﻿
function SendRequest(Url, Params, oWait, oSender)
{
    if (oSender != null)
    {
        img = document.createElement("img");
        img.setAttribute("src", ((document.location.href.indexOf("Admin/")==-1) ? "": "../") + "Images/Wait.gif");
        oWait.appendChild(img);
        oSender.style.display = 'none';        
    } 
    Req = InitXMLHTTPRequest();
    if (Req)
    {
        function ReadyStateChange()
        {
            if (Req.readyState == 4)
            {
                if (oSender != null)
                {
                    oWait.removeChild(img);            
                    oSender.style.display = "";  
                }
                document.body.onmousedown = null;
                OnRun(Req.responseText);
            }
        }          
        document.body.onmousedown = new Function("alert('Wait')");
        Req.onreadystatechange = ReadyStateChange;
        Req.open("POST", Url, true);
        Req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        Req.send(Params);
    }
}

function InitXMLHTTPRequest()
{
    var xRequest = null;
    if (window.XMLHttpRequest)
    {
        xRequest = new XMLHttpRequest();
    } 
    else if (window.ActiveXObject)
    {
        xRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    return xRequest;
}
 
function OnRun(ResponseText)
{
}



