








	/*Object ElemMenu*/
	function ElemMenu(idancestor,id,dcr,isMasked)
	{
		this.idancestor = idancestor;
		this.id = id;
		this.dcr = dcr;
                this.isMasked = isMasked;
	}
	/*Object ItemMenu*/
	function ItemMenu(name)
	{
		this.name = name;
		this.tabDcrs = new Array;/*Table of DCRs contained in this item*/
		this.tabElems = new Array;/*Table of ElemMenu contained in this item*/
		this.addElem = addElemMenu;
		this.containDcr = containDcrMenu;
		this.getTabIds = getTabIdsMenu;
		this.getElemMenuById = getElemMenuById;
                this.getElemMenuByDcr = getElemMenuByDcr;
        }
        /*Function for add an ElemeMenu in ItemMenu*/
        function addElemMenu(idancestor,id,dcr,isMasked)
        {
                if(typeof(isMasked)=='undefined') isMasked = false;
		this.tabDcrs.push(dcr);
		var newElem = new ElemMenu(idancestor,id,dcr,isMasked);
		this.tabElems.push(newElem);
	}
	/*Function for find if ItemMenu contain a dcr*/
	function containDcrMenu(dcr)
	{
		for(var i=0;i<this.tabDcrs.length;i++){
			if(this.tabDcrs[i] == dcr) {
				return true;
			}
		}
		return false;
	}
	/*Function for get an ElemeMenu in ItemMenu by Id*/
	function getElemMenuById(id)
	{
		for(var i=0;i<this.tabElems.length;i++){
			if(this.tabElems[i].id == id) {
				return this.tabElems[i];
			}
		}
		return false;
	}
        /*Function for get an ElemeMenu in ItemMenu by Dcr*/
        function getElemMenuByDcr(dcr)
        {
                for(var i=0;i<this.tabElems.length;i++){
                        if(this.tabElems[i].dcr == dcr) {
                                return this.tabElems[i];
                        }
                }
                return false;
        }
	/*Function for get the table of self and ancestor IDs ElemeMenu in ItemMenu by dcr*/
	function getTabIdsMenu(dcr)
	{
		if(this.containDcr(dcr)) {
			var tabIds = new Array;
			for(var i=0;i<this.tabElems.length;i++){
				if(this.tabElems[i].dcr == dcr) {
					tabIds.push(this.tabElems[i].id);
					var idancestor = this.tabElems[i].idancestor;
					while(idancestor > 0){
						var ancestor = this.getElemMenuById(idancestor);
						if(ancestor) {
							tabIds.push(ancestor.id);
							idancestor = ancestor.idancestor;
						} else {
							idancestor = 0;
						}
					}
					return tabIds;
				}
			}
		}
		return false;
	}


	/*Object MenuAF*/
	function MenuAF()
	{
		this.tabItems = new Array;/*Table of Items contained in this menu*/
		this.addItem = addItemMenu;
		this.getCurrentRubrique = getCurrentRubrique;
		this.getCurrentItem = getCurrentItem;		
                this.isCurrentItemMasked = isCurrentItemMasked;
	}
	/*Function for add an item in MenuAF*/
	function addItemMenu(newItem)
	{
		this.tabItems.push(newItem);
	}
	/*Function for get the current ItemMenu object through cu_Dcr set in tpl*/
	function getCurrentItem()
	{
		if(cu_Dcr && cu_Dcr.length > 0){
			for(var i=0;i<this.tabItems.length;i++){
				if(this.tabItems[i].containDcr(cu_Dcr)) {
					return this.tabItems[i];
				}
			}
                        if(cu_Dcr=="reservation") {return  this.tabItems[0];}
                        if(cu_Dcr=="award") {return  this.tabItems[6];}
                        if(cu_Dcr=="infovol") {return  this.tabItems[1];}
                        if(cu_Dcr=="horaire") {return  this.tabItems[1];}
		}
		return false;
	}
	/*Function for get the currentRubrique through cu_Dcr set in tpl*/
	function getCurrentRubrique()
	{
		var currentItemMenu = this.getCurrentItem();
		if(currentItemMenu) {
			return "id_" + currentItemMenu.name;
		}
		return false;
	}
        /*Function for get if the fluctuant is masked for the currentRubrique*/
        function isCurrentItemMasked()
        {
                var currentItemMenu = this.getCurrentItem();
                if(currentItemMenu) {
                        var currentElemMenu = currentItemMenu.getElemMenuByDcr(cu_Dcr);
                        if(currentElemMenu) {
                                return currentElemMenu.isMasked;
                        }
                }
                return false;
        }




