	function updateContent()
	{		
		UpdateCurSong();	
		//UpdateTimeRemaining();
		UpdateNext();
		UpdateRecent();
		UpdateCurrentListeners();
		/*var getDedication = new Ajax.PeriodicalUpdater
		( $('dedication_text'), "dedication.php",
			{
				frequency: timeLeft
			}
		);*/
	}	
	
	function UpdateCurSong()
	{
		var curSong = new Ajax.PeriodicalUpdater
		( $('current_song'), "current_song.php",
			{
				frequency:10
				/*onSuccess: function()
				{
					Element.setOpacity('current_song', 0.0);
					Effect.Appear('current_song', { duration: 1.0 });
				}*/
			}
		);
	}	
	
	function UpdateNext()
	{
		var nextSongs = new Ajax.PeriodicalUpdater
		( $('coming_soon'), "coming_soon.php",
			{
				frequency: 45
			}
		);	
	}
	
	
	function UpdateRecent()
	{
		var prevSongs = new Ajax.PeriodicalUpdater
		( $('recently'), "recently_played.php",
			{
				frequency: 49
			}
		);
	}
	
	function UpdateCurrentListeners()
	{
		var CurrListeners = new Ajax.PeriodicalUpdater
		( $('listeners'), "listeners.php",
			{
				frequency: 183
			}
		);
	}	

	function songinfo(songid)
	{
		songwin = window.open("songinfo.php?songid="+songid, "songinfowin", "location=no,status=no,menubar=no,scrollbars=yes,resizeable=yes,height=580,width=700");
	}
	
	function getSearchResults(start, limit)
	{
		var url = "searchresults.php";
		var pars = "search=" + document.forms.searchform.search.value.replace("&","amp;")
			+"&searchtype=" + FindCheckedVal(document.forms.searchform.searchtype)
			+"&artist=" + document.searchform.artist.options[document.searchform.artist.selectedIndex].value
			+"&order=" + document.searchform.orderby.options[document.searchform.orderby.selectedIndex].value
			+"&start=" + start
			+"&count=" + limit;
		
		var myAjax = new Ajax.Updater
		( 'searchresults', url,
			{
				method: 'get',
				parameters: pars,
				onSuccess: function()				
				{
					new Effect.Appear('searchresults', 'blind');
				}
			}
		);

	}

	
	function request(songid)
	{
 		var samhost = "wdmb.no-ip.org";
 		var samport = "1221";
 		var path = "http://www.audiorealm.com/req/";

 		reqwin = window.open(path+"req.html?songID="+songid+'&samport='+samport+'&samhost='+samhost, "_AR_request", "location=no,status=no,menubar=no,scrollbars=no,resizeable=yes,height=350,width=550");
		}
		
	function FindCheckedVal(Checkbox)
	{
		for(var i = 0; i< Checkbox.length;i++)
		{
			if(Checkbox[i].checked)
				return Checkbox[i].value;
		}
	}
	window.onload = function()
	{
		updateContent();
	}
	
