///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
// flash plugin sniffer 
// brandon ellis - edeveloper@hotmail.com - 6/2002
// revised 03/14/2003 - function rewrite
// revised 01/22/2004 - stupid ie on mac
///////////////////////////////////////////////////////////////
function detectFMX(){
	var reqVer = 6;
	var pluginChk = "";
	var isMac = false;
	var ua = navigator.userAgent.toLowerCase();
	if (ua.indexOf('mac') > -1)
		isMac = true;
	
	if (document.all && !isMac){
		document.write('<scr' + 'ipt language="VBScript"\> \n');
		document.write('function chkIe()\n');
		document.write('  on error resume next\n');
		document.write('	dim success : success = false\n');
		document.write('	dim flashVer : flashVer = 0\n');
		document.write('	dim i\n');
		document.write('	for i=9 to i=0 step -1\n');
		document.write('		set oFlash = createObject("shockwaveflash.shockwaveflash." & i)\n');
		document.write('		if isObject(oFlash) then\n');
		document.write('			flashVer = cStr(i)\n');
		document.write('		msgBox(oFlash)\n');
		document.write('			exit for\n');
		document.write('		end if\n');
		document.write('	next\n');
		document.write('	if flashVer < '+reqVer+' then\n');
		document.write('		success = false\n');
		document.write('	else\n');	
		document.write('		success = true');
		document.write('	end if\n');
		document.write('chkIe = success\n');
		document.write('end function\n');
		document.write('</scr' + 'ipt\> \n'); 
		pluginChk = chkIe(); 
	} else {
		if (navigator.plugins != null && navigator.plugins.length > 0) {
			var daPlugin = navigator.plugins['Shockwave Flash'];
			if (daPlugin) {
				for (i=9;i>0;i--){
					if (daPlugin.description.indexOf(i+'.') != -1){
						var flashVersion = i;
						break;
					}
				}
			}
			
			if (!daPlugin || flashVersion < reqVer){
			  pluginChk = false; 
			} else {
			  pluginChk = true;     
			}
			
			if (navigator.mimeTypes['application/x-shockwave-flash'] == null)
				pluginChk = false;

		} else {
			pluginChk = false;
		}
	}
  
	if (pluginChk){
		// do something
		alert("you have the current plugin");
	} else {
		// do something else
		var msg = '';
		msg = 'This site uses the Macromedia Flash Plugin to display content.\n';
		msg += 'The plugin is safe, fast and painless to download from www.macromedia.com\n';
		msg += 'Would you like to go there now?';
		if (confirm(msg)){
			document.location='http://www.macromedia.com/downloads/';
		} 
	}
}