/******************************************************************************
 Whittled down from Shaun Inman's IFR technique:
 - http://shauninman.com/mentary/past/ifr_an_fir_alternative.php
 
 This is the flash detection script.
 ******************************************************************************/
var required = 6;
var hasFlash = false;
if ( navigator.appVersion.indexOf( "MSIE" ) != -1 && navigator.appVersion.indexOf( "Windows" ) != -1 ) {
	document.write( '<SCR' + 'IPT LANGUAGE=VBScript\> \n' );
	document.write( 'on error resume next \n' );
	// AFAIK creating an instance of an older version of the Flash object 
	// will return succeed even if the actual installed version is newer.
	document.write( 'hasFlash = ( IsObject( CreateObject( "ShockwaveFlash.ShockwaveFlash." & required ) ) ) \n' );  
	document.write( '<'+'/scr' + 'ipt\> \n' );
} else {
	var plugin = ( navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] ) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if ( plugin ) {
		var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
		var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
		var flashVersion = parseInt( flashDescription.charAt( flashDescription.indexOf( "." ) - 1 ) );
		hasFlash = flashVersion >= required;
	}
}

/******************************************************************************
 This classes the <html> element as `hasFlash` if flash is found. This style
 hook can be used to hide our to-be-replaced content before it even comes down
 the datapipe and eliminate the FOPSC ("Flash of Partially Styled Content")
 
 I've determined that the lighter the page weight the greater chance of a FOPSC.
 ******************************************************************************/
window.onload = function() {
	if ( hasFlash && document.getElementsByTagName && document.getElementsByTagName( 'html' )[0] ) {
		document.getElementById( "get-flash" ).style.display = "none";
	} else {
		document.getElementById( "get-flash" ).style.display = "block";
	}
}