var XMLHTTP;

function GetXMLHTTP() {
  var result = null;
  try {
    result = new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch(e){
    try {
      result = new ActiveXObject("Microsoft.XMLHTTP") 
    }
    catch(sc) {
      result = null;
    }
  }
  if (!result && typeof XMLHttpRequest != "undefined") {
    result = new XMLHttpRequest();
  }
  return result;
}


function getServerData(url, callback) {
  if (XMLHTTP && XMLHTTP.readyState!=0) {
    XMLHTTP.abort() 
  }  
  XMLHTTP = GetXMLHTTP();
  if (XMLHTTP) {
    XMLHTTP.open("GET", url, true);
    
    XMLHTTP.onreadystatechange = function() {
      if (XMLHTTP.readyState == 4 && XMLHTTP.responseText) {
        if (XMLHTTP.responseText.charAt(0) == "<") {
          //alert(XMLHTTP.responseText);
        } 
        else {
          //alert(XMLHTTP.responseText);
          //eval(XMLHTTP.responseText);
        }
        callback(XMLHTTP.responseText);
      }
    }
    
    XMLHTTP.send(null)
  }
}

