var xmlHttp;

function passResponse(sUrl, sFunction, params) { 
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert ("Browser does not support HTTP Request");
        return;
    }
    
    if (sUrl.indexOf("?") == -1) {
        sUrl = sUrl + "?sid=" + Math.random();
    } else {
        sUrl = sUrl + "&sid=" + Math.random();
    }
    
    xmlHttp.onreadystatechange = function () {
        if (xmlHttp && xmlHttp.readyState==4) {
            if (xmlHttp.status==200) {
                var resFunction = sFunction + "(xmlHttp.responseText, '" + params + "')";
                document.body.style.cursor = "";
                eval(resFunction);
            }
        }   
    } 

    document.body.style.cursor = "wait";
    setTimeout("clearCursor()", 1000);
    xmlHttp.open("GET", sUrl, true);
    xmlHttp.send(null);
}

function GetXmlHttpObject() {
    var xmlHttp = null;
    try {
        // Firefox, Opera 8.0+, Safari
        xmlHttp = new XMLHttpRequest();
    } catch (e) {
        //Internet Explorer
        try {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
        } catch (e) {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
    }
    return xmlHttp;
}

function clearCursor() {
    document.body.style.cursor = "";
}
