function writeFlash(target, movie, version)
{
	// Check if the user has the correct version installed.
	var ok = checkFlash(version);

	if (ok == false)
	{
		// The Flash Player could not be detected or
		// is too old.
		return;
	}

	// Create the HTML for the Flash object.
	var html = "<object type=\"application/x-shockwave-flash\" "
	         + "data=\"" + movie + "\">"
	         + "<param name=\"movie\" value=\"" + movie + "\"/>"
	         + "</object>";
	
	// Write the Flash HTML to the target object.
	document.getElementById(target).innerHTML = html;
}

function checkFlash(version)
{
	var ok = false;

	if (window.ActiveXObject)
	{
		try
		{
			new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + version);
			ok = true;
		}
		catch (e)
		{}
	}
	else if (navigator.plugins && navigator.plugins["Shockwave Flash"])
	{
		var description = navigator.plugins["Shockwave Flash"].description;
		var result = description.match(/Flash ([0-9]+)/);
		ok = Number(result[1]) >= version;
	}

	return ok;
}
