$ = jQuery; var bookingWidgetController = function () { return { config: { _custom_hotel_namespace: false, _custom_hotel_domain: false, messages: { es: { kids_age: "De 3 a 12 años", babies_age: "Menores de 3 años (cuna bajo petición)" }, en: { kids_age: "From 3 to 12 years", babies_age: "Infants aged under 3 (cot on request)" }, de: { kids_age: "Von 3 bis 12 Jahre", babies_age: "Kinder unter 3 Jahren (kinderbett auf anfrage)" }, fr: { kids_age: "De 3 à 12 ans", babies_age: "Moins de 3 ans (berceau sous demande)" }, nl: { kids_age: "Van 3 tot 12 jaar oud", babies_age: "Onder de 3 jaar (kinderbed op aanvraag)" } } }, init: function () { this.prepare_dependencies(); }, is_mobile: function() { if(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)) { return true; } return false; }, prepare_dependencies: function () { jQuery('head').append(''); if (window.location.origin.indexOf('elfuertemarbella.com') > -1) { var target_css = "//fuerte-marbella-dot-amare-hotels.appspot.com/static_1/css/elfuertemarbella/booking_widget_fuerte_v2.css?v=1.69"; } else { var target_css = "//fuerte-marbella-dot-amare-hotels.appspot.com/static_1/css/fuerte/booking_widget_fuerte_v2.css?v=1.69"; } jQuery('head').append(jQuery('').attr('href', target_css)); var target_fawesome = "//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"; jQuery('head').append(jQuery('').attr('href', target_fawesome)); jQuery('head').append(''); jQuery('head').append(''); jQuery.getScript("//fuerte-marbella-dot-amare-hotels.appspot.com/static_inj/lib/jquery-ui-1.10.1.custom.min.modified.js").done(function(){ $ = jQuery; // if (window.location.origin.indexOf('elfuertemarbella.com') === -1) { jQuery.getScript("//fuerte-marbella-dot-amare-hotels.appspot.com/static_1/js/mainWebSkeletonAux_injection.js"); // } jQuery.getScript("//fuerte-marbella-dot-amare-hotels.appspot.com/static_1/lib/selectric/jquery.selectric.1.8.js").done(function () { var language_widget = jQuery("html").attr("lang").replace(/-.*/, ''); jQuery.getScript("//fuerte-marbella-dot-amare-hotels.appspot.com/static_1/js/datepicker/jquery.ui.datepicker-" + language_widget + ".js?v=1").done(function () { bookingWidgetController.get_booking_widget_html(); }); }); }); }, get_booking_widget_html: function () { if(jQuery(".buscador-reservas-horizontal").length){ var language_widget = jQuery("html").attr("lang").replace(/-.*/, ''), target_widget_url = "//fuerte-marbella-dot-amare-hotels.appspot.com/fuertewidget/" + language_widget, paraty_widget_namespace = bookingWidgetController.get_namespace_widget(); if (paraty_widget_namespace && ! paraty_widget_namespace == 'custom-paraty-format') target_widget_url = target_widget_url + "?namespace=" + paraty_widget_namespace; jQuery.get(target_widget_url, function (e) { parent_wrapper_widget = jQuery("
").html(e); }).done(function () { jQuery(".buscador-reservas-horizontal").html(parent_wrapper_widget); jQuery(".room.room1 .children_selector").append(jQuery("").html(bookingWidgetController.config.messages[language_widget].kids_age)); jQuery(".room.room1 .babies_selector").append(jQuery("").html(bookingWidgetController.config.messages[language_widget].babies_age)); jQuery.getScript("//fuerte-marbella-dot-amare-hotels.appspot.com/static_1/scripts/hotel_selector_2.js?v=1"); if(jQuery(".destination_wrapper").length) { jQuery("#full_wrapper_booking").addClass("with_hotel_selector"); } jQuery.getScript("//fuerte-marbella-dot-amare-hotels.appspot.com/static_1/lib/jquery-i18n-1.1.1/jquery.i18n.js").done(function () { jQuery.getScript("//fuerte-marbella-dot-amare-hotels.appspot.com/static_1/i18n/messages_" + language_widget + ".js?v=1").done(function () { jQuery.i18n.load(messages); _set_datepicker_regional(jQuery); jQuery.getScript("//fuerte-marbella-dot-amare-hotels.appspot.com/static_1/plugins/pricescalendar/calendar.plugin.js?v=1.1").done(function(){ _set_datepicker_regional(jQuery); jQuery.getScript("//fuerte-marbella-dot-amare-hotels.appspot.com/static_1/plugins/dates-selector/datepicker_v1.js?v=1.5").done(function () { DP_extend_info.config.booking_version = '7'; DP_extend_info.config.hotel_path_endpoint = '//fuerte-marbella-dot-amare-hotels.appspot.com'; var target_min_date; var period_closed = JSON.parse('[{"servingUrl": null, "title": "Periodo 1", "spanish_title": "Periodo 1", "description": "", "enabled": true, "priority": "a1", "linkUrl": "", "key": "ag5zfmFtYXJlLWhvdGVsc3IUCxIHUGljdHVyZRiAgMC1y7uJCgyiAQ9mdWVydGUtbWFyYmVsbGE", "altText": "Hotel Fuerte Marbella. Web Oficial", "allowInMobile": true, "onlyInMobile": false, "close": "2022-01-01", "open": "2023-06-01", "pictureTitle": "Periodo 1"}, {"servingUrl": null, "title": "Periodo 2", "spanish_title": "Periodo 2", "description": "", "enabled": true, "priority": "a2", "linkUrl": "", "key": "ag5zfmFtYXJlLWhvdGVsc3IUCxIHUGljdHVyZRiAgKD_-q-PCwyiAQ9mdWVydGUtbWFyYmVsbGE", "altText": "Hotel Fuerte Marbella. Web Oficial", "allowInMobile": true, "onlyInMobile": false, "pictureTitle": "Periodo 2", "open": "2024-03-09", "close": "2024-01-07"}, {"servingUrl": null, "title": "Periodo 3", "spanish_title": "Periodo 3", "description": "", "enabled": true, "priority": "a3", "linkUrl": "", "key": "ag5zfmFtYXJlLWhvdGVsc3IUCxIHUGljdHVyZRiAgJCSp4-RCwyiAQ9mdWVydGUtbWFyYmVsbGE", "altText": "Hotel Fuerte Marbella. Web Oficial", "allowInMobile": true, "onlyInMobile": false, "close": "2025-01-05", "pictureTitle": "Periodo 3", "open": "2025-03-07"}, {"servingUrl": null, "title": "Periodo Maximo", "spanish_title": "Periodo Maximo", "description": "", "enabled": true, "priority": "a4", "linkUrl": "", "key": "ag5zfmFtYXJlLWhvdGVsc3IUCxIHUGljdHVyZRiAgMDVp9GECgyiAQ9mdWVydGUtbWFyYmVsbGE", "altText": "Hotel Fuerte Marbella. Web Oficial", "allowInMobile": true, "onlyInMobile": false, "last_close": "2026-01-04", "pictureTitle": "Periodo Maximo"}]'); DP_extend_info.config.period_closed = period_closed; for (var n=0;n < period_closed.length;n++){ var closed_hotel = period_closed[n].close, open_hotel = period_closed[n].open; if (closed_hotel && new Date(closed_hotel)<= new Date()){ if (open_hotel && new Date(open_hotel)>= new Date()) target_min_date = new Date(open_hotel); } } if (!target_min_date) {target_min_date = new Date()} if (bookingWidgetController.config._custom_hotel_domain){ DP_extend_info.config.hotel_path_endpoint = bookingWidgetController.config._custom_hotel_domain; } DP_extend_info.init(); if (target_min_date) { DP_extend_info.config.datepicker_sd_wrapper.datepicker('option', 'minDate', target_min_date); DP_extend_info.config.datepicker_ed_wrapper.datepicker('option', 'minDate', target_min_date); DP_extend_info.format_dates($.datepicker.formatDate("dd/mm/yy", target_min_date)); DP_extend_info.set_datepicker_start_date($.datepicker.formatDate("dd/mm/yy", target_min_date)); } jQuery.getScript("//fuerte-marbella-dot-amare-hotels.appspot.com/static_1/scripts/booking_7.js?v=1.2").done(function () { bookingWidgetController.prepare_booking_button(); bookingWidgetController.prepare_rooms_modifications(); jQuery("select.room_selector").unbind("change"); jQuery(".days_number_datepicker").html("1"); jQuery(".room_selector").selectric({disableOnMobile: false}); jQuery(".rooms_number").selectric({disableOnMobile: false}); _set_datepicker_regional(jQuery); if(jQuery(".destination_wrapper").length) { if (bookingWidgetController.config._custom_hotel_namespace) { jQuery("#" + bookingWidgetController.config._custom_hotel_namespace).trigger('click'); } } if (DP_extend_info.config.min_date) { DP_extend_info.format_dates(jQuery.datepicker.formatDate("dd/mm/yy", DP_extend_info.config.min_date)); } var promocode_hidden_input = jQuery("#paraty_promocode"); if (promocode_hidden_input.length) { var promocode_applied_mesage = jQuery("").addClass('promocode_applied_message').html(jQuery.i18n._('descuento_aplicado')), full_wrapper_booking = jQuery(".booking_form.paraty-booking-form"), promocode_input = full_wrapper_booking.find(".promocode_input"); promocode_input.addClass("auto_applied").val(promocode_hidden_input.val()); full_wrapper_booking.find(".wrapper_booking_button ").addClass('promocode_autoapplied'); promocode_applied_mesage.insertAfter(promocode_input); } var hide_hotel_selector_input = jQuery("#paraty_hotel_selector_hidden"); if (hide_hotel_selector_input.length){ var engine_wrapper_selector = jQuery("#full_wrapper_booking"); engine_wrapper_selector.find(".destination_wrapper").addClass('hide'); engine_wrapper_selector.removeClass('with_hotel_selector'); } //Custom configuration if (window.location.host.indexOf('promo.') > -1) { $(".tooltip_wrapper").remove(); } }); }); }); }); }); if (jQuery(".babies_selector").length) { jQuery("#full_wrapper_booking").addClass("widget_with_babies"); } bookingWidgetController.adding_room_tag_selector(); bookingWidgetController.adding_adults_tag_selector(); bookingWidgetController.adding_kids_tag_selector(); bookingWidgetController.adding_babies_tag_selector(); bookingWidgetController.prepare_rooms_modifications(); bookingWidgetController.bind_click_buttons(); bookingWidgetController.hide_hotels_in_selector(); var has_promocode_at_url = getUrlParameter('promocode'); if (has_promocode_at_url) { jQuery(".promocode_wrapper .promocode_input").val(has_promocode_at_url); } bookingWidgetController.analytics_utils(); }); } }, get_namespace_widget: function(){ var paraty_widget_namespace = jQuery("#paraty_widget_namespace"), paraty_widget_internal_url = jQuery("#paraty_widget_url"); if (paraty_widget_namespace.length){ this.config._custom_hotel_namespace = paraty_widget_namespace.val(); if (paraty_widget_namespace.val() == 'custom-paraty-format') return 'custom-paraty-format'; this.config._custom_hotel_domain = paraty_widget_internal_url.val(); return this.config._custom_hotel_namespace; } }, bind_click_buttons: function(){ jQuery("a.btn-submit[href*='booking']").click(function(e){ e.preventDefault(); jQuery(".start_end_date_wrapper").trigger('click'); }); jQuery(".paraty_listener").click(function(){ bookingWidgetController.apply_clicked_options($(this)) }); jQuery(".hotel_selector_option").click(function(){ DP_extend_info.config.datepicker_sd_wrapper.datepicker('destroy'); DP_extend_info.create_datepicker_containers(); var open_hotel_property = jQuery(this).attr('data-open-hotel'), external_open = jQuery(this).attr("data-open-external"), target_max_date = new Date("2050-12-31"); if(open_hotel_property) { var json_hotel_property = JSON.parse(open_hotel_property); DP_extend_info.config.period_closed = json_hotel_property; var target_min_date; for (var n=0;n