function TunePlaylist()
	{
		GetXmlRes("playing2.php?ms=" + new Date().getTime(), "NowPlaying", "GET");
	}
	
function DJRotator()
	{
		GetXmlRes("whatson/preview.php?ms=" + new Date().getTime(), "tunedIn", "GET");
	}
var xmlHttp = new Array(2);
function GetXmlRes(url, action, HttpReqType) 
	{
	
		xmlHttp[action] = GetXmlHttpObject();
		HttpReqType = HttpReqType.length>0 ? HttpReqType : "GET";
		xmlHttp[action].open(HttpReqType, url , true);
		xmlHttp[action].onreadystatechange = 
			function () {
					if(xmlHttp[action].readyState==4 && xmlHttp[action].status==200) {
							if(action=="tunedIn") {
									browserElement("Online").innerHTML = xmlHttp[action].responseText;
									//setTimeout("DJRotator()", 10000);
								} else {
									Html = xmlHttp[action].responseText.split("|");
									browserElement("CurrentPlay").innerHTML = Html[0];
								}
						}
				}
		xmlHttp[action].send(null);
	} 

function GetXmlHttpObject()
	{ 
		var objXmlHttp = null;

		if(navigator.userAgent.indexOf("MSIE")>=0 && navigator.userAgent.indexOf("Opera")<=0) { 
				var strName="Msxml2.XMLHTTP";
				if(navigator.appVersion.indexOf("MSIE 5.5")>=0) {
						strName = "Microsoft.XMLHTTP";
					} try { 
						objXmlHttp = new ActiveXObject(strName);
						return objXmlHttp;
					} 
				catch(e) { 
						alert("Error. Scripting for ActiveX might be disabled") ;
						return;
					} 
			}
		if(navigator.userAgent.indexOf("Opera")>=0 || navigator.userAgent.indexOf("Mozilla")>=0) {
				objXmlHttp = new XMLHttpRequest();
				return objXmlHttp;
			}
	}
/* determine browser */
function browserElement(ChkStr)
	{
	IdChk = document.getElementById ? true : false;
		/* check for netscape 4+/IE 5+ */
		if(navigator.userAgent.indexOf("Gecko")>-1 && IdChk || navigator.userAgent.indexOf("MSIE")>-1 && IdChk || navigator.userAgent.indexOf("Opera")>-1 && IdChk) {
				return document.getElementById(ChkStr);
			}
		/* netscape 4 */
		if(document.layers && !IdChk) {
				return document.ChkStr.document;
			}
		/* IE 4 */
		if(document.all && !IdChk) {
				return document.all[ChkStr];
			}	
	}