/* Gebruik : var ajax1 = new new_Ajax(); 
/* ajax1.run("timer.php","id_naam"); */
 
function nAjax() {
  this.xmlhttp = null;
  this.element="";
  this.page="";
  var self="";
 
  this.initnAjax=function() {
    try {
      this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e1) {
      try {
        this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e2) {
        this.xmlhttp = null;
      }
    }
 
    if (! this.xmlhttp) {
      if (typeof XMLHttpRequest != "undefined") {
        this.xmlhttp = new XMLHttpRequest();
      } else {
        this.failed = true;
      }
    }
  };
 
  this.run=function (page,element) {
    self = this;
    if (this.xmlhttp) {
      if (self.xmlhttp.readyState >= 1 && self.xmlhttp.readyState <= 3) { self.xmlhttp.abort();}
      this.now = new Date();
      this.xmlhttp.open("GET", page + "?t=" + this.now.getTime(), true);
      this.xmlhttp.onreadystatechange = function () {
        if(self.xmlhttp.readyState == 4){
            document.getElementById(element).innerHTML = self.xmlhttp.responseText;
        }
      }
      this.xmlhttp.send(null);
    }
  }
  this.initnAjax();
}
