// Flash Version Detect
var m_intVERSION = 'Not Installed';
var m_intMAXVERSION = 9;
var m_intMINVERSION = 2;
var m_intERROR = 'Error';

function flashDetect(){
	/*
		**************************************************
		Name: Flash Detection Script
		Author: ENT, adapted from code by Chris Nott (chris[at]dithered[dot]com).
		Created: 1/26/2005
		Updated: ENT - 1/27/2005
		Details:
			Return Value	Meaning
			----------------------------
			-1				Error Thrown/Detection Failed
			0				Flash Not Installed
			2-9				Flash Version Number
			
			-Forward compatible to detect plug versions 
			up to 9.  Current version is 7.

		Successfully Tested on:
			- PC
				- MSIE 6, XP SP2
				- MSIE 6
				- MSIE 5.01, Win98 SP2
				- MSIE 5.5, Win98 SP2
				- MSIE 5.5
				- Firefox 1.0
				- Netscape 7.2
				- Netscape 6.2.3
				- Opera 7.54
			- Mac
				- MSIE 5.2 Mac
				- Firefox 1.0
				- Netscape 7.2
				- Netscape 7.0
				- Safari 1.2.4
				- Opera 6
		**************************************************
	*/
	try {
		var agent = navigator.userAgent.toLowerCase(); 
		var isIE  = (agent.indexOf("msie") != -1) ? true : false;
		var isWin = (agent.indexOf("win") != -1) ? true : false;
		
		// NS3 needs local vars. (NS3 is not technically supported, but added for completeness.)
		if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
			m_intVERSION = 0;
			m_intMAXVERSION = 9;
			m_intMINVERSION = 2;
			m_intERROR = -1;
		}
	
		if(navigator.plugins != null && navigator.plugins.length > 0) {
			// Test all other supported browsers.
			var flashPlugin = navigator.plugins['Shockwave Flash'];
			if (typeof flashPlugin == 'object') { 
				for (var i = m_intMAXVERSION; i >= m_intMINVERSION; i--) {
					if (flashPlugin.description.indexOf(i + '.') != -1) {
						m_intVERSION = i;
						break;
					}
				}
			}
		}else if(isIE && isWin){
			// Test IE using VBScript.
			var strVB = '<scr' + 'ipt language="VBScript"\> \n';
			strVB += '	On Error Resume Next \n';
			strVB += '	Dim obFlash \n';
			strVB += '	For i = ' + m_intMAXVERSION + ' To ' + m_intMINVERSION + ' Step -1 \n';
			strVB += '		Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
			strVB += '		If IsObject(obFlash) Then \n';
			strVB += '			m_intVERSION = i \n';
			strVB += '			Exit For \n';
			strVB += '		End If \n';
			strVB += '	Next \n';
			strVB += '</scr' + 'ipt\> \n';
			document.write(strVB);
		}else{
			// Can't detect/Browser not supported.
			throw new Error("Browser not supported.", "Browser not supported");
		}
		
	}catch(ex){
		// alert(ex.message);  // Uncomment to debug.
		m_intVERSION = m_intERROR;
	} finally {
		return m_intVERSION;
	}
}