// RICH MEDIA PROJECT : JAVASCRIPT PHP FLV FULLSCREEN PLAYER

// DETECT FLASH PLAYER VERSION FOR FULLSCREEN EXPERIENCE (from Flash Player v9.0.28) 

detectFlashPlayer=true;

// fullScreenFunction : if false, fullscreen mode won't be available
fullScreenFunction=true;


// PHP SCRIPT PATH 

// Path of the PHP provider script relative to the "player.swf" file or absolute (movies should be located in the same folder)
phpPath="http://www.monumentalmedia.com/arc/gaw/aaronturpeau/001/movies/flvprovider.php";
// movieName without extension, check bandwidth detector if you want to use different versions of a movie
movieName="AaronTurpeau";


// BEHAVIOURS
bufferTime=5;
volume=100;
autoStart=true;

// Behaviours when autoStart=false
// startPauseMode="Picture" | startPauseMode="First Frame" | startPauseMode="Empty Screen"
startPauseMode="First Frame";
// picturesFolder : the relative or absolute path to the folder where the pictures are. 
// Use the movieName for your pictures' names (myMovie.jpg for a movieName myMovie)
picturesFolder="pictures";
// startShowControls : if true, show the controls when play button is pressed.
startShowControls=true;

// endBehaviour : behaviour when the movie ends.
// endBehaviour="Stop" | endBehaviour="Loop"
endBehaviour="Stop";
// endFullScreenBackToNormal : if true, get back to normal mode when the movie ends in fullscreen mode
endFullScreenBackToNormal=true;
// endJavascriptFunction : a javascript function that will be called at the end of the movie
endJavascriptFunction="";
// stopCloseConnect : if true, the connection will be closed when stop button is pressed.
stopCloseConnect=true;


// BANDWIDTH DETECTOR
// Set differentVersions to true to enable bandwidth detection
// If differentVersions=false upload a single version of a movie on your server : [movieName].flv
// if differentVersions=true upload three different versions of a movie on your server :
// [movieName][version_hi_extension].flv
// [movieName][version_medium_extension].flv
// [movieName][version_low_extension].flv

differentVersions=true;
version_hi_value=1000;
version_medium_value=400;
version_low_value=150;
version_hi_extension="_1000";
version_medium_extension="_400";
version_low_extension="_150";


// PLAYER'S PROPERTIES

// SIZE AND COLORS
playerWidth=550;
playerHeight=396;
// autoSize="Movie" | autoSize="Off";
autoSize="Movie";
// If autoSize="Off", you can define blackborders
// You can use negative values to zoom into the movie
blackBorderWidth=0;
blackBorderHeight=0;
playerColor="#000000";
barColor="#FFFFFF";
playbarColor="#DDDEEE";
screenBorder=false;
screenBorderColor="#FFFFFF";
buttonsColor="#ffffff";
timeColor="#ff7722";
backgroundColor="#000000";
backgroundAlpha=100;
controlsY=0;

// CONTROLS POSITION AND COLORS in FULLSCREEN MODE
// ControlsYFullScreen, y position from the bottom of the screen
controlsYFullScreen=80;
playerColorFullScreen="#FFFFFF";
barColorFullScreen="#FFFFFF";
playbarColorFullScreen="#DDDEEE";
buttonsColorFullScreen="#333333";
timeColorFullScreen="#333333";
backgroundColorFullScreen="#000000";
backgroundAlphaFullScreen=100;

// CONTROLS
// controls="Hide" | controls="Autohide" | controls="Show"
controls="Show";
stopButton=true;
stopButtonFirst=true;
rewindFastForwardButtons=true;
// rw_ff_interval in seconds
rw_ff_interval=4;
volumeSlider=true;
showTimecode=true;
controlsBarPress=true;
// timeFormat="mm:ss" | timeFormat="hh:mm:ss" | timeFormat="mm:ss|duration" | timeFormat="hh:mm:ss|duration"
timeFormat="mm:ss|duration";
// doubleClickListener to go Fullscreen
doubleClickListener=true;

// BUFFER MESSAGE
bufferMessage=true;
bufferText="buffering";
bufferTextColor="#FFFFFF";
bufferTextBackgroundColor="#993333";
bufferTextBackgroundAlpha=40;
// bufferTextPosition="Upper Right" | bufferTextPosition="Upper Left" | bufferTextPosition="Lower Right" | bufferTextPosition="Lower Left" | bufferTextPosition="Center"
bufferTextPosition="Upper Right";

// LOGO
logo=false;
// logo can be a jpg or a swf
logoPath="";
// logoPosition="Upper Right" | logoPosition="Upper Left" | logoPosition="Lower Right" | logoPosition="Lower Left"
logoPosition="Upper Right";
logoAlpha=70;
logo_x=10;
logo_y=10;


