function nowplaying(){
start();
if (document.all||document.getElementById)
setInterval("start()",150000)       //Refresh iedere 150 seconden
}

function start(){
	xmlHttp = GetXmlHttpObject();
	getNowPlaying();
}	

function GetXmlHttpObject(){ 
	var objXMLHttp;
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}

function getNowPlaying(){
	var url = "/scripts/nowplaying.php";
	url += "?bustCache=" + Math.random(); 
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.send(null);
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		var gesplitst = xmlHttp.responseText.split(' - ');
//		document.getElementById("currentsong").innerHTML=xmlHttp.responseText;
		document.getElementById("currentprogramma").innerHTML=gesplitst[0]; 
		document.getElementById("currentomschrijving").innerHTML=gesplitst[1];
	} 
}

window.onload = nowplaying;
