/**
 * @author David E. Still
 */

var flashLogoObj = { movie:"media/fbf_logo.swf", width:"1000", height:"207", majorversion:"6", build:"40" };
//if (sec == home) {
//	UFO.create(flashLogoObj, "logo");
//}

function viewVideo(embed_id, src, width, height, mime_type, hide_id, header) {
	var pluginsPage = new Array();
	pluginsPage["video/quicktime"] = "http://www.apple.com/quicktime/download/";
	pluginsPage["application/x-shockwave-flash"] = "http://www.macromedia.com/go/getflashplayer";
	var embedObj = "";
	/* Use open source FlowPlayer for flv playback */
	/* http://flowplayer.sourceforge.net */
	if (src.indexOf(".flv") == (src.length - 4)) {
		if (header) embedObj += "<h2 class='video_header'>"+header+"</h2>\n";
		embedObj += '<object type="application/x-shockwave-flash" data="/media/FlowPlayer.swf" width="'+width+'" height="'+(height+23)+'" id="'+embed_id+'_video">\n';
		embedObj += '	<param name="allowScriptAccess" value="sameDomain" />\n';
		embedObj += '	<param name="movie" value="/media/FlowPlayer.swf" />\n';
		embedObj += '	<param name="quality" value="high" />\n';
		embedObj += '	<param name="scale" value="noScale" />\n';
		embedObj += '	<param name="bgcolor" value="#000000" />\n';
		embedObj += '	<param name="flashvars" value="config={ autoPlay: true, autoBuffering: true, videoFile: \'/'+src+'\' }" />\n';
		embedObj += '</object>';
	/* otherwise embed as object */
	} else {
		embedObj = "<embed src='"+src+"' ";
		embedObj += "width='"+width+"' ";
		embedObj += "height='"+(height+25)+"' ";
		embedObj += "id='"+embed_id+"_video' ";
		embedObj += "type='"+mime_type+"' ";
		embedObj += "pluginspage='"+pluginsPage[mime_type]+"' />";
	}
	/* Fade-out video links, if requested */
	$(embed_id).innerHTML = embedObj;
	if (hide_id) {
		$(embed_id).innerHTML += "<br /><a href=\"javascript:hideVideo('"+embed_id+"', '"+hide_id+"');\">close</a>";
		Effect.Fade(hide_id, { duration: 0.5, afterFinish: function() { Effect.Appear(embed_id, { duration: 0.5 });} });
	}
	/* Fade-in video player */
	else Effect.Appear(embed_id, { duration: 0.5 });
}

/* Hide video player and show video links */
function hideVideo(video_id, select_id) {
	Effect.Fade( video_id, { duration: 0.5 });
	window.setTimeout("$('"+video_id+"').innerHTML = '';", 500);
	if ($(select_id)) window.setTimeout("Effect.Appear('"+select_id+"', { duration: 0.5 });", 500);
}

/* Display Demo Reel */
function displayReel() {
	var bio = $("content_bio");
	var reel =  Builder.node("div", { id: "demo_reel", style: "display: none; position: absolute; top: 16px; left: 36px; padding: 4px; width: 90%; background-color: #fff; text-align: center;" });
	$("content_bio_background").appendChild(reel);
	viewVideo("demo_reel", "/media/promotional/david_hunt_demo_reel.flv", 504, 336, "application/x-shockwave-flash", "content_bio");
}
