function DetectFlash ()
{
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")[0];
		}
	}else{
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = 6;
				axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = axo.GetVariable("$version").split(" ")[1].split(",")[0];
		}
	}
	return PlayerVersion;
}

function IsFlash(FlashOn)
{
    if (old_menu=='') 
		old_menu = document.getElementById("top_menu").innerHTML;
    if ((old_promo)=='' && (!no_promo))
		old_promo = document.getElementById("flash_promo").innerHTML;
	if (FlashOn) {
		document.getElementById("top_menu").innerHTML = new_menu;
		if (!no_promo) {
			document.getElementById("flash_promo").innerHTML = new_promo;
		}
		document.getElementById("flash_on").innerHTML = 'Flash';
		document.getElementById("flash_off").innerHTML = '<a href="javascript:IsFlash(false);" OnClick="IsFlash(false); return false;">Html</a>';
		setCookie("showFlash",'yes',30);
	} else {
		document.getElementById("top_menu").innerHTML = old_menu;
		if (!no_promo) {
			document.getElementById("flash_promo").innerHTML = old_promo;
		}
		document.getElementById("flash_on").innerHTML = '<a href="javascript:IsFlash(true);" OnClick="IsFlash(true); return false;">Flash</a>';
		document.getElementById("flash_off").innerHTML = 'Html';
		setCookie("showFlash",'no',30);
	}		
}

function setCookie (c_name, value, expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate);
}

function getCookie(c_name)
{
	if (document.cookie.length>0)
	{
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1)
		{ 
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) 
				c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
    	} 
	}
	return null;
}


function CheckFlash()
{
	if (DetectFlash()>=8)
	{
		return true;
	} else {
		return false;
	}
}
