
// init namespace (a utiliser pour eviter toute collision)
if(!NOV) {var NOV = {};}

NOV.fhdyn = {
	
	lang : FH.getLang(),
	rid: FH.getRid(),
	brand :FH.getBrand(),
	mark:FH.getMark(),
	imgpath:FH.en2gb(FH.getLang()),
	version:FH.getVersion(),
	
	init: function() {
			  /** retro compatibilite pseudojs **/
			  var d_rfpCriteria;
				
				var d_isUserLoggedIn = false;
    		function NavBarInfo(isActive,lienBack,lienMoins,lienPlus){this.isActive = isActive;this.lienBack = lienBack;this.lienPlus = lienPlus;this.lienMoins = lienMoins;}
     		var d_lienResa = "", d_imagePath = NOV.fhdyn.imgpath, d_brand = NOV.fhdyn.brand, d_mark = NOV.fhdyn.mark, d_hotelCode = NOV.fhdyn.rid;
				
				eval(FH.fhdyn.callFhJsp());
				
				if (d_NavBarInfo.isActive) {NOV.fhdyn.nav(d_NavBarInfo.lienBack,d_NavBarInfo.lienMoins,d_NavBarInfo.lienPlus);};
				NOV.fhdyn.resaEngine(d_lienResa);
				NOV.fhdyn.book(d_lienResa );
				NOV.fhdyn.mapo();
				NOV.fhdyn.favorites(d_isUserLoggedIn);
				NOV.fhdyn.meeting();
				NOV.fhdyn.promoweb();
				NOV.fhdyn.promopackage();
				NOV.fhdyn.thalassa();
				NOV.fhdyn.oas();
				NOV.fhdyn.family();
	},
	
		
	resaEngine : function (d_lienResa){
		var src;
		if (FH.context.isThalassa) {
			src= '/'+this.imgpath+'/fichehotel/nov/bloc_moteur_tha_fh.htm?v='+this.version+'#rid='+this.rid;
		} else if (FH.context.isMeetings) {
			src= '/'+this.imgpath+'/fichehotel/nov/bloc_moteur_mice_fh.htm?v='+this.version+'#rid='+this.rid+'&brand=nov&lang='+FH.en2gb(this.lang);
		} else if (FH.context.isTravelagencies && d_lienResa!="") {
			src= '/'+this.imgpath+'/fichehotel/nov/bloc_moteur_travel_fh.htm?v='+this.version+'#rid='+this.rid+'&brand=nov&lang='+this.imgpath;
		} else if (d_lienResa!="") {
			src= '/'+this.imgpath+'/fichehotel/nov/bloc_moteur_fh.htm?v='+this.version+'#rid='+this.rid;
	  } else {
	  	src= '/'+this.imgpath+'/fichehotel/nov/bloc_moteur_empty_fh.htm?v='+this.version+'#rid='+this.rid;
	  } 
	  
	  var ifres = $('iframe_resa');
		ifres.replace('<iframe id="iframe_resa" src="'+src+'" frameborder="0" allowtransparency="true" class="bloc-moteur"></iframe>');
	},
	
	book : function(link){
		  if (link=="" || FH.context.isMeetings || FH.context.isTravelagencies){return;}
		 var alt= I18N._('fh','Rates and reservation');
		 var inn ='<a href="'+link+'" ><img alt="'+alt+'" src="/'+this.imgpath+'/images/fichehotel/nov/btn_tarifs_resa.gif" onclick="xt_med(\'C\',getCodeLangue(\''+this.lang+'\'),\'fiche_hotel::' + this.rid + '::rates\',\'N\')"/></a>';
	   try {$('btn_resa').innerHTML =inn;} catch(ee){};          
	},
	
	nav : function (link_all,link_prev,link_next){
			var nav = $("context-link");
			nav.innerHTML='<li class="list"><a href="'+link_all+'">'+I18N._('fh','List of hotels')+'</a></li>'
          +'<li class="previous"><a href="'+link_prev+'">'+I18N._('fh','Previous hotel')+'</a></li>'
          +'<li class="next"><a href="'+link_next+'">'+I18N._('fh','Next hotel')+'</a></li>';
	} ,
	
	favorites : function (idt){
		var fav = $('lnk_favorites');
		var iframe_profile_src = "";
		if (idt){
			fav.href = '/managePreferredHotels.svlt?action=addHotel&code_hotel='+this.rid+'&code_chaine=NOV';
			iframe_profile_src='/'+this.imgpath+'/fichehotel/nov/bloc_identifie.htm';
		} else {
			fav.href = '/'+this.imgpath+'/fichehotel/nov/pop_favoris.html';
			iframe_profile_src='/'+this.imgpath+'/fichehotel/nov/bloc_non_identifie.htm';
		}
		var ifres = $('iframe_profile');
		if ('iframe'==ifres.tagName.toLowerCase())
			ifres.src=iframe_profile_src;
		else 
			ifres.replace('<iframe id="iframe_profile" src="'+iframe_profile_src+ '" frameborder="0" allowtransparency="true" scrolling="no"></iframe>');
		
  },    

	meeting : function (){
		if ( FH.context.isMeetings) {
			try{$("lnk_meeting").remove()}catch(ee){};
			try{$("lnk_meeting1").remove()}catch(ee){};
			try{$("lnk_meeting2").remove()}catch(ee){};
		} 
	},

	family : function (){
		if (! FH.context.isNovotel) {
			try{$("btn_family-guide").remove()}catch(ee){};
		} 
	},

  promoweb : function (mice){
  	if (FH.context.isThalassa || FH.context.isTravelagencies || FH.context.isMeetings ) {
  		try{$("btn_promoweb").remove()}catch(ee){};
  	} else {
  		var lnk_promoweb = $("lnk_promoweb");
  		if (lnk_promoweb) Event.observe(lnk_promoweb, 'click', function(e) {e.stop();pop_v(lnk_promoweb.href,'480px','300px');} );
  	}
  },

	promopackage : function (mice){
  	if (FH.context.isThalassa || FH.context.isTravelagencies || FH.context.isMeetings ) {
  		try{$("btn_promopackage").remove()}catch(ee){};
  	} 
  },

	thalassa : function (){
		if (FH.context.isThalassa){
			try{$("btn_thalassa").remove()}catch(ee){};
	 } 
	},

	oas : function(){
		var oas = $('iframe_oas');
		if(oas==null) {return;}
		oas.src= '/'+this.imgpath+'/fichehotel/nov/push_oas.htm#lang='+this.lang+'&hotelcode='+this.rid+'&page='+new String(window.top.location.href).slice(7).split('#')[0];
	},
	
	 mapo : function(){
  	try{FH.mapo.init_map('mapo','lnk_map');}catch(ee){};
  }

	
}



// chargement des fonctions
FH.fhdyn.init(NOV);


