// JavaScript Document

//------------------------------------------
//	UPDATE NOW PLAYING
//------------------------------------------
var rand_no = Math.random();
rand_no = rand_no * 100;
//alert(rand_no);


var sStatus = window.setInterval("UpdateNowplaying()",20000); // 20 secs
//document.playerStatus.value = 'playing';

function startUpdateNowplaying() {
	var sStatus = window.setInterval("UpdateNowplaying()",20000);
}	

function UpdateNowplaying(style)
{
	window.clearInterval(sStatus);		

	var xmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	  xmlhttp = new XMLHttpRequest();
	}

	xmlhttp.open("POST", "/nowplaying.php?cacheid="+rand_no+"&style="+style+"",true);
	 xmlhttp.onreadystatechange=function() {
	  if (xmlhttp.readyState==4) {
		//alert("readystate is 4")
		  // if "OK"
			  if (xmlhttp.status==200)
			  {
			  document.getElementById('playing').innerHTML=xmlhttp.responseText;
			  }		
		}
	 }
	 xmlhttp.send(null)
}
 

//------------------------------------------
//	UPDATE NOW PLAYING
//------------------------------------------
