var clientIE = (navigator.userAgent.indexOf("MSIE") > -1);

function showFlash(url, sizex, sizey, version, idDiv, wMode, vars)
{
	if (checkPlayerVersion(version))
	{
		if (wMode)
			wMode = '<param name="wmode" value="'+wMode+'" />';
		else
			wMode = '';

		if (!vars)
			vars = '';

		var str = '<object type="application/x-shockwave-flash" data="'+url+'" width="'+sizex+'" height="'+sizey+'" style="vertical-align: top"';
		if (clientIE)
			str +=  ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+',0,0,0"';
		str += '>' + wMode +
			'<param name="movie" value="'+url+'" />' +
			'<param name="quality" value="high" />' +
			'<param name="menu" value="0" />' +
			(vars ? '<param name="flashvars" value="'+vars+'" />' : '') +
			'<embed src="'+url+'" ' + (vars ? 'flashvars="'+vars+'"':'') + ' width="'+sizex+'" height="'+sizey+'" '+
				'style="vertical-align: top" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
			'</object>';
		document.write(str);

		if (idDiv && document.getElementById(idDiv))
			document.getElementById(idDiv).style.display = 'none';
	}
}

function checkPlayerVersion(version)
{
	return (getPlayerVersion() >= version);
}

function getPlayerVersion()
{
	var lastVer = 0;
	if (navigator.plugins && navigator.mimeTypes.length)
	{
		var x = navigator.plugins["Shockwave Flash"];
		if (x && x.description)
		{
			var ver = x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split(".");
			lastVer = parseInt(ver[0]);
		}
	}
	else
	{
		try {
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			for (var i=3; axo!=null; i++)
			{
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
				lastVer = i;
			}
		}
		catch(e){}
	}
	return lastVer;
}
