	// how many seconds you want between updates of the track info
	var updateInterval = 45;
	
	// Define some messages for the "contact us" section in the stream player:
	var contactAutomation = "<a href=\"mailto:wuvtamfm@vt.edu?subject=Website+Feedback\">wuvtamfm@vt.edu</a>";
	var contactDJ = "540-231-WUVT [540-231-9888] / <a href=\"aim:goim?screenname=WUVTFMBLACKSBURG\">WUVTFMBLACKSBURG</a> on AIM"

	// Define the "cute" automation name:
	var cuteAutomationName = "The Automaton";

/*	// define the alternate message for the web stream
	var altMsg = "<b>Requests?</b> <font color=\"white\">(540) 231-9888</font> or "
				 + "<font color=\"white\"><a href=\"mailto:wuvtamfm@vt.edu\">wuvtamfm@vt.edu</a></font>";
*/
				 
	// this function from: http://snipplr.com/view/132/detect-ie/
	function isIE() {
	return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
	}

	// 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(varStream) {

		// define these for the date and time to be combined:
		var myDate = "";
		var myTime = "";
		
		var xhr;
		var child;
		var brother;
		var crack;
		
		// Create the XMLHTTP object (for both IE & non-IE browsers)
		try {		// try the standard version first!  ==> this means ie7/8, moz, webkit, opera
			xhr = new XMLHttpRequest();
		} catch (err) {
			try {
				xhr = new ActiveXObject('MSXML2.XMLHTTP.6.0');		// latest MSXML
			} catch (err) {
				try {
					xhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');		// newer MSXML
				} catch(err) {
					try {
						xhr = new ActiveXObject("MSXML2.XMLHTTP");	// newish
					} catch (err) {
						try {
							xhr = new ActiveXObject("Microsoft.XMLHTTP");    // Trying the old & busted activex control for Internet Explorer 
						} catch(err) {
							//// wheee put code here to unhide the refesh button!
							//document.getElementById("btnRefresh").style.display = "block";
							alert("Your browser is unable to make AJAX requests.  Please upgrade or speak to your system administrator.");
						}
					}
				}
			}
		}

		
		// 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) {
					
					for (child = xhr.responseXML.firstChild; child != null; child = child.nextSibling) {	
						for (brother = child.firstChild; brother != null; brother = brother.nextSibling)
						{	
								// create function to find artist and track title. 
							for (crack = brother.firstChild; crack != null; crack = crack.nextSibling) {
								//alert(brother.nodeName + ": " + crack.data);
								if (brother.nodeName == "title") {
									document.getElementById("currTitle").innerHTML = crack.data;
								}
								if (brother.nodeName == "artist") {
									document.getElementById("currArtist").innerHTML = crack.data;
								}
								if (brother.nodeName == "album") {
									document.getElementById("currAlbum").innerHTML = crack.data;
								}
								if (brother.nodeName == "label") {
									document.getElementById("currLabel").innerHTML = crack.data;
								}
								if (brother.nodeName == "dj") {									
									if (crack.data == "Automation") {
										document.getElementById("contact").innerHTML = contactAutomation;
										document.getElementById("currDJ").innerHTML = cuteAutomationName;
									} else {
										document.getElementById("contact").innerHTML = contactDJ;
										document.getElementById("currDJ").innerHTML = crack.data;
									}
										
								}
								if (brother.nodeName == "date") {
									myDate = crack.data;
									//document.getElementById("currDate").innerHTML = crack.data;
									document.getElementById("currDate").innerHTML = myDate + " " + myTime;

								}
								if (brother.nodeName == "time") {
									myTime = crack.data;
									//document.getElementById("currTime").innerHTML = crack.data;
									document.getElementById("currDate").innerHTML = myDate + " " + myTime;
								}
								
							}
						}	
					}
		
				}
			}
		};
		
		// activate the HTTP response
		
		xhr.open("GET", "wuvt_info/wuvt_tracks.php", true);

		// fix for IE caching bug:  from http://www.webmasterworld.com/forum91/4202.htm
		if (isIE()) {
			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(false)", updateInterval * 1000);
	}

	// this function is called in the onLoad section of the body to update the track info AND initially update values!
	function startDisplay() {
		getLatestTrack(false);

		// start a looping timer:
		setInterval("getLatestTrack(false)", updateInterval * 1000);
	}






/*	---------------------------------------------------------IGNORE BELOW---------------------------------------	
	// this function shows the alternate message: (for the stream player)
	function showStreamTrack() {
		getLatestTrack();
		document.getElementById("currTrack").innerHTML = "<b style=\"font-weight: bolder\">Now Playing:</b> <span style=\"color:white\">"
														 + document.getElementById("currTrack").innerHTML + "</span>";
	}

	// this function is called in the onLoad section of the body to update the track info for the stream:
	function startStreamUpdates() {
		// start a looping timer:
		setInterval("getLatestTrack(true)", updateInterval * 1000);
	}

	// this function is called in the onLoad section of the stream player to update the track info:
	function startStreamUpdates() {
		// start a looping timer:
		setInterval("getLatestTrack()", updateInterval * 1000);
		// start a looping timer:
		setInterval("showAltMsg()", updateInterval + (0.7 * updateInterval) * 1000);
	}
	---------------------------------------------------------------------------------------------------------- */
