// Fonction qui permet de charger le flash
function LoadFlash(smode, nom_fichier, num_ambiance)
{
	var so = new SWFObject("../flash/player-allibert.swf?anticache=" + (new Date()).getTime(), "myFlash", "769", "442", "8", "#000000");
	so.addParam("quality","High");
	so.addParam("wmode", "transparent");
	so.addVariable("smode", smode);
	so.addVariable("nom_fichier", "../xml/" + langue + "/" + nom_fichier);
	so.addVariable("duree", duree);
	so.addVariable("duree_transition", duree_trans);
	so.write("zoneFlash");
	
	if (num_ambiance != "")
	{
		AllumerMenu(num_ambiance);
	}
}

//Fonction qui permet d'allumer une ambiance
function AllumerMenu(num)
{
	$(".menu_effet").unbind("mouseover");
	$(".menu_effet").unbind("mouseout");
	
	$(".opcacite_menu").show();
	$(".effet_image").hide();

	$(".opcacite_menu", $("#menu_categorie_0" + num)).hide();
	$(".effet_image", $("#menu_categorie_0" + num)).show();

	$("#menu_categorie_01").attr("class", "menu_effet");
	$("#menu_categorie_02").attr("class", "menu_effet");
	$("#menu_categorie_03").attr("class", "menu_effet");
	$("#menu_categorie_04").attr("class", "menu_effet");


	$("#menu_categorie_0" + num).attr("class", "menu_effet_verrouille");
	
	AnimAmbiance();
	
}

//Fonction qui appelle la fonction LoadFlash
function ClickAmbiance(num)
{
	LoadFlash("ambiance", "ambiance_" + num + ".xml", num);
}

//Fonction qui permet de créer l'effet sur les ambiances
function AnimAmbiance()
{
	$(".menu_effet").mouseover(function(){
		$(".opcacite_menu", this).hide();
		$(".effet_image", this).show();
	}).mouseout(function(){
		$(".opcacite_menu", this).show();
		$(".effet_image", this).hide();
	});
	
}

function tb_show_mask(){
	if(document.getElementById("TB_window"))
	{
		document.getElementById("TB_window").style.display = "none";
	}
	if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
		$("body","html").css({height: "100%", width: "100%"});
		$("html").css("overflow","hidden");
		if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
			$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
		}
	}else{//all others
		if(document.getElementById("TB_overlay") === null){
			$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
		}
	}
	
	if(tb_detectMacXFF()){
		$("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
	}else{
		$("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
	}


	$("body").append("<div id='TB_load'><img src='../images/loading_wheel.gif' /><div style=\"color:#FFF; margin:10px 0 0 0;\">" + srtPatienter + "</div></div>");//add loader to the page
	$('#TB_load').show();//show loader
}

