function najaxRequest(obj,url,parameters,method,mime,oload) {
  this.req=false;
  this.url=url;
  this.parameters=parameters;
  this.method=method;
  this.obj=obj;
  this.mime=mime;

  this.sendRequest=function(){
    this.req=false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
       this.req=new XMLHttpRequest();
       if (this.req.overrideMimeType) {
          this.req.overrideMimeType(mime);
       }
    } else if (window.ActiveXObject) { // IE
       try {
          this.req=new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             this.req=new ActiveXObject("Microsoft.XMLHTTP");
          } catch (e) {}
       }
    }
    if (!this.req) {
      alert('Cannot create XMLHTTP instance');
      return false;
    }
    
    var self=this;
    
    if (this.method=='post'){
      //this.parameters=null;
      this.req.open(this.method,this.url,true);
      this.req.onreadystatechange=function(){self.handleResponse(self);}
      this.req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      this.req.setRequestHeader("Content-length", this.parameters.length);
      this.req.setRequestHeader("Accept-Charset","UTF-8");
      this.req.setRequestHeader("Connection", "close");
      this.req.send(this.parameters);
    }
    else{
      this.parameters="?"+this.parameters;
      if (this.parameters.length>1) this.parameters+='&';
      this.parameters+='r='+Math.floor(Math.random()*10000);
      this.req.open(this.method,this.url+this.parameters,true);
	    this.req.onreadystatechange=function(){self.handleResponse(self);}
      this.req.send(null);
    }
  }
  
  this.handleResponse = function(t){
    if (t.req.readyState == 4) {
        if (t.req.status == 200) {
          ctype=t.req.getResponseHeader("Content-Type").split(";")[0];
          if (ctype=='application/xml') {
            //XML parser
          }
          else if (ctype=='text/plain' || ctype=='text/html') {
            if (t.obj!=null) t.obj.innerHTML=t.req.responseText;
            else alert(t.req.responseText);
          }
          else if (ctype=='text/javascript') {
            eval(t.req.responseText);
          } else {
            alert("Unknown content type!");
          }
          eval(oload);
        } else {
            alert("There was a problem retrieving data:\n" + t.req.statusText);
        }
      }
  }
  this.sendRequest();
}
