﻿function getXMLRequester(){
   var xmlHttp;
   if (window.XMLHttpRequest){
       xmlHttp = new XMLHttpRequest();
       if (xmlHttp.overrideMimeType) {
         xmlHttp.overrideMimeType('text/xml');   }
   }else if (window.ActiveXObject){
       try{
              xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
       } 
       catch (e){
                try{
                     xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                }catch(e){
                     alert('对不起您的浏览器版本太低，请更新后使用。');
                     setTimeout("window.close();",100);}
          }   
   }
   return xmlHttp;
}
//get发送xmlHttp 
function ajaxGet(xmlHttp,path,raluFunc){
    if(raluFunc && raluFucn!=null)xmlHttp.onreadystatechange=raluFunc;
    xmlHttp.open("GET",path,true);ajaxSend(xmlHttp,null)
};
//post 发送xmlHttp
function ajaxPost(xmlHttp,path,parm,raluFunc){xmlHttp.onreadystatechange=raluFunc;
    xmlHttp.open("POST",path,true);
    xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-Length",parm.length);ajaxSend(xmlHttp,parm)
};
//发送xmlHttp
function ajaxSend(xmlHttp,parm){try{xmlHttp.send(parm)}catch(c){throw c;}};

function $get(id) {
     if(document.getElementById && document.getElementById(id)) 
     {
       return document.getElementById(id);
     } 
     else if (document.all && document.all(id)) 
     {
       return document.all(id);
     } 
     else if (document.layers && document.layers[id]) 
     {
       return document.layers[id];
     } 
     else 
     {
       return false;
     }
}  
