// JavaScript Document
//ajax handler
function startAjax() { //appropriate to browser being used
    var xmlHttpObj;
    if (window.XMLHttpRequest)
    xmlHttpObj = new XMLHttpRequest();
    else {
        try { xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP"); }
        catch (e) {
            try { xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP"); }
            catch (e) { xmlHttpObj = false; }
        }
    }
    return xmlHttpObj;
}

//our function
function runPHPScript() {
	gateway = startAjax();
    if (!gateway)
    return;
    else {
        gateway.open('GET', 'http://www.voiceofrock.com/currenttrack/currenttrack.php', true);
        gateway.onreadystatechange = function() { processResponse(1); }
        gateway.send(null);
    }
	
}

//process ajax response from PHP script
function processResponse() {
	if (gateway.readyState == 4 && gateway.status == 200) {
		jQuery('.nowplaying marquee').html(gateway.responseText);
		//alert("Done loading!\n\nThe response from the PHP script was: "+gateway.responseText);
	}
}
//everything's set - now we just need to start the interval so we hit our runPHPScript function every 5 seconds
runPHPScript();
var myInt = setInterval(runPHPScript, 10000);
