
//Ajax - XMLHttpRequest Constructor
AjaxRequest = function(a_filename, a_data){
	
	if(a_data) {
		this.data	= a_data;
		this.method	= "POST";
	}else{
		this.data	= null;
		this.method	= "GET";
	}
	
	this.filename		= a_filename;
	this.responseXML	= null;
 	this.Load();
}


// Load Methode
AjaxRequest.prototype.Load = function(){
	
	if (typeof XMLHttpRequest != 'undefined') {
		this.xmlHttp = new XMLHttpRequest();
		if(this.xmlHttp.overrideMimeType){               
			this.xmlHttp.overrideMimeType("text/xml");
		}
	}
	
	if (!this.xmlHttp) {
		// Internet Explorer 6 und älter
		try {
			this.xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				this.xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				this.xmlHttp  = null;
			}
		}
	}
	
	if (this.xmlHttp) {
		
		this.xmlHttp.open(this.method, this.filename,false);		
		this.xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
		
		this.xmlHttp.send(this.data);	
		
//		this.xmlHttp.onreadystatechange = function () {
//			if (this.xmlHttp.readyState != 4) {
//				return;							
//			}
//		};
		
		this.responseXML	= this.xmlHttp.responseXML;		
	}

}
