        
        // JavaScript code goes here
        var ctime = 0;
        var onairmoreshowing = 0;
        
        function DoButton(btn)
        {
        	glow.dom.get('#' + btn.id).css('background-color', '#FF2424');        	
        }
        
        function KillButton(btn)
        {
        	glow.dom.get('#' + btn.id).css('background-color', '#CC0000');        	
        }
        
        
        
        
        function onAirMoreShow()
        {
        	var myAnimation = glow.anim.css("#onairmore", 0.25,
			  {
			    "width": {to:222},
			    "height": {to: 88},
			    "opacity": {to: 1}
			  }, {
			    tween: glow.tweens.easeBoth()
			  }
			);
			myAnimation.start();

        	onairmoreshowing = 1;
        }
        
        function onAirMoreHide()
        {
        	  var myAnimation = glow.anim.css("#onairmore", 0.25,
			  {
			    "width": {to:0},
			    "height": {to: 88},
			    "opacity": {to: 0}
			  }, {
			    tween: glow.tweens.easeBoth()
			  }
			);
			myAnimation.start();
        	
        	onairmoreshowing = 1;
        }
                
        
        
        function onAirMoreStart()
        {
        	ctime = setTimeout("onAirMoreShow()", 250);
        }
        
        function onAirMoreStop()
        {
        	if (onairmoreshowing == 0)
        	{
        		clearTimeout(ctime);
        	}
        	else
            {
               	onAirMoreHide();
            }
        }     
        
        
        function ReloadCurrentOnAir()
        {
        	var request = glow.net.get("/onairnow.php", {
  			onLoad: function(response) {
    			//alert(response.text());
    			
    			return;
    			
    			var mySplitResult = response.text().split("||");

					var p = document.getElementById("presenterpic");
					
					if (p.src !== "/images/presenters/" + mySplitResult[0] + ".jpg")
    					p.src = "/images/presenters/" + mySplitResult[0] + ".jpg";

    				var p = document.getElementById("onairshownamei");
    				
    				if (p.innerHTML !== mySplitResult[1])
    					p.innerHTML = mySplitResult[1];
    				
    				
    				var p = document.getElementById("onairnexttimei");
    				
    				var timeInt = parseInt(mySplitResult[2]);
    				var suffix = 'am';
    				
    				if (timeInt >= 12) { 
    					if (timeInt > 12)
    						timeInt = timeInt - 12;
    					suffix = 'pm';
    					 }
    					else
    						{
    							if (timeInt == 0)
    							{
    								timeInt = 12;
    							}
    						}
    				
    				if (p.innerHTML !== timeInt.toString() + "" + suffix)
    					p.innerHTML = timeInt.toString() + "" + suffix;
    				
    				
    				var p = document.getElementById("onairnexti");
    				
    				if (p.innerHTML !== mySplitResult[3])
    					p.innerHTML = mySplitResult[3];
    				
    				var p = document.getElementById("onairmorei");
    				
    				if (p.innerHTML !== mySplitResult[4])
    					p.innerHTML = mySplitResult[4];    		
    				
					// alert("Element " + i + " = " + mySplitResult[0]); 
    			
  			},
  			onError: function(response) {
    			//
  			}
		});
        	
        }   
        
            
        
        
        
        
        function ReloadRecent()
        {
        	var request = glow.net.get("/recentlyplayed.php", {
  			onLoad: function(response) {
    			//alert(response.text());
    			var p = document.getElementById("recentlyplayed");
					
    			if (p.innerHTML !== response.text())
    				p.innerHTML = response.text();
	
    			
  			},
  			onError: function(response) {
    			//
  			}
		});
        	
        }          
               
        
        
        
         
       
       
       
		// Current JS    
		
		var infoTimer;   
		var currentinfo;
       
        
     function OpenPlayer(start)
     {
     		//window.open("/player.php?start=" + start, "tcrfmplayer", "width=476,height=366,statusbar=0,addressbar=no,scrollbars=no,toolbars=no");
     		window.open('/player/', 'UKRadioPlayerPopup', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=380,height=660');
     }  
     


			function updateInfo() {
			  $.get('/player/dataxchange.php', function (data) {  	
			  	currentinfo = jQuery.parseJSON(data);
					
					//$('#nowpresenter').text(currentinfo.showname);
					$('#nowartist').text(currentinfo.artist);
			  	$('#nowtitle').text(currentinfo.title);
			  	
			  	//$('#onairpic').css('background-image', 'url(\'/images/presenters/' + currentinfo.username + '.jpg\')');
			  	
			  	clearTimeout(infoTimer);
			  	infoTimer = setTimeout('updateInfo()', 10000);
			  });		
			}
