﻿//---------->>>  Global Variables  <<<----------//
var XpHttpRequest=null;
//---------->>>  AJAX Methods  <<<----------//
function xpCreateXMLHttpObject(){
    if(typeof XMLHttpRequest!="undefined"){
        return new XMLHttpRequest();
    }
    else if(window.ActiveXObject){
        var aVersions=["MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];
        for(var i=0,imax=aVersions.length;i<imax;i++)
            try{
                var obj=new ActiveXObject(aVersions[i]);
                return obj;
            }catch(ex){/* Do nothing */}
    }
    throw new Error("XMLHttp object could not be created.");
}
function xpSendHttpRequest(method,url,async,func,qs){
    try{
        if(!XpHttpRequest)XpHttpRequest=xpCreateXMLHttpObject();
        xpAssert(!!XpHttpRequest,"XpHttpRequest object could not be created.");
        XpHttpRequest.open(method,url,async);
        XpHttpRequest.onreadystatechange=func;
        if(method.toLowerCase()=="post")XpHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
        if(!qs)qs=null;
        XpHttpRequest.send(qs);
    }catch(ex){alert(ex.name+" in xpSendHttpRequest(): "+ex.message);}
}