// COMMERCIAL
playCommercialFirst=false;
commercialMovieName="";
commercialLink="";
commercialText="Your movie will start after this commercial...";
commercialTextColor="#333333";
commercialTextBold=true;


// SUBTITLES

subtitleXML="";
// subVisible at start
subVisible=true;
subButton=false;
subButtonOffColor="#CCCCCC";
subColor="#FFFFFF";
subBackground=true;
subBackgroundColor="#333333";
subBackgroundAlpha=40;
subFontSize=14;
autohideSubBackground=false;
// subAlign="left" | subAlign="center" | subAlign="right"
subAlign="center";
blankLineListMode=2;

// SUBTITLES COLORS IN FULLSCREEN MODE
subColorFullScreen="#FFFFFF";
subBackgroundFullScreen=false;
subBackgroundColorFullScreen="#993333";
subBackgroundAlphaFullScreen=40;
subFontSizeFullScreen=20;
autohideSubBackgroundFullScreen=false;
// subAlignFullScreen="left" | subAlignFullScreen="center" | subAlignFullScreen="right"
subAlignFullScreen="center";
blankLineFullScreen=2;


// POP UP

// Detect Flash Player Pop Up
// Detect Flash Player Text=[detectPopUpText1]+[versionNumber]+[detectPopUpText2]
// You can use HTML tags

detectPopUpTitle="Adobe Flash Player Version";
detectPopUpText1="You have Flash Player<br>version ";
detectPopUpText2=" installed.<br><br>Enjoy a fullscreen<br>experience with the new Flash Player.";
detectPopUpButton1="Get Flash";
detectPopUpButton2="Continue";

// Detect Bandwidth Pop Up
// Detect Bandwidth Result Text=[bandwidthDetectPopUpText2]+[bandwidth]+" kbps"

displayBandwidthDetectPopUp=true;
bandwidthDetectPopUpTitle="MONUMENTALmedia Speed Detector";
bandwidthDetectPopUpText1="Detecting Bandwidth<br>Please wait...";
bandwidthDetectPopUpText2="Your Bandwidth :<br>"

// Loading Movie Pop Up
displayLoadingMoviePopUp=true;
loadingMoviePopUpTitle="Loading...";
loadingMoviePopUpText="Loading Movie<br>Please wait..."


// Select Bandwidth Pop Up
// Select Bandwidth Text=[bandwidthSelectPopUpText1]+[bandwidthTextForXXXBandwidth]+[bandwidthSelectPopUpText2]+[version_XXX_value]+[bandwidthSelectPopUpText3]

bandwidthSelectPopUpTitle="MONUMENTAL Speed Selector";
bandwidthSelectPopUpButton1="Low";
bandwidthSelectPopUpButton2="Medium";
bandwidthSelectPopUpButton3="Hi";

bandwidthTextForLowBandwidth="Low";
bandwidthTextForMediumBandwidth="Medium";
bandwidthTextForHiBandwidth="Hi";

bandwidthSelectPopUpText1="";
bandwidthSelectPopUpText2=" bandwidth is selected :<br>";
bandwidthSelectPopUpText3=" kbps movie.<br><br>Please select the desired<br>bandwidth :";

// Info Pop Up
// This pop up is displayed if no movie is loaded at start (movieName="")
displayInfoPopUp=true;
infoPopUpTitle="Select movie";
infoPopUpText="Please select a movie in the gallery"


// SWF PROPERTIES

// swfPath : path of the swf that contains the player without swf extension
swfPath="http://www.monumentalmedia.com/arc/gaw/aaronturpeau/001/swf/player";
// swfID : name of the Flash Object
swfID="player";
// speedClipPath : path of the swf that contains the speed detector clip without swf extension
speedClipPath="http://www.monumentalmedia.com/arc/gaw/aaronturpeau/001/swf/speedClip";
swfWidth=playerWidth;
swfHeight=playerHeight+controlsY+1;
swfBackgroundColor="#FFFFFF";

// OBJECT BUILDER : DO NOT MODIFY THIS SCRIPT

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		for (var i in params)
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
		str +='swLiveConnect=true ';
  		str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


