// *********************************************************************************
// MERLIN SOFTWARE ENGINEERING INC. COPYRIGHT 2008, ALL RIGHTS RESERVED.
// *********************************************************************************
// Modification of this page by anyone other than MerlinSE.com voids all warranties
// made to the client, whether or not the client is aware of these changes.
// *********************************************************************************
// File:	 flashcheck_v2.js
// Purpose:	 JavaScript flash player detection
// Author:	 Merlin
// Date:	 May 2008, release 1
// Revised:  May 2008	- improved version of: AC_OETags.js (Flash Player Detection)
//						- now supports up to flash player version 15				
// Verified: Merlin Software Source Code Integrity Validation System
// *********************************************************************************
function AXversion() {
	var axo; var e; var ver; var i=15;
	try {																// --- first ensure ActiveX is avail
		axo = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		    axo = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			ver = "NOACTIVEX -1";
		}
	}
	while (!ver && i > 3) {												// --- try for players v15 down to v4
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
			if(i == 6) {
				ver = "WIN 6,0,21,0";									// --- GetVariable() crashes for v6.0.22 - 6.0.29
				axo.AllowScriptAccess = "always";						// --- AllowScripAccess didn't exist prior to v6.0r47 		
			}															// --- and therefore will error out to prevent crash
			ver = axo.GetVariable("$version");
		} catch (e) { }
		i--;
	}
	if (!ver) { ver = "NOFLASH 0"; }
	var a = ver.split(" ");
	if(a.length == 1) ver = a[0];
	else ver = a[1];
	return replaceChar(ver,",",".");
};
function getFlashVer(){
	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;
	var uAgent  = navigator.userAgent.toLowerCase();
	var ver     = "0";
	// --- try to detect Flash Player PlugIn version
	if (navigator.plugins != null && navigator.plugins.length > 0) {	// --- NS/Opera v3 or greater
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var s_desc = navigator.plugins["Shockwave Flash" + swVer2].description;
			var a_desc = s_desc.split(" "); var a = a_desc[2].split(".");			
			var vMajor = a[0]; var vMinor = a[1]; var vRevision = a_desc[3];
			if (vRevision == "") { vRevision = a_desc[4]; }
			if (vRevision[0] == "d") { vRevision = vRevision.substring(1); }
			else if (vRevision[0] == "r") {
				vRevision = vRevision.substring(1);
				if (vRevision.indexOf("d") > 0) {
					vRevision = vRevision.substring(0, vRevision.indexOf("d"));
				}
			}
			ver = vMajor + "." + vMinor + "." + vRevision;
		}
	}
	else if (uAgent.indexOf("webtv/2.6") != -1) ver = "4";				// --- MSN/WebTV 2.6 supports Flash 4
	else if (uAgent.indexOf("webtv/2.5") != -1) ver = "3";				// --- WebTV 2.5 supports Flash 3
	else if (uAgent.indexOf("webtv") != -1) ver = "2";					// --- older WebTV supports Flash 2
	else if ( isIE && isWin && !isOpera ) {
		// --- try to detect ActiveX control version
		ver = AXversion();
	}
	var a = ver.split(".");
	var vMajor = a[0]; var vMinor = 0; var vRevision = 0;
	if(a.length > 1) vMinor    = a[1];
	if(a.length > 2) vRevision = a[2];
	return properNum(vMajor);
};
function showFlashErr(i,r,dns,msei) {
	var s = "<table style='margin-top: 10px; margin-bottom: 10px; border: 1px #FF0000 solid; background-color: #FFFFE7;' cellpadding='5' cellspacing='0' width='100%'><tr><td><table cellpadding='0' cellspacing='0' border='0'><tr>";
	s += "<td><img src='" + dns + "en/img/i_caution.gif' alt='' width='16' height='16' border='0' hspace='5'><\/td>";
	s += "<td><span style='font-family: Arial, Verdana, Helvetica, Geneva, Sans-Serif; font-size: 9pt; color: #FF0000;'>Your browser has blocked or ";
	if(i != "-1") {
		s += "needs an upgraded <b><i>Flash Player<\/i><\/b>";
		var pg = msei + "en/flash.asp";
	} else {
		s += "does not support <b><i>microsoft ActiveX<\/i><\/b>, which is required";
		var pg = msei + "en/html/activex.htm";
	}
	s += " to correctly display this page!<\/span>&nbsp;&nbsp; <a href='" + pg + "' target='_blank' title='Click Here for more information' style='font-family: Arial, Verdana, Helvetica, Geneva, Sans-Serif; font-size: 9pt; color: #000000;'>Click Here<\/a><\/td>";
	s += "<\/tr><\/table><\/td><\/tr><\/table>";
    document.write(s);
};
