//Eolas-compliant Flash plugin detection v1.0 with optional cookie-based detection-override

<!--
// Set a cookie for optional detection override, reload page.
function SetCookieType(ctype) {
	document.cookie='Aftershock='+ctype+';path=/;'
	if ( navigator.appName.indexOf("Microsoft") != -1 )
		parent.history.go(0);
	else if ( navigator.userAgent.indexOf("Mozilla/2") != -1 )
		parent.location = parent.location;
	else
		parent.location.reload();
}

// Version of Flash we require
var MM_contentVersion = 6;

// Plugin Detected Flag
var MM_FlashCanPlay = 0;

// Variable to track degraded user override
var shockMode = 0;

// Call this function to set the cookie for the media type
function SetCookieType(ctype) {
	document.cookie='ChooseFlash='+ctype+';path=/;'
	if ( navigator.appName.indexOf("Microsoft") != -1 )
		parent.history.go(0);
	else if ( navigator.userAgent.indexOf("Mozilla/2") != -1 )
		parent.location = parent.location;
	else
		parent.location.reload();
}

// check for cookie override
if (document.cookie && (document.cookie.indexOf("ChooseFlash=Y") >= 0)) {
	shockMode = 1;
} 

// Detect Netscape plug-in
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
// Detect ActiveX control
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

function writeContent(flashPath, altPath, width, height, bgcolor)
{
	// Define the image map rectangle for the matching degradation image
	var mapRect;
	if(altPath.indexOf("deg_home.gif") != -1){
		mapRect = '<area shape="rect" coords="28,158,102,178" href="http://www.macromedia.com/go/getflashplayer/" target="_blank" />';
	}
	if(altPath.indexOf("deg_sidebar.gif") != -1){
		mapRect = '<area shape="rect" coords="11,112,85,132" href="http://www.macromedia.com/go/getflashplayer/" target="_blank" />';
	}
	if(altPath.indexOf("deg_topics.gif") != -1){
		mapRect = '<area shape="rect" coords="18,162,92,182" href="http://www.macromedia.com/go/getflashplayer/" target="_blank" />';
	}
	
	// Determine whether or not to play Flash content
	if ( MM_FlashCanPlay || shockMode) {
		shockMode = 1;
		document.write('<div align="center"><OBJECT classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
		document.write('  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ');
		document.write(' ID="" WIDTH="' + width + '" HEIGHT="' + height + '" ALIGN="">');
		document.write(' <PARAM NAME=movie VALUE="' + flashPath + '"> <PARAM NAME=quality VALUE=high> <param NAME=bgcolor VALUE=' + bgcolor + '">  '); 
		document.write(' <EMBED src="' + flashPath + '" quality=high bgcolor=' + bgcolor + '  ');
		document.write(' swLiveConnect=FALSE WIDTH="' + width + '" HEIGHT="' + height + '" NAME="aarp_magazine" ALIGN=""');
		document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
		document.write(' </EMBED>');
		document.write(' </OBJECT></div>');
	} else {
		// write out degradation content
		document.write('<div align="center">');
		document.write('<img src="' + altPath + '" alt="You need the Macromedia Flash 7 Player to view this content." width="' + width + '" height="' + height + '" border="0" usemap="#deg_map"/>');
		document.write('<map name="deg_map" id="deg_map">' + mapRect + '</map>');
		document.write(' </div>');
	}
}

//-->