PageSourceSearch

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

js climbingsouthamerica.com collected 2026-10-03 01:36:07 UTC 196,311 bytes, 5,117 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					// swal({
2547                    //     type: 'success',
2548                    //     title: respon.message,
2549                    //     text: respon.sub_message,
2550                    //     showConfirmButton: true,
2551                    //     confirmButtonText: respon.closeText,
2552                    //     onClose: function () {
2553                    //         $('#st-login-form', body).modal('show');
2554                    //         $('#st-register-form', body).modal('hide');
2555                    //     },
2556                    //     allowOutsideClick: false
2557                    // });
2558                }
2559            }
2560            loader.hide();
2561        }, 'json');
2562    });
2563    $('#st-register-form form', body).on('submit', function (ev) {
2564        ev.preventDefault();
2565        var form = $(this),
2566            loader = form.closest('.modal-content').find('.loader-wrapper'),
2567            message = $('.message-wrapper', form);
2568        var data = form.serializeArray();
2569        data.push({
2570            name: 'security',
2571            value: st_params._s
2572        });
2573        message.html('');
2574        loader.show();
2575        $.post(st_params.ajax_url, data, function (respon) {
2576            loader.hide();
2577            if (typeof respon == 'object') {
2578                message.html(respon.message);
2579                if (respon.status == 1) {
2580                    swal({
2581                        type: 'success',
2582                        title: respon.message,
2583                        text: respon.sub_message,
2584                        showConfirmButton: true,
2585                        confirmButtonText: respon.closeText,
2586                        onClose: function () {
2587                            $('#st-login-form', body).modal('show');
2588                            $('#st-register-form', body).modal('hide');
2589                        },
2590                        allowOutsideClick: false
2591                    });
2592                } else {
2593                    message.html(respon.message);
2594                    setTimeout(function () {
2595                        message.html('');
2596                    }, 1000);
2597                }
2598            }
2599        }, 'json');
2600    });
2601    $('#st-forgot-form form', body).on('submit', function (ev) {
2602        ev.preventDefault();
2603        var form = $(this),
2604            loader = form.closest('.modal-content').find('.loader-wrapper'),
2605            message = $('.message-wrapper', form);
2606        var data = form.serializeArray();
2607        data.push({
2608            name: 'security',
2609            value: st_params._s
2610        });
2611        message.html('');
2612        loader.show();
2613        $.post(st_params.ajax_url, data, function (respon) {
2614            if (typeof respon == 'object') {
2615                message.html(respon.message);
2616                setTimeout(function () {
2617                    message.html('');
2618                }, 2000);
2619            }
2620            loader.hide();
2621        }, 'json');
2622    });
2623    $('.select2-languages', body).select2({
2624        minimumResultsForSearch: -1
2625    });
2626    $('.select2-languages').on('change', function () {
2627        var target = $('option:selected', this).data('target');
2628        if (target) {
2629            window.location.href = target;
2630        }
2631    });
2632    $('.select2-currencies', body).select2({
2633        minimumResultsForSearch: -1
2634    });
2635    $('.select2-currencies').on('change', function () {
2636        var target = $('option:selected', this).data('target');
2637        if (target) {
2638            window.location.href = target;
2639        }
2640    });
2641    $('.form-check-availability-hotel .submit-group [name="submit"]', body).on('click', function (ev) {
2642        ev.preventDefault();
2643        var form = $(this).closest('.form-check-availability-hotel'),
2644            parent = form.parent(),
2645            loader = $('.loader-wrapper', parent),
2646            message = $('.message-wrapper', form);
2647        var has_fixed = form.closest('.fixed-on-mobile');
2648        if (has_fixed.hasClass('open')) {
2649            has_fixed.removeClass('open').hide();
2650            body.removeClass('st_overflow');
2651        }
2652        var data = form.serializeArray();
2653        data.push({
2654            name: 'security',
2655            value: st_params._s
2656        });
2657        message.html('');
2658        loader.show();
2659        $('.st-list-rooms .loader-wrapper').show();
2660        $.post(st_params.ajax_url, data, function (respon) {
2661            if (typeof respon == 'object') {
2662                if (respon.message) {
2663                    message.html(respon.message);
2664                }
2665                $('.st-list-rooms .fetch').html(respon.html);
2666                $('html, body').animate({
2667                    scrollTop: $('.st-list-rooms', body).offset().top - 150
2668                }, 500);
2669                $('[data-toggle="tooltip"]').tooltip();
2670            }
2671            $('.st-list-rooms .loader-wrapper').hide();
2672            loader.hide();
2673        }, 'json');
2674    });
2675    body.on('click', '.btn-show-price', function (ev) {
2676        ev.preventDefault();
2677        $('.form-check-availability-hotel .submit-group input[name="submit"]', body).trigger('click');
2678    });
2679    $('.shares .social-share').on('click', function (ev) {
2680        ev.preventDefault();
2681        $('.shares .share-wrapper').slideToggle(200);
2682    });
2683    $(document).on('click', '.btn_add_wishlist', function (event) {
2684        event.preventDefault();
2685        var $this = $(this);
2686        $.ajax({
2687            url: st_params.ajax_url,
2688            type: "POST",
2689            data: {
2690                action: "st_add_wishlist",
2691                data_id: $(this).data('id'),
2692                data_type: $(this).data('type')
2693            },
2694            dataType: "json",
2695        }).done(function (html) {
2696            $this.html(html.icon).attr("data-original-title", html.title)
2697        })
2698    });
2699    $('.st-like-review').on('click', function (e) {
2700        e.preventDefault();
2701        var me = $(this);
2702        var comment_id = me.data('id');
2703        $.ajax({
2704            url: st_params.ajax_url,
2705            type: 'post',
2706            dataType: 'json',
2707            data: {
2708                action: 'like_review',
2709                comment_ID: comment_id
2710            },
2711            success: function (res) {
2712                if (res.status) {
2713                    $('i', me).toggleClass('fa-thumbs-o-up fa-thumbs-o-down');
2714                    if ($('.booking-item-review-rate').length) {
2715                        $(me).toggleClass('fa-thumbs-o-up fa-thumbs-o-down');
2716                    }
2717                    if (typeof res.data.like_count != undefined) {
2718                        res.data.like_count = parseInt(res.data.like_count);
2719                        me.parent().find('span').html(res.data.like_count);
2720                    }
2721                }
2722            }
2723        });
2724    });
2725    $('.review-form .review-items .rates .fa').each(function () {
2726        var list = $(this).parent(),
2727            listItems = list.children(),
2728            itemIndex = $(this).index(),
2729            parentItem = list.parent();
2730
2731        $(this).on('mouseenter', function () {
2732            for (var i = 0; i < listItems.length; i++) {
2733                if (i <= itemIndex) {
2734                    $(listItems[i]).addClass('hovered');
2735                } else {
2736                    break;
2737                }
2738            }
2739            $(this).on('click', function () {
2740                for (var i = 0; i < listItems.length; i++) {
2741                    if (i <= itemIndex) {
2742                        $(listItems[i]).addClass('selected');
2743                    } else {
2744                        $(listItems[i]).removeClass('selected');
2745                    }
2746                };
2747                parentItem.children('.st_review_stats').val(itemIndex + 1);
2748            });
2749        });
2750
2751        $(this).on('mouseleave', function () {
2752            listItems.removeClass('hovered');
2753        });
2754    });
2755    $('.review-form .st-stars .fa').each(function () {
2756        var list = $(this).parent(),
2757            listItems = list.children(),
2758            itemIndex = $(this).index(),
2759            parentItem = list.parent();
2760        $(this).on('mouseenter', function () {
2761            for (var i = 0; i < listItems.length; i++) {
2762                if (i <= itemIndex) {
2763                    $(listItems[i]).addClass('hovered');
2764                } else {
2765                    break;
2766                }
2767            }
2768            $(this).on('click', function () {
2769                for (var i = 0; i < listItems.length; i++) {
2770                    if (i <= itemIndex) {
2771                        $(listItems[i]).addClass('selected');
2772                    } else {
2773                        $(listItems[i]).removeClass('selected');
2774                    }
2775                }
2776                parentItem.children('.st_review_stats').val(itemIndex + 1);
2777            });
2778        });
2779        $(this).on('mouseleave', function () {
2780            listItems.removeClass('hovered');
2781        });
2782    });
2783    /* Mobile location */
2784    $('.search-form-mobile .dropdown-menu li').on('click', function () {
2785        var t = $(this);
2786        var parent = t.closest('.dropdown');
2787        $('input[name="location_id"]', parent).val(t.data('value'));
2788        $('input[name="location_name"]', parent).val(t.find('span').text());
2789    });
2790    $(document).on('click', '.service-add-wishlist.login', function (event) {
2791        event.preventDefault();
2792        var t = $(this);
2793        t.addClass('loading');
2794        $.ajax({
2795            url: st_params.ajax_url,
2796            type: "POST",
2797            data: {
2798                action: "st_add_wishlist",
2799                data_id: t.data('id'),
2800                data_type: t.data('type')
2801            },
2802            dataType: "json",
2803        }).done(function (html) {
2804            if (html.status == 'true') {
2805                if (html.added == 'true') {
2806                    t.addClass('added');
2807                } else {
2808                    t.removeClass('added');
2809                }
2810                t.attr('title', html.title);
2811            }
2812            t.removeClass('loading');
2813        })
2814    });
2815    if ($('#contact-map-new').length) {
2816        initMapContactPage($('#contact-map-new'));
2817    }
2818    $('.field-detination .dropdown-menu').each(function () {
2819        $.fn.niceScroll && $(this).niceScroll({
2820            cursorcolor: "#a0a9b2",
2821        });
2822    });
2823    jQuery(function ($) {
2824        // Tour Package Popup
2825        if ($('.st-form-package').length) {
2826            $('.st-form-package').magnificPopup({
2827                removalDelay: 500,
2828                closeBtnInside: true,
2829                callbacks: {
2830                    beforeOpen: function () {
2831                        this.st.mainClass = this.st.el.attr('data-effect');
2832                    },
2833                    afterClose: function () {
2834                        if (st_params.caculator_price_single_ajax === 'on') {
2835                            if ($('.single-st_tours .st-form-package').length > 0) {
2836                                renderHtmlTour();
2837                            }
2838                            if ($('.single-st_activity .st-form-package').length > 0) {
2839                                renderHtmlActivity();
2840                            }
2841                        }
2842                    },
2843                },
2844                midClick: true,
2845                closeMarkup: '<button title="Close (Esc)" type="button" class="mfp-close"></button>',
2846            });
2847        }
2848        if (window.matchMedia('(max-width: 768px)').matches) {
2849            $('.as').slideDown();
2850        }
2851        if (window.matchMedia('(min-width: 991px)').matches) {
2852            var c = 0;
2853            var c1 = 0;
2854            $(window).on('scroll', function (event) {
2855                if ($('#btn-show-map').is(':checked') && $('.page-half-map').length) {
2856                    var scroll = $(window).scrollTop();
2857                    var topEl = $('.st-hotel-result').offset().top;
2858                    var colLeft = $('.page-half-map .col-left').height();
2859                    var divResult = $('#modern-search-result').height();
2860                    if (scroll >= topEl) {
2861                        if (divResult >= colLeft) {
2862                            if (c == 0) {
2863                                if ($("body").hasClass('rtl')) {
2864                                    if ($.fn.niceScroll) {
2865                                        $('.page-half-map').find('.col-left').niceScroll({
2866                                            railalign: 'left'
2867                                        });
2868                                    }
2869
2870                                } else {
2871                                    if ($.fn.niceScroll) {
2872                                        $('.page-half-map').find('.col-left').niceScroll();
2873                                    }
2874
2875                                }
2876                                c = 1;
2877                                $('.as').slideUp();
2878                            }
2879                        } else {
2880                            $.fn.getNiceScroll && $('.page-half-map').find('.col-left').getNiceScroll().remove();
2881                            $('.as').slideDown(50);
2882                        }
2883                    } else {
2884                        $('.as').slideUp();
2885                        if (c == 1) {
2886                            $.fn.getNiceScroll && $('.page-half-map').find('.col-left').animate({
2887                                scrollTop: 0
2888                            }).getNiceScroll().remove();
2889                            c = 0;
2890                        }
2891                    }
2892                }
2893            });
2894            $('.page-half-map .col-left').on('scroll', function (event) {
2895                var scroll = $(window).scrollTop();
2896                var topEl = $('.st-hotel-result').offset().top;
2897                if ($('#btn-show-map').is(':checked')) {
2898                    var t = $(this);
2899                    if (t.scrollTop() <= 0) {
2900                        if (c == 1) {
2901                            $.fn.getNiceScroll && $('.page-half-map').find('.col-left').getNiceScroll().remove();
2902                            window.scrollTo({
2903                                top: topEl - 1,
2904                            });
2905                            c = 0;
2906                        }
2907                    } else if (typeof t.getNiceScroll()[0] != 'undefined') {
2908                        if (t.getNiceScroll()[0].page.maxh <= t.scrollTop()) {
2909                            $('.page-half-map').find('.col-left').getNiceScroll().remove();
2910                            $('.as').slideDown('slow');
2911                            c = 1;
2912                        }
2913                    }
2914                }
2915            });
2916        }
2917    });
2918    $('.coupon-section form .btn').on('click', function (e) {
2919        e.preventDefault();
2920        var sform = $(this).closest('form');
2921        if ($('#field-coupon_code', sform).val() === '') {
2922            $('#field-coupon_code', sform).addClass('error');
2923        } else {
2924            $('#field-coupon_code', sform).removeClass('error');
2925            $(this).append('<i class="fa fa-spinner fa-spin"></i>');
2926            var data = {
2927                'action': 'apply_mdcoupon_function',
2928                'code': $('#field-coupon_code', sform).val()
2929            };
2930            $.post(st_params.ajax_url, data, function (respon, textStatus, xhr) {
2931                if (respon.status == 1) {
2932                    sform.trigger('submit');
2933                }
2934            }, 'json');
2935        }
2936    });
2937    $('.sidebar-widget h4:first-child').each(function () {
2938        $(this).wrap("<div class='sidebar-title'></div>");
2939    });
2940    if ($('#sticky-nav').length && window.matchMedia('(min-width: 991px)').matches) {
2941        var topElSearch = $('#sticky-nav').offset().top;
2942        var searchFormHeight = $('#sticky-nav').closest('.search-form-wrapper').outerHeight();
2943        $(window).on('resize', function () {
2944            var topElSearch = $('#sticky-nav').offset().top;
2945            var searchFormHeight = $('#sticky-nav').closest('.search-form-wrapper').outerHeight();
2946        });
2947        $(window).on('scroll', function (event) {
2948            var scroll = $(window).scrollTop();
2949            var top = 0;
2950            if ($('#wpadminbar').length) {
2951                top = $('#wpadminbar').height();
2952            }
2953            if (scroll > topElSearch - top) {
2954                $('#sticky-nav').closest('.search-form-wrapper').css({
2955                    height: searchFormHeight + 'px'
2956                });
2957                $('#sticky-nav').find('form').addClass('container');
2958                $('#sticky-nav').css({
2959                    top: top + 'px',
2960                    'margin-top': '0px'
2961                });
2962                $('#sticky-nav').addClass('sticky');
2963                $.fn.getNiceScroll && $('#sticky-nav .dropdown-menu').getNiceScroll().resize();
2964                $('#sticky-nav').addClass('small');
2965            } else {
2966                $('#sticky-nav').closest('.search-form-wrapper').css({
2967                    height: 'auto'
2968                });
2969                $('#sticky-nav').find('form').removeClass('container');
2970                $('#sticky-nav').css({
2971                    top: 'auto',
2972                    'margin-top': '50px'
2973                });
2974                $('#sticky-nav').removeClass('sticky');
2975                $.fn.getNiceScroll && $('#sticky-nav .dropdown-menu').getNiceScroll().resize();
2976                $('#sticky-nav').removeClass('small');
2977            }
2978        })
2979    }
2980    $('.st-number-wrapper').each(function () {
2981        var timeOut = 0;
2982        var t = $(this);
2983        var input = t.find('.st-input-number');
2984        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' +
2985            '    <!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->\n' +
2986            '    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">\n' +
2987            '        <g id="Tour_Detail_1" transform="translate(-1180.000000, -1085.000000)" stroke="#5E6D77" stroke-width="1.5">\n' +
2988            '            <g id="check-avai" transform="translate(1034.000000, 867.000000)">\n' +
2989            '                <g id="adults" transform="translate(0.000000, 184.000000)">\n' +
2990            '                    <g id="ico_subtract" transform="translate(147.000000, 35.000000)">\n' +
2991            '                        <path d="M0.5,0.038 L15.5,0.038" id="Shape"></path>\n' +
2992            '                    </g>\n' +
2993            '                </g>\n' +
2994            '            </g>\n' +
2995            '        </g>\n' +
2996            '    </g>\n' +
2997            '</svg></span>');
2998        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' +
2999            '    <!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->\n' +
3000            '    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">\n' +
3001            '        <g id="Tour_Detail_1" transform="translate(-1258.000000, -1077.000000)" stroke="#5E6D77" stroke-width="1.5">\n' +
3002            '            <g id="check-avai" transform="translate(1034.000000, 867.000000)">\n' +
3003            '                <g id="adults" transform="translate(0.000000, 184.000000)">\n' +
3004            '                    <g id="ico_add" transform="translate(225.000000, 27.000000)">\n' +
3005            '                        <path d="M0.5,8 L15.5,8" id="Shape"></path>\n' +
3006            '                        <path d="M8,0.5 L8,15.5" id="Shape"></path>\n' +
3007            '                    </g>\n' +
3008            '                </g>\n' +
3009            '            </g>\n' +
3010            '        </g>\n' +
3011            '    </g>\n' +
3012            '</svg></span>');
3013        var min = input.data('min');
3014        var max = input.data('max');
3015        t.find('span').on("click", function () {
3016            var $button = $(this);
3017            numberButtonFunc($button);
3018        });
3019        t.find('span').on("touchstart", function (e) {
3020            $(this).trigger('click');
3021            e.preventDefault();
3022            var $button = $(this);
3023            timeOut = setInterval(function () {
3024                // numberButtonFunc($button);
3025            }, 150);
3026        }).on('mouseup mouseleave touchend', function () {
3027            clearInterval(timeOut);
3028        });
3029
3030        function numberButtonFunc($button) {
3031            var oldValue = $button.parent().find("input").val();
3032            var container = $button.closest('.form-guest-search');
3033            var total = 0;
3034            $('input[type="text"]', container).each(function () {
3035                total += parseInt($(this).val());
3036            });
3037            var newVal = oldValue;
3038            if ($button.hasClass('next')) {
3039                if (total < max) {
3040                    if (oldValue < max) {
3041                        newVal = parseFloat(oldValue) + 1;
3042                    } else {
3043                        newVal = max;
3044                    }
3045                } else {
3046					let html = `<div class="alert alert-danger"> Max of people is ${total} people`;
3047					$( '#form-booking-inpage .message-wrapper-2' ).append( html ).fadeTo( 5000, 1, () => {
3048						$( '#form-booking-inpage .message-wrapper-2 .alert' ).remove();
3049					} );
3050				}
3051            } else {
3052                if (oldValue > min) {
3053                    newVal = parseFloat(oldValue) - 1;
3054                } else {
3055                    newVal = min;
3056                }
3057            }
3058            $button.parent().find("input").val(newVal).trigger('change');
3059            $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.search-form').trigger('change');
3060            $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.form-check-availability-hotel').trigger('change');
3061            $('input[name="' + $button.parent().find("input").attr('name') + '"]', '.single-room-form').trigger('change');
3062            if (window.matchMedia('(max-width: 767px)').matches) {
3063                $('#dropdown-1 label', $button.closest('.field-guest')).hide();
3064                $('#dropdown-1 .render', $button.closest('.field-guest')).show();
3065            }
3066        }
3067    });
3068    $('.btn-close-guest-form').on('click', function () {
3069        $('.field-guest  .dropdown-menu').slideUp(50);
3070    });
3071    $('.st-cut-text').each(function () {
3072        var t = $(this);
3073        if (t.text().length > 0) {
3074            var arr = t.text().trim().split(' ');
3075            console.log(arr);
3076        }
3077    });
3078    $('.booking-item-review-expand-more').on('click', function () {
3079        var t = $(this);
3080        t.closest('.booking-item-review-content').find('.booking-item-review-more').fadeIn();
3081        t.closest('.booking-item-review-content').find('.booking-item-review-expand-less').show();
3082        t.hide();
3083    });
3084    $('.booking-item-review-expand-less').on('click', function () {
3085        var t = $(this);
3086        t.closest('.booking-item-review-content').find('.booking-item-review-more').fadeOut();
3087        t.closest('.booking-item-review-content').find('.booking-item-review-expand-more').show();
3088        t.hide();
3089    });
3090    jQuery(function ($) {
3091        if (body.hasClass('rtl')) {
3092            var rtl_check = true;
3093        } else {
3094            var rtl_check = false;
3095        }
3096        $('.st-service-slider').each(function () {
3097            $(this).owlCarousel({
3098                loop: false,
3099                items: 4,
3100                margin: 20,
3101                responsiveClass: true,
3102                dots: false,
3103                rtl: rtl_check,
3104                responsive: {
3105                    0: {
3106                        items: 1,
3107                        nav: false,
3108                        margin: 15,
3109                        dots: true,
3110                    },
3111                    576: {
3112                        items: 2,
3113                        nav: false,
3114                        margin: 15,
3115                        dots: true,
3116                    },
3117                    992: {
3118                        items: 3,
3119                        nav: true,
3120                    },
3121                    1200: {
3122                        items: 4,
3123                        nav: true,
3124                    }
3125                }
3126            });
3127        });
3128
3129        $('.list-service-style2').each(function () {
3130            $(this).owlCarousel({
3131                loop: false,
3132                items: 3,
3133                margin: 20,
3134                responsiveClass: true,
3135                dots: true,
3136                rtl: rtl_check,
3137                responsive: {
3138                    0: {
3139                        items: 1,
3140                        nav: false,
3141                        margin: 15,
3142                    },
3143                    576: {
3144                        items: 2,
3145                        nav: false,
3146                        margin: 15,
3147                    },
3148                    992: {
3149                        items: 3,
3150                        nav: true,
3151                    },
3152                    1200: {
3153                        items: 3,
3154                        nav: true,
3155                    }
3156                }
3157            });
3158        });
3159        $('.list-service-style3').each(function () {
3160            $(this).owlCarousel({
3161                loop: false,
3162                items: 3,
3163                margin: 30,
3164                responsiveClass: true,
3165                dots: true,
3166                rtl: rtl_check,
3167                responsive: {
3168                    0: {
3169                        items: 1,
3170                        nav: false,
3171                        margin: 15,
3172                    },
3173                    576: {
3174                        items: 2,
3175                        nav: false,
3176                        margin: 15,
3177                    },
3178                    992: {
3179                        items: 3,
3180                        nav: true,
3181                    },
3182                    1200: {
3183                        items: 3,
3184                        nav: true,
3185                    }
3186                }
3187            });
3188        });
3189        $('.list-service-style4').each(function () {
3190            $(this).owlCarousel({
3191                loop: false,
3192                items: 3,
3193                margin: 30,
3194                responsiveClass: true,
3195                dots: true,
3196                rtl: rtl_check,
3197                nav: false,
3198                responsive: {
3199                    0: {
3200                        items: 1,
3201                        margin: 15,
3202                    },
3203                    576: {
3204                        items: 2,
3205                        margin: 15,
3206                    },
3207                    992: {
3208                        items: 3,
3209                    },
3210                    1200: {
3211                        items: 3,
3212                    }
3213                }
3214            });
3215        });
3216        $('.list-service-style5').each(function () {
3217            $(this).owlCarousel({
3218                loop: true,
3219                items: 3,
3220                margin: 30,
3221                responsiveClass: true,
3222                dots: false,
3223                nav: true,
3224                rtl: rtl_check,
3225                responsive: {
3226                    0: {
3227                        items: 1,
3228                        margin: 15,
3229                    },
3230                    576: {
3231                        items: 2,
3232                        margin: 15,
3233                    },
3234                    992: {
3235                        items: 3,
3236                    },
3237                    1200: {
3238                        items: 3,
3239                    }
3240                }
3241            });
3242        });
3243        $('.list-service-style6').each(function () {
3244            $(this).owlCarousel({
3245                loop: true,
3246                items: 3,
3247                margin: 30,
3248                responsiveClass: true,
3249                dots: true,
3250                nav: false,
3251                rtl: rtl_check,
3252                responsive: {
3253                    0: {
3254                        items: 1,
3255                        margin: 15,
3256                    },
3257                    576: {
3258                        items: 2,
3259                        margin: 15,
3260                    },
3261                    992: {
3262                        items: 3,
3263                    },
3264                    1200: {
3265                        items: 3,
3266                    }
3267                }
3268            });
3269        });
3270        $('.list-service-style7').each(function () {
3271            $(this).removeClass('row');
3272            $(this).addClass('owl-carousel');
3273            $(this).owlCarousel({
3274                loop: false,
3275                items: 3,
3276                margin: 30,
3277                responsiveClass: true,
3278                dots: false,
3279                rtl: rtl_check,
3280                nav: false,
3281                responsive: {
3282                    0: {
3283                        items: 1,
3284                        margin: 15,
3285                        dots: true,
3286                    },
3287                    768: {
3288                        items: 2,
3289                        margin: 30,
3290                        dots: true,
3291                    },
3292                    992: {
3293                        items: 3,
3294                        margin: 30,
3295                        dots: false,
3296                    },
3297                    1200: {
3298                        items: 3,
3299                    }
3300                }
3301            });
3302        });
3303        //Slider list of destination
3304        $('.list-destination-style8').each(function () {
3305            let t = $(this);
3306            var owl = $('.owl-carousel', t).owlCarousel({
3307                loop: true,
3308                margin: 30,
3309                items: 6,
3310                responsiveClass: true,
3311                dots: true,
3312                nav: true,
3313                rtl: rtl_check,
3314                responsive: {
3315                    0: {
3316                        items: 1,
3317                        nav: false,
3318                        margin: 15,
3319                    },
3320                    576: {
3321                        items: 2,
3322                        margin: 15,
3323                    },
3324                    767: {
3325                        items: 3,
3326                        nav: true,
3327                    },
3328                    992: {
3329                        items: 4,
3330                    },
3331                    1200: {
3332                        items: 6,
3333                        nav: true,
3334                    }
3335                }
3336            });
3337
3338        });
3339
3340        $('.st-service-rental-slider').each(function () {
3341            $(this).owlCarousel({
3342                loop: false,
3343                items: 3,
3344                margin: 20,
3345                rtl: rtl_check,
3346                responsiveClass: true,
3347                dots: true,
3348                responsive: {
3349                    0: {
3350                        items: 1,
3351                        nav: false,
3352                        margin: 15,
3353                    },
3354                    576: {
3355                        items: 2,
3356                        margin: 15,
3357                    },
3358                    992: {
3359                        items: 3,
3360                        nav: true,
3361                    },
3362                    1200: {
3363                        items: 3,
3364                        nav: true,
3365                    }
3366                }
3367            });
3368        });
3369
3370        $('.st-testimonial-new .style-3').each(function () {
3371            $(this).owlCarousel({
3372                loop: false,
3373                items: 4,
3374                rtl: rtl_check,
3375                margin: 30,
3376                responsiveClass: true,
3377                dots: true,
3378                nav: true,
3379                responsive: {
3380                    0: {
3381                        items: 1,
3382                        margin: 15,
3383                    },
3384                    767: {
3385                        items: 1,
3386                        margin: 15,
3387                    },
3388                    992: {
3389                        items: 2,
3390                    },
3391                    1200: {
3392                        items: 2,
3393                    }
3394                }
3395            });
3396        });
3397        $('.st-testimonial-new .style-4').each(function () {
3398            $(this).owlCarousel({
3399                loop: false,
3400                items: 1,
3401                responsiveClass: true,
3402                rtl: rtl_check,
3403                dots: true,
3404                responsive: {
3405                    0: {
3406                        items: 1,
3407
3408                    },
3409                    767: {
3410                        items: 1,
3411
3412                    },
3413                    992: {
3414                        items: 1,
3415                    },
3416                    1200: {
3417                        items: 1,
3418                    }
3419                }
3420            });
3421        });
3422        $('.st-testimonial-new .style-5').each(function () {
3423            $(this).owlCarousel({
3424                loop: false,
3425                rtl: rtl_check,
3426                items: 1,
3427                responsiveClass: true,
3428                dots: false,
3429                nav: true,
3430                responsive: {
3431                    0: {
3432                        items: 1,
3433
3434                    },
3435                    767: {
3436                        items: 1,
3437
3438                    },
3439                    992: {
3440                        items: 1,
3441                    },
3442                    1200: {
3443                        items: 1,
3444                    }
3445                }
3446            });
3447
3448            var parent = $(this);
3449            var data_image = $('.owl-item.active .item', parent).data('image');
3450            $('.st-testimonial-image img').attr("src", data_image);
3451
3452            $(this).on('translated.owl.carousel', function (event) {
3453                data_image = $('.owl-item.active .item', parent).data('image');
3454                $('.st-testimonial-image img').attr("src", data_image);
3455            });
3456
3457            /*var parent = $(this);
3458             var data_image = $('.owl-item.active .item',parent).data('image');
3459             $('.st-testimonial-image img').attr("src",data_image);
3460             $('.owl-nav button ',parent).on('click',function () {
3461             data_image = $('.owl-item.active .item',parent).data('image');
3462             $('.st-testimonial-image img').attr("src",data_image);
3463             })*/
3464        });
3465
3466        $(window).on('resize', function () {
3467            var screenWidth = $('body').width(),
3468                stTestimonialWidth = $('.st-testimonial-new').width(),
3469                leftMargin = (screenWidth - stTestimonialWidth) / 2;
3470
3471            $('.st-testimonial-image').css({
3472                'margin-left': '-' + leftMargin + 'px'
3473            });
3474
3475        }).trigger('resize');
3476
3477        $('.st-testimonial-slider').each(function () {
3478            $(this).owlCarousel({
3479                loop: false,
3480                items: 4,
3481                margin: 30,
3482                responsiveClass: true,
3483                dots: true,
3484                nav: false,
3485                responsive: {
3486                    0: {
3487                        items: 1,
3488                        margin: 15,
3489                    },
3490                    575: {
3491                        items: 2,
3492                        margin: 15,
3493                    },
3494                    992: {
3495                        items: 3,
3496                    },
3497                    1200: {
3498                        items: 3,
3499                    }
3500                }
3501            });
3502        });
3503
3504        $('.st-testimonial-solo-slider').each(function () {
3505            $(this).owlCarousel({
3506                loop: false,
3507                items: 1,
3508                margin: 30,
3509                responsiveClass: true,
3510                dots: true,
3511                nav: false
3512            });
3513        });
3514
3515        $('.owl-tour-program').each(function () {
3516            var parent = $(this).parent();
3517            var owl = $(this);
3518            owl.owlCarousel({
3519                loop: false,
3520                items: 3,
3521                margin: 20,
3522                responsiveClass: true,
3523                dots: false,
3524                nav: false,
3525                responsive: {
3526                    0: {
3527                        items: 1,
3528                        margin: 15,
3529                    },
3530                    992: {
3531                        items: 2,
3532                    },
3533                    1200: {
3534                        items: 3,
3535                    }
3536                }
3537            });
3538            $('.next', parent).on('click', function (ev) {
3539                ev.preventDefault();
3540                owl.trigger('next.owl.carousel');
3541            });
3542            $('.prev', parent).on('click', function (ev) {
3543                ev.preventDefault();
3544                owl.trigger('prev.owl.carousel');
3545            });
3546            owl.on('resized.owl.carousel', function () {
3547                setTimeout(function () {
3548                    if ($('.ovscroll').length) {
3549                        $.fn.getNiceScroll && $('.ovscroll').getNiceScroll().resize();
3550                    }
3551                }, 1000);
3552            });
3553        });
3554        $('.owl-tour-program-7').each(function () {
3555            var parent = $(this).parent();
3556            var owl = $(this);
3557            owl.owlCarousel({
3558                loop: false,
3559                items: 1,
3560                margin: 0,
3561                responsiveClass: true,
3562                dots: false,
3563                nav: true,
3564                responsive: {
3565                    0: {
3566                        items: 1,
3567                    },
3568                    992: {
3569                        items: 1,
3570                    },
3571                    1200: {
3572                        items: 1,
3573                    }
3574                }
3575            });
3576            owl.on('resized.owl.carousel', function () {
3577                setTimeout(function () {
3578                    if ($('.ovscroll').length) {
3579                        $.fn.getNiceScroll && $('.ovscroll').getNiceScroll().resize();
3580                    }
3581                }, 1000);
3582            });
3583        });
3584
3585        /* BG Slider */
3586        if ($('.search-form-wrapper.slider').length) {
3587            var heightSlider = $('.search-form-wrapper.slider').outerHeight();
3588            $('.st-bg-slider').fotorama({
3589                height: heightSlider
3590            });
3591            $(window).on('resize', function () {
3592                if ($('.search-form-wrapper.slider').length) {
3593                    var heightSlider = $('.search-form-wrapper.slider').outerHeight();
3594                    $('.st-bg-slider').fotorama({
3595                        height: heightSlider
3596                    });
3597                }
3598            });
3599        }
3600
3601    });
3602    var iex = 0;
3603    $('.st-program-list').each(function () {
3604        var t = $(this);
3605        $('.item .header', t).on('click', function () {
3606            $('.st-program .expand').text($('.st-program .expand').data('text-more'));
3607            iex = 0;
3608            $('.item', t).removeClass('active');
3609            $(this).parent().toggleClass('active');
3610        });
3611    });
3612    $('.st-program .expand').on('click', function () {
3613        var t = $(this);
3614        if (iex == 0) {
3615            $('.st-program .st-program-list .item').addClass('active');
3616            t.text(t.data('text-less'));
3617            iex = 1;
3618        } else {
3619            $('.st-program .st-program-list .item').removeClass('active');
3620            t.text(t.data('text-more'));
3621            iex = 0;
3622        }
3623    });
3624    $('.st-faq .item').each(function () {
3625        var t = $(this);
3626        t.find('.header').on('click', function () {
3627            $('.st-faq .item').not(t).removeClass('active');
3628            t.toggleClass('active');
3629        });
3630    });
3631    $(".st-video-popup").each(function () {
3632        $(this).magnificPopup({
3633            type: 'iframe'
3634        })
3635    });
3636    $('.st-gallery-popup').on('click', function (e) {
3637        e.preventDefault();
3638        var gallery = $(this).attr('href');
3639        $(gallery).magnificPopup({
3640            delegate: 'a',
3641            type: 'image',
3642            gallery: {
3643                enabled: true
3644            },
3645        }).magnificPopup('open');
3646    });
3647    //zzz
3648    $('.st-single-tour .form-date-search', body).each(function () {
3649        var parent = $(this),
3650            date_wrapper = $('.date-wrapper', parent),
3651            check_in_input = $('.check-in-input', parent),
3652            check_out_input = $('.check-out-input', parent),
3653            check_in_out_input = $('.check-in-out-input', parent),
3654            check_in_render = $('.check-in-render', parent),
3655            check_out_render = $('.check-out-render', parent),
3656            sts_checkout_label = $('.sts-tour-checkout-label', parent),
3657            availabilityDate = $(this).data('availability-date');
3658
3659        var customClass = $('.date-wrapper', parent).data('custom-class') || '';
3660
3661        var options = {
3662            singleDatePicker: true,
3663            showCalendar: false,
3664            sameDate: true,
3665            autoApply: true,
3666            disabledPast: true,
3667            dateFormat: 'DD/MM/YYYY',
3668            enableLoading: true,
3669            showEventTooltip: true,
3670            classNotAvailable: ['disabled', 'off'],
3671            disableHightLight: true,
3672            customClass: customClass,
3673            fetchEvents: function (start, end, el, callback) {
3674                var events = [];
3675                if (el.flag_get_events) {
3676                    return false;
3677                }
3678                el.flag_get_events = true;
3679                el.container.find('.loader-wrapper').show();
3680                var data = {
3681                    action: check_in_out_input.data('action'),
3682                    start: start.format('YYYY-MM-DD'),
3683                    end: end.format('YYYY-MM-DD'),
3684                    //tour_id: check_in_out_input.data('tour-id'),
3685                    security: st_params._s
3686                };
3687                var postType = check_in_out_input.data('posttype');
3688                if (typeof postType !== 'undefined' && postType === 'st_activity') {
3689                    data['activity_id'] = check_in_out_input.data('tour-id');
3690                } else {
3691                    data['tour_id'] = check_in_out_input.data('tour-id');
3692                }
3693
3694                $.post(st_params.ajax_url, data, function (respon) {
3695                    if (typeof respon === 'object') {
3696                        if (typeof respon.events === 'object') {
3697                            events = respon.events;
3698                        } else {
3699                            events = respon;
3700                        }
3701                    } else {
3702                        console.log('Can not get data');
3703                    }
3704                    callback(events, el);
3705                    el.flag_get_events = false;
3706                    el.container.find('.loader-wrapper').hide();
3707                }, 'json');
3708            }
3709        };
3710
3711        if (typeof availabilityDate != 'undefined') {
3712            options['minDate'] = availabilityDate;
3713        }
3714
3715        if (typeof locale_daterangepicker == 'object') {
3716            options.locale = locale_daterangepicker;
3717        }
3718        check_in_out_input.daterangepicker(options,
3719            function (start, end, label, elmDate) {
3720                check_in_input.val(start.format(parent.data('format'))).trigger('change');
3721                check_out_input.val(end.format(parent.data('format'))).trigger('change');
3722                check_in_render.html(start.format(parent.data('format'))).trigger('change');
3723                check_out_render.html(end.format(parent.data('format'))).trigger('change');
3724                if (start.format(parent.data('format')).toString() == end.format(parent.data('format')).toString()) {
3725                    sts_checkout_label.hide();
3726                } else {
3727                    sts_checkout_label.show();
3728                }
3729                if (typeof elmDate !== 'undefined' && elmDate !== false) {
3730                    if ($('.st-single-tour').length > 0) {
3731                        if (elmDate.target.classList.contains('has_starttime')) {
3732                            ajaxSelectStartTime(check_in_out_input.data('tour-id'), start.format(parent.data('format')), end.format(parent.data('format')), '', check_in_out_input.data('posttype'));
3733                        } else {
3734                            $('#starttime_tour option').remove();
3735                            $('#starttime_box').parent().hide();
3736                        }
3737                    }
3738                }
3739                if (st_params.caculator_price_single_ajax === 'on') {
3740                    if ($('.single-st_tours').length > 0) {
3741                        date_wrapper.trigger('tours-booking-form');
3742                    }
3743
3744                    if ($('.single-st_activity').length > 0) {
3745                        date_wrapper.trigger('activity-booking-form');
3746                    }
3747
3748                }
3749
3750            });
3751        date_wrapper.on('click', function (e) {
3752            check_in_out_input.trigger('click');
3753        });
3754    });
3755    if ($('.logo').length) {
3756        var logoWidth = $('.logo').width();
3757        if ($('.has-mega-menu .mega-menu').length) {
3758            var stMegaWidth = $('.has-mega-menu .mega-menu .st-mega').first().outerWidth();
3759            $('.has-mega-menu .mega-menu').css({
3760                left: (logoWidth + 60) + 'px',
3761                width: stMegaWidth + 'px'
3762            });
3763            $('.has-mega-menu .mega-menu .st-mega').css({
3764                width: '100%'
3765            });
3766            $(window).on('resize', function () {
3767                var winDowsWidth = $('#header').width();
3768                if (winDowsWidth < (stMegaWidth + logoWidth + 130)) {
3769                    var megaWidth = winDowsWidth - (logoWidth + 130);
3770                    $('.has-mega-menu .mega-menu').css({
3771                        width: megaWidth + 'px',
3772                    });
3773                } else {
3774                    $('.has-mega-menu .mega-menu').css({
3775                        width: stMegaWidth + 'px',
3776                    });
3777                }
3778                if (window.matchMedia("(min-width: 992px)").matches) {
3779                    $('.has-mega-menu .mega-menu').show();
3780                } else {
3781                    $('.has-mega-menu .mega-menu').hide();
3782                }
3783            });
3784        }
3785    }
3786    var checkExWoo = 0;
3787    $('.booking-item-review-expand-new').on('click', function (e) {
3788        e.preventDefault();
3789        var t = $(this);
3790        var textMore = t.data('more');
3791        var textLess = t.data('hide');
3792        if (t.hasClass('collapsed')) {
3793            t.html(textLess);
3794        } else {
3795            if (checkExWoo == 0) {
3796                t.html(textLess);
3797                checkExWoo++;
3798            } else {
3799                t.html(textMore);
3800            }
3801        }
3802        t.closest('.booking-item-review-content').find('.booking-item-review-more').slideToggle();
3803    });
3804    if (typeof $('.player').YTPlayer === 'function') {
3805        $('.btn-play-video').on('click', function (e) {
3806            e.preventDefault();
3807            if (typeof player == 'undefined') {
3808                var player = jQuery(".player").YTPlayer({
3809                    align: "center,center"
3810                });
3811            }
3812            var t = $(this);
3813            if (t.hasClass('play')) {
3814                player.YTPPlay();
3815                t.removeClass('play')
3816            } else {
3817                player.YTPPause();
3818                t.addClass('play')
3819            }
3820        });
3821    }
3822    if ($('#starttime_hidden_load_form').length > 0) {
3823        $('#starttime_box').each(function () {
3824            var meS = $(this);
3825            var st_data_tour_id = $('#starttime_hidden_load_form').data('tourid');
3826            var st_data_starttime = $('#starttime_hidden_load_form').data('starttime');
3827            var st_data_checkin = $('#starttime_hidden_load_form').data('checkin');
3828            var st_data_checkout = $('#starttime_hidden_load_form').data('checkout');
3829            var st_posttype = $('#starttime_hidden_load_form').data('posttype');
3830            if (st_data_starttime != "" && typeof st_data_starttime !== 'undefined') {
3831                ajaxSelectStartTime(st_data_tour_id, st_data_checkin, st_data_checkout, st_data_starttime, st_posttype);
3832            }
3833        });
3834    }
3835
3836    function ajaxSelectStartTime(tour_id, check_in, check_out, select_starttime, posttype = 'st_tours') {
3837        var sparent = $('.fixed-on-mobile');
3838        var overlay = $('.loader-wrapper', sparent);
3839        var data = {
3840            check_in: check_in,
3841            check_out: check_out
3842        };
3843        if (posttype === 'st_activity') {
3844            data['action'] = 'st_get_starttime_activity_frontend';
3845            data['activity_id'] = tour_id;
3846        } else {
3847            data['action'] = 'st_get_starttime_tour_frontend';
3848            data['tour_id'] = tour_id;
3849        }
3850        overlay.hide();
3851        $.ajax({
3852            url: st_params.ajax_url,
3853            dataType: 'json',
3854            type: 'post',
3855            data: data,
3856            beforeSend: function () {
3857                overlay.show();
3858            },
3859            success: function (doc) {
3860                var i = 0;
3861                if (doc['data'] != null && doc['data'].length > 0) {
3862                    $('#starttime_tour option').remove();
3863                    $('#starttime_box').parent().show();
3864                    var te = '';
3865                    for (i = 0; i < doc['data'].length; i++) {
3866                        var op_disable = '';
3867                        if (doc['check'][i] == '-1') {
3868                            if (doc['data'][i] == select_starttime) {
3869                                te += '<option value="' + doc['data'][i] + '" selected ' + op_disable + '>' + doc['data'][i] + '</option>';
3870                            } else {
3871                                te += '<option value="' + doc['data'][i] + '" ' + op_disable + '>' + doc['data'][i] + '</option>';
3872                            }
3873                        } else {
3874                            if (doc['check'][i] == '0') {
3875                                //op_disable = 'disabled="disabled"';
3876                                if (doc['data'][i] == select_starttime) {
3877                                    te += '<option value="' + doc['data'][i] + '" selected ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.no_vacancy + ' )' + '</option>';
3878                                } else {
3879                                    te += '<option value="' + doc['data'][i] + '" ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.no_vacancy + ' )' + '</option>';
3880                                }
3881                            } else {
3882                                if (doc['data'][i] == select_starttime) {
3883                                    if (doc['check'][i] == '1') {
3884                                        te += '<option value="' + doc['data'][i] + '" selected ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.a_vacancy + ' )' + '</option>';
3885                                    } else {
3886                                        if (doc['check'][i] < 0) {
3887                                            te += '<option value="' + doc['data'][i] + '" selected ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.no_vacancy + ' )' + '</option>';
3888                                        } else {
3889                                            te += '<option value="' + doc['data'][i] + '" selected ' + op_disable + '>' + doc['data'][i] + ' ( ' + doc['check'][i] + ' ' + st_params.more_vacancy + ' )' + '</option>';
3890                                        }
3891                                    }
3892                                } else {
3893                                    if (doc['check'][i] == '1') {
3894                                        te += '<option value="' + doc['data'][i] + '" ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.a_vacancy + ' )' + '</option>';
3895                                    } else {
3896                                        if (doc['check'][i] < 0) {
3897                                            te += '<option value="' + doc['data'][i] + '" ' + op_disable + '>' + doc['data'][i] + ' ( ' + st_params.no_vacancy + ' )' + '</option>';
3898                                        } else {
3899                                            te += '<option value="' + doc['data'][i] + '" ' + op_disable + '>' + doc['data'][i] + ' ( ' + doc['check'][i] + ' ' + st_params.more_vacancy + ' )' + '</option>';
3900                                        }
3901                                    }
3902                                }
3903                            }
3904                        }
3905                    }
3906                    $('#starttime_tour option').remove();
3907                    $('#starttime_tour').append(te);
3908                    overlay.hide();
3909                } else {
3910                    $('#starttime_box').parent().hide();
3911                    overlay.hide();
3912                }
3913            },
3914        });
3915    }
3916    $('.search-form-wrapper.slider a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
3917        var slideHeight = $('.search-form-wrapper.slider').outerHeight();
3918        var ft = $('.st-bg-slider').data('fotorama');
3919        if (typeof ft !== 'undefined') {
3920            ft.resize({
3921                height: slideHeight
3922            });
3923        }
3924
3925    });
3926    $('.st-list-of-multi-services').each(function () {
3927        var t = $(this);
3928        var dataTabShowVal = $('.st-list-dropdown .header', t).data('value');
3929        $('.multi-service-wrapper .tab-content.' + dataTabShowVal, t).show();
3930        $('.has-matchHeight', t).matchHeight({
3931            remove: true
3932        });
3933        $('.has-matchHeight', t).matchHeight();
3934    });
3935    $('.st-list-dropdown').each(function () {
3936        var t = $(this);
3937        var parent = t.closest('.st-list-of-multi-services');
3938        var currentTabList = t.find('.header').data('value');
3939        $('.list', t).find('li[data-value="' + currentTabList + '"]').hide();
3940        $('.header', t).on('click', function () {
3941            $('.list', t).toggle();
3942        });
3943        $('.list li', t).on('click', function () {
3944            var me = $(this);
3945            $('.list li', t).removeClass('active');
3946            me.addClass('active');
3947            var dataS = me.data('value');
3948            var dataArg = me.data('arg');
3949            var dataSName = me.text();
3950            $('.header span', t).text(dataSName);
3951            $('.header', t).attr('data-value', dataS);
3952            me.parent().hide();
3953            $.ajax({
3954                url: st_params.ajax_url,
3955                type: "GET",
3956                data: {
3957                    'action': "st_list_of_service_" + dataS,
3958                    'dataArg': dataArg,
3959                },
3960                dataType: "json",
3961                beforeSend: function () {
3962                    parent.find('.map-loading').html('<div class="st-loader"></div>');
3963                    parent.find('.map-loading').css('z-index', 99);
3964                    parent.find('.map-loading').show();
3965
3966                },
3967                error: function (jqXHR, textStatus, errorThrown) {},
3968                success: function (res) {
3969                    parent.find('.map-loading').html("");
3970                    parent.find('.map-loading').hide();
3971                },
3972                complete: function (xhr, status) {
3973
3974                    if (xhr.responseJSON) {
3975
3976                        parent.find('.multi-service-wrapper').html(xhr.responseJSON.html).hide().fadeIn(1500);
3977
3978                        $('.multi-service-wrapper .tab-content', parent).hide();
3979                        $('.multi-service-wrapper .tab-content.' + dataS, parent).show();
3980                        setTimeout(function () {
3981                            $('.multi-service-wrapper .tab-content .has-matchHeight', parent).matchHeight({
3982                                remove: true
3983                            });
3984                            $('.multi-service-wrapper .tab-content .has-matchHeight', parent).matchHeight();
3985                        }, 1000);
3986                        $('.list li', t).show();
3987                        $('.list', t).find('li[data-value="' + dataS + '"]').hide();
3988                    }
3989                    $('.st-service-slider').each(function () {
3990                        $(this).owlCarousel({
3991                            loop: false,
3992                            items: 4,
3993                            margin: 20,
3994                            responsiveClass: true,
3995                            dots: false,
3996                            responsive: {
3997                                0: {
3998                                    items: 1,
3999                                    nav: false,
4000                                    margin: 15,
4001                                    dots: true,
4002                                },
4003                                576: {
4004                                    items: 2,
4005                                    nav: false,
4006                                    margin: 15,
4007                                    dots: true,
4008                                },
4009                                992: {
4010                                    items: 3,
4011                                    nav: true,
4012                                },
4013                                1200: {
4014                                    items: 4,
4015                                    nav: true,
4016                                }
4017                            }
4018                        });
4019                    });
4020                }
4021            });
4022        })
4023        $(document).on('mouseup', function (e) {
4024            var container = t;
4025            if (!container.is(e.target) && container.has(e.target).length === 0) {
4026                container.find('.list').hide();
4027            }
4028        });
4029    });
4030    if ($('.search-form-wrapper.mix').length > 0) {
4031        if (window.matchMedia("(max-width: 991px)").matches) {
4032            var heightTabMix = [];
4033            $('.search-form-wrapper.mix .tab-content .tab-pane').each(function () {
4034                var idNameTabMix = $(this).attr('id');
4035                var tabMixShowEl = document.querySelector('.search-form-wrapper.mix .tab-pane#' + idNameTabMix),
4036                    tabMixWantedHeight = getHeightHiddenEl(tabMixShowEl);
4037                heightTabMix.push(tabMixWantedHeight);
4038            });
4039            if (heightTabMix.length) {
4040                var maxHeightTabMix = Math.max.apply(null, heightTabMix);
4041                var maxHeightPos = heightTabMix.indexOf(maxHeightTabMix);
4042                $('.search-form-wrapper.mix .tab-content .tab-pane').each(function (i, obj) {
4043                    if (i === maxHeightPos)
4044                        $(this).css('height', (maxHeightTabMix - 1) + 'px');
4045                    else
4046                        $(this).css('height', maxHeightTabMix + 'px');
4047                });
4048            }
4049        }
4050    }
4051})(jQuery);
4052
4053function initMapContactPage(mapEl) {
4054    var mapStylesContact = [{
4055            "elementType": "labels",
4056            "stylers": [{
4057                "visibility": "off"
4058            }]
4059        },
4060        {
4061            "featureType": "administrative",
4062            "elementType": "geometry",
4063            "stylers": [{
4064                "visibility": "off"
4065            }]
4066        },
4067        {
4068            "featureType": "administrative.land_parcel",
4069            "stylers": [{
4070                "visibility": "off"
4071            }]
4072        },
4073        {
4074            "featureType": "administrative.neighborhood",
4075            "stylers": [{
4076                "visibility": "off"
4077            }]
4078        },
4079        {
4080            "featureType": "poi",
4081            "stylers": [{
4082                "visibility": "off"
4083            }]
4084        },
4085        {
4086            "featureType": "road",
4087            "elementType": "labels.icon",
4088            "stylers": [{
4089                "visibility": "off"
4090            }]
4091        },
4092        {
4093            "featureType": "transit",
4094            "stylers": [{
4095                "visibility": "off"
4096            }]
4097        }
4098    ];
4099    var mapLat = mapEl.data('lat');
4100    var mapLng = mapEl.data('lng');
4101    var map = new google.maps.Map(document.getElementById('contact-map-new'), {
4102        zoom: 13,
4103        center: {
4104            lat: parseFloat(mapLat),
4105            lng: parseFloat(mapLng)
4106        },
4107        disableDefaultUI: true,
4108        styles: mapStylesContact
4109    });
4110    new google.maps.Marker({
4111        position: new google.maps.LatLng(mapLat, mapLng),
4112        icon: st_params.icon_contact_map,
4113        map: map,
4114    });
4115}
4116
4117function customControlGoogleMap(mapEl, map) {
4118    //==== Top Right area
4119    var topRightArea = document.createElement('div');
4120    topRightArea.className = 'google-control-top-right-area';
4121    var controlFullScreen = document.createElement('div');
4122    controlFullScreen.className = 'google-control-fullscreen google-custom-control';
4123    controlFullScreen.innerHTML = '<img src="' + st_list_map_params.icon_full_screen + '" alt="Full Screen"/>';
4124    topRightArea.appendChild(controlFullScreen);
4125    var controlCloseFullScreen = document.createElement('div');
4126    controlCloseFullScreen.className = 'google-control-closefullscreen google-custom-control hide';
4127    controlCloseFullScreen.innerHTML = '<img src="' + st_list_map_params.icon_close + '" alt="Full Screen"/>';
4128    topRightArea.appendChild(controlCloseFullScreen);
4129    var controlMyLocation = document.createElement('div');
4130    controlMyLocation.className = 'google-control-mylocation google-custom-control';
4131    controlMyLocation.innerHTML = '<img src="' + st_list_map_params.icon_my_location + '" alt="Full Screen"/>';
4132    topRightArea.appendChild(controlMyLocation);
4133    var controlStyles = document.createElement('div');
4134    controlStyles.className = 'google-control-styles google-custom-control';
4135    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>';
4136    topRightArea.appendChild(controlStyles);
4137    //==== Bottom Right area
4138    var bottomRightArea = document.createElement('div');
4139    bottomRightArea.className = 'google-control-bottom-right-area';
4140    var controlZoomIn = document.createElement('div');
4141    controlZoomIn.className = 'google-control-zoomin google-custom-control';
4142    controlZoomIn.innerHTML = '<img src="' + st_list_map_params.icon_zoom_in + '" alt="Full Screen"/>';
4143    bottomRightArea.appendChild(controlZoomIn);
4144    var controlZoomOut = document.createElement('div');
4145    controlZoomOut.className = 'google-control-zoomout google-custom-control';
4146    controlZoomOut.innerHTML = '<img src="' + st_list_map_params.icon_zoom_out + '" alt="Full Screen"/>';
4147    bottomRightArea.appendChild(controlZoomOut);
4148    map.controls[google.maps.ControlPosition.RIGHT_TOP].push(topRightArea);
4149    map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(bottomRightArea);
4150    controlFullScreen.addEventListener('click', function () {
4151        controlFullScreen.classList.add('hide');
4152        controlCloseFullScreen.classList.remove('hide');
4153        var element = map.getDiv();
4154        if (element.requestFullscreen) {
4155            element.requestFullscreen();
4156        }
4157        if (element.webkitRequestFullScreen) {
4158            element.webkitRequestFullScreen();
4159        }
4160        if (element.mozRequestFullScreen) {
4161            element.mozRequestFullScreen();
4162        }
4163    });
4164    controlCloseFullScreen.addEventListener('click', function () {
4165        controlFullScreen.classList.remove('hide');
4166        controlCloseFullScreen.classList.add('hide');
4167        if (document.exitFullscreen)
4168            document.exitFullscreen();
4169        else if (document.webkitExitFullscreen)
4170            document.webkitExitFullscreen();
4171        else if (document.mozCancelFullScreen)
4172            document.mozCancelFullScreen();
4173        else if (document.msExitFullscreen)
4174            document.msExitFullscreen();
4175    });
4176    controlMyLocation.addEventListener('click', function () {
4177        if (navigator.geolocation)
4178            navigator.geolocation.getCurrentPosition(function (pos) {
4179                var latlng = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
4180                map.setCenter(latlng);
4181                new google.maps.Marker({
4182                    position: latlng,
4183                    icon: mapEl.data().icon,
4184                    map: map
4185                });
4186            }, function (error) {
4187                console.log('Can not get your Location');
4188            });
4189    });
4190    controlZoomIn.addEventListener('click', function () {
4191        var current = map.getZoom();
4192        map.setZoom(current + 1);
4193    });
4194    controlZoomOut.addEventListener('click', function () {
4195        var current = map.getZoom();
4196        map.setZoom(current - 1);
4197    });
4198    controlStyles.addEventListener('click', function () {
4199        controlStyles.querySelector('.google-control-dropdown').classList.toggle('show');
4200    });
4201    var dropdownStyles = controlStyles.querySelector('.google-control-dropdown');
4202    var items = dropdownStyles.querySelectorAll('.item');
4203    for (var i = 0; i < items.length; i++) {
4204        items[i].addEventListener('click', function () {
4205            var style = item.textContent.toLowerCase();
4206            if (mapStyles[style]) {
4207                map.setOptions({
4208                    styles: mapStyles[style]
4209                });
4210            }
4211        });
4212    }
4213}
4214
4215function initMapDetail(mapEl, mapData, mapLat, mapLng, mapZoom, mapIcon) {
4216    // var popupPos = mapEl.data('popup-position');
4217    // if (mapData.length <= 0)
4218    mapData = mapEl.data('data_show');
4219    if (mapLat.length <= 0)
4220        mapLat = mapEl.data('lat');
4221    if (mapLng.length <= 0)
4222        mapLng = mapEl.data('lng');
4223    if (mapZoom.length <= 0)
4224        mapZoom = 16;
4225    if (mapIcon.length <= 0)
4226        mapIcon = mapEl.data('icon');
4227    var map = new google.maps.Map(document.getElementById('list_map'), {
4228        zoom: mapZoom,
4229        center: new google.maps.LatLng(mapLat, mapLng),
4230        mapTypeId: google.maps.MapTypeId.ROADMAP
4231    });
4232    var infowindow = new google.maps.InfoWindow({
4233        maxWidth: 400,
4234        maxHeight: 300
4235    });
4236    var marker, i;
4237
4238    if (typeof mapData != 'undefined' && Object.keys(mapData).length) {
4239        var markers = jQuery.map(mapData, function (location, i) {
4240            var icon = {
4241                url: mapData[i].icon_mk,
4242                size: {
4243                    width: 40,
4244                    height: 50
4245                },
4246                origin: new google.maps.Point(0, 0), // origin
4247            };
4248            marker = new google.maps.Marker({
4249                position: new google.maps.LatLng(parseFloat(mapData[i].lat), parseFloat(mapData[i].lng)),
4250                map: map,
4251                icon: icon,
4252                optimized: false
4253            });
4254
4255            bounds = new google.maps.LatLngBounds();
4256            var loc = new google.maps.LatLng(parseFloat(mapData[i].lat), parseFloat(mapData[i].lng));
4257            bounds.extend(loc);
4258            var ibOptions = {
4259                content: '',
4260                disableAutoPan: true,
4261                maxWidth: 0,
4262                zIndex: null,
4263                boxStyle: {
4264                    padding: "0px 0px 0px 0px",
4265                },
4266                closeBoxURL: "",
4267                cancelBubble: true,
4268                infoBoxClearance: new google.maps.Size(1, 1),
4269                isHidden: false,
4270                pane: "floatPane",
4271                enableEventPropagation: true,
4272                alignBottom: true
4273            };
4274            if (i < Object.keys(mapData).length) {
4275                google.maps.event.addListener(marker, 'click', (function (marker, i) {
4276                    return function () {
4277                        infowindow.setContent(mapData[i].content_html);
4278                        if ((mapData[i].lat != mapLat) && (mapData[i].lng != mapLng)) {
4279                            infowindow.open(map, marker);
4280                        }
4281
4282                    }
4283                })(marker, i));
4284            }
4285
4286        });
4287    }
4288
4289}
4290
4291function initHalfMap(mapEl, mapData, mapLat, mapLng, mapZoom, mapIcon) {
4292    var popupPos = mapEl.data('popup-position');
4293    if (mapData.length <= 0)
4294        mapData = mapEl.data('data_show');
4295    if (mapLat.length <= 0)
4296        mapLat = mapEl.data('lat');
4297    if (mapLng.length <= 0)
4298        mapLng = mapEl.data('lng');
4299    if (mapZoom.length <= 0)
4300        mapZoom = mapEl.data('zoom');
4301    if (mapIcon.length <= 0)
4302        mapIcon = mapEl.data('icon');
4303    var map = new google.maps.Map(mapEl.get(0), {
4304        zoom: mapZoom,
4305        center: {
4306            lat: parseFloat(mapLat),
4307            lng: parseFloat(mapLng)
4308        },
4309        disableDefaultUI: true
4310    });
4311    bounds = new google.maps.LatLngBounds();
4312    if (typeof mapData != 'undefined' && Object.keys(mapData).length) {
4313        var marker = [];
4314        var ib = [];
4315        var c = {};
4316        var markers = jQuery.map(mapData, function (location, i) {
4317            marker[i] = new google.maps.Marker({
4318                position: {
4319                    lat: parseFloat(location.lat),
4320                    lng: parseFloat(location.lng)
4321                },
4322                options: {
4323                    icon: mapIcon,
4324                    animation: google.maps.Animation.DROP
4325                },
4326                map: map
4327            });
4328            var loc = new google.maps.LatLng(parseFloat(location.lat), parseFloat(location.lng));
4329            bounds.extend(loc);
4330            var ibOptions = {
4331                content: '',
4332                disableAutoPan: true,
4333                maxWidth: 0,
4334                pixelOffset: new google.maps.Size(-135, -55),
4335                zIndex: null,
4336                boxStyle: {
4337                    padding: "0px 0px 0px 0px",
4338                    width: "270px",
4339                },
4340                closeBoxURL: "",
4341                cancelBubble: true,
4342                infoBoxClearance: new google.maps.Size(1, 1),
4343                isHidden: false,
4344                pane: "floatPane",
4345                enableEventPropagation: true,
4346                alignBottom: true
4347            };
4348            if (window.matchMedia("(min-width: 768px)").matches) {
4349                if (popupPos == 'right') {
4350                    ibOptions.pixelOffset = new google.maps.Size(35, -208);
4351                    ibOptions.alignBottom = false;
4352                }
4353            }
4354            jQuery(window).on('resize', function () {
4355                if (window.matchMedia("(min-width: 768px)").matches) {
4356                    if (popupPos == 'right') {
4357                        ibOptions.pixelOffset = new google.maps.Size(35, -208);
4358                        ibOptions.alignBottom = false;
4359                    }
4360                }
4361            });
4362            google.maps.event.addListener(marker[i], 'click', (function () {
4363                var source = location.content_html;
4364                var boxText = document.createElement("div");
4365                if (window.matchMedia("(min-width: 768px)").matches) {
4366                    if (popupPos == 'right') {
4367                        boxText.classList.add("right-box");
4368                    }
4369                }
4370                jQuery(window).on('resize', function () {
4371                    if (window.matchMedia("(min-width: 768px)").matches) {
4372                        if (popupPos == 'right') {
4373                            boxText.classList.add("right-box");
4374                        }
4375                    } else {
4376                        boxText.classList.remove("right-box");
4377                    }
4378                });
4379                boxText.style.cssText = "border-radius: 5px; background: #fff; padding: 0px;";
4380                boxText.innerHTML = source;
4381                ibOptions.content = boxText;
4382                var ks = Object.keys(c);
4383                if (ks.length) {
4384                    for (var j = 0; j < ks.length; j++) {
4385                        c[ks[j]].close();
4386                    }
4387                }
4388                ib[i] = new InfoBox(ibOptions);
4389                c[i] = ib[i];
4390                ib[i].open(map, this);
4391                map.panTo(ib[i].getPosition());
4392                google.maps.event.addListener(ib[i], 'domready', function () {
4393                    var closeInfoBox = document.getElementById("close-popup-on-map");
4394                    google.maps.event.addDomListener(closeInfoBox, 'click', function () {
4395                        ib[i].close();
4396                    });
4397                });
4398            }));
4399            return marker[i];
4400        });
4401        /*new MarkerClusterer(map, markers,
4402         {
4403         styles: [{
4404         height   : 36,
4405         url      : st_params.mclusmap,
4406         width    : 36,
4407         textColor: 'white',
4408         textSize : '16'
4409         }, {
4410         height   : 36,
4411         url      : st_params.mclusmap,
4412         width    : 36,
4413         textColor: 'white',
4414         textSize : '16'
4415         }, {
4416         height   : 36,
4417         url      : st_params.mclusmap,
4418         width    : 36,
4419         textColor: 'white',
4420         textSize : '16'
4421         }]
4422         });*/
4423        customControlGoogleMap(mapEl.get(0), map);
4424    }
4425    // map.fitBounds(bounds);
4426    map.panToBounds(bounds);
4427    var listener = google.maps.event.addListener(map, "idle", function () {
4428        if (map.getZoom() > 16)
4429            map.setZoom(16);
4430        google.maps.event.removeListener(listener);
4431    });
4432}
4433/*Send email all in single service*/
4434(function ($) {
4435    'use strict';
4436    var body = $('body');
4437    $(".form-st-send-mail .st_send-mail-form").on('submit', function (e) {
4438        return false;
4439    });
4440    $('.form-st-send-mail .st_send-mail-form .sent-email-st').on('click', function (ev) {
4441        ev.preventDefault();
4442        var type_service = $("input[name=type_service]").val();
4443        var name_service = $("input[name=name_service]").val();
4444        var name_st = $("input[name=name_st]").val();
4445        var email_st = $("input[name=email_st]").val();
4446        var phone_st = $("input[name=phone_st]").val();
4447        var content_st = $("textarea[name=content_st]").val();
4448        var email_owl = $("input[name=email_owl]").val();
4449        $('.st-sent-mail-customer .loader-wrapper').show();
4450        $.ajax({
4451            url: st_params.ajax_url,
4452            type: "GET",
4453            data: {
4454                'action': "st_send_email_single_service",
4455                'type_service': type_service,
4456                'name_service': name_service,
4457                'name_st': name_st,
4458                'email_st': email_st,
4459                'phone_st': phone_st,
4460                'content_st': content_st,
4461                'email_owl': email_owl
4462            },
4463            dataType: "json",
4464            beforeSend: function () {},
4465            error: function (jqXHR, textStatus, errorThrown) {},
4466            success: function (res) {
4467
4468            },
4469            complete: function (xhr, status) {
4470
4471                if (xhr.responseJSON.status != 0) {
4472                    var mess = '<div class="ccv-success"><div class="content-message">' + xhr.responseJSON.message + '</div></div>';
4473                    $('.form-st-send-mail .st_send-mail-form').html(mess);
4474                    $('.st-sent-mail-customer .loader-wrapper').hide();
4475                } else {
4476                    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>';
4477                    $('.form-st-send-mail .message-wrapper-sendemail').html(mess);
4478                    $('.st-sent-mail-customer .loader-wrapper').hide();
4479                }
4480            }
4481        });
4482    });
4483})(jQuery);
4484
4485(function ($) {
4486    // single hotel room booking ajax
4487    $('form.hotel-room-booking-form').on('click', 'button.btn-book-ajax', function (e) {
4488        e.preventDefault();
4489        var form = $('form.hotel-room-booking-form');
4490        var data = $('form.hotel-room-booking-form').serializeArray();
4491        var loadingSubmit = form.find('button[name=submit]');
4492        $(loadingSubmit).find("i.fa-spin").removeClass("hide");
4493        data.push({
4494            name: 'security',
4495            value: st_params._s
4496        });
4497        $('div.message-wrapper').html("");
4498        $.ajax({
4499            url: st_params.ajax_url,
4500            method: "post",
4501            dataType: 'json',
4502            data: data,
4503            beforeSend: function () {
4504                $('div.message-wrapper').html("");
4505            },
4506            success: function (res) {
4507                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4508                if (res) {
4509                    if (res.status) {
4510                        if (res.redirect) {
4511                            window.location = res.redirect;
4512                        }
4513                    } else {
4514                        if (res.message) {
4515                            $('div.message-wrapper').html(res.message);
4516                        }
4517                    }
4518                }
4519            },
4520            error: function (err) {
4521                $('div.message-wrapper').html("");
4522                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4523            }
4524        });
4525    });
4526
4527    // activity booking ajax
4528    $('form.activity-booking-form').on('click', 'button.btn-book-ajax', function (e) {
4529        e.preventDefault();
4530        var form = $('form.activity-booking-form');
4531        var data = $('form.activity-booking-form').serializeArray();
4532        var loadingSubmit = form.find('button[name=submit]');
4533        $(loadingSubmit).find("i.fa-spin").removeClass("hide");
4534        data.push({
4535            name: 'security',
4536            value: st_params._s
4537        });
4538        $('div.message-wrapper').html("");
4539        $.ajax({
4540            url: st_params.ajax_url,
4541            method: "post",
4542            dataType: 'json',
4543            data: data,
4544            beforeSend: function () {
4545                $('div.message-wrapper').html("");
4546            },
4547            success: function (res) {
4548                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4549                if (res) {
4550                    if (res.status) {
4551                        if (res.redirect) {
4552                            window.location = res.redirect;
4553                        }
4554                    } else {
4555                        if (res.message) {
4556                            $('div.message-wrapper').html(res.message);
4557                        }
4558                    }
4559                }
4560            },
4561            error: function (err) {
4562                $('div.message-wrapper').html("");
4563                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4564            }
4565        });
4566    });
4567
4568    // tour booking ajax
4569    $('form.tour-booking-form').on('click', 'button.btn-book-ajax', function (e) {
4570        e.preventDefault();
4571        var form = $('form.tour-booking-form');
4572        var data = $('form.tour-booking-form').serializeArray();
4573        var loadingSubmit = form.find('button[name=submit]');
4574        $(loadingSubmit).find("i.fa-spin").removeClass("hide");
4575        data.push({
4576            name: 'security',
4577            value: st_params._s
4578        });
4579        $('div.message-wrapper').html("");
4580        if (jQuery('#st-content-wrapper').hasClass('st-content-wrapper--solo')) {
4581            data.push({
4582                name: 'disable_require_name',
4583                value: true
4584            });
4585        }
4586        $.ajax({
4587            url: st_params.ajax_url,
4588            method: "post",
4589            dataType: 'json',
4590            data: data,
4591            beforeSend: function () {
4592                $('div.message-wrapper').html("");
4593            },
4594            success: function (res) {
4595                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4596                if (res) {
4597                    if (res.status) {
4598                        if (res.redirect) {
4599                            window.location = res.redirect;
4600                        }
4601                    } else {
4602                        if (res.message) {
4603                            $('#form-booking-inpage .message-wrapper').html(res.message);
4604                        }
4605                    }
4606                }
4607            },
4608            error: function (err) {
4609                $('div.message-wrapper').html("");
4610                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4611            }
4612        });
4613    });
4614
4615    // car booking ajax
4616    $('form.car-booking-form').on('click', 'button.btn-book-ajax', function (e) {
4617        e.preventDefault();
4618        var form = $('form.car-booking-form');
4619        var data = $('form.car-booking-form').serializeArray();
4620        var loadingSubmit = form.find('button[name=submit]');
4621        $(loadingSubmit).find("i.fa-spin").removeClass("hide");
4622        data.push({
4623            name: 'security',
4624            value: st_params._s
4625        });
4626        $('div.message-wrapper').html("");
4627        $.ajax({
4628            url: st_params.ajax_url,
4629            method: "post",
4630            dataType: 'json',
4631            data: data,
4632            beforeSend: function () {
4633                $('div.message-wrapper').html("");
4634            },
4635            success: function (res) {
4636                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4637                if (res) {
4638                    if (res.status) {
4639                        if (res.redirect) {
4640                            window.location = res.redirect;
4641                        }
4642                    } else {
4643                        if (res.message) {
4644                            $('#form-booking-inpage .message-wrapper').html(res.message);
4645                        }
4646                    }
4647                }
4648            },
4649            error: function (err) {
4650                $('div.message-wrapper').html("");
4651                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4652            }
4653        });
4654    });
4655
4656    // rental booking ajax
4657    $('form.rental-booking-form').on('click', 'button.btn-book-ajax', function (e) {
4658        e.preventDefault();
4659        var form = $('form.rental-booking-form');
4660        var data = $('form.rental-booking-form').serializeArray();
4661        var loadingSubmit = form.find('button[name=submit]');
4662        $(loadingSubmit).find("i.fa-spin").removeClass("hide");
4663        data.push({
4664            name: 'security',
4665            value: st_params._s
4666        });
4667        $('div.message-wrapper').html("");
4668        $.ajax({
4669            url: st_params.ajax_url,
4670            method: "post",
4671            dataType: 'json',
4672            data: data,
4673            beforeSend: function () {
4674                $('div.message-wrapper').html("");
4675            },
4676            success: function (res) {
4677                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4678                if (res) {
4679                    if (res.status) {
4680                        if (res.redirect) {
4681                            window.location = res.redirect;
4682                        }
4683                    } else {
4684                        if (res.message) {
4685                            $('#form-booking-inpage .message-wrapper').html(res.message);
4686                        }
4687                    }
4688                }
4689            },
4690            error: function (err) {
4691                $('div.message-wrapper').html("");
4692                $(loadingSubmit).find('i.fa-spin').addClass("hide");
4693            }
4694        });
4695    });
4696    if ($.fn.niceScroll) {
4697        jQuery(".dropdown-menu.st-icheck").niceScroll({});
4698    }
4699
4700    //Guest Name
4701    //--------------- Guest Name Inputs -------------------------
4702
4703    var adultNumber = $('.form-has-guest-name .adult_number');
4704    var childrenNumber = $('.form-has-guest-name .child_number');
4705    var infantNumber = $('.form-has-guest-name .infant_number');
4706    var guestNameInput = $('.form-has-guest-name .guest_name_input');
4707    adultNumber.on('change', triggerGuestInputChange);
4708    childrenNumber.on('change', triggerGuestInputChange);
4709    infantNumber.on('change', triggerGuestInputChange);
4710
4711    function triggerGuestInputChange(e) {
4712        guestNameInput.trigger('guest-change', {
4713            'adult': parseInt(adultNumber.val()),
4714            'children': parseInt(childrenNumber.val()),
4715            'infant': parseInt(infantNumber.val())
4716        });
4717    };
4718
4719    guestNameInput.on('guest-change', function (e, number) {
4720        var adult = number.adult;
4721        var children = number.children;
4722        var infant = number.infant;
4723        var hideAdult = $(this).data('hide-adult');
4724        var hideChildren = $(this).data('hide-children');
4725        var hideInfant = $(this).data('hide-infant');
4726        var controlWraps = $(this).find('.guest_name_control');
4727        var controls = controlWraps.find('.control-item');
4728        if (isNaN(infant))
4729            infant = 0;
4730        if (isNaN(children))
4731            children = 0;
4732
4733        if (hideAdult == 'on') {
4734            adult = 0;
4735        }
4736
4737        if (typeof hideChildren == 'undefined' || hideChildren != 'on')
4738            adult += children;
4739        if (typeof hideInfant == 'undefined' || hideInfant != 'on')
4740            adult += infant;
4741
4742        //adult-=1;// Only input guest >=2 name
4743
4744        if (adult <= 0) {
4745            $(this).addClass('hidden');
4746        } else {
4747            // Append
4748            for (var i = controls.length ? (controls.length) : 0; i < adult; i++) {
4749                var div = $($('#guest_name_control_item').clone().html());
4750                var p = div.find('input').attr('placeholder');
4751                div.find('input').attr('placeholder', p.replace('%d', i + 1));
4752
4753                controlWraps.append(div);
4754            }
4755
4756            // Remove
4757            controls.each(function () {
4758                if ($(this).index() > adult - 1) {
4759                    $(this).remove();
4760                }
4761            });
4762
4763            $(this).removeClass('hidden');
4764        }
4765    });
4766
4767    triggerGuestInputChange();
4768    //------------------End Guest Name Inputs -------------------
4769
4770})(jQuery);
4771
4772function updateQueryStringParam(key, value) {
4773    var baseUrl = [location.protocol, '//', location.host, location.pathname].join('');
4774    var urlQueryString = document.location.search;
4775    var newParam = key + '=' + value,
4776        params = '?' + newParam;
4777    // If the "search" string exists, then build params from it
4778    if (urlQueryString) {
4779        var keyRegex = new RegExp('([\?&])' + key + '[^&]*');
4780        // If param exists already, update it
4781        if (urlQueryString.match(keyRegex) !== null) {
4782            var params = urlQueryString.replace(keyRegex, "$1" + newParam);
4783        } else { // Otherwise, add it to end of query string
4784            var params = urlQueryString + '&' + newParam;
4785        }
4786    }
4787    //return baseUrl + params;
4788    window.history.replaceState({}, "", baseUrl + params);
4789}
4790
4791function isMobile() {
4792    var isMobile = false;
4793    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) ||
4794        /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 )|
4794sy(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))) {
4795        isMobile = true;
4796    }
4797    return isMobile;
4798}
4799
4800function stKeyupsmartSearch(event) {
4801    // Declare variables
4802    var input, filter, ul, li, a, i, txtValue;
4803    input = event.value.toUpperCase();
4804    filter = event.value.toUpperCase();
4805    parent = event.closest(".form-extra-field");
4806    ul = parent.getElementsByTagName('ul')[0];
4807    li = ul.getElementsByTagName('li');
4808
4809    // Loop through all list items, and hide those who don't match the search query
4810    for (i = 0; i < li.length; i++) {
4811        //a = li[i].getElementsByTagName("a")[0];
4812        txtValue = li[i].textContent || li[i].innerText;
4813        if (txtValue.toUpperCase().indexOf(filter) > -1) {
4814            li[i].style.display = "";
4815        } else {
4816            li[i].style.display = "none";
4817        }
4818    }
4819}
4820jQuery(function ($) {
4821    document.querySelectorAll(".select-number-passenger  .st-number  .plus").forEach((input) => input.addEventListener("click", calculate_add));
4822    document.querySelectorAll(".select-number-passenger  .st-number  .minus").forEach((input) => input.addEventListener("click", calculate_minus));
4823
4824    function calculate_add() {
4825        var num_item = $(this).closest('.select-number-passenger');
4826        var num = num_item.find('.st-input-number').val();
4827        var max_val = num_item.find('.st-input-number').data('max');
4828        var value_num = parseInt(num) + 1;
4829        num_item.find('.st-input-number').val(value_num);
4830        num_item.find('strong.num').text(value_num);
4831
4832    }
4833
4834    function calculate_minus() {
4835        var num_item = $(this).closest('.select-number-passenger');
4836        var num = num_item.find('.st-input-number').val();
4837        var min_val = num_item.find('.st-input-number').data('min');
4838        if (parseInt(num) > min_val) {
4839            var value_num = parseInt(num) - 1;
4840            num_item.find('.st-input-number').val(value_num);
4841            num_item.find('strong.num').text(value_num);
4842        }
4843
4844    }
4845})
4846
4847jQuery(function ($) {
4848    var startApp = function () {
4849        if (typeof st_social_params != 'undefined') {
4850            var key = st_social_params.google_client_id;
4851            let r = (Math.random() + 1).toString(36).substring(7);
4852            gapi.load('auth2', function () {
4853                auth2 = gapi.auth2.init({
4854                    client_id: key,
4855                    cookiepolicy: 'single_host_origin',
4856                    plugin_name: 'single_host_origin' + r,
4857                });
4858                attachSignin(document.getElementById('st-google-signin2'));
4859                attachSignin(document.getElementById('st-google-signin3'));
4860            });
4861        }
4862    };
4863
4864    if (typeof window.gapi != 'undefined') {
4865        startApp();
4866    }
4867
4868    function attachSignin(element) {
4869        auth2.attachClickHandler(element, {},
4870            function (googleUser) {
4871                var profile = googleUser.getBasicProfile();
4872                startLoginWithGoogle(profile);
4873
4874            },
4875            function (error) {
4876                console.log(JSON.stringify(error, undefined, 2));
4877            });
4878    }
4879
4880    function startLoginWithGoogle(profile) {
4881        if (typeof window.gapi.auth2 == 'undefined')
4882            return;
4883        sendLoginData({
4884            'channel': 'google',
4885            'userid': profile.getId(),
4886            'username': profile.getName(),
4887            'useremail': profile.getEmail(),
4888        });
4889    }
4890
4891    function startLoginWithFacebook(btn) {
4892        btn.addClass('loading');
4893
4894        FB.getLoginStatus(function (response) {
4895            if (response.status === 'connected') {
4896                sendLoginData({
4897                    'channel': 'facebook',
4898                    'access_token': response.authResponse.accessToken
4899                });
4900
4901            } else {
4902                FB.login(function (response) {
4903                    if (response.authResponse) {
4904                        sendLoginData({
4905                            'channel': 'facebook',
4906                            'access_token': response.authResponse.accessToken
4907                        });
4908
4909                    } else {
4910                        alert('User cancelled login or did not fully authorize.');
4911                    }
4912                }, {
4913                    scope: 'email',
4914                    return_scopes: true
4915                });
4916            }
4917        });
4918    }
4919
4920    function sendLoginData(data) {
4921        data._s = st_params._s;
4922        data.action = 'traveler.socialLogin';
4923        var parent_login = $(".login-regiter-popup");
4924        $.ajax({
4925            data: data,
4926            type: 'post',
4927            dataType: 'json',
4928            url: st_params.ajax_url,
4929            beforeSend: function () {
4930                parent_login.find('.map-loading').html('<div class="st-loader"></div>');
4931                parent_login.find('.map-loading').css('z-index', 99);
4932                parent_login.find('.map-loading').show();
4933
4934            },
4935            success: function (rs) {
4936                handleSocialLoginResult(rs);
4937            },
4938            error: function (e) {
4939
4940                alert('Can not login. Please try again later');
4941            }
4942        })
4943    }
4944
4945    function handleSocialLoginResult(rs) {
4946        if (rs.reload)
4947            window.location.reload();
4948        if (rs.message)
4949            alert(rs.message);
4950    }
4951
4952    $('.st_login_social_link').on('click', function () {
4953        var channel = $(this).data('channel');
4954
4955        switch (channel) {
4956            case "facebook":
4957                startLoginWithFacebook($(this));
4958                break;
4959        }
4960    })
4961
4962    /* Fix social login popup */
4963    function popupwindow(url, title, w, h) {
4964        var left = (screen.width / 2) - (w / 2);
4965        var top = (screen.height / 2) - (h / 2);
4966        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);
4967    }
4968
4969    $('.st_login_social_link').on('click', function () {
4970        var href = $(this).attr('href');
4971        if ($(this).hasClass('btn_login_tw_link'))
4972            popupwindow(href, '', 600, 450);
4973        return false;
4974    });
4975    /* End fix social login popup */
4976})
4977jQuery(function ($) {
4978    // caculator height menu
4979    function setHeightValueMenu(x) {
4980        if (tabslet.matches) { // If media query matches
4981            if (document.querySelector(".page-template.st-header-2 header#header")) {
4982                document.querySelector(".page-template.st-header-2 header#header").style.marginBottom = "-" + window.getComputedStyle(document.querySelector(".st-header-2 header#header .header")).height;
4983            }
4984        } else {}
4985    }
4986
4987    var tabslet = window.matchMedia("(min-width: 992px)")
4988    setHeightValueMenu(tabslet) // Call listener function at run time
4989    tabslet.addListener(setHeightValueMenu) // Attach listener function on state changes
4990});
4991/*Loadmore*/
4992jQuery(function ($) {
4993    if ($('.st-loadmore.loadmore-ccv')) {
4994        $('.st-loadmore.loadmore-ccv').each(function () {
4995            st_nav_tab($(this));
4996        });
4997    }
4998    //Show password
4999    $('.field-password svg').on('click', function () {
5000        let t = $(this),
5001            parent = t.parents('.field-password');
5002
5003        if (parent.hasClass('ic-view')) {
5004            parent.addClass('viewing').find('input').attr('type', 'text');
5005            parent.removeClass('ic-view');
5006        } else {
5007            parent.removeClass('viewing').find('input').attr('type', 'password');
5008            parent.addClass('ic-view');
5009        }
5010    });
5011
5012
5013	function set_sticky() {
5014		var topSpacing = 0;
5015		if ($(window).width() > 481 && $('body').hasClass('admin-bar')) {
5016			topSpacing = $('#wpadminbar').height()
5017		}
5018		var sticky_header = $('.enable_sticky_header').length;
5019		if (sticky_header) {
5020			$('.header-sticky-menu').sticky({
5021				topSpacing: topSpacing,
5022				zIndex: 9999,
5023			});
5024			return
5025		}
5026		return
5027	}
5028
5029	set_sticky();
5030});
5031
5032function st_nav_tab(el) {
5033    //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>';
5034    var append_load = '<div class="loader-wrapper"><div class="st-loader"></div></div>';
5035    el.find(".load_more_post").on('click', function (element) {
5036        element.preventDefault();
5037        var element = jQuery(this);
5038        var posts_per_page = element.attr('data-posts-per-page');
5039        var paged = element.attr('data-paged');
5040        var data_id_service = element.attr('data-id_service');
5041        var max_num_page = element.attr('data-max-num-page');
5042        var check_all = element.attr('check-all');
5043        var type_service = element.attr('type_service');
5044        var dataIndex = element.attr('data-index');
5045        var $container = element.closest('.st_service_load');
5046        var offloadmore = $container.find('.loadmore');
5047
5048        if (check_all === "true") {
5049            var append_content = $container.find('.st_all');
5050            var append_st = $container.find('.services-grid .row');
5051            var loadmore = $container.find('.st_all .load-ajax-icon .loader-wrapper');
5052            var offloadmore = $container.find('.st_all .loadmore ');
5053            var buttonloadmore = append_content.find('.st-button-loadmore');
5054        } else {
5055            var append_content = $container.find('.st_blog_' + tax_query);
5056            var append_st = $container.find('.services-grid .row');
5057
5058            var buttonloadmore = $container.find('.st-button-loadmore');
5059        }
5060        var append_st = $container.find('.services-grid > .row');
5061        var loadmore = $container.find('.load-ajax-icon .loader-wrapper');
5062        var offloadmore = $container.find('.loadmore');
5063        var buttonloadmore = $container.find('.st-button-loadmore');
5064        console.log(append_st);
5065        jQuery('.st-loadmore .loader-wrapper').show();
5066        jQuery.ajax({
5067            url: st_params.ajax_url,
5068            type: "POST",
5069            data: {
5070                'action': "st_load_more_service_by_id",
5071                'posts_per_page': posts_per_page,
5072                'paged': paged,
5073                'data_id_service': data_id_service,
5074                'max_num_page': max_num_page,
5075                'check_all': check_all,
5076                'type_service': type_service,
5077                'index': dataIndex
5078            },
5079            dataType: "json",
5080            beforeSend: function () {
5081                loadmore.show();
5082                buttonloadmore.hide();
5083            },
5084            error: function (jqXHR, textStatus, errorThrown) {
5085                jQuery("#aLoad").remove();
5086                console.log("ERRO" + jqXHR + "is" + errorThrown);
5087            },
5088            success: function (res) {
5089                $datxa = jQuery(res.html);
5090                if ($datxa.length) {
5091                    append_st.append(res.html);
5092
5093                } else {
5094
5095                }
5096                $container.animate({
5097                    scrollTop: $container.prop("scrollHeight")
5098                }, 1000);
5099            },
5100            complete: function (xhr, status) {
5101
5102                $data = jQuery(xhr.responseJSON.html);
5103                if ($data.length) {
5104                    element.attr('data-paged', xhr.responseJSON.paged);
5105                    element.attr('data-index', xhr.responseJSON.index);
5106                    loadmore.hide();
5107                    buttonloadmore.show();
5108                } else {
5109                    loadmore.hide();
5110                    offloadmore.remove();
5111                }
5112                jQuery('.st-loadmore .loader-wrapper').hide();
5113            }
5114        });
5115
5116    });
vendor: 1 bytes, line 5117
5117}

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.