 
function GetOnAir(){
	//Try to create the AJAX Object
	//*******************************
	function GetXmlHttpObject() {
		var xmlHttp=null;
		try {
  			// Firefox, Opera 8.0+, Safari
  			xmlHttp=new XMLHttpRequest();
  		} catch (e) {
  			// Internet Explorer
  			try {
    				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    			} catch (e) {
    				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    			 }
  		 }
	return xmlHttp;
	}

        //Test to see if the browser created the object
	//**********************************************
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
  		alert ("Your browser does not support AJAX!");
  		return;
  	}
	
	//Browser was able to create AJAX Object
	//**************************************
	var url="http://sparksunderland.com/wp-content/themes/sparkfm/onair/nowplaying.php";//added date to end of URL  as a hack for IE or it caches the results and doesnt refresh :(
	var id="OnAirNow";

	xmlHttp.onreadystatechange=function(){
        	//0=uninitialized, 1=loading,2=loaded,3=interactive,4=complete
        	if (xmlHttp.readyState==4) {
                	if (xmlHttp.status == 200) { //ok from server
                        	document.getElementById(id).innerHTML=xmlHttp.responseText;
                	}
                	else {
                        	document.getElementById(id).innerHTML=" ";
        		}
		}
		 /*else if (xmlHttp.readyState==1) {
                	document.getElementById(id).innerHTML=" ";
        	}
        	else if (xmlHttp.readyState==2){
                	document.getElementById(id).innerHTML=" ";
        	}*/

	};

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

	//Repeat every 1000 miliseconds (1 Second)
	//*******************************
	setTimeout("GetOnAir()", 10000);
}
 
window.onload=function(){GetOnAir();}//call when everything has loaded
  
 

