/*	File:					eyflashplayervideobox.js
	Brief:					add-on to flashplayerapi.js - Provides video box functionality to Flash player
	Author:				Eddie Hermoso (eddie.hermoso@ey.com)
	Copyright:				Ernst & Young (2009)
	Document Referral:		flash_player_API.doc
	Text Characteristics:		4 Character Tabs, 104 Character Line Width
	Character Encoding:		ANSI
	Language:				JavaScript
	Editing Environment:		Notepad++ (http://notepad-plus.sourceforge.net/)
_____________________________________________________________________________________
	
	Version:	Date:				Author:			Summary:
	1.0.0		4/9/2009			Eddie Hermoso		initial release
_____________________________________________________________________________________
*/


/* closes the popup window */
function closeIt(){

	// stop the media player
	if(swfLoaded)
		stopMedia();
	
	// hide the gray overlay and the popup window
	document.getElementById("gray_overlay").style.visibility = "hidden";
	document.getElementById("popup").style.visibility = "hidden";
	//needed on adv content sites where introductory flash animation is present
	$('#introflash').show();

}


function showVideoWindow(){
	
	var isIE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
	if(isIE6 == true){
		document.getElementById("gray_overlay").style.visibility = "visible";
	} else {
		document.getElementById("gray_overlay").style.visibility = "visible";
	}

	
	// if the browser window's height is bigger than the actual content
	if(document.body.clientHeight < window.screen.availHeight){
		
		// set the height to the available window height
		document.getElementById("gray_overlay").style.height = (window.screen.availHeight + document.body.clientTop) + "px";
	} else {
	
		// set the height to the actua lscrollable surface
		document.getElementById("gray_overlay").style.height = (document.body.clientHeight + document.body.clientTop) + "px";	
	}
	
	document.getElementById("popup").style.visibility = "visible"; 
}

function loadMovieInBox(mediaURL, aspect, title, descrip){
	
	showVideoWindow();
	
	if(!aspect)
		aspect = "";
		
	if(!title)
		title = "";

	if(!descrip)
		descrip = "";
		
	playMovieOnload(mediaURL, aspect);
	
	document.getElementById("media_title").innerHTML = title;
	document.getElementById("media_descrip").innerHTML = descrip;

}


function writeBox(){

	document.write(
	
		'<div id="gray_overlay"></div>' + 
		'<div id="popup">' + 

			'<div id="video_area">' + 
				'<div id="swf_container">' +
				'<img src="/Media/vwLUImages/video_player_nonflash/$FILE/video_player_nonflash.jpg" width="464" height="384" alt="Please visit adobe.com to download the latest Adobe Flash Player" border="0" /><noscript>You must enable JavaScript on your web browser to view this content.</noscript>' + 
				'</div>' + 
			'</div>' + 


			'<div id="text_area">' + 

				'<div id="media_title"></div>' + 
				'<div id="media_descrip"></div>' + 
				
			'</div>' + 
			
			'<div id="close_area">' + 
				'<div onclick=\'closeIt()\' id="close_button" title="Close Window">' + 
					'<div id="close_button_text">Close</div>' + 
				'</div>' + 
			'</div>' + 
			
		'</div>'
	);
	

}

writeBox();
