/*	The following code was adapted from:
	SWFObject v2.0 beta5 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
function detectflash() {
var w3cdom = typeof document.getElementById != "undefined" && typeof document.getElementsByTagName != "undefined" && typeof document.createElement != "undefined" && typeof document.appendChild != "undefined" && typeof document.replaceChild != "undefined" && typeof document.removeChild != "undefined" && typeof document.cloneNode != "undefined";
var playerVersion = [0,0,0];
var d = null;
if (typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") {
	d = navigator.plugins["Shockwave Flash"].description;
	if (d) {
		d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
		playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
		playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
		playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
	}
}
else if (typeof window.ActiveXObject != "undefined") {
	var a = null;
	var fp6Crash = false;
	try {
		a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
	}
	catch(e) {
		try { 
			a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			playerVersion = [6,0,21];
			a.AllowScriptAccess = "always";  // Introduced in fp6.0.47
		}
		catch(e) {
			if (playerVersion[0] == 6) {
				fp6Crash = true;
			}
		}
		if (!fp6Crash) {
			try {
				a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			}
			catch(e) {}
		}
	}
	if (!fp6Crash && typeof a == "object") { // When ActiveX is disbled in IE, then "typeof a" returns "object", however it is "null" in reality, so something like "typeof a.GetVariable" will crash the script
		try {
			d = a.GetVariable("$version");  // Will crash fp6.0.21/23/29
			if (d) {
				d = d.split(" ")[1].split(",");
				playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
			}
		}
		catch(e) {}
	}
}
var u = navigator.userAgent.toLowerCase();
var p = navigator.platform.toLowerCase();
var webkit = /webkit/.test(u);
var webkitVersion = webkit ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : 0;
var ie = false;
var win = p ? /win/.test(p) : /win/.test(u);
var mac = p ? /mac/.test(p) : /mac/.test(u);
/*@cc_on
	ie = true;
	@if (@_win32)
		win = true;
	@elif (@_mac)
		mac = true;
	@end
@*/

  
return playerVersion[0];
};
