<!--
// JavaScript Document

////////////////////  FLASH BROWSER SNIFFER ////////////////////
// Author: Robin Kidd, Nexolink Inc.
// Date: July 16, 2003
// Client: Travelex Plc.
/////////////////////////////////////////////////////////////////////////

//ALERT IS FOR DEBUG ONLY
// alert("checking for Flash version");

// INITIALISE THE SCRIPT GLOBAL VARS
var reqVersion = 6; // min 2 max 6+
var isFlash2 = false;    // true = flash 2 is installed
var isFlash3 = false;    // true = flash 3 is installed
var isFlash4 = false;    // true = flash 4 is installed
var isFlash5 = false;    // true = flash 5 is installed
var isFlash6 = false;    // true = flash 6 is installed
var maxVersion = 6;    // highest version to detect
var usersVersion = 0;   // version the user has now
var hasReqVersion = false;  // true = use flash embeded : false = use HTML substitute

// ALERT FOR DEBUG ONLY
// alert("default isFlash6 = false, our script says " + isFlash6);

////////////////// CHECK FOR WINDOWS IE BROWSER /////////

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true = Internet Explorer
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;  // true = Windows Machine

// Write vbscript detection WINDOWS IE because JavaScript plugins array detection is not supported
if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('isFlash2 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('isFlash3 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('isFlash4 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('isFlash5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('isFlash6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('</SCR' + 'IPT\> \n'); // break up tag so it doesn't end the script
}

// ALERT FOR DEBUG ONLY
//alert("is IE ? " + isIE);
//alert("is Windows? " + isWin);

/////////////// USE JAVASCRIPT WITH NON IE BROWSERS //////////
// checking the navigator.plugins array. 

function check4Flash() {  
  // If navigator.plugins exists...
  if (navigator.plugins) {
	// is flash 2 or 3+.
	if (navigator.plugins["Shockwave Flash 2.0"]
		|| navigator.plugins["Shockwave Flash"]) {

	   // Set reference to flash 2 and the plugin description.
	  var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
	  var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

	  // USE ALERT TO DEBUG ONLY
	  //alert("Flash plugin description: " + flashDescription);
	  
	  // Check major version of plugin
	  var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
	 
	  // Set the version flag. use >= for max version for future plugin releases
	  isFlash2 = flashVersion == 2;    
	  isFlash3 = flashVersion == 3;
	  isFlash4 = flashVersion == 4;
	  isFlash5 = flashVersion == 5;
	  isFlash6 = flashVersion >= 6;
	}
  }
  
  // Loop through versions and set usersVersion to highest detected version.
  for (var i = 2; i <= maxVersion; i++) {  
	if (eval("isFlash" + i ) == true) usersVersion = i;
  }
  
  // basic webTV detection
  if(navigator.userAgent.indexOf("WebTV") != -1) usersVersion = 3;  
  
  // USE ALERT TO DEBUG ONLY
  //alert("version detected: " + usersVersion);
 
  // FINISHED WITH BROWSER PLUGIN DETECTION ASIGN THE PROPER DISPLAY
 
  if (usersVersion >= reqVersion) {
	hasReqVersion = true;                
  }
 
 } // end check4Flash function brace

check4Flash();  // Run the detector 

// ALERT FOR DEBUG ONLY
//alert("hasReqVersion = "+hasReqVersion);

 /////////////// PLACE APPROPRIATE FLASH OR HTML CODE ON PAGE ////////////////

// Customize Flash and html to fit the page criteria
 if(hasReqVersion) {  // if we've detected an acceptable version
	var flashTags = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
	+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"'
	+ 'WIDTH="554" HEIGHT="150" id="/mt/personal/CFX/cfx_personal" ALIGN="">'
	+ '<PARAM NAME=movie VALUE="/mt/personal/CFX/cfx_personal.swf">'
	+ '<PARAM NAME=quality VALUE=high>'
	+ '<PARAM NAME=bgcolor VALUE=#FFFFFF>'
	+ '<EMBED src="/mt/personal/CFX/cfx_personal.swf" quality=high bgcolor=#FFFFFF  WIDTH="554" HEIGHT="150" NAME="/personal/CFX/cfx_personal" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>'
	+ '</OBJECT>';

	document.write(flashTags);   // embed the flash movie to the page
  } else {  // flash notavailable
	var altHTML = ' <table cellpadding="0" cellspacing="0" border="0">'
	+'<tr><td width="554" height="150" bgcolor="#353c91">'
	+'<img src="/mt/images/TVX_title_cfxpersonal.jpg" height="150" width="554" border="0" alt="Commercial Foreign Exchange Personal Transfers"></td>'
	+'<td width="554" height="150" align="left" valign="top">'
	+'<table cellpadding="10" cellspacing="0" border="0">'
	+'<tr><td>'
	+'<table cellpadding="0" cellspacing="0" border="0" bgcolor="#999999">'
	+'<tr><td bgcolor="#FFFFFF"><table cellpadding="0" cellspacing="3" border="0" bgcolor="#FFFFFF">'
	+'<td width="100"></td>'
	+'<td width="100"></td></tr>'
	+'<tr><td width="100"></td>'
	+'<td width="100"></td></tr></table>'
	+'</td></tr></table>'
	+'</td></tr></table>'
	+'</td></tr></table>'
	+'<map name="flashmap" id="flashmap">'
	+'<area href="http://www.macromedia.com/go/getflashplayer/" target="_blank" shape="rect" coords="2,115,343,188">'
	+'</map>';

	document.write(altHTML);  // insert non-flash HTML content
  }

// -->