var SERVER = {
	loaded:false,
	requestobj:false,
	load:function(){
		if(SERVER.loaded == false){
			this.loaded = SERVER.loadrequestobj(); //probeer te laden
		}
		return this.loaded;
	},

	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;
	},

	POSTrequest:function(url,sendData,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", sendData.length);
		this.requestobj.setRequestHeader("Connection", "close");
		this.requestobj.send(sendData);
		return true;
	},

	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;
		}
	}
}
