function BrowserDetect() {
   var ua = navigator.userAgent.toLowerCase();
   this.isBlackberry  = (ua.indexOf('blackberry') != -1);
   this.isOpera       = (ua.indexOf('opera') != -1);
   this.isIE          = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) );
   this.isNeoWare     = (ua.indexOf('NeoWare') != -1);
}
var browser = new BrowserDetect();

// Get Current Nav/Dir
url = window.location.pathname;
dir = url.substring(1, url.lastIndexOf('/'))
if(dir.indexOf('/')!=-1){
  dir = dir.substring(0,dir.indexOf('/'))
}
currentNav = null
for(i=0;i<topNav.length;i++){
  if(dir==topNav[i]){var currentNav = i;}
}
if(currentNav == null){dir = null}

onload = init;
function init(){
  moveDropdowns();
  if(currentNav != null){setActive();}
}

// Init variables
var timer; var timer2; // for showHideDivs
var currentNav; // for navigation

var xmlHttp;
var sid = Math.random();
var kbps_min = 250;  // threshold
var kbps = 0;

function loadHomePageFlash() {
  xmlHttp=GetXmlHttpObject();
  if( xmlHttp == null ) {
    return;
  }
  var testurl="5Kb.txt";
  testurl=testurl+"?sid="+sid;
  xmlHttp.onreadystatechange=stateChangedLHPF;
  xmlHttp.open("GET",testurl,true);
  xmlHttp.send(null);
}

function loadFlashBanner() {
  var so = new SWFObject("bnsf_banner.swf", "bnsf", "769", "154", "8", "#448800");
  if (deconcept.SWFObjectUtil.getPlayerVersion().major >= 8) {
    so.addParam("wmode", "opaque");
    so.addVariable("learn_url","/communities/environmental/");
    so.write("flashcontent");
  }
}

function stateChangedLHPF() {

  switch (xmlHttp.readyState) {
    case 1:
      // Request ready but not yet made
      break;
    case 2:
      // Contact established with server but nothing downloaded yet
      timerLHPF1 = new Date();
      startSec = timerLHPF1.getTime()/1000;
      break;
    case 3:
      // Opportunity to notify handler of download progress
      break;
    case 4:
      // loaded
      timerLHPF2 = new Date();
      endSec = timerLHPF2.getTime()/1000 + 0.1;
      elapSec = endSec - startSec;
      bytes = xmlHttp.responseText.length;
      kbits = ( 8 * bytes ) / 1000;
      kbps = kbits/elapSec;
      kbps = Math.round( kbps );
      if( kbps > kbps_min ) {
        loadFlashBanner();
      }
      reportBandwidth( kbps );
      break;
  }
}

function reportBandwidth(kbps) {
  xmlHttp=GetXmlHttpObject();
  if( xmlHttp == null ) {
    return;
  }
  var bandwidthurl="bandwidth.txt";
  bandwidthurl=bandwidthurl+"?sid="+sid+"&kbps="+kbps;
  //xmlHttp.onreadystatechange=stateChangedLHPF;
  xmlHttp.open("GET",bandwidthurl,true);
  xmlHttp.send(null);
}


