
function createFlash(sElementName, sSWFName)
{
	// Conditionally create object elements depending on browser
	// IE supports ActiveX, so create an <object> element that supports ActiveX
	// Mozilla supports MIME types, so if Mozilla, create an <object> element that supports MIME types

	if ((window.ActiveXObject) && 
		  (navigator.userAgent.indexOf("MSIE") != -1) &&
		  (navigator.userAgent.indexOf("Windows") != -1))
	{
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
		document.write(' width="100%" height="100%" id="' +sElementName+ '">');
		document.write(' <param name="movie" value="' +sSWFName+ '">');
		document.write(' <param name=quality value=high>');
		document.write(' <param name="swliveconnect" value="true">');
		document.write(' <embed src="' +sSWFName+ '" quality="high" bgcolor="#ffffff" width="100%" height="100%" swLiveConnect=true id="' +sElementName+ '" name="' +sElementName+ '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
		document.write('<\/object>');
	}
	else
	{
		var version_check = getFlashPluginVersion();
		if (version_check.scriptable)
		{
			document.write('<object id="' +sElementName+ '" name="' +sElementName+ '" data="' +sSWFName+ '" type="application/x-shockwave-flash"');
			document.write(' width="100%" height="100%">');
			document.write('<param name="movie" value="' +sSWFName+ '">');
			document.write('<param name="quality" value="high">');
			document.write('<param name="swliveconnect" value="true">');
			document.write('<\/object>'); 
		}
		else
			alert("unsupported browser or browser version")
	}
}
function getFlashPluginVersion()
{
	var version = { 
		major: -1, 
		minor: -1, 
		installed: false,
		scriptable: false,
		machoArchitectureProblem: false};
	
	var osxFlashVersion = 12;

	var mt = navigator.mimeTypes["application/x-shockwave-flash"];
	if(mt == null)
		return version;

	var plugin = mt.enabledPlugin; 
	if(!plugin) 
		return version;

	version.installed = true;

	var description = plugin.description; 
  
	// use RegExp to obtain the relevant version strings 
	// obtain an array of size 2 with version information
  
	var versionArray = description.match(/[\d.]+/g); 
	if (!versionArray)
		return version;

	if (versionArray.length >= 1 && !isNaN(versionArray[0]))
		version.major = parseFloat(versionArray[0]);

	if (versionArray.length >= 2 && !isNaN(versionArray[1]))
		version.minor = parseFloat(versionArray[1]);

	if (version.major < 6 || navigator.product != 'Gecko')
		return version;

	if (version.major > 6 || version.minor >= 47)
		version.scriptable = true;

	if((version.major < osxFlashVersion) && (navigator.userAgent.indexOf("Mach-O") != -1))
	{
		version.scriptable = false;
		version.machoArchitectureProblem = true;
	}

	return version;
}

