
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.XMLDOM");
					}
				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;
		else this.requestobj.onreadystatechange = null;
		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;
		else this.requestobj.onreadystatechange = null;		
		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.OntvangstText = function() {
		if( this.requestobj.readyState != 4 ) return false;
		else if( this.requestobj.status != 200 ) return 'Fout: '+this.requestobj.statusText;
		else return this.requestobj.responseText;
		};
SERVER.prototype.OntvangstXML = function() {
		if( this.requestobj.readyState != 4 ) return false;
		else if( this.requestobj.status != 200 ) return 'Fout: '+this.requestobj.statusText;
		else return this.requestobj.responseXML;
		}
function SERVER() {
	this.loaded = false;
	this.requestobj = false;
	};
