/*
	Public Properties:
		boolean flashInstalled
		integer flashVersion

	Version:
		1.0.0
		18th March 2002

	Written By:
		Tim Booker
		tim@saltstonemedia.co.uk

	Original code from:
		http://www.xs4all.nl/~ppk/js/flash.html
*/

flashInstalled = null;
flashVersion = null;

if( navigator.plugins && navigator.plugins.length ) {

	// check the Netscape plugins array

	var x = navigator.plugins[ 'Shockwave Flash' ];

	if( x ) {

		flashInstalled = true;
		if( x.description ) {
			y = x.description;
			flashVersion = y.charAt( y.indexOf( '.' ) - 1 );
		}

	} else {
		flashInstalled = false;
	}

	if( navigator.plugins[ 'Shockwave Flash 2.0' ] ) {
		flashInstalled = true;
		flashVersion = 2;
	}

} else {

	// for IE, insert a bit of VBScript to do the detect

	var vbDetect = '<script language="vbscript">\n' +
		'on error resume next\n' +
		'\n' +
		'For i = 2 to 10\n' +
		'	If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then\n' +
		'	Else\n' +
		'		flashInstalled = true\n' +
		'		flashVersion = i\n' +
		'	End If\n' +
		'Next\n' +
		'\n' +
		'If flashInstalled = null Then\n' +
		'	flashInstalled = false\n' +
		'End If\n' +
		'</script>\n';

	document.write( vbDetect );
}