// script based on a flash template from macromedia
// this does flash 6 detection and provides a funciton insert_flash(src,width,height,align) which
// alows you easely to insert flash content into your page. If it can't find a flash player it displays
// a error message in the same space as the flash movie would take up.



var UseFlash = 0;



if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] ) {
	// Check for Flash version 6 or greater in Netscape
	var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
	if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1))>=6)
		UseFlash = 1;
} else if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
	  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	// Assume any Windows IE except for Windows 3.1 supports the OBJECT tag
	UseFlash = 1;
}

// Allow the cookie to override
if (document.cookie && (document.cookie.indexOf("FlashRenderOption=P") >= 0)) {
	UseFlash = 1;
} else if (document.cookie && (document.cookie.indexOf("FlashRenderOption=I") >= 0)) {
	UseFlash = 0;
}


function insert_flash(src,width,height,align,bgcolor){
    if ( UseFlash ) {
            // Use Flash player
            document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
            document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"');
            document.write(' WIDTH='+width+' HEIGHT='+height+' '+align+' ID="'+src+'"> ');
            document.write(' <param NAME=movie VALUE="'+src+'">');
	    if (bgcolor)
		document.wirte(' <PARAM NAME=bgcolor VALUE='+bgcolor+'>');
            document.write('<EMBED');
            document.write(' swLiveConnect=FALSE WIDTH="'+width+'" HEIGHT="'+height+'"');
            document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"');
	    if (bgcolor)
		document.write(' bgcolor='+bgcolor+' ');
            document.write(' src="'+src+'"> ');
            document.write('</EMBED>');
            document.write('</OBJECT>');
    } else { // if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)) {
            // Netscape 2 will render the noscript tag
            document.write('<table width='+width+' height='+height+' '+align+' cellpadding=10>');
            document.write('<tr><td bgcolor=#000000 align=center><font color=#ff0000><u>');
            document.write('To view this animation you need flash6 or higher</u><br><br>');
            document.write(' please download it from ');
            document.write('<a href="http://www.macromedia.com/flash"><font color=#ffff00>macromedia</font></a>.');
            document.write('<br> If you are sure you have it installed, click ');
            document.write('<a href=\'javascript:SetCookieType("P")\'><font color=#ffff00>Here</font></a>');
            document.write('</font></td></tr></table>');

    }
}
// Call this function to set the cookie for the media type
function SetCookieType(ctype)
{
	document.cookie='FlashRenderOption='+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();
}
//<!-- sample links to allow user to set the cookie -->
//<a href='javascript:SetCookieType("")'>Use Automatic Detection</a><br>
//<a href='javascript:SetCookieType("P")'>Use Plug-in</a><br>
//<a href='javascript:SetCookieType("I")'>Use Image</a><br>


