function httpobj(url,paramsarray) {
  try {
  this.obj = new XMLHttpRequest()
  }
  catch (e) {
    try {
      this.obj = new ActiveXObject("Msxml2.XMLHTTP")
    }
    catch (e) {
      try {
        this.obj = new ActiveXObject("Microsoft.XMLHTTP")
      }
      catch (e) {        
        alert("Your browser does not support HTTP Request! Get a new one (a browser, that is. Not a request).")
        return
      }
    }
  }
  
  this.obj.params=""
  this.obj.sparams=""
  this.obj.method="POST"
}

httpobj.prototype.url=function(value) {
  if (this.obj) this.url=value
}

httpobj.prototype.func=function(value) {
  if (this.obj) this.obj.func=value
}

httpobj.prototype.method=function(value) {
  if (this.obj) this.obj.method=value
}

httpobj.prototype.add=function(name,value) {
  if (this.obj) {
    this.obj.params+="&"+name+"="+value
    this.obj.sparams+=",'"+replacements(name)+"':'"+replacements(value)+"'"
  }
}

function send(topobj) {
  if (topobj.obj) {
    topobj.obj.params=topobj.obj.params.substr(1)
    topobj.obj.sparams=topobj.obj.sparams.substr(1)
    if (topobj.obj.method.toLowerCase()=="get") topobj.obj.open("GET",topobj.url+"?"+topobj.obj.params,true)
    else topobj.obj.open("POST",topobj.url,true)
    topobj.obj.setRequestHeader("Content-type","application/x-www-form-urlencoded")
    topobj.obj.setRequestHeader("Content-length",topobj.obj.params.length)
    topobj.obj.setRequestHeader("Connection","close")
    topobj.obj.send(topobj.obj.params)
    
    topobj.obj.onreadystatechange=function() {
      if (this.func && (this.readyState==4 || this.readyState=="complete")) {
        if (this.status==200) eval(s_t_p(this.func,0,"'"+replacements(this.responseText)+"'","{"+this.sparams+"}"))
        else eval(s_t_p(this.func,1,"''","{"+this.sparams+"}"))
        delete topobj
      }
    }
  }
  else delete topobj
}

function replacements(str) {
  return (str+"").replace(/\'/g,"\\'").replace(/\"/g,'\\"').replace(/\r\n/g,"\\n").replace(/\r/g,"\\n").replace(/\n/g,"\\n")
}

function s_t_p(func,astate,atext,aparams) {
  var ffunc, len, i, p, ca, cb
  len=func.length
  p=new Array()
  p[0]=0
  p[1]=0
  
  for (i=1;i<len;i++) {
    ca=func.substr(i-1,1)
    cb=func.substr(i,2)
    if (ca!="\\" && (cb=="'" || cb=='"')) p[p.length]=i
  }
  p[p.length]=len
  
  ffunc=""
  len=p.length
  for (i=1;i<len;i+=2) {
    ffunc+=func.substr(p[i-1],p[i]-p[i-1])
    ffunc+=func.substr(p[i],p[i+1]-p[i]).replace(/text/i,atext).replace(/params/i,aparams).replace(/state/i,astate)
  }
  return ffunc
}