function createObject() {

AC_FL_RunContent(
			"src", swfPath,
			"FlashVars", "version_hi_value="+version_hi_value+'&version_medium_value='+version_medium_value+'&version_low_value='+version_low_value+'&version_hi_extension='+version_hi_extension+'&version_medium_extension='+version_medium_extension+'&version_low_extension='+version_low_extension+'&detectFlashPlayer='+detectFlashPlayer+'&phpPath='+phpPath+'&movieName='+movieName+'&differentVersions='+differentVersions+'&subtitleXML='+subtitleXML+'&autoSize='+autoSize+'&playerWidth='+playerWidth+'&playerHeight='+playerHeight+'&bufferTime='+bufferTime+'&autoStart='+autoStart+'&endBehaviour='+endBehaviour+'&controls='+controls+'&screenBorder='+screenBorder+'&controlsY='+controlsY+'&stopButton='+stopButton+'&rewindFastForwardButtons='+rewindFastForwardButtons+'&subButton='+subButton+'&volumeSlider='+volumeSlider+'&playerColor='+playerColor+'&playbarColor='+playbarColor+'&timeColor='+timeColor+'&barColor='+barColor+'&buttonsColor='+buttonsColor+'&screenBorderColor='+screenBorderColor+'&subColor='+subColor+'&subButtonOffColor='+subButtonOffColor+'&subBackgroundColor='+subBackgroundColor+'&subBackgroundAlpha='+subBackgroundAlpha+'&backgroundColor='+backgroundColor+'&backgroundAlpha='+backgroundAlpha+'&subBackground='+subBackground+'&subVisible='+subVisible+'&subFontSize='+subFontSize+'&autohideSubBackground='+autohideSubBackground+'&volume='+volume+'&commercialText='+commercialText+'&commercialTextColor='+commercialTextColor+'&commercialTextBold='+commercialTextBold+'&bufferTextBackgroundColor='+bufferTextBackgroundColor+'&bufferTextBackgroundAlpha='+bufferTextBackgroundAlpha+'&bufferTextColor='+bufferTextColor+'&bufferTextPosition='+bufferTextPosition+'&bufferText='+bufferText+'&timeFormat='+timeFormat+'&logo='+logo+'&logoPath='+logoPath+'&logoPosition='+logoPosition+'&logoAlpha='+logoAlpha+'&logo_x='+logo_x+'&logo_y='+logo_y+'&controlsBarPress='+controlsBarPress+'&bufferMessage='+bufferMessage+'&showTimecode='+showTimecode+'&subAlign='+subAlign+'&rw_ff_interval='+rw_ff_interval+'&stopButtonFirst='+stopButtonFirst+'&detectPopUpTitle='+detectPopUpTitle+'&detectPopUpText1='+detectPopUpText1+'&detectPopUpText2='+detectPopUpText2+'&detectPopUpButton1='+detectPopUpButton1+'&detectPopUpButton2='+detectPopUpButton2+'&bandwidthDetectPopUpTitle='+bandwidthDetectPopUpTitle+'&bandwidthDetectPopUpText1='+bandwidthDetectPopUpText1+'&bandwidthDetectPopUpText2='+bandwidthDetectPopUpText2+'&bandwidthSelectPopUpTitle='+bandwidthSelectPopUpTitle+'&bandwidthSelectPopUpButton1='+bandwidthSelectPopUpButton1+'&bandwidthSelectPopUpButton2='+bandwidthSelectPopUpButton2+'&bandwidthSelectPopUpButton3='+bandwidthSelectPopUpButton3+'&bandwidthTextForLowBandwidth='+bandwidthTextForLowBandwidth+'&bandwidthTextForMediumBandwidth='+bandwidthTextForMediumBandwidth+'&bandwidthTextForHiBandwidth='+bandwidthTextForHiBandwidth+'&bandwidthSelectPopUpText1='+bandwidthSelectPopUpText1+'&bandwidthSelectPopUpText2='+bandwidthSelectPopUpText2+'&bandwidthSelectPopUpText3='+bandwidthSelectPopUpText3+'&playerColorFullScreen='+playerColorFullScreen+'&barColorFullScreen='+barColorFullScreen+'&playbarColorFullScreen='+playbarColorFullScreen+'&buttonsColorFullScreen='+buttonsColorFullScreen+'&timeColorFullScreen='+timeColorFullScreen+'&backgroundColorFullScreen='+backgroundColorFullScreen+'&backgroundAlphaFullScreen='+backgroundAlphaFullScreen+'&blankLineFullScreen='+blankLineFullScreen+'&controlsYFullScreen='+controlsYFullScreen+'&blankLineListMode='+blankLineListMode+'&subColorFullScreen='+subColorFullScreen+'&subBackgroundFullScreen='+subBackgroundFullScreen+'&subBackgroundColorFullScreen='+subBackgroundColorFullScreen+'&subBackgroundAlphaFullScreen='+subBackgroundAlphaFullScreen+'&subFontSizeFullScreen='+subFontSizeFullScreen+'&autohideSubBackgroundFullScreen='+autohideSubBackgroundFullScreen+'&subAlignFullScreen='+subAlignFullScreen+'&speedClipPath='+speedClipPath+'&fullScreenFunction='+fullScreenFunction+'&endFullScreenBackToNormal='+endFullScreenBackToNormal+'&blackBorderWidth='+blackBorderWidth+'&blackBorderHeight='+blackBorderHeight+'&displayBandwidthDetectPopUp='+displayBandwidthDetectPopUp+'&playCommercialFirst='+playCommercialFirst+'&commercialMovieName='+commercialMovieName+'&commercialLink='+commercialLink+'&loadingMoviePopUpTitle='+loadingMoviePopUpTitle+'&loadingMoviePopUpText='+loadingMoviePopUpText+'&displayLoadingMoviePopUp='+displayLoadingMoviePopUp+'&endJavascriptFunction='+endJavascriptFunction+'&stopCloseConnect='+stopCloseConnect+'&startShowControls='+startShowControls+'&picturesFolder='+picturesFolder+'&startPauseMode='+startPauseMode+'&infoPopUpText='+infoPopUpText+'&infoPopUpTitle='+infoPopUpTitle+'&displayInfoPopUp='+displayInfoPopUp,
			"menu","false",
			"width", swfWidth,
			"height", swfHeight,
			"align", "middle",
			"id", swfID,
			"quality", "high",
			"bgcolor", swfBackgroundColor,
			"name", swfID,
			"allowFullScreen","true",
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
}




// CONTROL FLASH FROM JAVASCRIPT

/* =========================================================================

CLASS: JSFCommunicator
AUTHOR: Abdul Qabiz 
DATE  : 12/13/2003

*/

function JSFCommunicator(flashMovie)
{	
	this.init(flashMovie);
}

JSFCommunicator.prototype.init = function(flashMovie) {

	if(flashMovie=="undefined") {
		var flashMovie = null;
	 }
	this.setMovie(flashMovie);
	this.functionToCall = null;
	this.functionLocationinFlash = null;
	this.functionArgs = null;
}

JSFCommunicator.prototype.setMovie = function(flashMovie)
{
	this.flashMovie = flashMovie;
}


JSFCommunicator.prototype.setVariable  = function(propName, propValue) {
	this.flashMovie.SetVariable(propName,propValue);
}

JSFCommunicator.prototype.getVariable  = function(propName) {

	var result = this.flashMovie.GetVariable(propName);
	return result;
}

JSFCommunicator.prototype.callFunction = function(fnLocation,fnName,fnArgs) {
	if(this.flashMovie==null) {	return false; }
	var flag = this.getVariable("/:triggerFn");
	var result = false;
	if(fnName=="") {return false; }
	if(fnLocation=="") {
		var fnLocation = "_level0";
	}
	this.setVariable("/:fnLocation",fnLocation);
	this.setVariable("/:fnName",fnName);
	if(typeof(fnArgs)=="object") {
		this.setVariable("/:fnArgs",fnArgs.join("$@$$"));
	}else if(typeof(fnArgs)=="number" || typeof(fnArgs)=="string") {
		this.setVariable("/:fnArgs",fnArgs);
	}
	this.setVariable("/:triggerFn",!flag);
	result = this.getVariable("triggerFnStatus");
	this.setVariable("/:triggerFnStatus",false);
	return result;	
}

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
	
  } else {
   return window.document[movieName]
  }
}


