var ajax = new Object();

ajax.laden = function (url,post_data,func) {
	this.url = url;
	this.post_data = post_data;
	this.xhr = null;
	this.onload = func;
	this.loadXMLDoc(url,post_data);
}

ajax.laden.prototype = {
	loadXMLDoc:function(url,post_data) {
		try {
			this.xhr = new ActiveXObject ("MSXML2.XMLHTTP");
		} catch (e) {
			try {
				this.xhr = new ActiveXObject ("Microsoft.XMLHTTP");
			} catch (E) {
				this.xhr = false;
			}
		}
		if (!this.xhr && typeof XMLHttpRequest != "undefinded") {
			this.xhr = new XMLHttpRequest();
		}
		if (this.xhr) {
			if (post_data == "") post_data = null;
			try {
				var loader = this;
				this.xhr.onreadystatechange=function() {
					loader.onReadyState.call(loader);
				}
				this.xhr.open("POST",url,true);
				this.xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
//				if (post_data != "status=") alert(encodeURI(post_data));
				this.xhr.send(encodeURI(post_data));
			} catch (err) {
				alert("FEHLER");
			}
		}
	},
	onReadyState:function(){
		var xhr=this.xhr;
		var ready= xhr.readyState;
		var httpStatus = "";
		if (ready == 4) {
			httpStatus = xhr.status;
			if (httpStatus == 200 || httpStatus==0) {
				this.onload.call(this);
			}else {
				alert("HTTPREQUESTFEHLER!!!");
			}
		}
	}
}