/*Begin set of ItemMenu Objects with xml menu*/

		
		var menuAF = new MenuAF();
		
		
		var itemUn = new ItemMenu('itemUn');
		menuAF.addItem(itemUn);
		itemUn.addElem(0,1,"accueil_achat_enregistrement");itemUn.addElem(1,2,"reservation_achat");itemUn.addElem(1,3,"tarifs_promotions");itemUn.addElem(1,4,"option_payante");itemUn.addElem(1,5,"autre_service");itemUn.addElem(5,6,"hotel");itemUn.addElem(5,7,"voiture");itemUn.addElem(5,8,"coffre_numerique");itemUn.addElem(5,9,"tourisme");itemUn.addElem(5,10,"Vuelo_Hotel");itemUn.addElem(5,11,"assurance_onglet");itemUn.addElem(5,12,"transfert_aeroport");itemUn.addElem(1,13,"contact_reseaux_sociaux");itemUn.addElem(1,14,"reservation_gerer");itemUn.addElem(1,15,"enregistrement_onglet");itemUn.addElem(15,16,"enregistrement_hle");
		
		var itemDeux = new ItemMenu('itemDeux');
		menuAF.addItem(itemDeux);
		itemDeux.addElem(0,1,"accueil_infos_vols_destinations");itemDeux.addElem(1,2,"horaires");itemDeux.addElem(1,3,"airfrance_vous_contacte");itemDeux.addElem(1,4,"reseau_onglet");itemDeux.addElem(4,5,"destination_airfrance");itemDeux.addElem(4,6,"avion_train_onglet");itemDeux.addElem(1,7,"guide_destinations");itemDeux.addElem(1,8,"calculateur_co2");
		
		var itemTrois = new ItemMenu('itemTrois');
		menuAF.addItem(itemTrois);
		itemTrois.addElem(0,1,"accueil_preparation_voyage");itemTrois.addElem(1,2,"formalite_onglet");itemTrois.addElem(1,3,"bien_etre_sante");itemTrois.addElem(3,4,"bien_etre_onglet");itemTrois.addElem(3,5,"bien_etre_sante_vaccination");itemTrois.addElem(3,6,"anti_stress");itemTrois.addElem(1,7,"assistance_passager");itemTrois.addElem(7,8,"famille_enfant_onglet");itemTrois.addElem(7,9,"voyage_enfant_seul");itemTrois.addElem(7,10,"femme_enceinte");itemTrois.addElem(7,11,"pmr_onglet");itemTrois.addElem(7,12,"pfc");itemTrois.addElem(1,13,"bagage");itemTrois.addElem(13,14,"bagage_cabine_onglet");itemTrois.addElem(13,15,"bagage_soute_onglet");itemTrois.addElem(13,16,"bagage_special_onglet");itemTrois.addElem(13,17,"bagage_incident_onglet");itemTrois.addElem(1,18,"animal_onglet");
		
		var itemQuatre = new ItemMenu('itemQuatre');
		menuAF.addItem(itemQuatre);
		itemQuatre.addElem(0,1,"accueil_aeroport");itemQuatre.addElem(1,2,"aeroport_enregistrement");itemQuatre.addElem(1,3,"service_personnalise_aeroport");itemQuatre.addElem(1,4,"salon_onglet");itemQuatre.addElem(1,5,"correspondance_cdg");itemQuatre.addElem(1,6,"airfrance.travel-guides");itemQuatre.addElem(1,7,"service_gratuit_onglet");
		
		var itemCinq = new ItemMenu('itemCinq');
		menuAF.addItem(itemCinq);
		itemCinq.addElem(0,1,"accueil_a_bord");itemCinq.addElem(1,2,"vols_intercontinentaux");itemCinq.addElem(2,3,"la_premiere_onglet");itemCinq.addElem(2,4,"affaires_onglet");itemCinq.addElem(2,5,"premium_voyageur_onglet");itemCinq.addElem(2,6,"alize_onglet");itemCinq.addElem(2,7,"voyageur_onglet");itemCinq.addElem(1,8,"vols_en_europe");itemCinq.addElem(8,9,"premium_europe_onglet");itemCinq.addElem(8,10,"voyageur");itemCinq.addElem(1,11,"vols_en_france");itemCinq.addElem(1,12,"divertissement_onglet");itemCinq.addElem(1,13,"plan_cabine");
		
		var itemSix = new ItemMenu('itemSix');
		menuAF.addItem(itemSix);
		itemSix.addElem(0,1,"accueil_flying_blue");itemSix.addElem(1,2,"fblue_welcome");itemSix.addElem(2,3,"fblue_adhesion");itemSix.addElem(2,4,"fblue_avantages_elite_onglet");itemSix.addElem(2,5,"fblue_manage_my_account");itemSix.addElem(2,6,"fblue_regulariser");itemSix.addElem(2,7,"fblue_book_flight");itemSix.addElem(2,8,"fblue_news");itemSix.addElem(2,9,"fblue_gagner_utiliser_onglet");itemSix.addElem(2,10,"fblue_acheter");itemSix.addElem(1,11,"fblue_clubs");itemSix.addElem(11,12,"petroleum_programme_onglet");itemSix.addElem(11,13,"fblue_golf");itemSix.addElem(11,14,"fblue_china");itemSix.addElem(11,15,"fblue_africa");
		
		var itemSept = new ItemMenu('itemSept');
		menuAF.addItem(itemSept);
		itemSept.addElem(0,1,"accueil_offre_entreprise_zz");itemSept.addElem(1,2,"bluebiz_onglet");itemSept.addElem(2,3,"bluebiz_compte");itemSept.addElem(2,4,"bluebiz_prime");itemSept.addElem(2,5,"bluebiz_espace_client");itemSept.addElem(2,6,"bluebiz_adherer");itemSept.addElem(1,7,"global_travel");itemSept.addElem(1,8,"congres_salon_seminaire");

		
		var itemFooter = new ItemMenu('itemFooter');
		menuAF.addItem(itemFooter);
		itemFooter.addElem(0,0,"footer");itemFooter.addElem(0,1,"aide_et_contact");itemFooter.addElem(0,2,"internet_mobile_airfrance");itemFooter.addElem(0,3,"plan_du_site");itemFooter.addElem(0,4,"edito_preambule");itemFooter.addElem(0,5,"Vuelos Air France");itemFooter.addElem(0,6,"facebook");itemFooter.addElem(0,7,"twitter");itemFooter.addElem(0,8,"E-news");itemFooter.addElem(0,9,"El arte del viaje");itemFooter.addElem(0,10,"");itemFooter.addElem(0,11,"laboutique");itemFooter.addElem(0,12,"E-shopping");itemFooter.addElem(0,13,"corporate_airfrance");itemFooter.addElem(0,14,"airfranceklm");itemFooter.addElem(0,15,"developpement_durable");itemFooter.addElem(0,16,"La historia de Air France");itemFooter.addElem(0,17,"goodies");itemFooter.addElem(0,18,"klm");itemFooter.addElem(0,19,"SkyTeam");itemFooter.addElem(0,20,"autres_sites_af");

