	// how many seconds you want between updates of the track info
	var updateInterval = 45;

	// a state variable used in alternating between the "contact us" and the "current DJ" message
	var flipDJ = 0;
	

	// this function uses an AJAX request to grab the latest track.
	// (this function made using the tutorial at:   http://www.xul.fr/en-xml-ajax.html)
	function getAutoStatus() {
		
		var xhr;
		
		// Create the XMLHTTP object (for both IE & non-IE browsers)
		try {
		   xhr = new ActiveXObject("Microsoft.XMLHTTP");    // Trying Internet Explorer 
		}
		catch(e)    // Failed 
		{
		  xhr = new XMLHttpRequest()
		}	
		
		// define the inline callback function
		xhr.onreadystatechange = function() {
			// if the XMLHTTP object is ready:
			if (xhr.readyState == 4) {
				// update the track info if the HTTP server request was successful:
				if (xhr.status == 200) {
					// show the one for the stream if varStream is set
					//if (varStream) {
					//	var tempText = xhr.responseText;
						//document.getElementById("nowPlayingLabel").innerHTML = "Now Playing: ";
					//}
					
					// Show the track text!
					document.getElementById("currDJ").innerHTML = xhr.responseText;
					
				}
			}
		};
		
		// activate the HTTP response
		if (flipDJ) {
			xhr.open("GET", "/playlists/current_dj.php", true);
			flipDJ = 0;
		} else {
			xhr.open("GET", "/playlists/show_request_if_dj.php", true);
			flipDJ = 1;
		}			
		xhr.send(null);
	}

				 
	// this function uses an AJAX request to grab the latest track.
	// (this function made using the tutorial at:   http://www.xul.fr/en-xml-ajax.html)
	function getLatestTrack() {
		
		var xhr;
		
		// Create the XMLHTTP object (for both IE & non-IE browsers)
		try {
		   xhr = new ActiveXObject("Microsoft.XMLHTTP");    // Trying Internet Explorer 
		}
		catch(e)    // Failed 
		{
		  xhr = new XMLHttpRequest()
		}	
		
		// define the inline callback function
		xhr.onreadystatechange = function() {
			// if the XMLHTTP object is ready:
			if (xhr.readyState == 4) {
				// update the track info if the HTTP server request was successful:
				if (xhr.status == 200) {
					
					// Show the track text!
					document.getElementById("currTrack").innerHTML = xhr.responseText;
					
				}
			}
		};
		
		// activate the HTTP response
		xhr.open("GET", "/playlists/latest_track.php", true);
		xhr.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
		xhr.send(null);
	}




	// this function is called in the onLoad section of the body to update the track info:
	function startTimerUpdates() {
		// start a looping timer:
		setInterval("getLatestTrack()", updateInterval * 1000);
		setInterval("getAutoStatus()", updateInterval * 1000);
	}
	


