//Static Method
function MakeObject(){
    if (typeof XMLHttpRequest == "undefined") {
        try {return new ActiveXObject("Msxml2.XMLHTTP.6.0");}
        catch (e) {};
        try {return new ActiveXObject("Msxml2.XMLHTTP.3.0");} 
        catch (e) {};
        try {return new ActiveXObject("Msxml2.XMLHTTP");} 
        catch (e) {};
        try {return new ActiveXObject("Microsoft.XMLHTTP");} 
        catch (e) {};
    }
    else  return new XMLHttpRequest();
}

Method_Get = "GET";
Method_Post = "POST";
ReadyState_UnInitialized = 0;
ReadyState_Open = 1;
ReadyState_Sent = 2;
ReadyState_Receiving = 3;
ReadyState_Loaded = 4;

var OnError = null;
var OnComplete = null;
var OnError2 = null;
var OnComplete2 = null;

function Load(method, url, async, ss,id){
if(handle){
if(handle.abort)handle.abort();
}
    var handle = MakeObject();
	if(id==1)handle.onreadystatechange = _readyChange;
	else if(id==2)handle.onreadystatechange = _readyChange2;

    handle.open(method, url,async);
    handle.send(ss);
}

function _readyChange(){
    if (this.readyState == ReadyState_Loaded) {
        if (this.status == 200) {
            if (OnComplete) 
                OnComplete(this, this.responseText);
        }
        else {
            if (this.OnError) 
                this.OnError(this, this.statusText);
        }
	   handle = null;
    }
}

function _readyChange2(){
    if (this.readyState == ReadyState_Loaded) {
        if (this.status == 200) {
            if (OnComplete2) 
                OnComplete2(this, this.responseText);
        }
        else {
            if (this.OnError2) 
                this.OnError2(this, this.statusText);
        }
	   handle = null;
    }
}




