/*End set of ItemMenu Objects with xml menu*/

cu_Http="http://";
cu_Https="https://";


/*fonction pour ouvrir les liens du menu (permet la gestion des params d'ouverture en popup)*/
function af_md(iu_UrlMenu,iu_HttpsMenu,iu_ParametreMenu)
{
  var vo_UrlMenu=new String(iu_UrlMenu) ;
  if (vo_UrlMenu.length && vo_UrlMenu.substr(0,7)!= "http://" && vo_UrlMenu.substr(0,8)!= "https://"){
  	/*Si on a une action ou une jsp on ajoute la chaine base cgi-bin/AF et la session*/
		if (vo_UrlMenu.indexOf(".jsp")>0){
			vo_UrlMenu=(iu_HttpsMenu?cu_Https:cu_Http)+cu_Serveur+chaineBase+vo_UrlMenu;
		}
		else{   	/*Si on a une page statique on ajoute juste la session*/
			if (vo_UrlMenu.indexOf(".htm")>0 || vo_UrlMenu.indexOf(".html")>0){
				vo_UrlMenu=(iu_HttpsMenu?cu_Https:cu_Http)+cu_Serveur+vo_UrlMenu;
			}
		}
  }
  /*affichage du lien en popum avec les params recup du xml menu*/
  if (iu_ParametreMenu)
  {
    var vo_FenetreMenu = window.open(vo_UrlMenu,"popup",iu_ParametreMenu);
    vo_FenetreMenu.focus();
		var vo_PopMenu = window.open(vo_UrlMenu,"popup",iu_ParametreMenu+",scrollbars=yes");
		if((!vo_PopMenu) || (vo_PopMenu.closed)){
		      alert(".");
		} else{
		 vo_FenetreMenu.focus();
		}	  
	}
  else 	/*Si url complete on la passe telle suelle*/
  {
	document.location=vo_UrlMenu;
  }
}


