﻿Date.dayNames=["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"];Date.abbrDayNames=["Di","Lu","Ma","Me","Je","Ve","Sa"];Date.monthNames=["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"];Date.abbrMonthNames=["Jan","Fév","Mrs","Avr","Mai","Jin","Jil","Aoû","Sep","Oct","Nov","Déc"];$.dpText={TEXT_PREV_YEAR:"L’année passée",TEXT_PREV_MONTH:"Le mois passé",TEXT_NEXT_YEAR:"L’année prochaine",TEXT_NEXT_MONTH:"Le mois prochain",TEXT_CLOSE:"Fermer"};qbtb.prototype.settings={dateFormat:"dd-mm-yyyy",localDateFormat:"JJ-MM-AAAA",lang:{ajaxError:"Erreurs du serveur. Essaye à nouveau stp.",ajaxTimeout:"Erreurs du serveur. Essaye à nouveau stp."},urls:{flight_arrivalAirports:"/searchbook/airportlist.view?mid=CHIN&lang=fr",hotel_worldCityList:"/searchbook/citylist.view?lang=fr",flight_worldAirportCountries:"/searchbook/dispatcher?mid=CHIN&lang=fr&prodsel=fs_flights_int",flight_worldAirportList:"/searchbook/airportlist.view?mid=CHIN&lang=fr"},autoComplete:{minQueryLength:3,maxResultsDisplayed:100,useShadow:true,useIFrame:true,forceSelection:true,typeAhead:false,allowBrowserAutocomplete:false,queryMatchContains:true},dataSource:{maxCacheEntries:50}};var qbtbFR=new qbtb(".qbtb","#qbtb_flights");Date.prototype.isLeapYear=function(a){var b=a?this.getUTCFullYear():this.getFullYear();return !(b%4)&&(b%100)||!(b%400)?true:false};qbtbFR.checkValidDate=function(a){if(a.match(/^\d{4}$/)!=null){return true}else{return false}};qbtbFR.checkLeapYear=function(a){var b=new Date();b.setFullYear(a);if(b.isLeapYear()==true){return true}else{return false}};qbtbFR.selectBoxDOB=function(e,c,f,d){var c=c+"_"+e;var f=f+"_"+e;var d=d+"_"+e;var b=28;var a=new Array();a[1]=31;a[2]=29;a[3]=31;a[4]=30;a[5]=31;a[6]=30;a[7]=31;a[8]=31;a[9]=30;a[10]=31;a[11]=30;a[12]=31;$(d).click(function(){if($(d).val()=="AAAA"){$(d).val("")}});$(d).blur(function(){if($(d).val()==""){$(d).val("AAAA")}});$(d).keyup(function(){var j=$(f).val();if(j==2){var m=$(d).val();var k=a[2];var l=$(c).val();if(qbtbFR.checkValidDate(m)==true&&qbtbFR.checkLeapYear(m)==false){k=b}$(c).empty();$(c).append('<option value="">JJ</option>');for(var h=1;h<=k;h++){var g=null;if(h==l){g='selected="selected"'}if(h<10){h="0"+h}$(c).append('<option value="'+h+'" '+g+">"+h+"</option>")}}});$(f).change(function(){if($(f).val()!=""){var m=$(c).val();var l=$(d).val();var j=$(f).val();var k=a[j];if(j==2){if(qbtbFR.checkValidDate(l)==true&&qbtbFR.checkLeapYear(l)==false){k=b}}$(c).empty();$(c).append('<option value="">JJ</option>');for(var h=1;h<=k;h++){var g=null;if(h==m){g='selected="selected"'}if(h<10){h="0"+h}$(c).append('<option value="'+h+'" '+g+">"+h+"</option>")}}})};qbtbFR.activateDOB=function(b,c,a){$(b).change(function(){if($(b).val()==1){$(a).hide()}else{$(a).show()}})};qbtbFR.hotelRoomOptions=function(a,b){$(a).change(function(){var d=this.parentNode.parentNode;var c=$(d).children().children(".room_type");c.empty();switch(this.value){case"2":c.append('<option value="@DB">Double</option>');c.append('<option value="@TB">Chambre à deux lits</option>');c.append('<option value="@QR">Dortoir</option>');break;case"3":c.append('<option value="@TR">Chambre à trois lits</option>');c.append('<option value="@QR">Dortoir</option>');break;case"4":c.append('<option value="@QR">Dortoir</option>');break;default:c.append('<option value="@SB">Simple</option>');c.append('<option value="@DB">Double</option>');c.append('<option value="@QR">Dortoir</option>')}})};qbtbFR.validateHotels=function(){var c=new Array();if($("#hotel_country").val()=="0"){c.push("- Entre le pays stp")}if($("#hotel_city").val()=="0"||$("#hotel_city").val()==null){c.push("- Choisis la ville stp")}if($("#hotel_checkin").val().toLowerCase()==qbtbFR.settings.localDateFormat){c.push("- Entre la date d’aller stp")}if(c.length>0){var b=c.join("\n");var a="Corrige stp:";a=a+"\n\n"+b;return a}else{return true}};qbtbFR.convertHotels=function(e){var b=Date.fromString($(e+" #hotel_checkin").val());var a=$(e+" #hotel_num_rooms").val();var d=Date.fromString($(e+" #hotel_checkin").val());var c=Date.fromString($(e+" #hotel_checkout").html());Date.format="dd.mm.yyyy";var f={Customer:"statravel-sf-hotel-only",Onlyavail:1,Destination:$(e+" #hotel_city").val(),Page:"FastSessionInit",StartDate:d.asString(),ReturnDate:c.asString()};switch(a){case"4":f.Room4Adults=$(e+" #hotel_num_occupants_4").val();f.Room4=$(e+" #hotel_room_type_4").val();case"3":f.Room3Adults=$(e+" #hotel_num_occupants_3").val();f.Room3=$(e+" #hotel_room_type_3").val();case"2":f.Room2Adults=$(e+" #hotel_num_occupants_2").val();f.Room2=$(e+" #hotel_room_type_2").val();case"1":f.Room1Adults=$(e+" #hotel_num_occupants_1").val();f.Room1=$(e+" #hotel_room_type_1").val()}qbtbFR.createSubmitFields(e,f);$(e).submit()};qbtbFR.validateFlights=function(){var f=new Array();if($("#flight_depart_location").val()=="0"){f.push("- Entre la date d’arrivée stp")}if($("#flight_num_travellers_1").val()==0&&$("#flight_num_travellers_2").val()==0&&$("#flight_num_travellers_3").val()==0){f.push("- Attention! Choisit un adulte ou un adolescent ou un étudiant en 'nombre de voyageurs'!")}if(jQuery.trim($("#flight_arrive_location").val())==""){f.push("- Entre la destination stp")}if($("#flight_depart_date").val().toLowerCase()==qbtbFR.settings.localDateFormat){f.push("- Entre la date d’aller stp")}if($("#flight_return_date").val().toLowerCase()==qbtbFR.settings.localDateFormat&&$("#flight_one_way:checked").length==0){f.push("- Entre la date de retour stp")}if($("#tarif").val()==2||$("#tarif").val()==3){var b=$("#flight_num_travellers").val();var a=false;for(var c=1;c<=b;c++){if(qbtbFR.checkValidDate($("#dob_y_"+c).val())==false||$("#dob_d_"+c).val()==""||$("#dob_m_"+c).val()==""){a=true}}if(a){f.push("- Entre une date valide de naissance stp.")}}if(f.length>0){var e=f.join("\n");var d="Corrige stp:";d=d+"\n\n"+e;return d}else{return true}};qbtbFR.convertFlights=function(d){var c=Date.fromString($(d+" #flight_depart_date").val());var e={vendor:"ssr",agentc:"ssr",language:"f",mask:"fastbook",mode:3,fromt:$("#flight_depart_location").val(),destt:$("#flight_arrive_code").val(),hdate1:(c.getDate()<10?"0":"")+c.getDate(),hdate2:c.getFullYear()+""+((c.getMonth()+1)<10?"0":"")+(c.getMonth()+1)};if($(d+" #flight_return_date").is(":disabled")==false){var a=Date.fromString($(d+" #flight_return_date").val());e.rdate1=(a.getDate()<10?"0":"")+a.getDate();e.rdate2=a.getFullYear()+""+((a.getMonth()+1)<10?"0":"")+(a.getMonth()+1);e.flugart="R"}else{e.flugart="O"}if($("#tarif").val()==1){e.adult=$("#flight_num_travellers").val();e.student=0;e.youth=0}else{if($("#tarif").val()==2){e.student=$("#flight_num_travellers").val();e.youth=0;e.adult=0}else{e.youth=$("#flight_num_travellers").val();e.student=0;e.adult=0}}if($("#tarif").val()>1){for(var b=1;b<=$("#flight_num_travellers").val();b++){e["dob"+b]=$("#dob_y_"+b).val()+($("#dob_m_"+b).val()<10?"0":"")+$("#dob_m_"+b).val()+$("#dob_d_"+b).val()}}qbtbFR.createSubmitFields(d,e);$(d).submit()};qbtbFR.validateFlights2=function(b){var d=new Array();if($("#flight2_depart_date").val().toLowerCase()==qbtbFR.settings.localDateFormat){d.push("- Entre la date d’aller stp")}if($("#flight2_return_date").val().toLowerCase()==qbtbFR.settings.localDateFormat){d.push("- Entre la date de retour stp")}if(d.length>0){var c=d.join("\n");var a="Corrige stp:";a=a+"\n\n"+c;return a}else{return true}};qbtbFR.convertFlights2=function(c){var b=Date.fromString($(c+" #flight2_depart_date").val());var a=Date.fromString($(c+" #flight2_return_date").val());Date.format="dd.mm.yyyy";var d={StartRec:0,Customer:"statravel-sf",Departure:$("#flight2_depart_location").val(),Destination:$("#flight2_arrive_location").val(),NumRec:5,Page:"FastSessionInit",StartDate:b.asString(),ReturnDate:a.asString(),Room1Adults:$("#flights2_hotel").val()};if($("#flights2_hotel").val()==1){d.Room1="@SB"}else{if($("#flights2_hotel").val()==2){d.Room1="@DB"}}qbtbFR.createSubmitFields(c,d);$(c).submit()};flight_arrivalAirports=qbtbFR.dataSource.create(qbtbFR.settings.urls.flight_arrivalAirports);qbtbFR.autoComplete.create("flight_arrive_location","flight_arrive_code","flight_arrive_suggest",flight_arrivalAirports);qbtbFR.selectWithOptions("#flight_num_travellers",".qbtb #qbtb_flights fieldset.date_of_birth tr.dob_field");qbtbFR.activateDOB("#tarif","#flight_num_travellers","#date_of_birth");qbtbFR.selectBoxDOB("1","#dob_d","#dob_m","#dob_y");qbtbFR.selectBoxDOB("2","#dob_d","#dob_m","#dob_y");qbtbFR.selectBoxDOB("3","#dob_d","#dob_m","#dob_y");qbtbFR.selectBoxDOB("4","#dob_d","#dob_m","#dob_y");qbtbFR.floatingWindow("#flight_world_airports","#flight_arrive_button",qbtbFR.airportList.world,"#flight_arrive_location","#flight_arrive_code");qbtbFR.datePicker.setStartFromToday("#flight_depart_date",2);qbtbFR.datePicker.setEndFromToday("#flight_depart_date",329);qbtbFR.datePicker.setEndFromToday("#flight_return_date",330);qbtbFR.datePicker.link("flight_depart_date","flight_return_date",0);qbtbFR.toggle("#flight_one_way","#flight_return_date");qbtbFR.validate("#qbtb_flights form","img.search",qbtbFR.validateFlights,qbtbFR.convertFlights);qbtbFR.datePicker.calcFutureDate("#hotel_checkin","#hotel_num_nights","#hotel_checkout");qbtbFR.datePicker.setStartFromToday("#hotel_checkin",3);qbtbFR.datePicker.setEndFromToday("#hotel_checkin",450);qbtbFR.selectWithOptions("#hotel_num_rooms",".qbtb #qbtb_hotels fieldset.rooms tr.room");qbtbFR.hotelRoomOptions(".qbtb #qbtb_hotels fieldset.rooms select.occupants");qbtbFR.linkSelects("hotel_country","hotel_city",qbtbFR.settings.urls.hotel_worldCityList,"code");qbtbFR.validate("#qbtb_hotels form","img.search",qbtbFR.validateHotels,qbtbFR.convertHotels);qbtbFR.datePicker.link("flight2_depart_date","flight2_return_date",0);qbtbFR.datePicker.setEndFromToday("#flight2_depart_date",365);qbtbFR.validate("#qbtb_flights2 form","img.search",qbtbFR.validateFlights2,qbtbFR.convertFlights2);
