function getXMLHttpRequestObject(){

	var XMLHttpRequestObject = false;

	try{
		XMLHttpRequestObject = new ActiveXObject("MSXML2.XMLHTTP.5.0");
	}catch(exception1){
		try{
			XMLHttpRequestObject = new ActiveXObject("MSXML2.XMLHTTP.4.0");
		}catch(exception2){
			try{
				XMLHttpRequestObject = new ActiveXObject("MSXML2.XMLHTTP.3.0");
			}catch(exception3){
				try{
					XMLHttpRequestObject = new ActiveXObject("MSXML2.XMLHTTP");
				}catch(exception4){
					try{
						XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
					}catch(exception5){
							try{
								XMLHttpRequestObject = new XMLHttpRequest();
							}catch(exception6){	
								alert('fatal error because of none-existing XMLHttpRequestObject');
							}
					}
				}
			}	
		}
	}
	return XMLHttpRequestObject;
}



// rückgabe JSON, oder xml, oder text
// func werden bei fehler noch zu häufig ausgeschmissen, vielleicht vars setzen
// hole Daten aus Datei
function myAjaxRequest(method,source,onLoading,onLoaded,onSuccess,onFailure){



	var XMLHttpRequestObject = getXMLHttpRequestObject();
	var response	= null;
	var content		= null;
	var errorState	= false;

	if(XMLHttpRequestObject){

		eval(onLoading+"()");

		if(method=="POST"){
			var contentArray = source.split("?");
			if(contentArray.length==2){
				if(contentArray[0].typeOf!='undefined' && contentArray[1].typeOf!='undefined'){
					source			 = contentArray[0];
					content			 = contentArray[1];
					if(content.length==0){
						content=null;
					}
				}
			}
			
		}

		XMLHttpRequestObject.open(method,source,true); // sollte noch hinten an gehangen werden: new Date().getMilliseconds()
		
		if(method=="POST"){
			XMLHttpRequestObject.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		}

		XMLHttpRequestObject.onreadystatechange = function(){
	
			if(XMLHttpRequestObject.readyState == 2 && onLoaded!=null){
					eval(onLoaded+"()");
			}

			if(XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200 && onSuccess!=null){
				response = XMLHttpRequestObject.responseText;
				eval(onSuccess+"(response)");
			}

			try{
				if(XMLHttpRequestObject.status != 200 && onFailure!=null){ // status existiert noch nicht beim ersten durchlauf
					if(!errorState){
						eval(onFailure+"(XMLHttpRequestObject.status,XMLHttpRequestObject.statusText)");
						errorState = true;
					}
				}
			}catch(e){}

		}
		try{
			XMLHttpRequestObject.send(content);
		}catch(e){
			alert("fatal error because data not found");
		}

	}
}

// myAjaxRequest('GET','ext/news/addNewslink.php?ts='+(new Date().getMilliseconds())+'&linkUrl='+escape(linkUrl)+'&linkText='+escape(linkText),'loading','loaded','success','failure');