/*Alimentation des variables utiles pour le header*/
var affichagePicto = "Yes";
var countryLabel = "España";
var searchInSiteUrl = "";
var defaultSeachInputContent = "";
var aideUrl = "/ES/es/local/transverse/footer/aide_et_contact.htm?menu=false";
var aideParamUrl = "";
var aideLibUrl = "Contactarnos";
var faqUrl = " ";
var faqParamUrl = "";
var faqLibUrl = " ";
var champsRechercher = "";

var premiereLangue =  "Español";
var deuxiemeLangue =  "Français";
var troisiemeLangue =  "English";
var isMultiLangues = premiereLangue && deuxiemeLangue;
var autresPays = "Otros paises";



var premiereLangueUrl = "/"+cu_Marche+"/es/common/home/vuelos/billete-avion.do";
var deuxiemeLangueUrl =  "/"+cu_Marche+"/fr/common/home/vuelos/billete-avion.do";
var troisiemeLangueUrl = "/"+cu_Marche+"/en/common/home/vuelos/billete-avion.do";
var autresPaysUrl = "/ES/es/local/home/home/redirection_home.jsp";
var traductionPays= "España";
var urlQgo =  "http://faq.airfrance.fr/b2c/AskQuestion.do";
var qgoRechercher =  "Ask a question here (English only)";
var qgoOk =  "ok";

var profileHome = "https://"+document.location.hostname+"/"+cu_Marche+"/"+cu_Langue+"/common/personnalisation/nonloggue/modifierMonAirfranceFFPSecurise.do";
var siteHome = "https://"+document.location.hostname+"/"+cu_Marche+"/"+cu_Langue+"/common/home/vuelos/billete-avion.do";


