var enableDomesticValidation = false; // Common functions /////////////////////////////////////////////////////////////////////////////////////// /* ------------------------------------------------------------------------------------------------------*/ function setCSSBackground(item,className,path){ item.find(className).css('background-image', 'url("'+path+'")'); } /* ------------------------------------------------------------------------------------------------------*/ function initFlightsDropsPopups(item, groupPrefix){ item.find(".checkbox").checkbox({ on: false }); item.find(".drop_0-9.adults").dropdown( { width : "auto", textAlign : 'center', listHeight : 108, fontSize : "14px", groupname: groupPrefix+"form1adults", hasPreloadedItems: true }); item.find(".drop_0-9.kids").dropdown( { width : "auto", textAlign : 'center', listHeight : 108, fontSize : "14px", groupname: groupPrefix+"form1kids", hasPreloadedItems: true }); /* commented by arvanitis item.find(".drop_0-9.babys1").dropdown( { width : "auto", textAlign : 'center', listHeight : 108, fontSize : "14px", groupname: groupPrefix+"form1babys1", hasPreloadedItems: true }); */ item.find(".drop_0-9.babys2").dropdown( { width : "auto", textAlign : 'center', listHeight : 108, fontSize : "14px", groupname: groupPrefix+"form1babys2", hasPreloadedItems: true }); item.find(".drop_0-9.young").dropdown( { width : "auto", textAlign : 'center', listHeight : 108, fontSize : "14px", hasPreloadedItems: true }); item.find(".drop_0-9.old").dropdown( { width : "auto", textAlign : 'center', listHeight : 108, fontSize : "14px", hasPreloadedItems: true }); item.find(".drop_seat").dropdown( { width : "auto", itemList : SearchBoxUI.SeatsTexts, valueList : SearchBoxUI.SeatsValues, fontSize : "14px" }); var contentSpanStart=''; var contentSpanEnd=''; item.find(".popup.kids").commonPopup({ content: contentSpanStart +'accompanied 2-11 years old'+contentSpanEnd, width: 200 }); /* commented by arvanitis item.find(".popup.babys1").commonPopup({ content: contentSpanStart +'with a seat up to 2 years old'+contentSpanEnd, width: 200 }); */ item.find(".popup.babys2").commonPopup({ content: contentSpanStart+'without a seat up to 2 years old'+contentSpanEnd, width: 200 }); item.find(".popup.young").commonPopup({ content: contentSpanStart+'up to 25 years old'+contentSpanEnd, width: 200 }); item.find(".popup.old").commonPopup({ content: contentSpanStart+'over 65 years old'+contentSpanEnd, width: 200 }); } /* ------------------------------------------------------------------------------------------------------*/ function changeGraterThanZeroDropDownToRed(adults, children, young, senior, baby, babyNoSeat, errormessage, errorwidth, item, expandFormIfNeeds){ var mustBeExpanded = false; var errorPopupLeftOffeset = 26; // first value adults position var contentSpanStart=''; var contentSpanEnd=''; if (senior > 0){ setCSSBackground(item, ".drop_0-9.old", "images/flight_selector/dropdown_small_error.png"); } if (young > 0){ errorPopupLeftOffeset = 358; setCSSBackground(item, ".drop_0-9.young", "images/flight_selector/dropdown_small_error.png"); } /* commented by arvanitis if (baby > 0) { errorPopupLeftOffeset = 276; setCSSBackground(item, ".drop_0-9.babys1", "images/flight_selector/dropdown_small_error.png"); } */ if (babyNoSeat > 0) { errorPopupLeftOffeset = 193; setCSSBackground(item, ".drop_0-9.babys2", "images/flight_selector/dropdown_small_error.png"); } if (children > 0){ errorPopupLeftOffeset = 113; setCSSBackground(item, ".drop_0-9.kids", "images/flight_selector/dropdown_small_error.png"); } if (adults > 0){ setCSSBackground(item, ".drop_0-9.adults", "images/flight_selector/dropdown_small_error.png"); errorPopupLeftOffeset = 26; } //errors if ((errorPopupLeftOffeset > 193)&&(expandFormIfNeeds)){ mustBeExpanded = true; } if (item.find(".flight_selector_bottom_left_top.expanded").is(':visible')){ item.find(".flight_selector_bottom_left_top.expanded").errorPopup({ content: contentSpanStart+errormessage+contentSpanEnd, width: errorwidth, plusTop: 18, plusLeft: errorPopupLeftOffeset, onClose: function(){ resetAll0_9bgrs(item); } }); } else{ item.find(".flight_selector_bottom_left_top").not(".expanded").errorPopup({ content: contentSpanStart+errormessage+contentSpanEnd, width: errorwidth, plusTop: 18, plusLeft: errorPopupLeftOffeset, onClose: function(){ resetAll0_9bgrs(item); } }); } return mustBeExpanded; } /* ------------------------------------------------------------------------------------------------------*/ function resetAll0_9bgrs(item){ var defaultImagePath="images/flight_selector/dropdown_small.png"; setCSSBackground(item,".drop_0-9.adults",defaultImagePath); setCSSBackground(item,".drop_0-9.kids",defaultImagePath); setCSSBackground(item,".drop_0-9.babys1",defaultImagePath); setCSSBackground(item,".drop_0-9.babys2",defaultImagePath); setCSSBackground(item,".drop_0-9.young",defaultImagePath); setCSSBackground(item,".drop_0-9.old",defaultImagePath); } /* ------------------------------------------------------------------------------------------------------*/ function validatePassengerTypes(adults, children, young, senior, baby, babyNoSeat) { var result = 1; var hasAdults = 0; var hasChildren = 0; var hasYoungs = 0; var hasSeniors = 0; var hasInfantsWOS = 0; if (adults != 0) { hasAdults = 1; } if (children != 0) { hasChildren = 1; } if (young != 0) { hasYoungs = 1; } if (senior != 0) { hasSeniors = 1; } if (babyNoSeat != 0) { hasInfantsWOS = 1; } if ((hasAdults + hasChildren + hasYoungs + hasSeniors + hasInfantsWOS) > 4){ result = 0; } return result; } /* ------------------------------------------------------------------------------------------------------*/ function setPtcs(item, theForm){ var HOW_MANY_PTC_EXIST = 4; for (var j=1; j <= HOW_MANY_PTC_EXIST; j++){ $(theForm).find("input[name='ptc"+j+"']").val(""); $(theForm).find("input[name='numptc"+j+"']").val(""); } var items = ["adults", "kids", "babys1", "babys2", "young", "old"]; var ptcsSettedCount = 1; for (var i=0; i < items.length; i++){ if ( item.find(".drop_0-9."+items[i]).dropdown("val") > 0){ $(theForm).find("input[name='ptc"+ptcsSettedCount+"']").val(item.find(".drop_0-9."+items[i]).attr("id")); $(theForm).find("input[name='numptc"+ptcsSettedCount+"']").val(item.find(".drop_0-9."+items[i]).dropdown("val")); ptcsSettedCount++; } } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Initialization code on page loading //////////////////////////////////////////////////////////////////////// (function() { window.SearchBoxUI = { IntegrationTypeEnum : { INTERNAL : 0, /* same website */ FACEBOOK : 1, MAIN : 2 /* Please add additional types here */ /* ...... */ }, SeatsTexts : new Array( 'Any', 'Economy', 'Business', 'First Class' ), SeatsValues : new Array( "Any", "Coach", "Business", "First" ), Drop09 : new Array(0,1,2,3,4,5,6,7,8,9), formIsExpanded : false, isHotelsFormsLoaded : false, isCarFormsLoaded : false, isMultilegLoaded : false }; $.datepicker.regional['el'] = { closeText: 'Close', prevText: 'Previous Month', nextText: 'Next Month', currentText: 'This month', monthNames: ['January','February','March','April','May','June', 'July','August','September','October','November','December'], monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Okt','Nov','Dec'], dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'], dayNamesShort: ['Su','Mo','Tu','We','Th','Fr','Sa'], dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], weekHeader: 'week', dateFormat: 'dd/mm/yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['el']); })(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////