function verCaps(id) 
{
	if (typeof(caps) != "undefined" && typeof(caps.id) != "undefined" && typeof(caps.getComponentVersion) != "undefined")
	{
		return caps.getComponentVersion(id, "ComponentID");
	}
	else
	{
		return false;
	}
}

var Flash;
var FlashVersion;
var Shock;
var ShockVersion;

var i_flash;
var a_flash;
var v_flash;
var i_flash2;
var v_flash2;
var i_flash3;
var v_flash3;
var i_flash4;
var v_flash4;
var i_flash5;
var v_flash5;
var i_flash6;
var v_flash6;
var i_shock;
var v_shock;
var i_shock6;
var v_shock6;
var i_shock7;
var v_shock7;
var i_shock8;
var v_shock8;
var fv = verCaps("{D27CDB6E-AE6D-11CF-96B8-444553540000}");
if (fv)
{
	a_flash = fv;
}
if (navigator.plugins) 
{
	for (var i=0; i < navigator.plugins.length; i++) 
	{
		if (navigator.plugins[i].name.toLowerCase().indexOf("shockwave flash") >= 0) 
		{
			i_flash = true;
			v_flash = navigator.plugins[i].description.substring(navigator.plugins[i].description.toLowerCase().lastIndexOf("flash ") + 6, navigator.plugins[i].description.length);
			v_flash = v_flash.substring(0, 1);
		}
		if (navigator.plugins[i].name.indexOf("Shockwave for Director") >= 0) 
		{
			i_shock = true;
			v_shock = navigator.plugins[i].description.substring(navigator.plugins[i].description.toLowerCase().lastIndexOf("version ") + 8, navigator.plugins[i].description.length);
		}
	}
}

Flash = i_flash;
FlashVersion = parseInt(v_flash);
Shock = i_shock;
ShockVersion = parseInt(v_shock);

function writeFlash(movie, id, w, h, b, v, wmode, flashvars, downloadurl) 
{
	writeFlash(movie, id, w, h, b, v, wmode, flashvars, downloadurl, null, null, null);
}

function writeFlash(movie, id, w, h, b, v, wmode, flashvars, downloadurl, alternativeImage, downloadText, link) 
{
	//document.write('<a href="'+link+'"><img src="'+alternativeImage+'" alt="" /></a><div id="noFlashDownloadDiv"><a href="'+downloadurl+'">'+downloadText+'</a></div>');
	if 	(Flash == false || FlashVersion < v)
	{
		if (alternativeImage != null && downloadText != null)
		{
			if (link != null)
			{
				document.write('<a href="'+link+'"><img src="'+alternativeImage+'" alt="" /></a><div id="noFlashDownloadDiv"><a href="'+downloadurl+'">'+downloadText+'</a></div>');
			}
			else
			{
				document.write('<img src="'+alternativeImage+'" alt="" /><div id="noFlashDownloadDiv"><a href="'+downloadurl+'">'+downloadText+'</a></div>');
			}
		}
		else
		{
			document.write('<div style="height:'+h+'px; width:'+w+'px;" class="flashErrorDiv"><table height="100%" width="100%"><tr><td valign="middle" align="center">For this website you need the <a target="_blank" href="'+downloadurl+'">Macromedia Flash plugin</a> version ' + v + ' (or higher).</td><tr></table></div>');
		}
	}
	else
	{
		document.write('<OBJECT CLASSID="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" WIDTH="'+w+'" HEIGHT="'+h+'" id="'+id+'" VIEWASTEXT>'
		+ '<PARAM NAME="allowScriptAccess" VALUE="sameDomain">'
		+ '<PARAM NAME="FlashVars" VALUE="'+flashvars+'">'
		+ '<PARAM NAME="movie" VALUE="'+movie+'">'
		+ '<PARAM NAME="quality" VALUE="high">'
		+ '<PARAM NAME="bgcolor" VALUE="'+b+'">'
		+ '<PARAM NAME="wmode" VALUE="'+wmode+'">'
		+ '<EMBED SRC="'+movie+'" FlashVars="'+flashvars+'" quality="high" bgcolor="'+b+'" width="'+w+'" height="'+h+'" name="'+id+'" allowScriptAccess="sameDomain"  wmode="'+wmode+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
	}
}
