function XHR_getHTTPObject() {
    var xmlhttp;
    /*@cc_on
      @if (@_jscript_version >= 5)
      try {
          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
          try {
              xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (e) {
              xmlhttp = false;
          }
      }
      @else
      xmlhttp = false;
      @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	try {
	    xmlhttp = new XMLHttpRequest();
	} catch (e) {
	    xmlhttp = false;
	}
    }
    return xmlhttp;
}

function XHR_updateContentFromURI(sFromUrl, oTargetElement) {
    var xmlhttp = XHR_getHTTPObject();
    try {
        document.body.style.cursor = "wait";
        xmlhttp.open("GET", sFromUrl);
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4) {
                document.body.style.cursor = "auto";
		oTargetElement.innerHTML = xmlhttp.responseText;
            };
        };
        xmlhttp.send(null);
        document.body.style.cursor = "auto";
    }
    catch(e){
        document.body.style.cursor = "auto";
	alert(e.message);
	//        throw e;
    };
};


function XHR_getDataFromURI(sFromUrl, callback) {
    var xmlhttp = XHR_getHTTPObject();
    try {
        document.body.style.cursor = "wait";
        xmlhttp.open("GET", sFromUrl);
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4) {
                document.body.style.cursor = "auto";
		        callback(xmlhttp.responseText);
            };
        };
        xmlhttp.send(null);
        document.body.style.cursor = "auto";
    }
    catch(e){
        document.body.style.cursor = "auto";
	alert(e.message);
	//        throw e;
    };
    
}


function XHR_getUrl(url, id) {
    if (!XHR_xmlhttp && typeof XMLHttpRequest!='undefined') {
	XHR_xmlhttp = new XMLHttpRequest();
    }
    
    if (XHR_xmlhttp) {
	XHR_putdatainid = id;
	XHR_xmlhttp.onreadystatechange = XHR_processReqChange 
	    XHR_xmlhttp.open("GET", url, true);
	XHR_xmlhttp.send(null);
    }
}
function XHR_processReqChange() {
    if (XHR_xmlhttp.readyState == 4 && XHR_putdatainid != null) {
        document.getElementById(XHR_putdatainid).innerHTML = XHR_xmlhttp.responseText;
        XHR_putdatainid = null;
        XHR_xmlhttp = false;
    }
}
