function Ajax(){
	//	Eigenschaften deklarieren und intialisieren	
	this.url="";
	this.params="";
	this.method="GET";
	this.onSuccess=null;
	//this.loadProgress="";
	this.onError=function(msg){alert(msg)}
	}
	
Ajax.prototype.doRequest=function(){
	// Zugriff auf Klasse für readyStateHandler ermöglichen
	var _this=this;
	
	// Überprüfen der Angaben
	if(!this.url){
		this.onError("Es wurde keine URL angegeben!! Der Request wurde abgebrochen.");
		return false;
		};
	if(!this.method){
		this.method="GET";
		}
		else{
			this.method=this.method.toUpperCase();
			}
	
	// XMLHttpRequest-Objekt erstellen
	var xmlHttpRequest=getXMLHttpRequest();
	if(!xmlHttpRequest){
		this.onError("Es konnte kein XMLHttpRequest-Objekt erstellt werden.");
		return false;
		}
		
	
	// Einblenden des Progresszeichens
	/*if (_this.loadProgress != "" && _this.loadProgress != null){
		var showProgress = document.getElementById(_this.loadProgress).style.visibility = "visible";
	}*/
	// Fallunterscheidung nach Übertragungsmethode
	switch(this.method){
		
		case "GET":		xmlHttpRequest.open(this.method, this.url+"?"+this.params, true);
						xmlHttpRequest.onreadystatechange=readyStateHandler;
						xmlHttpRequest.send(null);
						break;
		case "POST":	xmlHttpRequest.open(this.method, this.url, true);
						xmlHttpRequest=onreadystatechange=readyStateHandler;
						xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
						xmlHttpRequest.send(this.params);
						break;
		}
	
	
	// Private Methode zur Verarbeitung der erhaltenen Daten
	function readyStateHandler(){
		if(xmlHttpRequest.readyState < 4){
			//_this.onError("readyState war fehlerhaft bei Annahme des Response: readyState < 4 -> "+xmlHttpRequest.readyState);
			return false;
			}
		if(xmlHttpRequest.status == 200 || xmlHttpRequest.status == 304){
			if(_this.onSuccess){
				// Ausblenden des Progresszeichens
				/*if (_this.loadProgress != "" && _this.loadProgress != null){
					var showProgress = document.getElementById(_this.loadProgress).style.visibility = "hidden";
				}*/
					
				_this.onSuccess(xmlHttpRequest.responseText, xmlHttpRequest.responseXML);
					
					
					
				}
			}
			else{
				if(_this.onError){
					_this.onError("["+xmlHttpRequest.status+" "+xmlHttpRequest.statusText+"] Es trat ein Fehler bei der Datenübertragung auf!");
					}
				}
		}
	}
	
// Gibt browserunabhängig ein XMLHttpRequest-Objekt zurück
function getXMLHttpRequest(){
	if(window.XMLHttpRequest){
		//XMLHttpRequest für Firefox, Opera, Safari & Co
		return new XMLHttpRequest();
		}
		else{
			if(window.ActiveXObject){
				try{
					// XMLHTTP für InternetExplorer (NEU)
					return new ActiveXObject("Msxml2.XMLHTTP");
					}
				catch(e){
					// XMLHTTP für InternetExplorer (ALT)
					try{
						return new ActiveXObject("Microsoft.XMLHTTP");
						}
					catch(e){
						return null;
						}
					}
				}
				return null;
			}
	}
