﻿function FlashSwitch ( theSWFurl, theW, theH, theIMGurl, theDESTurl ) { 

	var plugin = 0;

	// Check if MIME types are available
	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
		// If so, check if plugin is available
		if (navigator.plugins && navigator.plugins["Shockwave Flash"])
			// If so, set plugin flag
			plugin = 1;		
	}
	// Else, check if using IE
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
	   && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0)) {
		document.write('<SCRIPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('plugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3")))\n');
		document.write('if ( plugin <= 0 ) then plugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")))\n');
		document.write('</SCRIPT\> \n');
	}


	// Check if plugin is available
	if ( true ) {
		// Write the menu Flash tags via external JavScript - turned off 6/29/06
		// WriteMenu();
		// Writes Embed tag to output Flash movie
		// document.write('<embed src="/Main/Menu3.swf" type="application/x-shockwave-flash" width="196" height="105" quality="best">');

		// If so,
		// Write Flash movie tags
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" height="' + theH + '" width="' + theW + '">\n');
		document.write('	<param name="wmode" value="transparent" />\n');
		document.write('	<param name="play" value="true" />\n');
		document.write('	<param name="quality" value="best" />\n');
		document.write('	<param name="movie" value="' + theSWFurl + '" />\n');
		document.write('	<embed height="' + theH + '" pluginspage="http://www.macromedia.com/go/getflashplayer" src="' + theSWFurl + '" type="application/x-shockwave-flash" width="' + theW + '" quality="best" play="true" wmode="transparent"></embed>\n');
		document.write('</object>\n');

	} else {
		// Else,
		// Check if theDESTurl was given
		if ( theDESTurl != '' )
			// If so, set destGiven flag
			destGiven = true;
		else
			// Else, clear the flag
			destGiven = false;
			
		// Output anchor tag, if destination given
		if ( destGiven ) 
			document.write('<a href="' + theDESTurl + '">');
		
	    // Output image code					
		document.write('<img src="' + theIMGurl + '" />');
			
		// Output end of anchor tag, if destination given
		if ( destGiven ) 
			document.write('</a>');
	}


}


