//var Ajax = {};
if(typeof(Ajax)=="undefined")
{
    Ajax={};
}
Ajax.getXmlHttpObject = function(){
 var objHttp = null;
 if (window.XMLHttpRequest)
 {
  objHttp = new XMLHttpRequest();
  if (objHttp.overrideMimeType){
   objHttp.overrideMimeType("text/xml");
  }
 }
 else if(window.ActiveXObject)
 {
  try
  {
   objHttp = new ActiveXObject("MSXML2.XMLHTTP");
  }
  catch(e)
  {
   try
   {
    objHttp = new ActiveXObject("Microsoft.XMLHTTP");
   }
   catch(e)
   {
    objHttp = false;
   }
  }
 }
 return objHttp;
}
Ajax.Get = function(uri,aysn){
 var http = this.getXmlHttpObject();
 if (aysn)
 {
  http.onreadystatechange = function()
  {
   //http.readyState是等于4的,也就是说“完成”了
   //200是OK，一切正常
   //aysn为带参数的javascript函数
   if(http.readyState == 4)
   {
    if(http.status == 200)
    {
     aysn(http.responseText);
    }
   }
  }
 }
 
 if(uri.indexOf("?") > 0)
  uri += "&rnd=";
 else 
  uri += "?rnd=";
 uri += Math.round(Math.random()*100)+200;
 /**/
 //===发送====
 http.open("GET",uri,aysn?true:false);
 http.setRequestHeader('Content-Type','gb2312');
 http.send(null);
}
Ajax.Set = function(uri,obj){
 var http = this.getXmlHttpObject();
 if (obj)
 {
  http.onreadystatechange = function()
  {
   if(http.readyState == 4)
   {
    if(http.status == 200)
    {
     eval(obj).innerHTML=http.responseText;
    }
   }
  }
 }
 if(uri.indexOf("?") > 0)
  uri += "&rnd=";
 else 
  uri += "?rnd=";
 uri += Math.round(Math.random()*100)+200;
 http.open("GET",uri,obj?true:false);
 http.setRequestHeader('Content-Type','gb2312');
 http.send(null);
}
Ajax.Post=function(uri,aysn2,xml){
    var http = this.getXmlHttpObject();
 if (aysn2)
 {
  http.onreadystatechange = function()
  {
   if(http.readyState == 4)
   {
    if(http.status == 200)
    {
     aysn2(http.responseText);
    }
   }
  }
 }
 if(uri.indexOf("?") > 0)
  uri += "&rnd=";
 else 
  uri += "?rnd=";
 uri += Math.round(Math.random()*100)+200;
 http.open("post",uri,true);
 //http.setRequestHeader('Content-Type','gb2312'); 不能用否则错误  
 http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
 http.send(xml);
}
/*
//创建XML 
function CreateXML(){ 
    var xml = "<user>"; 
    xml = xml + "<name>sunjianbin<\/name>"; 
    xml = xml + "<password>7980421<\/password>"; 
    xml = xml + "<\/user>"; 
    return xml; 
} 
*/


