//<!--
///////////////////////////////////////////////////////////////////////////////
//	Symantec Corporation
//	Flash Items - Javascript for Calling Flash page items
// 
//	Description:
//		This script is used for loading the various flash items to be used
//
//	Author: Kevin De Angelis (KJD) <Kevin_DeAngelis - Symantec.com>
// 	Date: 	2006.11.13
//
//	Revisions:
//		2006.11.13 KJD: Initial script created
//		2007.08.15 KJD: Added VBScript Object for each flash
//
///////////////////////////////////////////////////////////////////////////////

// 2006.08.29 KJD: For counting the videos on the page
var MovieArray 	= new Array();
var MovieNumber = 0;

///////////////////////////////////////////////////////////////////////////////
// DisplayFlash 	- Set up and display a pre-activated Flash movie
// Author: 		Kevin De Angelis
// Date: 		2006.11.10
// Receive: 	string, integer, integer
// Return: 		void
///////////////////////////////////////////////////////////////////////////////
function DisplayFlash( PlayerFrame, Flash_width, Flash_height, Flash_name, returnString  )
{
	if( ( typeof Flash_name 	== "undefined" ) || ( Flash_name 	== ""	) ){ Flash_name 	= "FlashMovie"; }
	if( ( typeof returnString 	== "undefined" ) || ( returnString 	== ""	) ){ returnString 	= 0; 			}

	// 2006.08.29 KJD: The Flash string for loading and displaying
	var FlashString = "<DIV STYLE=\"background-color:none;border:none;width:" + parseInt( Flash_width ) 		+ ";height:" + parseInt( Flash_height + 11 ) 	+ ";\">";
	FlashString += "<object classid	= \"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" ";
	FlashString += "	codebase	= \"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" ";
	FlashString += "	width		= \"" + parseInt( Flash_width ) 		+ "\" ";
	FlashString += "	height		= \"" + parseInt( Flash_height + 11 ) 	+ "\" ";
	FlashString += "	id			= \"" + Flash_name + "\" ";
	FlashString += "	align		= \"left\" ";
	FlashString += "	STYLE		= 'margin: 0px 0px 0px 0px;padding:0px 0px 0px 0px;border:none;text-align:left;vertical-align:top;'>";
	
	FlashString += "<param name	= \"allowScriptAccess\" value= \"sameDomain\" />";
	FlashString += "<param name	= \"movie\" 			value= \"" + PlayerFrame + "\" />";
	FlashString += "<param name	= \"swliveconnect\" 	VALUE= \"true\">";
	FlashString += "<param name	= \"quality\" 			value= \"high\" />";
	FlashString += "<param name	= \"bgcolor\" 			value= \"#ffffff\" />";
	FlashString += "<param name	= \"wmode\" 			value= \"transparent\" />";
	FlashString += "<param name	= \"align\" 			value= \"left\" />";
	

	FlashString += "<embed src				= \"" + PlayerFrame + "\" ";
	FlashString += "	quality				= \"high\" ";
	FlashString += "	bgcolor				= \"#ffffff\" ";
	FlashString += "	swliveconnect		= \"true\" ";
	FlashString += "	name				= \"" + Flash_name + "\" ";
	FlashString += "	align				= \"left\" ";
	FlashString += "	width				= \"" + parseInt( Flash_width ) 		+ "\" ";
	FlashString += "	height				= \"" + parseInt( Flash_height + 11 ) 	+ "\" ";
	FlashString += "	allowScriptAccess	= \"sameDomain\" ";
	FlashString += "	type				= \"application/x-shockwave-flash\" ";
	FlashString += "	pluginspage			= \"http://www.macromedia.com/go/getflashplayer\" ";
	FlashString += "	wmode				= \"transparent\" ";
	FlashString += "/>";
	
	FlashString += "</object></DIV>";
	
	if( returnString )
	{
		return FlashString;
	}
	else
	{
		document.write( FlashString );
	}

	// 2007.08.15 KJD: Also set up the VBscript
	document.write( SetFlashVB( Flash_name ) );	
}

