 /* AJAXºËÐÄÀà£¬ÐÜÐÇ */
 var netAjax = new Object();
 netAjax.READY_STATE_COMPLETE=4;
 
 netAjax.Loader = function(url,oncallback,method,param,onerror)
 {
    this.url = url;
    this.method = method ? method : "GET";
    this.param = param ? param : null;
    this.xmlHttp = null;
    this.oncallback = oncallback;
    this.onerror = (onerror) ? onerror : this.defaultError;
    this.loadXmlDoc(url);
 }
 netAjax.Loader.prototype={
   loadXmlDoc:function(url){
     if (window.XMLHttpRequest){
        this.xmlHttp = new XMLHttpRequest();
     } else if (window.ActiveXObject){
        this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); //IE
     }
     if (this.xmlHttp){
        try{
            var loaderTemp = this;
            this.xmlHttp.onreadystatechange = function(){
                loaderTemp.onReadyState.call(loaderTemp);
            }
            if (this.method == "POST"){
                this.xmlHttp.open('POST',url,true);
                this.xmlHttp.setRequestHeader("Content-Length",this.param.length);    
                this.xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
            }else{
                this.xmlHttp.open('GET',url,true);
            }
            this.xmlHttp.send(this.param);
        }catch(err){
            this.onerror.call(this);
        }
     }
   },
   onReadyState:function(){
    var http = this.xmlHttp;
    var ready = http.readyState;
    if (ready == netAjax.READY_STATE_COMPLETE){
        if(http.status == 200 || http.status == 0){
            this.oncallback.call(this);
        }else{
            this.onerror.call(this);
        }
    }
   },
   defaultError:function(){
    alert("error :" + this.xmlHttp.getAllResponseHeaders());
   }
}
