
/* ---------------------------- */
/* Slim Ajax pipe by Simon	*/
/* ---------------------------- */
var containerName;

$GLOBALS = {};
$GLOBALS['containerName'] = "";



function createObject() {
	var request_type;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
	request_type = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_type = new XMLHttpRequest();
	}
		return request_type;
}

var http = createObject();

function fetch(fileName,containerName,URLString,loadText) {
$GLOBALS['containerName'] = containerName;
	
	if(loadText !== "")
	document.getElementById(containerName).innerHTML="<img align='top' src='images/loading.gif'/> " + loadText;
	
	nocache = Math.random();
	
	http.open('get', fileName+".cfm?nocache="+nocache+"&"+URLString);
	
	http.onreadystatechange = processThings;
	http.send(null);
}

function processThings() {
if(http.readyState == 4){

	var response = http.responseText;
	
	ct = document.getElementById($GLOBALS['containerName']);
	
	if(response!=""){
		ct.innerHTML=response;
		ct.style.display="block";
		
	} else {
		ct.innerHTML="<strong>WHOA! ERROR! ABANDON SHIP!!</strong>";
		ct.style.display="block";
	}
}}








