// RICH MEDIA PROJECT : MINI PHP FLV FULLSCREEN PLAYER & MEDIA LIST

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

detectFlashPlayer=true;

// fullScreenFunction : if false, fullscreen mode is not available
fullScreenFunction=false;


// 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.antiqueswilliamsburg.com/richmedia/movies/flvprovider.php";

// BEHAVIOURS
bufferTime=10;
autoStart=true;
volume=110;
// endBehaviour : behaviour when the movie ends. List_NextMedia : play next media in the list.
// endBehaviour="Stop" | endBehaviour="Loop" | endBehaviour="List_NextMedia"
endBehaviour="List_NextMedia";
// endFullScreenBackToNormal : if true, get back to normal mode when the movie ends in fullscreen mode
endFullScreenBackToNormal=false;
// endJavascriptFunction : a javascript function that will be called at the end of the movie
endJavascriptFunction="";
// 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=846;
version_medium_value=546;
version_low_value=371;
version_hi_extension="_HI";
version_medium_extension="_MED";
version_low_extension="_LOW";


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

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


// CONTROLS
// controls="Hide" | controls="Autohide" | controls="Show"
controls="Show";
stopButton=true;
stopButtonFirst=true;
listButtons=false;
rewindFastForwardButtons=false;
// rw_ff_interval in seconds
rw_ff_interval=4;
volumeSlider=true;
showTimecode=false;
controlsBarPress=false;
// 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";
bufferTextBackgroundColor="#993333";
bufferTextBackgroundAlpha=40;
bufferTextColor="#FFFFFF";
// bufferTextPosition="Upper Right" | bufferTextPosition="Upper Left" | bufferTextPosition="Lower Right" | bufferTextPosition="Lower Left" | bufferTextPosition="Center"
bufferTextPosition="Upper Left";


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

// COMMERCIAL MESSAGE
// commercialMessage="CommercialText+MovieName" | commercialMessage="CommercialText"
commercialMessage="CommercialText and MovieName";
commercialText="Coming next : ";
commercialTextColor="#FFFFFF";
commercialTextBold=true;


// SUBTITLES

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

// SUBTITLES 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;


// LIST'S PROPERTIES
// Set listMedia to true to give access to the media list in normal mode
listMedia=false;
// listXML is the path of the absolute or relative path to Media List XML file
listXML="http://www.antiqueswilliamsburg.com/richmedia/xml/showwamlist.xml";
showListAtStart=false;
showListInFullScreenMode=false;
// startAction="Wait for click" | startAction="Play first media"
startAction="Play first media";
// endAction="Loop list" | endAction="Reload list" | endAction="Stop" 
endAction="Stop";
listWidth=190;
// listSpace : space between movie's border and player's border in list mode.
listSpace=15;
cellHeight=80;
pictureWidth=60;
pictureHeight=68;
showDescription=true;
showPicture=true;
textFontSize=10;
titleFontSize=12;
titleBold=true;
blankLineAfterTitle=false;
textColor="#FFFFFF";
titleColor="#FFFFFF";
selectColor="#222222";
selectAlpha=60;
focusColor="#222222";
focusAlpha=40;
listButtonsColor="#FFFFFF";
listBarColor="#EEEEEE";
skinColor="#333333";
listBackgroundColor="#000000";
listBackgroundAlpha=100;
borderColor="#111111";
// spaceBP : space Before Picture | spaceBT : space Before Text | spaceAT : space After Text | spaceTT : space Top Text
spaceBP=10;
spaceBT=10;
spaceAT=20;
spaceTT=15;
scrollListener=true;
scrollSize=50;


// POP UP WINDOWS

// 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="Speed Detector";
bandwidthDetectPopUpText1="Detecting Bandwidth<br>Please wait...";
bandwidthDetectPopUpText2="Your Bandwidth :<br>"

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

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

bandwidthSelectPopUpTitle="Bandwidth Selector";
bandwidthSelectPopUpButton1="Low";
bandwidthSelectPopUpButton2="Medium";
bandwidthSelectPopUpButton3="Hi";

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

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

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


//SWF PATH & SIZE & BACKGROUND COLOR

// swfPath : path of the swf that contains the player without swf extension
swfPath="swf/media";
// swf ID : name of your Flash Object
swfID="media";
// speedClipPath : path of the swf that contains the speed detector clip without swf extension
speedClipPath="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+'&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+'&commercialMessage='+commercialMessage+'&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+'&listButtons='+listButtons+'&listMedia='+listMedia+'&listXML='+listXML+'&listWidth='+listWidth+'&listSpace='+listSpace+'&startAction='+startAction+'&endAction='+endAction+'&cellHeight='+cellHeight+'&pictureWidth='+pictureWidth+'&pictureHeight='+pictureHeight+'&showDescription='+showDescription+'&showPicture='+showPicture+'&textFontSize='+textFontSize+'&titleBold='+titleBold+'&blankLineAfterTitle='+blankLineAfterTitle+'&titleFontSize='+titleFontSize+'&textColor='+textColor+'&titleColor='+titleColor+'&selectColor='+selectColor+'&selectAlpha='+selectAlpha+'&listBackgroundColor='+listBackgroundColor+'&listBackgroundAlpha='+listBackgroundAlpha+'&scrollListener='+scrollListener+'&scrollSize='+scrollSize+'&focusColor='+focusColor+'&focusAlpha='+focusAlpha+'&listButtonsColor='+listButtonsColor+'&listBarColor='+listBarColor+'&skinColor='+skinColor+'&spaceBP='+spaceBP+'&spaceBT='+spaceBT+'&spaceAT='+spaceAT+'&spaceTT='+spaceTT+'&borderColor='+borderColor+'&showListAtStart='+showListAtStart+'&showListInFullScreenMode='+showListInFullScreenMode+'&blackBorderWidth='+blackBorderWidth+'&blackBorderHeight='+blackBorderHeight+'&displayBandwidthDetectPopUp='+displayBandwidthDetectPopUp+'&loadingMoviePopUpTitle='+loadingMoviePopUpTitle+'&loadingMoviePopUpText='+loadingMoviePopUpText+'&displayLoadingMoviePopUp='+displayLoadingMoviePopUp+'&endJavascriptFunction='+endJavascriptFunction+'&stopCloseConnect='+stopCloseConnect+'&displayInfoPopUp='+displayInfoPopUp+'&infoPopUpTitle='+infoPopUpTitle+'&infoPopUpText='+infoPopUpText,
			"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) {
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 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");		
}

function showList() {
fc.callFunction("_level0","showList");		
}
function hideList() {
fc.callFunction("_level0","hideList");		
}
function loadList(path,go) {
fc.callFunction("_level0","loadList",[path,go]);		
}


createObject();

createJSFCommunicatorObject(thisMovie(swfID));

