var nbMax = 9; var paxNumber = 1; var daylabels = new Array(); var tabTyposPaxUM = new Array(); // liste des typologies mineurs autorisés à voyager seuls (UM) tabTyposPaxUM[0] = 'CHD'; var isUMSearch = false; var CONST_ROUND_TRIP = "2"; var CONST_ONE_WAY = "1"; var CONST_MULTI_STOP = "4"; defaultErrorMessage[VALIDATION_MANDATORY] = "Please complete the {0} field."; var minDayTrip = 15; var minYearMonthTrip = 201712; var maxDayTrip = 15; var maxYearMonthTrip = 201812; AF.popupCounterUMTitle = "Travel for Unaccompanied Minors (UM) and infants"; AF.popupCounterUMMessage = "Booking for a child or youth is not possible on the mobile site.

Please go to a travel agency or an Air France ticket office, or make your booking on the regular Air France website, and make 2 separate bookings."; AF.popupUM12Title = "Travel for Unaccompanied Minors (UM) and infants"; AF.popupUM12Message = "The child will turn 12 years old during the trip. Therefore, booking is not possible on the mobile site.

Please go to a travel agency or an Air France ticket office, or make your booking on the regular Air France website, and make 2 separate bookings: one for the departing flight and one for the return flight."; /** * check if inputs are empty or if it's oneway */ function checkForm() { /* Si l'utilisateur n'a pas utilisé la completion */ if ($("idArrivalTrip1Input").value == '') { $("idArrivalTrip1Input").value = $("idArrivalTrip1").value; } if ($("idDepartureTrip1Input").value == '') { $("idDepartureTrip1Input").value = $("idDepartureTrip1").value; } /* Type de trajet */ if (jQuery("#idTypeTrip").val() == CONST_ROUND_TRIP) { // Aller Retour /* Mise à jour du champ origine du 2eme itineraire */ $("idDepartureTrip2Input").value = $("idArrivalTrip1Input").value; /* Mise à jour du champ destination du 2eme itineraire */ $("idArrivalTrip2Input").value = $("idDepartureTrip1Input").value; $("idDepartureTrip2Input_type").value = $("idArrivalTrip1Input_type").value; $("idArrivalTrip2Input_type").value = $("idDepartureTrip1Input_type").value; } else if(jQuery("#idTypeTrip").val() == CONST_ONE_WAY){ // Aller simple $("idDepartureTrip2Input").value = ""; $("idArrivalTrip2Input").value = ""; $("idDepartureTrip2Input_type").value = ""; $("idArrivalTrip2Input_type").value = ""; jQuery("#jourRetour").val(""); // way to know if its oneway or roundtrip in the java validateForm jQuery("#moisRetour").val(""); } } function formatDateForB2C(date) { return date.slice(0, 4) + "-" + date.slice(4, 6) + "-" + date.slice(6, 8); } function validate() { clearErrors(); var nameForm = jQuery("#idMainForm").attr("name"); /* Page UM-1 */ if(nameForm=="umSearchForm"){ isUMSearch = true; var nbChildMoreThan12 = 0; for(i=1;i<=AF.countNbCHD();i++){ if(jQuery("#inputAgeOfChild"+i).val()>=12){ nbChildMoreThan12++; } } if(nbChildMoreThan12 != 0 && nbChildMoreThan12 != AF.countNbCHD()){ AF.showMessage(AF.popupCounterUMTitle, AF.popupCounterUMMessage, "bmw-popup"); return; } for(i=1;i<=AF.countNbCHD();i++){ if(jQuery("#inputAgeOfChild"+i).val()>=12){ if (jQuery("#bmw-nbPassenger").hasClass('closed')) { jQuery("#bmw-title-nbPassenger").click(); } AF.showPopup("popup_um_not_available_bmw"); return; }else if(AF.getBirthday(i).year && AF.DateTools.getYears(AF.getBirthday(i), AF.getReturnDate()) >= 12 && AF.DateTools.getYears(AF.getBirthday(i), AF.getDepartureDate()) <= 12){ if (jQuery("#bmw-nbPassenger").hasClass('closed')) { jQuery("#bmw-title-nbPassenger").click(); } AF.showMessage(AF.popupUM12Title, AF.popupUM12Message, "bmw-popup"); return; } } } var fieldsOK = af_validation("idMainForm", false); if (fieldsOK) { var adults = AF.countNbAdult(); var children = AF.countNbCHD(); var youngMin = AF.countNbYTH_MIN(); var babies = AF.countNbBaby(); if (!isUMSearch && adults == 0 && applicationCode=="MSTD") { var isSH = jQuery("#idHaul").val()==="SH"; var isCIO = jQuery("#idHaul").val()==="CIO"; var isTypoChildOK = children <= 0 || isStringInArray(tabTyposPaxUM, "CHD"); var isTypoYoungMinOK = youngMin <= 0 || isStringInArray(tabTyposPaxUM, "YTH_MIN"); if(!isUMBMW || !isTypoChildOK || !isTypoYoungMinOK || !isSH && !isCIO){ jQuery("#redirectB2C").show(); jQuery("#yesButton").attr("onclick","javascript:AF.redirectTo('" + getB2CUrlToRedirect() + "')"); if(jQuery("#idTypeTrip").val() === '4') { jQuery("#yesButton").attr("onclick","javascript:AF.redirectTo('" + getB2CUrlToRedirect('true') + "')"); } } else { jQuery("#redirectB2C").hide(); jQuery("#yesButton").attr("onclick","javascript:AF.changeUrlActionAndSubmitForm('"+urlUMBMW+"')"); } if(youngMin > 0 && babies > 0 || youngMin > 0 && children > 0){ AF.showMessage(AF.popupCounterUMTitle, AF.popupCounterUMMessage, "bmw-popup"); return; }else if(babies > 0){ // Si typo baby we display question and button UM jQuery("#askForUM").hide(); jQuery('#commentUM').show(); jQuery('#commentUMOpenJaw').hide(); if(jQuery("#idTypeTrip").val() === '4') { jQuery('#commentUMOpenJaw').show(); jQuery('#commentUM').hide(); } } else { jQuery("#askForUM").show(); jQuery('#commentUMOpenJaw').hide(); jQuery('#commentUM').show(); if(jQuery("#idTypeTrip").val() === '4') { jQuery('#commentUMOpenJaw').show(); jQuery('#commentUM').hide(); jQuery("#yesButton").attr("onclick","javascript:AF.redirectTo('" + getB2CUrlToRedirect('true') + "')"); } } if (jQuery("#bmw-nbPassenger").hasClass('closed')) { jQuery("#bmw-title-nbPassenger").click(); } AF.showPopup("popup_pax_comment"); return; } /* Cas UM non disponible */ else if (!AF.validateCompatibilityBaby()) { AF.showPopup("popup_pax_UM"); return; } /* Cas : la premiere */ else if(((!isUMSearch && adults>0 && babies>0) || !AF.validateCompatibilityBaby()) && cabinSelected=='F') { AF.showPopup("popup_pax_UM_FIRST"); return; } else { checkForm(); } saveSearchInCookieStandard(); if(jQuery("#idTypeTrip").val() === '4') { jQuery('#idMainForm').attr('action','/DK/en/local/process/standardbooking/CheckOpenJawAction.do'); jQuery("#idSubCabin").val(""); }else{ jQuery('#idMainForm').attr('action','/DK/en/local/process/standardbooking/ValidateSearchAction.do'); } submitForm(); } } function getB2CUrlToRedirect(isOpenJaw){ var urlUMB2CRedirect = urlUMB2C; if(isOpenJaw) { urlUMB2CRedirect += "multidest=true&"; } if(!isOpenJaw) { urlUMB2CRedirect += "typeTrip=" + jQuery("#idTypeTrip").val() + "&from=" + jQuery("#idDepartureTrip1Input").val() + "_" + jQuery("#idDepartureTrip1Input_type").val().substring(0,1) + "&to=" + jQuery("#idArrivalTrip1Input").val() + "_" + jQuery("#idArrivalTrip1Input_type").val().substring(0,1); } urlUMB2CRedirect += "&outboundDate=" + formatDateForB2C(jQuery("#moisAller").val() + jQuery("#jourAller").val()); if (jQuery("#idTypeTrip").val() == CONST_ROUND_TRIP || isOpenJaw) { urlUMB2CRedirect += "&inboundDate=" + formatDateForB2C(jQuery("#moisRetour").val() + jQuery("#jourRetour").val()); } urlUMB2CRedirect += "&nbPax=" + jQuery("input[name='paxTypoList']").length + "&listPaxTypo="; jQuery("input[name='paxTypoList']").each(function(){ urlUMB2CRedirect += jQuery(this).val() + "|"; }); urlUMB2CRedirect += "&isTribe="; if(jQuery("#idFamilyTrip").val()){ urlUMB2CRedirect += "1"; } urlUMB2CRedirect += "&isTribe=" + "&cabin=" + jQuery("#idCabin").val() + "&subCabin=" + jQuery("#idSubCabin").val(); return urlUMB2CRedirect+"&fromMobile=true"; } function submitForm(){ // For PrivateSales, if city, disabled input aren't send to the server $("idMainForm").submit(); } // Liste des recherches var lstPreviousSearches = new Array(); // Libelles var previousSearchesText = "Recent searches "; var clearPreviousSearchesText = "Delete history "; // Constantes var CONST_RECENT_SEARCH_ACTIVE = true; var CONST_CONFIRM_RESET_SEARCHES_ACTIVE = false; var CONST_MAX_COOKIES = 4; var CONST_PAX_TYPE_UM = "CHD"; var CONST_CLEAR_SEARCH_OPTION = "clearSearches"; var CONST_PREFIX_SEARCH_STD = "previousSearch"; var CONST_PREFIX_SEARCH_ABO = "previousSearchAbo"; var rechercheAbonne = false; var contratAbonne = ""; var hasFirstPax = false; /* * loadPreviousSearches * Charge les cookies, et appelle le serveur pour controle et formatage des champs * param contractId : contrat abonne */ function loadPreviousSearches(contractId) { if(CONST_RECENT_SEARCH_ACTIVE == false) return; // Gestion du type de contrat pour la page abonnés rechercheAbonne = false; if(typeof contractId != 'undefined' && contractId != null){ contratAbonne = "_" + contractId; rechercheAbonne = true; } // Creation d'un formulaire var dataSearches = new Object(); dataSearches.departureAirportCode = new Array(); dataSearches.arrivalAirportCode = new Array(); dataSearches.departureStopoverType = new Array(); dataSearches.arrivalStopoverType = new Array(); dataSearches.departureDay = new Array(); dataSearches.departureMonth = new Array(); dataSearches.departureYear = new Array(); var cookiesFound = false; for(var i=1; i<=CONST_MAX_COOKIES; i++){ // Lecture de la recherche en cookie var searchBean = loadSearchFromCookie(rechercheAbonne, i); if(searchBean != null){ cookiesFound = true; lstPreviousSearches[searchBean.id] = searchBean; dataSearches.departureAirportCode.push(searchBean.departureAirportCode); if(searchBean.departureStopoverType != undefined){ dataSearches.departureStopoverType.push(searchBean.departureStopoverType); }else{ //Ne devrait plus etre utilise une fois que les vieux cookies ne contenant pas de types d'escales auront disparus dataSearches.departureStopoverType.push("MISSING_TYPE"); } dataSearches.arrivalAirportCode.push(searchBean.arrivalAirportCode); if(searchBean.arrivalStopoverType != undefined){ dataSearches.arrivalStopoverType.push(searchBean.arrivalStopoverType); }else{ //Ne devrait plus etre utilise une fois que les vieux cookies ne contenant pas de types d'escales auront disparus dataSearches.arrivalStopoverType.push("MISSING_TYPE"); } dataSearches.departureDay.push(searchBean.jourAller); dataSearches.departureMonth.push(searchBean.moisAller); dataSearches.departureYear.push(searchBean.anneeAller); } } if(cookiesFound == true) { jQuery.ajax({ url : "/" + cu_Marche + "/" + cu_Langue + "/local/home/home/PreviousSearchAction.do", data : dataSearches, success : displayPreviousSearches, type : 'POST', dataType : 'xml' }); } } /* * displayPreviousSearches * Remplit la liste deroulante des recherches * param data : liste recue du serveur */ function displayPreviousSearches(data) { var nbOfCellToShow = 0; if(data != null){ var comboPreviousSearches = jQuery('#idSelectPreviousSearch' + contratAbonne); comboPreviousSearches.empty(); comboPreviousSearches.append('
'+previousSearchesText+''+'
'+ '
'); comboPreviousSearches.append(''); jQuery('PreviousSearch', data).each(function(){ if(nbOfCellToShow<3){ option = '
'; option += ''+jQuery(this).find('departure').text()+''+" ("+jQuery(this).find('departureCode').text()+") - "; option += ''+jQuery(this).find('arrival').text()+''+" ("+jQuery(this).find('arrivalCode').text()+") - "; option += jQuery(this).find('labelDate').text(); option += '
'; jQuery('#idSelectPreviousSearch div[data-role="dropdown_content"]').append(option); nbOfCellToShow++; } }); jQuery("#idSelectPreviousSearch" + contratAbonne).show(); AF.actionOnDropDown(); // action/event sur la drop down AF.onChangePreviousSearch(); // onChange } } /* * askResetPreviousSearches * Ouvre une popup de confirmation d'effacement des recherches */ function askResetPreviousSearches(){ if(CONST_CONFIRM_RESET_SEARCHES_ACTIVE == true){ var urlPopupReset = "/DK/en/local/transverse/popup/popup_previous_searches.jsp"; af_popin(urlPopupReset,'640','200'); }else{ resetPreviousSearches(); } } /* * resetPreviousSearch * Efface les recherches et la liste deroulante */ function resetPreviousSearches(){ // On cache la liste var comboPreviousSearches = jQuery('#idSelectPreviousSearch' + contratAbonne); comboPreviousSearches.hide(); // On efface les cookies for(var i=1; i<=CONST_MAX_COOKIES; i++){ // Lecture de la recherche en cookie var searchBean = loadSearchFromCookie(rechercheAbonne, i); var prefixCookie = CONST_PREFIX_SEARCH_STD; if(rechercheAbonne == true){ prefixCookie = CONST_PREFIX_SEARCH_ABO; } AF.eraseWebStorageOrCookie(prefixCookie+i); } AF.eraseWebStorageOrCookie('currentSearch'); } /* * onChangePreviousSearchStandard * Ecouteur sur changement de recherche dans la resa standard */ function onChangePreviousSearchStandard(value){ loadPreviousSearchStandard(value); } /* * loadPreviousSearchStandard * Chargement d'une recherche dans la resa standard */ function loadPreviousSearchStandard(previousSearchId){ if(previousSearchId != null && previousSearchId != ""){ if(previousSearchId == 'clearSearches'){ // Effacement des recherches askResetPreviousSearches(); }else{ // Chargement de la recherche var searchBean = lstPreviousSearches[previousSearchId]; if(searchBean != null){ // Aeroport de Depart jQuery("#idDepartureTrip1Input").val(searchBean.departureAirportCode); // hidden if(searchBean.departureStopoverType != "MISSING_TYPE"){ jQuery("#idDepartureTrip1Input_type").val(searchBean.departureStopoverType); // hidden }else{ //Ne devrait plus etre utilise une fois que les vieux cookies ne contenant pas de types d'escales auront disparus jQuery("#idDepartureTrip1Input_type").val(AF.idDepartureTrip1LibCompl._getIataType(searchBean.departureAirportCode)); // hidden } jQuery("#codeDeparture").val(searchBean.departureAirportCode); // hidden jQuery("#idDepartureTrip1").val(jQuery('#idSelectedOption span#idDeparture').html()+" ("+searchBean.departureAirportCode+")"); // Aeroport d'Arrivee jQuery("#idArrivalTrip1Input").val(searchBean.arrivalAirportCode); // hidden if(searchBean.arrivalStopoverType != "MISSING_TYPE"){ jQuery("#idArrivalTrip1Input_type").val(searchBean.arrivalStopoverType); // hidden }else{ //Ne devrait plus etre utilise une fois que les vieux cookies ne contenant pas de types d'escales auront disparus jQuery("#idArrivalTrip1Input_type").val(AF.idArrivalTrip1LibCompl._getIataType(searchBean.arrivalAirportCode)); // hidden } jQuery("#codeArrival").val(searchBean.arrivalAirportCode); // hidden jQuery("#idArrivalTrip1").val(jQuery('#idSelectedOption span#idArrival').html()+" ("+searchBean.arrivalAirportCode+")"); // Type de voyage AllerRetour / Aller simple if(searchBean.flightType == CONST_ROUND_TRIP){ jQuery("#idTypeTrip").val(CONST_ROUND_TRIP); jQuery('#arHeader').trigger('click'); } else if(searchBean.flightType == CONST_MULTI_STOP) { jQuery("#idTypeTrip").val(CONST_MULTI_STOP); // Aeroport de Depart jQuery("#idDepartureTrip2Input").val(searchBean.departureAirportCode2); // hidden if(searchBean.departureStopoverType2 != "MISSING_TYPE"){ jQuery("#idDepartureTrip2Input_type").val(searchBean.departureStopoverType2); // hidden }else{ //Ne devrait plus etre utilise une fois que les vieux cookies ne contenant pas de types d'escales auront disparus jQuery("#idDepartureTrip2Input_type").val(AF.idDepartureTrip2LibCompl._getIataType(searchBean.departureAirportCode2)); // hidden } jQuery("#codeDeparture").val(searchBean.departureAirportCode2); // hidden jQuery("#idDepartureTrip2").val(searchBean.departureTrip2); // Aeroport d'Arrivee jQuery("#idArrivalTrip2Input").val(searchBean.arrivalAirportCode2); // hidden if(searchBean.arrivalStopoverType2 != "MISSING_TYPE"){ jQuery("#idArrivalTrip2Input_type").val(searchBean.arrivalStopoverType2); // hidden }else{ //Ne devrait plus etre utilise une fois que les vieux cookies ne contenant pas de types d'escales auront disparus jQuery("#idArrivalTrip2Input_type").val(AF.idArrivalTrip2LibCompl._getIataType(searchBean.arrivalAirportCode2)); // hidden } jQuery("#codeArrival").val(searchBean.arrivalAirportCode2); // hidden jQuery("#idArrivalTrip2").val(searchBean.arrivalTrip2); } else if (searchBean.flightType == CONST_ONE_WAY){ jQuery("#idTypeTrip").val(CONST_ONE_WAY); jQuery('#asHeader').trigger('click'); } // Date de depart var yearMonthDeparture = concatYearMonth(searchBean.anneeAller,searchBean.moisAller); if(checkDiadMinMax(searchBean.jourAller, yearMonthDeparture)){ jQuery("#moisAller").val(yearMonthDeparture); jQuery("#jourAller").val(format2(searchBean.jourAller)); // Display the outward (and/or) the return flight date jQuery("#selectTrip").addClass('bmw-element-invisible'); jQuery(".bmw-tab-page").removeClass('bmw-element-invisible').removeClass('hidden'); jQuery(".bmw-tab-page").attr('style','display: block !important'); printFormatedDate($('libJourAller'), searchBean.anneeAller, parseInt(searchBean.moisAller, 10)+1, searchBean.jourAller); if(jQuery(".bmw-tabs-content").hasClass('color-txt-grey')){ jQuery(".bmw-tabs-content").removeClass('color-txt-grey'); jQuery(".bmw-tabs-content").addClass('color-txt-blue-af'); } } else { jQuery("#moisAller").val($('moisAllerOrigine').value); jQuery("#jourAller").val($('jourAllerOrigine').value); // Display the outward (and/or) the return flight date jQuery("#selectTrip").addClass('bmw-element-invisible'); jQuery(".bmw-tab-page").removeClass('bmw-element-invisible').removeClass('hidden'); jQuery(".bmw-tab-page").attr('style','display: block !important'); printFormatedDate($('libJourAller'), ($('moisAllerOrigine').value).substring(0,4), ($('moisAllerOrigine').value).substring(4,6), $('jourAllerOrigine').value); } updateInbound($('libJourRetour'), $('moisAller'), $('jourAller'), $('moisRetour'), $('jourRetour')); // Date de retour if(searchBean.flightType == CONST_ROUND_TRIP || searchBean.flightType == CONST_MULTI_STOP) { var yearMonthReturn = concatYearMonth(searchBean.anneeRetour,searchBean.moisRetour); if(checkDiadMinMax(searchBean.jourRetour, yearMonthReturn)){ jQuery("#moisRetour").val(yearMonthReturn); jQuery("#jourRetour").val(format2(searchBean.jourRetour)); // Display the outward (and/or) the return flight date jQuery("#selectTrip").addClass('bmw-element-invisible'); jQuery(".bmw-tab-page").removeClass('bmw-element-invisible').removeClass('hidden'); jQuery(".bmw-tab-page").attr('style','display: block !important'); printFormatedDate($('libJourRetour'), searchBean.anneeRetour, parseInt(searchBean.moisRetour, 10)+1, searchBean.jourRetour); } } updateOutbound($('libJourAller'), $('moisAller'), $('jourAller'), $('moisRetour'), $('jourRetour')); // Nombre de passagers et Ages des passagers var nbPassenger = 1; if(searchBean.paxTypes != null){ AF.erasePaxNumber(); nbPassenger = searchBean.paxTypes.length; for(var i=0; i1){ AF.openPassengerBloc(); } // Classe de reservation jQuery("#idCabin"+searchBean.haul+searchBean.cabin+searchBean.subCabin).attr("checked", "checked"); updateCabin(searchBean.haul,searchBean.cabin,searchBean.subCabin); // hidden for form document.onChangeStopover(); // select the good cabin if(jQuery('#idCabin'+searchBean.haul+searchBean.cabin+searchBean.subCabin+':input:checked')){ AF.changeSelectedCabin(jQuery('#idDivCabin'+searchBean.haul+searchBean.cabin+searchBean.subCabin)); } // Famille if(jQuery("#idFamilyTrip")[0] != null){ var inputFamilyTrip = jQuery('#idFamilyTrip'); if(searchBean.isFamilyTrip){ inputFamilyTrip.removeAttr("disabled"); inputFamilyTrip.attr("data-checked", "true"); inputFamilyTrip.attr('value', inputFamilyTrip.attr('data-value')); jQuery('#idFamilyTrip-img').addClass("checked").removeClass("notchecked"); }else{ inputFamilyTrip.attr("disabled", "disabled"); inputFamilyTrip.removeAttr('value'); inputFamilyTrip.attr("data-checked", "false"); jQuery('#idFamilyTrip-img').addClass("notchecked").removeClass("checked"); } } if(searchBean.flightType == CONST_MULTI_STOP) { jQuery("#selectMultiTrip").addClass('bmw-element-invisible'); jQuery('#multiHeader').trigger('click'); } clearErrors(); } } } } /* * loadSearchFromCookie * Chargement d'une recherche depuis les cookies */ function loadSearchFromCookie(rechercheAbonne, number) { var prefixCookie = CONST_PREFIX_SEARCH_STD; if(rechercheAbonne == true){ prefixCookie = CONST_PREFIX_SEARCH_ABO; } return JSON.parse(AF.readWebStorageOrCookie(prefixCookie + number)); } /* * saveSearchInCookieStandard * Sauvegarde d'une recherche dans les cookies depuis la resa standard */ function saveSearchInCookieStandard() { // Controle d'activation de la fonction if(CONST_RECENT_SEARCH_ACTIVE == false) return; var moisAnneeAller = $("moisAller").value; var annneAller = parseInt(moisAnneeAller.substr(0, 4), 10); var moisAller = parseInt(moisAnneeAller.substr(4, 2), 10) - 1; var jourAller = parseInt($("jourAller").value, 10); var moisAnneeRetour = $("moisRetour").value; var annneRetour = parseInt(moisAnneeRetour.substr(0, 4), 10); var moisRetour = parseInt(moisAnneeRetour.substr(4, 2), 10) - 1; var jourRetour = parseInt($("jourRetour").value, 10); var searchBean = new Object(); // Aeroport de Depart searchBean.departureAirportCode = jQuery("#idDepartureTrip1Input").val(); // Aeroport d'Arrivee searchBean.arrivalAirportCode = jQuery("#idArrivalTrip1Input").val(); // Type d'Escale de Depart searchBean.departureStopoverType = jQuery("#idDepartureTrip1Input_type").val(); // Type d'Escale d'Arrivee searchBean.arrivalStopoverType = jQuery("#idArrivalTrip1Input_type").val(); /*---- CAS MULTI DEST ----*/ // Aeroport de Depart searchBean.departureAirportCode2 = jQuery("#idDepartureTrip2Input").val(); searchBean.departureTrip2 = jQuery("#idDepartureTrip2").val(); // Aeroport d'Arrivee searchBean.arrivalAirportCode2 = jQuery("#idArrivalTrip2Input").val(); searchBean.arrivalTrip2 = jQuery("#idArrivalTrip2").val(); // Type d'Escale de Depart searchBean.departureStopoverType2 = jQuery("#idDepartureTrip2Input_type").val(); // Type d'Escale d'Arrivee searchBean.arrivalStopoverType2 = jQuery("#idArrivalTrip2Input_type").val(); /*---- CAS MULTI DEST ----*/ // Type de voyage AllerRetour / Aller simple if (jQuery("#idTypeTrip").val() == CONST_ROUND_TRIP) { searchBean.flightType = CONST_ROUND_TRIP; } else if(jQuery("#idTypeTrip").val() == CONST_MULTI_STOP) { searchBean.flightType = CONST_MULTI_STOP; } else{ searchBean.flightType = CONST_ONE_WAY; } // Date de depart searchBean.anneeAller = annneAller; searchBean.moisAller = moisAller; searchBean.jourAller = jourAller; // Date de retour searchBean.anneeRetour = annneRetour; searchBean.moisRetour = moisRetour; searchBean.jourRetour = jourRetour; // Construction de l'ID de la recherche searchBean.id = getSearchId(searchBean); // Nombre de passagers searchBean.paxNumber = jQuery(".bmw-select-number-cell").val(); // Ages des passagers searchBean.paxTypes = new Array(); jQuery("input[name='paxTypoList']").each(function(){ var paxTypoListName = jQuery(this).val(); searchBean.paxTypes.push(paxTypoListName); }); // Classe de reservation searchBean.haul = jQuery('#idHaul').val(); searchBean.cabin = jQuery('#idCabin').val(); searchBean.subCabin = jQuery('#idSubCabin').val(); // Flexible if(jQuery("#idCalendarSearch")[0] != null){ searchBean.isFlexible = jQuery("#idCalendarSearch")[0].checked; }else{ searchBean.isFlexible = false; } // Voyage en famille if(jQuery("#idFamilyTrip")[0] != null){ searchBean.isFamilyTrip = jQuery("#idFamilyTrip-img").hasClass("checked"); }else{ searchBean.isFamilyTrip = false; } // Resident Corse if(jQuery("#idCorsicaResident")[0] != null){ searchBean.isCorsicaResident = jQuery("#idCorsicaResident")[0].checked; }else{ searchBean.isCorsicaResident = false; } // Si on part d'une recherche precedente var oldSearchId = jQuery('#idSelectPreviousSearch').val(); if(controleChaineVide(oldSearchId) && oldSearchId != CONST_CLEAR_SEARCH_OPTION){ // On conserve les valeurs qui sont en cookie var oldSearchBean = lstPreviousSearches[oldSearchId]; if(oldSearchBean != null){ // UM - ages des enfants searchBean.umChildren = oldSearchBean.umChildren; } }else{ // UM - ages des enfants : pas de selection dans la resa standard searchBean.umChildren = null; } saveSearchInCookie(searchBean); } /* * saveSearchInCookie * Sauvegarde d'une recherche dans les cookies * param searchBean : la recherche a enregistrer */ function saveSearchInCookie(searchBean) { // Controle d'activation de la fonction if(CONST_RECENT_SEARCH_ACTIVE == false) return; // Controle de validite if(searchBean == null || searchBean.id == null){ return; } // Chargement des cookies var previousSearches = new Array(); for(var i=1; i<=CONST_MAX_COOKIES; i++){ previousSearches.push(loadSearchFromCookie(rechercheAbonne, i)); } var currentSearch = ""; var prefixCookie = CONST_PREFIX_SEARCH_STD; if(rechercheAbonne == true){ prefixCookie = CONST_PREFIX_SEARCH_ABO; } // Si un des cookies concerne la meme recherche : on le met a jour var cookieUpdated = null; for(var i=0; i0; i--){ previousSearches[i] = previousSearches[i-1]; } // On insere la nouvelle recherche previousSearches[0] = searchBean; } // Ecriture des cookies var dateExpiration = new Date(); dateExpiration.setFullYear(dateExpiration.getFullYear()+10); for(var i=0; i 0 && searchBean.moisAller != null && searchBean.moisAller >= 0 && searchBean.jourAller != null && searchBean.jourAller > 0){ searchId = searchBean.departureAirportCode; searchId += "-" + searchBean.arrivalAirportCode; searchId += "_" + searchBean.anneeAller + searchBean.moisAller + searchBean.jourAller; } return searchId; } function checkDiadMinMax(day,yearMonth) { // plage de selection du calendrier (DIAD) var minDay = parseInt($('jourAllerOrigine').value,10); var minYearMonth = $('moisAllerOrigine').value; var maxDay = parseInt($('jourAllerFin').value,10); var maxYearMonth = $('moisAllerFin').value; if ((yearMonth == minYearMonth && day < minDay) || (yearMonth < minYearMonth) || (yearMonth == maxYearMonth && day > maxDay) || (yearMonth > maxYearMonth)) { return false; } return true; } AF.migratePreviousSearchesFromCookiesToWebStorage = function() { // Pascal - 2014-07-10 // If the browser supports HTML5 web storage, let's migrate any existing previous searches // from the cookies to the web storage, and delete those cookies. for(var i=1; i<=CONST_MAX_COOKIES; i++) { AF.maybeMigrateCookieToWebStorage(CONST_PREFIX_SEARCH_STD + i); } AF.maybeMigrateCookieToWebStorage("currentSearch"); } var selectedHaul = 'SH'; var newHaul = 'SH'; var haulTable = new Array (4); var availableMinDayTable = new Array(4); var availableMaxDayTable = new Array(4); var availableMinYearMonthTable = new Array(4); var availableMaxYearMonthTable = new Array(4); var lowCabinTable = new Array (4); var lowSubCabinTable = new Array (4); var cabinTable = new Array (4); var subCabinTable = new Array (4); var label1CabinTable = new Array (4); var label2CabinTable = new Array (4); haulTable[0] = 'MH'; lowCabinTable[0] = 'Y'; lowSubCabinTable[0] = 'MCHER'; cabinTable[0] = new Array(2); subCabinTable[0] = new Array(2); label1CabinTable[0] = new Array(2); label2CabinTable[0] = new Array(2); availableMinDayTable[0]='15'; availableMinYearMonthTable[0]='201712'; availableMaxDayTable[0]='15'; availableMaxYearMonthTable[0]='201812'; cabinTable[0][0]='C'; subCabinTable[0][0]='MCHER'; label1CabinTable[0][0]="Business"; label2CabinTable[0][0]="Business"; cabinTable[0][1]='Y'; subCabinTable[0][1]='MCHER'; label1CabinTable[0][1]="Economy (lowest fare)"; label2CabinTable[0][1]="Economy (lowest fare)"; haulTable[1] = 'SH'; lowCabinTable[1] = 'Y'; lowSubCabinTable[1] = 'MCHER'; cabinTable[1] = new Array(2); subCabinTable[1] = new Array(2); label1CabinTable[1] = new Array(2); label2CabinTable[1] = new Array(2); availableMinDayTable[1]='15'; availableMinYearMonthTable[1]='201712'; availableMaxDayTable[1]='15'; availableMaxYearMonthTable[1]='201812'; cabinTable[1][0]='Y'; subCabinTable[1][0]='FLEX'; label1CabinTable[1][0]="Economy ( changes allowed free of charge )"; label2CabinTable[1][0]="Economy ( changes allowed free of charge )"; cabinTable[1][1]='Y'; subCabinTable[1][1]='MCHER'; label1CabinTable[1][1]="Economy (lowest fare)"; label2CabinTable[1][1]="Economy (lowest fare)"; haulTable[2] = 'LH'; lowCabinTable[2] = 'Y'; lowSubCabinTable[2] = 'MCHER'; cabinTable[2] = new Array(5); subCabinTable[2] = new Array(5); label1CabinTable[2] = new Array(5); label2CabinTable[2] = new Array(5); availableMinDayTable[2]='16'; availableMinYearMonthTable[2]='201712'; availableMaxDayTable[2]='15'; availableMaxYearMonthTable[2]='201812'; cabinTable[2][0]='F'; subCabinTable[2][0]='MCHER'; label1CabinTable[2][0]="La Première"; label2CabinTable[2][0]="La Première"; cabinTable[2][1]='C'; subCabinTable[2][1]='MCHER'; label1CabinTable[2][1]="Business"; label2CabinTable[2][1]="Business "; cabinTable[2][2]='W'; subCabinTable[2][2]='MCHER'; label1CabinTable[2][2]="Premium Economy"; label2CabinTable[2][2]="Premium Economy"; cabinTable[2][3]='Y'; subCabinTable[2][3]='FLEX'; label1CabinTable[2][3]="Economy ( changes allowed free of charge )"; label2CabinTable[2][3]="Economy ( changes allowed free of charge )"; cabinTable[2][4]='Y'; subCabinTable[2][4]='MCHER'; label1CabinTable[2][4]="Economy (lowest fare)"; label2CabinTable[2][4]="Economy (lowest fare)"; haulTable[3] = 'CIO'; lowCabinTable[3] = 'Y'; lowSubCabinTable[3] = 'MCHER'; cabinTable[3] = new Array(4); subCabinTable[3] = new Array(4); label1CabinTable[3] = new Array(4); label2CabinTable[3] = new Array(4); availableMinDayTable[3]='16'; availableMinYearMonthTable[3]='201712'; availableMaxDayTable[3]='15'; availableMaxYearMonthTable[3]='201812'; cabinTable[3][0]='C'; subCabinTable[3][0]='MCHER'; label1CabinTable[3][0]="Business"; label2CabinTable[3][0]="Business "; cabinTable[3][1]='W'; subCabinTable[3][1]='MCHER'; label1CabinTable[3][1]="Premium Economy"; label2CabinTable[3][1]="Premium Economy"; cabinTable[3][2]='Y'; subCabinTable[3][2]='FLEX'; label1CabinTable[3][2]="Economy ( changes allowed free of charge )"; label2CabinTable[3][2]="Economy (unrestricted)"; cabinTable[3][3]='Y'; subCabinTable[3][3]='MCHER'; label1CabinTable[3][3]="Economy (lowest fare)"; label2CabinTable[3][3]="Economy (lowest fare)"; /* Return the index of the given haul in the global table haulTable*/ function getIndexHaul(haul){ var indexHaul = -1; for (var i = 0; i < haulTable.length; i++){ if (haulTable[i] == haul){ indexHaul = i; break; } } return indexHaul; } function getCabinTable(haul){ return cabinTable[getIndexHaul(haul)]; } function getSubCabinTable(haul){ return subCabinTable[getIndexHaul(haul)]; } function getLabel1CabinTable(haul){ return label1CabinTable[getIndexHaul(haul)]; } function getLabel2CabinTable(haul){ return label2CabinTable[getIndexHaul(haul)]; } function changeHaul(url, originList, destinationList, originTypeList, destinationTypeList, departureAlert, arrivalAlert){ url += originList.length + '&' var validRequest = true; for(var i=0; i 0) { url = url + '&'; } url = url + 'origin' + (i + 1)+ '=' + originList[i]; url = url + '&'; url = url + 'originType' + (i + 1)+ '=' + originTypeList[i]; url = url + '&'; url = url + 'destination' + (i + 1)+ '=' + destinationList[i]; url = url + '&'; url = url + 'destinationType' + (i + 1)+ '=' + destinationTypeList[i]; } if (validRequest == true) { if (arguments.length == 5) { url = url + '&'; url = url + 'orgineAlert' + '=' + departureAlert; url = url + '&'; url = url + 'destinationAlert' + '=' + arrivalAlert; } url = url + '&'; url = url + 'countries' + '=countries'; doRequestXml(url, "GET", getNewHaul); } } function doRequestXml(url, method, fct_callback) { jQuery.ajax({ type: method, url: url, dataType: 'xml', async: false, success: function(responseXml){ if(responseXml != null && fct_callback != null){ fct_callback(responseXml); } }, error: function(xhr, status, e){ return; } }); } function getNewHaul(xmlResponse){ if (xmlResponse != null && xmlResponse.getElementsByTagName("data").length > 0) { for(i = 0; i -1){ newHaul = result; if (newHaul != selectedHaul){ changeCabin(); checkCabin(); if(jQuery('#idCabin'+newHaul+$('idCabin').value+$('idSubCabin').value+':input:checked')){ // change the css and class for cabin selected AF.changeSelectedCabin(jQuery('#idDivCabin'+newHaul+$('idCabin').value+$('idSubCabin').value)); } changeDateCalendar(); selectedHaul = newHaul; } } } if (xmlResponse.getElementsByTagName("data")[i].getAttribute("id") == 'countries') { var countries = xmlResponse.getElementsByTagName("data")[i].getAttribute("value"); var indexCountries = countries.indexOf(","); var origin = countries.substring(0,indexCountries); var destination = countries.substring(indexCountries+1); if (origin == destination) { $('idCountries').value = 'FR'; } else { $('idCountries').value = ''; } } } } } function updateCabin(haul,cabin, subCabin){ $('idCabin').value = cabin; $('idSubCabin').value = subCabin; $('idHaul').value = haul; } function findCabin(cabin, subCabin, checkHaul){ var result = false; var indexH = getIndexHaul(checkHaul); for (var i = 0; i < cabinTable[indexH].length; i++){ if (cabinTable[indexH][i] == cabin && subCabinTable[indexH][i] == subCabin){ result = true; break; } } return result; } function changeDateCalendar(){ for (var i = 0; i < haulTable.length; i++){ var haulKey = haulTable[i]; if (newHaul == haulKey){ $('jourAllerOrigine').value = availableMinDayTable[i]; $('moisAllerOrigine').value = availableMinYearMonthTable[i]; $('jourAllerFin').value = availableMaxDayTable[i]; $('moisAllerFin').value = availableMaxYearMonthTable[i]; } } } function changeCabin(){ for (var i = 0; i < haulTable.length; i++){ var haulKey = haulTable[i]; if (newHaul == haulKey){ jQuery('#idSelectCabin' + haulKey).show(); } else { jQuery('#idSelectCabin' + haulKey).hide(); } } $('idHaul').value = newHaul; } function checkCabin(){ var cabin = $('idCabin').value; var subCabin = $('idSubCabin').value; if ($('idCabin'+selectedHaul+cabin+subCabin)) { $('idCabin'+selectedHaul+cabin+subCabin).checked = false; } if (!findCabin(cabin, subCabin,newHaul)) { var newCabin = lowCabinTable[getIndexHaul(newHaul)]; var newSubCabin = lowSubCabinTable[getIndexHaul(newHaul)]; $('idCabin'+newHaul+newCabin+newSubCabin).checked = true; updateCabin(newHaul,newCabin, newSubCabin); } else { $('idCabin'+newHaul+cabin+subCabin).checked = true; } } var previousCabinId = null; var cabinSelected = null; AF.changeSelectedCabin = function(elementSelected) { var idSelected = jQuery(elementSelected).attr("id"); cabinSelected = jQuery(elementSelected).attr("data-cabin"); if(cabinSelected){ if (previousCabinId == null){ previousCabinId = jQuery(elementSelected).attr("id"); } jQuery("#"+idSelected+" input").prop('checked', true); // hidden // To change title of collapsible header jQuery('.cabins [data-role="collapsible2_header"]').html(jQuery(elementSelected).html()+''); // Hide the current selected cabin in the dropdown list jQuery("#"+previousCabinId).removeClass('hidden'); jQuery("#"+idSelected).addClass('hidden'); previousCabinId = idSelected; } } function triggerClickCollapsible(){ jQuery('.cabins.open [data-role="collapsible2_header"]').trigger('click'); } jQuery(document).ready(function() { AF.migratePreviousSearchesFromCookiesToWebStorage(); //Requette ajax allant chercher les recherches précédentes loadPreviousSearches(); // In case a child is prefill we add an adult AF.updatePaxDisplay(); // We verify if the Typo parent element are correctly filled AF.verifyIfTypoElementFill(typoElementPax); // We verify if we need to display family trip AF.verifyIfDisplayFamilyTrip(); // It is important to call init before creating the completion objects $('idDepartureTrip1Input').value = "CPH"; $('idArrivalTrip1Input').value = ""; $('idDepartureTrip2Input').value = ""; $('idArrivalTrip2Input').value = ""; AF.addRequestStopoverCompletion("origine", "", "MSTD", "AF.idDepartureTrip1LibCompl", "idDepartureTrip1", "idDepartureTrip1Input", "codesIataStopOver", "libellesCitiesStopOver", "libellesCountriesStopOver", "libellesAeroportStopOver", "stopOverType", "null"); if (typeof (document.getElementById('idDepartureTrip1').oninput) == 'string' ) { jQuery('#idDepartureTrip1').bind('keyup', function(event) { AF.idDepartureTrip1LibCompl.findCompletionFromKeyUp(event); }); } AF.addRequestStopoverCompletion("destination", "", "MSTD", "AF.idArrivalTrip1LibCompl", "idArrivalTrip1", "idArrivalTrip1Input", "codesIataStopOver", "libellesCitiesStopOver", "libellesCountriesStopOver", "libellesAeroportStopOver", "stopOverType", "null"); if (typeof (document.getElementById('idArrivalTrip1').oninput) == 'string' ) { jQuery('#idArrivalTrip1').bind('keyup', function(event) { AF.idArrivalTrip1LibCompl.findCompletionFromKeyUp(event); }); } AF.addRequestStopoverCompletion("origine", "", "MSTD", "AF.idDepartureTrip2LibCompl", "idDepartureTrip2", "idDepartureTrip2Input", "codesIataStopOver", "libellesCitiesStopOver", "libellesCountriesStopOver", "libellesAeroportStopOver", "stopOverType", "null"); if (typeof (document.getElementById('idDepartureTrip2').oninput) == 'string' ) { jQuery('#idDepartureTrip2').bind('keyup', function(event) { AF.idDepartureTrip2LibCompl.findCompletionFromKeyUp(event); }); } AF.addRequestStopoverCompletion("destination", "", "MSTD", "AF.idArrivalTrip2LibCompl", "idArrivalTrip2", "idArrivalTrip2Input", "codesIataStopOver", "libellesCitiesStopOver", "libellesCountriesStopOver", "libellesAeroportStopOver", "stopOverType", "null"); if (typeof (document.getElementById('idArrivalTrip2').oninput) == 'string' ) { jQuery('#idArrivalTrip2').bind('keyup', function(event) { AF.idArrivalTrip2LibCompl.findCompletionFromKeyUp(event); }); } updateDepartureAndArrivalTypes = function(type){ if(type == "origine"){ $('idDepartureTrip1Input_type').value = AF.idDepartureTrip1LibCompl._getIataType("CPH"); }else if(type == "destination"){ $('idArrivalTrip1Input_type').value = AF.idArrivalTrip1LibCompl._getIataType(""); } } AF.getRequestsStopoverCompletion(updateDepartureAndArrivalTypes); /* si aller simple on change d'onglet grace au trigger */ // show selected cabin var haul = jQuery('#idHaul').val(); var cabin = jQuery('#idCabin').val(); var subCabin = jQuery('#idSubCabin').val(); if(jQuery('#idCabin'+haul+cabin+subCabin+':input:checked')){ AF.changeSelectedCabin(jQuery('#idDivCabin'+haul+cabin+subCabin)); } // si le nbr de passager est supérieur à 1 on ouvre le bloc passager if(nbPaxTotal>1){ AF.openPassengerBloc(); AF.changeLabelPax(nbPaxTotal); } // Update the pax number showed AF.updatePaxNumberShow(); if(AF.isMultiDestAndNoOpenJaw){ AF.showPopup("popup_multiDest"); } }); /* push ABO / ABT */ AF.changeUrlActionAndSubmitForm = function(urlPush){ checkForm(); jQuery('#idMainForm').attr('action', urlPush); $("idMainForm").submit(); } // fonction appeler après la requet ajax de récup des cookies AF.onChangePreviousSearch = function(){ jQuery(".bmw-dropdown-content .bmw-dropdown-cell").click(function() { var value = jQuery(this).find("span.value").text(); onChangePreviousSearchStandard(value); }); } // fonction pour avoir le label passenger dynamique AF.changeLabelPax = function(nbPaxTotal, paxName){ if(nbPaxTotal<=1){ if(paxName){ jQuery("#labelPassenger").html(paxName); } else { jQuery("#labelPassenger").html("Passenger"); } } else { jQuery("#labelPassenger").html("Passengers"); } } var oldDeparture=""; var oldArrival=""; document.onChangeStopover = function (){ if ($('idArrivalTrip1Input') != null){ var newDeparture = $('idDepartureTrip1Input').value; var newArrival = $('idArrivalTrip1Input').value; var newDepartureType = $('idDepartureTrip1Input_type').value; var newArrivalType = $('idArrivalTrip1Input_type').value; if ((newDeparture != '' && newArrival != '') && (newDeparture != oldDeparture || newArrival != oldArrival)){ var originList = new Array(1); var destinationList = new Array(1); var originTypeList = new Array(1); var destinationTypeList = new Array(1); originList[0] = newDeparture; destinationList[0] = newArrival; originTypeList[0] = newDepartureType; destinationTypeList[0] = newArrivalType; if (typeof(changeHaul) == 'function') { changeHaul('/DK/en/local/core/engine/stopover/GetHaulAction.do?itinerary=', originList, destinationList, originTypeList, destinationTypeList); oldDeparture = newDeparture; oldArrival = newArrival; } } } } AF.bmwCalendar.showOutwardFlightInstructions = function(){ var message = 'Select your departure date' if(AF.bmwCalendar.isMultiDestination) { if(AF.bmwCalendar.arrivalDateNotSelected) { message = 'Sélectionnez la date du vol 2'; } else{ message = 'Sélectionnez la date du vol 1'; } } jQuery('#bmw-title-calendar .bmw-header-title-txt').html(message); }; AF.bmwCalendar.showReturnFlightInstructions = function(){ var message = 'Select your return date' if(AF.bmwCalendar.isMultiDestination) { message = 'Sélectionnez la date du vol 2'; } jQuery('#bmw-title-calendar .bmw-header-title-txt').html(message); }; AF.bmwCalendar.returnFlightInformativeMessage = 'Select your return date'; AF.bmwCalendar.close = function(){ if (typeof AF.bmwCalendar.outwardFlightDate !== 'undefined') { var day = AF.bmwCalendar.outwardFlightDate.getDate().toString(); var month = (AF.bmwCalendar.outwardFlightDate.getMonth()+1).toString(); var year = AF.bmwCalendar.outwardFlightDate.getFullYear().toString(); day = (day < 10)? '0' + day : day; month = (month < 10)? '0' + month : month; jQuery('#jourAller').val(day); jQuery('#moisAller').val(year + month); jQuery('#aller .day').html(day); jQuery('#aller .month').html(AF.bmwCalendar.outwardFlightDate.getMonthNameNotUpperCase()); jQuery('#aller .year').html(year); jQuery(".bmw-tab-page").attr('style','display: block !important'); if (AF.bmwCalendar.tripType == AF.bmwCalendar.trip.ONEWAY && (!AF.bmwCalendar.isMultiDestination || (AF.bmwCalendar.isMultiDestination && AF.bmwCalendar.arrivalDateNotSelected))) { jQuery('#jourRetour').val(day); jQuery('#moisRetour').val(year + month); jQuery('#retour .day').html(day); jQuery('#retour .month').html(AF.bmwCalendar.outwardFlightDate.getMonthNameNotUpperCase()); jQuery('#retour .year').html(year); jQuery('#multi .day').html(day); jQuery('#multi .month').html(AF.bmwCalendar.outwardFlightDate.getMonthNameNotUpperCase()); jQuery('#multi .year').html(year); if(AF.bmwCalendar.arrivalDateNotSelected) { AF.bmwCalendar.returnFlightDate = AF.bmwCalendar.outwardFlightDate; jQuery("#selectMultiTrip").addClass('bmw-element-invisible'); jQuery("#multi").removeClass('bmw-element-invisible'); jQuery('#multi').append(jQuery('#libJourRetour')); jQuery('#multi').append(jQuery('#dateArrivalContent')); } } else if(AF.bmwCalendar.tripType == AF.bmwCalendar.trip.ONEWAY && AF.bmwCalendar.isMultiDestination){ var dayReturnFlight = jQuery('#jourRetour').val(); var monthYearReturnFlight = jQuery('#moisRetour').val(); if (!jQuery('#multi').hasClass('bmw-element-invisible')) { if(dayReturnFlight != "" && monthYearReturnFlight!="") { var yearReturnFlight = monthYearReturnFlight.substring(0, 4); var monthReturnFlight = monthYearReturnFlight.substring(4)-1; var dateReturn = new Date(yearReturnFlight, monthReturnFlight, dayReturnFlight); if(dateReturn < AF.bmwCalendar.outwardFlightDate) { jQuery('#jourRetour').val(day); jQuery('#moisRetour').val(year + month); // Update the displayed date jQuery('#retour .day').html(day); jQuery('#retour .month').html(AF.bmwCalendar.outwardFlightDate.getMonthNameNotUpperCase()); jQuery('#retour .year').html(year); jQuery('#multi .day').html(day); jQuery('#multi .month').html(AF.bmwCalendar.outwardFlightDate.getMonthNameNotUpperCase()); jQuery('#multi .year').html(year); } } } } } // Fill the return flight fields if (AF.bmwCalendar.tripType == AF.bmwCalendar.trip.ROUNDTRIP) { var day = AF.bmwCalendar.returnFlightDate.getDate().toString(); var month = (AF.bmwCalendar.returnFlightDate.getMonth()+1).toString(); var year = AF.bmwCalendar.returnFlightDate.getFullYear().toString(); day = (day < 10)? '0' + day : day; month = (month < 10)? '0' + month : month; // Updated the hidden inputs (Used for EBT-2) jQuery('#jourRetour').val(day); jQuery('#moisRetour').val(year + month); // Update the displayed date jQuery('#retour .day').html(day); jQuery('#retour .month').html(AF.bmwCalendar.returnFlightDate.getMonthNameNotUpperCase()); jQuery('#retour .year').html(year); if(AF.bmwCalendar.isMultiDestination) { jQuery('#multi .day').html(day); jQuery('#multi .month').html(AF.bmwCalendar.returnFlightDate.getMonthNameNotUpperCase()); jQuery('#multi .year').html(year); } jQuery("#selectMultiTrip").addClass('bmw-element-invisible'); jQuery("#multi").removeClass('bmw-element-invisible'); if(AF.bmwCalendar.isMultiDestination) { jQuery('#multi').append(jQuery('#libJourRetour')); jQuery('#multi').append(jQuery('#dateArrivalContent')); jQuery("#multi").removeClass('bmw-element-invisible'); } } //multi destination // on reinitialise les donnees AF.bmwCalendar.isMultiDestination = false; AF.bmwCalendar.arrivalDateNotSelected = false; // Display the outward (and/or) the return flight date jQuery("#selectTrip").addClass('bmw-element-invisible'); jQuery(".bmw-tab-page").removeClass('bmw-element-invisible'); // Go back to EBT-1 AF.changePage('standardSearchPage', "ebtPageTitle"); }