// Flash detector.
//
// Set version to something like 4.
//

var flashDetected = -1;

function detectFlashPlayer ( version ) 
{
	if ( flashDetected != -1 )
	{
		return flashDetected;
	}

	var pluginFound = false;

	var plugin = null;
	
	if ( navigator.mimeTypes && navigator.mimeTypes [ "application/x-shockwave-flash" ] && navigator.mimeTypes [ "application/x-shockwave-flash" ].enabledPlugin )
	{
		plugin = detectPlugin ( 'Shockwave Flash' );
	}

	// Check the version.
	//

	if ( plugin != null )
	{
		var words = plugin.description.split ( " " );

	    for ( var i = 0; i < words.length; i++ )
	    {
			if ( isNaN ( parseInt ( words [ i ] ) ) )
			{
				continue;
			}

			if ( words [ i ] >= version ) 
			{
				pluginFound = true;
			}

			break;
	    }
	}
	else
	{
		pluginFound = detectActiveXControl ( 'ShockwaveFlash.ShockwaveFlash.' + version, 0 );
	}

	flashDetected = pluginFound;

	return pluginFound;
}