function initFaqPopup() {
  document.getElementById('idFaqQuestion').value = document.getElementById('idQgoQuestion').value;
  document.getElementById('idFaqLanguage').value = cu_Langue;
  document.getElementById('idFaqCountry').value = cu_Marche;
  document.getElementById('idFaqReferrer').value = cu_Serveur;
  document.getElementById('idFaqDefaultQuestionBoolean').value = (document.getElementById('idQgoQuestion').value==document.getElementById('idQgoQuestion').defaultValue);
  var popup = window.open('','faqPopup','menubar=no, location=no, scrollbars=no, statusbar=no, width=890, height=450');
  document.faqForm.action = 'http://faq.airfrance.fr/b2c/AskQuestion.do';
  document.faqForm.target = 'faqPopup';
  document.faqForm.submit();
}

function goToHome() {
  var urlHomePage = "";
  for (var i=0;i<cu_Monet.length;i++){
     if (cu_Marche == cu_Monet[i]) { 
          urlHomePage = '/' + cu_Marche + '/' + cu_Langue + '/common/home/vuelos/billete-avion.do'; 
          break;
     }
  }
  if (urlHomePage == ""){
		for (i=0; i<cu_MonetNonVendeur.length; i++){
			if (cu_Marche == cu_MonetNonVendeur[i]) {
				urlHomePage = '/' + cu_Marche + '/' + cu_Langue + '/common/home/vuelos/billete-avion.do' + '?' + chaineLien;
				break;
			}
		}
	}
	
  if (urlHomePage == ""){
     urlHomePage = '/' + cu_Marche + '/' + cu_Langue + '/common/util/forwardClusterAction.do?url=flyingblue.htm';     
  }
  document.location = urlHomePage;
}

