PageSourceSearch

https://tourcataratas.com.br/wp-content/themes/traveler/v2/js/custom.js

js tourcataratas.com.br collected 2026-09-24 08:26:54 UTC 195,710 bytes, 5,104 lines download raw bytes

1jQuery(function ($) {
2    $(".hotel-room-booking-form").on("hotel-room-booking-form", function (event) {
3        renderHtmlHotel();
4    });
5});
6jQuery(function ($) {
7    $(".date-wrapper").on("tours-booking-form", function (event) {
8        renderHtmlTour();
9    });
10});
11
12jQuery(function ($) {
13    $(".date-wrapper").on("rental-booking-form", function (event) {
14        renderHtmlRental();
15    });
16});
17
18
19jQuery(function ($) {
20    $("body").on("cartransfer-booking-form", function (event, el) {
21        renderHtmlCarstranfer(event, el);
22    });
23});
24
25jQuery(function ($) {
26    $(".date-wrapper").on("car-booking-form", function (event) {
27        renderHtmlCar(event);
28    });
29});
30
31jQuery(function ($) {
32    $("body").on("activity-booking-form", function (event, el) {
33        renderHtmlActivity(event, el);
34    });
35});
36
37function renderHtmlCarstranfer(event, el) {
38    var form = el.closest('form.form-booking-car-transfer');
39    var data = form.serializeArray();
40    jQuery('.map-content-loading').hide();
41    data.push({
42        name: 'security',
43        value: st_params._s
44    });
45    for (var i = 0; i < data.length; i++) {
46        if (data[i].name === 'action') {
47            data[i]['value'] = 'st_format_cartransfer_price';
48        }
49    };
50    jQuery.ajax({
51        method: "post",
52        dataType: 'json',
53        data: data,
54        url: st_params.ajax_url,
55        beforeSend: function () {
56            jQuery('div.message-wrapper').html("");
57            jQuery('.map-content-loading').show();
58            jQuery('.message_box').html('');
59            jQuery(form).closest('.item-service').find('.message').removeClass('mt20 alert alert-danger').hide();
60        },
61        success: function (response) {
62            jQuery('.map-content-loading').hide();
63            if (response) {
64                if (response.price_html) {
65
66                    if (jQuery(form).find('.service-price')) {
67                        jQuery(form).find('.service-price .price').html(response.price_html);
68                    }
69                    jQuery('.message_box').html('');
70                    jQuery('div.message-wrapper').html("");
71                } else {
72                    if (response.message) {
73                        jQuery(form).closest('.item-service').find('.message').addClass('mt20 alert alert-danger').show().html(response.message);
74                    }
75                    if (response.price_from) {
76                        if (jQuery('.form-head .price').length > 0) {
77                            jQuery('.form-head .price').html(response.price_from);
78                        }
79                    }
80                }
81            }
82        }
83    });
84}
85
86function renderHtmlTour() {
87    var form = jQuery('form.tour-booking-form');
88    var data = jQuery('form.tour-booking-form').serializeArray();
89    jQuery('.loader-wrapper').hide();
90    data.push({
91        name: 'security',
92        value: st_params._s
93    });
94    for (var i = 0; i < data.length; i++) {
95        if (data[i].name === 'action') {
96            data[i]['value'] = 'st_format_tour_price';
97        }
98    };
99
100    jQuery.ajax({
101        method: "post",
102        dataType: 'json',
103        data: data,
104        url: st_params.ajax_url,
105        beforeSend: function () {
106            jQuery('div.message-wrapper').html("");
107            jQuery('.loader-wrapper').show();
108            jQuery('.message_box').html('');
109        },
110        success: function (response) {
111            jQuery('.loader-wrapper').hide();
112
113            if (response) {
114                if (response.price_html) {
115                    if (jQuery('.form-head .price').length > 0) {
116                        jQuery('.form-head .price').html(response.price_html);
117                    }
118                    if (jQuery('.st-tour-booking__price--item').length > 0) {
119                        jQuery('.st-tour-booking__price--item').html(response.price_html);
120                    }
121                    if (jQuery('.hotel-target-book-mobile').length > 0) {
122                        jQuery('.hotel-target-book-mobile .price-wrapper').html(response.price_html);
123                    }
124                    jQuery('.message_box').html('');
125                    jQuery('div.message-wrapper').html("");
126
127                } else {
128                    if (response.message) {
129                        jQuery('#form-booking-inpage .message-wrapper').html('<div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> ' + response.message + ' </div>');
130                    }
131                    if (response.price_from) {
132                        if (jQuery('.form-head .price').length > 0) {
133                            jQuery('.form-head .price').html(response.price_from);
134                        }
135                    }
136                }
137            }
138        }
139    });
140}
141
142function renderHtmlActivity() {
143    var form = jQuery('form.activity-booking-form');
144    var data = jQuery('form.activity-booking-form').serializeArray();
145    jQuery('.loader-wrapper').hide();
146    data.push({
147        name: 'security',
148        value: st_params._s
149    });
150    for (var i = 0; i < data.length; i++) {
151
152        if (data[i].name === 'action') {
153            data[i]['value'] = 'st_format_activity_price';
154        }
155    };
156    jQuery.ajax({
157        method: "post",
158        dataType: 'json',
159        data: data,
160        url: st_params.ajax_url,
161        beforeSend: function () {
162            jQuery('.loader-wrapper').show();
163            jQuery('div.message-wrapper').html("");
164            jQuery('.message_box').html('');
165        },
166        success: function (response) {
167            jQuery('.loader-wrapper').hide();
168            if (response) {
169                if (response.price_html) {
170                    if (jQuery('.form-head .price').length > 0) {
171                        if (response.price_html) {
172                            jQuery('.form-head .price').html(response.price_html);
173                        }
174                    }
175                    if (jQuery('.hotel-target-book-mobile').length > 0) {
176                        jQuery('.hotel-target-book-mobile .price-wrapper').html(response.price_html);
177                    }
178                    jQuery('div.message-wrapper').html("");
179                    jQuery('.message_box').html('');
180                    ci = 0;
181                } else {
182                    if (response.message) {
183                        jQuery('#form-booking-inpage .message-wrapper').html('<div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> ' + response.message + ' </div>');
184                    }
185                }
186            }
187        }
188    });
189}
190
191function renderHtmlRental() {
192    var form = jQuery('form.rental-booking-form');
193    var data = jQuery('form.rental-booking-form').serializeArray();
194    jQuery('.loader-wrapper').hide();
195    data.push({
196        name: 'security',
197        value: st_params._s
198    });
199    for (var i = 0; i < data.length; i++) {
200
201        if (data[i].name === 'action') {
202            data[i]['value'] = 'st_format_rental_price';
203        }
204    };
205    jQuery.ajax({
206        method: "post",
207        dataType: 'json',
208        data: data,
209        url: st_params.ajax_url,
210        beforeSend: function () {
211            jQuery('.loader-wrapper').show();
212            jQuery('div.message-wrapper').html("");
213            jQuery('.message_box').html('');
214        },
215        success: function (response) {
216            jQuery('.loader-wrapper').hide();
217            if (response) {
218                if (response.price_html) {
219                    if (jQuery('.form-head').length > 0) {
220                        if (response.price_html) {
221                            jQuery('.form-head .price-min').html(response.price_html);
222                        }
223                    }
224                    if (jQuery('.hotel-target-book-mobile').length > 0) {
225                        jQuery('.hotel-target-book-mobile .price-wrapper').html(response.price_html);
226                    }
227                    jQuery('.message_box').html('');
228                    jQuery('div.message-wrapper').html("");
229                    ci = 0;
230                } else {
231                    if (response.message) {
232                        jQuery('#form-booking-inpage .message-wrapper').html('<div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> ' + response.message + ' </div>');
233                    }
234                }
235            }
236        }
237    });
238}
239
240function renderHtmlHotel() {
241    var form = jQuery('form.hotel-room-booking-form');
242    var data = jQuery('form.hotel-room-booking-form').serializeArray();
243    jQuery('.loader-wrapper').hide();
244    data.push({
245        name: 'security',
246        value: st_params._s
247    });
248    for (var i = 0; i < data.length; i++) {
249
250        if (data[i].name === 'action') {
251            data[i]['value'] = 'st_format_hotel_price';
252        }
253    };
254    jQuery.ajax({
255        method: "post",
256        dataType: 'json',
257        data: data,
258        url: st_params.ajax_url,
259        beforeSend: function () {
260            jQuery('.loader-wrapper').show();
261            jQuery('div.message-wrapper').html("");
262            jQuery('.message_box').html('');
263        },
264        success: function (response) {
265            jQuery('.loader-wrapper').hide();
266            if (response) {
267                if (response.price_html) {
268                    if (jQuery('.form-head').length > 0) {
269                        if (response.price_html) {
270                            jQuery('.form-head').html(response.price_html);
271                        }
272                    }
273                    if (jQuery('.hotel-target-book-mobile').length > 0) {
274                        jQuery('.hotel-target-book-mobile .price-wrapper').html(response.price_html);
275                    }
276                    jQuery('.message_box').html('');
277                    jQuery('div.message-wrapper').html("");
278                    ci = 0;
279                } else {
280                    if (response.message) {
281                        jQuery('.message-wrapper').html('<div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> ' + response.message + ' </div>');
282                    }
283                }
284            }
285        }
286    });
287}
288
289function renderHtmlCar() {
290    var form = jQuery('form.car-booking-form');
291    var data = jQuery('form.car-booking-form').serializeArray();
292
293    jQuery('.loader-wrapper').hide();
294    data.push({
295        name: 'security',
296        value: st_params._s
297    });
298    for (var i = 0; i < data.length; i++) {
299
300        if (data[i].name === 'action') {
301            data[i]['value'] = 'st_format_car_price';
302        }
303    };
304    jQuery.ajax({
305        method: "post",
306        dataType: 'json',
307        data: data,
308        url: st_params.ajax_url,
309        beforeSend: function () {
310            jQuery('.loader-wrapper').show();
311            jQuery('div.message-wrapper').html("");
312            jQuery('.message_box').html('');
313        },
314        success: function (response) {
315            jQuery('.loader-wrapper').hide();
316            if (response) {
317                if (response.price_html) {
318                    if (jQuery('.form-head').length > 0) {
319                        jQuery('.form-head').html(response.price_html);
320                    }
321
322                    jQuery('.message_box').html('');
323                    ci = 0;
324                } else {
325                    if (response.message) {
326                        jQuery('#form-booking-inpage .message-wrapper').html('<div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> ' + response.message + ' </div>');
327                    }
328                }
329            }
330        }
331    });
332}
333//caculator Booking
334if (st_params.caculator_price_single_ajax && st_params.caculator_price_single_ajax === 'on') {
335    //Car
336    jQuery(function ($) {
337        if (jQuery('.car-booking-form').length > 0) {
338            if (jQuery('.form-more-extra .extras').length > 0) {
339                jQuery('.form-more-extra .extras li').each(function () {
340                    jQuery(this).find('.extra-service-select').on('change', function () {
341                        changeServiceSelect();
342                    })
343                });
344            }
345
346            function changeServiceSelect() {
347                renderHtmlCar();
348            }
349
350            function renderHtmlCar() {
351                var form = jQuery('form.car-booking-form');
352                var data = jQuery('form.car-booking-form').serializeArray();
353                jQuery('.loader-wrapper').hide();
354                data.push({
355                    name: 'security',
356                    value: st_params._s
357                });
358                for (var i = 0; i < data.length; i++) {
359
360                    if (data[i].name === 'action') {
361                        data[i]['value'] = 'st_format_car_price';
362                    }
363                };
364                jQuery.ajax({
365                    method: "post",
366                    dataType: 'json',
367                    data: data,
368                    url: st_params.ajax_url,
369                    beforeSend: function () {
370                        jQuery('.loader-wrapper').show();
371                        jQuery('div.message-wrapper').html("");
372                    },
373                    success: function (response) {
374                        jQuery('.loader-wrapper').hide();
375                        if (response) {
376                            if (response.price_html) {
377                                if (jQuery('.form-head').length > 0) {
378                                    jQuery('.form-head').html(response.price_html);
379                                }
380
381                                jQuery('.message_box').html('');
382                                ci = 0;
383                            } else {
384                                if (response.message) {
385                                    jQuery('#form-booking-inpage .message-wrapper').html('<div class="alert alert-danger"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> ' + response.message + ' </div>');
386                                }
387                            }
388                        }
389                    }
390                });
391            }
392        }
393    });
394
395    //Tour
396    jQuery(function ($) {
397        if ($('.tour-booking-form').length > 0) {
398            if ($('.guest-wrapper').length > 0) {
399                $('.guest-wrapper').each(function () {
400                    $(this).find('.form-control.st-input-number').on('change', function () {
401                        renderHtmlTour();
402                    })
403                });
404            }
405            if ($('#st-package-popup').length > 0) {
406                $('#st-package-popup .mfp-close').on('click', function () {
407                    renderHtmlTour();
408                });
409            }
410            if ($('.form-more-extra .extras').length > 0) {
411                $('.form-more-extra .extras li').each(function () {
412                    $(this).find('.extra-service-select').on('change', function () {
413                        renderHtmlTour();
414                    })
415                });
416            }
417            if ($('.form-more-extra-solo').length > 0) {
418                $('.st-package-popup-solo  li').each(function () {
419                    $(this).find('.extra-service-select').on('change', function () {
420                        renderHtmlTour();
421                    })
422                });
423                $('.form-more-extra-solo li.item').each(function () {
424                    $(this).find('.extra-service-select').on('change', function () {
425                        renderHtmlTour();
426                    })
427                });
428
429            }
430            if ($('.st-form-starttime').length > 0) {
431                $('.st_tour_starttime').each(function () {
432                    $(this).on('change', function () {
433                        renderHtmlTour();
434                    })
435                });
436            }
437
438        }
439    });
440
441
442    //Activity
443    jQuery(function ($) {
444        if ($('.activity-booking-form').length > 0) {
445            var flag = false;
446            if ($('.guest-wrapper').length > 0) {
447                $('.guest-wrapper').each(function () {
448                    $(this).find('.form-control.st-input-number').on('change', function () {
449                        renderHtmlActivity();
450                    })
451                });
452            }
453            if ($('#st-package-popup').length > 0) {
454                $('#st-package-popup .item').each(function () {
455                    $(this).find('ul li .extra-service-select').on('change', function () {
456                        renderHtmlActivity();
457                    })
458                });
459            }
460            if ($('.form-more-extra .extras').length > 0) {
461                $('.form-more-extra .extras li').each(function () {
462                    $(this).find('.extra-service-select').on('change', function () {
463                        renderHtmlActivity();
464                    })
465                });
466            }
467            if ($('.st-form-starttime').length > 0) {
468                $('.st_tour_starttime').each(function () {
469                    $(this).on('change', function () {
470                        renderHtmlActivity();
471                    })
472                });
473            }
474            if (flag) {
475                renderHtmlActivity();
476            }
477
478        }
479    });
480
481    //Rental
482    jQuery(function ($) {
483        if ($('.rental-booking-form').length > 0) {
484            var flag = false;
485            if ($('.form-extra-field').length > 0) {
486                $('.form-extra-field').each(function () {
487                    var st_guest = $(this).closest('.field-guest');
488                    st_guest.find('.st-input-number').on('change', function () {
489                        renderHtmlRental();
490                    })
491                });
492            }
493            if ($('.form-more-extra .extras').length > 0) {
494                $('.form-more-extra .extras li').each(function () {
495                    $(this).find('.extra-service-select').on('change', function () {
496                        renderHtmlRental();
497                    })
498                });
499            }
500            if (flag) {
501                renderHtmlRental();
502            }
503
504        }
505    });
506
507    //HotelRoom
508    jQuery(function ($) {
509        if ($('.hotel-room-booking-form').length > 0) {
510            var flag = false;
511            var ci_hotel = 0;
512            $('.check-in-input').on('change', function (e) {
513                if (ci_hotel != 0) {
514                    renderHtmlHotel();
515                }
516                ci_hotel++;
517            });
518            if ($('.form-extra-field').length > 0) {
519                $('.form-extra-field').each(function () {
520                    $(this).find('.form-control.st-input-number').on('change', function () {
521                        renderHtmlHotel();
522                    })
523                });
524            }
525            if ($('.form-more-extra .extras').length > 0) {
526                $('.form-more-extra .extras li').each(function () {
527                    $(this).find('.extra-service-select').on('change', function () {
528                        renderHtmlHotel();
529                    })
530                });
531            }
532            if (flag) {
533                renderHtmlHotel();
534            }
535
536        }
537    });
538    //Car transfer
539    jQuery(function ($) {
540        $(document).on('change', '.item-service-car .sroom-extra-service table tr .extra-service-select', function (event) {
541            $('body').trigger('cartransfer-booking-form', [$(this)]);
542        });
543
544        $(document).on('change', '.item-service-car .sroom-return  input[name ="return_car"]', function (event) {
545            $('body').trigger('cartransfer-booking-form', [$(this)]);
546        });
547    });
548}
549
550var mapStyles = {
551    'silver': [{
552            "elementType": "geometry",
553            "stylers": [{
554                "color": "#f5f5f5"
555            }]
556        },
557        {
558            "elementType": "labels.icon",
559            "stylers": [{
560                "visibility": "off"
561            }]
562        },
563        {
564            "elementType": "labels.text.fill",
565            "stylers": [{
566                "color": "#616161"
567            }]
568        },
569        {
570            "elementType": "labels.text.stroke",
571            "stylers": [{
572                "color": "#f5f5f5"
573            }]
574        },
575        {
576            "featureType": "administrative.land_parcel",
577            "elementType": "labels.text.fill",
578            "stylers": [{
579                "color": "#bdbdbd"
580            }]
581        },
582        {
583            "featureType": "poi",
584            "elementType": "geometry",
585            "stylers": [{
586                "color": "#eeeeee"
587            }]
588        },
589        {
590            "featureType": "poi",
591            "elementType": "labels.text.fill",
592            "stylers": [{
593                "color": "#757575"
594            }]
595        },
596        {
597            "featureType": "poi.park",
598            "elementType": "geometry",
599            "stylers": [{
600                "color": "#e5e5e5"
601            }]
602        },
603        {
604            "featureType": "poi.park",
605            "elementType": "labels.text.fill",
606            "stylers": [{
607                "color": "#9e9e9e"
608            }]
609        },
610        {
611            "featureType": "road",
612            "elementType": "geometry",
613            "stylers": [{
614                "color": "#ffffff"
615            }]
616        },
617        {
618            "featureType": "road.arterial",
619            "elementType": "labels.text.fill",
620            "stylers": [{
621                "color": "#757575"
622            }]
623        },
624        {
625            "featureType": "road.highway",
626            "elementType": "geometry",
627            "stylers": [{
628                "color": "#dadada"
629            }]
630        },
631        {
632            "featureType": "road.highway",
633            "elementType": "labels.text.fill",
634            "stylers": [{
635                "color": "#616161"
636            }]
637        },
638        {
639            "featureType": "road.local",
640            "elementType": "labels.text.fill",
641            "stylers": [{
642                "color": "#9e9e9e"
643            }]
644        },
645        {
646            "featureType": "transit.line",
647            "elementType": "geometry",
648            "stylers": [{
649                "color": "#e5e5e5"
650            }]
651        },
652        {
653            "featureType": "transit.station",
654            "elementType": "geometry",
655            "stylers": [{
656                "color": "#eeeeee"
657            }]
658        },
659        {
660            "featureType": "water",
661            "elementType": "geometry",
662            "stylers": [{
663                "color": "#c9c9c9"
664            }]
665        },
666        {
667            "featureType": "water",
668            "elementType": "labels.text.fill",
669            "stylers": [{
670                "color": "#9e9e9e"
671            }]
672        }
673    ],
674    'retro': [{
675            "elementType": "geometry",
676            "stylers": [{
677                "color": "#ebe3cd"
678            }]
679        },
680        {
681            "elementType": "labels.text.fill",
682            "stylers": [{
683                "color": "#523735"
684            }]
685        },
686        {
687            "elementType": "labels.text.stroke",
688            "stylers": [{
689                "color": "#f5f1e6"
690            }]
691        },
692        {
693            "featureType": "administrative",
694            "elementType": "geometry.stroke",
695            "stylers": [{
696                "color": "#c9b2a6"
697            }]
698        },
699        {
700            "featureType": "administrative.land_parcel",
701            "elementType": "geometry.stroke",
702            "stylers": [{
703                "color": "#dcd2be"
704            }]
705        },
706        {
707            "featureType": "administrative.land_parcel",
708            "elementType": "labels.text.fill",
709            "stylers": [{
710                "color": "#ae9e90"
711            }]
712        },
713        {
714            "featureType": "landscape.natural",
715            "elementType": "geometry",
716            "stylers": [{
717                "color": "#dfd2ae"
718            }]
719        },
720        {
721            "featureType": "poi",
722            "elementType": "geometry",
723            "stylers": [{
724                "color": "#dfd2ae"
725            }]
726        },
727        {
728            "featureType": "poi",
729            "elementType": "labels.text.fill",
730            "stylers": [{
731                "color": "#93817c"
732            }]
733        },
734        {
735            "featureType": "poi.park",
736            "elementType": "geometry.fill",
737            "stylers": [{
738                "color": "#a5b076"
739            }]
740        },
741        {
742            "featureType": "poi.park",
743            "elementType": "labels.text.fill",
744            "stylers": [{
745                "color": "#447530"
746            }]
747        },
748        {
749            "featureType": "road",
750            "elementType": "geometry",
751            "stylers": [{
752                "color": "#f5f1e6"
753            }]
754        },
755        {
756            "featureType": "road.arterial",
757            "elementType": "geometry",
758            "stylers": [{
759                "color": "#fdfcf8"
760            }]
761        },
762        {
763            "featureType": "road.highway",
764            "elementType": "geometry",
765            "stylers": [{
766                "color": "#f8c967"
767            }]
768        },
769        {
770            "featureType": "road.highway",
771            "elementType": "geometry.stroke",
772            "stylers": [{
773                "color": "#e9bc62"
774            }]
775        },
776        {
777            "featureType": "road.highway.controlled_access",
778            "elementType": "geometry",
779            "stylers": [{
780                "color": "#e98d58"
781            }]
782        },
783        {
784            "featureType": "road.highway.controlled_access",
785            "elementType": "geometry.stroke",
786            "stylers": [{
787                "color": "#db8555"
788            }]
789        },
790        {
791            "featureType": "road.local",
792            "elementType": "labels.text.fill",
793            "stylers": [{
794                "color": "#806b63"
795            }]
796        },
797        {
798            "featureType": "transit.line",
799            "elementType": "geometry",
800            "stylers": [{
801                "color": "#dfd2ae"
802            }]
803        },
804        {
805            "featureType": "transit.line",
806            "elementType": "labels.text.fill",
807            "stylers": [{
808                "color": "#8f7d77"
809            }]
810        },
811        {
812            "featureType": "transit.line",
813            "elementType": "labels.text.stroke",
814            "stylers": [{
815                "color": "#ebe3cd"
816            }]
817        },
818        {
819            "featureType": "transit.station",
820            "elementType": "geometry",
821            "stylers": [{
822                "color": "#dfd2ae"
823            }]
824        },
825        {
826            "featureType": "water",
827            "elementType": "geometry.fill",
828            "stylers": [{
829                "color": "#b9d3c2"
830            }]
831        },
832        {
833            "featureType": "water",
834            "elementType": "labels.text.fill",
835            "stylers": [{
836                "color": "#92998d"
837            }]
838        }
839    ],
840    'dark': [{
841            "elementType": "geometry",
842            "stylers": [{
843                "color": "#212121"
844            }]
845        },
846        {
847            "elementType": "labels.icon",
848            "stylers": [{
849                "visibility": "off"
850            }]
851        },
852        {
853            "elementType": "labels.text.fill",
854            "stylers": [{
855                "color": "#757575"
856            }]
857        },
858        {
859            "elementType": "labels.text.stroke",
860            "stylers": [{
861                "color": "#212121"
862            }]
863        },
864        {
865            "featureType": "administrative",
866            "elementType": "geometry",
867            "stylers": [{
868                "color": "#757575"
869            }]
870        },
871        {
872            "featureType": "administrative.country",
873            "elementType": "labels.text.fill",
874            "stylers": [{
875                "color": "#9e9e9e"
876            }]
877        },
878        {
879            "featureType": "administrative.land_parcel",
880            "stylers": [{
881                "visibility": "off"
882            }]
883        },
884        {
885            "featureType": "administrative.locality",
886            "elementType": "labels.text.fill",
887            "stylers": [{
888                "color": "#bdbdbd"
889            }]
890        },
891        {
892            "featureType": "poi",
893            "elementType": "labels.text.fill",
894            "stylers": [{
895                "color": "#757575"
896            }]
897        },
898        {
899            "featureType": "poi.park",
900            "elementType": "geometry",
901            "stylers": [{
902                "color": "#181818"
903            }]
904        },
905        {
906            "featureType": "poi.park",
907            "elementType": "labels.text.fill",
908            "stylers": [{
909                "color": "#616161"
910            }]
911        },
912        {
913            "featureType": "poi.park",
914            "elementType": "labels.text.stroke",
915            "stylers": [{
916                "color": "#1b1b1b"
917            }]
918        },
919        {
920            "featureType": "road",
921            "elementType": "geometry.fill",
922            "stylers": [{
923                "color": "#2c2c2c"
924            }]
925        },
926        {
927            "featureType": "road",
928            "elementType": "labels.text.fill",
929            "stylers": [{
930                "color": "#8a8a8a"
931            }]
932        },
933        {
934            "featureType": "road.arterial",
935            "elementType": "geometry",
936            "stylers": [{
937                "color": "#373737"
938            }]
939        },
940        {
941            "featureType": "road.highway",
942            "elementType": "geometry",
943            "stylers": [{
944                "color": "#3c3c3c"
945            }]
946        },
947        {
948            "featureType": "road.highway.controlled_access",
949            "elementType": "geometry",
950            "stylers": [{
951                "color": "#4e4e4e"
952            }]
953        },
954        {
955            "featureType": "road.local",
956            "elementType": "labels.text.fill",
957            "stylers": [{
958                "color": "#616161"
959            }]
960        },
961        {
962            "featureType": "transit",
963            "elementType": "labels.text.fill",
964            "stylers": [{
965                "color": "#757575"
966            }]
967        },
968        {
969            "featureType": "water",
970            "elementType": "geometry",
971            "stylers": [{
972                "color": "#000000"
973            }]
974        },
975        {
976            "featureType": "water",
977            "elementType": "labels.text.fill",
978            "stylers": [{
979                "color": "#3d3d3d"
980            }]
981        }
982    ],
983    'night': [{
984            "elementType": "geometry",
985            "stylers": [{
986                "color": "#242f3e"
987            }]
988        },
989        {
990            "elementType": "labels.text.fill",
991            "stylers": [{
992                "color": "#746855"
993            }]
994        },
995        {
996            "elementType": "labels.text.stroke",
997            "stylers": [{
998                "color": "#242f3e"
999            }]
1000        },
1001        {
1002            "featureType": "administrative.locality",
1003            "elementType": "labels.text.fill",
1004            "stylers": [{
1005                "color": "#d59563"
1006            }]
1007        },
1008        {
1009            "featureType": "poi",
1010            "elementType": "labels.text.fill",
1011            "stylers": [{
1012                "color": "#d59563"
1013            }]
1014        },
1015        {
1016            "featureType": "poi.park",
1017            "elementType": "geometry",
1018            "stylers": [{
1019                "color": "#263c3f"
1020            }]
1021        },
1022        {
1023            "featureType": "poi.park",
1024            "elementType": "labels.text.fill",
1025            "stylers": [{
1026                "color": "#6b9a76"
1027            }]
1028        },
1029        {
1030            "featureType": "road",
1031            "elementType": "geometry",
1032            "stylers": [{
1033                "color": "#38414e"
1034            }]
1035        },
1036        {
1037            "featureType": "road",
1038            "elementType": "geometry.stroke",
1039            "stylers": [{
1040                "color": "#212a37"
1041            }]
1042        },
1043        {
1044            "featureType": "road",
1045            "elementType": "labels.text.fill",
1046            "stylers": [{
1047                "color": "#9ca5b3"
1048            }]
1049        },
1050        {
1051            "featureType": "road.highway",
1052            "elementType": "geometry",
1053            "stylers": [{
1054                "color": "#746855"
1055            }]
1056        },
1057        {
1058            "featureType": "road.highway",
1059            "elementType": "geometry.stroke",
1060            "stylers": [{
1061                "color": "#1f2835"
1062            }]
1063        },
1064        {
1065            "featureType": "road.highway",
1066            "elementType": "labels.text.fill",
1067            "stylers": [{
1068                "color": "#f3d19c"
1069            }]
1070        },
1071        {
1072            "featureType": "transit",
1073            "elementType": "geometry",
1074            "stylers": [{
1075                "color": "#2f3948"
1076            }]
1077        },
1078        {
1079            "featureType": "transit.station",
1080            "elementType": "labels.text.fill",
1081            "stylers": [{
1082                "color": "#d59563"
1083            }]
1084        },
1085        {
1086            "featureType": "water",
1087            "elementType": "geometry",
1088            "stylers": [{
1089                "color": "#17263c"
1090            }]
1091        },
1092        {
1093            "featureType": "water",
1094            "elementType": "labels.text.fill",
1095            "stylers": [{
1096                "color": "#515c6d"
1097            }]
1098        },
1099        {
1100            "featureType": "water",
1101            "elementType": "labels.text.stroke",
1102            "stylers": [{
1103                "color": "#17263c"
1104            }]
1105        }
1106    ],
1107    'aubergine': [{
1108            "elementType": "geometry",
1109            "stylers": [{
1110                "color": "#1d2c4d"
1111            }]
1112        },
1113        {
1114            "elementType": "labels.text.fill",
1115            "stylers": [{
1116                "color": "#8ec3b9"
1117            }]
1118        },
1119        {
1120            "elementType": "labels.text.stroke",
1121            "stylers": [{
1122                "color": "#1a3646"
1123            }]
1124        },
1125        {
1126            "featureType": "administrative.country",
1127            "elementType": "geometry.stroke",
1128            "stylers": [{
1129                "color": "#4b6878"
1130            }]
1131        },
1132        {
1133            "featureType": "administrative.land_parcel",
1134            "elementType": "labels.text.fill",
1135            "stylers": [{
1136                "color": "#64779e"
1137            }]
1138        },
1139        {
1140            "featureType": "administrative.province",
1141            "elementType": "geometry.stroke",
1142            "stylers": [{
1143                "color": "#4b6878"
1144            }]
1145        },
1146        {
1147            "featureType": "landscape.man_made",
1148            "elementType": "geometry.stroke",
1149            "stylers": [{
1150                "color": "#334e87"
1151            }]
1152        },
1153        {
1154            "featureType": "landscape.natural",
1155            "elementType": "geometry",
1156            "stylers": [{
1157                "color": "#023e58"
1158            }]
1159        },
1160        {
1161            "featureType": "poi",
1162            "elementType": "geometry",
1163            "stylers": [{
1164                "color": "#283d6a"
1165            }]
1166        },
1167        {
1168            "featureType": "poi",
1169            "elementType": "labels.text.fill",
1170            "stylers": [{
1171                "color": "#6f9ba5"
1172            }]
1173        },
1174        {
1175            "featureType": "poi",
1176            "elementType": "labels.text.stroke",
1177            "stylers": [{
1178                "color": "#1d2c4d"
1179            }]
1180        },
1181        {
1182            "featureType": "poi.park",
1183            "elementType": "geometry.fill",
1184            "stylers": [{
1185                "color": "#023e58"
1186            }]
1187        },
1188        {
1189            "featureType": "poi.park",
1190            "elementType": "labels.text.fill",
1191            "stylers": [{
1192                "color": "#3C7680"
1193            }]
1194        },
1195        {
1196            "featureType": "road",
1197            "elementType": "geometry",
1198            "stylers": [{
1199                "color": "#304a7d"
1200            }]
1201        },
1202        {
1203            "featureType": "road",
1204            "elementType": "labels.text.fill",
1205            "stylers": [{
1206                "color": "#98a5be"
1207            }]
1208        },
1209        {
1210            "featureType": "road",
1211            "elementType": "labels.text.stroke",
1212            "stylers": [{
1213                "color": "#1d2c4d"
1214            }]
1215        },
1216        {
1217            "featureType": "road.highway",
1218            "elementType": "geometry",
1219            "stylers": [{
1220                "color": "#2c6675"
1221            }]
1222        },
1223        {
1224            "featureType": "road.highway",
1225            "elementType": "geometry.stroke",
1226            "stylers": [{
1227                "color": "#255763"
1228            }]
1229        },
1230        {
1231            "featureType": "road.highway",
1232            "elementType": "labels.text.fill",
1233            "stylers": [{
1234                "color": "#b0d5ce"
1235            }]
1236        },
1237        {
1238            "featureType": "road.highway",
1239            "elementType": "labels.text.stroke",
1240            "stylers": [{
1241                "color": "#023e58"
1242            }]
1243        },
1244        {
1245            "featureType": "transit",
1246            "elementType": "labels.text.fill",
1247            "stylers": [{
1248                "color": "#98a5be"
1249            }]
1250        },
1251        {
1252            "featureType": "transit",
1253            "elementType": "labels.text.stroke",
1254            "stylers": [{
1255                "color": "#1d2c4d"
1256            }]
1257        },
1258        {
1259            "featureType": "transit.line",
1260            "elementType": "geometry.fill",
1261            "stylers": [{
1262                "color": "#283d6a"
1263            }]
1264        },
1265        {
1266            "featureType": "transit.station",
1267            "elementType": "geometry",
1268            "stylers": [{
1269                "color": "#3a4762"
1270            }]
1271        },
1272        {
1273            "featureType": "water",
1274            "elementType": "geometry",
1275            "stylers": [{
1276                "color": "#0e1626"
1277            }]
1278        },
1279        {
1280            "featureType": "water",
1281            "elementType": "labels.text.fill",
1282            "stylers": [{
1283                "color": "#4e6d70"
1284            }]
1285        }
1286    ]
1287};
1288var getHeightHiddenEl = function (el) {
1289    var el_style = window.getComputedStyle(el),
1290        el_display = el_style.display,
1291        el_position = el_style.position,
1292        el_visibility = el_style.visibility,
1293        el_max_height = el_style.maxHeight.replace('px', '').replace('%', ''),
1294        wanted_height = 0;
1295    // if its not hidden we just return normal height
1296    if (el_display !== 'none' && el_max_height !== '0') {
1297        return el.offsetHeight;
1298    }
1299    // the element is hidden so:
1300    // making the el block so we can meassure its height but still be hidden
1301    el.style.position = 'absolute';
1302    el.style.visibility = 'hidden';
1303    el.style.display = 'block';
1304    wanted_height = el.offsetHeight;
1305    // reverting to the original values
1306    el.style.display = '';
1307    el.style.position = 'relative';
1308    el.style.visibility = 'visible';
1309    return wanted_height;
1310};
1311(function ($) {
1312    'use strict';
1313    var body = $('body');
1314    if ($('.has-matchHeight', body).length) {
1315        $('.has-matchHeight', body).matchHeight();
1316    }
1317    if ($('.dropdown-toggle', body).length) {
1318        $('.dropdown-toggle', body).dropdown();
1319    }
1320    $('.open-loss-password', body).on('click', function (ev) {
1321        ev.preventDefault();
1322        $('#st-login-form', body).modal('hide');
1323        $('#st-register-form', body).modal('hide');
1324        setTimeout(function () {
1325            $('#st-forgot-form', body).modal('show');
1326        }, 500);
1327    });
1328    $('.open-login', body).on('click', function (ev) {
1329        ev.preventDefault();
1330        $('#st-register-form', body).modal('hide');
1331        $('#st-forgot-form', body).modal('hide');
1332        setTimeout(function () {
1333            $('#st-login-form', body).modal('show');
1334        }, 500);
1335    });
1336    $('.open-signup', body).on('click', function (ev) {
1337        ev.preventDefault();
1338        $('#st-forgot-form', body).modal('hide');
1339        $('#st-login-form', body).modal('hide');
1340        setTimeout(function () {
1341            $('#st-register-form', body).modal('show');
1342        }, 500);
1343    });
1344    $('[data-toggle="tooltip"]').tooltip();
1345
1346    $('.toggle-menu', '.header').on('click', function (ev) {
1347        ev.preventDefault();
1348        toggleBody($('#st-main-menu'));
1349        $('#st-main-menu').toggleClass('open');
1350    });
1351    $('.back-menu', '.header').on('click', function (ev) {
1352        ev.preventDefault();
1353        var backmenu = $(this).closest('#st-main-menu');
1354        var time = setTimeout(() => {
1355            $('#st-main-menu').toggleClass('open', toggleBody(backmenu));
1356        }, 100)
1357
1358
1359    });
1360
1361    function toggleBody(el) {
1362        if (el.hasClass('open')) {
1363            body.css({
1364                'overflow': 'auto'
1365            });
1366        } else {
1367            body.css({
1368                'overflow': 'hidden'
1369            });
1370        }
1371    }
1372    $('#st-main-menu .main-menu .menu-item-has-children .fa').on('click', function () {
1373        if (window.matchMedia("(max-width: 991px)").matches) {
1374            $(this).toggleClass('fa-angle-down fa-angle-up');
1375            var parent = $(this).parent();
1376            $('>.menu-dropdown', parent).toggle();
1377            if ($(this).closest('.menu-item-has-children').hasClass('has-mega-menu')) {
1378                $('>.mega-menu', $(this).parent().parent()).toggle();
1379            }
1380        }
1381    });
1382    body.on('click', function (ev) {
1383        if ($(ev.target).is('#st-main-menu')) {
1384            toggleBody($(ev.target));
1385            $('#st-main-menu').toggleClass('open');
1386        }
1387    });
1388    $(window).on('resize', function () {
1389        if (window.matchMedia('(min-width: 992px)').matches) {
1390            $('.st-gallery', body).each(function () {
1391                var parent = $(this);
1392                var $fotoramaDiv = $('.fotorama', parent).fotorama({
1393                    width: parent.data('width'),
1394                    nav: parent.data('nav'),
1395                    thumbwidth: '135',
1396                    thumbheight: '135',
1397                    allowfullscreen: parent.data('allowfullscreen')
1398                });
1399                parent.data('fotorama', $fotoramaDiv.data('fotorama'));
1400            });
1401        } else {
1402            $('.st-gallery', body).each(function () {
1403                var parent = $(this);
1404                if (typeof parent.data('fotorama') !== 'undefined') {
1405                    parent.data('fotorama').destroy();
1406                }
1407                var $fotoramaDiv = $('.fotorama', parent).fotorama({
1408                    width: parent.data('width'),
1409                    nav: parent.data('nav'),
1410                    thumbwidth: '80',
1411                    thumbheight: '80',
1412                    allowfullscreen: parent.data('allowfullscreen')
1413                });
1414                parent.data('fotorama', $fotoramaDiv.data('fotorama'));
1415            });
1416        }
1417        if (window.matchMedia('(min-width: 992px)').matches) {
1418            $('.full-map').show();
1419        } else {
1420            $('.full-map').hide();
1421        }
1422        if (window.matchMedia('(max-width: 991px)').matches) {
1423            $('.as').slideDown();
1424        }
1425    }).trigger('resize');
1426    if ($('.dropdown-toggle', body).length) {
1427        $('.dropdown-toggle', body).dropdown();
1428    }
1429    body.on('click', '.toggle-section', function (ev) {
1430        ev.preventDefault();
1431        var t = $(this);
1432        var target = t.data('target');
1433        $('.fa', t).toggleClass('fa-angle-up fa-angle-down');
1434        $('[data-toggle-section="' + target + '"]').slideToggle(200);
1435    });
1436    var timeout_fixed_item;
1437    $(window).on('resize', function () {
1438        clearTimeout(timeout_fixed_item);
1439        timeout_fixed_item = setTimeout(function () {
1440            $('.fixed-on-mobile', body).each(function () {
1441                var t = $(this);
1442                var screen = t.data('screen');
1443                var width = t.width(),
1444                    top = t.offset().top;
1445                $(window).on('scroll', function () {
1446                    if ($(window).scrollTop() >= top && window.matchMedia('(min-width: ' + screen + ')').matches) {
1447                        if (t.css('position') != 'fixed') {
1448                            let top = 0;
1449                            if ($('#wpadminbar') && $('#wpadminbar')[0]) {
1450                                top += $('#wpadminbar').height();
1451                            }
1452                            t.css({
1453                                width: width,
1454                                position: 'fixed',
1455                                top: top,
1456                                'z-index': 9
1457                            });
1458                        }
1459                        if ($('.stoped-scroll-section', body).length) {
1460                            var room_position = $('.stoped-scroll-section', body).offset().top;
1461                            if ($(window).scrollTop() + t.innerHeight() >= room_position && t.css('position') == 'fixed') {
1462                                t.css({
1463                                    width: width,
1464                                    position: 'fixed',
1465                                    top: room_position - $(window).scrollTop() - t.innerHeight(),
1466                                    'z-index': 9
1467                                });
1468                            } else {
1469                                let top = 0;
1470                                if ($('#wpadminbar') && $('#wpadminbar')[0]) {
1471                                    top += $('#wpadminbar').height();
1472                                }
1473                                t.css({
1474                                    width: width,
1475                                    position: 'fixed',
1476                                    top: top,
1477                                    'z-index': 9
1478                                });
1479                            }
1480                        }
1481                    } else {
1482                        t.css({
1483                            position: '',
1484                            top: '',
1485                            width: 'auto',
1486                            'z-index': ''
1487                        })
1488                    }
1489                });
1490            });
1491            $('.hotel-target-book-mobile', body).each(function () {
1492                var t = $(this);
1493                $(window).on('scroll', function () {
1494                    if ($(window).scrollTop() >= 50 && window.matchMedia('(max-width: 991px)').matches) {
1495                        t.css('display', 'flex');
1496                    } else {
1497                        t.css('display', 'none');
1498                    }
1499                });
1500            });
1501        }, 1000);
1502    }).trigger('resize');
1503    $('[data-show-all]', body).each(function () {
1504        var t = $(this);
1505        var height = t.data('height');
1506        t.css('height', height);
1507    });
1508    body.on('click', '[data-show-target]', function (ev) {
1509        ev.preventDefault();
1510        var target = $(this).data('show-target');
1511        $('.fa', this).toggleClass('fa-caret-up fa-caret-down');
1512        if ($('.fa', this).hasClass('fa-caret-up')) {
1513            $('.text', this).html($(this).data('text-less'));
1514        } else {
1515            $('.text', this).html($(this).data('text-more'));
1516        }
1517        if ($('[data-show-all="' + target + '"]', body).hasClass('open')) {
1518            $('[data-show-all="' + target + '"]', body).css({
1519                height: $('[data-show-all="' + target + '"]', body).data('height')
1520            });
1521        } else {
1522            $('[data-show-all="' + target + '"]', body).css({
1523                height: ''
1524            });
1525        }
1526        $('[data-show-all="' + target + '"]', body).toggleClass('open');
1527    });
1528    $('.hotel-target-book-mobile .btn-mpopup', body).on('click', function (ev) {
1529        ev.preventDefault();
1530        $('.fixed-on-mobile', body).toggleClass('open').fadeToggle(300);
1531        $(body).addClass('st_overflow');
1532    });
1533    $('.fixed-on-mobile .close-icon', body).on('click', function (ev) {
1534        ev.preventDefault();
1535        $('.fixed-on-mobile', body).toggleClass('open').fadeToggle(300);
1536        $(body).removeClass('st_overflow');
1537    });
1538    $('.review-list', body).on('click', '.show-more', function (ev) {
1539        ev.preventDefault();
1540        var parent = $(this).closest('.comment');
1541        $(this).css('display', 'none');
1542        $('.review', parent).slideDown(200);
1543        $('.show-less', parent).css('display', 'block');
1544    });
1545    $('.review-list', body).on('click', '.show-less', function (ev) {
1546        ev.preventDefault();
1547        var parent = $(this).closest('.comment');
1548        $(this).css('display', 'none');
1549        $('.review', parent).slideUp(200);
1550        $('.show-more', parent).css('display', 'block');
1551    });
1552    // Availability
1553    $('.st-availability', body).each(function () {
1554        var t = $(this);
1555        var container = $('.st-calendar', t);
1556        var calendar = $('.calendar_input', container);
1557        var options = {
1558            parentEl: container,
1559            showCalendar: true,
1560            alwaysShow: true,
1561            autoUpdateInput: true,
1562            singleDatePicker: false,
1563            showTodayButton: false,
1564            autoApply: true,
1565            disabledPast: true,
1566            responSingle: true,
1567            widthCalendar: 750,
1568            onlyShowCurrentMonth: true,
1569            classNotAvailable: ['disabled', 'off'],
1570            enableLoading: true,
1571            showEventTooltip: true,
1572            fetchEvents: function (start, end, el, callback) {
1573                var events = [];
1574                if (el.flag_get_events) {
1575                    return false;
1576                }
1577                el.flag_get_events = true;
1578                el.container.find('.loader-wrapper').show();
1579                var data = {
1580                    action: calendar.data('action'),
1581                    start: start.format('YYYY-MM-DD'),
1582                    end: end.format('YYYY-MM-DD'),
1583                    post_id: calendar.data('room-id'),
1584                    security: st_params._s
1585                };
1586                $.post(st_params.ajax_url, data, function (respon) {
1587                    if (typeof respon === 'object') {
1588                        if (typeof respon.events === 'object') {
1589                            events = respon.events;
1590                        }
1591                    } else {
1592                        console.log('Can not get data');
1593                    }
1594                    callback(events, el);
1595                    el.flag_get_events = false;
1596                    el.container.find('.loader-wrapper').hide();
1597                }, 'json');
1598            }
1599        };
1600        if (typeof locale_daterangepicker == 'object') {
1601            options.locale = locale_daterangepicker;
1602        }
1603        calendar.daterangepicker(options, function (start, end, label) {});
1604        var dp = calendar.data('daterangepicker');
1605        dp.show();
1606    });
1607    /* Price range */
1608    function format_money($money) {
1609        // if (!$money) {
1610        //     return st_params.free_text;
1611        // }
1612
1613        $money = st_number_format($money, st_params.booking_currency_precision, st_params.decimal_separator, st_params.thousand_separator);
1614        var $symbol = st_params.currency_symbol;
1615        var $money_string = '';
1616
1617        switch (st_params.currency_position) {
1618            case "right":
1619                $money_string = $money + $symbol;
1620                break;
1621            case "left_space":
1622                $money_string = $symbol + " " + $money;
1623                break;
1624
1625            case "right_space":
1626                $money_string = $money + " " + $symbol;
1627                break;
1628            case "left":
1629            default:
1630                $money_string = $symbol + $money;
1631                break;
1632        }
1633
1634        return $money_string;
1635    }
1636
1637    function st_number_format(number, decimals, dec_point, thousands_sep) {
1638        number = (number + '')
1639            .replace(/[^0-9+\-Ee.]/g, '');
1640        var n = !isFinite(+number) ? 0 : +number,
1641            prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
1642            sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
1643            dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
1644            s = '',
1645            toFixedFix = function (n, prec) {
1646                var k = Math.pow(10, prec);
1647                return '' + (Math.round(n * k) / k)
1648                    .toFixed(prec);
1649            };
1650        // Fix for IE parseFloat(0.55).toFixed(0) = 0;
1651        s = (prec ? toFixedFix(n, prec) : '' + Math.round(n))
1652            .split('.');
1653        if (s[0].length > 3) {
1654            s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
1655        }
1656        if ((s[1] || '')
1657            .length < prec) {
1658            s[1] = s[1] || '';
1659            s[1] += new Array(prec - s[1].length + 1)
1660                .join('0');
1661        }
1662        return s.join(dec);
1663    }
1664    $(".price_range").each(function () {
1665        var t = $(this);
1666        var min = $(this).data('min');
1667        var max = $(this).data('max');
1668        var step = $(this).data('step');
1669        var value = $(this).val();
1670        var from = value.split(';');
1671        var prefix_symbol = $(this).data('symbol');
1672        var to = from[1];
1673        from = from[0];
1674        $(this).ionRangeSlider({
1675            min: min,
1676            max: max,
1677            type: 'double',
1678            prefix: prefix_symbol,
1679            prettify: false,
1680            step: step,
1681            onFinish: function (data) {
1682                t.trigger('st_ranger_price_change');
1683                set_price_range_val(data, $('input[name="price_range"]'));
1684                format_price_price_ranger(data);
1685            },
1686            from: from,
1687            to: to,
1688            force_edges: true,
1689        });
1690    });
1691    var rangeContainer = $('.sidebar-item.range-slider');
1692
1693    function format_price_price_ranger(data) {
1694
1695
1696        var min = rangeContainer.find('.price_range').data('min');
1697        var max = rangeContainer.find('.price_range').data('max');
1698        var convert_price_min = format_money(data.from);
1699        var convert_price_max = format_money(data.to);
1700        rangeContainer.find('.irs-from').text(convert_price_min);
1701        rangeContainer.find('.irs-to').text(convert_price_max);
1702
1703    }
1704
1705    function set_price_range_val(data, element) {
1706        var exchange = 1;
1707        var from = Math.round(parseInt(data.from) / exchange);
1708        var to = Math.round(parseInt(data.to) / exchange);
1709        var text = from + ";" + to;
1710        element.val(text);
1711    }
1712    /*Sidebar toggle*/
1713    if ($('.sidebar-item').length) {
1714        $('.sidebar-item').each(function () {
1715            var t = $(this);
1716            if (t.hasClass('open')) {
1717                t.find('.item-content').slideUp();
1718            }
1719        });
1720    }
1721    $('.sidebar-item .item-title').on('click', function () {
1722        var t = $(this);
1723        t.parent().toggleClass('open');
1724        t.parent().find('.item-content').slideToggle();
1725    });
1726    /* Clear radio button */
1727    $('.btn-clear-review-score').on('click', function () {
1728        var t = $(this);
1729        var parent = t.closest('ul');
1730        parent.find('input').prop('checked', false);
1731    });
1732    /* Load more checkbox item */
1733    if ($('.btn-more-item').length) {
1734        $('.btn-more-item').each(function () {
1735            var t = $(this);
1736            var parent = t.closest('.item-content');
1737            if (parent.find('ul li').length > 3) {
1738                t.show();
1739            }
1740            t.on('click', function () {
1741                var countLi = parent.find('ul li.hidden').length;
1742                var max = 3;
1743                if (countLi < 3) {
1744                    max = countLi;
1745                }
1746                for (var i = 0; i < max; i++) {
1747                    parent.find('ul li.hidden').eq(0).removeClass('hidden');
1748                }
1749                var countLi = parent.find('ul li.hidden').length;
1750                if (countLi <= 0) {
1751                    t.hide();
1752                }
1753            });
1754        });
1755    }
1756    $('.form-date-search', body).each(function () {
1757        var parent = $(this),
1758            date_wrapper = $('.date-wrapper', parent),
1759            check_in_input = $('.check-in-input', parent),
1760            check_out_input = $('.check-out-input', parent),
1761            check_in_out = $('.check-in-out', parent),
1762            check_in_render = $('.check-in-render', parent),
1763            check_out_render = $('.check-out-render', parent);
1764        var timepicker = parent.data('timepicker');
1765        if (typeof timepicker == 'undefined' || timepicker == '') {
1766            timepicker = false;
1767        } else {
1768            timepicker = true;
1769        }
1770        var options = {
1771            singleDatePicker: false,
1772            sameDate: false,
1773            autoApply: true,
1774            disabledPast: true,
1775            dateFormat: 'DD/MM/YYYY',
1776            customClass: '',
1777            widthSingle: 500,
1778            onlyShowCurrentMonth: true,
1779            timePicker: timepicker,
1780            timePicker24Hour: (st_params.time_format == '12h') ? false : true,
1781        };
1782        if (typeof locale_daterangepicker == 'object') {
1783            options.locale = locale_daterangepicker;
1784        }
1785        check_in_out.daterangepicker(options,
1786            function (start, end, label) {
1787                check_in_input.val(start.format(parent.data('format'))).trigger('change');
1788                $('#tp_hotel .form-date-search .check-in-input').val(start.format('YYYY-MM-DD')).trigger('change');
1789                check_in_render.html(start.format(parent.data('format'))).trigger('change');
1790                check_out_input.val(end.format(parent.data('format'))).trigger('change');
1791                $('#tp_hotel .form-date-search .check-out-input').val(end.format('YYYY-MM-DD')).trigger('change');
1792                check_out_render.html(end.format(parent.data('format'))).trigger('change');
1793                if (timepicker) {
1794                    check_in_input.val(start.format(parent.data('date-format'))).trigger('change');
1795                    $('.check-in-input-time', parent).val(start.format(parent.data('time-format'))).trigger('change');
1796                    check_out_input.val(end.format(parent.data('date-format'))).trigger('change');
1797                    $('.check-out-input-time', parent).val(end.format(parent.data('time-format'))).trigger('change');
1798                    $('.check-out-input-time', parent).val(end.format(parent.data('time-format'))).trigger('change');
1799                }
1800                check_in_out.trigger('daterangepicker_change', [start, end]);
1801                $(body).removeClass('st_overflow');
1802                if (window.matchMedia('(max-width: 767px)').matches) {
1803                    $('label', parent).hide();
1804                    $('.render', parent).show();
1805                    $('.check-in-wrapper span', parent).show();
1806                }
1807                console.log("date");
1808            });
1809        date_wrapper.on('click', function (e) {
1810            check_in_out.trigger('click');
1811        });
1812    });
1813    $('.form-date-search.form-date-car', body).each(function () {
1814        var parent = $(this),
1815            date_wrapper = $('.date-wrapper', parent),
1816            check_in_input = $('.check-in-input', parent),
1817            check_out_input = $('.check-out-input', parent),
1818            check_in_out = $('.check-in-out', parent),
1819            check_in_render = $('.check-in-render', parent),
1820            check_out_render = $('.check-out-render', parent);
1821        var timepicker = parent.data('timepicker');
1822        if (typeof timepicker == 'undefined' || timepicker == '') {
1823            timepicker = false;
1824        } else {
1825            timepicker = true;
1826        }
1827        var options = {
1828            singleDatePicker: false,
1829            sameDate: true,
1830            sameDateMulti: true,
1831            autoApply: true,
1832            disabledPast: true,
1833            dateFormat: 'DD/MM/YYYY',
1834            timeFormat: (st_params.time_format == '12h') ? 'hh:mm A' : 'HH:mm',
1835            customClass: '',
1836            widthSingle: 500,
1837            onlyShowCurrentMonth: true,
1838            timePicker: timepicker,
1839            timePicker24Hour: (st_params.time_format == '12h') ? false : true,
1840        };
1841        if (typeof locale_daterangepicker == 'object') {
1842            options.locale = locale_daterangepicker;
1843        }
1844        check_in_out.daterangepicker(options,
1845            function (start, end, label) {
1846
1847                $('#tp_hotel .form-date-search .check-in-input').val(start.format('YYYY-MM-DD')).trigger('change');
1848                $('#tp_hotel .form-date-search .check-out-input').val(end.format('YYYY-MM-DD')).trigger('change');
1849                check_in_input.val(start.format(parent.data('format'))).trigger('change');
1850                check_in_render.html(start.format(parent.data('format'))).trigger('change');
1851                check_out_input.val(end.format(parent.data('format'))).trigger('change');
1852                check_out_render.html(end.format(parent.data('format'))).trigger('change');
1853                if (timepicker) {
1854                    check_in_input.val(start.format(parent.data('date-format'))).trigger('change');
1855                    $('.check-in-input-time', parent).val(start.format(parent.data('time-format'))).trigger('change');
1856                    check_out_input.val(end.format(parent.data('date-format'))).trigger('change');
1857                    $('.check-out-input-time', parent).val(end.format(parent.data('time-format'))).trigger('change');
1858                }
1859                check_in_out.trigger('daterangepicker_change', [start, end]);
1860                $(body).removeClass('st_overflow');
1861                if (window.matchMedia('(max-width: 767px)').matches) {
1862                    $('label', parent).hide();
1863                    $('.render', parent).show();
1864                    $('.check-in-wrapper span', parent).show();
1865                }
1866
1867                if (st_params.caculator_price_single_ajax === 'on') {
1868                    if ($('.single-st_cars .car-booking-form').length > 0) {
1869                        date_wrapper.trigger('car-booking-form');
1870                    }
1871                }
1872            });
1873        date_wrapper.on('click', function (e) {
1874            check_in_out.trigger('click');
1875        });
1876    });
1877    //form date in tour
1878    $('.form-date-search-new', body).each(function () {
1879        var parent = $(this),
1880            date_wrapper = $('.date-wrapper', parent),
1881            check_in_input = $('.check-in-input', parent),
1882            check_out_input = $('.check-out-input', parent),
1883            check_in_out = $('.check-in-out', parent),
1884            check_in_render = $('.check-in-render', parent),
1885            check_out_render = $('.check-out-render', parent);
1886        var timepicker = parent.data('timepicker');
1887        if (typeof timepicker == 'undefined' || timepicker == '') {
1888            timepicker = false;
1889        } else {
1890            timepicker = true;
1891        }
1892        var customClass = parent.data('custom-class') || '';
1893        var options = {
1894            singleDatePicker: false,
1895            autoApply: true,
1896            disabledPast: true,
1897            dateFormat: 'DD/MM/YYYY',
1898            customClass: customClass,
1899            widthSingle: 500,
1900            onlyShowCurrentMonth: true,
1901            timePicker: timepicker,
1902            timePicker24Hour: (st_params.time_format == '12h') ? false : true,
1903        };
1904        if (typeof locale_daterangepicker == 'object') {
1905            options.locale = locale_daterangepicker;
1906        }
1907        check_in_out.daterangepicker(options,
1908            function (start, end, label) {
1909                check_in_input.val(start.format(parent.data('format'))).trigger('change');
1910                $('#tp_hotel .form-date-search .check-in-input').val(start.format('YYYY-MM-DD')).trigger('change');
1911                var html = start.format(parent.data('format')) + ' - ';
1912                check_in_render.html(html).trigger('change');
1913                check_out_input.val(end.format(parent.data('format'))).trigger('change');
1914                $('#tp_hotel .form-date-search .check-out-input').val(end.format('YYYY-MM-DD')).trigger('change');
1915                check_out_render.html(end.format(parent.data('format'))).trigger('change');
1916
1917                if (timepicker) {
1918                    check_in_input.val(start.format(parent.data('date-format'))).trigger('change');
1919                    $('.check-in-input-time', parent).val(start.format(parent.data('time-format'))).trigger('change');
1920                    check_out_input.val(end.format(parent.data('date-format'))).trigger('change');
1921                    $('.check-out-input-time', parent).val(end.format(parent.data('time-format'))).trigger('change');
1922                    $('.check-out-input-time', parent).val(end.format(parent.data('time-format'))).trigger('change');
1923
1924
1925                }
1926                check_in_out.trigger('daterangepicker_change', [start, end]);
1927                $(body).removeClass('st_overflow');
1928                if (window.matchMedia('(max-width: 767px)').matches) {
1929                    $('label', parent).hide();
1930                    $('.render', parent).show();
1931                    $('.check-in-wrapper span', parent).show();
1932                }
1933            });
1934        date_wrapper.on('click', function (e) {
1935            check_in_out.trigger('click');
1936        });
1937    });
1938    $('.form-date-hotel-room', body).each(function () {
1939        var parent = $(this),
1940            date_wrapper = $('.date-wrapper', parent),
1941            check_in_input = $('.check-in-input', parent),
1942            check_out_input = $('.check-out-input', parent),
1943            check_in_out = $('.check-in-out', parent),
1944            check_in_render = $('.check-in-render', parent),
1945            check_out_render = $('.check-out-render', parent),
1946            availabilityDate = $(this).data('availability-date');
1947        var minimum = check_in_out.data('minimum-day');
1948        if (typeof minimum !== 'number') {
1949            minimum = 0;
1950        }
1951        var options = {
1952            singleDatePicker: false,
1953            autoApply: true,
1954            disabledPast: true,
1955            dateFormat: 'DD/MM/YYYY',
1956            widthSingle: 500,
1957            onlyShowCurrentMonth: true,
1958            minimumCheckin: minimum,
1959            classNotAvailable: ['disabled', 'off'],
1960            enableLoading: true,
1961            showEventTooltip: true,
1962            fetchEvents: function (start, end, el, callback) {
1963                var events = [];
1964                if (el.flag_get_events) {
1965                    return false;
1966                }
1967                el.flag_get_events = true;
1968                el.container.find('.loader-wrapper').show();
1969                var data = {
1970                    action: check_in_out.data('action'),
1971                    start: start.format('YYYY-MM-DD'),
1972                    end: end.format('YYYY-MM-DD'),
1973                    post_id: check_in_out.data('room-id'),
1974                    security: st_params._s
1975                };
1976                $.post(st_params.ajax_url, data, function (respon) {
1977                    if (typeof respon === 'object') {
1978                        if (typeof respon.events === 'object') {
1979                            events = respon.events;
1980                        } else {
1981                            events = respon;
1982                        }
1983                    } else {
1984                        console.log('Can not get data');
1985                    }
1986                    callback(events, el);
1987                    el.flag_get_events = false;
1988                    el.container.find('.loader-wrapper').hide();
1989                }, 'json');
1990            }
1991        };
1992
1993        if (typeof availabilityDate != 'undefined') {
1994            options['minDate'] = availabilityDate;
1995        }
1996
1997        if (typeof locale_daterangepicker == 'object') {
1998            options.locale = locale_daterangepicker;
1999        }
2000        check_in_out.daterangepicker(options,
2001            function (start, end, label) {
2002                check_in_input.val(start.format(parent.data('format'))).trigger('change');
2003                check_in_render.html(start.format(parent.data('format'))).trigger('change');
2004                check_out_input.val(end.format(parent.data('format'))).trigger('change');
2005                check_out_render.html(end.format(parent.data('format'))).trigger('change');
2006                if (st_params.caculator_price_single_ajax === 'on') {
2007                    if ($('.single-st_rental .single-room-form').length > 0) {
2008                        date_wrapper.trigger('rental-booking-form');
2009                    }
2010                }
2011            });
2012
2013
2014        date_wrapper.on('click', function (e) {
2015            check_in_out.trigger('click');
2016
2017        });
2018
2019
2020        check_in_out.on('apply.daterangepicker', function (ev, picker) {
2021            if (st_params.caculator_price_single_ajax === 'on') {
2022                if ($('.single-hotel_room .single-room-form').length > 0) {
2023                    $('.hotel-room-booking-form').trigger('hotel-room-booking-form');
2024                }
2025            }
2026
2027        });
2028    });
2029
2030    $('.form-extra-field').each(function () {
2031        var parent = $(this);
2032        $('.dropdown', parent).on('click', function (e) {
2033            var tab_exclude = [
2034                'tp_hotel',
2035                'bookingdc'
2036            ]
2037            if (tab_exclude.includes($(this).parents('.tab-pane').attr('id'))) {
2038                return;
2039            }
2040            var dropdown_menu = $('[aria-labelledby="' + $(this).attr('id') + '"]', parent);
2041            $('.form-extra-field').find('.dropdown-menu').not(dropdown_menu).slideUp(50);
2042            dropdown_menu.slideToggle(50);
2043            $(this).parent('.dropdown').find('.arrow').toggleClass('fa-angle-down fa-angle-up');
2044            if ($('.ovscroll').length) {
2045                $.fn.getNiceScroll && $('.ovscroll').getNiceScroll().resize();
2046            }
2047        });
2048        $('.arrow', parent).on('click', function (e) {
2049            var drop_down = $(this).closest('.dropdown');
2050            var dropdown_menu = $('[aria-labelledby="' + drop_down.find('.dropdown').attr('id') + '"]', parent);
2051            $('.form-extra-field').find('.dropdown-menu').not(dropdown_menu).slideUp(50);
2052            dropdown_menu.slideToggle(50);
2053            $(this).toggleClass('fa-angle-down fa-angle-up');
2054            if ($('.ovscroll').length) {
2055                $.fn.getNiceScroll && $('.ovscroll').getNiceScroll().resize();
2056            }
2057        });
2058        $('input[name="adult_number"]', parent).on('change', function () {
2059            var adults = parseInt($(this).val());
2060            var html = adults;
2061            if (typeof adults == 'number') {
2062                if (adults < 2) {
2063                    html = adults + ' ' + $('.render .adult', parent).data('text');
2064                } else {
2065                    html = adults + ' ' + $('.render .adult', parent).data('text-multi');
2066                }
2067            }
2068            $('.render .adult', parent).html(html);
2069        });
2070        $('input[name="adult_number"]', parent).trigger('change');
2071        $('input[name="child_number"]', parent).on('change', function () {
2072            var children = parseInt($(this).val());
2073            var html = children;
2074            if (typeof children == 'number') {
2075                if (children < 2) {
2076                    html = children + ' ' + $('.render .children', parent).data('text');
2077                } else {
2078                    html = children + ' ' + $('.render .children', parent).data('text-multi');
2079                }
2080            }
2081            $('.render .children', parent).html(html);
2082        });
2083        $('input[name="child_number"]', parent).trigger('change');
2084    });
2085    //form guest in tour
2086    $('.form-extra-field.field-guest-new').each(function () {
2087        var parent = $(this);
2088
2089        $('input[name="adult_number"]', parent).on('change', function () {
2090            var adults = parseInt($(this).val());
2091            var html = adults;
2092            if (typeof adults == 'number') {
2093                if (adults < 2) {
2094                    html = adults + ' ' + $('.render .adult', parent).data('text');
2095                } else {
2096                    html = adults + ' ' + $('.render .adult', parent).data('text-multi');
2097                }
2098            }
2099            $('.render .adult', parent).html(html);
2100            $('.render', parent).removeClass('hide');
2101            parent.find('label').first().hide();
2102        });
2103        //$('input[name="adult_number"]', parent).trigger('change');
2104        $('input[name="child_number"]', parent).on('change', function () {
2105            var children = parseInt($(this).val());
2106            var html = children;
2107            if (typeof children == 'number') {
2108                if (children < 2) {
2109                    html = children + ' ' + $('.render .children', parent).data('text');
2110                } else {
2111                    html = children + ' ' + $('.render .children', parent).data('text-multi');
2112                }
2113            }
2114            $('.render .children', parent).html(html);
2115            $('.render', parent).removeClass('hide');
2116            parent.find('label').first().hide();
2117        });
2118        // $('input[name="child_number"]', parent).trigger('change');
2119    });
2120    body.on('click', function (ev) {
2121        if ($(ev.target).closest('.form-extra-field').length == 0) {
2122            $('.form-extra-field .dropdown-menu').slideUp(50);
2123            $('.form-extra-field .arrow').removeClass('fa-angle-up').addClass('fa-angle-down');
2124        }
2125    });
2126    $('.form-more-extra', body).each(function () {
2127        var t = $(this),
2128            parent = t.closest('.form-more-extra');
2129        $('.dropdown', parent).on('click', function (ev) {
2130            ev.preventDefault();
2131            $('.extras', parent).slideToggle(200);
2132            $('.arrow', parent).toggleClass('fa-caret-up fa-caret-down');
2133        });
2134    });
2135    $('a[data-toggle="tab"][href="#map-tab"]').on('click', function (e) {
2136        e.preventDefault();
2137        loadMap('.st-map');
2138    });
2139
2140    function loadMap(el) {
2141        $(el, body).each(function () {
2142            var parent = $(this),
2143                mapEl = $('.google-map', parent);
2144            var style = mapEl.data('style');
2145            var data = {
2146                center: {
2147                    lat: parseFloat(mapEl.data().lat),
2148                    lng: parseFloat(mapEl.data().lng)
2149                },
2150                zoom: mapEl.data().zoom,
2151                disableDefaultUI: mapEl.data().disablecontrol,
2152                styles: mapStyles[style] ? mapStyles[style] : ''
2153            };
2154            var showcustomcontrol = mapEl.data('showcustomcontrol');
2155
2156            if (typeof (new google.maps.Map(mapEl.get(0), data)) === "undefined") {
2157                var map = new google.maps.Map(mapEl.get(0), data);
2158                new google.maps.Marker({
2159                    position: new google.maps.LatLng(mapEl.data().lat, mapEl.data().lng),
2160                    icon: mapEl.data().icon,
2161                    map: map,
2162                });
2163                if (showcustomcontrol) {
2164                    customControlGoogleMap(mapEl, map);
2165                }
2166            }
2167        });
2168    }
2169
2170    function initPanoDetal(lat_center, lng_center) {
2171        const panorama = new google.maps.StreetViewPanorama(
2172            document.getElementById("list_map"), {
2173                position: {
2174                    lat: lat_center,
2175                    lng: lng_center
2176                },
2177                addressControlOptions: {
2178                    position: google.maps.ControlPosition.BOTTOM_CENTER,
2179                },
2180                linksControl: false,
2181                panControl: false,
2182                enableCloseButton: false,
2183            }
2184        );
2185    }
2186    $('.st-map', body).each(function () {
2187        var parent = $(this),
2188            mapEl = $('.google-map', parent),
2189            mapData = mapEl.data('data_show'),
2190            lat_center = mapEl.data('lat'),
2191            lng_center = mapEl.data('lng'),
2192            data_zoom = mapEl.data('zoom'),
2193            mapIcon = mapEl.data('icon'),
2194            street_views = mapEl.data('street_views');
2195        if (street_views == 'on') {
2196            window.initPano = initPanoDetal(lat_center, lng_center);
2197        } else {
2198            initMapDetail(mapEl, mapData, lat_center, lng_center, data_zoom, mapIcon);
2199        }
2200
2201    });
2202
2203
2204    /*Destination selection*/
2205    $('.field-detination').each(function () {
2206        var parent = $(this);
2207        var dropdown_menu = $('.dropdown-menu', parent);
2208        $('li', dropdown_menu).on('click', function () {
2209            var target = $(this).closest('ul.dropdown-menu').attr('aria-labelledby');
2210            var focus = parent.find('#' + target);
2211            $('.destination', focus).text($(this).find('span').text());
2212            $('input[name="location_name"]', focus).val($(this).find('span').text());
2213            $('input.location_name', focus).val($(this).find('span').text());
2214            $('input[name="location_id"]', focus).val($(this).data('value'));
2215            $('input.location_id', focus).val($(this).data('value'));
2216            if (window.matchMedia('(max-width: 767px)').matches) {
2217                $('label', focus).hide();
2218                $('.render', focus).show();
2219            }
2220            dropdown_menu.slideUp(50);
2221        });
2222    });
2223    /*Tour type selection*/
2224    $('.field-tour-type').each(function () {
2225        var parent = $(this);
2226        var dropdown_menu = $('.dropdown-menu', parent);
2227        $('li', dropdown_menu).on('click', function () {
2228            var target = $(this).closest('ul.dropdown-menu').attr('aria-labelledby');
2229            var focus = parent.find('#' + target);
2230            $('.tour-type', focus).text($(this).find('span').text());
2231            $('input[name="taxonomy[st_tour_type]"]', focus).val($(this).data('value'));
2232
2233            if (window.matchMedia('(max-width: 767px)').matches) {
2234                $('label', focus).hide();
2235                $('.render', focus).show();
2236            }
2237            dropdown_menu.slideUp(50);
2238        });
2239    });
2240    /*Tour Duration selection*/
2241    $('.field-durations').each(function () {
2242        var parent = $(this);
2243        var dropdown_menu = $('.dropdown-menu', parent);
2244        $('li', dropdown_menu).on('click', function () {
2245            var target = $(this).closest('ul.dropdown-menu').attr('aria-labelledby');
2246            var focus = parent.find('#' + target);
2247            $('.durations', focus).text($(this).find('span').text());
2248
2249            $('input[name="taxonomy[durations]"]', focus).val($(this).data('value'));
2250            if (window.matchMedia('(max-width: 767px)').matches) {
2251                $('label', focus).hide();
2252                $('.render', focus).show();
2253            }
2254            dropdown_menu.slideUp(50);
2255        });
2256    });
2257    $('.st-search-form-tour .st-price-field').each(function () {
2258        var parent = $(this);
2259        var dropdown_menu = $('.dropdown-menu', parent);
2260        $('.dropdown', parent).on('click', function () {
2261            var priceInput = parent.find('input[name="price_range"]').val();
2262            var arrayPrice = priceInput.split(";");
2263            var minPrice = arrayPrice[0];
2264            var maxPrice = arrayPrice[1];
2265            $('.render .price-min', parent).html(minPrice);
2266            $('.render .price-max', parent).html(maxPrice);
2267            $('.render', parent).removeClass('hide');
2268            $('.label', parent).hide();
2269        })
2270    });
2271
2272    $('.st-search-form-tour .st-price-field input[name="price_range"]').on('st_ranger_price_change', function () {
2273        let t = $(this),
2274            parent = t.closest('.st-search-form-tour .st-price-field'),
2275            priceInput = t.val(),
2276            arrayPrice = priceInput.split(";"),
2277            minPrice = arrayPrice[0],
2278            maxPrice = arrayPrice[1];
2279        $('.render .price-min', parent).html(minPrice);
2280        $('.render .price-max', parent).html(maxPrice);
2281    });
2282    /* nicescroll */
2283    $('.ovscroll').each(function () {
2284        $.fn.niceScroll && $(this).niceScroll();
2285    });
2286    $('.map-view-popup .col-left-map').each(function () {
2287        $.fn.niceScroll && $(this).niceScroll();
2288    });
2289    /*Filter mobile click*/
2290    $('.toolbar-action-mobile .btn-from-to').on('click', function (e) {
2291        e.preventDefault();
2292        window.scrollTo({
2293            top: '46',
2294        });
2295        $('.sidebar-filter').fadeIn();
2296        $('.top-filter').fadeIn();
2297        $('.sidebar-filter .sidebar-search-form').show();
2298        $('.sidebar-filter .sidebar-item-wrapper').hide();
2299        $('.sidebar-filter .form-date-search').hide();
2300        $('html, body').css({
2301            overflow: 'hidden'
2302        });
2303    });
2304    $('.toolbar-action-mobile .btn-filter').on('click', function (e) {
2305        e.preventDefault();
2306        window.scrollTo({
2307            top: '46',
2308        });
2309        $('.sidebar-filter').fadeIn();
2310        $('.top-filter').fadeIn();
2311        $('.sidebar-filter .sidebar-item-wrapper').fadeIn();
2312        $('.sidebar-filter .sidebar-search-form').hide();
2313        $('html, body').css({
2314            overflow: 'hidden'
2315        });
2316    });
2317    $('.toolbar-action-mobile .btn-sort').on('click', function (e) {
2318        e.preventDefault();
2319        $('.sort-menu-mobile').fadeIn();
2320    });
2321    $('.toolbar-action-mobile .btn-map').on('click', function (e) {
2322        e.preventDefault();
2323        window.scrollTo({
2324            top: '46',
2325        });
2326        $('.page-half-map .col-right').show();
2327        $('.full-map .full-map-item').show();
2328        $('html, body').css({
2329            overflow: 'hidden'
2330        });
2331    });
2332    $('.sidebar-filter .close-filter').on('click', function () {
2333        $(this).closest('.sidebar-filter').fadeOut(function () {
2334            $('html, body').css({
2335                overflow: 'auto'
2336            });
2337        });
2338    });
2339    $('.top-filter .close-filter').on('click', function () {
2340        $(this).closest('.top-filter').fadeOut(function () {
2341            $('html, body').css({
2342                overflow: 'auto'
2343            });
2344        });
2345    });
2346    $('.sort-menu-mobile .close-filter').on('click', function () {
2347        $(this).closest('.sort-menu-mobile').fadeOut();
2348    });
2349    $('.page-half-map .close-half-map').on('click', function () {
2350        $(this).closest('.col-right').hide();
2351        $('html, body').css({
2352            overflow: 'auto'
2353        });
2354        if ($('#btn-show-map-mobile').length) {
2355            $('#btn-show-map-mobile').prop('checked', false);
2356        }
2357    });
2358    $('.full-map .close-map').on('click', function () {
2359        $(this).closest('.full-map').hide();
2360        $('html, body').css({
2361            overflow: 'auto'
2362        });
2363    });
2364    $(window).on('resize', function () {
2365        if (window.matchMedia('(min-width: 768px)').matches) {
2366            if ($('.full-map-item').length) {
2367                if (!$('.full-map-item').is(':visible')) {
2368                    $('.full-map-item').attr('style', '');
2369                }
2370            }
2371            if ($('.st-hotel-result .sidebar-filter').length) {
2372                if (!$('.st-hotel-result .sidebar-filter').is(':visible')) {
2373                    $('.st-hotel-result .sidebar-filter').attr('style', '');
2374                }
2375            }
2376            if ($('.st-hotel-result .top-filter').length) {
2377                if (!$('.st-hotel-result .top-filter').is(':visible')) {
2378                    $('.st-hotel-result .top-filter').attr('style', '');
2379                }
2380            }
2381        }
2382        if (window.matchMedia('(min-width: 992px)').matches) {
2383            if ($('.page-half-map .col-right').length) {
2384                if (!$('.page-half-map .col-right').is(':visible') && $('#btn-show-map').is(':checked')) {
2385                    $('.page-half-map .col-right').attr('style', '');
2386                }
2387            }
2388        }
2389        if (window.matchMedia('(max-width: 991px)').matches) {
2390            if ($('.page-half-map .col-right').length) {
2391                if ($('.page-half-map .col-right').is(':visible')) {
2392                    $('.page-half-map .col-right').attr('style', '');
2393                }
2394            }
2395            if ($('.page-half-map .col-left').length) {
2396                if ($('.page-half-map .col-left').is(':visible')) {
2397                    $.fn.getNiceScroll && $('.page-half-map .col-left').getNiceScroll().remove();
2398                }
2399            }
2400        }
2401    });
2402    /* On/Off map */
2403    //Check scroll page
2404    /*jQuery(function($) {
2405     if (window.matchMedia('(min-width: 991px)').matches) {
2406     var c  = 0;
2407     var c1 = 0;
2408     $(window).on('scroll',function (event) {
2409     if ($('#btn-show-map').is(':checked') && $('.page-half-map').length) {
2410     var scroll = $(window).scrollTop();
2411     var topEl  = $('.page-half-map').offset().top;
2412     var colLeft = $('.page-half-map .col-left').height();
2413     var divResult = $('#modern-search-result').height();
2414     if (scroll >= topEl - 1 && scroll != 0) {
2415     if (c == 0) {
2416     if(divResult >= colLeft) {
2417     /!*window.scrollTo({
2418     top: topEl,
2419     behavior: 'auto'
2420     });*!/
2421     $('.page-half-map').addClass('static').find('.col-left').niceScroll();
2422     }
2423     }
2424     } else {
2425     $('.page-half-map').removeClass('static');
2426     if (c != 2) {
2427     c = 0;
2428     $('.page-half-map').find('.col-left').getNiceScroll().remove();
2429     } else {
2430     if (c1 == 0) {
2431     if (scroll < topEl - 100) {
2432     c = 0;
2433     $('.page-half-map').find('.col-left').animate({scrollTop: 0});
2434     c1 = 1;
2435     }
2436     }
2437     }
2438     }
2439     }
2440     });
2441     $('.page-half-map .col-left').on('scroll',function (event) {
2442     if ($('#btn-show-map').is(':checked')) {
2443     var t = $(this);
2444     if (t.scrollTop() <= 1) {
2445     c = 0;
2446     if (c == 0) {
2447     $('.page-half-map').removeClass('static').find('.col-left').getNiceScroll().remove();
2448     }
2449     } else if (typeof t.getNiceScroll()[0] != 'undefined') {
2450     if (t.getNiceScroll()[0].page.maxh <= t.scrollTop()) {
2451     $('.page-half-map').removeClass('static').find('.col-left').getNiceScroll().remove();
2452     c  = 2;
2453     c1 = 0;
2454     }
2455     }
2456     }
2457     });
2458     }
2459     });*/
2460    if ($('.payment-form .payment-item').length) {
2461        $('.payment-form .payment-item').eq(0).find('.st-icheck-item input[type="radio"]').prop('checked', true);
2462        $('.payment-form .payment-item').eq(0).find('.dropdown-menu').slideDown();
2463    }
2464    $('.payment-form .payment-item').each(function (l, i) {
2465        var parent = $(this);
2466        $('.st-icheck-item input[type="radio"]', parent).on('change', function () {
2467            $('.payment-form .payment-item .dropdown-menu').slideUp();
2468            if ($(this).is(':checked')) {
2469                if ($('.dropdown-menu', parent).length) {
2470                    $('.dropdown-menu', parent).slideDown();
2471                }
2472            }
2473        });
2474    });
2475    $('.info-section .detail button').on('click', function () {
2476        var parent = $(this).closest('.detail');
2477        $('.detail-list', parent).slideToggle();
2478    });
2479    /*$('#st-login-form form').on('submit',function (ev) {
2480     ev.preventDefault();
2481     var form    = $(this),
2482     loader  = form.closest('.modal-content').find('.loader-wrapper'),
2483     message = $('.message-wrapper', form);
2484     var data    = form.serializeArray();
2485     data.push({
2486     name : 'security',
2487     value: st_params._s
2488     });
2489     message.html('');
2490     loader.show();
2491     $.post(st_params.ajax_url, data, function (respon) {
2492     if (typeof respon == 'object') {
2493     message.html(respon.message);
2494     if (respon.status == 1) {
2495     setTimeout(function () {
2496     window.location.href = respon.redirect;
2497     }, 2000);
2498     }
2499     }
2500     loader.hide();
2501     }, 'json');
2502     });*/
2503    /* Taxonomy advance search */
2504    var advFacilities = [];
2505    $('.advance-item.facilities input[type="checkbox"]').each(function () {
2506        var t = $(this);
2507        if (t.is(':checked')) {
2508            advFacilities.push(t.val());
2509        }
2510    });
2511    $('.advance-item.facilities input[type="checkbox"]').on('change', function () {
2512        var t = $(this);
2513        if (t.is(':checked')) {
2514            advFacilities.push(t.val());
2515        } else {
2516            var index = advFacilities.indexOf(t.val());
2517            if (index > -1) {
2518                advFacilities.splice(index, 1);
2519            }
2520        }
2521        t.closest('.facilities').find('.data_taxonomy').val(advFacilities.join(','));
2522    });
2523    $('#st-login-form form, #st-login-form-page form', body).on('submit', function (ev) {
2524        ev.preventDefault();
2525        var form = $(this),
2526            loader = form.closest('.modal-content').find('.loader-wrapper'),
2527            message = $('.message-wrapper', form);
2528        var data = form.serializeArray();
2529        data.push({
2530            name: 'security',
2531            value: st_params._s
2532        });
2533        message.html('');
2534        loader.show();
2535        $.post(st_params.ajax_url, data, function (respon) {
2536            if (typeof respon == 'object') {
2537                message.html(respon.message);
2538                setTimeout(function () {
2539                    message.html('');
2540                }, 1000);
2541                if (respon.status == 1) {
2542                    setTimeout(function () {
2543                        window.location.href = respon.redirect;
2544                    }, 200);
2545                }
2546            }
2547            loader.hide();
2548        }, 'json');
2549    });
2550    $('#st-register-form form', body).on('submit', function (ev) {
2551        ev.preventDefault();
2552        var form = $(this),
2553            loader = form.closest('.modal-content').find('.loader-wrapper'),
2554            message = $('.message-wrapper', form);
2555        var data = form.serializeArray();
2556        data.push({
2557            name: 'security',
2558            value: st_params._s
2559        });
2560        message.html('');
2561        loader.show();
2562        $.post(st_params.ajax_url, data, function (respon) {
2563            loader.hide();
2564            if (typeof respon == 'object') {
2565                message.html(respon.message);
2566                if (respon.status == 1) {
2567                    swal({
2568                        type: 'success',
2569                        title: respon.message,
2570                        text: respon.sub_message,
2571                        showConfirmButton: true,
2572                        confirmButtonText: respon.closeText,
2573                        onClose: function () {
2574                            $('#st-login-form', body).modal('show');
2575                            $('#st-register-form', body).modal('hide');
2576                        },
2577                        allowOutsideClick: false
2578                    });
2579                } else {
2580                    message.html(respon.message);
2581                    setTimeout(function () {
2582                        message.html('');
2583                    }, 1000);
2584                }
2585            }
2586        }, 'json');
2587    });
2588    $('#st-forgot-form form', body).on('submit', function (ev) {
2589        ev.preventDefault();
2590        var form = $(this),
2591            loader = form.closest('.modal-content').find('.loader-wrapper'),
2592            message = $('.message-wrapper', form);
2593        var data = form.serializeArray();
2594        data.push({
2595            name: 'security',
2596            value: st_params._s
2597        });
2598        message.html('');
2599        loader.show();
2600        $.post(st_params.ajax_url, data, function (respon) {
2601            if (typeof respon == 'object') {
2602                message.html(respon.message);
2603                setTimeout(function () {
2604                    message.html('');
2605                }, 2000);
2606            }
2607            loader.hide();
2608        }, 'json');
2609    });
2610    $('.select2-languages', body).select2({
2611        minimumResultsForSearch: -1
2612    });
2613    $('.select2-languages').on('change', function () {
2614        var target = $('option:selected', this).data('target');
2615        if (target) {
2616            window.location.href = target;
2617        }
2618    });
2619    $('.select2-currencies', body).select2({
2620        minimumResultsForSearch: -1
2621    });
2622    $('.select2-currencies').on('change', function () {
2623        var target = $('option:selected', this).data('target');
2624        if (target) {
2625            window.location.href = target;
2626        }
2627    });
2628    $('.form-check-availability-hotel .submit-group [name="submit"]', body).on('click', function (ev) {
2629        ev.preventDefault();
2630        var form = $(this).closest('.form-check-availability-hotel'),
2631            parent = form.parent(),
2632            loader = $('.loader-wrapper', parent),
2633            message = $('.message-wrapper', form);
2634        var has_fixed = form.closest('.fixed-on-mobile');
2635        if (has_fixed.hasClass('open')) {
2636            has_fixed.removeClass('open').hide();
2637            body.removeClass('st_overflow');
2638        }
2639        var data = form.serializeArray();
2640        data.push({
2641            name: 'security',
2642            value: st_params._s
2643        });
2644        message.html('');
2645        loader.show();
2646        $('.st-list-rooms .loader-wrapper').show();
2647        $.post(st_params.ajax_url, data, function (respon) {
2648            if (typeof respon == 'object') {
2649                if (respon.message) {
2650                    message.html(respon.message);
2651                }
2652                $('.st-list-rooms .fetch').html(respon.html);
2653                $('html, body').animate({
2654                    scrollTop: $('.st-list-rooms', body).offset().top - 150
2655                }, 500);
2656                $('[data-toggle="tooltip"]').tooltip();
2657            }
2658            $('.st-list-rooms .loader-wrapper').hide();
2659            loader.hide();
2660        }, 'json');
2661    });
2662    body.on('click', '.btn-show-price', function (ev) {
2663        ev.preventDefault();
2664        $('.form-check-availability-hotel .submit-group input[name="submit"]', body).trigger('click');
2665    });
2666    $('.shares .social-share').on('click', function (ev) {
2667        ev.preventDefault();
2668        $('.shares .share-wrapper').slideToggle(200);
2669    });
2670    $(document).on('click', '.btn_add_wishlist', function (event) {
2671        event.preventDefault();
2672        var $this = $(this);
2673        $.ajax({
2674            url: st_params.ajax_url,
2675            type: "POST",
2676            data: {
2677                action: "st_add_wishlist",
2678                data_id: $(this).data('id'),
2679                data_type: $(this).data('type')
2680            },
2681            dataType: "json",
2682        }).done(function (html) {
2683            $this.html(html.icon).attr("data-original-title", html.title)
2684        })
2685    });
2686    $('.st-like-review').on('click', function (e) {
2687        e.preventDefault();
2688        var me = $(this);
2689        var comment_id = me.data('id');
2690        $.ajax({
2691            url: st_params.ajax_url,
2692            type: 'post',
2693            dataType: 'json',
2694            data: {
2695                action: 'like_review',
2696                comment_ID: comment_id
2697            },
2698            success: function (res) {
2699                if (res.status) {
2700                    $('i', me).toggleClass('fa-thumbs-o-up fa-thumbs-o-down');
2701                    if ($('.booking-item-review-rate').length) {
2702                        $(me).toggleClass('fa-thumbs-o-up fa-thumbs-o-down');
2703                    }
2704                    if (typeof res.data.like_count != undefined) {
2705                        res.data.like_count = parseInt(res.data.like_count);
2706                        me.parent().find('span').html(res.data.like_count);
2707                    }
2708                }
2709            }
2710        });
2711    });
2712    $('.review-form .review-items .rates .fa').each(function () {
2713        var list = $(this).parent(),
2714            listItems = list.children(),
2715            itemIndex = $(this).index(),
2716            parentItem = list.parent();
2717
2718        $(this).on('mouseenter', function () {
2719            for (var i = 0; i < listItems.length; i++) {
2720                if (i <= itemIndex) {
2721                    $(listItems[i]).addClass('hovered');
2722                } else {
2723                    break;
2724                }
2725            }
2726            $(this).on('click', function () {
2727                for (var i = 0; i < listItems.length; i++) {
2728                    if (i <= itemIndex) {
2729                        $(listItems[i]).addClass('selected');
2730                    } else {
2731                        $(listItems[i]).removeClass('selected');
2732                    }
2733                };
2734                parentItem.children('.st_review_stats').val(itemIndex + 1);
2735            });
2736        });
2737
2738        $(this).on('mouseleave', function () {
2739            listItems.removeClass('hovered');
2740        });
2741    });
2742    $('.review-form .st-stars .fa').each(function () {
2743        var list = $(this).parent(),
2744            listItems = list.children(),
2745            itemIndex = $(this).index(),
2746            parentItem = list.parent();
2747        $(this).on('mouseenter', function () {
2748            for (var i = 0; i < listItems.length; i++) {
2749                if (i <= itemIndex) {
2750                    $(listItems[i]).addClass('hovered');
2751                } else {
2752                    break;
2753                }
2754            }
2755            $(this).on('click', function () {
2756                for (var i = 0; i < listItems.length; i++) {
2757                    if (i <= itemIndex) {
2758                        $(listItems[i]).addClass('selected');
2759                    } else {
2760                        $(listItems[i]).removeClass('selected');
2761                    }
2762                }
2763                parentItem.children('.st_review_stats').val(itemIndex + 1);
2764            });
2765        });
2766        $(this).on('mouseleave', function () {
2767            listItems.removeClass('hovered');
2768        });
2769    });
2770    /* Mobile location */
2771    $('.search-form-mobile .dropdown-menu li').on('click', function () {
2772        var t = $(this);
2773        var parent = t.closest('.dropdown');
2774        $('input[name="location_id"]', parent).val(t.data('value'));
2775        $('input[name="location_name"]', parent).val(t.find('span').text());
2776    });
2777    $(document).on('click', '.service-add-wishlist.login', function (event) {
2778        event.preventDefault();
2779        var t = $(this);
2780        t.addClass('loading');
2781        $.ajax({
2782            url: st_params.ajax_url,
2783            type: "POST",
2784            data: {
2785                action: "st_add_wishlist",
2786                data_id: t.data('id'),
2787                data_type: t.data('type')
2788            },
2789            dataType: "json",
2790        }).done(function (html) {
2791            if (html.status == 'true') {
2792                if (html.added == 'true') {
2793                    t.addClass('added');
2794                } else {
2795                    t.removeClass('added');
2796                }
2797                t.attr('title', html.title);
2798            }
2799            t.removeClass('loading');
2800        })
2801    });
2802    if ($('#contact-map-new').length) {
2803        initMapContactPage($('#contact-map-new'));
2804    }
2805    $('.field-detination .dropdown-menu').each(function () {
2806        $.fn.niceScroll && $(this).niceScroll({
2807            cursorcolor: "#a0a9b2",
2808        });
2809    });
2810    jQuery(function ($) {
2811        // Tour Package Popup
2812        if ($('.st-form-package').length) {
2813            $('.st-form-package').magnificPopup({
2814                removalDelay: 500,
2815                closeBtnInside: true,
2816                callbacks: {
2817                    beforeOpen: function () {
2818                        this.st.mainClass = this.st.el.attr('data-effect');
2819                    },
2820                    afterClose: function () {
2821                        if (st_params.caculator_price_single_ajax === 'on') {
2822                            if ($('.single-st_tours .st-form-package').length > 0) {
2823                                renderHtmlTour();
2824                            }
2825                            if ($('.single-st_activity .st-form-package').length > 0) {
2826                                renderHtmlActivity();
2827                            }
2828                        }
2829                    },
2830                },
2831                midClick: true,
2832                closeMarkup: '<button title="Close (Esc)" type="button" class="mfp-close"></button>',
2833            });
2834        }
2835        if (window.matchMedia('(max-width: 768px)').matches) {
2836            $('.as').slideDown();
2837        }
2838        if (window.matchMedia('(min-width: 991px)').matches) {
2839            var c = 0;
2840            var c1 = 0;
2841            $(window).on('scroll', function (event) {
2842                if ($('#btn-show-map').is(':checked') && $('.page-half-map').length) {
2843                    var scroll = $(window).scrollTop();
2844                    var topEl = $('.st-hotel-result').offset().top;
2845                    var colLeft = $('.page-half-map .col-left').height();
2846                    var divResult = $('#modern-search-result').height();
2847                    if (scroll >= topEl) {
2848                        if (divResult >= colLeft) {
2849                            if (c == 0) {
2850                                if ($("body").hasClass('rtl')) {
2851                                    if ($.fn.niceScroll) {
2852                                        $('.page-half-map').find('.col-left').niceScroll({
2853                                            railalign: 'left'
2854                                        });
2855                                    }
2856
2857                                } else {
2858                                    if ($.fn.niceScroll) {
2859                                        $('.page-half-map').find('.col-left').niceScroll();
2860                                    }
2861
2862                                }
2863                                c = 1;
2864                                $('.as').slideUp();
2865                            }
2866                        } else {
2867                            $.fn.getNiceScroll && $('.page-half-map').find('.col-left').getNiceScroll().remove();
2868                            $('.as').slideDown(50);
2869                        }
2870                    } else {
2871                        $('.as').slideUp();
2872                        if (c == 1) {
2873                            $.fn.getNiceScroll && $('.page-half-map').find('.col-left').animate({
2874                                scrollTop: 0
2875                            }).getNiceScroll().remove();
2876                            c = 0;
2877                        }
2878                    }
2879                }
2880            });
2881            $('.page-half-map .col-left').on('scroll', function (event) {
2882                var scroll = $(window).scrollTop();
2883                var topEl = $('.st-hotel-result').offset().top;
2884                if ($('#btn-show-map').is(':checked')) {
2885                    var t = $(this);
2886                    if (t.scrollTop() <= 0) {
2887                        if (c == 1) {
2888                            $.fn.getNiceScroll && $('.page-half-map').find('.col-left').getNiceScroll().remove();
2889                            window.scrollTo({
2890                                top: topEl - 1,
2891                            });
2892                            c = 0;
2893                        }
2894                    } else if (typeof t.getNiceScroll()[0] != 'undefined') {
2895                        if (t.getNiceScroll()[0].page.maxh <= t.scrollTop()) {
2896                            $('.page-half-map').find('.col-left').getNiceScroll().remove();
2897                            $('.as').slideDown('slow');
2898                            c = 1;
2899                        }
2900                    }
2901                }
2902            });
2903        }
2904    });
2905    $('.coupon-section form .btn').on('click', function (e) {
2906        e.preventDefault();
2907        var sform = $(this).closest('form');
2908        if ($('#field-coupon_code', sform).val() === '') {
2909            $('#field-coupon_code', sform).addClass('error');
2910        } else {
2911            $('#field-coupon_code', sform).removeClass('error');
2912            $(this).append('<i class="fa fa-spinner fa-spin"></i>');
2913            var data = {
2914                'action': 'apply_mdcoupon_function',
2915                'code': $('#field-coupon_code', sform).val()
2916            };
2917            $.post(st_params.ajax_url, data, function (respon, textStatus, xhr) {
2918                if (respon.status == 1) {
2919                    sform.trigger('submit');
2920                }
2921            }, 'json');
2922        }
2923    });
2924    $('.sidebar-widget h4:first-child').each(function () {
2925        $(this).wrap("<div class='sidebar-title'></div>");
2926    });
2927    if ($('#sticky-nav').length && window.matchMedia('(min-width: 991px)').matches) {
2928        var topElSearch = $('#sticky-nav').offset().top;
2929        var searchFormHeight = $('#sticky-nav').closest('.search-form-wrapper').outerHeight();
2930        $(window).on('resize', function () {
2931            var topElSearch = $('#sticky-nav').offset().top;
2932            var searchFormHeight = $('#sticky-nav').closest('.search-form-wrapper').outerHeight();
2933        });
2934        $(window).on('scroll', function (event) {
2935            var scroll = $(window).scrollTop();
2936            var top = 0;
2937            if ($('#wpadminbar').length) {
2938                top = $('#wpadminbar').height();
2939            }
2940            if (scroll > topElSearch - top) {
2941                $('#sticky-nav').closest('.search-form-wrapper').css({
2942                    height: searchFormHeight + 'px'
2943                });
2944                $('#sticky-nav').find('form').addClass('container');
2945                $('#sticky-nav').css({
2946                    top: top + 'px',
2947                    'margin-top': '0px'
2948                });
2949                $('#sticky-nav').addClass('sticky');
2950                $.fn.getNiceScroll && $('#sticky-nav .dropdown-menu').getNiceScroll().resize();
2951                $('#sticky-nav').addClass('small');
2952            } else {
2953                $('#sticky-nav').closest('.search-form-wrapper').css({
2954                    height: 'auto'
2955                });
2956                $('#sticky-nav').find('form').removeClass('container');
2957                $('#sticky-nav').css({
2958                    top: 'auto',
2959                    'margin-top': '50px'
2960                });
2961                $('#sticky-nav').removeClass('sticky');
2962                $.fn.getNiceScroll && $('#sticky-nav .dropdown-menu').getNiceScroll().resize();
2963                $('#sticky-nav').removeClass('small');
2964            }
2965        })
2966    }
2967    $('.st-number-wrapper').each(function () {
2968        var timeOut = 0;
2969        var t = $(this);
2970        var input = t.find('.st-input-number');
2971        input.after('<span class="prev"><svg width="18px" height="2px" viewBox="0 0 18 2" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n' +
2972            '    <!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->\n' +
2973            '    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">\n' +
2974            '        <g id="Tour_Detail_1" transform="translate(-1180.000000, -1085.000000)" stroke="#5E6D77" stroke-width="1.5">\n' +
2975            '            <g id="check-avai" transform="translate(1034.000000, 867.000000)">\n' +
2976            '                <g id="adults" transform="translate(0.000000, 184.000000)">\n' +
2977            '                    <g id="ico_subtract" transform="translate(147.000000, 35.000000)">\n' +
2978            '                        <path d="M0.5,0.038 L15.5,0.038" id="Shape"></path>\n' +
2979            '                    </g>\n' +
2980            '                </g>\n' +
2981            '            </g>\n' +
2982            '        </g>\n' +
2983            '    </g>\n' +
2984            '</svg></span>');
2985        input.before('<span class="next"><svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n' +
2986            '    <!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->\n' +
2987            '    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">\n' +
2988            '        <g id="Tour_Detail_1" transform="translate(-1258.000000, -1077.000000)" stroke="#5E6D77" stroke-width="1.5">\n' +
2989            '            <g id="check-avai" transform="translate(1034.000000, 867.000000)">\n' +
2990            '                <g id="adults" transform="translate(0.000000, 184.000000)">\n' +
2991            '                    <g id="ico_add" transform="translate(225.000000, 27.000000)">\n' +
2992            '                        <path d="M0.5,8 L15.5,8" id="Shape"></path>\n' +
2993            '                        <path d="M8,0.5 L8,15.5" id="Shape"></path>\n' +
2994            '                    </g>\n' +
2995            '                </g>\n' +
2996            '            </g>\n' +
2997            '        </g>\n' +
2998            '    </g>\n' +
2999            '</svg></span>');
3000        var min = input.data('min');
3001        var max = input.data('max');
3002        t.find('span').on("click", function () {
3003            var $button = $(this);
3004            numberButtonFunc($button);
3005        });
3006        t.find('span').on("touchstart", function (e) {
3007            $(this).trigger('click');
3008            e.preventDefault();
3009            var $button = $(this);
3010            timeOut = setInterval(function () {
3011                // numberButtonFunc($button);
3012            }, 150);
3013        }).on('mouseup mouseleave touchend', function () {
3014            clearInterval(timeOut);
3015        });
3016
3017        function numberButtonFunc($button) {
3018            var oldValue = $button.parent().find("input").val();
3019            var container = $button.closest('.form-guest-search');
3020            var total = 0;
3021            $('input[type="text"]', container).each(function () {
3022                total += parseInt($(this).val());
3023            });
3024            var newVal = oldValue;
3025            if ($button.hasClass('next')) {
3026                if (total < max) {
3027                    if (oldValue < max) {
3028                        newVal = parseFloat(oldValue) + 1;
3029                    } else {
3030                        newVal = max;
3031                    }
3032                } else {
3033					let html = `<div class="alert alert-danger"> Max of people is ${total} people`;
3034					$( '#form-booking-inpage .message-wrapper-2' ).append( html ).fadeTo( 5000, 1, () => {
3035						$( '#form-booking-inpage .message-wrapper-2 .alert' ).remove();
3036					} );
3037				}
3038            } else {
3039                if (oldValue > min) {
3040                    newVal = parseFloat(oldValue) - 1;
3041                } else {
3042                    newVal = min;
3043                }
3044            }
3045            $button.parent().find("input").val(newVal).trigger('change');
3046            $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.search-form').trigger('change');
3047            $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.form-check-availability-hotel').trigger('change');
3048            $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.single-room-form').trigger('change');
3049            if (window.matchMedia('(max-width: 767px)').matches) {
3050                $('#dropdown-1 label', $button.closest('.field-guest')).hide();
3051                $('#dropdown-1 .render', $button.closest('.field-guest')).show();
3052            }
3053        }
3054    });
3055    $('.btn-close-guest-form').on('click', function () {
3056        $('.field-guest  .dropdown-menu').slideUp(50);
3057    });
3058    $('.st-cut-text').each(function () {
3059        var t = $(this);
3060        if (t.text().length > 0) {
3061            var arr = t.text().trim().split(' ');
3062            console.log(arr);
3063        }
3064    });
3065    $('.booking-item-review-expand-more').on('click', function () {
3066        var t = $(this);
3067        t.closest('.booking-item-review-content').find('.booking-item-review-more').fadeIn();
3068        t.closest('.booking-item-review-content').find('.booking-item-review-expand-less').show();
3069        t.hide();
3070    });
3071    $('.booking-item-review-expand-less').on('click', function () {
3072        var t = $(this);
3073        t.closest('.booking-item-review-content').find('.booking-item-review-more').fadeOut();
3074        t.closest('.booking-item-review-content').find('.booking-item-review-expand-more').show();
3075        t.hide();
3076    });
3077    jQuery(function ($) {
3078        if (body.hasClass('rtl')) {
3079            var rtl_check = true;
3080        } else {
3081            var rtl_check = false;
3082        }
3083        $('.st-service-slider').each(function () {
3084            $(this).owlCarousel({
3085                loop: false,
3086                items: 4,
3087                margin: 20,
3088                responsiveClass: true,
3089                dots: false,
3090                rtl: rtl_check,
3091                responsive: {
3092                    0: {
3093                        items: 1,
3094                        nav: false,
3095                        margin: 15,
3096                        dots: true,
3097                    },
3098                    576: {
3099                        items: 2,
3100                        nav: false,
3101                        margin: 15,
3102                        dots: true,
3103                    },
3104                    992: {
3105                        items: 3,
3106                        nav: true,
3107                    },
3108                    1200: {
3109                        items: 4,
3110                        nav: true,
3111                    }
3112                }
3113            });
3114        });
3115
3116        $('.list-service-style2').each(function () {
3117            $(this).owlCarousel({
3118                loop: false,
3119                items: 3,
3120                margin: 20,
3121                responsiveClass: true,
3122                dots: true,
3123                rtl: rtl_check,
3124                responsive: {
3125                    0: {
3126                        items: 1,
3127                        nav: false,
3128                        margin: 15,
3129                    },
3130                    576: {
3131                        items: 2,
3132                        nav: false,
3133                        margin: 15,
3134                    },
3135                    992: {
3136                        items: 3,
3137                        nav: true,
3138                    },
3139                    1200: {
3140                        items: 3,
3141                        nav: true,
3142                    }
3143                }
3144            });
3145        });
3146        $('.list-service-style3').each(function () {
3147            $(this).owlCarousel({
3148                loop: false,
3149                items: 3,
3150                margin: 30,
3151                responsiveClass: true,
3152                dots: true,
3153                rtl: rtl_check,
3154                responsive: {
3155                    0: {
3156                        items: 1,
3157                        nav: false,
3158                        margin: 15,
3159                    },
3160                    576: {
3161                        items: 2,
3162                        nav: false,
3163                        margin: 15,
3164                    },
3165                    992: {
3166                        items: 3,
3167                        nav: true,
3168                    },
3169                    1200: {
3170                        items: 3,
3171                        nav: true,
3172                    }
3173                }
3174            });
3175        });
3176        $('.list-service-style4').each(function () {
3177            $(this).owlCarousel({
3178                loop: false,
3179                items: 3,
3180                margin: 30,
3181                responsiveClass: true,
3182                dots: true,
3183                rtl: rtl_check,
3184                nav: false,
3185                responsive: {
3186                    0: {
3187                        items: 1,
3188                        margin: 15,
3189                    },
3190                    576: {
3191                        items: 2,
3192                        margin: 15,
3193                    },
3194                    992: {
3195                        items: 3,
3196                    },
3197                    1200: {
3198                        items: 3,
3199                    }
3200                }
3201            });
3202        });
3203        $('.list-service-style5').each(function () {
3204            $(this).owlCarousel({
3205                loop: true,
3206                items: 3,
3207                margin: 30,
3208                responsiveClass: true,
3209                dots: false,
3210                nav: true,
3211                rtl: rtl_check,
3212                responsive: {
3213                    0: {
3214                        items: 1,
3215                        margin: 15,
3216                    },
3217                    576: {
3218                        items: 2,
3219                        margin: 15,
3220                    },
3221                    992: {
3222                        items: 3,
3223                    },
3224                    1200: {
3225                        items: 3,
3226                    }
3227                }
3228            });
3229        });
3230        $('.list-service-style6').each(function () {
3231            $(this).owlCarousel({
3232                loop: true,
3233                items: 3,
3234                margin: 30,
3235                responsiveClass: true,
3236                dots: true,
3237                nav: false,
3238                rtl: rtl_check,
3239                responsive: {
3240                    0: {
3241                        items: 1,
3242                        margin: 15,
3243                    },
3244                    576: {
3245                        items: 2,
3246                        margin: 15,
3247                    },
3248                    992: {
3249                        items: 3,
3250                    },
3251                    1200: {
3252                        items: 3,
3253                    }
3254                }
3255            });
3256        });
3257        $('.list-service-style7').each(function () {
3258            $(this).removeClass('row');
3259            $(this).addClass('owl-carousel');
3260            $(this).owlCarousel({
3261                loop: false,
3262                items: 3,
3263                margin: 30,
3264                responsiveClass: true,
3265                dots: false,
3266                rtl: rtl_check,
3267                nav: false,
3268                responsive: {
3269                    0: {
3270                        items: 1,
3271                        margin: 15,
3272                        dots: true,
3273                    },
3274                    768: {
3275                        items: 2,
3276                        margin: 30,
3277                        dots: true,
3278                    },
3279                    992: {
3280                        items: 3,
3281                        margin: 30,
3282                        dots: false,
3283                    },
3284                    1200: {
3285                        items: 3,
3286                    }
3287                }
3288            });
3289        });
3290        //Slider list of destination
3291        $('.list-destination-style8').each(function () {
3292            let t = $(this);
3293            var owl = $('.owl-carousel', t).owlCarousel({
3294                loop: true,
3295                margin: 30,
3296                items: 6,
3297                responsiveClass: true,
3298                dots: true,
3299                nav: true,
3300                rtl: rtl_check,
3301                responsive: {
3302                    0: {
3303                        items: 1,
3304                        nav: false,
3305                        margin: 15,
3306                    },
3307                    576: {
3308                        items: 2,
3309                        margin: 15,
3310                    },
3311                    767: {
3312                        items: 3,
3313                        nav: true,
3314                    },
3315                    992: {
3316                        items: 4,
3317                    },
3318                    1200: {
3319                        items: 6,
3320                        nav: true,
3321                    }
3322                }
3323            });
3324
3325        });
3326
3327        $('.st-service-rental-slider').each(function () {
3328            $(this).owlCarousel({
3329                loop: false,
3330                items: 3,
3331                margin: 20,
3332                rtl: rtl_check,
3333                responsiveClass: true,
3334                dots: true,
3335                responsive: {
3336                    0: {
3337                        items: 1,
3338                        nav: false,
3339                        margin: 15,
3340                    },
3341                    576: {
3342                        items: 2,
3343                        margin: 15,
3344                    },
3345                    992: {
3346                        items: 3,
3347                        nav: true,
3348                    },
3349                    1200: {
3350                        items: 3,
3351                        nav: true,
3352                    }
3353                }
3354            });
3355        });
3356
3357        $('.st-testimonial-new .style-3').each(function () {
3358            $(this).owlCarousel({
3359                loop: false,
3360                items: 4,
3361                rtl: rtl_check,
3362                margin: 30,
3363                responsiveClass: true,
3364                dots: true,
3365                nav: true,
3366                responsive: {
3367                    0: {
3368                        items: 1,
3369                        margin: 15,
3370                    },
3371                    767: {
3372                        items: 1,
3373                        margin: 15,
3374                    },
3375                    992: {
3376                        items: 2,
3377                    },
3378                    1200: {
3379                        items: 2,
3380                    }
3381                }
3382            });
3383        });
3384        $('.st-testimonial-new .style-4').each(function () {
3385            $(this).owlCarousel({
3386                loop: false,
3387                items: 1,
3388                responsiveClass: true,
3389                rtl: rtl_check,
3390                dots: true,
3391                responsive: {
3392                    0: {
3393                        items: 1,
3394
3395                    },
3396                    767: {
3397                        items: 1,
3398
3399                    },
3400                    992: {
3401                        items: 1,
3402                    },
3403                    1200: {
3404                        items: 1,
3405                    }
3406                }
3407            });
3408        });
3409        $('.st-testimonial-new .style-5').each(function () {
3410            $(this).owlCarousel({
3411                loop: false,
3412                rtl: rtl_check,
3413                items: 1,
3414                responsiveClass: true,
3415                dots: false,
3416                nav: true,
3417                responsive: {
3418                    0: {
3419                        items: 1,
3420
3421                    },
3422                    767: {
3423                        items: 1,
3424
3425                    },
3426                    992: {
3427                        items: 1,
3428                    },
3429                    1200: {
3430                        items: 1,
3431                    }
3432                }
3433            });
3434
3435            var parent = $(this);
3436            var data_image = $('.owl-item.active .item', parent).data('image');
3437            $('.st-testimonial-image img').attr("src", data_image);
3438
3439            $(this).on('translated.owl.carousel', function (event) {
3440                data_image = $('.owl-item.active .item', parent).data('image');
3441                $('.st-testimonial-image img').attr("src", data_image);
3442            });
3443
3444            /*var parent = $(this);
3445             var data_image = $('.owl-item.active .item',parent).data('image');
3446             $('.st-testimonial-image img').attr("src",data_image);
3447             $('.owl-nav button ',parent).on('click',function () {
3448             data_image = $('.owl-item.active .item',parent).data('image');
3449             $('.st-testimonial-image img').attr("src",data_image);
3450             })*/
3451        });
3452
3453        $(window).on('resize', function () {
3454            var screenWidth = $('body').width(),
3455                stTestimonialWidth = $('.st-testimonial-new').width(),
3456                leftMargin = (screenWidth - stTestimonialWidth) / 2;
3457
3458            $('.st-testimonial-image').css({
3459                'margin-left': '-' + leftMargin + 'px'
3460            });
3461
3462        }).trigger('resize');
3463
3464        $('.st-testimonial-slider').each(function () {
3465            $(this).owlCarousel({
3466                loop: false,
3467                items: 4,
3468                margin: 30,
3469                responsiveClass: true,
3470                dots: true,
3471                nav: false,
3472                responsive: {
3473                    0: {
3474                        items: 1,
3475                        margin: 15,
3476                    },
3477                    575: {
3478                        items: 2,
3479                        margin: 15,
3480                    },
3481                    992: {
3482                        items: 3,
3483                    },
3484                    1200: {
3485                        items: 3,
3486                    }
3487                }
3488            });
3489        });
3490
3491        $('.st-testimonial-solo-slider').each(function () {
3492            $(this).owlCarousel({
3493                loop: false,
3494                items: 1,
3495                margin: 30,
3496                responsiveClass: true,
3497                dots: true,
3498                nav: false
3499            });
3500        });
3501
3502        $('.owl-tour-program').each(function () {
3503            var parent = $(this).parent();
3504            var owl = $(this);
3505            owl.owlCarousel({
3506                loop: false,
3507                items: 3,
3508                margin: 20,
3509                responsiveClass: true,
3510                dots: false,
3511                nav: false,
3512                responsive: {
3513                    0: {
3514                        items: 1,
3515                        margin: 15,
3516                    },
3517                    992: {
3518                        items: 2,
3519                    },
3520                    1200: {
3521                        items: 3,
3522                    }
3523                }
3524            });
3525            $('.next', parent).on('click', function (ev) {
3526                ev.preventDefault();
3527                owl.trigger('next.owl.carousel');
3528            });
3529            $('.prev', parent).on('click', function (ev) {
3530                ev.preventDefault();
3531                owl.trigger('prev.owl.carousel');
3532            });
3533            owl.on('resized.owl.carousel', function () {
3534                setTimeout(function () {
3535                    if ($('.ovscroll').length) {
3536                        $.fn.getNiceScroll && $('.ovscroll').getNiceScroll().resize();
3537                    }
3538                }, 1000);
3539            });
3540        });
3541        $('.owl-tour-program-7').each(function () {
3542            var parent = $(this).parent();
3543            var owl = $(this);
3544            owl.owlCarousel({
3545                loop: false,
3546                items: 1,
3547                margin: 0,
3548                responsiveClass: true,
3549                dots: false,
3550                nav: true,
3551                responsive: {
3552                    0: {
3553                        items: 1,
3554                    },
3555                    992: {
3556                        items: 1,
3557                    },
3558                    1200: {
3559                        items: 1,
3560                    }
3561                }
3562            });
3563            owl.on('resized.owl.carousel', function () {
3564                setTimeout(function () {
3565                    if ($('.ovscroll').length) {
3566                        $.fn.getNiceScroll && $('.ovscroll').getNiceScroll().resize();
3567                    }
3568                }, 1000);
3569            });
3570        });
3571
3572        /* BG Slider */
3573        if ($('.search-form-wrapper.slider').length) {
3574            var heightSlider = $('.search-form-wrapper.slider').outerHeight();
3575            $('.st-bg-slider').fotorama({
3576                height: heightSlider
3577            });
3578            $(window).on('resize', function () {
3579                if ($('.search-form-wrapper.slider').length) {
3580                    var heightSlider = $('.search-form-wrapper.slider').outerHeight();
3581                    $('.st-bg-slider').fotorama({
3582                        height: heightSlider
3583                    });
3584                }
3585            });
3586        }
3587
3588    });
3589    var iex = 0;
3590    $('.st-program-list').each(function () {
3591        var t = $(this);
3592        $('.item .header', t).on('click', function () {
3593            $('.st-program .expand').text($('.st-program .expand').data('text-more'));
3594            iex = 0;
3595            $('.item', t).removeClass('active');
3596            $(this).parent().toggleClass('active');
3597        });
3598    });
3599    $('.st-program .expand').on('click', function () {
3600        var t = $(this);
3601        if (iex == 0) {
3602            $('.st-program .st-program-list .item').addClass('active');
3603            t.text(t.data('text-less'));
3604            iex = 1;
3605        } else {
3606            $('.st-program .st-program-list .item').removeClass('active');
3607            t.text(t.data('text-more'));
3608            iex = 0;
3609        }
3610    });
3611    $('.st-faq .item').each(function () {
3612        var t = $(this);
3613        t.find('.header').on('click', function () {
3614            $('.st-faq .item').not(t).removeClass('active');
3615            t.toggleClass('active');
3616        });
3617    });
3618    $(".st-video-popup").each(function () {
3619        $(this).magnificPopup({
3620            type: 'iframe'
3621        })
3622    });
3623    $('.st-gallery-popup').on('click', function (e) {
3624        e.preventDefault();
3625        var gallery = $(this).attr('href');
3626        $(gallery).magnificPopup({
3627            delegate: 'a',
3628            type: 'image',
3629            gallery: {
3630                enabled: true
3631            },
3632        }).magnificPopup('open');
3633    });
3634    //zzz
3635    $('.st-single-tour .form-date-search', body).each(function () {
3636        var parent = $(this),
3637            date_wrapper = $('.date-wrapper', parent),
3638            check_in_input = $('.check-in-input', parent),
3639            check_out_input = $('.check-out-input', parent),
3640            check_in_out_input = $('.check-in-out-input', parent),
3641            check_in_render = $('.check-in-render', parent),
3642            check_out_render = $('.check-out-render', parent),
3643            sts_checkout_label = $('.sts-tour-checkout-label', parent),
3644            availabilityDate = $(this).data('availability-date');
3645
3646        var customClass = $('.date-wrapper', parent).data('custom-class') || '';
3647
3648        var options = {
3649            singleDatePicker: true,
3650            showCalendar: false,
3651            sameDate: true,
3652            autoApply: true,
3653            disabledPast: true,
3654            dateFormat: 'DD/MM/YYYY',
3655            enableLoading: true,
3656            showEventTooltip: true,
3657            classNotAvailable: ['disabled', 'off'],
3658            disableHightLight: true,
3659            customClass: customClass,
3660            fetchEvents: function (start, end, el, callback) {
3661                var events = [];
3662                if (el.flag_get_events) {
3663                    return false;
3664                }
3665                el.flag_get_events = true;
3666                el.container.find('.loader-wrapper').show();
3667                var data = {
3668                    action: check_in_out_input.data('action'),
3669                    start: start.format('YYYY-MM-DD'),
3670                    end: end.format('YYYY-MM-DD'),
3671                    //tour_id: check_in_out_input.data('tour-id'),
3672                    security: st_params._s
3673                };
3674                var postType = check_in_out_input.data('posttype');
3675                if (typeof postType !== 'undefined' && postType === 'st_activity') {
3676                    data['activity_id'] = check_in_out_input.data('tour-id');
3677                } else {
3678                    data['tour_id'] = check_in_out_input.data('tour-id');
3679                }
3680
3681                $.post(st_params.ajax_url, data, function (respon) {
3682                    if (typeof respon === 'object') {
3683                        if (typeof respon.events === 'object') {
3684                            events = respon.events;
3685                        } else {
3686                            events = respon;
3687                        }
3688                    } else {
3689                        console.log('Can not get data');
3690                    }
3691                    callback(events, el);
3692                    el.flag_get_events = false;
3693                    el.container.find('.loader-wrapper').hide();
3694                }, 'json');
3695            }
3696        };
3697
3698        if (typeof availabilityDate != 'undefined') {
3699            options['minDate'] = availabilityDate;
3700        }
3701
3702        if (typeof locale_daterangepicker == 'object') {
3703            options.locale = locale_daterangepicker;
3704        }
3705        check_in_out_input.daterangepicker(options,
3706            function (start, end, label, elmDate) {
3707                check_in_input.val(start.format(parent.data('format'))).trigger('change');
3708                check_out_input.val(end.format(parent.data('format'))).trigger('change');
3709                check_in_render.html(start.format(parent.data('format'))).trigger('change');
3710                check_out_render.html(end.format(parent.data('format'))).trigger('change');
3711                if (start.format(parent.data('format')).toString() == end.format(parent.data('format')).toString()) {
3712                    sts_checkout_label.hide();
3713                } else {
3714                    sts_checkout_label.show();
3715                }
3716                if (typeof elmDate !== 'undefined' && elmDate !== false) {
3717                    if ($('.st-single-tour').length > 0) {
3718                        if (elmDate.target.classList.contains('has_starttime')) {
3719                            ajaxSelectStartTime(check_in_out_input.data('tour-id'), start.format(parent.data('format')), end.format(parent.data('format')), '', check_in_out_input.data('posttype'));
3720                        } else {
3721                            $('#starttime_tour option').remove();
3722                            $('#starttime_box').parent().hide();
3723                        }
3724                    }
3725                }
3726                if (st_params.caculator_price_single_ajax === 'on') {
3727                    if ($('.single-st_tours').length > 0) {
3728                        date_wrapper.trigger('tours-booking-form');
3729                    }
3730
3731                    if ($('.single-st_activity').length > 0) {
3732                        date_wrapper.trigger('activity-booking-form');
3733                    }
3734
3735                }
3736
3737            });
3738        date_wrapper.on('click', function (e) {
3739            check_in_out_input.trigger('click');
3740        });
3741    });
3742    if ($('.logo').length) {
3743        var logoWidth = $('.logo').width();
3744        if ($('.has-mega-menu .mega-menu').length) {
3745            var stMegaWidth = $('.has-mega-menu .mega-menu .st-mega').first().outerWidth();
3746            $('.has-mega-menu .mega-menu').css({
3747                left: (logoWidth + 60) + 'px',
3748                width: stMegaWidth + 'px'
3749            });
3750            $('.has-mega-menu .mega-menu .st-mega').css({
3751                width: '100%'
3752            });
3753            $(window).on('resize', function () {
3754                var winDowsWidth = $('#header').width();
3755                if (winDowsWidth < (stMegaWidth + logoWidth + 130)) {
3756                    var megaWidth = winDowsWidth - (logoWidth + 130);
3757                    $('.has-mega-menu .mega-menu').css({
3758                        width: megaWidth + 'px',
3759                    });
3760                } else {
3761                    $('.has-mega-menu .mega-menu').css({
3762                        width: stMegaWidth + 'px',
3763                    });
3764                }
3765                if (window.matchMedia("(min-width: 992px)").matches) {
3766                    $('.has-mega-menu .mega-menu').show();
3767                } else {
3768                    $('.has-mega-menu .mega-menu').hide();
3769                }
3770            });
3771        }
3772    }
3773    var checkExWoo = 0;
3774    $('.booking-item-review-expand-new').on('click', function (e) {
3775        e.preventDefault();
3776        var t = $(this);
3777        var textMore = t.data('more');
3778        var textLess = t.data('hide');
3779        if (t.hasClass('collapsed')) {
3780            t.html(textLess);
3781        } else {
3782            if (checkExWoo == 0) {
3783                t.html(textLess);
3784                checkExWoo++;
3785            } else {
3786                t.html(textMore);
3787            }
3788        }
3789        t.closest('.booking-item-review-content').find('.booking-item-review-more').slideToggle();
3790    });
3791    if (typeof $('.player').YTPlayer === 'function') {
3792        $('.btn-play-video').on('click', function (e) {
3793            e.preventDefault();
3794            if (typeof player == 'undefined') {
3795                var player = jQuery(".player").YTPlayer({
3796                    align: "center,center"
3797                });
3798            }
3799            var t = $(this);
3800            if (t.hasClass('play')) {
3801                player.YTPPlay();
3802                t.removeClass('play')
3803            } else {
3804                player.YTPPause();
3805                t.addClass('play')
3806            }
3807        });
3808    }
3809    if ($('#starttime_hidden_load_form').length > 0) {
3810        $('#starttime_box').each(function () {
3811            var meS = $(this);
3812            var st_data_tour_id = $('#starttime_hidden_load_form').data('tourid');
3813            var st_data_starttime = $('#starttime_hidden_load_form').data('starttime');
3814            var st_data_checkin = $('#starttime_hidden_load_form').data('checkin');
3815            var st_data_checkout = $('#starttime_hidden_load_form').data('checkout');
3816            var st_posttype = $('#starttime_hidden_load_form').data('posttype');
3817            if (st_data_starttime != "" && typeof st_data_starttime !== 'undefined') {
3818                ajaxSelectStartTime(st_data_tour_id, st_data_checkin, st_data_checkout, st_data_starttime, st_posttype);
3819            }
3820        });
3821    }
3822
3823    function ajaxSelectStartTime(tour_id, check_in, check_out, select_starttime, posttype = 'st_tours') {
3824        var sparent = $('.fixed-on-mobile');
3825        var overlay = $('.loader-wrapper', sparent);
3826        var data = {
3827            check_in: check_in,
3828            check_out: check_out
3829        };
3830        if (posttype === 'st_activity') {
3831            data['action'] = 'st_get_starttime_activity_frontend';
3832            data['activity_id'] = tour_id;
3833        } else {
3834            data['action'] = 'st_get_starttime_tour_frontend';
3835            data['tour_id'] = tour_id;
3836        }
3837        overlay.hide();
3838        $.ajax({
3839            url: st_params.ajax_url,
3840            dataType: 'json',
3841            type: 'post',
3842            data: data,
3843            beforeSend: function () {
3844                overlay.show();
3845            },
3846            success: function (doc) {
3847                var i = 0;
3848                if (doc['data'] != null && doc['data'].length > 0) {
3849                    $('#starttime_tour option').remove();
3850                    $('#starttime_box').parent().show();
3851                    var te = '';
3852                    for (i = 0; i < doc['data'].length; i++) {
3853                        var op_disable = '';
3854                        if (doc['check'][i] == '-1') {
3855                            if (doc['data'][i] == select_starttime) {
3856                                te += '<option value="' + doc['data'][i] + '" selected ' + op_disable + '>' + doc['data'][i] + '</option>';
3857                            } else {
3858                                te += '<option value="' + doc['data'][i] + '" ' + op_disable + '>' + doc['data'][i] + '</option>';
3859                            }
3860                        } else {
3861                            if (doc['check'][i] == '0') {
3862                                //op_disable = 'disabled="disabled"';
3863                                if (doc['data'][i] == select_starttime) {
3864                                    te += '<option value="' + doc['data'][i] + '" selected ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.no_vacancy + ' )' + '</option>';
3865                                } else {
3866                                    te += '<option value="' + doc['data'][i] + '" ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.no_vacancy + ' )' + '</option>';
3867                                }
3868                            } else {
3869                                if (doc['data'][i] == select_starttime) {
3870                                    if (doc['check'][i] == '1') {
3871                                        te += '<option value="' + doc['data'][i] + '" selected ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.a_vacancy + ' )' + '</option>';
3872                                    } else {
3873                                        if (doc['check'][i] < 0) {
3874                                            te += '<option value="' + doc['data'][i] + '" selected ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.no_vacancy + ' )' + '</option>';
3875                                        } else {
3876                                            te += '<option value="' + doc['data'][i] + '" selected ' + op_disable + '>' + doc['data'][i] + ' ( ' + doc['check'][i] + ' ' + st_params.more_vacancy + ' )' + '</option>';
3877                                        }
3878                                    }
3879                                } else {
3880                                    if (doc['check'][i] == '1') {
3881                                        te += '<option value="' + doc['data'][i] + '" ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.a_vacancy + ' )' + '</option>';
3882                                    } else {
3883                                        if (doc['check'][i] < 0) {
3884                                            te += '<option value="' + doc['data'][i] + '" ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.no_vacancy + ' )' + '</option>';
3885                                        } else {
3886                                            te += '<option value="' + doc['data'][i] + '" ' + op_disable + '>' + doc['data'][i] + ' ( ' + doc['check'][i] + ' ' + st_params.more_vacancy + ' )' + '</option>';
3887                                        }
3888                                    }
3889                                }
3890                            }
3891                        }
3892                    }
3893                    $('#starttime_tour option').remove();
3894                    $('#starttime_tour').append(te);
3895                    overlay.hide();
3896                } else {
3897                    $('#starttime_box').parent().hide();
3898                    overlay.hide();
3899                }
3900            },
3901        });
3902    }
3903    $('.search-form-wrapper.slider a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
3904        var slideHeight = $('.search-form-wrapper.slider').outerHeight();
3905        var ft = $('.st-bg-slider').data('fotorama');
3906        if (typeof ft !== 'undefined') {
3907            ft.resize({
3908                height: slideHeight
3909            });
3910        }
3911
3912    });
3913    $('.st-list-of-multi-services').each(function () {
3914        var t = $(this);
3915        var dataTabShowVal = $('.st-list-dropdown .header', t).data('value');
3916        $('.multi-service-wrapper .tab-content.' + dataTabShowVal, t).show();
3917        $('.has-matchHeight', t).matchHeight({
3918            remove: true
3919        });
3920        $('.has-matchHeight', t).matchHeight();
3921    });
3922    $('.st-list-dropdown').each(function () {
3923        var t = $(this);
3924        var parent = t.closest('.st-list-of-multi-services');
3925        var currentTabList = t.find('.header').data('value');
3926        $('.list', t).find('li[data-value="' + currentTabList + '"]').hide();
3927        $('.header', t).on('click', function () {
3928            $('.list', t).toggle();
3929        });
3930        $('.list li', t).on('click', function () {
3931            var me = $(this);
3932            $('.list li', t).removeClass('active');
3933            me.addClass('active');
3934            var dataS = me.data('value');
3935            var dataArg = me.data('arg');
3936            var dataSName = me.text();
3937            $('.header span', t).text(dataSName);
3938            $('.header', t).attr('data-value', dataS);
3939            me.parent().hide();
3940            $.ajax({
3941                url: st_params.ajax_url,
3942                type: "GET",
3943                data: {
3944                    'action': "st_list_of_service_" + dataS,
3945                    'dataArg': dataArg,
3946                },
3947                dataType: "json",
3948                beforeSend: function () {
3949                    parent.find('.map-loading').html('<div class="st-loader"></div>');
3950                    parent.find('.map-loading').css('z-index', 99);
3951                    parent.find('.map-loading').show();
3952
3953                },
3954                error: function (jqXHR, textStatus, errorThrown) {},
3955                success: function (res) {
3956                    parent.find('.map-loading').html("");
3957                    parent.find('.map-loading').hide();
3958                },
3959                complete: function (xhr, status) {
3960
3961                    if (xhr.responseJSON) {
3962
3963                        parent.find('.multi-service-wrapper').html(xhr.responseJSON.html).hide().fadeIn(1500);
3964
3965                        $('.multi-service-wrapper .tab-content', parent).hide();
3966                        $('.multi-service-wrapper .tab-content.' + dataS, parent).show();
3967                        setTimeout(function () {
3968                            $('.multi-service-wrapper .tab-content .has-matchHeight', parent).matchHeight({
3969                                remove: true
3970                            });
3971                            $('.multi-service-wrapper .tab-content .has-matchHeight', parent).matchHeight();
3972                        }, 1000);
3973                        $('.list li', t).show();
3974                        $('.list', t).find('li[data-value="' + dataS + '"]').hide();
3975                    }
3976                    $('.st-service-slider').each(function () {
3977                        $(this).owlCarousel({
3978                            loop: false,
3979                            items: 4,
3980                            margin: 20,
3981                            responsiveClass: true,
3982                            dots: false,
3983                            responsive: {
3984                                0: {
3985                                    items: 1,
3986                                    nav: false,
3987                                    margin: 15,
3988                                    dots: true,
3989                                },
3990                                576: {
3991                                    items: 2,
3992                                    nav: false,
3993                                    margin: 15,
3994                                    dots: true,
3995                                },
3996                                992: {
3997                                    items: 3,
3998                                    nav: true,
3999                                },
4000                                1200: {
4001                                    items: 4,
4002                                    nav: true,
4003                                }
4004                            }
4005                        });
4006                    });
4007                }
4008            });
4009        })
4010        $(document).on('mouseup', function (e) {
4011            var container = t;
4012            if (!container.is(e.target) && container.has(e.target).length === 0) {
4013                container.find('.list').hide();
4014            }
4015        });
4016    });
4017    if ($('.search-form-wrapper.mix').length > 0) {
4018        if (window.matchMedia("(max-width: 991px)").matches) {
4019            var heightTabMix = [];
4020            $('.search-form-wrapper.mix .tab-content .tab-pane').each(function () {
4021                var idNameTabMix = $(this).attr('id');
4022                var tabMixShowEl = document.querySelector('.search-form-wrapper.mix .tab-pane#' + idNameTabMix),
4023                    tabMixWantedHeight = getHeightHiddenEl(tabMixShowEl);
4024                heightTabMix.push(tabMixWantedHeight);
4025            });
4026            if (heightTabMix.length) {
4027                var maxHeightTabMix = Math.max.apply(null, heightTabMix);
4028                var maxHeightPos = heightTabMix.indexOf(maxHeightTabMix);
4029                $('.search-form-wrapper.mix .tab-content .tab-pane').each(function (i, obj) {
4030                    if (i === maxHeightPos)
4031                        $(this).css('height', (maxHeightTabMix - 1) + 'px');
4032                    else
4033                        $(this).css('height', maxHeightTabMix + 'px');
4034                });
4035            }
4036        }
4037    }
4038})(jQuery);
4039
4040function initMapContactPage(mapEl) {
4041    var mapStylesContact = [{
4042            "elementType": "labels",
4043            "stylers": [{
4044                "visibility": "off"
4045            }]
4046        },
4047        {
4048            "featureType": "administrative",
4049            "elementType": "geometry",
4050            "stylers": [{
4051                "visibility": "off"
4052            }]
4053        },
4054        {
4055            "featureType": "administrative.land_parcel",
4056            "stylers": [{
4057                "visibility": "off"
4058            }]
4059        },
4060        {
4061            "featureType": "administrative.neighborhood",
4062            "stylers": [{
4063                "visibility": "off"
4064            }]
4065        },
4066        {
4067            "featureType": "poi",
4068            "stylers": [{
4069                "visibility": "off"
4070            }]
4071        },
4072        {
4073            "featureType": "road",
4074            "elementType": "labels.icon",
4075            "stylers": [{
4076                "visibility": "off"
4077            }]
4078        },
4079        {
4080            "featureType": "transit",
4081            "stylers": [{
4082                "visibility": "off"
4083            }]
4084        }
4085    ];
4086    var mapLat = mapEl.data('lat');
4087    var mapLng = mapEl.data('lng');
4088    var map = new google.maps.Map(document.getElementById('contact-map-new'), {
4089        zoom: 13,
4090        center: {
4091            lat: parseFloat(mapLat),
4092            lng: parseFloat(mapLng)
4093        },
4094        disableDefaultUI: true,
4095        styles: mapStylesContact
4096    });
4097    new google.maps.Marker({
4098        position: new google.maps.LatLng(mapLat, mapLng),
4099        icon: st_params.icon_contact_map,
4100        map: map,
4101    });
4102}
4103
4104function customControlGoogleMap(mapEl, map) {
4105    //==== Top Right area
4106    var topRightArea = document.createElement('div');
4107    topRightArea.className = 'google-control-top-right-area';
4108    var controlFullScreen = document.createElement('div');
4109    controlFullScreen.className = 'google-control-fullscreen google-custom-control';
4110    controlFullScreen.innerHTML = '<img src="' + st_list_map_params.icon_full_screen + '" alt="Full Screen"/>';
4111    topRightArea.appendChild(controlFullScreen);
4112    var controlCloseFullScreen = document.createElement('div');
4113    controlCloseFullScreen.className = 'google-control-closefullscreen google-custom-control hide';
4114    controlCloseFullScreen.innerHTML = '<img src="' + st_list_map_params.icon_close + '" alt="Full Screen"/>';
4115    topRightArea.appendChild(controlCloseFullScreen);
4116    var controlMyLocation = document.createElement('div');
4117    controlMyLocation.className = 'google-control-mylocation google-custom-control';
4118    controlMyLocation.innerHTML = '<img src="' + st_list_map_params.icon_my_location + '" alt="Full Screen"/>';
4119    topRightArea.appendChild(controlMyLocation);
4120    var controlStyles = document.createElement('div');
4121    controlStyles.className = 'google-control-styles google-custom-control';
4122    controlStyles.innerHTML = '<img src="' + st_list_map_params.icon_my_style + '" alt="Full Screen"/><div class="google-control-dropdown"><div class="item">Silver</div><div class="item">Retro</div><div class="item">Dark</div><div class="item">Night</div><div class="item">Aubergine</div></div>';
4123    topRightArea.appendChild(controlStyles);
4124    //==== Bottom Right area
4125    var bottomRightArea = document.createElement('div');
4126    bottomRightArea.className = 'google-control-bottom-right-area';
4127    var controlZoomIn = document.createElement('div');
4128    controlZoomIn.className = 'google-control-zoomin google-custom-control';
4129    controlZoomIn.innerHTML = '<img src="' + st_list_map_params.icon_zoom_in + '" alt="Full Screen"/>';
4130    bottomRightArea.appendChild(controlZoomIn);
4131    var controlZoomOut = document.createElement('div');
4132    controlZoomOut.className = 'google-control-zoomout google-custom-control';
4133    controlZoomOut.innerHTML = '<img src="' + st_list_map_params.icon_zoom_out + '" alt="Full Screen"/>';
4134    bottomRightArea.appendChild(controlZoomOut);
4135    map.controls[google.maps.ControlPosition.RIGHT_TOP].push(topRightArea);
4136    map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(bottomRightArea);
4137    controlFullScreen.addEventListener('click', function () {
4138        controlFullScreen.classList.add('hide');
4139        controlCloseFullScreen.classList.remove('hide');
4140        var element = map.getDiv();
4141        if (element.requestFullscreen) {
4142            element.requestFullscreen();
4143        }
4144        if (element.webkitRequestFullScreen) {
4145            element.webkitRequestFullScreen();
4146        }
4147        if (element.mozRequestFullScreen) {
4148            element.mozRequestFullScreen();
4149        }
4150    });
4151    controlCloseFullScreen.addEventListener('click', function () {
4152        controlFullScreen.classList.remove('hide');
4153        controlCloseFullScreen.classList.add('hide');
4154        if (document.exitFullscreen)
4155            document.exitFullscreen();
4156        else if (document.webkitExitFullscreen)
4157            document.webkitExitFullscreen();
4158        else if (document.mozCancelFullScreen)
4159            document.mozCancelFullScreen();
4160        else if (document.msExitFullscreen)
4161            document.msExitFullscreen();
4162    });
4163    controlMyLocation.addEventListener('click', function () {
4164        if (navigator.geolocation)
4165            navigator.geolocation.getCurrentPosition(function (pos) {
4166                var latlng = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
4167                map.setCenter(latlng);
4168                new google.maps.Marker({
4169                    position: latlng,
4170                    icon: mapEl.data().icon,
4171                    map: map
4172                });
4173            }, function (error) {
4174                console.log('Can not get your Location');
4175            });
4176    });
4177    controlZoomIn.addEventListener('click', function () {
4178        var current = map.getZoom();
4179        map.setZoom(current + 1);
4180    });
4181    controlZoomOut.addEventListener('click', function () {
4182        var current = map.getZoom();
4183        map.setZoom(current - 1);
4184    });
4185    controlStyles.addEventListener('click', function () {
4186        controlStyles.querySelector('.google-control-dropdown').classList.toggle('show');
4187    });
4188    var dropdownStyles = controlStyles.querySelector('.google-control-dropdown');
4189    var items = dropdownStyles.querySelectorAll('.item');
4190    for (var i = 0; i < items.length; i++) {
4191        items[i].addEventListener('click', function () {
4192            var style = item.textContent.toLowerCase();
4193            if (mapStyles[style]) {
4194                map.setOptions({
4195                    styles: mapStyles[style]
4196                });
4197            }
4198        });
4199    }
4200}
4201
4202function initMapDetail(mapEl, mapData, mapLat, mapLng, mapZoom, mapIcon) {
4203    // var popupPos = mapEl.data('popup-position');
4204    // if (mapData.length <= 0)
4205    mapData = mapEl.data('data_show');
4206    if (mapLat.length <= 0)
4207        mapLat = mapEl.data('lat');
4208    if (mapLng.length <= 0)
4209        mapLng = mapEl.data('lng');
4210    if (mapZoom.length <= 0)
4211        mapZoom = 16;
4212    if (mapIcon.length <= 0)
4213        mapIcon = mapEl.data('icon');
4214    var map = new google.maps.Map(document.getElementById('list_map'), {
4215        zoom: mapZoom,
4216        center: new google.maps.LatLng(mapLat, mapLng),
4217        mapTypeId: google.maps.MapTypeId.ROADMAP
4218    });
4219    var infowindow = new google.maps.InfoWindow({
4220        maxWidth: 400,
4221        maxHeight: 300
4222    });
4223    var marker, i;
4224
4225    if (typeof mapData != 'undefined' && Object.keys(mapData).length) {
4226        var markers = jQuery.map(mapData, function (location, i) {
4227            var icon = {
4228                url: mapData[i].icon_mk,
4229                size: {
4230                    width: 40,
4231                    height: 50
4232                },
4233                origin: new google.maps.Point(0, 0), // origin
4234            };
4235            marker = new google.maps.Marker({
4236                position: new google.maps.LatLng(parseFloat(mapData[i].lat), parseFloat(mapData[i].lng)),
4237                map: map,
4238                icon: icon,
4239                optimized: false
4240            });
4241
4242            bounds = new google.maps.LatLngBounds();
4243            var loc = new google.maps.LatLng(parseFloat(mapData[i].lat), parseFloat(mapData[i].lng));
4244            bounds.extend(loc);
4245            var ibOptions = {
4246                content: '',
4247                disableAutoPan: true,
4248                maxWidth: 0,
4249                zIndex: null,
4250                boxStyle: {
4251                    padding: "0px 0px 0px 0px",
4252                },
4253                closeBoxURL: "",
4254                cancelBubble: true,
4255                infoBoxClearance: new google.maps.Size(1, 1),
4256                isHidden: false,
4257                pane: "floatPane",
4258                enableEventPropagation: true,
4259                alignBottom: true
4260            };
4261            if (i < Object.keys(mapData).length) {
4262                google.maps.event.addListener(marker, 'click', (function (marker, i) {
4263                    return function () {
4264                        infowindow.setContent(mapData[i].content_html);
4265                        if ((mapData[i].lat != mapLat) && (mapData[i].lng != mapLng)) {
4266                            infowindow.open(map, marker);
4267                        }
4268
4269                    }
4270                })(marker, i));
4271            }
4272
4273        });
4274    }
4275
4276}
4277
4278function initHalfMap(mapEl, mapData, mapLat, mapLng, mapZoom, mapIcon) {
4279    var popupPos = mapEl.data('popup-position');
4280    if (mapData.length <= 0)
4281        mapData = mapEl.data('data_show');
4282    if (mapLat.length <= 0)
4283        mapLat = mapEl.data('lat');
4284    if (mapLng.length <= 0)
4285        mapLng = mapEl.data('lng');
4286    if (mapZoom.length <= 0)
4287        mapZoom = mapEl.data('zoom');
4288    if (mapIcon.length <= 0)
4289        mapIcon = mapEl.data('icon');
4290    var map = new google.maps.Map(mapEl.get(0), {
4291        zoom: mapZoom,
4292        center: {
4293            lat: parseFloat(mapLat),
4294            lng: parseFloat(mapLng)
4295        },
4296        disableDefaultUI: true
4297    });
4298    bounds = new google.maps.LatLngBounds();
4299    if (typeof mapData != 'undefined' && Object.keys(mapData).length) {
4300        var marker = [];
4301        var ib = [];
4302        var c = {};
4303        var markers = jQuery.map(mapData, function (location, i) {
4304            marker[i] = new google.maps.Marker({
4305                position: {
4306                    lat: parseFloat(location.lat),
4307                    lng: parseFloat(location.lng)
4308                },
4309                options: {
4310                    icon: mapIcon,
4311                    animation: google.maps.Animation.DROP
4312                },
4313                map: map
4314            });
4315            var loc = new google.maps.LatLng(parseFloat(location.lat), parseFloat(location.lng));
4316            bounds.extend(loc);
4317            var ibOptions = {
4318                content: '',
4319                disableAutoPan: true,
4320                maxWidth: 0,
4321                pixelOffset: new google.maps.Size(-135, -55),
4322                zIndex: null,
4323                boxStyle: {
4324                    padding: "0px 0px 0px 0px",
4325                    width: "270px",
4326                },
4327                closeBoxURL: "",
4328                cancelBubble: true,
4329                infoBoxClearance: new google.maps.Size(1, 1),
4330                isHidden: false,
4331                pane: "floatPane",
4332                enableEventPropagation: true,
4333                alignBottom: true
4334            };
4335            if (window.matchMedia("(min-width: 768px)").matches) {
4336                if (popupPos == 'right') {
4337                    ibOptions.pixelOffset = new google.maps.Size(35, -208);
4338                    ibOptions.alignBottom = false;
4339                }
4340            }
4341            jQuery(window).on('resize', function () {
4342                if (window.matchMedia("(min-width: 768px)").matches) {
4343                    if (popupPos == 'right') {
4344                        ibOptions.pixelOffset = new google.maps.Size(35, -208);
4345                        ibOptions.alignBottom = false;
4346                    }
4347                }
4348            });
4349            google.maps.event.addListener(marker[i], 'click', (function () {
4350                var source = location.content_html;
4351                var boxText = document.createElement("div");
4352                if (window.matchMedia("(min-width: 768px)").matches) {
4353                    if (popupPos == 'right') {
4354                        boxText.classList.add("right-box");
4355                    }
4356                }
4357                jQuery(window).on('resize', function () {
4358                    if (window.matchMedia("(min-width: 768px)").matches) {
4359                        if (popupPos == 'right') {
4360                            boxText.classList.add("right-box");
4361                        }
4362                    } else {
4363                        boxText.classList.remove("right-box");
4364                    }
4365                });
4366                boxText.style.cssText = "border-radius: 5px; background: #fff; padding: 0px;";
4367                boxText.innerHTML = source;
4368                ibOptions.content = boxText;
4369                var ks = Object.keys(c);
4370                if (ks.length) {
4371                    for (var j = 0; j < ks.length; j++) {
4372                        c[ks[j]].close();
4373                    }
4374                }
4375                ib[i] = new InfoBox(ibOptions);
4376                c[i] = ib[i];
4377                ib[i].open(map, this);
4378                map.panTo(ib[i].getPosition());
4379                google.maps.event.addListener(ib[i], 'domready', function () {
4380                    var closeInfoBox = document.getElementById("close-popup-on-map");
4381                    google.maps.event.addDomListener(closeInfoBox, 'click', function () {
4382                        ib[i].close();
4383                    });
4384                });
4385            }));
4386            return marker[i];
4387        });
4388        /*new MarkerClusterer(map, markers,
4389         {
4390         styles: [{
4391         height   : 36,
4392         url      : st_params.mclusmap,
4393         width    : 36,
4394         textColor: 'white',
4395         textSize : '16'
4396         }, {
4397         height   : 36,
4398         url      : st_params.mclusmap,
4399         width    : 36,
4400         textColor: 'white',
4401         textSize : '16'
4402         }, {
4403         height   : 36,
4404         url      : st_params.mclusmap,
4405         width    : 36,
4406         textColor: 'white',
4407         textSize : '16'
4408         }]
4409         });*/
4410        customControlGoogleMap(mapEl.get(0), map);
4411    }
4412    map.fitBounds(bounds);
4413    map.panToBounds(bounds);
4414    var listener = google.maps.event.addListener(map, "idle", function () {
4415        if (map.getZoom() > 16)
4416            map.setZoom(16);
4417        google.maps.event.removeListener(listener);
4418    });
4419}
4420/*Send email all in single service*/
4421(function ($) {
4422    'use strict';
4423    var body = $('body');
4424    $(".form-st-send-mail .st_send-mail-form").on('submit', function (e) {
4425        return false;
4426    });
4427    $('.form-st-send-mail .st_send-mail-form .sent-email-st').on('click', function (ev) {
4428        ev.preventDefault();
4429        var type_service = $("input[name=type_service]").val();
4430        var name_service = $("input[name=name_service]").val();
4431        var name_st = $("input[name=name_st]").val();
4432        var email_st = $("input[name=email_st]").val();
4433        var phone_st = $("input[name=phone_st]").val();
4434        var content_st = $("textarea[name=content_st]").val();
4435        var email_owl = $("input[name=email_owl]").val();
4436        $('.st-sent-mail-customer .loader-wrapper').show();
4437        $.ajax({
4438            url: st_params.ajax_url,
4439            type: "GET",
4440            data: {
4441                'action': "st_send_email_single_service",
4442                'type_service': type_service,
4443                'name_service': name_service,
4444                'name_st': name_st,
4445                'email_st': email_st,
4446                'phone_st': phone_st,
4447                'content_st': content_st,
4448                'email_owl': email_owl
4449            },
4450            dataType: "json",
4451            beforeSend: function () {},
4452            error: function (jqXHR, textStatus, errorThrown) {},
4453            success: function (res) {
4454
4455            },
4456            complete: function (xhr, status) {
4457
4458                if (xhr.responseJSON.status != 0) {
4459                    var mess = '<div class="ccv-success"><div class="content-message">' + xhr.responseJSON.message + '</div></div>';
4460                    $('.form-st-send-mail .st_send-mail-form').html(mess);
4461                    $('.st-sent-mail-customer .loader-wrapper').hide();
4462                } else {
4463                    var mess = '<div class="alert alert-danger"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' + xhr.responseJSON.message + '</div>';
4464                    $('.form-st-send-mail .message-wrapper-sendemail').html(mess);
4465                    $('.st-sent-mail-customer .loader-wrapper').hide();
4466                }
4467            }
4468        });
4469    });
4470})(jQuery);
4471
4472(function ($) {
4473    // single hotel room booking ajax
4474    $('form.hotel-room-booking-form').on('click', 'button.btn-book-ajax', function (e) {
4475        e.preventDefault();
4476        var form = $('form.hotel-room-booking-form');
4477        var data = $('form.hotel-room-booking-form').serializeArray();
4478        var loadingSubmit = form.find('button[name=submit]');
4479        $(loadingSubmit).find("i.fa-spin").removeClass("hide");
4480        data.push({
4481            name: 'security',
4482            value: st_params._s
4483        });
4484        $('div.message-wrapper').html("");
4485        $.ajax({
4486            url: st_params.ajax_url,
4487            method: "post",
4488            dataType: 'json',
4489            data: data,
4490            beforeSend: function () {
4491                $('div.message-wrapper').html("");
4492            },
4493            success: function (res) {
4494                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4495                if (res) {
4496                    if (res.status) {
4497                        if (res.redirect) {
4498                            window.location = res.redirect;
4499                        }
4500                    } else {
4501                        if (res.message) {
4502                            $('div.message-wrapper').html(res.message);
4503                        }
4504                    }
4505                }
4506            },
4507            error: function (err) {
4508                $('div.message-wrapper').html("");
4509                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4510            }
4511        });
4512    });
4513
4514    // activity booking ajax
4515    $('form.activity-booking-form').on('click', 'button.btn-book-ajax', function (e) {
4516        e.preventDefault();
4517        var form = $('form.activity-booking-form');
4518        var data = $('form.activity-booking-form').serializeArray();
4519        var loadingSubmit = form.find('button[name=submit]');
4520        $(loadingSubmit).find("i.fa-spin").removeClass("hide");
4521        data.push({
4522            name: 'security',
4523            value: st_params._s
4524        });
4525        $('div.message-wrapper').html("");
4526        $.ajax({
4527            url: st_params.ajax_url,
4528            method: "post",
4529            dataType: 'json',
4530            data: data,
4531            beforeSend: function () {
4532                $('div.message-wrapper').html("");
4533            },
4534            success: function (res) {
4535                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4536                if (res) {
4537                    if (res.status) {
4538                        if (res.redirect) {
4539                            window.location = res.redirect;
4540                        }
4541                    } else {
4542                        if (res.message) {
4543                            $('div.message-wrapper').html(res.message);
4544                        }
4545                    }
4546                }
4547            },
4548            error: function (err) {
4549                $('div.message-wrapper').html("");
4550                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4551            }
4552        });
4553    });
4554
4555    // tour booking ajax
4556    $('form.tour-booking-form').on('click', 'button.btn-book-ajax', function (e) {
4557        e.preventDefault();
4558        var form = $('form.tour-booking-form');
4559        var data = $('form.tour-booking-form').serializeArray();
4560        var loadingSubmit = form.find('button[name=submit]');
4561        $(loadingSubmit).find("i.fa-spin").removeClass("hide");
4562        data.push({
4563            name: 'security',
4564            value: st_params._s
4565        });
4566        $('div.message-wrapper').html("");
4567        if (jQuery('#st-content-wrapper').hasClass('st-content-wrapper--solo')) {
4568            data.push({
4569                name: 'disable_require_name',
4570                value: true
4571            });
4572        }
4573        $.ajax({
4574            url: st_params.ajax_url,
4575            method: "post",
4576            dataType: 'json',
4577            data: data,
4578            beforeSend: function () {
4579                $('div.message-wrapper').html("");
4580            },
4581            success: function (res) {
4582                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4583                if (res) {
4584                    if (res.status) {
4585                        if (res.redirect) {
4586                            window.location = res.redirect;
4587                        }
4588                    } else {
4589                        if (res.message) {
4590                            $('#form-booking-inpage .message-wrapper').html(res.message);
4591                        }
4592                    }
4593                }
4594            },
4595            error: function (err) {
4596                $('div.message-wrapper').html("");
4597                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4598            }
4599        });
4600    });
4601
4602    // car booking ajax
4603    $('form.car-booking-form').on('click', 'button.btn-book-ajax', function (e) {
4604        e.preventDefault();
4605        var form = $('form.car-booking-form');
4606        var data = $('form.car-booking-form').serializeArray();
4607        var loadingSubmit = form.find('button[name=submit]');
4608        $(loadingSubmit).find("i.fa-spin").removeClass("hide");
4609        data.push({
4610            name: 'security',
4611            value: st_params._s
4612        });
4613        $('div.message-wrapper').html("");
4614        $.ajax({
4615            url: st_params.ajax_url,
4616            method: "post",
4617            dataType: 'json',
4618            data: data,
4619            beforeSend: function () {
4620                $('div.message-wrapper').html("");
4621            },
4622            success: function (res) {
4623                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4624                if (res) {
4625                    if (res.status) {
4626                        if (res.redirect) {
4627                            window.location = res.redirect;
4628                        }
4629                    } else {
4630                        if (res.message) {
4631                            $('#form-booking-inpage .message-wrapper').html(res.message);
4632                        }
4633                    }
4634                }
4635            },
4636            error: function (err) {
4637                $('div.message-wrapper').html("");
4638                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4639            }
4640        });
4641    });
4642
4643    // rental booking ajax
4644    $('form.rental-booking-form').on('click', 'button.btn-book-ajax', function (e) {
4645        e.preventDefault();
4646        var form = $('form.rental-booking-form');
4647        var data = $('form.rental-booking-form').serializeArray();
4648        var loadingSubmit = form.find('button[name=submit]');
4649        $(loadingSubmit).find("i.fa-spin").removeClass("hide");
4650        data.push({
4651            name: 'security',
4652            value: st_params._s
4653        });
4654        $('div.message-wrapper').html("");
4655        $.ajax({
4656            url: st_params.ajax_url,
4657            method: "post",
4658            dataType: 'json',
4659            data: data,
4660            beforeSend: function () {
4661                $('div.message-wrapper').html("");
4662            },
4663            success: function (res) {
4664                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4665                if (res) {
4666                    if (res.status) {
4667                        if (res.redirect) {
4668                            window.location = res.redirect;
4669                        }
4670                    } else {
4671                        if (res.message) {
4672                            $('#form-booking-inpage .message-wrapper').html(res.message);
4673                        }
4674                    }
4675                }
4676            },
4677            error: function (err) {
4678                $('div.message-wrapper').html("");
4679                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4680            }
4681        });
4682    });
4683    if ($.fn.niceScroll) {
4684        jQuery(".dropdown-menu.st-icheck").niceScroll({});
4685    }
4686
4687    //Guest Name
4688    //--------------- Guest Name Inputs -------------------------
4689
4690    var adultNumber = $('.form-has-guest-name .adult_number');
4691    var childrenNumber = $('.form-has-guest-name .child_number');
4692    var infantNumber = $('.form-has-guest-name .infant_number');
4693    var guestNameInput = $('.form-has-guest-name .guest_name_input');
4694    adultNumber.on('change', triggerGuestInputChange);
4695    childrenNumber.on('change', triggerGuestInputChange);
4696    infantNumber.on('change', triggerGuestInputChange);
4697
4698    function triggerGuestInputChange(e) {
4699        guestNameInput.trigger('guest-change', {
4700            'adult': parseInt(adultNumber.val()),
4701            'children': parseInt(childrenNumber.val()),
4702            'infant': parseInt(infantNumber.val())
4703        });
4704    };
4705
4706    guestNameInput.on('guest-change', function (e, number) {
4707        var adult = number.adult;
4708        var children = number.children;
4709        var infant = number.infant;
4710        var hideAdult = $(this).data('hide-adult');
4711        var hideChildren = $(this).data('hide-children');
4712        var hideInfant = $(this).data('hide-infant');
4713        var controlWraps = $(this).find('.guest_name_control');
4714        var controls = controlWraps.find('.control-item');
4715        if (isNaN(infant))
4716            infant = 0;
4717        if (isNaN(children))
4718            children = 0;
4719
4720        if (hideAdult == 'on') {
4721            adult = 0;
4722        }
4723
4724        if (typeof hideChildren == 'undefined' || hideChildren != 'on')
4725            adult += children;
4726        if (typeof hideInfant == 'undefined' || hideInfant != 'on')
4727            adult += infant;
4728
4729        //adult-=1;// Only input guest >=2 name
4730
4731        if (adult <= 0) {
4732            $(this).addClass('hidden');
4733        } else {
4734            // Append
4735            for (var i = controls.length ? (controls.length) : 0; i < adult; i++) {
4736                var div = $($('#guest_name_control_item').clone().html());
4737                var p = div.find('input').attr('placeholder');
4738                div.find('input').attr('placeholder', p.replace('%d', i + 1));
4739
4740                controlWraps.append(div);
4741            }
4742
4743            // Remove
4744            controls.each(function () {
4745                if ($(this).index() > adult - 1) {
4746                    $(this).remove();
4747                }
4748            });
4749
4750            $(this).removeClass('hidden');
4751        }
4752    });
4753
4754    triggerGuestInputChange();
4755    //------------------End Guest Name Inputs -------------------
4756
4757})(jQuery);
4758
4759function updateQueryStringParam(key, value) {
4760    var baseUrl = [location.protocol, '//', location.host, location.pathname].join('');
4761    var urlQueryString = document.location.search;
4762    var newParam = key + '=' + value,
4763        params = '?' + newParam;
4764    // If the "search" string exists, then build params from it
4765    if (urlQueryString) {
4766        var keyRegex = new RegExp('([\?&])' + key + '[^&]*');
4767        // If param exists already, update it
4768        if (urlQueryString.match(keyRegex) !== null) {
4769            var params = urlQueryString.replace(keyRegex, "$1" + newParam);
4770        } else { // Otherwise, add it to end of query string
4771            var params = urlQueryString + '&' + newParam;
4772        }
4773    }
4774    //return baseUrl + params;
4775    window.history.replaceState({}, "", baseUrl + params);
4776}
4777
4778function isMobile() {
4779    var isMobile = false;
4780    if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) ||
4781        /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
4781sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0, 4))) {
4782        isMobile = true;
4783    }
4784    return isMobile;
4785}
4786
4787function stKeyupsmartSearch(event) {
4788    // Declare variables
4789    var input, filter, ul, li, a, i, txtValue;
4790    input = event.value.toUpperCase();
4791    filter = event.value.toUpperCase();
4792    parent = event.closest(".form-extra-field");
4793    ul = parent.getElementsByTagName('ul')[0];
4794    li = ul.getElementsByTagName('li');
4795
4796    // Loop through all list items, and hide those who don't match the search query
4797    for (i = 0; i < li.length; i++) {
4798        //a = li[i].getElementsByTagName("a")[0];
4799        txtValue = li[i].textContent || li[i].innerText;
4800        if (txtValue.toUpperCase().indexOf(filter) > -1) {
4801            li[i].style.display = "";
4802        } else {
4803            li[i].style.display = "none";
4804        }
4805    }
4806}
4807jQuery(function ($) {
4808    document.querySelectorAll(".select-number-passenger  .st-number  .plus").forEach((input) => input.addEventListener("click", calculate_add));
4809    document.querySelectorAll(".select-number-passenger  .st-number  .minus").forEach((input) => input.addEventListener("click", calculate_minus));
4810
4811    function calculate_add() {
4812        var num_item = $(this).closest('.select-number-passenger');
4813        var num = num_item.find('.st-input-number').val();
4814        var max_val = num_item.find('.st-input-number').data('max');
4815        var value_num = parseInt(num) + 1;
4816        num_item.find('.st-input-number').val(value_num);
4817        num_item.find('strong.num').text(value_num);
4818
4819    }
4820
4821    function calculate_minus() {
4822        var num_item = $(this).closest('.select-number-passenger');
4823        var num = num_item.find('.st-input-number').val();
4824        var min_val = num_item.find('.st-input-number').data('min');
4825        if (parseInt(num) > min_val) {
4826            var value_num = parseInt(num) - 1;
4827            num_item.find('.st-input-number').val(value_num);
4828            num_item.find('strong.num').text(value_num);
4829        }
4830
4831    }
4832})
4833
4834jQuery(function ($) {
4835    var startApp = function () {
4836        if (typeof st_social_params != 'undefined') {
4837            var key = st_social_params.google_client_id;
4838            let r = (Math.random() + 1).toString(36).substring(7);
4839            gapi.load('auth2', function () {
4840                auth2 = gapi.auth2.init({
4841                    client_id: key,
4842                    cookiepolicy: 'single_host_origin',
4843                    plugin_name: 'single_host_origin' + r,
4844                });
4845                attachSignin(document.getElementById('st-google-signin2'));
4846                attachSignin(document.getElementById('st-google-signin3'));
4847            });
4848        }
4849    };
4850
4851    if (typeof window.gapi != 'undefined') {
4852        startApp();
4853    }
4854
4855    function attachSignin(element) {
4856        auth2.attachClickHandler(element, {},
4857            function (googleUser) {
4858                var profile = googleUser.getBasicProfile();
4859                startLoginWithGoogle(profile);
4860
4861            },
4862            function (error) {
4863                console.log(JSON.stringify(error, undefined, 2));
4864            });
4865    }
4866
4867    function startLoginWithGoogle(profile) {
4868        if (typeof window.gapi.auth2 == 'undefined')
4869            return;
4870        sendLoginData({
4871            'channel': 'google',
4872            'userid': profile.getId(),
4873            'username': profile.getName(),
4874            'useremail': profile.getEmail(),
4875        });
4876    }
4877
4878    function startLoginWithFacebook(btn) {
4879        btn.addClass('loading');
4880
4881        FB.getLoginStatus(function (response) {
4882            if (response.status === 'connected') {
4883                sendLoginData({
4884                    'channel': 'facebook',
4885                    'access_token': response.authResponse.accessToken
4886                });
4887
4888            } else {
4889                FB.login(function (response) {
4890                    if (response.authResponse) {
4891                        sendLoginData({
4892                            'channel': 'facebook',
4893                            'access_token': response.authResponse.accessToken
4894                        });
4895
4896                    } else {
4897                        alert('User cancelled login or did not fully authorize.');
4898                    }
4899                }, {
4900                    scope: 'email',
4901                    return_scopes: true
4902                });
4903            }
4904        });
4905    }
4906
4907    function sendLoginData(data) {
4908        data._s = st_params._s;
4909        data.action = 'traveler.socialLogin';
4910        var parent_login = $(".login-regiter-popup");
4911        $.ajax({
4912            data: data,
4913            type: 'post',
4914            dataType: 'json',
4915            url: st_params.ajax_url,
4916            beforeSend: function () {
4917                parent_login.find('.map-loading').html('<div class="st-loader"></div>');
4918                parent_login.find('.map-loading').css('z-index', 99);
4919                parent_login.find('.map-loading').show();
4920
4921            },
4922            success: function (rs) {
4923                handleSocialLoginResult(rs);
4924            },
4925            error: function (e) {
4926
4927                alert('Can not login. Please try again later');
4928            }
4929        })
4930    }
4931
4932    function handleSocialLoginResult(rs) {
4933        if (rs.reload)
4934            window.location.reload();
4935        if (rs.message)
4936            alert(rs.message);
4937    }
4938
4939    $('.st_login_social_link').on('click', function () {
4940        var channel = $(this).data('channel');
4941
4942        switch (channel) {
4943            case "facebook":
4944                startLoginWithFacebook($(this));
4945                break;
4946        }
4947    })
4948
4949    /* Fix social login popup */
4950    function popupwindow(url, title, w, h) {
4951        var left = (screen.width / 2) - (w / 2);
4952        var top = (screen.height / 2) - (h / 2);
4953        return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
4954    }
4955
4956    $('.st_login_social_link').on('click', function () {
4957        var href = $(this).attr('href');
4958        if ($(this).hasClass('btn_login_tw_link'))
4959            popupwindow(href, '', 600, 450);
4960        return false;
4961    });
4962    /* End fix social login popup */
4963})
4964jQuery(function ($) {
4965    // caculator height menu
4966    function setHeightValueMenu(x) {
4967        if (tabslet.matches) { // If media query matches
4968            if (document.querySelector(".page-template.st-header-2 header#header")) {
4969                document.querySelector(".page-template.st-header-2 header#header").style.marginBottom = "-" + window.getComputedStyle(document.querySelector(".st-header-2 header#header .header")).height;
4970            }
4971        } else {}
4972    }
4973
4974    var tabslet = window.matchMedia("(min-width: 992px)")
4975    setHeightValueMenu(tabslet) // Call listener function at run time
4976    tabslet.addListener(setHeightValueMenu) // Attach listener function on state changes
4977});
4978/*Loadmore*/
4979jQuery(function ($) {
4980    if ($('.st-loadmore.loadmore-ccv')) {
4981        $('.st-loadmore.loadmore-ccv').each(function () {
4982            st_nav_tab($(this));
4983        });
4984    }
4985    //Show password
4986    $('.field-password svg').on('click', function () {
4987        let t = $(this),
4988            parent = t.parents('.field-password');
4989
4990        if (parent.hasClass('ic-view')) {
4991            parent.addClass('viewing').find('input').attr('type', 'text');
4992            parent.removeClass('ic-view');
4993        } else {
4994            parent.removeClass('viewing').find('input').attr('type', 'password');
4995            parent.addClass('ic-view');
4996        }
4997    });
4998
4999
5000	function set_sticky() {
5001		var topSpacing = 0;
5002		if ($(window).width() > 481 && $('body').hasClass('admin-bar')) {
5003			topSpacing = $('#wpadminbar').height()
5004		}
5005		var sticky_header = $('.enable_sticky_header').length;
5006		if (sticky_header) {
5007			$('.header-sticky-menu').sticky({
5008				topSpacing: topSpacing,
5009				zIndex: 9999,
5010			});
5011			return
5012		}
5013		return
5014	}
5015
5016	set_sticky();
5017});
5018
5019function st_nav_tab(el) {
5020    //var append_load = '<div id="morefloatingBarsG"><div class="ngothoai-spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>';
5021    var append_load = '<div class="loader-wrapper"><div class="st-loader"></div></div>';
5022    el.find(".load_more_post").on('click', function (element) {
5023        element.preventDefault();
5024        var element = jQuery(this);
5025        var posts_per_page = element.attr('data-posts-per-page');
5026        var paged = element.attr('data-paged');
5027        var data_id_service = element.attr('data-id_service');
5028        var max_num_page = element.attr('data-max-num-page');
5029        var check_all = element.attr('check-all');
5030        var type_service = element.attr('type_service');
5031        var dataIndex = element.attr('data-index');
5032        var $container = element.closest('.st_service_load');
5033        var offloadmore = $container.find('.loadmore');
5034
5035        if (check_all === "true") {
5036            var append_content = $container.find('.st_all');
5037            var append_st = $container.find('.services-grid .row');
5038            var loadmore = $container.find('.st_all .load-ajax-icon .loader-wrapper');
5039            var offloadmore = $container.find('.st_all .loadmore ');
5040            var buttonloadmore = append_content.find('.st-button-loadmore');
5041        } else {
5042            var append_content = $container.find('.st_blog_' + tax_query);
5043            var append_st = $container.find('.services-grid .row');
5044
5045            var buttonloadmore = $container.find('.st-button-loadmore');
5046        }
5047        var append_st = $container.find('.services-grid > .row');
5048        var loadmore = $container.find('.load-ajax-icon .loader-wrapper');
5049        var offloadmore = $container.find('.loadmore');
5050        var buttonloadmore = $container.find('.st-button-loadmore');
5051        console.log(append_st);
5052        jQuery('.st-loadmore .loader-wrapper').show();
5053        jQuery.ajax({
5054            url: st_params.ajax_url,
5055            type: "POST",
5056            data: {
5057                'action': "st_load_more_service_by_id",
5058                'posts_per_page': posts_per_page,
5059                'paged': paged,
5060                'data_id_service': data_id_service,
5061                'max_num_page': max_num_page,
5062                'check_all': check_all,
5063                'type_service': type_service,
5064                'index': dataIndex
5065            },
5066            dataType: "json",
5067            beforeSend: function () {
5068                loadmore.show();
5069                buttonloadmore.hide();
5070            },
5071            error: function (jqXHR, textStatus, errorThrown) {
5072                jQuery("#aLoad").remove();
5073                console.log("ERRO" + jqXHR + "is" + errorThrown);
5074            },
5075            success: function (res) {
5076                $datxa = jQuery(res.html);
5077                if ($datxa.length) {
5078                    append_st.append(res.html);
5079
5080                } else {
5081
5082                }
5083                $container.animate({
5084                    scrollTop: $container.prop("scrollHeight")
5085                }, 1000);
5086            },
5087            complete: function (xhr, status) {
5088
5089                $data = jQuery(xhr.responseJSON.html);
5090                if ($data.length) {
5091                    element.attr('data-paged', xhr.responseJSON.paged);
5092                    element.attr('data-index', xhr.responseJSON.index);
5093                    loadmore.hide();
5094                    buttonloadmore.show();
5095                } else {
5096                    loadmore.hide();
5097                    offloadmore.remove();
5098                }
5099                jQuery('.st-loadmore .loader-wrapper').hide();
5100            }
5101        });
5102
5103    });
5104}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.