﻿//object detection to return the correct object depending upon broswer type. Used by the getAXHA(); function.
function objgetNewHttpObject() {
    var objType = false;
    try {
        objType = new ActiveXObject('Msxml2.XMLHTTP');
    } catch(e) {
        try {
            objType = new ActiveXObject('Microsoft.XMLHTTP');
        } catch(e) {
            objType = new XMLHttpRequest();
        }
    }
    return objType;
}
//Function used to update page content with new xhtml fragments by using a javascript object, the dom, and http.
function getDateInfo(url,elementContainer){
    document.getElementById(elementContainer).innerHTML = '<font size=2><i>loading data......</i></font>';
	var theHttpRequest = objgetNewHttpObject();
	theHttpRequest.onreadystatechange = function() {processAXAHDate(elementContainer);};
	theHttpRequest.open("GET", url);
	theHttpRequest.setRequestHeader("If-Modified-Since","0");
	theHttpRequest.send(null);
        
	function processAXAHDate(elementContainer){
	   if (theHttpRequest.readyState == 4) {
		   if (theHttpRequest.status == 200) {
			   document.getElementById(elementContainer).innerHTML = theHttpRequest.responseText;
		   } else {
		    //alert(theHttpRequest.responseText);
			   document.getElementById(elementContainer).innerHTML="<p><span class='redtxt'>Error!<\/span> HTTP request return the following status message:&nbsp;" + theHttpRequest.statusText +"<\/p>";
		   }
	   }
	}
}

