// this sets up the show pages, hiding all sections then revealing just the current one

function loadMP3Player() {
	// HIDE ALL SECTIONS
	var showContentDiv = document.getElementById("showContent");
	if (showContentDiv) {
		var links = showContentDiv.getElementsByTagName("a");
		
		for (var i=0; i < links.length; i++) {
			if (links[i].href.search(".mp3")>0) {
				// when we've found a link to a track, 1st build the flash player
				var songTitle = links[i].href;
				
				// link is in form "http://tallstories.org.uk/file_download/5/Swimming-Song.m4a"
				// so we need to change that to ""http://tallstories.org.uk/files/Swimming-Song.m4a"
				songTitle = rootDir + "files/" + songTitle.substr(songTitle.lastIndexOf("/")+1);
				
				var flashHtml = '<h3>Music from this show</h3><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="181" height="35" id="mp3Player" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="FlashVars" value="songTitle=' + songTitle + '" /><param name="movie" value="../mp3Player/mp3Player.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="../mp3Player/mp3Player.swf" FlashVars="songTitle=' + songTitle + '" quality="high" bgcolor="#ffffff" width="181" height="35" name="mp3Player" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object><div class="mp3BottomBorder"></div>';
				var mp3PlayerHolder = document.getElementById("mp3PlayerHolder");
				mp3PlayerHolder.innerHTML = flashHtml;
			
				// finally, hide the link from the page
				links[i].style.display = "none";
			
				return;
			}
		}
	}
}


addLoadEvent(loadMP3Player);