var xmlhttp;

function xmlHTTPRequest(url,method,data)
{
  if(!method) {
    method="GET";
  }
  if(!data) {
    data=null;
  }

  var req=xmlHTTPRequestObject();
  if (req) {
    req.open(method,url,false);
    if(method=="POST") {
      req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    }
    req.send(data);
    return req.responseText;
  }

  return false;
}

function xmlHTTPAsyncRequest(url,method,data,callbackr,respVar){
  if(!method) method="GET";
  if(!data) data=null;
  if(typeof(respVar)=="undefined") respVar="xmlhttp";
  eval(respVar+'=xmlHTTPRequestObject()');
  if(eval(respVar)){
    eval(respVar+'.onreadystatechange='+callbackr+';');
    eval(respVar+'.open(method,url,true)');
    if(method=="POST") eval(respVar+".setRequestHeader('Content-Type','application/x-www-form-urlencoded')");
    eval(respVar+'.send(data)');
    return eval(respVar);
  }
}

function xmlHTTPRequestObject() {
  var o=false;
  var oIDs=new Array("Microsoft.XMLHTTP","Msxml2.XMLHTTP","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP.4.0");
  var success=false;
  for(i=0;!success && i<oIDs.length;i++) {
    try {
      o=new ActiveXObject(oIDs[i]);
      success=true;
    } catch(e){o=false;}
  }
  if (!o) o=new XMLHttpRequest();
  return o;
}

function isXMLHTTPRequestSupported(){return xmlHTTPRequestObject != null;}
