﻿// JScript File
var xmlHttp = GetXmlHttpObject();
function Ajax_Send(URL_Params, ReceiveMethod)
{     
    strUrl = "CallbackManager.aspx?cachebuster=" + new Date().getTime() + "&" + URL_Params;
    
    try{      
        xmlHttp.open("GET", strUrl, true);
        xmlHttp.onreadystatechange = ReceiveMethod; 
        xmlHttp.send(null);
    }
    catch(e){alert(e.message);}
}

function Ajax_Send_W(URL_Params, ReceiveMethod) {
    
    var sPath = '';
    var sPage = '';
    
    try {   
        sPath = window.location.pathname;
        sPage = sPath.substring(sPath.lastIndexOf('/') + 1).replace(".aspx", "");
        if (sPage == null)
            sPage = '';

        //alert(sPage);
    }
    catch (ex) { }

    strUrl = "CallbackManagerW.aspx?cachebuster=" + new Date().getTime() + "&" + URL_Params + "&pageName=" + sPage;

    try {
        xmlHttp.open("GET", strUrl, true);
        xmlHttp.onreadystatechange = ReceiveMethod;
        xmlHttp.send(null);
    }
    catch (e) { alert(e.message); }
}

function Ajax_Send_receipt(URL_Params, ReceiveMethod)
{     
    strUrl = "CallbackManager_receipt.aspx?cachebuster=" + new Date().getTime() + "&cb=" + URL_Params;
    
    try{      
        xmlHttp.open("GET", strUrl, true);
        xmlHttp.onreadystatechange = ReceiveMethod; 
        xmlHttp.send(null);
    }
    catch(e){alert(e.message);}
}

function Ajax_Send_Supplements(URL_Params, ReceiveMethod)
{         
    strUrl = "CallbackManager_Supplements.aspx?cachebuster=" + new Date().getTime() + "&cb=" + URL_Params;
    
    try{      
        xmlHttp.open("GET", strUrl, true);
        xmlHttp.onreadystatechange = ReceiveMethod; 
        xmlHttp.send(null);
    }
    catch(e){alert(e.message);}
}

function Ajax_Send_Supplements_W(URL_Params, ReceiveMethod) {
    strUrl = "CallbackManager_Supplements_W.aspx?cachebuster=" + new Date().getTime() + "&cb=" + URL_Params;

    try {
        xmlHttp.open("GET", strUrl, true);
        xmlHttp.onreadystatechange = ReceiveMethod;
        xmlHttp.send(null);
    }
    catch (e) { alert(e.message); }
}


function Ajax_Receive()
{
    strReceive = "";
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
          strReceive = xmlHttp.responseText;
    return strReceive;
}

function GetXmlHttpObject()
{ 
    var objXMLHttp=null;
    if (window.XMLHttpRequest)
    {
        objXMLHttp=new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    return objXMLHttp;
}

function Ajax_Send_FreeBees(URL_Params, ReceiveMethod)
{     
    strUrl = "CallbackManagerFreeBees.aspx?cachebuster=" + new Date().getTime() + "&" + URL_Params;   
    try{      
        xmlHttp.open("GET", strUrl, true);        
        xmlHttp.onreadystatechange = ReceiveMethod;     
        xmlHttp.send(null);    
    }
    catch(e){alert(e.message);}   
}