///////////////////////////////////////////////////////////////////////////////
// ShowFlashVideo 	- Write the HTML to show the Flash movie
// Author: 		Kevin De Angelis
// Date: 		2006.08.29
// Receive: 	string, integer, integer, string, string, string
// Return: 		document.write
///////////////////////////////////////////////////////////////////////////////
function ShowFlashVideo( Flash_movie, Flash_name, Flash_message, Flash_image, Flash_width, Flash_height, returnString )
{
	// 2006.11.13 KJD: The Skin and player to use
	var PlayerSkin 	= "../flash/SymantecExternalPlaySeekMute.swf";
	// var PlayerFrame	= "/flash/20070209/VideoPlayer.swf";
	var PlayerFrame	= "../flash/videoplayer.swf";

	
	// 2006.08.29 KJD: Variable for error checking
	var ErrorString = "";

	// 2006.08.29 KJD: Error check, if there's no name declared
	if( ( typeof Flash_name == "undefined" ) || ( Flash_name == "" ) )			{		ErrorString 	+= "ERROR: The 'Flash_name' (value #4) variable must be declared.<br>"; 	}

	// 2006.08.29 KJD: Check for movie being declared.
	if( ( typeof Flash_movie == "undefined" ) || ( Flash_movie == "" ) )		{		ErrorString 	+= "ERROR: The 'Flash_movie' (value #1) variable must be declared.<br>";	}

	// 2006.08.29 KJD: If no message is stated, let's create one.	
	if( ( typeof Flash_message == "undefined" ) || ( Flash_message == "" ) )	{		Flash_message 	= "Click <b>PLAY</b> to view";	}

	// 2006.08.29 KJD: Check for width
	if( ( typeof Flash_width == "undefined" ) || !( Flash_width ) )				{		Flash_width 	= 375;	}

	// 2006.08.29 KJD: Check for height
	if( ( typeof Flash_height == "undefined" ) || !( Flash_height) )			{		Flash_height 	= 230;	}

	// 2007.03.20 KJD: Added returnString
	if( ( typeof returnString 	== "undefined" ) || ( returnString 	== ""	) )	{ 		returnString 	= 0; 			}
	
	if( ErrorString == "" )
	{
		// 2006.08.29 KJD: Create an array of movies we need to load
		var thisLength = MovieArray.length;
		MovieArray[ thisLength ] 			= new Array();
		MovieArray[ thisLength ]['name'] 	= Flash_name;
		MovieArray[ thisLength ]['message'] = Flash_message;
		MovieArray[ thisLength ]['movie'] 	= Flash_movie;
		MovieArray[ thisLength ]['image']	= Flash_image;
		MovieArray[ thisLength ]['skin']	= PlayerSkin;
		
		// 2007.02.13 KJD: Added
		MovieArray[ thisLength ]['width']	= Flash_width;
		MovieArray[ thisLength ]['height']	= Flash_height;
		
		// 2006.11.13 KJD: Display the Flash
		if( returnString )
		{
			return DisplayFlash( PlayerFrame, Flash_width, Flash_height, Flash_name, returnString  );
		}
		else
		{
			DisplayFlash( PlayerFrame, Flash_width, Flash_height, Flash_name, returnString  );
			
			// 2006.08.29 KJD: Wait for a second to load the movie first
			window.setTimeout( "SendDataToFlashMovie()", 1250 );
		}
	}
	else
	{
		document.write( ErrorString );
	}
}

///////////////////////////////////////////////////////////////////////////////
// FlashVideo	Send an action to the flash video player
// Author: 		Kevin De Angelis
// Date: 		2007.03.27
// Receive: 	string, string ( play, pause, stop, mute )
// Return: 		void
///////////////////////////////////////////////////////////////////////////////
function FlashVideo( playername, playeraction )
{
	var myFlash = getFlashMovieObject( playername );
	
	myFlash.SetVariable( "action_" + playeraction,	"1" );
}


///////////////////////////////////////////////////////////////////////////////
// SendDataToFlashMovie 	- Variables to send to flash video player
// Author: 		Kevin De Angelis
// Date: 		2006.08.29
// Receive: 	void
// Return: 		void
///////////////////////////////////////////////////////////////////////////////
function SendDataToFlashMovie(  )
{
	for( var i=0; i < MovieArray.length; i++ )
	{
		setTimeout( "SendFlashVars( " + i + ")", ( 231 * i ) );
	}
}

///////////////////////////////////////////////////////////////////////////////
// SendFlashVars		Variables to send to flash video player - fix for Max FF
// Author: 				Kevin De Angelis
// Date: 				2007.04.04
// Receive: 			integer
// Return: 				void
///////////////////////////////////////////////////////////////////////////////
function SendFlashVars( thisMovieNumber )
{
	var flashMovie = getFlashMovieObject( MovieArray[ thisMovieNumber ]['name'] );
	
	flashMovie.SetVariable( "/:LoadingText", 	MovieArray[ thisMovieNumber ]['message'] 	);
	flashMovie.SetVariable( "/:ShowMovie", 		MovieArray[ thisMovieNumber ]['movie'] 		);
	flashMovie.SetVariable( "/:MovieSkin", 		MovieArray[ thisMovieNumber ]['skin'] 		);
	flashMovie.SetVariable( "/:LoadingImage", 	MovieArray[ thisMovieNumber ]['image'] 		);

	// 2007.02.13 KJD: Added
	flashMovie.SetVariable( "/:MovieWidth", 	MovieArray[ thisMovieNumber ]['width'] 		);
	flashMovie.SetVariable( "/:MovieHeight", 	MovieArray[ thisMovieNumber ]['height']		);
	
	flashMovie.SetVariable( "/:MovieName", 		MovieArray[ thisMovieNumber ]['name']		);

	
	// 2007.03.27 KJD: Updated to set Stage size
	document.getElementById( MovieArray[ MovieNumber ]['name'] ).style.width = MovieArray[ thisMovieNumber ]['width'];
	document.getElementById( MovieArray[ MovieNumber ]['name'] ).style.height = MovieArray[ thisMovieNumber ]['height'] + 11;
	
	
	MovieNumber = thisMovieNumber;
}


