// JavaScript Document

function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}


var bWin32IE;
if ((navigator.userAgent.indexOf("IE")
    > -1) && (navigator.platform == "Win32")) {
     bWin32IE = true;
} else {
     bWin32IE = false;
}

function playVideo(){
   if (bWin32IE == true) {
      WMPlay.CurrentPosition = 0;
       WMPlay.play();
   } else {
      document.WMPlay.SetCurrentPosition(0);
      document.WMPlay.Play();
      
   }
}

function stopVideo(){
	alert ('');
   if (bWin32IE == true) {
      WMPlay.stop();
   } else {
      document.WMPlay.Stop();
      document.WMPlay.SetCurrentPosition(0);
   }
}

var videoFormat = 'flv';
var videoObject = 0;
function runVideo(param){
	//alert (param);
	if (param=='wmv') videoObject='<OBJECT ID="MediaPlayer" WIDTH="400" HEIGHT="300" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject"><PARAM NAME="FileName" VALUE="assets/video/RLTeaser400.wmv"><PARAM name="autostart" VALUE="true"><PARAM name="ShowControls" VALUE="false"><param name="ShowStatusBar" value="false"><PARAM name="ShowDisplay" VALUE="false"><param name="scale" value="tofit"><EMBED ID="MediaPlayer" TYPE="application/x-mplayer2" SRC="assets/video/RLTeaser400.wmv" NAME="MediaPlayer" WIDTH="400" HEIGHT="300" scale="tofit" ShowControls="0" ShowStatusBar="0" ShowDisplay="0" autostart="1"> </EMBED></OBJECT>'
	if (param=='mov') videoObject='<object id="QTplayer" CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="400" height="300" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab"><param name="src" value="assets/video/RLTeaser400.mov"><param name="autoplay" value="true"><param name="loop" value="false"><param name="controller" value="false"><param name="scale" value="tofit"><embed id="QTplayer" src="assets/video/RLTeaser400.mov" width="400" height="300" scale="tofit" autoplay="true" loop="false" controller="false" pluginspage="http://www.apple.com/quicktime/"></embed>'
	if (param=='flv') videoObject='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="400" height="300" id="FLVPlayer"><param name="movie" value="FLVPlayer_Progressive.swf" /><param name="salign" value="lt" /><param name="bgcolor" value="#000000" /><param name="skinAutoHide" value="true" /><param name="quality" value="high" /><param name="scale" value="tofit" /><param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Clear_Skin_3&streamName=http://s3.amazonaws.com/rlpn_static_content/visan_com.video_assets.RLTeaser400&autoPlay=true&autoRewind=true&skinAutoHide=true" /><embed src="FLVPlayer_Progressive.swf" flashvars="&MM_ComponentVersion=1&skinName=Clear_Skin_3&streamName=http://s3.amazonaws.com/rlpn_static_content/visan_com.video_assets.RLTeaser400&autoPlay=true&autoRewind=true&skinAutoHide=true" quality="high" scale="noscale" bgcolor="#000000" skinAutoHide="true" width="400" height="300" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>'
	if (param=='none') videoObject='&nbsp;'
	if (videoObject != 0) document.getElementById('videobox').innerHTML=videoObject;
}
function setVideo(param) {
	videoFormat=param;
}

function playVideo() {
	runVideo(videoFormat);
}

MM_CheckFlashVersion('8,0,0,0','Content on this page requires a newer version of Macromedia Flash Player. Do you want to download it now?');
