// JavaScript Document

eval(loadJavascript("./jsdata.js"));
eval(loadJavascript("/scripts/i18n_"+d_imagePath+".js"));
eval(loadJavascript("/scripts/fh/hotel_lists.js"));
eval(loadJavascript("/scripts/fh/fh_default.js"));
eval(loadJavascript("/scripts/fh.jsp?referer="+escape(window.document.referrer)));

function changeLang(l){window.location='/i18n/setLangue.jsp?lang='+l+'&ref='+escape(window.location);}

function hotel_show_hide_outils(nom){
		
	//$("a_partage").removeClassName("actif");
	$("a_imp").removeClassName("actif");
	$("a_pda").removeClassName("actif");
	$("a_fav").removeClassName("actif");
	if(nom!="imp" && $("bloc_outil_hotel_"+nom).style.display!="none"){
		$("bloc_outil_hotel_"+nom).hide();
	}
	else{
		$("a_"+nom).addClassName("actif");
		
		switch(nom){
		
			case 'partage' :
				//$("bloc_outil_hotel_partage").show();
				$("bloc_outil_hotel_pda").hide();	
				$("bloc_outil_hotel_fav").hide();
				
			break;
			
			case 'pda' :
				//$("bloc_outil_hotel_partage").hide();
				$("bloc_outil_hotel_pda").show();
				$("bloc_outil_hotel_fav").hide();	
			break;
	
			case 'fav' :
		//		$("bloc_outil_hotel_partage").hide();
				$("bloc_outil_hotel_pda").hide();
				$("bloc_outil_hotel_fav").show();	
			break;
	
			case 'imp' :
			//	$("bloc_outil_hotel_partage").hide();
				$("bloc_outil_hotel_pda").hide();	
				$("bloc_outil_hotel_fav").hide();
	
			break;
		}	
	}

}

function hotel_show_hide_detail(nom){
		
	if(document.getElementById(nom).style.display=="" || document.getElementById(nom).style.display=="block"){
		$(nom).hide();
		document.getElementById(nom+"_a").style.background = "url(/imagerie/fichehotel/mer/fleche_bas_lien.gif) no-repeat left 4px";
	}
	else{
		$(nom).show();
		document.getElementById(nom+"_a").style.background = "url(/imagerie/fichehotel/mer/fleche_haut_lien.gif) no-repeat left 4px";
	}

}

function hotel_show_hide_salle(nom){
	
	if(document.getElementById(nom).style.display=="" || document.getElementById(nom).style.display=="table-row"){
		$(nom).hide();
		//document.getElementById(nom+"_a").style.background = "url(/imagerie/fichehotel/mer/fleche_bas_lien.gif) no-repeat left 4px";
	}
	else{
		$(nom).show();
		//document.getElementById(nom+"_a").style.background = "url(/imagerie/fichehotel/mer/fleche_haut_lien.gif) no-repeat left 4px";
	}

}


function hotel_show_hide_detail_accor(nom){
		
	$("a_fiche_accor_l_hotel").removeClassName("actif");
	$("a_fiche_accor_l_institut").removeClassName("actif");
	$("a_fiche_accor_soins").removeClassName("actif");

	$(nom).addClassName("actif");
	
	switch(nom){
	
		case 'fiche_accor_l_hotel' :
			$("fiche_accor_l_hotel").show();
			$("fiche_accor_l_institut").hide();	
			$("fiche_accor_soins").hide();
			
		break;
		
		case 'fiche_accor_l_institut' :
			$("fiche_accor_l_hotel").hide();
			$("fiche_accor_l_institut").show();
			$("fiche_accor_soins").hide();	
		break;

		case 'fiche_accor_soins' :
			$("fiche_accor_l_hotel").hide();
			$("fiche_accor_l_institut").hide();
			$("fiche_accor_soins").show();	
		break;
	}

}

function affLogoMercure() {
	
if (getWebapp()=='accorhotels')
{
document.write('<div id="titre_hotel_logo"><img src="/imagerie/fichehotel/mer/logo_mercure.gif" alt="Mercure" width="89" height="52"/></div>');
document.write('<style type="text/css">');
document.write('html>body #nav_hotel{margin-left: 55px;}');
document.write('html>body #titre_hotel{margin-left: 55px;}');
document.write('html>body #nav_fiche_hotel{	margin: 15px 0px 5px 55px;}');
document.write('html>body #contenu_hotel{margin-left: 55px;}');
document.write('</style>');
}
}




