/*	AJAXTools.js		Created:  2.15.07	Creator:  M. Kircher, Mainline Media LLC	Modified: ---	*///var xmlHttp;var action = "";function createXMLHttpRequest(){	if(window.ActiveXObject)	  {	xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");	}	else if(window.XMLHttpRequest){	xmlHttp = new XMLHttpRequest();						}}function startRequest(url, method){	createXMLHttpRequest();	xmlHttp.onreadystatechange = handleStateChange;	url = url+"&timestamp="+new Date().getTime();	xmlHttp.open(method, url, true);	if(method == "POST"){		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	}	xmlHttp.send(null);}function handleStateChange(){	if(xmlHttp.readyState == 4){		if(xmlHttp.status == 200){			//xmlHttp.responseXML;		}	}}/* --- RSS --- */var RSSfeedDir 			= "feeds/"var RSStemplateDir 		= "templates/";var RSStemplateDefault 	= RSStemplateDir+"simple-template1.html";var RSStemplate;RSSRequest = function(id){	this.id = id;	if(window.ActiveXObject)	  {	this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");	}	else if(window.XMLHttpRequest){	this.xmlHttp = new XMLHttpRequest();					}}RSSRequest.prototype.setDOMid = function(DOMid){	this.DOMid = DOMid;}function getRSS(xmlfile, maxItems, template, id, isLocal){		if(document.getElementById(id)){		//determine template to use		if(template != ""){ RSStemplate = RSStemplateDir+template; }		else 			  { RSStemplate = RSStemplateDefault; }				//determine path of xml file		var xml = xmlfile;		if(isLocal){ xml = RSSfeedDir+xmlfile; }				//create RSSRequest object		var url = "rss/rss2html.php?XMLFILE="+xml+"&TEMPLATE="+RSStemplate;				//create url for rss2html.php		if(maxItems >= 0 && maxItems !== null){			url +="&MAXITEMS="+maxItems;		}		var obj = new RSSRequest("rssRequest_"+new Date().getTime()+Math.random());		//create RSSRequest object w/ unique id		obj.setDOMid(id);																//set DOM id for RSSRequest object				//start RSSRequest object's request to server		startRSSRequest(url, obj);	}}function startRSSRequest(url, RSSReqObj){		//set up handler object/function	RSSReqObj.xmlHttp.onreadystatechange = function(){		if(RSSReqObj.xmlHttp.readyState == 1){					if(!document.getElementById(RSSReqObj.id+"_wait_icon")){				var RSSwaitingIcon = createRSSwaitingIcon();				RSSwaitingIcon.id = RSSReqObj.id+"_wait_icon";				RSSwaitingIcon.setAttribute("class", "rss_wait_icon");				RSSwaitingIcon.setAttribute("className", "rss_wait_icon");				var container = document.getElementById(RSSReqObj.DOMid);				if(container){					container.appendChild(RSSwaitingIcon);				}			}		}		else if(RSSReqObj.xmlHttp.readyState == 4){			removeRSSwaitingIcon(RSSReqObj.id+"_wait_icon");			if(RSSReqObj.xmlHttp.status == 200){				insertRSS(RSSReqObj);			}		}		}		//create a unique url with timestamp	url = url+"&timestamp="+new Date().getTime();		RSSReqObj.xmlHttp.open("POST", url, true);	RSSReqObj.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	RSSReqObj.xmlHttp.send(null);}function createRSSwaitingIcon(){	var icon = document.createElement('img');	icon.src = 'images/rss_waiting.gif';	icon.alt = 'Loading RSS...';	return icon;}function removeRSSwaitingIcon(id){	var icon = document.getElementById(id);	icon.parentNode.removeChild(icon);}function insertRSS(RSSReqObj){	//insert formatted RSS2html.php response into DOM	if(document.getElementById(RSSReqObj.DOMid)){		document.getElementById(RSSReqObj.DOMid).innerHTML += RSSReqObj.xmlHttp.responseText;	} else {		var newContainer = document.createElement('div');		var main_content = document.getElementById('main-content');		newContainer.innerHTML = RSSReqObj.xmlHttp.responseText;		main_content.appendChild(newContainer);	}	setColumnHeights();}