//Flash version 6+ detection
var ShockMode = false;
DetectFlash(8);

function DetectFlash(version)
{
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) 
						? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin 
						: 0;
	if ((plugin) && (parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= version))
		ShockMode = true;

	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)
				)
			)
	{
		try{ShockMode = (new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ version))!=null;}
		catch(ex){ShockMode = false;}
	}
	
	return ShockMode;
}

function WriteFlash (tagID_Name, swfName, width, height, imgSrc)
{
	if (ShockMode)
	{
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' codebase="'+document.location.protocol+'//www.adobe.com/go/getflashplayer"');
		document.write(' width="'+width+'" height="'+height+'" id="'+tagID_Name+'">');
		document.write(' <param name="movie" value="'+swfName+'"><param name="allowScriptAccess" value="always"> '); 
		document.write(' <param name="quality" value="best"><param name="wmode" value="opaque"> ');
		document.write(' <embed name="'+tagID_Name+'" src="'+swfName+'" quality="best" allowScriptAccess="always"'); 
		document.write(' swliveconnect="true" width="'+width+'" height="'+height+'"');
		document.write(' type="application/x-shockwave-flash" pluginspage="'+document.location.protocol+'//www.adobe.com/go/getflashplayer">');
		document.write('</embed>');
		document.write('</object>');
		if (imgSrc != null) document.write('<noembed><img id="'+tagID_Name+'" width="'+width+'" height="'+height+'" src="'+imgSrc+'" border=0></noembed>');
	}
	else
	{
		if (imgSrc != null) document.write('<img id="'+tagID_Name+'" width="'+width+'" height="'+height+'" src="'+imgSrc+'" border=0>');
	}
}

function WriteFlashToContainer (tagID_Name, swfName, width, height, containerID)
{
	if (ShockMode)
	{
		var container = document.getElementById(containerID);
		container.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+
				' codebase="'+document.location.protocol+'//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"'+
				' width="'+width+'" height="'+height+'" id="'+tagID_Name+'">'+
				' <param name="movie" value="'+swfName+'"><param name="allowScriptAccess" value="always"> '+
				' <param name="quality" value="best"><param name="wmode" value="opaque"> '+
				' <embed name="'+tagID_Name+'" src="'+swfName+'" quality="best" allowScriptAccess="always"'+
				' swliveconnect="true" width="'+width+'" height="'+height+'"'+
				' type="application/x-shockwave-flash" pluginspage="'+document.location.protocol+'//www.adobe.com/go/getflashplayer">'+
				'</embed>'+
				'</object>';
	}
}