
function getXMLHttpRequest()
{try
{var req=new XMLHttpRequest();}
catch(e)
{try
{var req=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{try
{var req=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e)
{var req=false;}}}
return req;}
function XHR()
{this.params={method:'GET',url:'',content:null,asyncFlag:true,username:'',password:''};this.requestHeaders={};}
XHR.prototype.onLoad=function(req){}
XHR.prototype.onError=function(req){}
XHR.prototype.sendReq=function()
{this.abort();this.req=getXMLHttpRequest();var xhr=this;this.req.onreadystatechange=function()
{if(xhr.req.readyState==4)
{if(xhr.req.status==200||xhr.req.status==304)
{xhr.onLoad(xhr.req);}
else
{xhr.onError(xhr.req);}}}
for(var label in this.requestHeaders)
{this.req.setRequestHeader(label,this.requestHeaders[label]);}
this.req.open(this.params.method,this.params.url,this.params.asyncFlag,this.params.username,this.params.password);return this.req.send(this.params.content);}
XHR.prototype.abort=function()
{var ret=false;if(this.req&&this.req.readystate!=4)
{this.req.onreadystatechange=function(){};ret=this.req.abort();this.req=null;}
return ret;}