<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 45;
// -----------------------------------------------------------------------------
// -->

/*
	PARAMETERS: 
	
	filePath => The relative or absolute path to the video file
	flashPlayerSourceFolder => the relative or absolute path to where player.swf is located.
	autoplay => true or false value

	NOTES:
	filePath: REQUIRED FIELD, if not specified function will return with an error message
	flashPlayerSourceFolder: if not specified, the default value is the root
	autoplay: if not specified, the default value is true
	
	THE SIZE THAT WILL BE NEEDED FOR THE PLAYER IS 420px x 320px

*/

var DEFAULT_FLASH_PLAYER_FOLDER = "Flash_Player/";
var DEFAULT_AUTOPLAY = "true";
var ERROR_MESSAGE = "INCORRECT FILENAME";

function playVideo(filePath,flashPlayerSourceFolder,autoplay)
{
	if(typeof(flashPlayerSourceFolder) == undefined || flashPlayerSourceFolder == "")
	{
		flashPlayerSourceFolder = DEFAULT_FLASH_PLAYER_FOLDER;
	}
	
	if(typeof(autoplay) == undefined || autoplay == "")
	{
		autoplay = DEFAULT_AUTOPLAY;
	}
	
	
	if(typeof(filePath) == undefined || filePath == "")
	{
		alert(ERROR_MESSAGE);
		return;
	}
		
	if (AC_FL_RunContent == 0 || DetectFlashVer == 0) 
	{
		alert("This page requires AC_RunActiveContent.js.");
	}
	else
	{
		var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
		
		if(hasRightVersion)
		{
			// if we've detected an acceptable version
			// embed the flash movie
			
			AC_FL_RunContent(
				'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0',
				'width', '640',
				'height', '520',
				'src', flashPlayerSourceFolder + 'player',
				'quality', 'high',
				'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
				'align', 'middle',
				'play', 'true',
				'loop', 'true',
				'scale', 'showall',
				'wmode', 'transparent',
				'devicefont', 'false',
				'id', 'player',
				'bgcolor', '#ffffff',
				'name', 'player',
				'menu', 'true',
				'allowScriptAccess','sameDomain',
				'allowFullScreen','true',
				'movie',flashPlayerSourceFolder + 'player',
				'salign', '',
				'Flashvars','fileName='+filePath +
				'&autoplay='+autoplay
				); //end AC code
		}
		else
		{  // flash is too old or we can't detect the plugin
			var alternateContent = 'Alternate HTML content should be placed here.'
			+ 'This content requires the Adobe Flash Player.'
			+ '<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>';
			document.write(alternateContent);  // insert non-flash content
		}
	}
}