function createJSFCommunicatorObject(playerObj)
{
		//create an instance of JSFCommunicator, pass the flashMovie's reference
		//make sure flash object is loaded when you create this object with parameter otherwise
		//you can JSFCommunicator.setMovie(flashMovie) once flash object is loaded
		fc = new JSFCommunicator(playerObj);
}


// =========================================================================

function play() {
fc.callFunction("_level0","playMovie");		
}
function pause() {
fc.callFunction("_level0","pauseMovie");		
}
function stop() {
fc.callFunction("_level0","stopMovie");		
}
function seek(time) {
fc.callFunction("_level0","seek",[time]);		
}
function load(movie,sub) {
fc.callFunction("_level0","load",[movie,sub]);		
}
function loadWithCommercial(com,movie,comlink,sub) {
fc.callFunction("_level0","loadWithCommercial",[com,movie,comlink,sub]);		
}
function showSubtitles() {
fc.callFunction("_level0","showSubtitles");		
}
function hideSubtitles() {
fc.callFunction("_level0","hideSubtitles");		
}
function showControls() {
fc.callFunction("_level0","showControls");		
}
function hideControls() {
fc.callFunction("_level0","hideControls");		
}
function setVolume(v) {
fc.callFunction("_level0","setVolume",[v]);		
}
function mute() {
fc.callFunction("_level0","mute");		
}
function changeSubtitles(sub) {
fc.callFunction("_level0","changeSubtitles",[sub]);		
}
function close() {
fc.callFunction("_level0","close");		
}


createObject();

createJSFCommunicatorObject(thisMovie(swfID));

