  function Server() {
    this.loaded = false;
    this.requestobj = false;
  }

  Server.prototype.load = function() {
    if ( this.loaded == false ) {
      this.loaded = this.loadrequestobj(); //probeer te laden
    }
    return this.loaded;
  }

  Server.prototype.loadrequestobj = function () {
    if (window.XMLHttpRequest){ // if Mozilla, Safari etc or IE7
      this.requestobj = new XMLHttpRequest();
      if ( this.requestobj.overrideMimeType ) {
        this.requestobj.overrideMimeType('text/xml');
      }
      return true;
    } else if (window.ActiveXObject) { // if IE, not IE7
      try {
        this.requestobj = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
        try {
          this.requestobj = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
          return false;
        }
      }
      return true;
    }
    return false;
  }

  Server.prototype.GETrequest = function(url,data,func) {
    if ( !this.load() ) {
      return false;
    }
    this.requestobj.open('GET', url+'?'+data, true);
    if ( func ) {
      this.requestobj.onreadystatechange = func;
    }
    this.requestobj.send(null);
    return true;
  }

  Server.prototype.POSTrequest = function(url,data,func) {
    if ( !this.load() ) {
      return false;
    }
    this.requestobj.open('POST', url, true);
    if ( func ) { 
      this.requestobj.onreadystatechange = func;
    }
    this.requestobj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    this.requestobj.setRequestHeader("Content-length", data.length);
    this.requestobj.setRequestHeader("Connection", "close");
    this.requestobj.send(data);
    return true;
  }

  Server.prototype.Ontvangst = function() {
    if ( this.requestobj.readyState != 4 ) { 
      return false;
    } else if ( this.requestobj.status != 200 ) { 
      return 'Fout: ' + this.requestobj.statusText;
    } else { 
      return this.requestobj.responseText;
    }  
  }

