<!--
	// *********************************************************
	// This code Copyright (c) 2006 Jayisgames.com
	// *********************************************************
	/////////////////////////////////////////////////////////////////
	//  Globals and trace window supporting code
	/////////////////////////////////////////////////////////////////
	//function OpenScrollWindow(theURL,winName,theWidth,theHeight) {
	//	return window.open(theURL,winName,'width='+theWidth+',height='+theHeight+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,top='+((screen.height/2)-(theHeight/2))+',left='+((screen.width/2)-(theWidth/2))+'');
	//}
	//var trace = OpenScrollWindow('traceoutput.html','trace',300,200);
	function log(string) {
		//trace.document.write(string+"<br />");
	}
	/////////////////////////////////////////////////////////////////
	//  Begin AJAX code
	/////////////////////////////////////////////////////////////////
	/////////////////////////////////////////////////////////////////
	//  HTTP Object instantiation routine
	/////////////////////////////////////////////////////////////////
	//*********************************************************************
	// first, we create a XMLHttpRequest Object...
	function getHTTPObject() {
		var xmlhttp;
		// branch for IE/Windows ActiveX version
		if(window.ActiveXObject) {
			try {
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch(e) {
					log("Failed to create IE XMLHttpRequest object");
					xmlhttp = false;
				}
			}
		// branch for native XMLHttpRequest object
		} else if(window.XMLHttpRequest) {
			try {
				xmlhttp = new XMLHttpRequest();
				xmlhttp.overrideMimeType("text/xml"); 
			} catch(e) {
				log("Failed to create new XMLHttpRequest object");
				xmlhttp = false;
			}
		}
		return xmlhttp;
	}
	/////////////////////////////////////////////////////////////////
	//  HTTP response handlers
	/////////////////////////////////////////////////////////////////
	//*********************************************************************
	// If we got the information, load the entry data into the form
	function handleFetchExcerptResponse() {
		//first, is my 'object' complete (done getting info from server?)
		if (fetchExcerptHttp.readyState == 4) {
			//if I got something...
			if (fetchExcerptHttp.status==200) {
				log("got handleFetchExcerptResponse");
				// Use the XML DOM to unpack the data 
				var xmlDocument;
				var resultNode;
				var output = '';
				try {
					xmlDocument = fetchExcerptHttp.responseXML;
					// first check the status code
					resultNode = xmlDocument.getElementsByTagName('status');
					output += resultNode.item(0).firstChild.data;
					if(output == 'true') {
						//excerptFetched = true;
						var idNode = xmlDocument.getElementsByTagName('excerpt');
						showExcerpt(idNode.item(0).firstChild.data);
					} else log("error occurred while fetching excerpt");
					fetchExcerptIsWorking = false;
				} catch(e) {
					alert("handlefetchExcerptResponse: "+e.toString());
				}
			}
		}
	}
	//*********************************************************************
	/////////////////////////////////////////////////////////////////
	//  XMLHttpRequest routines w/supporting variables
	/////////////////////////////////////////////////////////////////
	//*********************************************************************
	// keep trying to load the excerpt, until it returns an indicator of success
	function fetchExcerpt(entryID) {
		//alert("fetchExcerpt called: "+entryID);
		if(fetchExcerptHttp && !fetchExcerptIsWorking && !excerptFetched) {
			log("fetchExcerpt called");
			fetchExcerptIsWorking=true;
			var now = new Date();
			var theUrl = "getExcerpt.php?id="+entryID+"&time="+now.getTime();
			fetchExcerptHttp.open('GET',theUrl,true);
			fetchExcerptHttp.onreadystatechange=handleFetchExcerptResponse;
			fetchExcerptHttp.send(null);
		} else if(!excerptFetched) window.setTimeout(fetchExcerpt,1000);
	}	
	// create an http object that will load a new excerpt from the database.
	var excerptFetched = true;
	var fetchExcerptHttp = getHTTPObject(); // create an HTTP Object
	var fetchExcerptIsWorking = false;
	//*********************************************************************
	/////////////////////////////////////////////////////////////////
	//  end AJAX code
	/////////////////////////////////////////////////////////////////
	//*********************************************************************
	function getExcerpt(theEntryID) {
		//alert("getExcerpt called for: "+theEntryID);
		if(excerptFetched) {
			excerptFetched = false;
			fetchExcerpt(theEntryID);
		}
		/* else {
			window.setTimeout("getExcerpt("+theEntryID+")",1000);
		}*/
	}
//-->