// Return an element by name.
function getElement(objectName)
{
    if (document.getElementById) return document.getElementById(objectName);
    if (document.all) return document.all[objectName].style.display=value;
    return null;
}

var flashValid = false;

function insertFlash(filename, width, height, backgroundColour, minVersion, alternateType, alternate)
{
	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]; 
		}
		flashValid = (MM_PluginVersion >= minVersion);
	}
	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('flashValid = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+minVersion+'")))\n');
		document.write('</SCR' + 'IPT\> \n');
	}
	if (flashValid) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write('    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"');
		document.write('    id="FlashMain" width="' + width + '" height="' + height + '" align="">');
		document.write('    <param name="movie" value="' + filename + '">');
		document.write('    <param name="quality" value="best">');
		document.write('    <param name="bgcolor" value="' + backgroundColour + '">');
		document.write('    <embed src="' + filename + '" quality="best" bgcolor="' + backgroundColour + '"');
		document.write('        swLiveConnect="FALSE" width="' + width + '" height="' + height + '" name="Main" align=""');
		document.write('        type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
		document.write('    </embed>');
		document.write('</object>');
	} else {
		switch (alternateType)
		{
			case 'image':
				document.write('<img src="'+alternate+'" width="'+width+'" height="'+height+'" border="0"/>');
				break;
			case 'flashRequired':
				document.write('<p>Macromedia Flash version '+minVersion+' or above is required to view this content.</p>');
				document.write('<p><a href="http://www.macromedia.com/go/getflashplayer" target="_blank"><img src="http://www.macromedia.com/images/shared/download_buttons/get_flash_player.gif" border="0" width="88" height="31"/></a></p>');
				break;
			case 'showElement':
				getElement(alternate).style.display='block';
				break;
			default:
				document.write(alternate);
				break;
		}
	}
}

function testFlash() {
	var tmpURL = window.location.href;
	if ( tmpURL.search("noFlash") > -1 ) {
	return true;
	} else {
	return false;	
	}
}