// JavaScript Document
var currentMovie = "KaylaDJ";

 $(document).ready(function(){
   $(".movieThumbnailContainer").click(function(event){
	$("#movieThumbnail" + currentMovie).removeClass("selected");
	currentMovie = ($(this).attr("id").substr("movieThumbnail".length));
	$(this).addClass("selected");
	//alert(currentMovie);
	deleteMovie();
	embedMovie("movies/" + currentMovie + "700.flv");
   });
 });



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/KaylaDJ700.flv");

