// JavaScript Document

var now = "/SRMC/nowplaying.php";
var show = "/SRMC/showplaying.php";
function nowplaying()
 {
    // native XMLHttpRequest object
	var nowurl = "/SRMC/nowplaying.php?key=ms" + new Date().getTime();
   if (window.XMLHttpRequest) {
       req = new XMLHttpRequest();
       req.onreadystatechange = function() {ajaxDone('playingnow');};
       req.open("GET", nowurl, true);
       req.send(null);
   // IE/Windows ActiveX version
   } else if (window.ActiveXObject) {
       req = new ActiveXObject("Microsoft.XMLHTTP");
       if (req) {
           req.onreadystatechange = function() {ajaxDone();};
            req.open("GET", nowurl, true);
           req.send();
       }
   }
		   setTimeout("nowplaying()", 20000);
}

function ajaxDone() {
// only if req is "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200 || req.status == 304) {
results = req.responseText;
document.getElementById('playingnow').innerHTML = results;
} else {
document.getElementById('playingnow').innerHTML="ajax error:\n" +
req.statusText;
}
}
}
function showplaying()
 {
    // native XMLHttpRequest object
	var showurl = "/SRMC/showplaying.php?key=ms" + new Date().getTime();
   if (window.XMLHttpRequest) {
       req1 = new XMLHttpRequest();
       req1.onreadystatechange = function() {ajaxDoneShow('playingshow');};
       req1.open("GET", showurl, true);
       req1.send(null);
   // IE/Windows ActiveX version
   } else if (window.ActiveXObject) {
       req1 = new ActiveXObject("Microsoft.XMLHTTP");
       if (req1) {
           req1.onreadystatechange = function() {ajaxDoneShow();};
		   
           req1.open("GET", showurl, true);
           req1.send();
       }
   }
		   setTimeout("showplaying()", 300000);
}

function ajaxDoneShow() {
// only if req is "loaded"
if (req1.readyState == 4) {
// only if "OK"
if (req1.status == 200 || req.status == 304) {
results = req1.responseText;
document.getElementById('playingshow').innerHTML = results;
} else {
document.getElementById('playingshow').innerHTML="ajax error:\n" +
req1.statusText;
}
}
}