function sortBySequence(){var swapp;var n=hotel_folders.length-1;var x=hotel_folders;do{swapp=false;for(var i=0;icomparej){var temp=x[i];x[i]=x[i+1];x[i+1]=temp;swapp=true;}} n--;}while(swapp);return x;} var sortedHotels=sortBySequence();var onlyHotels=[];var onlyFolders=[];for(var i=0;i0){let clearMobileHotelSearchFieldIcon=$('.clear-search-field-icon[for="'+mobileHotelSearchField.attr('id')+'"]') clearMobileHotelSearchFieldIcon.on('click',function(){clearField(mobileHotelSearchField);});}}});$(".hotels_all, .hotels_hotel, .hotels_folder, .all-hotels, .hotels-folder, .hotel").click(function(){let divClicked=$(this);if(divClicked.hasClass("hotels_folder")==true&&divClicked.parent().parent().attr('id')=="as-destination"){$("#select-hotel").modal("show");return;} if(divClicked.hasClass('all-hotels')||divClicked.hasClass('hotels-folder')||divClicked.hasClass('hotel')||divClicked.hasClass('hotels_all')||divClicked.hasClass('hotels_folder')||divClicked.hasClass('hotels_hotel')){if(resolution==1){$(".hotels_dropdown").slideUp();}else{$("#mobile-search-dropdown").slideUp(200);$('body').removeClass('position-fixed');$('body').removeClass('search_bar_open');}} hotel_code=divClicked.attr("data-id");hotel_folder=divClicked.attr("data-folder-id");hotel_name=divClicked.text();$("#hotels").val(hotel_name);$("#mobile-hotels").val(hotel_name);$("#hotel_code").val(hotel_code);if(hotel_code!=0||hotel_code!=null){$(".as-destination-input").val(hotel_name);$("#as-hotel-id").val(hotel_code);} if(hotel_folder!=0&&hotel_folder!=null){$("#hotel_code").val("0");$("#hotel_folder").val(hotel_folder);$("#hotels").val(hotel_name);$("#mobile-hotels").val(hotel_name);$(".as-destination-input").val(hotel_name);}else{$("#hotel_folder").val(null);} let action=$("#hotel_code").closest("form").attr("action");if($("#hotel_code").val()==""||$("#hotel_code").val()=="0"){action=action.replace(/hotelresults/g,"chainresults");$("#hotel_code").val("");$("#occupancy_dropdown .pl-2").show();childrenAllowedChain();}else{action=action.replace(/chainresults/g,"hotelresults");childrenAllowed();};$("#hotel_code").closest("form").attr("action",action);$("#hotel_code").trigger("change");});var path=window.location.pathname;var path_split=path.split("/");$("#hotel_code").on("change",function(){var hotelCode=$(this).val();if(hotelCode!=''&&$("#hotels").hasClass('single-hotel')==false){$.get('/children_age_limit/'+hotelCode,function(data){$("#guests").attr("data-max-children-age",data);if(resolution==1||path_split[1]=="chain"){var children_number=$(".select-child-value").text();for(i=0;i',{text:$(".select-child-ages-holder").attr("data-children-empty-value"),'data-value':'/',selected:'true'}));for(i=0;i<=17;i++){if(i==1){$('.select-child-ages-input-clone').append($('