function fireTimer(_1)
{
  var _2=_1;
  function timerFired()
  {
    if(_2.inprogress)
    {
      _2._abortRequest(_2);
    }
  }
  _2._timeoutID=window.setTimeout(timerFired,_2.timeoutMS);
}

function R9HTTPXml() { /**/ }

R9HTTPXml.prototype = 
{
  uservars:null,
  url:null,
  postbuffer:null,
  xmlhttp:null,
  inprogress:false,
  thecallback:null,
  timeoutMS:-1,
  _timeoutID:null,
  cancelled:false,
  init:function(_3,_4,_5)
  {
    this.url=_3;
    this.uservars=_5;
    this.postbuffer=_4;
    if(window.XMLHttpRequest)
    {
      this.xmlhttp=new XMLHttpRequest();
    }
    else
    {
      if(window.ActiveXObject)
      {
        this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      else
      {
        window.alert("Sorry your browser is not compatible with this functionality");
      }
    }
  },
  setTimeout:function(_6)
  {
    this.timeoutMS=_6;
  },
  asyncGET:function(_7)
  {
    if(this.inprogress)
    {
      throw "Call in progress";
    }
    
    var _8=this;
    
    if(_7==null)
    {
      _7=_8;
    }
    
    this.thecallback=_7;
    var _9=null;
    
    if(this.postbuffer==null)
    {
      this.xmlhttp.open("GET",this.url,true);
    }
    else
    {
      this.xmlhttp.open("POST",this.url,true);
      this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
      _9=this.postbuffer;
    }
    
    this.xmlhttp.onreadystatechange = function()
    {
      _8.stateChangeCallback(_8);
    };
    
    this.inprogress=true;
    this.cancelled=false;
    this.xmlhttp.send(_9);
    if(this.timeoutMS>0)
    {
      fireTimer(this);
    }
  },
  stateChangeCallback:function(_a)
  {
  switch(_a.xmlhttp.readyState)
  {
    case 1:
      try
      {
        if(!_a.cancelled) { _a.thecallback.onInit(); }
      }
      catch(e) { /**/ }
      break;
    case 2:
      try
      {
        if(_a.xmlhttp.status!=200&&_a.xmlhttp.status!=0)
        {
          if(!_a.cancelled)
          {
            window.status="error";
            _a.thecallback.onError(_a.xmlhttp.status,_a.xmlhttp.statusText,_a);
          }
          _a.xmlhttp.abort();
          _a.inprogress=false;
        }
      }
      catch(e)
      {
      }
      break;
    case 3:
      var _b;
      try
      {
        try
        {
          _b=_a.xmlhttp.getResponseHeader("Content-Length");
        }
        catch(e)
        {
          _b=NaN;
        }
        if(!_a.cancelled)
        {
          window.status="ping";
          _a.thecallback.onProgress(_a.xmlhttp.responseText,_b);
        }
      }
      catch(e)
      {
      }
      break;
    case 4:
      try
      {
        if(_a._timeoutID)
        {
          window.clearTimeout(_a._timeoutID);
          _a._timeoutID=null;
        }
        if(_a.inprogress)
        {
          _a.inprogress=false;
          if(!_a.cancelled)
          {
            window.status="done";
            _a.thecallback.onLoad(_a);
          }
        }
      }
      catch(e)
      {
      }
      finally
      {
        _a.inprogress=false;
      }
      break;
    }
  },
  cancelRequest:function()
  {
    var _c=this;
    this.cancelled=true;
    if(this._timeoutID)
    {
      window.clearTimeout(this._timeoutID);
      this._timeoutID=null;
    }
    _c._abortRequest(_c);
  },
  _abortRequest:function(_d)
  {
    if(_d.xmlhttp!=null)
    {
      try
      {
        _d.xmlhttp.abort();
        if(_d.inprogress)
        {
          window.status="abort";
          _d.thecallback.onError("timeout","Your request has timed out.",_d);
        }
      }
      catch(e)
      {
      }
      _d.cancelled=true;
      _d.inprogress=false;
    }
  },
  getText:function()
  {
    return this.xmlhttp.responseText;
  },
  getXML:function()
  {
    return this.xmlhttp.responseXML;
  },
  getTags:function(_e)
  {
    try
    {
      return this.xmlhttp.responseXML.getElementsByTagName(_e);
    }
    catch(e)
    {
      return null;
    }
  },
  getOperaText:function(_f,_10,_11)
  {
    try
    {
      var _12=_f.getElementsByTagName(_10)[_11];
      if(_12)
      {
        var _13="",i=0,_15;
        while(_15=_12.childNodes[i])
        {
          _13+=_15.nodeValue;
          i++;
        }
        return _13;
      }
      else
      {
        return "";
      }
    }
    catch(e)
    {
      opera.postError("exception: "+e);
    }
  },
  getOpera:function(_16,_17,_18)
  {
    return "foo";
  },
  getTagText:function(_19,_1a,_1b)
  {
    var _1c=_19.getElementsByTagName(_1a)[_1b];
    if(_1c)
    {
      if(_1c.childNodes.length>1)
      {
        return _1c.childNodes[1].nodeValue;
      }
      else
      {
        if(_1c.childNodes.length==1)
        {
          return _1c.firstChild.nodeValue;
        }
      }
    }
    else
    {
      return "";
    }
  },
  onProgress:function(t,l) { },
  onError:function(s,t,c) { },
  onLoad:function(c) { },
  onInit:function(c) { }
};