function TJ_HTTP() {
  if (window.XMLHttpRequest) {
    this.xmlHttp = new XMLHttpRequest();
  } else {
    this.xmlHttp = new ActiveXObject('Msxml2.XMLHTTP')||new ActiveXObject('Microsoft.XMLHTTP');
  }
}

TJ_HTTP.prototype.asyncStateChange = function() {
  if (this.xmlHttp.readyState==4) {
    var status = 0;
    var statusText = "";
    var response = "";
    try {status = this.xmlHttp.status; response=this.xmlHttp.responseText; statusText=this.xmlHttp.statusText} catch(e){}
    if (status==200 || status == 0)
      this.callback(response);
    else
      this.callback("Error:"+statusText);
    delete this.xmlHttp;
  }
}

TJ_HTTP.prototype.getAsync = function(url, callback) {
  this.callback = callback;
  this.xmlHttp.open("GET", url, true); 
  var tjHttp = this;
  this.xmlHttp.onreadystatechange=function(){tjHttp.asyncStateChange()};
  this.xmlHttp.send(null); 
}

TJ_HTTP.prototype.postAsync = function(url, params, callback) {
  this.callback = callback;
  this.xmlHttp.open("POST", url, true); 
  this.xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  this.xmlHttp.setRequestHeader("Content-length", params.length);
  var tjHttp = this;
  this.xmlHttp.onreadystatechange=function(){tjHttp.asyncStateChange()};
  this.xmlHttp.send(params);
}