function GetXmlHttpObject() {
  var xmlHttp=null;
  try
  {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch (e)
  {
    // Internet Explorer
    try
    {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  return xmlHttp;
}

function setActive(){
  document.images["nav" + (currentNav+1) + "img"].src = eval("nav" + (currentNav+1) + "on.src")
}

// Preload Images
nav1=new Image(); nav1.src="/images/nav1.gif"
nav1ov=new Image(); nav1ov.src="/images/nav1ov.gif"
nav1on=new Image(); nav1on.src="/images/nav1on.gif"
nav2=new Image(); nav2.src="/images/nav2.gif"
nav2ov=new Image(); nav2ov.src="/images/nav2ov.gif"
nav2on=new Image(); nav2on.src="/images/nav2on.gif"
nav3=new Image(); nav3.src="/images/nav3.gif"
nav3ov=new Image(); nav3ov.src="/images/nav3ov.gif"
nav3on=new Image(); nav3on.src="/images/nav3on.gif"
nav4=new Image(); nav4.src="/images/nav4.gif"
nav4ov=new Image(); nav4ov.src="/images/nav4ov.gif"
nav4on=new Image(); nav4on.src="/images/nav4on.gif"
nav5=new Image(); nav5.src="/images/nav5.gif"
nav5ov=new Image(); nav5ov.src="/images/nav5ov.gif"
nav5on=new Image(); nav5on.src="/images/nav5on.gif"
nav6=new Image(); nav6.src="/images/nav6.gif"
nav6ov=new Image(); nav6ov.src="/images/nav6ov.gif"
nav6on=new Image(); nav6on.src="/images/nav6on.gif"
nav7=new Image(); nav7.src="/images/nav7.gif"
nav7ov=new Image(); nav7ov.src="/images/nav7ov.gif"
nav7on=new Image(); nav7on.src="/images/nav7on.gif"
nav8=new Image(); nav8.src="/images/nav8.gif"
nav8ov=new Image(); nav8ov.src="/images/nav8ov.gif"
nav8on=new Image(); nav8on.src="/images/nav8on.gif"
nav9=new Image(); nav9.src="/images/nav9.gif"
nav9ov=new Image(); nav9ov.src="/images/nav9ov.gif"
nav9on=new Image(); nav9on.src="/images/nav9on.gif"
nav10=new Image(); nav10.src="/images/nav10.gif"
nav10ov=new Image(); nav10ov.src="/images/nav10ov.gif"
nav10on=new Image(); nav10on.src="/images/nav10on.gif"
homeArrows=new Image(); homeArrows.src="/images/home_banner_arrows.gif"
homeArrowsov=new Image(); homeArrowsov.src="/images/home_banner_arrowsOv.gif"


// Image Rollover
function iC(imageID,which,whichImg){
  navNum = imageID.substring(3)
  if(which==1){
    if(currentNav == null && whichImg == null){
      document.images[imageID+"img"].src = eval(imageID + "ov.src")}
    else {
      if(whichImg != null){document.images[whichImg].src = eval(imageID + "ov.src")}
      else if(navNum!=(currentNav+1)){document.images[imageID+"img"].src = eval(imageID + "ov.src")}
    }
  }
  else {
    if(currentNav == null && whichImg == null){document.images[imageID+"img"].src = eval(imageID + ".src")}
    else {
      if(whichImg != null){document.images[whichImg].src = eval(imageID + ".src")}
      else if(navNum!=(currentNav+1)){document.images[imageID+"img"].src = eval(imageID + ".src")}
    }
  }
}

function clearSearchBox(){
  document.f.q.className = 'homeSearch2';
}
function clearLoginBox(){
  document.frm1.IDToken1.className = 'homeSearch2';
}
function clearPswdBox(){
  document.frm1.IDToken2.className = 'homeSearch2';
}

function registerLink(){
  var host = location.host;
  var options = 'dependent,resizable,scrollbars,status,toolbar,titlebar';

  if( host.indexOf('wwwtr')!=-1 ) {
      url = 'https://wwwtr.bnsf.com/bnsf.was5/iPowerUserReg/UserReg'
  }else{
    url = 'https://www.bnsf.com/bnsf.was5/iPowerUserReg/UserReg'
  }

  window.open(url, '_blank');


}
// ShowHide Divs
var openDelay;
var navOpen = 0;
function showHide(divName,v){
  thedivname = divName;
  whichV = v;
  if(navOpen == 0){openDelay = setTimeout("showHide2(thedivname,whichV)",500)}
  else {openDelay = setTimeout("showHide2(thedivname,whichV)",1)}
}

function showHide2(divName,v){
  clearTimeout(openDelay)
  thedivname = divName;
  which = divName.substring(8)
  if (v == 1) {
    navOpen = 1;
    for(w=1;w<=10;w++){ //Close all dropdowns in case one got stuck
      showHideDiv("dropdown"+w,"hidden");
      iC('nav'+w,0);
    }
    iC('nav'+which,1)
    showHideDiv(thedivname,'visible')
    }
  else if(v == 0){
    navOpen = 0;
    timer  = setTimeout("showHideDiv(thedivname,'hidden')",250);
    timer2 = setTimeout("iC('nav'+which,0)",250);
    }
}
function showHideDiv(divName,option){
//if(browser.isIE && browser.isMac){return}
  if(browser.isIE) {
    document.all(divName).style.visibility = option;
    if(divName.indexOf(8)!=-1 || divName.indexOf(9)!=-1 || divName.indexOf(10)!=-1){
      if(option=="visible"){document.all.loginDiv.style.visibility = 'hidden';}
      if(option=="hidden"){document.all.loginDiv.style.visibility = 'visible';}
      //if(option=="visible"){document.all.divName.style.visibility = 'hidden';}
      //if(option=="hidden"){document.all.divName.style.visibility = 'visible';}
      }
    }
  else {document.getElementById(divName).style.visibility = option;}
}
function killDelay(){
  if(openDelay != undefined){window.clearTimeout(openDelay);}
  window.clearTimeout(timer);window.clearTimeout(timer2);
}

function moveDropdowns(){
  for(i=8;i<=10;i++){
    d = eval("document.getElementById('dropdown"+i+"')");
    w = d.offsetWidth
    l = d.offsetLeft
    if(w+l > 770){
      move = (l+w) - 770
      if(browser.isIE){d.style.left = l - move;}
      else{d.style.left = l - move + "px";}
    }
  }
}



// Build Drop Downs for nav.html
function buildDropDown(which){
//if(browser.isIE && browser.isMac){return}
document.write('<table cellspacing="0" cellpadding="0" border="0">')
  for(a=0;a<(eval("snav"+which+".length")-1);a++){
    if(eval("snav"+which+"[a+2]") == 0){ // Section Title
      document.write('<tr><td class="dropdownTDtitle">'+eval("snav"+which+"[a+1]")+'</td></tr>')
    } else {
      theLink = eval("snav"+which+"[a+2]")
      if(theLink.indexOf("?")!=-1 && theLink.indexOf("newwin")!=-1){ // Open in new window
        theLink = theLink.substring(0,theLink.indexOf("?"))
        document.write('<tr><td nowrap="nowrap" class="dropdownTD" onmouseover="this.className=\'dropdownTDov\'" onmouseout="this.className=\'dropdownTD\'" onclick="window.open(\''+eval("snav"+which+"[a+2]")+'\',\'_blank\')"><a href="#">'+eval("snav"+which+"[a+1]")+'</a></td></tr>')
      } else { // Open in Same Window
        // no arg fix
        //document.write('<tr><td nowrap="nowrap" class="dropdownTD" onmouseover="this.className=\'dropdownTDov\'" onmouseout="this.className=\'dropdownTD\'" onclick="window.location.href=\''+eval("snav"+which+"[a+2]")+'?menu='+eval("snav"+which+"[a]")+'&submenu=0\'"><a href="'+eval("snav"+which+"[a+2]")+'?menu='+eval("snav"+which+"[a]")+'&submenu=0">'+eval("snav"+which+"[a+1]")+'</a></td></tr>')
        document.write('<tr><td nowrap="nowrap" class="dropdownTD" onmouseover="this.className=\'dropdownTDov\'" onmouseout="this.className=\'dropdownTD\'" onclick="window.location.href=\''+eval("snav"+which+"[a+2]")+'\'"><a href="'+eval("snav"+which+"[a+2]")+'">'+eval("snav"+which+"[a+1]")+'</a></td></tr>')
      }
    }
    if(eval("snav"+which+"[a+3]") == 0){a = a + 3;}
    else{a = a + 4;}
  }
document.write('</table>')
}


// LOGIN SUBMIT & COOKIE

function loginSubmit(which){
  window.open('/login.html?type='+which,'login','width=470,height=318,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
  createCookie('bnsfloginType',which)
}
function createCookie(name,value,days){
  if (days){
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else var expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name){
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++){
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function eraseCookie(name){
  createCookie(name,"",-1);
}

function readCookieAndUpdate(){
  var cookieVar = readCookie('bnsfloginType')
  if (cookieVar){
    if(cookieVar=='Customer')document.login.portal.selectedIndex = 0;
    else if(cookieVar=='Employee') document.login.portal.selectedIndex = 1;
    else if(cookieVar=='Retiree')  document.login.portal.selectedIndex = 2;
    else if(cookieVar=='Supplier') document.login.portal.selectedIndex = 3;
  }
}

function customerLogin() {
  //https://ipower.bnsf.com/amserver/UI/Login?org=customer
  var host = location.host;
  var suffix = '.bnsf.com';
  var url = 'https://ipower.bnsf.com/amserver/UI/Login?org=customer';

  if( host.indexOf('wwwdv')!=-1 ) {
    suffix = 'dv.bnsf.com/amserver/UI/Login?org=customer';
  }
  if( host.indexOf('wwwtr')!=-1 ) {
    suffix = 'tr.bnsf.com/amserver/UI/Login?org=customer';
    //suffix = '.bnsf.com/amserver/UI/Login?org=customer';
  }

    url = 'https://ipower' + suffix;
    if( host.indexOf('wwwtr')!=-1 ) {
      url = 'https://topslptlr001.corp.bnsf.com:8243/amserver/UI/Login?org=customer';
    }

  document.frm1.action = url;
  document.frm1.submit();

}


function portalLogin(portal) {

  var host = location.host;
  var suffix = '.bnsf.com';
  var url = 'http://ipower.bnsf.com';
  var options = 'dependent,resizable,scrollbars,status,menubar,toolbar,titlebar';

  if( host.indexOf('wwwdv')!=-1 ) {
    suffix = 'dv.bnsf.com';
  }
  if( host.indexOf('wwwtr')!=-1 ) {
    suffix = 'tr.bnsf.com';
  }

  if( portal == 'Customer' ) {
    url = 'http://ipower' + suffix;
    if( host.indexOf('wwwtr')!=-1 ) {
      url = 'https://topslptlr001.corp.bnsf.com:8243/amserver/UI/Login?org=customer';
    }
  }
  if( portal == 'Employee' ) {
    url = 'http://employee' + suffix + "/";
    if( host.indexOf('wwwtr')!=-1 ) {
      url = 'http://employeetrial.bnsf.com/amserver/UI/Login?org=employee';
    }
  }
  if( portal == 'Retiree' ) {
    url = 'http://employee' + suffix + "/";
    if( host.indexOf('wwwtr')!=-1 ) {
      url = 'http://employeedv.bnsf.com/amserver/UI/Login?org=employee';
    }
  }
  if( portal == 'Supplier' ) {
    url = 'http://supplier' + suffix;
  }
  portalWin = window.open(url, '_blank', options);
  createCookie('bnsfloginType',portal, 365);
  return true;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function checkNumeric(curfield) {

  validChars = "0123456789";

  fieldName   = document.SupplierVerificationForm[curfield];
  inField = fieldName.name;
  var myNames = new String(inField);

  fieldValue  = fieldName.value;
  fieldLength = fieldValue.length;

  var err01 = "Please enter only numbers.";

  for( var i=0; i<fieldLength; i++ ) {
    if ( validChars.indexOf( fieldValue.charAt( i )) == -1 ) {
      alert( err01 );
      fieldName.focus();
      break;
    }
  }
}

// CAREERS FLASH VIDEO

var visible = 0;
var qual = 1;
var autoPlay = 'true';
var bnsfRw_baseURL = "";

function FlowPlayer( path, url, width, height, autoPlay, div ) {

  var bnsfRw_baseURL = path;

  var so = new SWFObject("/video/FlowPlayer.swf", "FlowPlayer", width, height, "8", "#FFFFFF", "true");
  so.addParam("movie", path + url );
  so.addParam("quality", "high");
  so.addParam("scale", "noscale");
  so.addParam("wmode", "transparent");
  so.addParam("flashvars", bnsfRw_baseURL + '&amp;videoFile=' + url + '&amp;autoPlay=' + autoPlay + '&amp;bufferLength=5&amp;loop=false&amp;progressBarColor1=0xAAAAAA&amp;progressBarColor2=0x555555&amp;autoBuffering=false&amp;hideControls=false');
  so.write(div);

}

function showVideo1(path,url){

  bnsfRw_baseURL = path;
  if(qual == 1) {
    w = 320;
    h = 240;
    quality = "high";
  }
  if( qual == 2 ) {
    w = 176;
    h = 132;
    quality = "low";
  }

  //alert (path+url+w+h);
  FlowPlayer( path, url, w, h, "true", "flashcontent" );

  if( qual == "1" ) {
    document.getElementById('bandwidth').innerHTML = '<div style="padding-top:5px;"><a href="#" onclick="setQuality1(\'lo\',\''+path+'\',\''+url+'\');">Dial&nbsp;Up</a></div>';
  } else {
    document.getElementById('bandwidth').innerHTML = '<div style="padding-top:5px;"><a href="#" onclick="setQuality1(\'hi\',\''+path+'\',\''+url+'\');">Broadband</a></div>';
  }

  if( visible == 0 ) {
    visible = 1;
    document.getElementById('flashVideo').style.visibility = 'visible';
  }
}

function showVideo(theName){

  if(qual == 1){w = 320; h = 240}
  if(qual == 2){w = 176; h = 132}

  vidCode = '<div align="right" style="padding-bottom:5px;"><a href="#" onclick="closeVideo();">Close</a></div>'
  vidCode += '<OBJECT ID="MediaPlayer1" width='+w+' height='+h+' classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">'
  vidCode += '<PARAM NAME="FileName" VALUE="/images/'+theName+'.flv">'
  vidCode += '<PARAM NAME="animationatStart" VALUE="true">'
  vidCode += '<PARAM NAME="transparentatStart" VALUE="true">'
  vidCode += '<PARAM NAME="autoStart" VALUE="true">'
  vidCode += '<PARAM NAME="showControls" VALUE="true">'
  vidCode += '<EMBED type="application/x-mplayer2" pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/" SRC="/images/'+theName+'_SEQ.Copy.01_WMF_Stream_'+qual+'.wmv" name="MediaPlayer1" width='+w+'  height='+h+' AutoStart=true>'
  vidCode += '</EMBED>'
  vidCode += '</OBJECT>'

  if(qual=="1"){vidCode += '<div style="padding-top:5px;"><a href="#" onclick="setQuality(\'lo\');">Dial&nbsp;Up</a></div>'}
  else {vidCode += '<div style="padding-top:5px;"><a href="#" onclick="setQuality(\'hi\');">Broadband</a></div>'}


  if(visible==0){
    visible = 1;
    document.getElementById('flashVideo').className = 'flashVideoVis';
    document.getElementById('flashVideo').innerHTML =vidCode;
  }
}

function closeVideo1(){
  visible = 0;
//  document.getElementById('flashVideo').className = 'flashVideoHid';
//  document.getElementById('flashVideo').innerHTML = '';
  document.getElementById('flashVideo').style.visibility = 'hidden';
//  document.getElementById('flashVideo').style.display = 'block';
  document.getElementById('sendform').style.visibility = 'hidden';
  document.getElementById('sendform').style.display = 'none';
}

function closeVideo(){
  visible = 0;
  document.getElementById('flashVideo').className = 'flashVideoHid';
  document.getElementById('flashVideo').innerHTML = '';
}

function setQuality1(which,path,url){
  closeVideo1();
  if( which == "lo" ) {
    qual = '2';
  } else {
    qual = '1';
  }
  showVideo1(path,url);
}

function setQuality(which){
  closeVideo();
  if(which == "lo"){qual = '2'}
  else{qual = '1'}
  showVideo(theName);
}

//added to be able to play videos
function getFlash() {
  		var flashVersion = [0,0];
		if (flashVersion[0] != 0) return;
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
			var _d = navigator.plugins["Shockwave Flash"].description;
			if (typeof _d != "undefined") {
				_d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
				var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
				flashVersion = [_m, _r];
			}
		}
		else if (window.ActiveXObject) {
			try { // avoid fp 6 crashes
				var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}
			catch(e) {
				try {
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					flashVersion = [6, 0];
					_a.AllowScriptAccess = "always"; // throws if fp < 6.47
				}
				catch(e) {
					if (flashVersion[0] == 6) return;
				}
				try {
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				}
				catch(e) {}
			}
			if (typeof _a == "object") {
				var _d = _a.GetVariable("$version"); // bugs in fp 6.21/6.23
				if (typeof _d != "undefined") {
					_d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
					flashVersion = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
				}
			}
		}
		//alert(flashVersion + " Flash Version in Flash");

	return flashVersion;
	}

function play( videoFile, aPlay, bnsfRw_baseURL, vwidth, vheight ) {
  var splashImageFile = videoFile + ".jpg";
  var flash = getFlash();
  var flashVersion = flash[0];
   //alert(flash[0] + " flash version " + flashVersion);
  if( aPlay ) {
  var autoPlay = aPlay;
  } else {
  var autoPlay = 'true';
  }
  splashImageFile = videoFile;
  if( autoPlay == 'true' ) {
    splashImageFile = "black";
  }
  var play = "";
  //play += '<object type="application/x-shockwave-flash" data="/video/FlowPlayer.swf" width="350" height="250" id="FlowPlayer">';
  play += '<object type="application/x-shockwave-flash" data="/video/FlowPlayer.swf" width="' + vwidth + '" height="' + vheight + '" id="FlowPlayer">';
  play += '  <param name="allowScriptAccess" value="sameDomain" />';
  play += '  <param name="movie" value="/video/FlowPlayer.swf" />';
  play += '  <param name="quality" value="high" />';
  play += '  <param name="scale" value="noScale" />';
  play += '  <param name="wmode" value="transparent" />';
  //play += '  <param name="flashvars" value="baseURL=http://wwwtr.bnsf.com/video&amp;videoFile=';
  play += '  <param name="flashvars" value="bnsfRw_baseURL&amp;videoFile=';
  play +=  videoFile + '&amp;autoPlay=' + autoPlay ;
  play += '&amp;bufferLength=5&amp;loop=false&amp;progressBarColor1=0xAAAAAA&amp;progressBarColor2=0x555555&amp;';
  play += 'autoBuffering=false&amp;splashImageFile=' + videoFile + '.jpg&amp;hideControls=false" />';
  play += '</object>';

  if( flashVersion > 7 ) {
    document.getElementById("videoplayer").innerHTML = play;
  } else {
    play = "";
    play += '<table width="100%" height="180" cellpadding="5" cellspacing="0"><tr>';
    play += '<td style="background:#CCCCCC; font-family:arial,sans-serif; font-size:.8em;" >';
    play += '<strong>To view the video, you need to have Flash Player version 8 or greater.';
    play += '</strong><br><br>Please <a href="http://www.adobe.com/support/flashplayer/downloads.html" target="_blank">click here</a>';
    play += ' to download the latest Flash Plugin from Adobe\'s website.</td></tr></table>';
    document.getElementById("videoplayer").innerHTML = play;
  }
}

