var oldresults = new Array(); 
oldresults[0] = "";
oldresults[1] = "";
oldresults[2] = "";
oldresults[3] = "";
oldresults[4] = "";
var results = new Array(); 
results[0] = "";
results[1] = "";
results[2] = "";
results[3] = "";
results[4] = "";
function jah(url,target,olddata) {

 // native XMLHttpRequest object
    /*document.getElementById(target).innerHTML = 'sending...'; */
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
		
        req.onreadystatechange = function() {jahDone(target,olddata);};
        req.open("GET", url, true);
        req.send(null);
    // IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = function() {jahDone(target,olddata);};
            req.open("GET", url, true);
            req.send(null);
        }
    }
}    

//THIS SCRIPT DOES NOT USE olddate properly it doesnt remember the last data if new data is sent
// MEANING the page will blink all the time if there are 2 scripts calling these functions
// Even when there is no new data
function jahDone(target,olddata) {
    // only if req is "loaded"
	//alert("OLD DATA VARIABLE NAME="+ olddata);
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            results[olddata] = req.responseText;

			if(oldresults[olddata] != results[olddata]) { // Stops the page from being refreshed if there is no new data
			//alert("OLDDATA!!!!!!!!!!" + oldresults[olddata]);
			//alert("RESULTDATA!!!!!!!!!!" + results[olddata]);
			document.getElementById(target).innerHTML = results[olddata];
			oldresults[olddata] = results[olddata];
				var myregexp = new RegExp("(?:<script[^>]*>)([^</]*?)(?:</script[^>]*>)", "im"); 
                var match = myregexp.exec(req.responseText); 
                if (match != null) 
                { 
                       // alert("JAH=" + match[1]);
					  //Parses javascript inside an innerhtml
						eval(match[1]); 
                } 	
			//alert(req.responseText);
			//alert(oldresults);
            } 
        } else {
            document.getElementById(target).innerHTML="jah error:\n" +
                req.statusText;
		 }
    }
}
