var req = false;
if (typeof XMLHttpRequest != 'undefined') 
{
	req = new XMLHttpRequest();
}
if (!req) 
{
	try 
	{
		req = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e) 
	{
		try 
		{
			req = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e) 
		{
			req = false;
		}
	}
}

if (req == false) {
	// Kein Ajax
}

var loadingImg = document.createElement('div');
loadingImg.className = 'loadingIcon';

function sendRequest(source, background, linkref) {
	if (source == null) {
		source = "content.php";
	} 
	if (background == null) {
	background = "Standard_Rot.png";
	} 
	var target = "content";
	
	// Loading-Image �ber den content setzen
	document.getElementById(target).appendChild(loadingImg);
	req.onreadystatechange = function() {
		if (req.readyState == 4) { 
			if (req.status == 200) {
				document.getElementById(target).innerHTML = req.responseText;
				document.getElementById('wrapper').style.backgroundImage="url(images/background/".concat(background).concat(")");
			} else if (req.status == 404) {
				document.getElementById(target).innerHTML = "<h1>Der Inhalt konnte nicht geladen werden.</h1><p>Sorry, wir k&uuml;mmern uns so schnell wie m&ouml;glich drum.</p>";
			} else {
				document.getElementById(target).innerHTML = "<h1>Beim laden des Inhalts ist ein Fehler aufgetreten.</h1><p>Sorry, wir k&uuml;mmern uns so schnell wie m&ouml;glich drum.</p>";
			}
		}
	}

	req.open('post', source);
	req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	req.send('key=val'); 

	return false; // return false damit nicht der link ausgef�hrt wird / die seite neu l�dt
}
