/*

 XML HTTP Request - include this script on a page, and call
 fncCallXMLData() to load an ASP file:

 fncCallXMLData("xml.asp?x=y", false, "fncSetThis()")

*/

var objXMLHttpRequest;

function fncCallXMLData(strURL, blnNoCache, strFunction) {
	// strURL - URL to "get"
	// blnNoCache - normally, results are cached (better performance); set to true to prevent caching (for real-time data)
	// strFunction - function to call after URL is loaded
	objXMLHttpRequest = false;
	if (window.XMLHttpRequest) {
		// branch for native XMLHttpRequest object
		try {
			objXMLHttpRequest = new XMLHttpRequest();
		} catch(e) {
			objXMLHttpRequest = false;
		}
	} else if (window.ActiveXObject) {
		// branch for IE/Windows ActiveX version
		try {
			objXMLHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				objXMLHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				objXMLHttpRequest = false;
			}
		}
	}
	if (objXMLHttpRequest) {
		objXMLHttpRequest.onreadystatechange = function() {
			eval(strFunction)
		}
		objXMLHttpRequest.open("GET", strURL, true);
		if (blnNoCache) {
			// prevent caching
			objXMLHttpRequest.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
		}
	objXMLHttpRequest.send("");
	}
}

function fncProcessRequest(strFunction) {
    // only if req shows "loaded"
    if (objXMLHttpRequest.readyState == 4) {
        // only if "OK"
        if (objXMLHttpRequest.status == 200) {
            // ...processing statements go here...
			eval(strFunction)
        } else {
            alert("There was a problem retrieving the XML data:\n" +
                objXMLHttpRequest.statusText);
        }
    }
}