///////////////////////////////////////////////////////////////////////////////
// getFlashMovieObject 	- Get the ID of the flash video player
// Author: 		Kevin De Angelis
// Date: 		2006.08.29
// Receive: 	void
// Return: 		object
///////////////////////////////////////////////////////////////////////////////
function getFlashMovieObject( movieName )
{
	if ( window.document[movieName] ) 
	{
		return window.document[movieName];
	}
	
	if ( navigator.appName.indexOf("Microsoft Internet") == -1 )
	{
		if (document.embeds && document.embeds[movieName])
		{
			return document.embeds[movieName]; 
		}
	}
	else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
	{
		return document.getElementById( movieName );
	}
}

///////////////////////////////////////////////////////////////////////////////
// Podcast 		Send an action to the podcast player
// Author: 		Kevin De Angelis
// Date: 		2007.03.26
// Receive: 	string, string ( play, pause, stop, rewind )
// Return: 		void
///////////////////////////////////////////////////////////////////////////////
function Podcast( playername, playeraction )
{
	var myFlash = getFlashMovieObject( playername );
	
	myFlash.SetVariable( "action_" + playeraction,	"1" );
}


///////////////////////////////////////////////////////////////////////////////
// DisplayPodcast 	Show a podcast on a page
// Author: 			Kevin De Angelis
// Date: 			2007.03.26
// Receive: 		string, string, string, string, string
// Return: 			void
///////////////////////////////////////////////////////////////////////////////
function DisplayPodcast( podcastname, podcastfile, autoStart, frontColor, backColor )
{
	if( ( typeof podcastname 	== "undefined" ) || ( podcastname 	== ""	) )	{ 		podcastname = "myPodcast"; 		}
	if( ( typeof autoStart 		== "undefined" ) || ( autoStart 	== ""	) )	{ 		autoStart 	= "false"; 			}
	if( ( typeof frontColor		== "undefined" ) || ( frontColor 	== ""	) )	{ 		frontColor 	= "ffffff";			}
	if( ( typeof backColor		== "undefined" ) || ( backColor 	== ""	) )	{ 		backColor 	= "000000";			}

	var thisPlayer = "";

	thisPlayer += "<object ";
	thisPlayer += "	classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"250\" height=\"30\"";
	thisPlayer += "    codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\"";
	thisPlayer += "	ID=\"" + podcastname + "\"";
	thisPlayer += "	>";
	thisPlayer += "    <param name=\"movie\" value=\"../flash/podcastPlayer20070326.swf?file=" + podcastfile + "&autoStart=" + autoStart + "&backColor=" + backColor + "&frontColor=" + frontColor + "&songVolume=90\" />";
	thisPlayer += "    <param name=\"wmode\" value=\"transparent\" />";
	thisPlayer += "	<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
	thisPlayer += "	<param name=\"swLiveConnect\" VALUE=\"true\" />";
	thisPlayer += "    <embed wmode=\"transparent\" ";
	thisPlayer += "		width=\"250\" ";
	thisPlayer += "		height=\"30\" ";
	thisPlayer += "		src=\"../flash/podcastPlayer20070326.swf?file=" + podcastfile + "&autoStart=" + autoStart + "&backColor=" + backColor + "&frontColor=" + frontColor + "&songVolume=90\"";
	thisPlayer += "		type=\"application/x-shockwave-flash\" ";
	thisPlayer += "		pluginspage=\"http://www.macromedia.com/go/getflashplayer\"";
	thisPlayer += "		NAME=\"" + podcastname + "\"";
	thisPlayer += "		swLiveConnect=\"true\"";
	thisPlayer += "		allowScriptAccess=\"sameDomain\"";
	thisPlayer += "	></embed>";
	thisPlayer += "</object>";

	document.write( thisPlayer );
}

/* ****************************************************************************
SetFlashVB		Set up the Flash VBScript
Author: 		Kevin De Angelis
Date: 			2007.08.15
Receive: 		string
Return: 		string
**************************************************************************** */
function SetFlashVB( thisFlashName )
{
	// 2007.07.27 KJD: Catch FSCommand in IE
	var thisString = ""
		
		// 2007.08.15 KJD: Set Up VB function
		+ "<SCR" + "IPT LANGUAGE=\"VBScript\">"
		+ "Sub " + thisFlashName + "_FSCommand(ByVal command, ByVal args)\n"
		+ "call FlashItem_DoFSCommand( args )\n"
		+ "end sub"
		+ "</SCR" + "IPT>"

	return thisString;
}

/* ****************************************************************************
thisHeader_DoFSCommand	Capture Flash FSCommand to surpres mouse-clicks
Author: 				Kevin De Angelis
Date: 					2007.07.27
Receive: 				null
Return: 				null
**************************************************************************** */
function FlashItem_DoFSCommand( thisArg )
{
	var myCheck = thisArg.toLowerCase();
	
	if( myCheck.indexOf( 'javascript:' ) > -1 )
	{
		thisArg = thisArg.replace( "javascript:", "" );
		eval( thisArg );
	}
	else
	{
		// 2007.09.07 KJD: Updated for document.referrer
		// location.href = thisArg;
		URLredirect( thisArg );
	}
}

//-->