jQuery(function($) {ServicesModuleInitialize();});function ServicesModuleInitialize() {$( document ).on( 's123.page.ready', function( event ) {var $section = $('section.s123-module-services');$section.each(function( index ) {var $sectionThis = $(this);var categories = new ModuleLayoutCategories({$items :  $sectionThis.find('.services-category'),$categoriesContainer : $sectionThis.find('.categories-panel'),$filterButton : $sectionThis.find('.items-responsive-filter'),$categories : $sectionThis.find('.items-categories-container li')});if ( $sectionThis.hasClass('layout-10') ) {$sectionThis.find('.service-item-description').each(function() {const $paragraph = $(this);const lineHeight = parseFloat($paragraph.css('font-size')) * 1.5;const maxLines = 4;const actualHeight = $paragraph.height();const numberOfLines = actualHeight / lineHeight;if (numberOfLines > maxLines) {$paragraph.addClass('show-more');$paragraph.attr('data-rel', 'tooltip');$paragraph.css('height', lineHeight * maxLines);$paragraph.on('click', function() {var _this = $(this);bootbox.alert({title: _this.data('title'),message: _this.html(),backdrop: true});});}});}
ServicesModuleMobileViewCarouselInit($sectionThis);});});}
function ServicesModuleMobileViewCarouselInit( $section ) {let sectionID = $section.get(0).id.replace('section-','');let $sectionItemsContainer = $section.find('.service-grid');let mobileViewTypeNUM = $section.data('mobile-view-type');ServicesModuleMobileViewCarouselInitResizeHandler();if ( $sectionItemsContainer.hasClass('slick-initialized') ) {$sectionItemsContainer.css('visibility','none');$sectionItemsContainer.slick('unslick');$sectionItemsContainer.parent().find('.custom-arrow-container').remove();}
if ( findBootstrapEnvironment() != 'xs' || mobileViewTypeNUM != '2' ) {$sectionItemsContainer.css('visibility','visible');return;}
$sectionItemsContainer.on('init', function(event) {$sectionItemsContainer.css('visibility','visible');});$sectionItemsContainer.slick({dots: false,infinite: true,vertical: false,verticalSwiping: false,slidesToShow: 1,slidesToScroll: 1,adaptiveHeight: true,swipeToSlide: true,rtl: $('html').attr('dir') === 'rtl' ? true : false,centerMode: true,centerPadding: '8%',arrows: false});function ServicesModuleMobileViewCarouselInitResizeHandler() {$(window).off('resize.ServicesModuleMobileViewCarouselInit').on('resize.ServicesModuleMobileViewCarouselInit', function( event ) {clearTimeout(window.ServicesModuleMobileViewCarouselInit_Delay);window.ServicesModuleMobileViewCarouselInit_Delay = setTimeout( function() {var $sections = $('section.s123-module-services');$sections.each(function( index ) {ServicesModuleMobileViewCarouselInit($(this));});},50);});}}
jQuery(function($) {TeamModuleInitialize();});function TeamModuleInitialize() {$( document ).on( 's123.page.ready', function( event ) {var $section = $('section.s123-module-team:not(.layout-9)');$section.each(function( index ) {var $sectionThis = $(this);$sectionThis.find('.team-phone-btn').click(function() {var $this = $(this);var $teamPhone = $this.closest('.team-phone');buildPopup('teamPopupFloatDivPhone','',$teamPhone.find('.team-phone-popover').html(),'',true,true,true,'','');});var categories = new ModuleLayoutCategories({$items :  $sectionThis.find('.team-category'),$categoriesContainer : $sectionThis.find('.categories-panel'),$filterButton : $sectionThis.find('.items-responsive-filter'),$categories : $sectionThis.find('.items-categories-container li')});if ( $sectionThis.hasClass('layout-13') ) {$sectionThis.find('.team-item-description').each(function() {if ( isMobileDevice.any() ) return;const $paragraph = $(this);const lineHeight = parseFloat($paragraph.css('font-size')) * 1.5;const maxLines = 4;const actualHeight = $paragraph.height();const numberOfLines = actualHeight / lineHeight;if (numberOfLines > maxLines) {$paragraph.addClass('show-more');$paragraph.attr('data-rel', 'tooltip');$paragraph.css('height', lineHeight * maxLines);$paragraph.on('click.layout.13.open.more', function() {var _this = $(this);bootbox.alert({className: 'item-show-more-popup',title: _this.data('title'),message: `<p class="item-show-more-text">${_this.html()}</p>`,backdrop: true});});}});}});});}
jQuery(function($) {TeamModuleInitialize_Layout9();});function TeamModuleInitialize_Layout9() {$( document ).on( 's123.page.ready', function( event ) {var $section = $('section.s123-module-team.layout-9');$section.each(function( index ) {var $sectionThis = $(this);$section.off('module_layout_categories.shown').on('module_layout_categories.shown', function( event, catID ) {var $category = $(this).find('.team-category[data-categories-filter="'+catID+'"]');var numberImagesInRow = getSlidesPerView($category);var spaceBetween = 30;var highestMember = 0;if ( numberImagesInRow == 0 ) {$category.find('.owl-carousel').addClass('manually-loaded');$category.find('.team-member-wrap').css({height: ''});initializeTeamPhone($sectionThis);return;}
if ( $category.find('.owl-carousel').hasClass('owl-loaded') ) return;$category.find('.team-member-wrap').css({height: ''});$category.find('.team-member-wrap').each(function() {if ( $(this).height() > highestMember ) {highestMember = $(this).height();}});if ( findBootstrapEnvironment()  === 'xs' ) {$category.find('.team-member-wrap').css({height: (highestMember + spaceBetween) + 'px'});} else {$category.find('.team-member-wrap').css({height: highestMember + 'px'});}
var $teamMemberWrap = $category.find('.team-member-wrap').first();if ( $teamMemberWrap.find('.team-member').length > 0 ) {$category.find('.s123-module-shadows').css({height: $teamMemberWrap.height() + 'px'});}
$category.find('.owl-carousel').owlCarousel({items: numberImagesInRow,autoplay: false,autoplayTimeout: 0,center: true,dots: $category.find('.owl-carousel').data('item-count') > 7 ? false : true,dotsEach: (numberImagesInRow % 2 == 1 ? true : false),margin: spaceBetween,loop: true,lazyLoad: true,stagePadding: 50,rtl: $('html').attr('dir') == 'rtl',responsive: {0: {items: 1},479: {items: 1},768: {items: 1},979: {items: 3},1199: {items: 3}},nav: true,navText: ['<i class="fa fa-chevron-left"></i>','<i class="fa fa-chevron-right"></i>'],onInitialize: function() {initializeTeamPhone($sectionThis);window.myLazyLoad.update();},onResize: function() {window.myLazyLoad.update();},onDrag: function() {window.myLazyLoad.update();},onLoadLazy: function() {window.myLazyLoad.update();}});});if ( $sectionThis.find('.team-category[data-categories-filter="s123-g-show-all"]').length > 0 ) {$sectionThis.trigger('module_layout_categories.shown',['s123-g-show-all']);}
var categories = new ModuleLayoutCategories({$items :  $sectionThis.find('.team-category'),$categoriesContainer : $sectionThis.find('.categories-panel'),$filterButton : $sectionThis.find('.items-responsive-filter'),$categories : $sectionThis.find('.items-categories-container li')});});function initializeTeamPhone( $teamSection ) {$teamSection.off('click.initializeTeamPhone').on('click.initializeTeamPhone','.team-phone-btn', function() {var $teamPhone = $(this).closest('.team-phone');buildPopup('teamPopupFloatDivPhone','',$teamPhone.find('.team-phone-popover').html(),'',true,true,true,'','');})}});function getSlidesPerView( $category ) {var slidesPerView = 3.3;var originalItems = [];$category.find('.team-member').each(function() {if ( !$(this).closest('.owl-item').hasClass('cloned') ) {originalItems.push($(this));}});switch( findBootstrapEnvironment() ) {case 'xs':case 'sm':slidesPerView = originalItems.length < 2 ? 0 : 1;break;default:slidesPerView = originalItems.length <= 3 ? 0 : 3;break;}
return slidesPerView;}
if ( IsWizard() ) {$(document).on('wizard.preview.device.changed', function( event ) {var $section = $('section.s123-module-team.layout-9');$section.each(function( index ) {var $sectionThis = $(this);var $category = $sectionThis.find('.team-category').filter(':visible');var $carousel = $category.find('.owl-carousel');$carousel.trigger('destroy.owl.carousel');$carousel.removeClass('owl-loaded owl-carousel-init manually-loaded');$sectionThis.trigger('module_layout_categories.shown',[$category.data('categories-filter')]);});});}}
jQuery(function($) {TeamModuleInitialize_Layout14();});function TeamModuleInitialize_Layout14() {$( document ).on( 's123.page.ready', function( event ) {var $section = $('section.s123-module-team.layout-14');$section.each(function( index ) {var $sectionThis = $(this);$sectionThis.find('.team-category').each(function() {$(this).find('.team-member').first().addClass('active');$(this).find('.team-image').first().addClass('active');var $firstInfo = $(this).find('.team-memeber-info').first();if ($firstInfo.length > 0) {$firstInfo.removeClass('team-more-info-hidden');}});$sectionThis.find('.team-members .team-member').on('click mouseenter',function() {let $this = $(this);if ( $this.hasClass('active') ) return;let imgKey = $this.data('img-key');$sectionThis.find('.team-member').removeClass('active');$sectionThis.find('.team-image.active').stop().fadeOut(500).removeClass('active');$sectionThis.find('.team-memeber-info').addClass('team-more-info-hidden');$sectionThis.find('.team-member[data-img-key="' + imgKey + '"]').addClass('active');$sectionThis.find('.team-image[data-img-key="' + imgKey + '"]').stop().fadeIn(500).addClass('active');var $targetInfo = $sectionThis.find('.team-memeber-info[data-img-key="' + imgKey + '"]');if ($targetInfo.length > 0) {$targetInfo.removeClass('team-more-info-hidden');}});$sectionThis.off('module_layout_categories.shown').on('module_layout_categories.shown', function( event, catID ) {$category = $(this).find('.team-category[data-categories-filter="'+catID+'"]');$sectionThis.find('.team-member').removeClass('active');$sectionThis.find('.team-image.active').fadeOut(500).removeClass('active');$sectionThis.find('.team-image').removeClass('active');$sectionThis.find('.team-memeber-info').addClass('team-more-info-hidden');let imgKey = $category.find('.team-member:first-child').data('img-key');$sectionThis.find(`.team-member[data-img-key="${imgKey}"]`).addClass('active');$sectionThis.find(`.team-image[data-img-key="${imgKey}"]`).fadeIn(500).addClass('active');var $targetInfo = $sectionThis.find(`.team-memeber-info[data-img-key="${imgKey}"]`);if ($targetInfo.length > 0) {$targetInfo.removeClass('team-more-info-hidden');}});});});}
jQuery(function($) {headersModuleInitialize_Layout();});function headersModuleInitialize_Layout() {$( document ).on( "s123.page.ready", function( event ) {var $sections = $('section.s123-module-headers:is(.layout-6,.layout-7,.layout-8,.layout-9,.layout-18,.layout-20,.layout-22,.layout-23,.layout-24,.layout-25,.layout-26,.layout-27,.layout-29,.layout-30,.layout-35,.layout-39,.layout-40,.mobile-layout-1,.mobile-layout-3,.mobile-layout-7,.mobile-layout-8,.mobile-layout-11');$sections.each(function( index ) {var $s = $(this);var $carousel = $s.find('[data-ride="carousel"]');var sliderSpeed = $s.data('slider-speed');if ( sliderSpeed == '' || parseInt(sliderSpeed) < 1 || parseInt(sliderSpeed) > 21 ) {sliderSpeed = 5000;} else {sliderSpeed = parseInt(sliderSpeed) * 1000;}
$s.find('.header1, .header2').each(function( index ) {var $this = $(this);if ( $this.data('line-height') && $this.data('line-height').length > 0 ) {$this.get(0).style.setProperty('--header_line_height',$this.data('line-height'));$this.css('line-height',$this.data('line-height'));}});if( $s.hasClass('layout-20') ) {var $firstImage = $s.find('.headers-image').first();if ( $firstImage.length > 0 ) {if ( $firstImage.data('bg') !== undefined ) {var img = new Image();img.src = $firstImage.data('bg');img.onload = function() {var aspectRatio = this.width / this.height;$s.find('.headers-image').css('aspect-ratio',String(aspectRatio));if( $s.find('.headers-container').hasClass('circle-under-image') && aspectRatio < 1 ) {$s.addClass('corner-circle');}};} else {$firstImage.closest('.headers-img-wrap').addClass('circle-fixed-width');}}}
if( $s.hasClass('layout-22') || $s.hasClass('layout-29') || $s.hasClass('mobile-layout-7') ) {var $headersDescription = $s.find('.headers-description');var $headersimage = $s.find('.headers-image');if ( $headersimage.length == 0 ) {$headersimage = $s.find('.headers-bg-video');}
if ( $headersimage.length > 0 && $headersDescription.length > 0 ) {if ( ($headersDescription.get(0).offsetHeight - 60) > $headersimage.get(0).offsetHeight ) {$s.get(0).style.setProperty('--headers-description-height',$headersDescription.get(0).offsetHeight+'px');}}}
$carousel.carousel({interval: sliderSpeed});if( $s.hasClass('layout-26') && $s.attr('data-version') !== undefined && $s.attr('data-version') == '2' ) {if ( IsWizard() ) {$(document).on('site123.colorPicker.change',function( event ) {updateBackgroundColor();});}
updateBackgroundColor();}
function updateBackgroundColor() {var boxColorClass = $s.data('box-color');var color = $s.hasClass('bg-primary') ?getComputedStyle(document.documentElement).getPropertyValue('--modules_color_box') :getComputedStyle(document.documentElement).getPropertyValue('--modules_color_second_box');switch (boxColorClass) {case 'bg-primary-gray':color = '#ebedf0';break;case 'bg-primary-white':color = '#ffffff';break;case 'bg-primary-black':color = '#000000';break;case 'background-primary-color btn-primary-text-color':color = $s.hasClass('bg-primary') ?getComputedStyle(document.documentElement).getPropertyValue('--modules_color_section_main') :getComputedStyle(document.documentElement).getPropertyValue('--modules_color_second_section_main');break;}
$s.find('.headers-img-wrap').get(0).style.setProperty('--layout26OpacityColor',hexToRGB(color));}
function hexToRGB(hex) {var r = parseInt(hex.slice(1, 3), 16),g = parseInt(hex.slice(3, 5), 16),b = parseInt(hex.slice(5, 7), 16);return r + ", " + g + ", " + b;}
if( $s.data('image-width') == 2 ) {var sectionHeight = $s.height();$s.find('.headers-container').css('min-height',sectionHeight+'px');if( $s.hasClass('layout-22') ) {$s.find('.headers-image').css('min-height',sectionHeight+'px');}
$s.data('image-width',0);}});var $sections = $('section.s123-module-headers');$sections.each(function( index ) {var $s = $(this);$s.find('.custom-header-font').each(function( index ) {var $this = $(this);var customFont = $this.data('custom-font');if ( customFont.length > 0 ) {$this.css('font-family',customFont);}});$s.find('.header1, .header2').each(function( index ) {var $this = $(this);if( $s.hasClass('layout-7') || $s.hasClass('layout-9') || $s.hasClass('layout-22') || $s.hasClass('layout-23') || $s.hasClass('layout-24') || $s.hasClass('layout-26') || $s.hasClass('layout-27') || $s.hasClass('layout-29') || $s.hasClass('layout-33') || $s.hasClass('mobile-layout-1') || $s.hasClass('mobile-layout-7') ) {fitHeaderTextToParentContainer($this);}});$s.find('.h-s-form').each(function( index ) {let $this = $(this);hotelBookingWidgetInit($this);$this.off('submit').on('submit', function(event) {event.preventDefault();window.location.href = '/'+ $this.find('[data-id="page"] option').val() + '?' + $this.serialize();});});function fitHeaderTextToParentContainer( $textEl ) {if ( $textEl.length == 0 ) return;fontSize = parseFloat($textEl.css('font-size'));if ( !$.isNumeric(fontSize) ) return;var $parentContainer = $textEl.closest('.headers-text-resize-container');if ( $parentContainer.length > 0 && $parentContainer.width() < $textEl.width() ) {$textEl.css('visibility','hidden');var parentContainerWidth = $parentContainer.width();if ( $textEl.closest('section').hasClass('layout-9') || $textEl.closest('section').hasClass('layout-27') || $textEl.closest('section').hasClass('mobile-layout-1') ) {parentContainerWidth = parentContainerWidth + 5;}
if ( $textEl.closest('section').hasClass('layout-23') ) {parentContainerWidth = $parentContainer.innerWidth();}
var index = 0;while ( parentContainerWidth < $textEl.width() && index < 99 ) {index++;fontSize--;$textEl.get(0).style.setProperty('--header-font-size',fontSize);}
$textEl.css('visibility','unset');}}});S123_ActionButtons.init();});}
jQuery(function($) {HeadersModuleInitialize_Layout5();});function HeadersModuleInitialize_Layout5() {$( document ).on( 's123.page.ready', function( event ) {var $section = $('section.s123-module-headers.layout-5');$section.each(function( index ) {var $sectionThis = $(this);var $flickityContainer = $sectionThis.find('.carousel');var originalFirstImageSize = {};if ( $flickityContainer.length === 0 ) return;$flickityContainer.flickity({imagesLoaded: true,lazyLoad: 2,pageDots: false,wrapAround: true,percentPosition: false});});});}
jQuery(function($) {HeadersModuleInitialize_Layout30();});function HeadersModuleInitialize_Layout30() {$( document ).on( 's123.page.ready', function( event ) {var $section = $('section.s123-module-headers.layout-30, section.s123-module-headers.mobile-layout-11');$section.each(function( index ) {var $sectionThis = $(this);$sectionThis.find('.contactUsForm').each( function( index ) {var $form = $(this);var customFormMultiSteps = new CustomFormMultiSteps();customFormMultiSteps.init({$form: $form,$nextButton: $form.find('.next-form-btn'),$submitButton: $form.find('.submit-form-btn'),$previousButton: $form.find('.previous-form-btn'),totalSteps: $form.find('.custom-form-steps').data('total-steps')});var forms_GoogleRecaptcha = new Forms_GoogleRecaptcha();forms_GoogleRecaptcha.init($form);$form.validate({errorElement: 'div',errorClass: 'help-block',focusInvalid: true,ignore: ':hidden:not(.custom-form-step:visible input[name^="datePicker-"])',highlight: function (e) {$(e).closest('.form-group').removeClass('has-info').addClass('has-error');},success: function (e) {$(e).closest('.form-group').removeClass('has-error');$(e).remove();},errorPlacement: function (error, element) {if( element.is('input[type=checkbox]') || element.is('input[type=radio]') ) {var controls = element.closest('div[class*="col-"]');if( controls.find(':checkbox,:radio').length > 0 ) element.closest('.form-group').append(error);else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));}
else if( element.is('.select2') ) {error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));}
else if( element.is('.chosen-select') ) {error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));}
else {error.appendTo(element.closest('.form-group'));}},submitHandler: function( form ) {var $form = $(form);var clickAction = $form.data('click-action');$form.append($('<div class="conv-code-container"></div>'));var $convCodeContainer = $form.find('.conv-code-container');var thankYouMessage = translations.ThankYouAfterSubmmit;if ( $form.data('thanks-msg') ) {thankYouMessage = $form.data('thanks-msg');}
$form.find('button:submit').prop('disabled', true);S123.ButtonLoading.start($form.find('button:submit'));var url = "/versions/2/include/contactO.php";if ( $form.hasClass('custom-form') || $form.hasClass('horizontal-custom-form') ) {if ( !CustomForm_IsLastStep( $form ) ) {$form.find('.next-form-btn:visible').trigger('click');S123.ButtonLoading.stop($form.find('button:submit'));$form.find('button:submit').prop('disabled', false);return false;}
if ( !CustomForm_IsFillOutAtLeastOneField($form) ) {bootbox.alert(translations.fillOutAtLeastOneField);S123.ButtonLoading.stop($form.find('button:submit'));$form.find('button:submit').prop('disabled', false);return false;}
url = "/versions/2/include/customFormO.php";}
if ( forms_GoogleRecaptcha.isActive && !forms_GoogleRecaptcha.isGotToken ) {forms_GoogleRecaptcha.getToken();return false;}
$.ajax({type: "POST",url: url,data: $form.serialize(),success: function( data ) {var dataObj = jQuery.parseJSON(data);$form.trigger("reset");if ( clickAction == 'thankYouMessage' || clickAction == '' ) {bootbox.alert({title: translations.sent,message: thankYouMessage+'<iframe src="/versions/2/include/contactSentO.php?w='+$('#w').val()+'&websiteID='+dataObj.websiteID+'&moduleID='+dataObj.moduleID+'" style="width:100%;height:30px;" frameborder="0"></iframe>',className: 'contactUsConfirm',buttons: {ok: {label: translations.Ok}},backdrop: true});} else {if ( dataObj.conv_code.length > 0 ) {var $convCode = $('<div>' + dataObj.conv_code + '</div>');$convCodeContainer.html($convCode.text());}
if( top.$('#websitePreviewIframe').length ) {bootbox.alert({title: translations.previewExternalLinkTitle,message: translations.previewExternalLinkMsg.replace('{{externalLink}}','<b>'+dataObj.action.url+'</b>'),className: 'externalAlert'});} else {window.open(dataObj.action.url,'_self');}}
customFormMultiSteps.reset();forms_GoogleRecaptcha.reset();S123.ButtonLoading.stop($form.find('button:submit'));$form.find('button:submit').prop('disabled', false);WizardNotificationUpdate();}});return false;}});$form.find('.f-b-date-timePicker').each( function() {var $option = $(this);var $datePicker = $option.find('.fake-input.date-time-picker');var $hiddenInput = $option.find('[data-id="'+$datePicker.data('related-id')+'"]');var $datePickerIcon = $option.find('.f-b-date-timePicker-icon');var formBuilderCalendar = new calendar_handler();$datePicker.data('date-format',$form.data('date-format'));formBuilderCalendar.init({$fakeInput: $datePicker,$hiddenInput: $hiddenInput,$fakeInputIcon: $datePickerIcon,type: 'datePicker',title: translations.chooseDate,calendarSettings: {format: $datePicker.data('date-format'),weekStart: 0,todayBtn: "linked",clearBtn: false,language: languageCode,todayHighlight: true},onSubmit: function( selectedDate ) {$datePicker.html(selectedDate);$hiddenInput.val(selectedDate);}});});CustomForm_DisableTwoColumns($form);});});});}
// Run when the page ready (before images and other resource)
jQuery(function($) {MultiCurrencies.init();ActiveOrderPopup.init();WishList.init();});var MultiCurrencies = function() {var that = {nameSpace: 'multi-currencies',isActive: false,isChangedCurrency: false};that.init = function() {$(document).on('s123.page.ready.multi_currencies', function( event ) {that.settings = tryParseJSON($('.s123-multi-currencies').val());if ( !that.settings ) return;if ( !that.settings.active ) return;that.activeCurrency = tryParseJSON($.cookie($(websiteID).val()+'-'+that.nameSpace));that.defaultCurrency = that.settings.defaultCurrency;that.currencies = that.settings.currencies;that.setActiveCurrency(that.activeCurrency.currency);that.$menuIcon = $('[data-toggle="multiCurrenciesPopup"]');that.isActive = true;$(document).off('build_popup.open.multi_currencies').on('build_popup.open.multi_currencies', function( event ) {handleMenuIcon($('#popupFloatDivMenu [data-toggle="multiCurrenciesPopup"]'),true);});handleMenuIcon(that.$menuIcon,false);that.priceOnlyType.backup();$(document).off('pageLoaded.multi_currencies').on('pageLoaded.multi_currencies', function( event ) {if ( $.isNumeric(S123.QueryString.clientZone) ) {$('.client-zone-orders-table [data-rel="multiCurrency"]').removeAttr('data-rel');}
if ( isDefaultCurrency() && that.isChangedCurrency ) {that.reset();} else if ( isDefaultCurrency() && !that.isChangedCurrency  ) {$('[data-rel="multiCurrency"]').css({visibility: 'visible'});} else {updateAllPrices();}});if ( $.isNumeric(S123.QueryString.clientZone) ) return;$(document).off('s123.pjax.complete.multi_currencies').on('s123.pjax.complete.multi_currencies', function() {that.$menuIcon = $('[data-toggle="multiCurrenciesPopup"]');handleMenuIcon(that.$menuIcon,false);that.priceOnlyType.backup();$(document).trigger('pageLoaded.multi_currencies');});$(document).off('multi_currencies_price_update').on('multi_currencies_price_update', function( event, settings ) {$.each(settings, function( index, setting ) {if ( !isDefaultCurrency() ) {updatePrice(setting.el,setting.newPrice,true);} else {setting.el.find('[data-rel="multiCurrency"]').css({visibility: 'visible'});}});});$(document).trigger('pageLoaded.multi_currencies');modulesExtraActions();$(document).off('multi_currency_update').on('multi_currency_update', function() {buildPopup_CloseAction('popupFloatDivMenu');});});};that.setActiveCurrency = function( currency ) {that.activeCurrency = that.currencies[currency];if ( !that.activeCurrency ) {that.activeCurrency = that.defaultCurrency;}
$.cookie($(websiteID).val()+'-'+that.nameSpace,JSON.stringify(that.activeCurrency),{ expires: 365, path: '/' });};that.reset = function( ) {if ( !that.isActive ) return;if ( getOrderScreen() > 1 ) return;if ( window.czIsLoggedIn ) return;$('[data-rel="multiCurrency"]').each(function( index, el ) {var originalPrice = $(this).find('[data-type="price"]').data(that.nameSpace + '-price');var $price = $(showPrice(that.defaultCurrency.data,originalPrice));$(this).replaceWith($price);$price.css({visibility: 'visible'});backUpPrice($price.find('[data-type="price"]'),$price.find('[data-type="price"]').html(),false);});$('[data-multi-currency-symbol-only="true"]').html(that.defaultCurrency.data.symbol);that.priceOnlyType.update();that.isChangedCurrency = false;};that.geConvertedPrice = function( price ) {if ( !that.isActive ) return price;if ( !$.isNumeric(price) ) return price;if ( isDefaultCurrency() ) return price;if ( getOrderScreen() > 1 ) return price;var result = parseFloat(price) * parseFloat(that.activeCurrency.rate);return result > 0 ? result.toFixed(2) : result;};that.getOriginalPrice = function( price ) {if ( !that.isActive ) return price;if ( !$.isNumeric(price) ) return price;return parseFloat(price) / parseFloat(that.activeCurrency.rate);};that.getActiveCurrency = function() {return that.activeCurrency.data;};that.getMobileIconHtml = function() {var $clone = that.$menuIcon.clone();$clone.attr('data-is-mobile',true);return $clone.prop('outerHTML');};function handleMenuIcon( $menuIcon, isMobileMenu ) {setMenuIconCurrency($menuIcon);var html = '';var maxHeight = 160;html += '<div class="currency-menu-container fancy-scrollbar" style="max-height:' + maxHeight + 'px;">';html += '<div class="currency-list">';html += '<div class="currency-list-item" data-value="' + S123.escapeHtml(that.defaultCurrency.currency) + '">';html += '<a href="#">';html += '<span>' + that.defaultCurrency.currency + '</span>';html += '<span>-</span>';html += '<span>' + that.defaultCurrency.data.symbol + '</span>';html += '</a>';html += '</div>';$.each(that.currencies, function( currencyCode, currency ) {html += '<div class="currency-list-item" data-value="' + S123.escapeHtml(currencyCode) + '">';html += '<a href="#">';html += '<span>' + currencyCode + '</span>';html += '<span>-</span>';html += '<span>' + currency.data.symbol + '</span>';html += '</a>';html += '</div>';});html += '</div>';html += '</div>';$html = $(html);setActiveCurrencyListItem($html);$html.find('.currency-list').on('click.multi_currencies', 'a', function( event ) {event.preventDefault();if ( !isDefaultCurrency() ) {that.isChangedCurrency = true;} else {that.isChangedCurrency = false;}
that.setActiveCurrency($(this).parent().data('value'));$(document).trigger('pageLoaded.multi_currencies');modulesExtraActions();setMenuIconCurrency($menuIcon);$menuIcon.popover('hide');setActiveCurrencyListItem($html);$(document).trigger('multi_currency_update',[that.activeCurrency]);});S123.popOver.init({$el: $menuIcon,elSelector: '.multi-currencies-controller',namespace: 'multi_currency_menu_icon',oneTimeUsage: false,popOverSettings: {selector: 'multi-currency',content: $html,html: true,trigger: 'manual',template: '<div class="popover multi-currency" role="tooltip"><div class="arrow"></div><div data-menu-dismiss="popover"><i class="fa fa-times" aria-hidden="true"></i></div><div class="popover-content"></div></div>',placementCallBack: function() {if ( isMobileMenu ) return 'top';if ( getWebsiteMenuPosition() === 'top' || getWebsiteMenuPosition() === 'bottom' ) {if ( ($('nav#mainNav').offset().top - $(window).scrollTop()) > maxHeight ) {return 'top';} else {return 'bottom';}} else {if ( $('html').attr('dir') === 'rtl' ) {return 'left';} else {return 'right';}}}}});$(document).on('s123_pop_over_wrapper.show.multi_currency_menu_icon', function() {$menuIcon.addClass('active');})
.on('s123_pop_over_wrapper.hide.multi_currency_menu_icon', function() {$menuIcon.removeClass('active');});$menuIcon.off('click.multi_currencies').on('click.multi_currencies', function() {if ( $(this).hasClass('active') ) {$(this).popover('hide');} else {$(this).popover('show');}});}
function setActiveCurrencyListItem( $currencyList ) {$currencyList.find('.currency-list-item').removeClass('active');$currencyList.find('.currency-list-item[data-value="'+that.activeCurrency.currency+'"]').addClass('active');}
function setMenuIconCurrency( $menuIcon ) {var html = '';if ( $menuIcon.data('is-mobile') ) {html += '<span>' + that.activeCurrency.currency + '</span>';} else {html += '<span>' + that.activeCurrency.currency + '</span>';html += '<span class="m-c-symbol">' + that.activeCurrency.data.symbol + '</span>';if ( getWebsiteMenuPosition() === 'top' || getWebsiteMenuPosition() === 'bottom' ) {html += S123.s123IconToSvg.getHtml('caret-down','mc-icon','');} else {if ( $('html').attr('dir') === 'rtl' ) {html += S123.s123IconToSvg.getHtml('caret-left','mc-icon','');} else {html += S123.s123IconToSvg.getHtml('caret-right','mc-icon','');}}}
$menuIcon.html(html);}
function updateAllPrices() {if ( isDefaultCurrency() && that.isChangedCurrency ) {that.reset();} else if ( isDefaultCurrency() && !that.isChangedCurrency  ) {$('[data-rel="multiCurrency"]').css({visibility: 'visible'});} else {$('[data-rel="multiCurrency"]').each(function( index, el ) {updatePrice($(this),$(this).find('[data-type="price"]').html(),false);});}
$('[data-multi-currency-symbol-only="true"]').html(that.activeCurrency.data.symbol);that.priceOnlyType.update();}
function updatePrice( $el, newPrice, force ) {backUpPrice($el.find('[data-type="price"]'),newPrice,force);if ( isReplaceDisabled() ) {$el.css({visibility: 'visible'});} else {var $price = $el.find('[data-type="price"]');var priceAsString = $price.data(that.nameSpace + '-price');var price = parseFloat(priceAsString);var $newEl = $(showPrice(that.activeCurrency.data,(price * parseFloat(that.activeCurrency.rate)).toFixed(2)));backUpPrice($newEl.find('[data-type="price"]'),priceAsString,false);$price.parent().replaceWith($newEl);$newEl.css({visibility: 'visible'});}}
function backUpPrice( $el, newPrice, force ) {if ( !that.isActive ) return;if ( !$el.data(that.nameSpace + '-price') || force ) {$el.data(that.nameSpace + '-price',newPrice);}}
function modulesExtraActions() {$(document).off('donate_price_update.multi_currencies giftCard_price_update.multi_currencies').on('donate_price_update.multi_currencies giftCard_price_update.multi_currencies', function( event, $el ) {if ( isDefaultCurrency() ) return;var price = $el.val();price = parseFloat(price) * parseFloat(that.activeCurrency.rate);$el.val(price.toFixed(2));});}
function isDefaultCurrency() {return that.defaultCurrency.currency === that.activeCurrency.currency;}
function isReplaceDisabled() {if ( getOrderScreen() > 1 ) {return true;} else if ( window.czIsLoggedIn ) {return true;} else {return false;}
return false;}
function getOrderScreen() {var path = window.location.pathname.split("/");var orderScreen = path[path.length - 2];if ( orderScreen == '-order1' ) return 1;if ( orderScreen == '-order2' ) return 2;if ( orderScreen == '-order3' ) return 3;return 0;}
that.priceOnlyType = {backup: function() {$('[data-multi-currency-price-only="true"]').each(function( index, el ) {if ( $.isNumeric($(this).data(that.nameSpace + '-price')) ) return;$(this).data(that.nameSpace + '-price',$(this).html());});},update: function() {$('[data-multi-currency-price-only="true"]').each(function( index, el ) {var originalPrice = $(this).data(that.nameSpace + '-price');var newPrice = parseFloat(originalPrice) * parseFloat(that.activeCurrency.rate);if ( newPrice % 1 === 0 ) {$(this).html(newPrice);} else {$(this).html(newPrice.toFixed(2));}});}};return that;}();var ActiveOrderPopup = function() {AO = {};AO.init = function() {$( document ).on( 's123.page.ready.activeOrderPopup', function( event ) {AO.initializeAddToCart();AO.productCallToAction.init();AO.initializeShowCart();});};AO.initializeAddToCart = function() {$('.orderButtonPopup').off('click').on('click', function( event ) {var $this = $(this);if ( $this.hasClass('a-o-out-of-stock') ) {bootbox.dialog({title: translations.activeOrderPopup.messageTitle,message: translations.activeOrderPopup.messageBody,buttons: {cancel: {label: translations.Ok,className: 'btn btn-primary'}}});return;}
if ( $this.data('disable-atc-validator') != '1' ) {if ( !AO.atcValidator() ) return;}
$this.attr('disabled','');S123.ButtonLoading.start($this);var multiProducts = $this.data('multi-products') ? $this.data('multi-products') : JSON.stringify([$this.data('unique-page')]);var formData = new FormData();formData.append('w',$('#w').val());formData.append('websiteID',$('#websiteID').val());formData.append('moduleID',$this.data('module'));if ( $this.data('product-page') ) {if ( $('#productOptions').prop('type') == 'textarea' ) {formData.append('productOptions',$('#productOptions').length !== 0 ? $('#productOptions').html() : '');} else {formData.append('productOptions',$('#productOptions').length !== 0 ? $('#productOptions').val() : '');}
formData.append('customText',$('#customText').length !== 0 ? $('#customText').html() : '');}
formData.append('amount',$this.data('quantity-amount') ? $this.data('quantity-amount') : '1');formData.append('multiProducts',multiProducts);formData.append('viewModeTXT',viewModeTXT);$('input[type="file"]').each(function( index, upload ) {if ( upload.files.length > 0 ) {formData.append(upload.id,upload.files[0]);}});if ( $('.product-subscription-pricing').length !== 0 ) {let checkedPricing = $('.product-subscription-pricing').find('input[type="radio"]:checked');if ( checkedPricing.length == 0 ) {$('.product-subscription-error').remove();$('.product-subscription-title').append(`<div class="product-subscription-error">${translations.productSubscriptionError}</div>`);S123.ButtonLoading.stop($this);$this.removeAttr('disabled');return;}
formData.append('subscriptionTicketID',checkedPricing.val());formData.append('activeProductSubscription',true);}
$.ajax({type: "POST",url: "/versions/2/wizard/orders/front/addToCart.php",data: formData,cache: false,contentType: false,processData: false,success: function( response ) {response = tryParseJSON(response);showCart_GetContent('/versions/2/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&tranW='+websiteLanguageCountryFullCode+'&moduleID='+$this.data('module')+'&viewModeTXT='+viewModeTXT,true);CartCounter.updateCartIcon();S123.ButtonLoading.stop($this);$this.removeAttr('disabled');topWindow.eCommerce_cart_lastAdded = response.updatedCartIds ? response.updatedCartIds : false;}});});};AO.initializeShowCart = function() {$('.orderOpenCart').off('click').on('click',function( event ) {AO.showCart();});};AO.showCart = function() {showCart_GetContent('/versions/2/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&moduleTypeNUM=37&tranW='+websiteLanguageCountryFullCode+'&cartButton=1',true);};AO.atcValidator = function() {var $ct = $("#product-custom-text");var $po = $('.product-options');if ( $ct.length !== 0 && $ct.data('mandatory') ) {var $ct_fieldTitle = $('#ct_fieldTitle');if ( $ct_fieldTitle.val().length === 0 ) {$ct_fieldTitle.popover({container: 'body',content: translations.productvalidatorPopover,trigger: 'manual',template: '<div class="popover product-validator-popover" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>',placement: function(popover, input) {return isMobileDevice.any() ? 'auto' : ($('html').attr('dir') === 'rtl' ? 'left' : 'right');}});$ct_fieldTitle.popover('show').one('input', function(e) {$(this).popover('hide');});$ct_fieldTitle.focus();return false;}}
if ( $po.length !== 0 ) {var $options = $po.find('.p-o-container[data-mandatory="1"]');var addToCart = true;var $popoverContainer;var $firstErrorOption;var $errorsOptionsList = [];$.each($options, function( index, option ) {var $option = $(option);var addErrorMsg = false;switch( $option.data('type') ) {case 'color':case 'radio':case 'checkbox':case 'size':case 'list':if ( $option.find('[id*=poi].selected').length === 0 ) {addToCart = false;addErrorMsg = true;}
$popoverContainer = $(option);break;default:if ( $option.find('.fake-input').length > 0 ) {var id = $option.find('.fake-input').data('related-id');if ( $option.find('[data-id="'+id+'"]').val().length === 0 ) {addToCart = false;addErrorMsg = true;$popoverContainer = $(option).parent();}} else {if ( $option.find('.form-control').val().length === 0 ) {addToCart = false;addErrorMsg = true;$popoverContainer = $(option).parent();}}}
if ( addErrorMsg ) {$errorsOptionsList.push($option);var $popover = $option.find('.p-o-popover-box');if ( $popover.length === 0  ) $popover = $option;$popover.popover({container: 'body',content: translations.productvalidatorPopover,trigger: 'manual',template: '<div class="popover product-validator-popover" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>',placement: function(popover, input) {let isSmallDeviceWidthBOO = findBootstrapEnvironment() === 'xs';return isSmallDeviceWidthBOO ? 'auto' : ($('html').attr('dir') === 'rtl' ? 'right' : 'left');}});}});if ( $errorsOptionsList.length !== 0 ) {var offset = $('#mainNav').outerHeight();if ( !$.isNumeric(offset) ) offset = 0;if ( !elementInViewport($errorsOptionsList[0].get(0)) ) {$('html, body').scrollTop($errorsOptionsList[0].offset().top - offset);}
$.each($errorsOptionsList, function( index, $option ) {var $popover = $option.find('.p-o-popover-box');if ( $popover.length === 0  ) $popover = $option;$popover.popover('show');});$po.off('po.update').on('po.update', function( event ) {$('.product-validator-popover').popover('hide');});}
return addToCart;}
return true;};AO.productCallToAction = function() {var _ = {};_.init = function( settings ) {_.$controllers = $('.orderButtonPopup[data-p-c-t-a]');if ( _.$controllers.length == 0 ) return;_.$controllers.each(function() {var $this = $(this);var callToAction = $this.data('p-c-t-a');if ( callToAction.type == 'externalLink' && callToAction.externalLink.length > 0 ) {$this.off('click').on('click', function( event ) {window.open(callToAction.externalLink,'_blank');});} else if ( callToAction.type == 'contactUs' ) {$this.off('click').on('click', function( event ) {buildPopup('popupFloatDivSearch','',generateContactForm(callToAction),'',true,true,true,'right','')
S123.globalContactEmail.submitHandler();fillDescription(callToAction);});}});};function generateContactForm( callToAction ) {var html = '';html += '<div class="global-contact-email-container">';html += '<div class="g-c-email-info-box">';html += '<h3>'+translations.productCallToAction.title+'</h3>';html += '<p>'+translations.productCallToAction.infoBox+'</p>';html += '</div>';html += '<form class="g-c-email-form">';html += '<div class="row">';html += '<div class="col-xs-12">';html += '<div class="form-group">';html += '<label for="emailForm_fullName" class="white">'+translations.productCallToAction.fullName+'</label>';html += '<input type="text" name="emailForm_fullName" placeholder="'+translations.productCallToAction.fullName+'" class="form-control" required data-msg-required="'+translations.jqueryValidMsgRequire+'">';html += '</div>';html += '</div>';html += '<div class="col-xs-12">';html += '<div class="form-group">';html += '<label for="emailForm_email" class="white">'+translations.emailAddress+'</label>';html += '<input type="text" name="emailForm_email" placeholder="'+translations.emailAddress+'" class="form-control" required data-msg-required="'+translations.jqueryValidMsgRequire+'" data-rule-email="true" data-msg-email="'+translations.jqueryValidMsgEmail+'">';html += '</div>';html += '</div>';html += '<div class="col-xs-12">';html += '<div class="form-group">';html += '<label for="emailForm_phone" class="white">'+translations.productCallToAction.phone+'</label>';html += '<input type="text" name="emailForm_phone" placeholder="'+translations.productCallToAction.phone+'" class="form-control">';html += '</div>';html += '</div>';html += '</div>';html += '<div class="row">';html += '<div class="col-xs-12">';html += '<button type="submit" class="btn btn-primary btn-block">'+translations.send+'</button>';html += '<input type="hidden" name="websiteID" value="'+$('#websiteID').val()+'">';html += '<input type="hidden" name="w" value="'+$('#w').val()+'">';html += '<input type="hidden" name="isAddToCartBtn" value="1">';html += '<input type="hidden" name="recaptchaToken" value="">';html += '<textarea class="form-control hidden" name="emailForm_description"></textarea>';html += '</div>';html += '</div>';html += '</form>';html +='<div class="g-c-email-message-sent-box">';html += '<div class="row">';html += '<div class="col-sm-6 col-xs-12 col-md-offset-3">';html += '<h3 class="g-c-email-message-content">'+translations.productCallToAction.thankYouMessage+'</h3>';html += '</div>';html += '</div>';html += '<div class="row">';html += '<div class="col-sm-6 col-xs-12 col-md-offset-3">';html += '<button type="button" class="btn btn-primary close-order-thank-you">'+translations.productCallToAction.thankYouCloseBtn+'</button>';html += '</div>';html += '</div>';html += '</div>';html += '</div>';return html;}
function fillDescription( callToAction ) {var pageURL = window.location.protocol+'//'+domain+callToAction.pageURL;
var html = '';html += '<br>';html += '<strong>'+translations.productCallToAction.productName+'<strong> ';html += '<a href="'+pageURL+'" target="_blank">'+callToAction.title+'</a>';$('#popupFloatDivSearch [name="emailForm_description"]').val(html);}
return _;}();return AO;}();var WishList = function() {var WL = {};WL.init = function( settings ) {$( document ).on( 's123.page.ready.wish_list', function( event ) {WL.websiteID = $('#websiteID').val();WL.$menuButton = $('.wishListActionButton');if ( WL.$menuButton.length === 0 ) return;WL.eventRecurring();WL.initilizeMenuButton();WL.initializeLayoutButtons();WL.initializeDataPageButtons();});};WL.markUnMarkIcons = function() {var $container = $('.s123-module-eCommerce');var $items = $container.find('.product-data-obj');var $icons = $items.find('.wish-list-btn');WL.items = tryParseJSON($.cookie(WL.websiteID+'-wishList'));if ( !WL.items || $container.length === 0 ) return;$icons.removeClass('wl-active');$.each(WL.items, function( index, item ) {$items.filter('.product-data-obj[data-unique-id="'+item.uniqueID+'"]').find('.wish-list-btn').addClass('wl-active');});if ( $container.hasClass('s123-page-data-eCommerce') ) {WL.setToolTip($container);}};WL.setToolTip = function( $container ) {var $wishListBtn = $container.find('.wish-list-btn');$wishListBtn.attr('data-original-title',$wishListBtn.data('add-tooltip'));$wishListBtn.filter('.wl-active').attr('data-original-title',$wishListBtn.data('remove-tooltip'));$wishListBtn.tooltip({container: 'body',placement: 'auto'});};WL.eventRecurring = function() {WL.markUnMarkIcons();WL.updateCounterIcon();};WL.refresh = function() {WL.eventRecurring();};WL.initilizeMenuButton = function() {if ( WL.$menuButton.length === 0 ) return;WL.$menuButton.off('click').on('click',function( event ) {var $this = $(this);showCart_GetContent('/versions/2/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&moduleTypeNUM=112&tranW='+websiteLanguageCountryFullCode+'&cartButton=1&wishList=true',true);});};WL.initializeLayoutButtons = function() {var $container = $('.s123-module-eCommerce:not(.s123-page-data-eCommerce)');if ( $container.length === 0 ) return;$container.find('.wish-list-btn').off('click.wishList').on('click.wishList',function( event ) {event.stopPropagation();var $this = $(this);var $wishListItem = $this.closest('.product-data-obj');if ( $this.hasClass('disabled') ) return false;if ( $this.hasClass('wl-active') ) {WL.removeItem($this,$wishListItem.data('module'),$wishListItem.data('module-type-num'),$wishListItem.data('unique-id'));} else {WL.addItem($this,$wishListItem.data('module'),$wishListItem.data('unique-id'));}});};WL.initializeDataPageButtons = function() {var $container = $('.s123-module-eCommerce.s123-page-data-eCommerce');if ( $container.length === 0 ) return;$container.find('.wish-list-btn').off('click.wishList').on('click.wishList', function( event ) {var $this = $(this);var $wishListItem = $this.closest('.product-data-obj');if ( $this.hasClass('disabled') ) return false;if ( $this.hasClass('wl-active') ) {WL.removeItem($this,$wishListItem.data('module'),$wishListItem.data('module-type-num'),$wishListItem.data('unique-id'));} else {WL.addItem($this,$wishListItem.data('module'),$wishListItem.data('unique-id'));}});};WL.addItem = function( $item , moduleID, uniqueID ) {$item.addClass('disabled');$.ajax({type: "POST",url: "/versions/2/wizard/orders/front/addToCart.php",data:  {w: $('#w').val(),websiteID: WL.websiteID,moduleID: moduleID,wishList: true,multiProducts: JSON.stringify(Array(uniqueID)),viewModeTXT: viewModeTXT,},success: function( response ) {response = tryParseJSON(response);showCart_GetContent('/versions/2/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&tranW='+websiteLanguageCountryFullCode+'&moduleID='+moduleID+'&wishList=true',true);WishList.eventRecurring();$item.removeClass('disabled');topWindow.eCommerce_cart_lastAdded = response.updatedCartIds ? response.updatedCartIds : false;}});};WL.removeItem = function( $item, moduleID, moduleTypeNUM, uniqueID ) {$item.addClass('disabled');$.ajax({type: "POST",url: "/versions/2/wizard/orders/front/removeCartItem.php",data: {w: $('#w').val(),websiteID: WL.websiteID,moduleID: moduleID,id: WL.items[uniqueID].id,uniqueID: uniqueID,wishList: true,cartType: moduleTypeNUM,tranW: websiteLanguageCountryFullCode},success: function( response ) {var response = JSON.parse(response);if ( !response.success ) return;WishList.eventRecurring();$item.removeClass('disabled');topWindow.eCommerce_cart_lastAdded = response.updatedCartIds ? response.updatedCartIds : false;}});};WL.updateCounterIcon = function() {var $headerWishListWrapper = $('.header-wish-list');if ( $headerWishListWrapper.length === 0 ) return;var itemsNumber = WL.items ? Object.keys(WL.items).length : 0 ;if ( parseInt(itemsNumber) === 0 ) {if ( !$headerWishListWrapper.hasClass('show-static') ) {$headerWishListWrapper.hide();ResetMoreButton();}
$headerWishListWrapper.find('.count').hide();} else {if ( !$headerWishListWrapper.hasClass('show-static') ) {$headerWishListWrapper.show();ResetMoreButton();}
$headerWishListWrapper.find('.count').html(itemsNumber).css({ display: 'flex' });}};return WL;}();var ShowCartMobileHandler = function() {var _ = {};_.step1 = function( settings ) {$(document).one('buildSmallPopup.open',function() {$('body').addClass('popupWinScroll');});$(document).one('buildSmallPopup.close',function() {$('body').removeClass('popupWinScroll');if ( window.visualViewport ) {$(window.visualViewport).off('resize.cartMobile scroll.cartMobile');}
$(window).off('resize.cartMobile');});};_.step2 = function() {if ( !isMobileDevice.any() ) return;const updateQuickCartHeight = () => {const quickCart = $('.quickCart');if ( !quickCart.length ) return;const visibleHeight = window.visualViewport?.height || window.innerHeight;quickCart.height(visibleHeight);};const handleViewportChange = () => {clearTimeout(window.updateQuickCartTimeout);window.updateQuickCartTimeout = setTimeout(updateQuickCartHeight,100);};if ( window.visualViewport ) {$(window.visualViewport).on('resize.cartMobile scroll.cartMobile',handleViewportChange);}
$(window).on('resize.cartMobile',handleViewportChange);updateQuickCartHeight();};return _;}();function showCart_GetContent( url, bsp ) {var window_object = S123.isWebsiteInSlidingWindow ? parent : window;var b_s_p = window_object.buildSmallPopup;ShowCartMobileHandler.step1();$.ajax({type: "GET",url: url,success: function( response ) {if ( bsp ) {b_s_p('popupCart',translations.cart,response,'',true,false,true,'');} else {$('#popupCart .content').html(response);}
showCart(window_object);}});}
function showCart( current_window ) {var $cartOrderPage = current_window.$('#popupCart').find('.content');init();function init() {eventRecurring();if ( $.isArray(topWindow.eCommerce_cart_lastAdded) ) {$.each(topWindow.eCommerce_cart_lastAdded, function( index, cart_id ) {$cartOrderPage.find('[data-cart-id="'+cart_id+'"]').addClass('last-added-highlight');});topWindow.eCommerce_cart_lastAdded = false;}}
function eventRecurring() {current_window.CartCounter.updateCartIcon();var aop_settings = tryParseJSON($cartOrderPage.find('#aopSettings').val());$cartOrderPage.height('auto');$cartOrderPage.find('.empty-cart-btn').off('click').on('click','a.empty-cart', function() {$.ajax({type: "GET",url: $(this).data('href')+'&wishList='+aop_settings.wishList,success: function( data ) {$cartOrderPage.closest('#popupCart .content').html(data);eventRecurring();showCart_UpdateCartWasChanged();}});});$cartOrderPage.find('.change-cart').on('click', function() {$.ajax({type: "GET",url: $(this).data('href'),success: function( data ) {$cartOrderPage.closest('#popupCart .content').html(data);eventRecurring();}});});$cartOrderPage.find('.continue-shopping-btn, .closeIcon').click(function() {current_window.buildSmallPopup_CloseAction('popupCart');});$cartOrderPage.find('.edit-quantity').on('click',function() {var $this = $(this);$cartOrderPage.find('#quantity_box_'+$this.data('product-id')+'').toggle();});$cartOrderPage.find('.edit-quantity-minus').on('click',function() {var $this = $(this);var $box = $cartOrderPage.find('#quantity_box_'+$this.data('product-id')+'');$box.find('.quantity_field').val(parseInt($box.find('.quantity_field').val())-1).trigger('input');updateAutomaticCouponMsg();});$cartOrderPage.find('.edit-quantity-plus').on('click',function() {var $this = $(this);var $box = $cartOrderPage.find('#quantity_box_'+$this.data('product-id')+'');$box.find('.quantity_field').val(parseInt($box.find('.quantity_field').val())+1).trigger('input');updateAutomaticCouponMsg();});function updateAutomaticCouponMsg() {$.ajax({type: 'POST',url: '/versions/' + $('#versionNUM').val() + '/wizard/orders/front/getAutomaticCouponMsg.php',data: {w: $('#w').val(),websiteID: $(websiteID).val(),total: $('#cartTotalPrice span[data-type="price"]').html(),cartType: $('.cartBottom').data('cart-type'),couponApplyTo: 'cartOrder',},success: function( response ) {$('.cart-automatic-coupon-container').html('').append(response);}});}
$cartOrderPage.find('.quantity_field').on('input', function() {var $input = $(this);if ( $input.val().length === 0 ) $input.val(1);if ( !$.isNumeric($input.val()) ) $input.val($input.val().replace(/[^0-9]/g,''));if ( $input.val() <= 0 ) $input.val(1);if ( parseInt($input.val()) > parseInt($input.data('inventory-limit')) ) {$input.val($input.data('inventory-limit'));showCart_QuantityPopover($cartOrderPage.find('[data-cart-id="'+$input.data('product-id')+'"]'),translations.productQuntityLimit.replace('{{units_limitation}}',$input.data('inventory-limit')));} else if ( parseInt($input.val()) > parseInt($input.data('maximum-purchase')) ) {$input.val($input.data('maximum-purchase'));showCart_QuantityPopover($cartOrderPage.find('[data-cart-id="'+$input.data('product-id')+'"]'),translations.productQuntityLimit.replace('{{units_limitation}}',$input.data('maximum-purchase')));} else if ( parseInt($input.val()) < parseInt($input.data('minimum-purchase')) ) {$input.val($input.data('minimum-purchase'));showCart_QuantityPopover($cartOrderPage.find('[data-cart-id="'+$input.data('product-id')+'"]'),translations.productQuntityLimitMin.replace('{{units_limitation}}',$input.data('minimum-purchase')));}
showCart_UpdateQuantityTotalPrice();clearTimeout(window.quantityInputFinished);window.quantityInputFinished = setTimeout( function() {$cartOrderPage.find('#q_u_loading_'+$input.data('product-id')).show();$.ajax({type: 'POST',url: '/versions/' + aop_settings.versionNUM + '/wizard/orders/front/quantityUpdate.php',data: {w: aop_settings.w,websiteID: aop_settings.websiteID,tranW: aop_settings.tranW,moduleID: aop_settings.moduleID,cartType: aop_settings.cartType,id: $input.data('product-id'),newQuantity: $input.val()},success: function( response ) {var response = JSON.parse(response);if ( response.success ) {$cartOrderPage.find('#q_u_loading_'+$input.data('product-id')).hide();current_window.CartCounter.updateCartIcon();showCart_UpdateCartWasChanged();}}});},300);});$cartOrderPage.find('.remove-product-btn').off('click').on('click', function() {var $this = $(this);$this.parent().children().hide();$this.parent().append('<div class="loading-primary r-p-loading" class="text-center">'+S123.s123IconToSvg.getHtml('spinner','fa-spin','')+'</div>');$.ajax({type: 'POST',url: '/versions/' + aop_settings.versionNUM + '/wizard/orders/front/removeCartItem.php',data: {id: $this.data('product-id'),uniqueID: $this.closest('.item').get(0).id,w: aop_settings.w,websiteID: aop_settings.websiteID,tranW: aop_settings.tranW,moduleID: aop_settings.moduleID,cartType: aop_settings.cartType,wishList: aop_settings.wishList},success: function( response ) {var response = tryParseJSON(response);if ( response.success ) {if ( $this.closest('.item').siblings().not('.mix-modules-products-buttons').length == 0 ) {$cartOrderPage.find('.cart-list-container').hide();$cartOrderPage.find('.empty-cart-container').show();}
$this.closest('.item').fadeOut(300,function() {$this.closest('.item').remove();showCart_UpdateQuantityTotalPrice();if ( aop_settings.wishList ) {WishList.markUnMarkIcons();WishList.updateCounterIcon();}
showCart_UpdateCartWasChanged();updateAutomaticCouponMsg();});} else {$cartOrderPage.find('.r-p-loading').remove();$this.show();showCart_UpdateQuantityTotalPrice();}
current_window.CartCounter.updateCartIcon();},error: function(data) {$cartOrderPage.find('.r-p-loading').remove();$this.show();}});});$cartOrderPage.find('#couponWebsite').validate({errorElement: 'div',errorClass: 'help-block',focusInvalid: true,ignore: ":hidden",highlight: function (e) {$(e).closest('.form-group').removeClass('has-info').addClass('has-error');},success: function (e) {$(e).closest('.form-group').removeClass('has-error');$(e).remove();},errorPlacement: function (error, element) {if( element.is('input[type=checkbox]') || element.is('input[type=radio]') ) {var controls = element.closest('div[class*="col-"]');if( controls.find(':checkbox,:radio').length > 1 ) controls.append(error);else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));}
else if( element.is('.select2') ) {error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));}
else if( element.is('.chosen-select') ) {error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));}
else {error.appendTo(element.closest('.form-group'));}},submitHandler: function( form ) {$(form).find('button:submit').prop('disabled', true);return true;}});ShowCartMobileHandler.step2();if ( aop_settings.foodDeliveryCart ) {foodDeliveryEditProductEvent($cartOrderPage);}
if ( $('html.onlyContent123').length > 0 ) {window.parent.$(window.parent.document).trigger('pageLoaded');} else {$(document).trigger('pageLoaded');}
if ( window.location.pathname == '/-order1/' ) {$(document).off('order1.reload').on('order1.reload', function(){if ( typeof window.isCartWasChanged != 'undefined' ) {delete window.isCartWasChanged;window.location.reload();}});}}
function showCart_QuantityPopover( $input, message ) {$input.popover({container: $cartOrderPage,content: message,trigger: 'manual',template: '<div class="popover cart-validator-popover" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>',placement: function(popover, input) {return isMobileDevice.any() ? 'auto' : 'bottom';}});$input.popover('show');clearTimeout($input.data('q-p-timeout'));$input.data('q-p-timeout',setTimeout(function(){$input.popover('destroy');},3000));}
function showCart_UpdateQuantityTotalPrice() {var cartTotal = 0.00;$cartOrderPage.find('.quantity_field').each(function() {var $quantityInput = $(this);var $info            = $quantityInput.closest('.cart-product-info');var $priceBox        = $info.find('.cart-product-price');var $price           = $info.find('.cart-product-price [data-type="price"]');var $quantityPrice   = $info.find('.quantity-total-price');var $fullPrice           = $info.find('.cart-product-full-price [data-type="price"]');var $quantityFullPrice   = $info.find('.quantity-total-full-price');var total = (parseFloat($price.closest('[data-price]').data('price')) * parseInt($quantityInput.val()));var totalFullPrice = (parseFloat($fullPrice.closest('[data-price]').data('price')) * parseInt($quantityInput.val()));cartTotal += parseFloat(total);$quantityPrice.find('.main_price [data-type="price"]').html(total.toFixed(2));$quantityFullPrice.find('.main_price [data-type="price"]').html(totalFullPrice.toFixed(2));if (parseInt($quantityInput.val()) > 1) {$quantityPrice.show();$priceBox.hide();} else {$quantityPrice.hide();$priceBox.show();}
$info.find('.cart-product-quantity .qty_count').html($quantityInput.val());$(document).trigger('multi_currencies_price_update',[[{el: $quantityPrice.find('.main_price'),newPrice: total.toFixed(2)}]]);});$cartOrderPage.find('#cartTotalPrice [data-type="price"]').html(cartTotal.toFixed(2));$(document).trigger('multi_currencies_price_update',[[{el: $cartOrderPage.find('#cartTotalPrice'),newPrice: cartTotal.toFixed(2)}]]);}
function showCart_UpdateCartWasChanged() {window.isCartWasChanged = window.location.pathname == '/-order1/';}}
var StaffMembersHelpers = function() {var _ = {};_.getStaffSettings = function( $booking, item_tool_staff_id, settingTXT ) {let $staffMembersContainerOBJ = $booking.find('.staff-members-container');let staffMemberSettingsARR = tryParseJSON($staffMembersContainerOBJ.find('#staffMemberSettings_'+item_tool_staff_id).text());if ( !staffMemberSettingsARR ) {staffMemberSettingsARR = {businessHours: getBusinessHoursStructureJSON(),availability: 'unavailable'};}
if ( !settingTXT ) {return staffMemberSettingsARR;} else {if ( settingTXT == 'businessHours' && staffMemberSettingsARR.availability == 'unavailable' ) {return getBusinessHoursStructureJSON();}
return staffMemberSettingsARR[settingTXT];}
function getBusinessHoursStructureJSON() {return Array(7).fill().map((_, dayIndex) => {let day = {isActive: false,};for (let i = 0; i <= 2; i++) {day[`startTime${i}`] = '';day[`endTime${i}`] = '';}
return day;});}}
_.getBusiessHoursFromSessions = function ( input ) {const daysOfWeek = 7;const sessionsCount = Object.keys(input).length;const result = Array(daysOfWeek).fill().map(() => ({isActive: false,startTime0: "",endTime0: "",startTime1: "",endTime1: "",}));for ( let i = 2; i <= sessionsCount; i++ ) {result.forEach(day => {day[`startTime${i}`] = "";day[`endTime${i}`] = "";});}
Object.values(input).forEach(shift => {const dayIndex = shift.repeatDayNUM; // Adjust for 0-based index
const startDate = new Date(`${shift.startDateFUN} ${shift.startTimeFUN}`);const startHour = startDate.getHours();const startMinute = startDate.getMinutes();const durationHours = parseInt(shift.durationNUM);const endDate = new Date(startDate.getTime() + durationHours * 60 * 60 * 1000);const endHour = endDate.getHours();const endMinute = endDate.getMinutes();result[dayIndex].isActive = true;for (let i = 1; i <= sessionsCount; i++) {const startKey = `startTime${i}`;const endKey = `endTime${i}`;if (result[dayIndex][startKey] === "") {result[dayIndex][startKey] = `${startHour.toString().padStart(2, '0')}:${startMinute.toString().padStart(2, '0')}`;result[dayIndex][endKey] = `${endHour.toString().padStart(2, '0')}:${endMinute.toString().padStart(2, '0')}`;break;}}});return result;};_.mergeBusinessStaffHours = function ( staffMembers ) {if (staffMembers.length === 0) return [];let mergedHours = JSON.parse(JSON.stringify(staffMembers[0].businessHours));for (let i = 1; i < staffMembers.length; i++) {staffMembers[i].businessHours.forEach((day, dayNumber) => {if (!day.isActive) return;mergedHours[dayNumber].isActive = true;let shifts = [];for (let j = 1; j < 4; j++) {if (mergedHours[dayNumber][`startTime${j}`] && mergedHours[dayNumber][`endTime${j}`]) {shifts.push({start: mergedHours[dayNumber][`startTime${j}`],end: mergedHours[dayNumber][`endTime${j}`]});}
if (day[`startTime${j}`] && day[`endTime${j}`]) {shifts.push({start: day[`startTime${j}`],end: day[`endTime${j}`]});}}
shifts.sort((a, b) => a.start.localeCompare(b.start));let mergedShifts = [];for (let shift of shifts) {if (mergedShifts.length === 0 || shift.start > mergedShifts[mergedShifts.length - 1].end) {mergedShifts.push(shift);} else if (shift.end > mergedShifts[mergedShifts.length - 1].end) {mergedShifts[mergedShifts.length - 1].end = shift.end;}}
mergedShifts.forEach((shift, index) => {if (index < 3) {  // We only have startTime1 to startTime3
mergedHours[dayNumber][`startTime${index + 1}`] = shift.start;mergedHours[dayNumber][`endTime${index + 1}`] = shift.end;}});for (let j = mergedShifts.length + 1; j <= 3; j++) {mergedHours[dayNumber][`startTime${j}`] = "";mergedHours[dayNumber][`endTime${j}`] = "";}});}
return mergedHours;}
_.isStaffAvailable = function( $calendarWidget, item_tool_staff_id, staffMemberSettingsARR, chWidget ) {if ( staffMemberSettingsARR.availability === 'unavailable' ) return false;let selectedTimeOption = $calendarWidget.find('.service-hour option:selected');let availableStaff = JSON.parse(selectedTimeOption.attr('data-available-staff') || '[]');if ( !availableStaff.some(staff => staff.id === item_tool_staff_id && staff.remainingCapacity > 0) ) return false;const selectedDate = new Date(chWidget.getSelectedDate(true));let dayOfWeek = selectedDate.getDay();const daySchedule = staffMemberSettingsARR.businessHours[dayOfWeek];if ( !daySchedule.isActive ) return false;const selectedTime = _.convertToMinutes(chWidget.getSelectedHour());for (let i = 0; i < 4; i++) {const startKey = `startTime${i}`;const endKey = `endTime${i}`;if (daySchedule[startKey] && daySchedule[endKey]) {const startTime = _.convertToMinutes(daySchedule[startKey]);const endTime = _.convertToMinutes(daySchedule[endKey]);if (selectedTime >= startTime && selectedTime < endTime) {return true;}}}
return false;}
_.convertToMinutes = function( timeString ) {const [hours,minutes] = timeString.split(':').map(Number);return hours * 60 + minutes;}
_.selectRandomStaff = function(service, $booking, $calendarWidget) {let $staffMembersContainerOBJ = $booking.find('.staff-members-container');let selectedTimeOption = $calendarWidget.find('.service-hour option:selected');let availableStaff = JSON.parse(selectedTimeOption.attr('data-available-staff') || '[]');let availableStaffIds = availableStaff.map(staff => staff.id);let $availableStaffMemberCardsOBJ = $staffMembersContainerOBJ.find('.staff-member-card').filter(function() {let staffId = $(this).data('item-tool-staff-id');return availableStaffIds.includes(staffId);});if ($availableStaffMemberCardsOBJ.length === 0) return;let randomIndex = Math.floor(Math.random() * $availableStaffMemberCardsOBJ.length);let $randomStaffMemberCard = $availableStaffMemberCardsOBJ.eq(randomIndex);let item_tool_staff_id = $randomStaffMemberCard.data('item-tool-staff-id');$booking.find('[name="item_tool_staff_id"]').val(item_tool_staff_id);}
function tryParseJSON( str ) {try {var Obj = JSON.parse(str);if ( Obj && typeof Obj === "object" ) {return Obj;}} catch (e) {}
return false;}
return _;}();
// Booking Initialize
function bookingV2Init( $booking ) {if ( $booking.length === 0 ) return;googleMapPopUp.init({locationData : $booking.find('.mapPopupActivator'),mapsDisplayDomain : $GLOBALS["maps-display-domain"],longFreeCustomer : longFreeCustomer,language : languageCode});var rtl = $('html[dir=rtl]').length === 1;var $mainImage = $booking.find('.main-image > div');var $productOwlcarousel = $booking.find('.bookingOwlcarousel');$productOwlcarousel.owlCarousel({autoPlay: false,items : 4,margin: 10,stagePadding: 5,startPosition: 0,loop: false,center: false,nav: true,rtl: rtl,navText:  [S123.s123IconToSvg.getHtml('angle-'+(rtl ? 'right' : 'left'),'fa-2x'),S123.s123IconToSvg.getHtml('angle-'+(rtl ? 'left' : 'right'),'fa-2x')],dots: true});$productOwlcarousel.find('.item').click(function() {var $clickedImage = $(this).find('.item-image');setMainImageVideo($clickedImage);$mainImage.css({backgroundImage: $clickedImage.css('background-image')});});if ($productOwlcarousel.find('.item').length > 0) {$productOwlcarousel.find('.item').eq(0).trigger('click');}
let $bcWidgetGenerator = $booking.find('.bc-widget-generator');if ( $bcWidgetGenerator.hasClass('is-loading') ) return;$bcWidgetGenerator.addClass('is-loading');if ( $bcWidgetGenerator.length === 0 ) return;const schedulesOffset = {minDate: 10, // load 10 days before the selected date
maxDate: 180 // load 180 days of schedules from the selected date
};let data = {w: $('#w').val(),websiteID : $bcWidgetGenerator.data('website-id'),moduleTypeNUM : $bcWidgetGenerator.data('module-type-num'),moduleID : $bcWidgetGenerator.data('module-id'),uniqueID : $bcWidgetGenerator.data('unique-id'),serviceTimeInterval : $bcWidgetGenerator.data('service-time-interval'),selectedDate : dayjs(new Date()).subtract(schedulesOffset.minDate, 'days').format('YYYY-MM-DD HH:mm:ss'),lastDateOfMonth : dayjs(new Date()).add(schedulesOffset.maxDate, 'days').format('YYYY-MM-DD'),tranW : websiteLanguageCountryFullCode};const isReschedule = S123.QueryString.reschedule === '1';if ( isReschedule ) {data.reScheduleSettings = JSON.stringify({rescheduleBOO: isReschedule,orderID: S123.QueryString.orderID,eventID: S123.QueryString.eventID,clientEmail: S123.QueryString.clientEmail,participantUniqueID: S123.QueryString.participantUniqueID});}
$.ajax({type: 'GET',url: '/versions/2/wizard/modules/scheduleBookingV2/bookingWidget.php',data: data,success: function( response ) {response = tryParseJSON(response);$('.bc-widget-generator').replaceWith(response.html);bookingInitAfterWidgetLoad($booking,{orders: response.orders,userTime: response.userTime,sessions: response.sessions,serviceSettings: response.serviceSettings,resourceEvents: response.resourceEvents,lastDateOfMonth: data.lastDateOfMonth});}});function bookingInitAfterWidgetLoad( $booking, pageLoadSettings ) {var serviceType = $booking.find('.serviceType').val();var pricingTypeNUM = $booking.find('.pricingTypeNUM').val();var fixedPriceNUM = $booking.find('.fixedPriceNUM').val();var $bookingForm = $booking.find('.scheduleBookingForm');if ( $bookingForm.length == 0 ) return;var currentDate = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss');var currentHour = '';var currentDateWebsiteFormat = '';var settings = $booking.find('.ch-widget').data('settings');var moduleID = $bookingForm.find('[name="moduleID"]').val();var $calendarWidget = $booking.find('[data-id="ch-'+moduleID+'"]');if ( $calendarWidget.length == 0 ) return;if ( $calendarWidget.hasClass('s123-ready-handler') ) return;$calendarWidget.addClass('s123-ready-handler');var service = pageLoadSettings.serviceSettings;if ( serviceType === 'Course' ) {CourseSchedulesHelpers.widgetGenerator(moduleID,service,$booking,pageLoadSettings);} else {CalendarWidgetHandler(moduleID,service,$booking,$calendarWidget,pageLoadSettings);}
$bookingForm.off('submit').on('submit', function( event ) {let $this = $(this);$this.find('.btn-buy-now').addClass('disabled');var serviceOrdered = {};var price = $booking.find('.servicePrice').val();var pricing = $booking.find('.schedule-pricing-types input[name="schedule-pricing-types-'+moduleID+'"]:checked').val();if ( $booking.find('.productPrice').data('price') == 'Free' ) {price = 0;}
serviceOrdered.price = price;serviceOrdered.title = $booking.find('.serviceTitle').val();serviceOrdered.orderDate = currentDate;$booking.find('.scheduleBookingOrder').val(JSON.stringify(serviceOrdered));$booking.find('#scheduleBookingPricing').val(pricing);if ( service.staffOrderFlow == 'autoStaffByDate' ) {StaffMembersHelpers.selectRandomStaff(service,$booking,$calendarWidget);}
if ( viewModeTXT === 'clean' ) {const scheduleBookingEmbedWidgetOBJ = new WebsitesEmbedWidget({modalId: 'scheduleBookingModal_' + moduleID});scheduleBookingEmbedWidgetOBJ.openModal(this);event.preventDefault();}
if ( isReschedule ) {event.preventDefault();$.ajax({type: 'POST',url: '/versions/2/wizard/modules/scheduleBookingV2/clientZoneActions/reSchedule/reScheduleO.php',data: $this.serialize(),success: function( response ) {window.parent.postMessage({type: 'rescheduleComplete',response: tryParseJSON(response)}, '*');}});return false;}});function CalendarWidgetHandler( moduleID, service, $booking, $calendarWidget, pageLoadSettings ) {$booking.find('.c-h-note-container').addClass('hidden');$booking.find('.calendar-loading-container').addClass('hidden');if ( service.isServiceUnavailable ) {$booking.find('.c-h-note-container').removeClass('hidden');return;}
if ( service.staffOrderFlow === 'byStaff' ) {initChooseStaffFirst();} else if ( ['byStaffDateFirst','autoStaffByDate'].includes(service.staffOrderFlow) ) {initByDateFirst();} else {$booking.find('.c-h-note-container').removeClass('hidden');}
function calendarWidgetInit( moduleID, service, $booking, $calendarWidget, businessHoursOBJ, pageLoadSettings ) {var chWidget = new CalendarWidgetV2({maxShiftsAmount: 10,$moduleSelector: $booking,$rootContainer: $calendarWidget,$fakeInput: $calendarWidget.find('.fake-input.c-h-input'),$hiddenInput: $calendarWidget.find('.real-input.c-h-input'),$fakeInputIcon: $calendarWidget.find('.c-h-input-icon'),title: translations.chooseDate,moduleID: moduleID,moduleTypeNUM: 208,itemID: $booking.find('[name="itemID"]').val(),schedulesOffset: schedulesOffset,calendarSettings: {format: service.dateFormat,firstDayOfWeek: parseInt(service.firstDayOfWeek),todayBtn: "linked",clearBtn: false,language: $(document).find('html').attr('lang'),startDate: $calendarWidget.find('.clientTimeByZone').val(),todayHighlight: true,timeFormat: service.timeFormat,availability: service.availability,staffOrderFlow: service.staffOrderFlow,isServiceUnavailable: service.isServiceUnavailable,businessHours: businessHoursOBJ,courseObject: service.courseObject,resourceTypes: service.resourceTypes || [],item_tool_staff_id: $booking.find('[name="item_tool_staff_id"]').val()},hoursInputSettings: {$form: $bookingForm,maxParticipants: serviceType == 'Appointment' ? 1 : $booking.find('.maxParticipants').val(),timeInterval: service.serviceTimeInterval,pageLoadSettings: pageLoadSettings,onBeforeHoursLoad: function($hoursContainer) {if ($hoursContainer.length > 0) {$hoursContainer.find('.hours-loading-overlay, .hours-skeleton-container').remove();let $loadingOverlay = $('<div class="hours-loading-overlay" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(255,255,255,0.7); z-index: 10; display: flex; justify-content: center; align-items: center;"><div class="spinner">' + S123.s123IconToSvg.getHtml('spinner', 'fa-spin fa-2x') + '</div></div>');$hoursContainer.append($loadingOverlay);let $skeletonContainer = $('<div class="hours-skeleton-container" style="width: 100%;"></div>');for (let i = 0; i < 5; i++) {$skeletonContainer.append('<div class="skeleton-item" style="height: 20px; margin-bottom: 10px; background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite linear;"></div>');}
if ($('style#skeleton-animation').length === 0) {$('head').append('<style id="skeleton-animation">@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }</style>');}
$hoursContainer.append($skeletonContainer);$hoursContainer.find('.c-h-hours-container').css({'filter': 'blur(3px)','opacity': '0.5','pointer-events': 'none'});setTimeout(function() {$loadingOverlay.css('display', 'flex');}, 0);}},onHoursLoad: function(chWidget, $tableHour) {let $hoursContainer = $tableHour.closest('.c-h-hours-wrapper');if ($hoursContainer.length > 0) {setTimeout(function() {$hoursContainer.find('.hours-loading-overlay, .hours-skeleton-container').fadeOut(200, function() {$(this).remove();});$hoursContainer.find('.c-h-hours-container').css({'filter': 'none','opacity': '1','pointer-events': 'auto'});}, 300); // Short delay to ensure loading effect is visible
}
currentDate = chWidget.getSelectedDateTime();currentDateWebsiteFormat = chWidget.getSelectedDate(false);currentHour = chWidget.getSelectedHour();bookingMultiPricing(moduleID,currentHour,currentDateWebsiteFormat,serviceType,service.staffOrderFlow);$booking.find('.btn-buy-now').prop("disabled", true);$booking.find('.show-pricing-btn').prop("disabled", true);$booking.find('.show-staff-btn').prop("disabled", true);let $selectedOption = $tableHour.find('option:selected');if ($selectedOption.length > 0) {$booking.find('[name="selectedDuration"]').val($selectedOption.data('duration'));}},onHoursChage: function ( selectedHour, $selecteOption ) {currentDate = chWidget.getSelectedDateTime();currentDateWebsiteFormat = chWidget.getSelectedDate(false);currentHour = chWidget.getSelectedHour();bookingMultiPricing(moduleID,currentHour,currentDateWebsiteFormat,serviceType,service.staffOrderFlow);if ( selectedHour ) {$booking.find('.btn-buy-now').prop("disabled", false);$booking.find('.show-pricing-btn').prop("disabled", false);$booking.find('.show-staff-btn').prop("disabled", false);} else {$booking.find('.btn-buy-now').prop("disabled", true);$booking.find('.show-pricing-btn').prop("disabled", true);$booking.find('.show-staff-btn').prop("disabled", true);}
if ( serviceType == 'Classes' && service.availability == 'bySchedule' ) {$booking.find('[name="selectedEventID"]').val($selecteOption.data('related-schedules')[0].eventID);$booking.find('[name="scheduleSelectedDate"]').val($selecteOption.data('schedule-selected-date'));$booking.find('.duration-display-li').show();if ( parseInt($selecteOption.data('related-schedules')[0].duration) > 0 ) {$booking.find('.duration-display').text($selecteOption.data('related-schedules')[0].duration + ' ' + translations.scheduleBooking.durationPH2);} else {$booking.find('.duration-display').text($selecteOption.data('related-schedules')[0].duration + ' ' + translations.scheduleBooking.durationPM);}}}},onInit: function( instance ) {currentDate = instance.getSelectedDateTime();currentDateWebsiteFormat = instance.getSelectedDate(false);currentHour = instance.getSelectedHour();bookingMultiPricing(moduleID,currentHour,currentDateWebsiteFormat,serviceType,service.staffOrderFlow);$booking.find('.widget-datetime-container').show();if ( !instance.isUnAvalible() ) {$booking.find('.btn-buy-now').prop("disabled", true);$booking.find('.btn-buy-now').hide();$booking.find('.show-pricing-btn').hide();$booking.find('.show-staff-btn').hide();if ( $booking.find('.widget-pricing-container').length !== 0 ) {$booking.find('.show-pricing-btn').show();} else {$booking.find('.btn-buy-now').show();}
if ( ['byStaffDateFirst'].includes(service.staffOrderFlow) ) {$booking.find('.btn-buy-now').hide();$booking.find('.show-pricing-btn').hide();$booking.find('.show-staff-btn').show();$booking.find('.show-staff-btn').on('click', function( event ) {event.preventDefault();$booking.find('.widget-pricing-container .selected-date-summery-value').text(currentDateWebsiteFormat);$booking.find('.widget-pricing-container .selected-hour-summery-value').text(currentHour);let $staffMembersContainerOBJ = $booking.find('.staff-members-container');$booking.find('.calendar-container').fadeOut(200,function() {$staffMembersContainerOBJ.find('.staff-member-card').each(function() {let $staffMemberCardOBJ = $(this);let item_tool_staff_id = $staffMemberCardOBJ.data('item-tool-staff-id');let staffMemberSettingsARR = StaffMembersHelpers.getStaffSettings($booking,item_tool_staff_id,'');if ( StaffMembersHelpers.isStaffAvailable($calendarWidget,item_tool_staff_id,staffMemberSettingsARR,chWidget) ) {$staffMemberCardOBJ.removeClass('unavailable-staff');$staffMemberCardOBJ.removeClass('hidden');} else {$staffMemberCardOBJ.addClass('unavailable-staff');if ( service.staffUnavailableDisplay == 0 ) {$staffMemberCardOBJ.addClass('hidden');}}});$staffMembersContainerOBJ.fadeIn(200);$booking.find('[name="item_tool_staff_id"]').val('');});$booking.find('.select-staff-back-btn').show();});}}},onSubmit: function( formattedSelectedDate, selectedDate ) {$calendarWidget.find('.fake-input.c-h-input').html(formattedSelectedDate + ' (' + chWidget.getDateDayName(selectedDate) + ')');$calendarWidget.find('.real-input.c-h-input').val(formattedSelectedDate);currentDate = chWidget.getSelectedDateTime();currentDateWebsiteFormat = chWidget.getSelectedDate(false);currentHour = chWidget.getSelectedHour();bookingMultiPricing(moduleID,currentHour,currentDateWebsiteFormat,serviceType,service.staffOrderFlow);}});if ( chWidget.isUnAvalible() ) {chWidget.showUnavailableMsg();}
return chWidget;}
function initChooseStaffFirst() {let $staffMembersContainerOBJ = $booking.find('.staff-members-container');$staffMembersContainerOBJ.find('.staff-member-card').each(function() {let $staffMemberCardOBJ = $(this);let item_tool_staff_id = $staffMemberCardOBJ.data('item-tool-staff-id');let staffMemberSettingsARR = StaffMembersHelpers.getStaffSettings($booking,item_tool_staff_id,'');$staffMemberCardOBJ.removeClass('unavailable-staff');if ( staffMemberSettingsARR.service === 'unavailable' ) {$staffMemberCardOBJ.addClass('unavailable-staff');if ( service.staffUnavailableDisplay == 0 ) {$staffMemberCardOBJ.addClass('hidden');}} else {$staffMemberCardOBJ.on('click', function() {$booking.find('[name="item_tool_staff_id"]').val(item_tool_staff_id);chWidget = calendarWidgetInit(moduleID,service,$booking,$calendarWidget,staffMemberSettingsARR.businessHours,pageLoadSettings);$staffMembersContainerOBJ.fadeOut(200,function() {$booking.find('.select-staff-back-btn').show();$booking.find('.calendar-container').fadeIn(200);});});}});$booking.find('.select-staff-back-btn').off('click').on('click', function( event ) {event.preventDefault();$booking.find('.calendar-container').fadeOut(200,function() {$booking.find('.select-staff-back-btn').hide();$booking.find('.widget-datetime-container').show();$booking.find('.show-pricing-btn').hide();$booking.find('.btn-buy-now').hide();$staffMembersContainerOBJ.fadeIn(200);$booking.find('[name="item_tool_staff_id"]').val('');});});if ( $staffMembersContainerOBJ.find('.staff-member-card').length == $staffMembersContainerOBJ.find('.staff-member-card.hidden.unavailable-staff').length ) {$booking.find('.c-h-note-container').removeClass('hidden');} else {$staffMembersContainerOBJ.fadeIn(200);}}
function initByDateFirst() {let allStaffBusinessHoursARR = [];let $staffMembersContainerOBJ = $booking.find('.staff-members-container');$staffMembersContainerOBJ.find('.staff-member-card').each(function() {let $staffMemberCardOBJ = $(this);let item_tool_staff_id = $staffMemberCardOBJ.data('item-tool-staff-id');let staffBusinessHoursARR = StaffMembersHelpers.getStaffSettings($booking,item_tool_staff_id,'businessHours');allStaffBusinessHoursARR.push({id: item_tool_staff_id,businessHours: staffBusinessHoursARR});});let mergedStaffBusinessHoursARR = StaffMembersHelpers.mergeBusinessStaffHours(allStaffBusinessHoursARR);chWidget = calendarWidgetInit(moduleID,service,$booking,$calendarWidget,mergedStaffBusinessHoursARR,pageLoadSettings);$booking.find('.calendar-container').fadeIn(200);$staffMembersContainerOBJ.find('.staff-member-card').each(function() {let $staffMemberCardOBJ = $(this);$booking.find('.show-staff-btn').on('click', function() {if (!$(this).hasClass('disabled')) {$booking.find('.show-staff-btn').fadeOut(200, function() {$staffMembersContainerOBJ.fadeIn(200);});}});$staffMemberCardOBJ.on('click', function() {if ( $staffMemberCardOBJ.hasClass('unavailable-staff') ) return;let item_tool_staff_id = $staffMemberCardOBJ.data('item-tool-staff-id');if ( service.availability == 'bySchedule' ) {let $selecteOption = chWidget.HoursInput.$tableHour.find('option:selected');$selecteOption.data('related-schedules').forEach(function( relatedSchedule ) {if ( relatedSchedule.item_tool_staff_id == item_tool_staff_id ) {$booking.find('[name="selectedEventID"]').val(relatedSchedule.eventID);$booking.find('[name="scheduleSelectedDate"]').val($selecteOption.data('schedule-selected-date'));$booking.find('[name="item_tool_staff_id"]').val(relatedSchedule.item_tool_staff_id);return false;}});} else {$booking.find('[name="item_tool_staff_id"]').val(item_tool_staff_id);}
if ( $booking.find('.widget-pricing-container').length !== 0 ) {$staffMembersContainerOBJ.fadeOut(200,function() {$booking.find('.calendar-container').show();$booking.find('.widget-pricing-container').show();$booking.find('.widget-datetime-container').hide();$booking.find('.btn-buy-now').show();$booking.find('.show-pricing-btn').hide();$booking.find('.show-staff-btn').hide();$booking.find('.select-staff-back-btn').hide();$booking.find('.widget-pricing-container .widget-pricing-back-btn').one('click', function( event ) {event.preventDefault();let $staffMembersContainerOBJ = $booking.find('.staff-members-container');$booking.find('.widget-pricing-container').fadeOut(200,function() {$booking.find('.btn-buy-now').hide();$booking.find('.select-staff-back-btn').show();$staffMembersContainerOBJ.fadeIn(200);$booking.find('[name="item_tool_staff_id"]').val('');});});});} else {$staffMemberCardOBJ.addClass('selected-staff');$booking.find('.widget-datetime-container').hide();$booking.find('.calendar-container').show();$booking.find('.show-staff-btn').hide();$staffMemberCardOBJ.append('<div class="selected-staff-loading">'+S123.s123IconToSvg.getHtml('spinner','fa-spin fa-3x')+'</div>');$bookingForm.submit();}});});$booking.find('.select-staff-back-btn').off('click').on('click', function( event ) {event.preventDefault();let $staffMembersContainerOBJ = $booking.find('.staff-members-container');$staffMembersContainerOBJ.fadeOut(200,function() {$booking.find('.select-staff-back-btn').hide();$booking.find('.widget-datetime-container').show();$booking.find('.show-pricing-btn').hide();$booking.find('.show-staff-btn').show();$booking.find('.calendar-container').fadeIn(200);$booking.find('[name="item_tool_staff_id"]').val('');});});}}}
function bookingMultiPricing( moduleID, currentHour, currentDateWebsiteFormat, serviceType, staffOrderFlow ) {$booking.find('.schedule-pricing-types').find("input[name='schedule-pricing-types-"+moduleID+"']:eq(0)").prop("checked",true);$booking.find('.schedule-pricing-types .schedule-pricing-radio:first-child').addClass('checked');$booking.find('.schedule-pricing-types').find('.schedule-pricing-radio').on('click',function() {$booking.find('.schedule-pricing-types').find('.schedule-pricing-radio').removeClass('checked');$(this).addClass('checked');$(this).find('input[name="schedule-pricing-types-'+moduleID+'"]').prop("checked", true);});if ( $booking.find('.widget-pricing-container').length !== 0 ) {$booking.find('.show-pricing-btn').off('click').on('click', function( event ) {event.preventDefault();$booking.find('.widget-pricing-container .selected-date-summery-value').text(currentDateWebsiteFormat);$booking.find('.widget-pricing-container .selected-hour-summery-value').text(currentHour);$booking.find('.widget-pricing-container').show();$booking.find('.widget-datetime-container').hide();$booking.find('.btn-buy-now').show();$booking.find('.show-pricing-btn').hide();$booking.find('.select-staff-back-btn').hide();$booking.find('.course-container').hide();$booking.find('.widget-pricing-container .widget-pricing-back-btn').off('click').one('click', function( event ) {event.preventDefault();$booking.find('.widget-pricing-container').hide();$booking.find('.widget-datetime-container').show();$booking.find('.btn-buy-now').hide();$booking.find('.show-pricing-btn').show();if ( staffOrderFlow != 'autoStaffByDate' ) {$booking.find('.select-staff-back-btn').show();}
if ( serviceType == 'Course' ) {$booking.find('.course-container').show();$booking.find('.widget-pricing-container').hide();$booking.find('.btn-buy-now').hide();$booking.find('.select-staff-back-btn').hide();}});});}}
function setMainImageVideo( $clickedImage ) {if ( !$mainImage || $mainImage.length === 0 ) return;if ( !$clickedImage || $clickedImage.length === 0 ) return;$mainImage.empty();if ($clickedImage.data('media-type') == 'video' ) {$('<iframe data-player="site123" style="color:white;width:'+ $mainImage.width() +'px;height:'+ $mainImage.height() +'px" type="text/html" src="'+ '/include/globalVideoPlayer.php?websiteID='+$('#websiteID').val()+'&website_uniqueID='+$('#website_uniqueID').val()+'&cad=1&url=' + $clickedImage.data('video-path') + (isMobileDevice.any() ? '&autoplay=false': '&autoplay=true' ) +'" frameborder="0" allowfullscreen=""></iframe>').appendTo($mainImage);}}
var CourseSchedulesHelpers = function() {var _ = {};_.widgetGenerator = function( moduleID, service, $booking ) {let $courseContainerOBJ = $booking.find('.course-container');let $courseScheduleContainerOBJ = $courseContainerOBJ.find('.course-schedule-container');let $btnBuyNow = $booking.find('.btn-buy-now');let $btnShowPricing = $booking.find('.show-pricing-btn');let $bookingForm = $booking.find('.scheduleBookingForm');let itemID = $booking.find('[name="itemID"]').val();let courseScheduleOBJ = tryParseJSON($booking.find('#courseScheduleOBJ_'+itemID).text());$booking.find('[name="selectedEventID"]').val(service.courseObject.courseID);let schedulesARR = _.generateCourseSchedules($booking,courseScheduleOBJ);let html = `<div class="course-schedule-summary-container hidden">
${schedulesARR.length > 0 ? `
<span class="course-schedule-summary-date">${schedulesARR[0].date} - ${schedulesARR[schedulesARR.length - 1].date}</span>
<span class="course-schedule-summary-total-sessions">${schedulesARR.length} ${translations.scheduleBooking.totalSessions}</span>
<a href="javascript:void(0)" class="course-schedule-summary-show-full-list">${translations.scheduleBooking.showFullList}</a>
` : ``}
</div>`;$courseScheduleContainerOBJ.append(html);$courseScheduleContainerOBJ.fadeIn(200);$courseScheduleContainerOBJ.find('.course-schedule-summary-show-full-list')
.off('click.showCourseScheduleFullList')
.on('click.showCourseScheduleFullList',function() {_.showCourseScheduleFullList(schedulesARR);});$booking.find('.widget-pricing-container .selected-date-summery').hide();bookingMultiPricing(moduleID,'','','Course',service.staffOrderFlow);$btnBuyNow.on('click', function() {$bookingForm.submit();});if ( schedulesARR.length > 0 ) {_.getScheduledOrders(service,$booking,function( data ) {$booking.find('.calendar-loading-container').addClass('hidden');$booking.find('.course-schedule-summary-container').removeClass('hidden');let maxParticipants = $booking.find('.maxParticipants').val();if ( !$.isNumeric(maxParticipants) || parseInt(data.orders.length) < parseInt(maxParticipants) ) {if ( $booking.find('.widget-pricing-container').length !== 0 ) {$btnShowPricing.show();} else {$btnBuyNow.show();}} else {if ( $booking.find('.widget-pricing-container').length !== 0 ) {$btnShowPricing.attr('disabled','disabled').show();} else {$btnBuyNow.attr('disabled','disabled').show();}
$courseContainerOBJ.find('.course-full-message').fadeIn(200);}});} else {$booking.find('.calendar-loading-container').addClass('hidden');$booking.find('.course-schedule-summary-container').removeClass('hidden');$courseContainerOBJ.find('.no-sessions-message').fadeIn(200);if ( $booking.find('.widget-pricing-container').length !== 0 ) {$btnShowPricing.attr('disabled','disabled').show();} else {$btnBuyNow.attr('disabled','disabled').show();}}}
_.generateCourseSchedules = function( $booking, courseSchedulesOBJ ) {let schedulesARR = [];const dayNames = Object.values(translations.calendarHandler.daysShort);const monthNames = Object.values(translations.calendarHandler.monthsShort);const dayMap = {SU: 0, MO: 1, TU: 2, WE: 3, TH: 4, FR: 5, SA: 6};courseSchedulesOBJ.forEach(courseSchedule => {let startDate = new Date(courseSchedule.startDateFUN);const endDate = new Date(courseSchedule.endDateFUN);const rruleEndDate = courseSchedule.rrule_endDateFUN ? new Date(courseSchedule.rrule_endDateFUN) : endDate;const [startHours, startMinutes] = courseSchedule.startDateFUN.split(' ')[1].split(':').map(Number);const duration = (new Date(courseSchedule.endDateFUN) - new Date(courseSchedule.startDateFUN)) / (1000 * 60 * 60); // duration in hours
const staffMemberName = $booking.find('.staff-members-container')
.find('.staff-member-card[data-item-tool-staff-id="'+courseSchedule.staffMemberID+'"]')
.find('.staff-member-name').text();let repeatDays = [];let excludedDates = [];if (courseSchedule.rrule) {const rruleParts = courseSchedule.rrule.split(';');const bydayPart = rruleParts.find(part => part.startsWith('BYDAY='));if (bydayPart) {repeatDays = bydayPart.split('=')[1].split(',').map(day => dayMap[day]);}
excludedDates = courseSchedule.rrule ? courseSchedule.rrule.split(';').find(rule => rule.startsWith('EXDATE')) : [];excludedDates = excludedDates && excludedDates.length > 0 ? excludedDates.split('=')[1].split(',') : [];}
while (startDate <= rruleEndDate) {if (repeatDays.length === 0 || repeatDays.includes(startDate.getDay())) {const formattedDate = `${dayNames[startDate.getDay()]}, ${monthNames[startDate.getMonth()]} ${startDate.getDate()}, ${startDate.getFullYear()}`;const formattedTime = `${startHours.toString().padStart(2, '0')}:${startMinutes.toString().padStart(2, '0')}`;const localDateWithTime = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate(), startHours, startMinutes);const currentDateString = formatDateForExtDateOfRRule(localDateWithTime);if ( !excludedDates.includes(currentDateString) ) {schedulesARR.push({date: formattedDate,time: formattedTime,duration: `${duration} ${duration === 1 ? translations.scheduleBooking.durationPH : translations.scheduleBooking.durationPH2}`,staff: staffMemberName,sortDate: new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate(), startHours, startMinutes)});}}
startDate.setDate(startDate.getDate() + 1);}});schedulesARR.sort((a, b) => a.sortDate - b.sortDate);schedulesARR.forEach(schedule => delete schedule.sortDate);return schedulesARR;function formatDateForExtDateOfRRule( localDate ) {const year = localDate.getUTCFullYear();const month = String(localDate.getUTCMonth() + 1).padStart(2, '0');const day = String(localDate.getUTCDate()).padStart(2, '0');const hours = String(localDate.getUTCHours()).padStart(2, '0');const minutes = String(localDate.getUTCMinutes()).padStart(2, '0');const seconds = String(localDate.getUTCSeconds()).padStart(2, '0');return `${year}${month}${day}T${hours}${minutes}${seconds}`;}};_.getScheduledOrders = function( service, $booking, callback ) {var $bookingForm = $booking.find('.scheduleBookingForm');$.ajax({url: '/versions/2/wizard/modules/scheduleBookingV2/get-scheduled-orders.php',method: 'post',data: $bookingForm.serialize()+'&cartType=208&serviceTimeInterval='+encodeURIComponent(service.serviceTimeInterval),})
.done(function( data ) {data = tryParseJSON(data);callback(data);});}
_.showCourseScheduleFullList = function( schedulesARR ) {let html = `<table class="table table-bordered">
<thead>
<tr>
<th>${translations.scheduleBooking.scheduleSessionDate}</th>
<th>${translations.scheduleBooking.scheduleTime}</th>
<th>${translations.scheduleBooking.duration}</th>
<th>${translations.scheduleBooking.scheduleStaff}</th>
</tr>
</thead>
<tbody>
${schedulesARR.map(schedule => `<tr>
<td>${schedule.date}</td>
<td>${schedule.time}</td>
<td>${schedule.duration}</td>
<td>${schedule.staff}</td>
</tr>`).join('')}
</tbody>
</table>`;var $modal = bootbox.dialog({title: translations.scheduleBooking.courseScheduleList,message: html,className: `s123-course-schedule-modal`,size: 'medium',closeButton: true,backdrop: true,onEscape: true,show: false});$modal.find('.modal-header').addClass('background-primary-color btn-primary-text-color');$modal.find('.modal-header .bootbox-close-button').addClass('btn-primary-text-color');$modal.modal('show');}
return _;}();}
jQuery(function($) {ScheduleBookingV2ModuleInitialize_Layout1();});function ScheduleBookingV2ModuleInitialize_Layout1() {$( document ).on( 's123.page.ready', function( event ) {var $sections = $('.s123-module-schedule-bookingV2.layout-1');$sections.each(function( index ) {var $s = $(this);var $categories = $s.find('.items-categories-container li');var $products = $s.find('.products-container > div');bookingV2Init($s);$categories.off('click').on('click',function ( event, initialize ) {var $category = $(this);$categories.removeClass('active');$category.addClass('active');var $filtered = $products.filter('[data-product-filter=' + $category.data('categories-filter') + ']');if ( initialize ) {$products.hide();$filtered.show();} else {$products.fadeOut(200).promise().done( function() {$filtered.fadeIn(200);$(window).trigger('scroll');});}
return false;});$categories.first().trigger('click',true);$s.find('.items-responsive-filter').click(function() {var $category = $(this);$s.find('.categories-panel').slideToggle('slow');$category.toggleClass('active');return false;});});});}
jQuery(function($) {ScheduleBookingV2ModuleInitialize_Layout2();});function ScheduleBookingV2ModuleInitialize_Layout2() {$( document ).on( 's123.page.ready', function( event ) {var $sections = $('.s123-module-schedule-bookingV2.layout-2');$sections.each(function( index ) {var $s = $(this);var $categories = $s.find('.items-categories-container li');var $products = $s.find('.products-container > div');bookingV2Init($s);$categories.off('click').on('click',function ( event, initialize ) {var $category = $(this);$categories.removeClass('active');$category.addClass('active');var $filtered = $products.filter('[data-product-filter=' + $category.data('categories-filter') + ']');if ( initialize ) {$products.hide();$filtered.show();} else {$products.fadeOut(200).promise().done( function() {$filtered.fadeIn(200);$(window).trigger('scroll');});}
return false;});$categories.first().trigger('click',true);$s.find('.items-responsive-filter').off('click').on('click', function() {var $category = $(this);$s.find('.categories-panel').slideToggle('slow');$category.toggleClass('active');return false;});});});}
