// JavaScript Document

function flashPutHref(href) { location.href = href; }

// SWFObject embed
var sbflashvars = {
	paramXMLPath: "communityworkshopsparam.xml",
	initialURL: escape(document.location),
	useExternalInterface: "true"
};

var exflashvars = {
	paramXMLPath: "exhibitionparam.xml",
	initialURL: escape(document.location),
	useExternalInterface: "true"
};


var params = { 
	base: ".",
	bgcolor: "#121212",
	allowfullscreen: "true"
};                
var attributes = {
	id: "movie"
};

function getMovie(movieName) {
	/*if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	} else {
	    return document[movieName]
	}*/
	return document.getElementById(movieName);
}

function flashPutHref(href) { location.href = href; }

function embedMovie(fileName){
	// SWFObject embed
	var flashvars = {
		paramXMLPath: "param.xml",
		initialURL: escape(document.location),
		useExternalInterface: "true",
		file: fileName,
		controlbar: "over",
		autostart: "true",
		skin: "stylish_slim.swf"
	};
	var params = { 
		base: ".",
		bgcolor: "#121212",
		allowfullscreen: "true",
		movie: "player.swf",
		allowscriptaccess: "always"
	};                
	var attributes = {
		id: "movie"
	};
	swfobject.embedSWF("player.swf", "movie", "640", "480", "9.0.0", false, flashvars, params, attributes);
}

function deleteMovie(){
	swfobject.removeSWF("movie");
	var tmp=document.getElementById("movieWrapper");
	if (tmp) { 
		tmp.innerHTML = "<div id='movie'>This video requires the Flash Player plugin and a web browser with JavaScript enabled.</div>";
	}

}




embedMovie("movies/sanctuary/exhibitionVideo.flv");

var currentItem = "exhibitionVideo";

$(document).ready(function(){
							
   $(".movieThumbnailContainer").click(function(event){
	$("#" + currentItem).removeClass("selected");
	currentItem = ($(this).attr("id"));
	$(this).addClass("selected");
	//remove what's there

	
	deleteMovie();
	//and replace with whatver is needed
	
	switch(currentItem)
	{
		case "sabrinaScrapbook":
		  swfobject.embedSWF("slideshowpro.swf", "movie", "640", "480", "9.0.0", false, sbflashvars, params, attributes);
		  $(".sanctuaryExhibit").hide();
		  $("#movieViewer .movieCaption").show();
		  
		  break
		case "exhibitionStills":
		  swfobject.embedSWF("slideshowpro.swf", "movie", "640", "480", "9.0.0", false, exflashvars, params, attributes);
		  $("#movieViewer .movieCaption").hide();
		  $(".sanctuaryExhibit").show();
		  break		
		default:
		  $("#movieViewer .movieCaption").hide();
		  $(".sanctuaryExhibit").hide();
		  embedMovie("movies/sanctuary/" + currentItem + ".flv");
	}
	

	});
 });