var clic_mapo=0;

function load_mapo(){
	  if(clic_mapo==0){
	   clic_mapo=1;
		var url_mapo='http://maps.maporama.com/idl/'+getMapoContext()+'/drawPartner.aspx?MD_height=380&MD_width=404&_rawxml=1&MD_scale=0.00013333&xsl=popup&xml=common&MD_txtStyle=standard&Lang='+gb2en(d_imagePath)+'&siteOrigine='+getSiteOrigine()+'&PBC_1_config=2&PBC_1_list='+d_hotelCode+'&PBC_1_extended=free,yes';
		$('contiframe').innerHTML='<iframe src="'+url_mapo+'" id="iframemapo" name="iframemapo" frameborder="0"></iframe>';
	}
	$('conteneur_mapo').style.visibility="visible";
	  var d= new Draggable('conteneur_mapo'); 
}
	  
function unload_mapo(){
	   $('conteneur_mapo').style.visibility="hidden";
}



function getSiteOrigine(){
	 
	var sites = new Array();
 			sites['accorhotels']='ALL';
 		  sites['mercure']='MER';
	    sites['thalassa']='THA';
   
   var ret = sites[getWebapp()];
   return (ret!=undefined)?ret:'ALL';
   	 
    
}

function getMapoContext(){
	 
	var sites = new Array();
 			sites['accorhotels']='accor';
 		  sites['mercure']='mercure';
	    sites['thalassa']='thalassa';
   
   var ret = sites[getWebapp()];
   return (ret!=undefined)?ret:'accor';
   	 
  
}


function gb2en(l){return (l=='gb')?'en':l};


function affReservez() {
	if (d_lienResa!="")
		document.write('<div class="btn_gris_bg_left"><div class="btn_gris_bg_right"><div class="btn_gris"><span class="btn_bg"><a href="'+d_lienResa+'">'+i18n['rates.and.reservation']+'</a></span></div></div></div>'	);
}

function affNavBar() {
    var nbi = d_NavBarInfo;
    if (nbi.isActive) {
		  document.write('<a href="'+nbi.lienBack+'"><img src="/imagerie/fichehotel/mer/picto_liste.gif" alt=" " width="9" height="9" />&nbsp;'+i18n['hotel.list']+'</a>&nbsp;<a href="'+nbi.lienMoins+'"><img src="/imagerie/fichehotel/mer/fleche_gauche_lien.gif" alt=" " />&nbsp;'+i18n['previous.hotel']+'</a> &nbsp;<img src="/imagerie/fichehotel/mer/fleche_droite_lien.gif" alt=" " /><a href="'+nbi.lienPlus+'">&nbsp;'+i18n['next.hotel']+'</a>');
	}
}

function affFavoris(){
	favHTML ='';
	if (d_isUserLoggedIn){
		favHTML += '<ul><li><a href="javascript:pop_v(\'/managePreferredHotels.svlt?action=addHotel&code_hotel='+d_hotelCode+'&code_chaine='+d_brand+'\',\'450\',\'455\')">'+i18n['add.to.favorites']+'</a></li></ul>';	
	} else {
		favHTML += i18n['you.are.not.identified'];
    favHTML +='<ul><li><a href="javascript:pop_v(\'/modeles/mod_avantages.jsp\',\'450\',\'623\')">'+i18n['avantages']+'</a></li>';
    favHTML +='<li><a href="/createUser.svlt" target="_top">'+i18n['register']+'</a></li>';
    favHTML +='<li><a href="/reservez/fr_top.jsp?ecran=identification" target="_top" >'+i18n['already.registered']+'</a></li></ul>';
	}
	$("bloc_outil_hotel_fav").innerHTML = favHTML;
}


function affMeeting(){
	var lm = $("lien_meeting");
	if (lm==undefined){return;}
  if (getWebapp()!='mercure'){
  		lm.src='http://www.accorhotels.com/'+d_imagePath+'/espace_pro/reunions/rech_hotel.shtml';
  }
  	
}


function affThalassa(){
	if (getWebapp()=='thalassa'){return;}
	var bra = $("btn_reserver_accor");
	if (bra==undefined){return;}
		bra.innerHTML='<a href="/direct.svlt?goto=Thalassa"><img alt="Book your vitality package" width="194" height="18" border="0" src="/'+d_imagePath+'/images/fichehotel/mer/btn_reserver_accor.gif"></a>';
}


