// JavaScript Document
firstTime = true;
function playMovie(whichMovie, whichLayer, width, height, allAreas, currentArea) 
{
	// remove all selected areas
	allAreasArr = allAreas.split(',');
	for( x = 0; x < allAreasArr.length; x++)
	{
		linkArea = document.getElementById(allAreasArr[x]);
		if( linkArea )
			linkArea.className = linkArea.className.replace("selectedArea", "");
	}
	
	// add latest selectedArea
	linkArea = document.getElementById(currentArea);
	if( linkArea )
		linkArea.className += " selectedArea";

	var movieArea = document.getElementById(whichLayer);
	if( movieArea ) {
		if( !firstTime ) {
			document.theMovie.SetURL(whichMovie);
		}
		else {
			movieArea.innerHTML = '<embed src="' + whichMovie +'" width="' + width + '" height="' + height + '" autoplay="true" align="middle" bgcolor="black" pluginspace="http://www.apple.com/quicktime/download" type="video/quicktime" name="theMovie" enablejavascript="true"></embed>';
			//movieArea.innerHTML = QT_GenerateOBJECTText_XHTML(whichMovie, width, height, '', 'autoplay', 'true', 'emb#bgcolor', 'black', 'align', 'middle', 'enablejavascript', 'true', 'name', currentArea + 'Movie'); 
			firstTime = false;
		}
	}
		
	return false;
}

function showSpryAreas(theAreas)
{
	areasArr = theAreas.split(',');
	for( x = 0; x < areasArr.length; x++)
	{
		areaID = document.getElementById(areasArr[x]);
		if( areaID )
			areaID.style.display = "block";
	}
}

function showCredits()
{
	w = 780;
	h = 540;
	if( document.all && (navigator.userAgent.indexOf("Microsoft Internet") == -1) ) {
		temp=navigator.appVersion.split("MSIE");
		version=parseFloat(temp[1]);
		if( version >= 7 ) {
		h += 7;
		w += 45;
		  /*IE7 Height adjust*/
		}
		else {
		w += 20;
		h += 5;
		  /*IE6- Height adjust*/
		}
	}
	openWindow("http://www.museumsinthesea.com/credits.htm", w, h);
	return false;
}

 courseChangeWin = "";
 function openWindow(type, width, height)
 {
	courseChangeWin = open(type, "", "top=20,left=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height);
	return false;
 }
 
 function updateMovie(whichMov, movieID)
 {
	 if( document[movieID] ) {
		 document[movieID].SetURL(whichMov);
		 document[movieID].Stop();
	 }
 }