var xmlhttp;
var content_id;

function loadData(str,id){
	content_id=id;
	xmlhttp=GetXmlHttpObject()
	
	if (xmlhttp==null){
		alert ("Your browser does not support XML HTTP Request");
		return;
	}
	if(id=='news_content') {
			 var url="getNews.php";
	} else { var url="kalender.php";}

	url=url+"?sid="+Math.random()+str;
	xmlhttp.onreadystatechange=stateChanged ;
	if(str.length>2) xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
}

function stateChanged(){
	if (xmlhttp.readyState==4 && xmlhttp.status==200){
		document.getElementById(content_id).innerHTML=xmlhttp.responseText;
		
	}
	//else document.getElementById("thekalender").innerHTML="<div style='position:relative;left:50%;'><img src='loader.gif' width='32 height='32'></div>";
}

function GetXmlHttpObject(){
	if (window.XMLHttpRequest){
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject){
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}

	return null;
}
