function Request()
{
}

Request.prototype.dataURL = "";
Request.prototype._request = "";
Request.prototype.type = "GET";
Request.prototype.postdata = "";
Request.prototype.ResponseText = "";
Request.prototype.name = "";

Request.prototype.onLoad = 0;
Request.prototype.Busy = false;
Request.prototype.Aborting = false;

Request.prototype.SetBusy = function(a_value)
{
  this.Busy=a_value;
}

Request.prototype.GetBusy = function()
{
  return this.Busy;
}

Request.prototype.go = function()
{

  if (this.GetBusy())
  {
    if(this.onError)this.onError("busy");
    return false;
  }

  this.SetBusy(true);

  this._request = this._getXMLHTTPRequest();

  var _this = this;

  this._request.onreadystatechange = function(){_this._onData()};
  var rnd=Math.random();
  if (this.dataURL.match(/\?/g))
    this.dataURL=this.dataURL+'&sm='+rnd;
  else
    this.dataURL=this.dataURL+'?sm='+rnd;

  this._request.open(this.type, this.dataURL, true);

  if (navigator.appName!='Microsoft Internet Explorer')
  {
  this._request.setRequestHeader("User-Agent", "");
  this._request.setRequestHeader("Accept", "");
  this._request.setRequestHeader("Accept-Language", "");
  this._request.setRequestHeader("Accept-Charset", "");
  }

  if (this.type=='POST')
  {
    this._request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  }

  this._request.send(this.postdata);
  
  return true;
}

Request.prototype.abort = function()
{
  if (this._request)
  {
    this.Aborting=true;
    this._request.abort();
    this.Aborting=false;

    delete this._request;
  }
  _request=0;

  this.SetBusy(false);
}

Request.prototype._onData = function()
{
  if (this.Aborting)return;
  
  if(this._request.readyState == 4)
  {
    var __status=-1;
    try{__status=this._request.status;}catch(e){}
    if(__status == "200")
    {
      this.ResponseText=this._request.responseText;
      var textin_l=0;var headin_l=0;
      try{textin_l=this.ResponseText.length;}catch(e){}
      try{headin_l=this._request.getAllResponseHeaders().length;}catch(e){}
      this.HeadersLength=headin_l;
      this.TextLength=textin_l;
      this.TotalLength=textin_l+headin_l;

      if(this.onLoad)this.onLoad();
    }
    else
    {
      if(this.onError)this.onError('connectlost');
    }
    this.abort();
  }
}

Request.prototype._getXMLHTTPRequest = function()
{
  var xmlHttp;
  try
  {
    xmlHttp = new ActiveXObject("Msxml2.XMLHttp");
  }
  catch(e)
  {
    try
    {
      xmlHttp = new ActiveXObject("Microsoft.XMLHttp");
    }
    catch(e2)
    {
    }
  }

  if(xmlHttp == undefined && (typeof XMLHttpRequest != 'undefined'))
  {
    xmlHttp = new XMLHttpRequest();
  }

  return xmlHttp;
}

JS_REQUEST_Ready=true;
