var flashinstalled = 0;
var flashversion = 0;
//max version of flash to test up to for the IE test
var MAXFLASHVERSION = 10;

//vbscript to test flash in IE since IE doesn't suport navigator.plugins or nagigator.mimeTypes
function IEflashdetect()
{	
	document.write('<script language="VBScript" type="text/VBScript"> \n');
	document.write('on error resume next \n');
	document.write('For i = 2 to MAXFLASHVERSION \n');
	document.write('	If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then \n');
	document.write('	Else \n');
	document.write('		flashinstalled = 2 \n');
	document.write('		flashversion = i \n');
	document.write('	End If \n');
	document.write('Next \n');
	document.write('If flashinstalled = 0 Then \n');
	document.write('	flashinstalled = 1 \n');
	document.write('End If \n');
	document.write('</script> \n');

	return(flashversion);
}

//checks the version of flash installed against the minimum version required by the product
function HasFlash(minVer)
{
	FlashDetect();
	if(flashinstalled == 2)
	{
		if(flashversion >= minVer)
			return(true);
		else
			return(false);
	}
	else{
		return(false);
	}
}

//detects if flash is installed and what version
function FlashDetect()
{
	if(BrowserDetect.browser == "Explorer")
	{
		flashversion = IEflashdetect();
	}

	if (navigator.plugins && navigator.plugins.length)
	{
		x = navigator.plugins["Shockwave Flash"];
		if (x)
		{
			flashinstalled = 2;
			if (x.description)
			{
				y = x.description;
				y = y.substr(15);
				flashversion = y.substr(0, y.indexOf('.'));
			}
		}
		else
			flashinstalled = 1;
		if (navigator.plugins["Shockwave Flash 2.0"])
		{
			flashinstalled = 2;
			flashversion = 2;
		}
	}
	else if (navigator.mimeTypes && navigator.mimeTypes.length)
	{
		x = navigator.mimeTypes['application/x-shockwave-flash'];
		if (x && x.enabledPlugin)
			flashinstalled = 2;
		else
			flashinstalled = 1;
	}

	return(flashversion);
}