/* Variables pour le bloc FB */
	var libBoutonDepliantShow = "Mostrar";
	var libBoutonDepliantHide = "Ocultar";

  var msgNoReservation = "No hemos encontrado ninguna reserva";
  var msgOtherReservations = "Todas sus reservas";
  var labelRef = "Ref.";

	var urlLoginXml = '/' + cu_Marche + '/' + cu_Langue + '/local/home/login/XmlLoginAction.do';

	var libNiveauxTier = new Array();
	libNiveauxTier[0] = "Afiliado Flying Blue Ivory";
	libNiveauxTier[1] = "Afiliado Flying Blue Silver";
	libNiveauxTier[2] = "Afiliado Flying Blue Club 2000";
	libNiveauxTier[3] = "Afiliado Flying Blue Jeune";
	libNiveauxTier[4] = "Afiliado Flying Blue Jeune";
	libNiveauxTier[5] = "Afiliado Flying Blue Gold";
	libNiveauxTier[6] = "Afiliado Flying Blue Platinum";
	
	var msg_plage_longueur_alphanum = "El campo {0} debe contener entre {1} y {2} caracteres.";
	var msg_champs_alphanumeriques = "El campo {0} no debe contener espacios, los símbolos *+-/ ni caracteres especiales.";
	var msgMandatoryField = "Por favor, complete el/los campo(s) obligatorio(s).";

	var vocaIdentifiant	= "Identificador";
	var vocaMotDePasse	= "Código";
    if (isMyAccountActive){
        vocaIdentifiant = "Identificador";
        vocaMotDePasse  = "Código";
    }
	/** Controle : Identifiant **/
	var msgFbNumberLength = msg_plage_longueur_alphanum.replace('\{0\}', vocaIdentifiant);
	msgFbNumberLength = msgFbNumberLength.replace("\{1\}", "6");
	msgFbNumberLength = msgFbNumberLength.replace("\{2\}", "16");
	msgFbNumberLength = msgFbNumberLength.replace("'", "\'");

	var msgFbNumberAlphaNum = msg_champs_alphanumeriques.replace("\{0\}", vocaIdentifiant);
	msgFbNumberAlphaNum = msgFbNumberAlphaNum.replace("'", "\'");
    var msg_email_mya = "La dirección de e-mail que ha introducido no es válida.";  

	/** Controle : Mot de passe **/
	var msgFbPasswordLength = msg_plage_longueur_alphanum.replace("\{0\}",vocaMotDePasse);
	msgFbPasswordLength = msgFbPasswordLength.replace("\{1\}", "4");
	msgFbPasswordLength = msgFbPasswordLength.replace("\{2\}", "10");
	msgFbPasswordLength = msgFbPasswordLength.replace("'", "\'");

	var msgFbPasswordAlphaNum = msg_champs_alphanumeriques.replace("\{0\}", vocaMotDePasse);
	msgFbPasswordAlphaNum = msgFbPasswordAlphaNum.replace("'", "\'");

    var vocaMotDePasseMA  = "Código";
    var msgMAPasswordLength = msg_plage_longueur_alphanum.replace("\{0\}",vocaMotDePasseMA);
    msgMAPasswordLength = msgMAPasswordLength.replace("\{1\}", "6");
    msgMAPasswordLength = msgMAPasswordLength.replace("\{2\}", "12");
    msgMAPasswordLength = msgMAPasswordLength.replace("'", "\'");

    var msgMAPasswordAlphaNum = msg_champs_alphanumeriques.replace("\{0\}", vocaMotDePasseMA);
    msgMAPasswordAlphaNum = msgMAPasswordAlphaNum.replace("'", "\'");

    var msgFbPasswordDigits = "El campo {0} debe contener entre {1} y {2} caracteres.";
    msgFbPasswordDigits = msgFbPasswordDigits.replace("\{0\}",vocaMotDePasse);
    msgFbPasswordDigits = msgFbPasswordDigits.replace("\{1\}", "4");
    msgFbPasswordDigits = msgFbPasswordDigits.replace("\{2\}", "6");
    msgFbPasswordDigits = msgFbPasswordDigits.replace("'", "\'");
    
	function showLoginError(errorCode) {
		var errorMsg;
		if(errorCode == 'COMM_MESG_LOGIN_NON_TROUVE') {
			errorMsg = "";
		}
		if(errorCode == 'COMM_MESG_LOGIN_INVALIDE') {
			errorMsg = "El identificador o el código de acceso indicado es incorrecto. Después de 3 intentos fallidos, la cuenta se bloqueará durante 30 minutos. Si ha perdido su identificador y/o su código de acceso, haga clic en el enlace “Código perdido” del bloque de autenticación Flying Blue.  Nota: por razones de seguridad, sus antiguos códigos quedarán invalidados.";
		}
		if(errorCode == 'COMM_MESG_FORMAT_PASSWORD') {
			errorMsg = "";
		}
		if(errorCode == 'COMM_MESG_LOGIN_BLOQUE') {
			errorMsg = "El acceso a su cuenta se ha bloqueado durante 30 minutos";
		}
		if(errorCode == 'COMM_MESG_LOGIN_INVALIDE_BLOQUE') {
			errorMsg = "El código de acceso es incorrecto. El acceso a su cuenta se ha bloqueado durante 30 minutos.";
		}
		if(errorCode == 'COMM_MESG_POSSEDE_LOGIN') {
			errorMsg = "";
		} 
		if(errorCode == 'COMM_MESG_REFUSER') {
			errorMsg = "";
		}  
		if(errorCode == 'COMM_MESG_ERREUR_TECHNIQUE') {
			errorMsg = "";
		}
		alert(errorMsg);
	}

function toggleLoginBoxState(){
 if(document.getElementById("FBNotLoggued") != null){
	 if(document.getElementById("FBNotLoggued").style.display =="block"){
		 document.getElementById("FBNotLoggued").style.display = "none";
		 if(document.getElementById("toggleLogoFB") != null)document.getElementById("toggleLogoFB").src = "/FR/common/common/img/logos/FBLogo_closed.gif";
	 }
	 else {
		 if(document.getElementById("toggleLogoFB") != null)document.getElementById("toggleLogoFB").src = "/FR/common/common/img/logos/FBLogo_open.gif";
			 document.getElementById("FBNotLoggued").style.display = "block";
		
		 }
 }
}

