;
(function ($) {
    "use strict";

    function stParseMapData(mapData, mapEl) {
        if (!mapData && mapEl && mapEl.length) {
            var raw = mapEl.attr('data-data_show');
            if (raw) {
                try {
                    mapData = JSON.parse(raw);
                } catch (e) {
                    mapData = null;
                }
            }
            if (!mapData) {
                mapData = mapEl.data('data_show');
            }
        }
        if (!mapData) {
            return [];
        }
        if (typeof mapData === 'string') {
            try {
                mapData = JSON.parse(mapData);
            } catch (e) {
                return [];
            }
        }
        if (Array.isArray(mapData)) {
            return mapData;
        }
        if (typeof mapData === 'object') {
            return Object.keys(mapData).map(function (key) {
                return mapData[key];
            });
        }
        return [];
    }

    function stReadSingleDetailMapCoords(mapEl) {
        function readAttr(key) {
            var val = mapEl.attr('data-' + key);
            if (val === undefined || val === null || val === '') {
                val = mapEl.data(key);
            }
            return val;
        }

        var lat = parseFloat(readAttr('lat'));
        var lng = parseFloat(readAttr('lng'));
        var zoom = parseFloat(readAttr('zoom'));

        if (isNaN(zoom) || zoom < 2) {
            zoom = 13;
        }
        if (zoom > 18) {
            zoom = 18;
        }

        if (isNaN(lat) || isNaN(lng) || (Math.abs(lat) < 0.000001 && Math.abs(lng) < 0.000001)) {
            return null;
        }

        return { lat: lat, lng: lng, zoom: zoom };
    }

    function stCenterSingleDetailMap(map, mapboxLib, coords, locations, options) {
        options = options || {};
        var resizeOnly = options.resizeOnly === true;

        if (!map || !coords) {
            return;
        }

        if (map.resize) {
            map.resize();
        }

        if (resizeOnly) {
            return;
        }

        var lng = coords.lng;
        var lat = coords.lat;
        var zoom = coords.zoom;

        if (locations && locations.length > 1 && mapboxLib && mapboxLib.LngLatBounds) {
            try {
                var bounds = new mapboxLib.LngLatBounds();
                locations.forEach(function (location) {
                    if (!location) {
                        return;
                    }
                    var mLat = parseFloat(location.lat);
                    var mLng = parseFloat(location.lng);
                    if (!isNaN(mLat) && !isNaN(mLng)) {
                        bounds.extend([mLng, mLat]);
                    }
                });

                if (!bounds.isEmpty()) {
                    map.fitBounds(bounds, {
                        padding: { top: 48, bottom: 48, left: 48, right: 48 },
                        maxZoom: Math.min(zoom, 16),
                        duration: 0
                    });
                    return;
                }
            } catch (e) {}
        }

        if (map.jumpTo) {
            map.jumpTo({ center: [lng, lat], zoom: zoom });
        } else if (map.flyTo) {
            map.flyTo({ center: [lng, lat], zoom: zoom, duration: 0 });
        } else {
            if (map.setCenter) {
                map.setCenter([lng, lat]);
            }
            if (map.setZoom) {
                map.setZoom(zoom);
            }
        }
    }

    function stScheduleSingleDetailMapLayout(map, mapboxLib, coords, locations, mapEl) {
        if (!map || !mapEl || !mapEl.length) {
            return;
        }

        var containerEl = map.getContainer ? map.getContainer() : null;
        if (typeof stAttachMapResizeObserver === 'function' && containerEl) {
            stAttachMapResizeObserver(map, containerEl);
        }

        [120, 350, 600].forEach(function (delay) {
            setTimeout(function () {
                if (!mapEl.data('st-detail-map') || mapEl.data('st-detail-map') !== map) {
                    return;
                }
                stCenterSingleDetailMap(map, mapboxLib, coords, locations, { resizeOnly: true });
            }, delay);
        });
    }

    function stFlySingleDetailMapTo(map, lng, lat, zoom) {
        if (!map || isNaN(lng) || isNaN(lat)) {
            return;
        }
        var targetZoom = zoom;
        if (isNaN(targetZoom) || targetZoom < 10) {
            targetZoom = 14;
        }
        if (targetZoom > 18) {
            targetZoom = 18;
        }
        if (map.flyTo) {
            map.flyTo({ center: [lng, lat], zoom: targetZoom, essential: true });
        } else if (map.jumpTo) {
            map.jumpTo({ center: [lng, lat], zoom: targetZoom });
        }
    }

    function stResolveSingleDetailMapContainer(mapEl) {
        var $inner = mapEl.children('div[id^="st-map"], div.st-map-canvas').first();
        if (!$inner.length) {
            $inner = mapEl.find('div[id^="st-map"], div.st-map-canvas').first();
        }
        if (!$inner.length && (mapEl.attr('id') === 'list_map' || mapEl.hasClass('map-full-height'))) {
            $inner = mapEl;
        }
        if (!$inner.length) {
            $inner = $('<div class="st-map-canvas"></div>');
            mapEl.append($inner);
        }

        var el = $inner.get(0);
        var existingId = el.id;
        if (!existingId || document.getElementById(existingId) !== el) {
            el.id = mapEl.data('st-map-uid') || ('st-map-' + Date.now().toString(36) + Math.random().toString(36).slice(2, 7));
            mapEl.data('st-map-uid', el.id);
        }

        if (typeof stEnsureNeshanContainer === 'function') {
            stEnsureNeshanContainer(el);
        }
        return el;
    }

    function stIsSingleDetailMapVisible(mapEl) {
        if (!mapEl || !mapEl.length) {
            return false;
        }
        var $host = mapEl.closest('.map-view-popup, .modal, .mfp-hide, .hidden');
        if ($host.length) {
            return $host.is(':visible') && $host.css('display') !== 'none';
        }
        return mapEl.is(':visible') && mapEl.closest(':hidden').length === 0;
    }

    function stResizeSingleDetailMap(mapEl, delay) {
        delay = typeof delay === 'number' ? delay : 150;
        setTimeout(function () {
            var map = mapEl.data('st-detail-map');
            if (map && map.resize) {
                map.resize();
            }
        }, delay);
    }

    function stApplySingleDetailMapInteractionOptions(map) {
        if (typeof stApplyMapInteractionOptions === 'function') {
            stApplyMapInteractionOptions(map);
            return;
        }
        if (!map) {
            return;
        }
        if (map.scrollZoom && map.scrollZoom.enable) {
            map.scrollZoom.enable();
            if (map.scrollZoom.setWheelZoomRate) {
                map.scrollZoom.setWheelZoomRate(0.012);
            }
        }
        if (map.dragRotate && map.dragRotate.disable) {
            map.dragRotate.disable();
        }
        if (map.touchZoomRotate && map.touchZoomRotate.disableRotation) {
            map.touchZoomRotate.disableRotation();
        }
    }

    function stAddSingleDetailMarker(map, mapboxLib, location, mapEl, mapIcon) {
        if (!location || location.lat === undefined || location.lng === undefined) {
            return;
        }

        var markerLat = parseFloat(location.lat);
        var markerLng = parseFloat(location.lng);
        if (isNaN(markerLat) || isNaN(markerLng)) {
            return;
        }

        var el = typeof stCreateMapMarkerElement === 'function'
            ? stCreateMapMarkerElement(location, mapEl, '', mapIcon)
            : (function () {
                var node = document.createElement('div');
                node.className = 'st-map-marker st-map-marker-large';
                var img = document.createElement('img');
                img.src = location.icon_mk || mapIcon || '';
                img.alt = location.name || '';
                img.width = 48;
                img.style.width = '48px';
                img.style.display = 'block';
                node.appendChild(img);
                return node;
            })();

        function attachMarker() {
            var popupHtml = String(location.content_html || '');
            if (!popupHtml && location.name) {
                popupHtml = '<div class="st-single-map-popup st-single-map-popup-card"><div class="st-single-map-popup__body">' +
                    '<div class="st-single-map-popup__title">' + location.name + '</div></div></div>';
            }
            var popup = new mapboxLib.Popup({ offset: [0, -30], closeOnClick: true, maxWidth: '320px', anchor: 'bottom' })
                .setHTML(popupHtml);
            var marker = new mapboxLib.Marker({ element: el, anchor: 'bottom' })
                .setLngLat([markerLng, markerLat])
                .setPopup(popup)
                .addTo(map);
            el.addEventListener('click', function (e) {
                e.stopPropagation();
                marker.togglePopup();
            });
        }

        var img = el.querySelector('img');
        if (img && !img.complete) {
            img.addEventListener('load', attachMarker, { once: true });
            img.addEventListener('error', attachMarker, { once: true });
        } else {
            attachMarker();
        }
    }

    function stRenderSingleDetailVectorMap(mapEl, mapData) {
        if (!mapEl || !mapEl.length) {
            return;
        }

        var locations = stParseMapData(mapData, mapEl);
        var coords = stReadSingleDetailMapCoords(mapEl);

        if (!coords && locations.length) {
            coords = {
                lat: parseFloat(locations[0].lat),
                lng: parseFloat(locations[0].lng),
                zoom: 13
            };
        }
        if (!coords || isNaN(coords.lat) || isNaN(coords.lng)) {
            return;
        }

        var lat = coords.lat;
        var lng = coords.lng;
        var zoom = coords.zoom;
        var mapIcon = mapEl.attr('data-icon') || mapEl.data('icon');

        var containerEl = stResolveSingleDetailMapContainer(mapEl);

        function stAddDetailMarkers(map, mapboxLib) {
            locations.forEach(function (location) {
                stAddSingleDetailMarker(map, mapboxLib, location, mapEl, mapIcon);
            });

            stCenterSingleDetailMap(map, mapboxLib, coords, locations);
            stScheduleSingleDetailMapLayout(map, mapboxLib, coords, locations, mapEl);
            stResizeSingleDetailMap(mapEl, 100);
        }

        function stDestroyExistingDetailMap() {
            if (mapEl.data('st-detail-map')) {
                try {
                    mapEl.data('st-detail-map').remove();
                } catch (e) {}
                mapEl.removeData('st-detail-map');
            }
        }

        function stRunDetailMapInit(createMapFn) {
            stDestroyExistingDetailMap();
            createMapFn().then(function (map) {
                if (!map) {
                    return;
                }
                stApplySingleDetailMapInteractionOptions(map);
                mapEl.data('st-detail-map', map);
                var gl = (typeof stIsNeshanMap === 'function' && stIsNeshanMap())
                    ? window.nmp_mapboxgl
                    : window.mapboxgl;
                if (map.loaded && map.loaded()) {
                    stAddDetailMarkers(map, gl);
                } else {
                    map.on('load', function () {
                        stAddDetailMarkers(map, gl);
                    });
                }
            });
        }

        if (typeof stIsNeshanMap === 'function' && stIsNeshanMap()) {
            var runNeshan = function () {
                if (typeof stCreateNeshanMap === 'function') {
                    stRunDetailMapInit(function () {
                        return stCreateNeshanMap({
                            container: containerEl,
                            lat: lat,
                            lng: lng,
                            zoom: zoom
                        });
                    });
                }
            };
            if (window.nmp_mapboxgl && window.nmp_mapboxgl.Map) {
                runNeshan();
            } else if (typeof stLoadNeshanSdk === 'function') {
                stLoadNeshanSdk().then(runNeshan);
            }
            return;
        }

        var mapboxLib = window.mapboxgl;
        if (!mapboxLib || !mapboxLib.Map) {
            console.warn('[Traveler] Map library is not loaded.');
            return;
        }
        var token = (typeof stGetMapConfig === 'function' ? stGetMapConfig() : st_params).token_mapbox;
        if (!token) {
            console.warn('[Traveler] Mapbox token is empty. Set it in Theme Options > Map API.');
            return;
        }

        stDestroyExistingDetailMap();
        if (typeof stSetMapboxAccessToken === 'function') {
            stSetMapboxAccessToken(mapboxLib);
        } else {
            mapboxLib.accessToken = token;
        }

        var map = new mapboxLib.Map({
            container: containerEl,
            style: 'mapbox://styles/mapbox/light-v10?optimize=true',
            zoom: zoom,
            center: [lng, lat],
            pitch: 0,
            bearing: 0,
            trackResize: true
        });
        stApplySingleDetailMapInteractionOptions(map);
        mapEl.data('st-detail-map', map);
        map.on('load', function () {
            if (map.resize) {
                map.resize();
            }
            stAddDetailMarkers(map, mapboxLib);
        });
    }

    window.stRenderSingleDetailVectorMap = stRenderSingleDetailVectorMap;
    window.stIsSingleDetailMapVisible = stIsSingleDetailMapVisible;

    let SingleHotelDetail = {
        $body: $('body'),
        isValidated: {},
        renderHtmlHotel() {
			let number_room_search = $('input[name="room_num_search"]').val();
			let max_adult = $('input[name="adult_number"]').attr( 'data-max-adult' );
			let max_child = $('input[name="child_number"]').attr( 'data-max-child' );
            var data = jQuery('form.hotel-room-booking-form').serializeArray();
            jQuery('.loader-wrapper').hide();
            let priceWrapper = $('#st-price-render');
            data.push({
                name: 'security',
                value: st_params._s
            });
            for (var i = 0; i < data.length; i++) {

                if (data[i].name === 'action') {
                    data[i]['value'] = 'st_format_hotel_price';
                }
            };
            jQuery.ajax({
                method: "post",
                dataType: 'json',
                data: data,
                url: st_params.ajax_url,
                beforeSend: function () {
                    jQuery('.loader-wrapper').show();
                    jQuery('div.message-wrapper').html("");
                    jQuery('.message_box').html('');
                },
                success: function (response) {
                    jQuery('.loader-wrapper').hide();
                    if (response) {
                        if (response.price_html) {
                            if (jQuery('.form-head').length > 0) {
                                if (response.price_html) {
                                    jQuery('.form-head').html(response.price_html);
                                }
                            }
                            if (jQuery('.hotel-target-book-mobile').length > 0) {
                                jQuery('.hotel-target-book-mobile .price-wrapper').html(response.price_html);
                            }

                            if (priceWrapper.length) {
								$('input[name="adult_number"]').attr( 'data-max', max_adult * number_room_search );
								$('input[name="child_number"]').attr( 'data-max', max_child * number_room_search );
                                let priceWrapper = $('#st-price-render');
                                $('.number-night', priceWrapper).text(response.data.number_night);
                                $('.sale-price', priceWrapper).text(response.data.sale_price);
                                $('.total-price', priceWrapper).text(response.data.total_price);
                                priceWrapper.show();
                            }

                            jQuery('.message_box').html('');
                            jQuery('div.message-wrapper').html("");
                        } else {
                            if (priceWrapper.length) {
                                priceWrapper.hide();
                            }
                            if (response.message) {
                                jQuery('.message-wrapper').html(response.message);
                            }
                        }
                    }
                }
            });
        },
        init: function () {
            let base = this;
            base._resize(base.$body);
            base._share();
            base._stContent(base.$body);
            base._stReviewSingle();
            base._stMapSingle(base.$body);
            base._stcheckavailabilityHotel(base.$body);
            base._stReviewSingleRoom(base.$body);
            base._stToggleExtra(base.$body);
            base._stSentMessageToOwner();
            base._stSentMailInquiry();
            base._stDateFieldCheckInCheckOut(base.$body);
            base._bookingRoomAjax();
            base._bookingRoomChangeAjax();
            base._dropdownselectDate();
            base._popupGallery();
            base._putGuestName();
            base._scroll_reserve();
        },
        formatDateDdMmYy: function(input) {
            if (st_params.date_format == 'dd/mm/yyyy' || (st_params.date_format == 'dd-mm-yyyy')) {
                var datePart = input.match(/\d+/g),
                    day = datePart[0],
                    month = datePart[1],
                    year = datePart[2];
                return month + '/' + day + '/' + year;
            } else {
                return input;
            }
        },
        _dropdownselectDate: function () {
			let base = this;
            $('.form-date-search', 'body').each(function () {
                var parent = $(this),
                    date_wrapper = $('.date-wrapper', parent),
                    check_in_input = $('.check-in-input', parent),
                    check_out_input = $('.check-out-input', parent),
                    check_in_out = $('.check-in-out', parent),
                    check_in_render = $('.check-in-render', parent),
                    check_out_render = $('.check-out-render', parent);
                var timepicker = parent.data('timepicker');
                if (typeof timepicker == 'undefined' || timepicker == '') {
                    timepicker = false;
                } else {
                    timepicker = true;
                }

                var options = {
                    singleDatePicker: true,
                    sameDate: false,
                    autoApply: true,
                    opens: 'right',
                    minDate: new Date(),
                    dateFormat: 'YYYY-MM-DD',
                    customClass: '',
                    widthSingle: 500,
                    onlyShowCurrentMonth: true,
                    timePicker: timepicker,
                    timePicker24Hour: (st_params.time_format == '12h') ? false : true,
                };
                if (typeof locale_daterangepicker == 'object') {
                    options.locale = locale_daterangepicker;
                }

                if (check_in_input.val() != null && check_in_input.val() != '' && check_out_input.val() != null && check_out_input.val() != '') {
                    options.startDate = base.formatDateDdMmYy(check_in_input.val());
                    options.endDate = base.formatDateDdMmYy(check_out_input.val());
                }
                check_in_out.daterangepicker(options,
                    function (start, end, label) {
                        check_in_input.val(start.format(parent.data('format'))).trigger('change');
                        $('#tp_hotel .form-date-search .check-in-input').val(start.format('YYYY-MM-DD')).trigger('change');
                        check_in_render.html(start.format('jYYYY/jMM/jDD')).trigger('change'); // Hamzeh
                        check_out_input.val(end.format(parent.data('format'))).trigger('change');
                        $('#tp_hotel .form-date-search .check-out-input').val(end.format('YYYY-MM-DD')).trigger('change');
                        check_out_render.html(end.format('jYYYY/jMM/jDD')).trigger('change'); // Hamzeh
                        if (timepicker) {
                            check_in_input.val(start.format(parent.data('date-format'))).trigger('change');
                            $('.check-in-input-time', parent).val(start.format(parent.data('time-format'))).trigger('change');
                            check_out_input.val(end.format(parent.data('date-format'))).trigger('change');
                            $('.check-out-input-time', parent).val(end.format(parent.data('time-format'))).trigger('change');
                            $('.check-out-input-time', parent).val(end.format(parent.data('time-format'))).trigger('change');
                        }
                        check_in_out.trigger('daterangepicker_change', [start, end]);
                        if (window.matchMedia('(max-width: 767px)').matches) {
                            $('label', parent).hide();
                            $('.render', parent).show();
                            $('.check-in-wrapper span', parent).show();
                        }
                    }
                );

                date_wrapper.on('click', function (e) {
                    check_in_out.trigger('click');
                });
            });

        },
        _scroll_reserve: function () {
            function goToByScroll(id) {
                var id = id.replace("_link", "");
                // Scroll
                $('html,body').animate({
                    scrollTop: $("#" + id).offset().top
                }, 'slow');
            }
            $(".single .button_reserve").on('click', function (e) {
                // Prevent a page reload when a link is pressed
                e.preventDefault();
                // Call the scroll function
                goToByScroll($(this).attr("id"));
            });
        },
        _bookingRoomChangeAjax: function () {
            let base = this;
            $(".hotel-room-booking-form").on("hotel-room-booking-form", function (event) {
                SingleHotelDetail.renderHtmlHotel();
            });
            if ($('.hotel-room-booking-form').length > 0) {
                let flag = false;
                $('.form-date-hotel-room  .check-in-out').on('apply.daterangepicker', function () {
                    SingleHotelDetail.renderHtmlHotel();
                });
                if ($('.field-guest').length > 0) {
                    $('.field-guest').each(function () {
                        $(this).find('.form-control.st-input-number').on('change', function () {
                            SingleHotelDetail.renderHtmlHotel();
                        })
                    });
                }
                if ($('.form-more-extra .extras').length > 0) {
                    $('.form-more-extra .extras li').each(function () {
                        $(this).find('.extra-service-select').on('change', function () {
                            SingleHotelDetail.renderHtmlHotel();
                        })
                    });
                }
                if (flag) {
                    SingleHotelDetail.renderHtmlHotel();
                }

            }
        },
        _bookingRoomAjax: function () {
            $('form.hotel-room-booking-form').on('click', 'button.btn-book-ajax', function (e) {
                e.preventDefault();
                var form = $('form.hotel-room-booking-form');
                var data = $('form.hotel-room-booking-form').serializeArray();
                var loadingSubmit = form.find('button[name=submit]');
                $(loadingSubmit).find("i.fa-spin").removeClass("d-none");
                data.push({
                    name: 'security',
                    value: st_params._s
                });
                $('div.message-wrapper').html("");
                $.ajax({
                    url: st_params.ajax_url,
                    method: "post",
                    dataType: 'json',
                    data: data,
                    beforeSend: function () {
                        $('div.message-wrapper').html("");
                    },
                    success: function (res) {
                        $(loadingSubmit).find('i.fa-spin').addClass("d-none");
                        if (res) {
                            if (res.status) {
                                if (res.redirect) {
                                    window.location = res.redirect;
                                }
                            } else {
                                if (res.message) {
                                    $('div.message-wrapper').html(res.message);
                                }
                            }
                        }
                    },
                    error: function (err) {
                        $('div.message-wrapper').html("");
                        $(loadingSubmit).find('i.fa-spin').addClass("d-none");
                    }
                });
            });
        },
        _stDateFieldCheckInCheckOut: function (body) {
            let base = this;
            $('.form-date-hotel-room', body).each(function () {
                var parent = $(this),
                    date_wrapper = $('.date-wrapper', parent),
                    check_in_input = $('.check-in-input', parent),
                    check_out_input = $('.check-out-input', parent),
                    check_in_out = $('.check-in-out', parent),
                    check_in_render = $('.check-in-render', parent),
                    check_out_render = $('.check-out-render', parent),
                    availabilityDate = $(this).data('availability-date');
                var minimum = check_in_out.data('minimum-day');
                if (typeof minimum !== 'number') {
                    minimum = 0;
                }
                var options = {
                    singleDatePicker: false,
                    autoApply: true,
                    disabledPast: true,
                    dateFormat: 'DD/MM/YYYY',
                    widthSingle: 500,
                    onlyShowCurrentMonth: true,
                    minimumCheckin: minimum,
                    classNotAvailable: ['disabled', 'off'],
                    enableLoading: true,
                    showEventTooltip: true,
                    fetchEvents: function (start, end, el, callback) {
                        var events = [];
                        if (el.flag_get_events) {
                            return false;
                        }
                        el.flag_get_events = true;
                        el.container.find('.loader-wrapper').show();
                        var data = {
                            action: check_in_out.data('action'),
                            start: start.format('YYYY-MM-DD'),
                            end: end.format('YYYY-MM-DD'),
                            post_id: check_in_out.data('room-id'),
                            security: st_params._s
                        };
                        $.post(st_params.ajax_url, data, function (respon) {
                            if (typeof respon === 'object') {
                                if (typeof respon.events === 'object') {
                                    events = respon.events;
                                } else {
                                    events = respon;
                                }
                            } else {
                                console.log('Can not get data');
                            }
                            callback(events, el);
                            el.flag_get_events = false;
                            el.container.find('.loader-wrapper').hide();
                        }, 'json');
                    }
                };

                if (typeof availabilityDate != 'undefined') {
                    options['minDate'] = availabilityDate;
                }

                if (typeof locale_daterangepicker == 'object') {
                    options.locale = locale_daterangepicker;
                }
                check_in_out.daterangepicker(options,
                    function (start, end, label) {
                        check_in_input.val(start.format(parent.data('format'))).trigger('change');
                        check_in_render.html(start.format('jYYYY/jMM/jDD')).trigger('change'); // Hamzeh
                        check_out_input.val(end.format(parent.data('format'))).trigger('change');
                        check_out_render.html(end.format('jYYYY/jMM/jDD')).trigger('change'); // Hamzeh
                        if (st_params.caculator_price_single_ajax === 'on') {
                            if ($('.single-st_rental .single-room-form').length > 0) {
                                date_wrapper.trigger('rental-booking-form');
                            }
                        }
                    });


                date_wrapper.on('click', function (e) {
                    check_in_out.trigger('click');

                });


                check_in_out.on('apply.daterangepicker', function (ev, picker) {
                    if (st_params.caculator_price_single_ajax === 'on') {
                        if ($('.single-hotel_room .single-room-form').length > 0) {
                            $('.hotel-room-booking-form').trigger('hotel-room-booking-form');
                        }
                    }

                });
            });

        },
        _stSentMailInquiry() {
            $('.form-st-send-mail .st_send-mail-form .sent-email-st').on('click', function (ev) {
                ev.preventDefault();
                var id_service = $("input[name=id_service]").val();
                var type_service = $("input[name=type_service]").val();
                var name_service = $("input[name=name_service]").val();
                var name_st = $("input[name=name_st]").val();
                var email_st = $("input[name=email_st]").val();
                var phone_st = $("input[name=phone_st]").val();
                var content_st = $("textarea[name=content_st]").val();
                var email_owl = $("input[name=email_owl]").val();
                $('.st-sent-mail-customer .loader-wrapper').show();
                $.ajax({
                    url: st_params.ajax_url,
                    type: "GET",
                    data: {
                        'action': "st_send_email_single_service",
                        'id_service': id_service,
                        'type_service': type_service,
                        'name_service': name_service,
                        'name_st': name_st,
                        'email_st': email_st,
                        'phone_st': phone_st,
                        'content_st': content_st,
                        'email_owl': email_owl
                    },
                    dataType: "json",
                    beforeSend: function () {},
                    error: function (jqXHR, textStatus, errorThrown) {},
                    success: function (res) {

                    },
                    complete: function (xhr, status) {

                        if (xhr.responseJSON.status != 0) {
                            var mess = '<div class="ccv-success"><div class="content-message">' + xhr.responseJSON.message + '</div></div>';
                            $('.form-st-send-mail .st_send-mail-form').html(mess);
                            $('.st-sent-mail-customer .loader-wrapper').hide();
                        } else {
                            var mess = '<div class="alert alert-danger"><button type="button" class="close" data-bs-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' + xhr.responseJSON.message + '</div>';
                            $('.form-st-send-mail .message-wrapper-sendemail').html(mess);
                            $('.st-sent-mail-customer .loader-wrapper').hide();
                        }
                    }
                });
            });
        },
        _stSentMessageToOwner() {
            $(document).on("ready", function () {
                $('.single .st_ask_question #btn-send-message-owner').on('click', function (e) {
                    e.preventDefault();
                    jQuery(".btn-send-message").trigger('click');
                });
            })
        },
        _stToggleExtra(body) {
            $('.form-more-extra', body).each(function () {
                var t = $(this),
                    parent = t.closest('.form-more-extra');
                $('.dropdown', parent).on('click', function (ev) {
                    ev.preventDefault();
                    $('.extras', parent).slideToggle(200);
                    $('.arrow', parent).toggleClass('fa-caret-up fa-caret-down');
                });
            });
        },
        _stReviewSingleRoom: function (body) {
            $('.review-form .review-items .rates .fa').each(function () {
                var list = $(this).parent(),
                    listItems = list.children(),
                    itemIndex = $(this).index(),
                    parentItem = list.parent();

                $(this).on('mouseenter', function () {
                    for (var i = 0; i < listItems.length; i++) {
                        if (i <= itemIndex) {
                            $(listItems[i]).addClass('hovered');
                        } else {
                            break;
                        }
                    }
                    $(this).on('click', function () {
                        for (var i = 0; i < listItems.length; i++) {
                            if (i <= itemIndex) {
                                $(listItems[i]).addClass('selected');
                            } else {
                                $(listItems[i]).removeClass('selected');
                            }
                        };
                        parentItem.children('.st_review_stats').val(itemIndex + 1);
                    });
                });

                $(this).on('mouseleave', function () {
                    listItems.removeClass('hovered');
                });
            });
            $('.review-form .st-stars .fa').each(function () {
                var list = $(this).parent(),
                    listItems = list.children(),
                    itemIndex = $(this).index(),
                    parentItem = list.parent();
                $(this).on('mouseenter', function () {
                    for (var i = 0; i < listItems.length; i++) {
                        if (i <= itemIndex) {
                            $(listItems[i]).addClass('hovered');
                        } else {
                            break;
                        }
                    }
                    $(this).on('click', function () {
                        for (var i = 0; i < listItems.length; i++) {
                            if (i <= itemIndex) {
                                $(listItems[i]).addClass('selected');
                            } else {
                                $(listItems[i]).removeClass('selected');
                            }
                        }
                        parentItem.children('.st_review_stats').val(itemIndex + 1);
                    });
                });
                $(this).on('mouseleave', function () {
                    listItems.removeClass('hovered');
                });
            });
        },
        _stcheckavailabilityHotel: function (body) {
            $('.form-check-availability-hotel .submit-group [name="submit"]', body).on('click', function (ev) {

                var form = $(this).closest('.form-check-availability-hotel'),
                    parent = form.parent(),
                    loader = $('.loader-wrapper', parent),
                    message = $('.message-wrapper', form);
                    ev.preventDefault();
                var has_fixed = form.closest('.fixed-on-mobile');
                if (has_fixed.hasClass('open')) {
                    has_fixed.removeClass('open').hide();
                    body.removeClass('st_overflow');
                }
                var data = form.serializeArray();
                data.push({
                    name: 'security',
                    value: st_params._s
                });
                message.html('');
                loader.show();
                $('.fixed-on-mobile .loader-wrapper').show();
                $('.st-list-rooms .loader-wrapper').show();
                $.post(st_params.ajax_url, data, function (respon) {
                    if (typeof respon == 'object') {
                        if (respon.message) {
                            message.html(respon.message);
                        }
                        $('.st-list-rooms .fetch').html(respon.html);
                        $('html, body').animate({
                            scrollTop: $('.st-list-rooms', body).offset().top - 150
                        }, 500);
                        $('[data-toggle="tooltip"]').tooltip();
                    }
                    $('.st-list-rooms .loader-wrapper').hide();
                    $('.fixed-on-mobile .loader-wrapper').hide();
                    loader.hide();
                }, 'json');
            });
            body.on('click', '.st-list-rooms .btn-show-price', function (ev) {
                ev.preventDefault();
                $('.form-check-availability-hotel .submit-group [name="submit"]', body).trigger('click');
            });

            //Mobile
            $('.hotel-target-book-mobile .btn-mpopup', body).on('click', function (ev) {
                ev.preventDefault();
                $('.fixed-on-mobile', body).toggleClass('open').fadeToggle(300);
				$('.hotel-target-book-mobile', body).addClass('hide');
                $(body).addClass('st_overflow');
            });
            $('.fixed-on-mobile .close-icon', body).on('click', function (ev) {
                ev.preventDefault();
                $('.fixed-on-mobile', body).toggleClass('open').fadeToggle(300);
				$('.hotel-target-book-mobile', body).removeClass('hide');
                $(body).removeClass('st_overflow');
            });
        },
        initPano: function (lat_center, lng_center) {
            const panorama = new google.maps.StreetViewPanorama(
                document.getElementById("list_map"), {
                    position: {
                        lat: lat_center,
                        lng: lng_center
                    },
                    addressControlOptions: {
                        position: google.maps.ControlPosition.BOTTOM_CENTER,
                    },
                    linksControl: false,
                    panControl: false,
                    enableCloseButton: false,
                }
            );
        },
        _stMapSingle: function (body) {
            if ($(".single-st_hotel").length || $(".single-st_tours").length || $(".single-st_activity").length || $(".single-st_rental").length || $(".single-st_cars").length ||
                $(".single-hotel_room").length
            ) {
                window.initPano = SingleHotelDetail.initPano;
				let is_mapbox = $('.google-map-mapbox').length;

                if (!is_mapbox) {
                    $('.map-view').on('click', function () {
                        $('.map-view-popup').fadeIn();
                    })
                    $('.map-view-popup.style-2', body).each(function () {
                        var parent = $(this),
                            mapEl = $('#list_map', parent),
                            mapData = mapEl.data('data_show'),
                            lat_center = mapEl.data('lat'),
                            lng_center = mapEl.data('lng'),
                            data_zoom = mapEl.data('zoom'),
                            mapIcon = mapEl.data('icon'),
                            street_views = mapEl.data('street_views');
                        if (street_views == 'on') {
                            window.initPano = SingleHotelDetail.initPano(lat_center, lng_center);
                        } else {
                            initMapDetail(mapEl, mapData, lat_center, lng_center, data_zoom, mapIcon);
                        }


                    });
                    $('.st-map', body).each(function () {
                        var parent = $(this),
                            mapEl = $('.google-map', parent),
                            mapData = mapEl.data('data_show'),
                            lat_center = mapEl.data('lat'),
                            lng_center = mapEl.data('lng'),
                            data_zoom = mapEl.data('zoom'),
                            mapIcon = mapEl.data('icon'),
                            street_views = mapEl.data('street_views');

                        if (street_views == 'on') {
                            window.initPano = SingleHotelDetail.initPano(lat_center, lng_center);
                        } else {
                            initMapDetail(mapEl, mapData, lat_center, lng_center, data_zoom, mapIcon);
                        }


                    });
                    var mapGobal;

                    function initMapDetail(mapEl, mapData, mapLat, mapLng, mapZoom, mapIcon, mapVersion = false, isMapMove = false) {
                        mapGobal = new google.maps.Map(mapEl.get(0), {
                            zoom: mapZoom,
                            center: {
                                lat: parseFloat(mapLat),
                                lng: parseFloat(mapLng)
                            },
                            disableDefaultUI: true
                        });
                        var popupPos = mapEl.data('popup-position');
                        if (mapData.length <= 0)
                            mapData = mapEl.data('data_show');
                        if (mapLat.length <= 0)
                            mapLat = mapEl.data('lat');
                        if (mapLng.length <= 0)
                            mapLng = mapEl.data('lng');
                        if (mapZoom.length <= 0)
                            mapZoom = typeof mapEl.data('zoom') !== 'undefined' ? mapEl.data('zoom') : 13;
                        if (mapIcon.length <= 0)
                            mapIcon = mapEl.data('icon');

                        if (typeof isMapMove === 'undefined')
                            isMapMove = false;

                        if (!isMapMove) {
                            mapGobal = new google.maps.Map(mapEl.get(0), {
                                zoom: mapZoom,
                                center: {
                                    lat: parseFloat(mapLat),
                                    lng: parseFloat(mapLng)
                                },
                                disableDefaultUI: true
                            });
                        }




                        if (typeof mapData != 'undefined' && Object.keys(mapData).length) {
                            var marker = [];
                            var ib = [];
                            var c = {};
                            var markerGolbal;
                            markerGolbal = jQuery.map(mapData, function (location, i) {

                                marker[i] = new google.maps.Marker({
                                    position: {
                                        lat: parseFloat(location.lat),
                                        lng: parseFloat(location.lng)
                                    },
                                    options: {
                                        icon: location.icon_mk,
                                        animation: isMapMove ? google.maps.Animation.NONE : google.maps.Animation.DROP
                                    },
                                    map: mapGobal
                                });

                                var ibOptions = {
                                    content: '',
                                    disableAutoPan: true,
                                    maxWidth: 0,
                                    pixelOffset: new google.maps.Size(-135, 20),
                                    zIndex: null,
                                    boxStyle: {
                                        padding: "0px 0px 0px 0px",
                                        width: "270px",
                                    },
                                    closeBoxURL: "",
                                    cancelBubble: true,
                                    infoBoxClearance: new google.maps.Size(1, 1),
                                    isHidden: false,
                                    pane: "floatPane",
                                    enableEventPropagation: true,
                                    alignBottom: true
                                };
                                if (window.matchMedia("(min-width: 768px)").matches) {
                                    if (popupPos == 'right') {
                                        ibOptions.pixelOffset = new google.maps.Size(35, -208);
                                        ibOptions.alignBottom = false;
                                    }
                                }
                                jQuery(window).on('resize', function () {
                                    if (window.matchMedia("(min-width: 768px)").matches) {
                                        if (popupPos == 'right') {
                                            ibOptions.pixelOffset = new google.maps.Size(35, -208);
                                            ibOptions.alignBottom = false;
                                        }
                                    }
                                });
                                if (location.lat != mapLat && location.lng != mapLng) {
                                    google.maps.event.addListener(marker[i], 'click', (function () {
                                        var source = location.content_html;
                                        var boxText = document.createElement("div");
                                        if (window.matchMedia("(min-width: 768px)").matches) {
                                            if (popupPos == 'right') {
                                                boxText.classList.add("right-box");
                                            }
                                        }
                                        jQuery(window).on('resize', function () {
                                            if (window.matchMedia("(min-width: 768px)").matches) {
                                                if (popupPos == 'right') {
                                                    boxText.classList.add("right-box");
                                                }
                                            } else {
                                                boxText.classList.remove("right-box");
                                            }
                                        });
                                        boxText.style.cssText = "border-radius: 5px; background: #fff; padding: 0px;";
                                        boxText.innerHTML = source;
                                        ibOptions.content = boxText;
                                        var ks = Object.keys(c);
                                        if (ks.length) {
                                            for (var j = 0; j < ks.length; j++) {
                                                c[ks[j]].close();
                                            }
                                        }
                                        ib[i] = new InfoBox(ibOptions);
                                        c[i] = ib[i];
                                        ib[i].open(mapGobal, this);
                                        mapGobal.panTo(ib[i].getPosition());
                                        google.maps.event.addListener(ib[i], 'domready', function () {
                                            var closeInfoBox = document.getElementById("close-popup-on-map");
                                            google.maps.event.addDomListener(closeInfoBox, 'click', function () {
                                                ib[i].close();
                                            });
                                        });
                                    }));
                                }


                                return marker[i];
                            });

                        }
                        var listener = google.maps.event.addListener(mapGobal, "idle", function () {
                            if (mapGobal.getZoom() > 16)
                                mapGobal.setZoom(16);
                            google.maps.event.removeListener(listener);
                        });

                    }
                } else {

                    function stInitSingleDetailMapFromEl(mapEl) {
                        if (!mapEl || !mapEl.length) {
                            return;
                        }

                        function initMap() {
                            var existing = mapEl.data('st-detail-map');
                            if (existing && existing.getContainer && existing.getContainer()) {
                                var container = existing.getContainer();
                                if (typeof stEnsureNeshanContainer === 'function') {
                                    stEnsureNeshanContainer(container);
                                }
                                if (existing.resize) {
                                    existing.resize();
                                }
                                return;
                            }
                            stRenderSingleDetailVectorMap(mapEl, mapEl.data('data_show'));
                            stResizeSingleDetailMap(mapEl, 250);
                        }

                        if (typeof stRunAfterMapContainerLayout === 'function') {
                            stRunAfterMapContainerLayout(mapEl.get(0), initMap);
                        } else {
                            initMap();
                        }
                    }

                    function stInitSingleHotelPopupMap(popup) {
                        popup = popup && popup.length ? popup : $('.map-view-popup.style-2:visible');
                        if (!popup.length) {
                            popup = $('.map-view-popup.style-2');
                        }
                        stInitSingleDetailMapFromEl(popup.find('.google-map-mapbox').first());
                    }

                    var body = 'body.single';
                    $('.st-map-box, .st-map-wrapper .google-map-mapbox', body).each(function () {
                        var parent = $(this).closest('.st-map-box, .st-map-wrapper');
                        if (!parent.length) {
                            parent = $(this).parent();
                        }
                        var mapEl = $(this).hasClass('google-map-mapbox') ? $(this) : $('.google-map-mapbox', parent).first();
                        if (!mapEl.length || !stIsSingleDetailMapVisible(mapEl)) {
                            return;
                        }
                        stInitSingleDetailMapFromEl(mapEl);
                    });

                    $('.map-view').on('click.stMapPopup', function () {
                        var popup = $('.map-view-popup.style-2');
                        popup.fadeIn(200, function () {
                            if (typeof stRunAfterMapContainerLayout === 'function') {
                                stRunAfterMapContainerLayout(popup.get(0), function () {
                                    stInitSingleHotelPopupMap(popup);
                                });
                            } else {
                                stInitSingleHotelPopupMap(popup);
                            }
                        });
                    });

                    popupMapCloseHandler();
                    function popupMapCloseHandler() {
                        $('.map-view-popup.style-2 .close').off('click.stMapPopup').on('click.stMapPopup', function () {
                            $('.map-view-popup.style-2').fadeOut(200);
                        });
                    }

                    $('#st-modal-show-map').on('shown.bs.modal', function () {
                        var modal = $(this);
                        var mapEl = modal.find('.google-map-mapbox').first();
                        if (typeof stRunAfterMapContainerLayout === 'function') {
                            stRunAfterMapContainerLayout(modal.get(0), function () {
                                stInitSingleDetailMapFromEl(mapEl);
                            });
                        } else {
                            stInitSingleDetailMapFromEl(mapEl);
                        }
                    });
                }
            }

        },
        _stReviewSingle: function () {
            $('.review-form .review-items .rates i').each(function () {
                var list = $(this).parent(),
                    listItems = list.children(),
                    itemIndex = $(this).index(),
                    parentItem = list.parent();

                $(this).on('mouseenter', function () {
                    for (var i = 0; i < listItems.length; i++) {
                        if (i <= itemIndex) {
                            $(listItems[i]).addClass('hovered');
                        } else {
                            break;
                        }
                    }
                    $(this).on('click', function () {
                        for (var i = 0; i < listItems.length; i++) {
                            if (i <= itemIndex) {
                                $(listItems[i]).addClass('selected');
                            } else {
                                $(listItems[i]).removeClass('selected');
                            }
                        };
                        parentItem.children('.st_review_stats').val(itemIndex + 1);
                    });
                });

                $(this).on('mouseleave', function () {
                    listItems.removeClass('hovered');
                });
            });
            $('.review-form .st-stars i').each(function () {
                var list = $(this).parent(),
                    listItems = list.children(),
                    itemIndex = $(this).index(),
                    parentItem = list.parent();
                $(this).on('mouseenter', function () {
                    for (var i = 0; i < listItems.length; i++) {
                        if (i <= itemIndex) {
                            $(listItems[i]).addClass('hovered');
                        } else {
                            break;
                        }
                    }
                    $(this).on('click', function () {
                        for (var i = 0; i < listItems.length; i++) {
                            if (i <= itemIndex) {
                                $(listItems[i]).addClass('selected');
                            } else {
                                $(listItems[i]).removeClass('selected');
                            }
                        }
                        parentItem.children('.st_review_stats').val(itemIndex + 1);
                    });
                });
                $(this).on('mouseleave', function () {
                    listItems.removeClass('hovered');
                });
            });
        },
        _stContent: function (body) {
            //----------- Description Tour-------------------------------

            $('.st-description-more .stt-more').on('click', function () {
                $('.st-description-more').hide();
                $('.st-description-less').show();
            });
            $('.st-description-less .stt-less').on('click', function () {
                $('.st-description-less').hide();
                $('.st-description-more').show();
            });
            $('[data-show-all]', body).each(function () {
                var t = $(this);
                var height = t.data('height');
                t.css('height', height);
            });
            body.on('click', '[data-show-target]', function (ev) {
                ev.preventDefault();
                var target = $(this).data('show-target');
                $('.fa', this).toggleClass('fa-caret-up fa-caret-down');
                if ($('.fa', this).hasClass('fa-caret-up')) {
                    $('.text', this).html($(this).data('text-less'));
                } else {
                    $('.text', this).html($(this).data('text-more'));
                }
                if ($('[data-show-all="' + target + '"]', body).hasClass('open')) {
                    $('[data-show-all="' + target + '"]', body).css({
                        height: $('[data-show-all="' + target + '"]', body).data('height')
                    });
                } else {
                    $('[data-show-all="' + target + '"]', body).css({
                        height: ''
                    });
                }
                $('[data-show-all="' + target + '"]', body).toggleClass('open');
            });
            //----------- End Description Tour---------------------------
        },

        _putGuestName: function () {
            //--------------- Guest Name Inputs -------------------------

            var adultNumber = $('.field-guest input[name="adult_number"]');
            var childrenNumber = $('.field-guest input[name="child_number"]');
            var guestNameInput = $('.field-guest .guest_name_input');
            adultNumber.on('change', triggerGuestInputChange);
            childrenNumber.on('change', triggerGuestInputChange);

            function triggerGuestInputChange(e) {
                guestNameInput.trigger('guest-change', {
                    'adult': parseInt(adultNumber.val()),
                    'children': parseInt(childrenNumber.val()),
                });
            };

            guestNameInput.on('guest-change', function (e, number) {
                var adult = number.adult;
                var children = number.children;
                var hideAdult = $(this).data('hide-adult');
                var hideChildren = $(this).data('hide-children');
                var controlWraps = $(this).find('.guest_name_control');
                var controls = controlWraps.find('.control-item');
                if (isNaN(children)) {
                    children = 0;
                }

                if (hideAdult == 'on') {
                    adult = 0;
                }

                if (typeof hideChildren == 'undefined' || hideChildren != 'on') {
                    adult += children;
                }



                //adult-=1;// Only input guest >=2 name

                if (adult <= 0) {
                    $(this).addClass('d-none');
                } else {
                    // Append
                    for (var i = controls.length ? (controls.length) : 0; i < adult; i++) {
                        var div = $($('#guest_name_control_item').clone().html());
                        var p = div.find('input').attr('placeholder');
                        div.find('input').attr('placeholder', p.replace('%d', i + 1));

                        controlWraps.append(div);
                    }

                    // Remove
                    controls.each(function () {
                        if ($(this).index() > adult - 1) {
                            $(this).remove();
                        }
                    });

                    $(this).removeClass('d-none');
                }
            });

            triggerGuestInputChange();
            //------------------End Guest Name Inputs -------------------
        },
        _popupGallery: function () {

            if ($('.st-style-elementor').length) {
                $('.st-gallery-popup').on('click', function (e) {
                    e.preventDefault();
                    var gallery = $(this).attr('href');
                    $(gallery).magnificPopup({
                        delegate: 'a',
                        type: 'image',
                        closeMarkup: '<button class="mfp-close"><i class="stt-icon-close"></i></button>',
                        gallery: {
                            enabled: true,
                            arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow stt-icon-arrow-%dir%"></button>',
							tCounter: '%curr% / %total%'
                        },
                    }).magnificPopup('open');
                });

                $('.st-list-item-gallery').magnificPopup({
                    delegate: 'a', // child items selector, by clicking on it popup will open
                    type: 'image',
                    mainClass: 'stt-single-popup'
                    // other options
                });


            } else {
                if ($('.single-hotel_room').length || $('.single-st_hotel').length) {
                    $('.st-gallery-popup').on('click', function (e) {
                        e.preventDefault();
                        var gallery = $(this).attr('href');
                        $(gallery).magnificPopup({
                            delegate: 'a',
                            type: 'image',
                        }).magnificPopup('open');
                    });
                }

            }
            $(document).on('click', '.mfp-close', function (e) {
                e.preventDefault();
                $.magnificPopup.close();
            });
        },
        _share: function () {
            $('.shares .social-share').on('click', function (ev) {
                ev.preventDefault();
                $('.shares .share-wrapper').slideToggle(200);
            });
            if ($('.st-style-elementor').length) {
                $(".st-video-popup").each(function () {
                    $(this).magnificPopup({
                        type: 'iframe',
                        closeMarkup: '<button class="mfp-close"><i class="stt-icon-close"></i></button>',
                    })
                });
            } else {
                $(".st-video-popup").each(function () {
                    $(this).magnificPopup({
                        type: 'iframe'
                    })
                });
            }

            $(document).on('click', '.btn_add_wishlist', function (event) {
                event.preventDefault();
                var $this = $(this);
                $.ajax({
                    url: st_params.ajax_url,
                    type: "POST",
                    data: {
                        action: "st_add_wishlist",
                        data_id: $(this).data('id'),
                        data_type: $(this).data('type')
                    },
                    dataType: "json",
                }).done(function (html) {
                    $this.html(html.icon).attr("data-original-title", html.title)
                })
            });
        },
        _resize: function (body) {
            var timeout_fixed_item;
            $(window).on('resize', function () {
                clearTimeout(timeout_fixed_item);
                timeout_fixed_item = setTimeout(function () {

                    $('.st-hotel-content', 'body').each(function () {
                        var t = $(this);
                        $(window).on('scroll', function () {
                            if ($(window).scrollTop() >= 50 && window.matchMedia('(max-width: 991px)').matches) {
                                t.css('display', 'flex');
                            } else {
                                t.css('display', 'none');
                            }
                        });
                    });
                }, 1000);
            }).trigger('resize');
            //Slider gallery single hotel detail
            if (window.matchMedia('(min-width: 992px)').matches) {
                $('.st-gallery', body).each(function () {
                    var parent = $(this);
                    var $fotoramaDiv = $('.fotorama', parent).fotorama({
                        width: parent.data('width'),
                        nav: parent.data('nav'),
                        thumbwidth: '135',
                        thumbheight: '135',
                        allowfullscreen: parent.data('allowfullscreen')
                    });
                    parent.data('fotorama', $fotoramaDiv.data('fotorama'));
                });
            } else {
                $('.st-gallery', body).each(function () {
                    var parent = $(this);
                    if (typeof parent.data('fotorama') !== 'undefined') {
                        parent.data('fotorama').destroy();
                    }
                    var $fotoramaDiv = $('.fotorama', parent).fotorama({
                        width: parent.data('width'),
                        nav: parent.data('nav'),
                        thumbwidth: '80',
                        thumbheight: '80',
                        allowfullscreen: parent.data('allowfullscreen')
                    });
                    parent.data('fotorama', $fotoramaDiv.data('fotorama'));
                });
            }
            if (window.matchMedia('(min-width: 992px)').matches) {
                $('.full-map').show();
            } else {
                $('.full-map').hide();
            }
            if (window.matchMedia('(max-width: 991px)').matches) {
                $('.as').slideDown();
            }

        }
    }
    SingleHotelDetail.init();
})(jQuery);