

function loadAJAX( request ) {

	if(window.XMLHttpRequest) {
		request = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		request = new ActiveXObject("MSXML2.XMLHTTP");
	}

	return request;
}

function checkReadyState( obj, location, message ) {
//	if( location == '' )
//		location = 'status';
	if( message == '' )
		message = 'Working...';

	if(obj.readyState == 0) {  }
	if(obj.readyState == 1) { document.getElementById( location ).innerHTML = '<div style="height:17px;"><img width="15px" style="margin-right:10px;" src="images/wait.gif" />' + message + '</div>'; }
	if(obj.readyState == 2) {  }
	if(obj.readyState == 3) {  }
	if(obj.readyState == 4)
	{
		document.getElementById(location).innerHTML = "";
	
		if(obj.status == 200) {
			return true;
		} else if(obj.status == 404) {
			// trouble retrieving xml file... treat as unknown error 
			document.getElementById(location).innerHTML = "Requested File Not Found.";
		} else {
			// other error
			document.getElementById(location).innerHTML = "Error:"+obj.status +" Please try Reloading the page" ;
		}
	}
}

