// ----- Show Video ----- 

function showVideo( video_width, video_height, video_url, player_url ) {
	
	var video_width = 640;
	var video_height = 360;
	var flashvars = {
		"source_file": video_url, 
		"default_resize_mode": "fillScreen",
		"scale": "noScale",
		"default_thumb_height": "90",
		"prevent_xml_cache": "true",
		"auto_start": "true"
	};
	var objectparams = {};
	var elementattributes = {};
	swfobject.embedSWF( player_url, "FlashPlaceholder", video_width, video_height, "9.0.0", "", flashvars, objectparams, elementattributes );
	
	// Get Window Dimensions
	var win_width = 0, win_height = 0;
	if( typeof( window.innerWidth ) == 'number' ) { 
		// Standard DOM
		win_width = window.innerWidth;
		win_height = window.innerHeight;
	} else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		// IE 6+ in 'standards compliant mode'
		win_width = document.documentElement.clientWidth;
		win_height = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		// IE previous
		win_width = document.body.clientWidth;
		win_height = document.body.clientHeight;
	}

	var pagescreen = document.getElementById("PageScreen");
	pagescreen.style.width = win_width + "px";
	pagescreen.style.height = Math.max((video_height+20),document.documentElement.scrollHeight) + "px";
	pagescreen.style.display = "block";
	
	var overlay = document.getElementById("OverlayPanel");
	overlay.style.left = ((win_width-video_width)/2) + "px";
	overlay.style.top = ((win_height-video_height)/3) + "px";
	overlay.style.display = "block";

}


// ----- Close Video ----- 

function closeVideo() {
	var screen = document.getElementById("PageScreen");
	screen.style.display = "none";
	var flash = document.getElementById("FlashPlaceholder");
	flash.parentNode.removeChild(flash);
	var content = document.getElementById("OverlayContent");
	var flashdiv = document.createElement("div");
	flashdiv.id = "FlashPlaceholder";
	content.insertBefore(flashdiv,content.firstChild);
	var overlay = document.getElementById("OverlayPanel");
	overlay.style.display = "none";
}