function affResaEngine(){
	if (getWebapp()=='thalassa' || d_lienResa==""){return;}

var bth = $("bloc_tarif_hotel");
	if (bth==undefined){ alert("undef");return;}
	bth.innerHTML='<iframe marginheight="0" marginwidth="0" frameborder="0" scrolling="no" allowtransparency="true" id="iframe_oas" src="/'+d_imagePath+'/fichehotel/mer/iframe_resa.html?rid='+d_hotelCode+'"></iframe>';
}

/********************************************
**** Fonction supplementaire pour flash *****
********************************************/

function openLightBoxFromFlash(page,_paramlang,_parammarque,_paramlabel,_paramcode, height, width){
   var a = document.getElementById("galerie1");
   a.setAttribute('href', page+'?pl='+_paramlang+'&pm='+_parammarque+'&pb='+_paramlabel+'&pc='+_paramcode);
   a.setAttribute('rel',"lightbox| 524| 400");
   myLightbox.start(a);
}

function myClose() {
	self.parent.myLightbox.end();
	return false;
	}
	
// Ecriture du Flash Galerie dans l'Iframe avec passage des parametres de localisation
function passeFlash2() {
	var adresse= window.location.search.slice(1,window.location.search.length);
	var tab_data = adresse.split("&"); //les donnes sont séparées
	var myVar="firstvar=1&";
	//traitement pour la gestion de la langue
	var myTabLangue=tab_data[0].split("=");
	var myLangue=myTabLangue[1];
	if ((!myLangue) || (myLangue==""))
	{
		var contenuAlternatif='<p><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=English&P5_Language=English">You need to upgrade your Flash Player to view this content. Click here to start the upgrade.<br /><br />';
		
		
	}else{
	switch(myLangue){
	
		case 'fr' :
			var contenuAlternatif='<p><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=French&P5_Language=French">Vous devez mettre &agrave; jour votre plugin flash pour profiter de ce contenu :<br />cliquez ici pour effectuer la mise &agrave; jour.<br /><br />';
			var contenuAlternatifClose='X Fermer';
		break;
		
		case 'gb' :
			var contenuAlternatif='<p><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=English&P5_Language=English">You need to upgrade your Flash Plugin to view this content. Click here to upgrade.<br /><br />';
			var contenuAlternatifClose='X Close';
		break;

		case 'de' :
			var contenuAlternatif='<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German&P5_Language=German">Sie müssen ihren plug in Adobe Flash Player  um den inhalt lesen zu können :<br />klicken sie hier um aufzurüsten.<br /><br />';
			var contenuAlternatifClose='X Schlie&szlig;e';
		break;
		case 'es' :
			var contenuAlternatif='<p><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=Spanish&P5_Language=Spanish">You need to upgrade your Flash Plugin to view this content. Click here to upgrade.<br /><br />';
			var contenuAlternatifClose='X Close';
		break;
		case 'it' :
			var contenuAlternatif='<p><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=Italian&P5_Language=Italian">You need to upgrade your Flash Plugin to view this content. Click here to upgrade.<br /><br />';
			var contenuAlternatifClose='X Close';
		break;
		case 'nl' :
			var contenuAlternatif='<p><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=Dutch&P5_Language=Dutch">You need to upgrade your Flash Plugin to view this content. Click here to upgrade.<br /><br />';
			var contenuAlternatifClose='X Close';
		break;	
	}
	}

	
	//traitement pour le flash
   	for(i = 0; i < tab_data.length ;i++){
  		 myVar=myVar+tab_data[i]+"&";
    }
	myVar=myVar+"lastvar=1";	
	document.write('<div id="flashcontent">');
	document.write(contenuAlternatif);
document.write('<img src="/imagerie/flash_rune_home.gif" width="53" height="53" border="0" alt="Flash"></a></p>'); 
document.write('<p><a href="javascript:myClose();">'+contenuAlternatifClose+'</a></p></div>');
// <![CDATA[');
var a = new SWFObject("/flash/hotel/mer_galerie.swf?"+myVar, "mer_slideshow", "518", "379", "7", "#00000");
a.addParam("allowScriptAccess", "always");
a.addParam("quality", "high");;
a.addParam("scale", "noscale");
a.addParam("wmode", "transparent");
a.setAttribute('xiRedirectUrl', window.location);
a.write("flashcontent");
// ]]>';
}
