﻿
var browser = document.all?"IE":(document.layers?"NS":(document.getElementById?"NS6":"IE"));//detect browser else try IE

function flashDetect(){
	if (typeof(browser)== "undefined") return;
	if (browser == "IE") return flashDetectIE()
	else return flashDetectNS()
}

//Internet Explorer Code
function flashDetectIE(){
	var fDetect = false;
	for (var i=1;i<10;i++){
		try { var x = typeof(new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i))} 
			catch(e){}
		if (x == "object") {
			// flash object detected
			fDetect = i
		}
	}
	return fDetect;			
}

//Netscape  code
function flashDetectNS(){
	var flashVersion = false;
	if (navigator.plugins) {
		// ...then check for flash 2 or flash 3+.
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {	
			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

			// DEBUGGING: uncomment next line to see the actual description.
			// alert("Flash plugin description: " + flashDescription);
			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		}
	}
	return flashVersion;
}
