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 $categoryItems = $sectionThis.find('.services-category-block');if ( $categoryItems.length === 0 ) $categoryItems = $sectionThis.find('.services-category');var sectionContext = $sectionThis.find('.services-category-block').first().data('context') || 'modulepage';$sectionThis.data('servicesContext', sectionContext);$sectionThis.off('module_layout_categories.shown.servicesInfiniteScroll')
.on('module_layout_categories.shown.servicesInfiniteScroll', function( event, filter ) {var $section = $(this);var $placeholder = $section.find('.services-category-block[data-categories-filter="' + filter + '"][data-needs-load="true"]');if ( $placeholder.length > 0 ) {servicesLoadCategoryItems($section, $placeholder);} else {servicesDisableEnableInfiniteScroll($section);}});var categories = new ModuleLayoutCategories({$items :  $categoryItems,$categoriesContainer : $sectionThis.find('.categories-panel'),$filterButton : $sectionThis.find('.items-responsive-filter'),$categories : $sectionThis.find('.items-categories-container li')});$sectionThis.data('moduleLayoutCategoriesInstance', categories);servicesAddInfiniteScroll($sectionThis);var hashCategoryUniqueID = window.location.hash ? window.location.hash.substring(1) : '';if ( hashCategoryUniqueID ) {var $hashBlock = $sectionThis.find('.services-category-block[data-unique-id="' + hashCategoryUniqueID + '"]');if ( $hashBlock.length > 0 ) {var hashFilter = $hashBlock.data('categories-filter');var $hashTab = $sectionThis.find('.items-categories-container li[data-categories-filter="' + hashFilter + '"]');if ( $hashTab.length > 0 && !$hashTab.hasClass('active') ) {$hashTab.trigger('click', true);}}}
if ( $sectionThis.hasClass('layout-10') ) {$sectionThis.find('.service-item-description').each(function() {const $paragraph = $(this);const element = $paragraph.get(0);if (element.scrollHeight > element.clientHeight) {$paragraph.addClass('show-more');$paragraph.attr('data-rel', 'tooltip');$paragraph.off('click.openMore').on('click.openMore', function() {var $this = $(this);if ( $this.hasClass('show-more-disabled') ) return;bootbox.alert({title: $this.data('title'),message: $this.html(),backdrop: true});});}});}
if ( $sectionThis.hasClass('layout-13') ) {var servicesLayout13ActivateFirst = function( $category ) {$sectionThis.find('.service-item').removeClass('active');$sectionThis.find('.service-image.active').stop(true,true).fadeOut(500).removeClass('active');$sectionThis.find('.service-image').removeClass('active');$sectionThis.find('.service-info').addClass('service-more-info-hidden');var $firstItem = $category.find('.service-items .service-item').first();if ( $firstItem.length === 0 ) return;var imgKey = $firstItem.data('img-key');if ( imgKey === undefined ) return;$sectionThis.find('.service-item[data-img-key="' + imgKey + '"]').addClass('active');$sectionThis.find('.service-image[data-img-key="' + imgKey + '"]').addClass('active').stop(true,true).fadeIn(500);var $targetInfo = $sectionThis.find('.service-info[data-img-key="' + imgKey + '"]');if ( $targetInfo.length > 0 ) $targetInfo.removeClass('service-more-info-hidden');};$sectionThis.find('.services-category').each(function() {servicesLayout13ActivateFirst($(this));});$sectionThis.off('click.servicesLayout13 mouseenter.servicesLayout13', '.service-items .service-item')
.on('click.servicesLayout13 mouseenter.servicesLayout13', '.service-items .service-item', function() {var $this = $(this);if ( $this.hasClass('active') ) return;var imgKey = $this.data('img-key');$sectionThis.find('.service-item').removeClass('active');$sectionThis.find('.service-image.active').stop().fadeOut(500).removeClass('active');$sectionThis.find('.service-info').addClass('service-more-info-hidden');$sectionThis.find('.service-item[data-img-key="' + imgKey + '"]').addClass('active');var $newImage = $sectionThis.find('.service-image[data-img-key="' + imgKey + '"]');$newImage.addClass('active').stop().fadeIn(500);var $targetInfo = $sectionThis.find('.service-info[data-img-key="' + imgKey + '"]');if ( $targetInfo.length > 0 ) $targetInfo.removeClass('service-more-info-hidden');});$sectionThis.off('module_layout_categories.shown.servicesLayout13')
.on('module_layout_categories.shown.servicesLayout13', function( event, catID ) {var $category = $(this).find('.services-category[data-categories-filter="' + catID + '"]');servicesLayout13ActivateFirst($category);});$sectionThis.off('services.category.loaded.servicesLayout13')
.on('services.category.loaded.servicesLayout13', function( event, catID ) {var $category = $(this).find('.services-category[data-categories-filter="' + catID + '"]');servicesLayout13ActivateFirst($category);});}
$modulesMobileCarouselViewOBJ = new ModulesMobileCarouselView({$section : $sectionThis});$sectionThis.data('modulesMobileCarouselViewInstance', $modulesMobileCarouselViewOBJ);servicesBindCarouselSwipeInfiniteScroll($sectionThis);if ( $sectionThis.find('.mapPopupActivator').length > 0 ) {$sectionThis.find('.mapPopupActivator').each(function() {var $mapLink = $(this);var location = $mapLink.data('location');$mapLink.off('click.mapPopup').on('click.mapPopup', function(e) {e.preventDefault();buildPopup('popupServiceMap','','', $GLOBALS["maps-display-domain"] + '/include/globalMapDisplay.php?cad=1&q=' + encodeURIComponent(location) + '&fl=1&l=' + encodeURIComponent(languageCode) + '&ilfc=' + encodeURIComponent(longFreeCustomer), true, false, true, '', '');});});}
initPseudoLinks($sectionThis);initAttributePopovers($sectionThis);});});function initPseudoLinks($container) {var $pseudoLinks = $container.find('[data-link-element="true"][data-href]');if ( $pseudoLinks.length === 0 ) return;$pseudoLinks.off('mousedown.pseudoLink').on('mousedown.pseudoLink', function(e) {if (e.which === 2) {e.preventDefault();e.stopPropagation();var href = $(this).data('href');if (href) {window.open(href, '_blank');}}});$pseudoLinks.off('click.pseudoLink').on('click.pseudoLink', function(e) {e.preventDefault();e.stopPropagation();var $el = $(this);var href = $el.data('href');var target = $el.data('target');if ( !href ) return;var open_in_new_tab_boo = e.ctrlKey || e.metaKey || target === '_blank';if ( open_in_new_tab_boo ) {window.open(href, '_blank');} else {window.location.href = href;}});$pseudoLinks.off('auxclick.pseudoLink').on('auxclick.pseudoLink', function(e) {if (e.which === 2) {e.preventDefault();e.stopPropagation();}});}
function initAttributePopovers($container) {var $attrElements = $container.find('.service-extra-attr');if ( $attrElements.length === 0 ) return;$attrElements.each(function() {var $attrEl = $(this);var titleText = $attrEl.attr('title');if ( !titleText || titleText.trim() === '' ) return;$attrEl.popover({container: 'body',content: titleText,html: false,trigger: 'hover',placement: 'top',template: '<div class="popover service-attr-popover" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>'});});}}
function servicesAddInfiniteScroll( $sectionThis ) {var sectionContext = $sectionThis.data('servicesContext') || 'modulepage';$.each($sectionThis.find('.services-category-block.s123-infinity-scroll'), function() {var $this = $(this);if ( $this.data('s123InfiniteScroll') ) return;var $itemsContainer = $this.find('[data-items-container="true"]').first();if ( $itemsContainer.length === 0 ) return;var infiniteScroll = new s123InfiniteScroll({isMobile: false,$container: $this,id: $this.data('unique-id'),offset: $('footer.global_footer').outerHeight(),ajax: {type: 'GET',url: '/versions/2/wizard/modules/services/front/infiniteScroll.php',data: {w: $('#w').val(),websiteID: $('#websiteID').val(),uniquePageID: $this.data('module-id'),pageUrl: $this.data('page-url'),limit: $this.data('limit'),filter: $this.data('filter'),categoriesFilter: $this.data('categories-filter'),toolStyle: $this.data('tool-style'),tranW: $this.data('language'),context: sectionContext},success: function( data ) {if ( !data || !data.itemsHtml ) return;if ( $itemsContainer.find('> .service-images').length > 0 && $itemsContainer.find('> .service-items').length > 0 ) {var $tempL13 = $('<div>').append(data.itemsHtml);$itemsContainer.find('> .service-images').append($tempL13.find('.l13-images-batch').children());$itemsContainer.find('> .service-items').append($tempL13.find('.l13-items-batch').children());if ( window.myLazyLoad ) window.myLazyLoad.update();return;}
if ( $itemsContainer.hasClass('slick-initialized') ) {var $newItems = $('<div>').append(data.itemsHtml).children();var savedCurrentSlideNUM;var infiniteScrollInstance = $itemsContainer.closest('.services-category-block.s123-infinity-scroll').data('s123InfiniteScroll');if ( infiniteScrollInstance && typeof infiniteScrollInstance.carouselTriggerSlideNUM === 'number' ) {savedCurrentSlideNUM = infiniteScrollInstance.carouselTriggerSlideNUM;infiniteScrollInstance.carouselTriggerSlideNUM = null;} else {savedCurrentSlideNUM = $itemsContainer.slick('slickCurrentSlide');}
$newItems.each(function() {$itemsContainer.slick('slickAdd', this);});var slickInstanceOBJ = $itemsContainer.slick('getSlick');var restoreFn = function() {setTimeout(function() {$itemsContainer.slick('slickGoTo', savedCurrentSlideNUM, true);}, 0);};if ( slickInstanceOBJ && slickInstanceOBJ.animating === true ) {$itemsContainer.off('afterChange.servicesPositionRestore').one('afterChange.servicesPositionRestore', restoreFn);} else {restoreFn();}} else {$itemsContainer.append(data.itemsHtml);}
if ( window.myLazyLoad ) window.myLazyLoad.update();}}});});servicesDisableEnableInfiniteScroll($sectionThis);}
function servicesDisableEnableInfiniteScroll( $sectionThis ) {$.each($sectionThis.find('.services-category-block.s123-infinity-scroll'), function() {var $this = $(this);var instance = $this.data('s123InfiniteScroll');if ( !instance ) return;if ( instance.carouselMode ) return;if ( $this.is(':visible') ) {instance.enable();} else {instance.disable();}});}
function servicesBindCarouselSwipeInfiniteScroll( $sectionThis ) {var triggerOffsetNUM = 0;$.each($sectionThis.find('.services-category-block.s123-infinity-scroll'), function() {var $block = $(this);var instance = $block.data('s123InfiniteScroll');if ( !instance ) return;var $itemsContainer = $block.find('[data-items-container="true"]').first();if ( $itemsContainer.length === 0 || !$itemsContainer.hasClass('slick-initialized') ) return;if ( $itemsContainer.data('servicesCarouselInfiniteBound') ) return;$itemsContainer.data('servicesCarouselInfiniteBound', true);instance.disable();instance.carouselMode = true;$itemsContainer.off('afterChange.servicesCarouselInfinite').on('afterChange.servicesCarouselInfinite', function( event, slick, currentSlide ) {var totalSlidesNUM = slick.slideCount;var shouldTriggerBOO = currentSlide >= totalSlidesNUM - 1 - triggerOffsetNUM && !instance.inProgress;if ( shouldTriggerBOO ) {instance.carouselTriggerSlideNUM = currentSlide;instance.getPage();instance.inProgress = true;}});});}
function servicesLoadCategoryItems( $sectionThis, $placeholder ) {if ( $placeholder.attr('data-loading') === 'true' ) return;$placeholder.attr('data-loading', 'true');$placeholder.html('<div class="services-category-loading text-center">' + S123.s123IconToSvg.getHtml('spinner','fa-spin fa-4x primary-color','') + '</div>');$.ajax({type: 'GET',url: '/versions/2/wizard/modules/services/front/infiniteScroll.php',dataType: 'json',data: {w: $('#w').val(),websiteID: $('#websiteID').val(),uniquePageID: $placeholder.data('module-id'),pageUrl: $placeholder.data('page-url'),limit: $placeholder.data('limit'),filter: $placeholder.data('filter'),categoriesFilter: $placeholder.data('categories-filter'),toolStyle: $placeholder.data('tool-style'),tranW: $placeholder.data('language'),pageNumber: 1,firstLoad: 1,context: $placeholder.data('context')},success: function( data ) {if ( !data || !data.wrappedHtml ) {$placeholder.removeAttr('data-loading').empty();return;}
var $newBlock = $(data.wrappedHtml);$placeholder.replaceWith($newBlock);$newBlock.show();var categoriesInstance = $sectionThis.data('moduleLayoutCategoriesInstance');if ( categoriesInstance ) {categoriesInstance.$items = $sectionThis.find('.services-category-block');}
if ( window.myLazyLoad ) window.myLazyLoad.update();servicesAddInfiniteScroll($sectionThis);var carouselInstance = $sectionThis.data('modulesMobileCarouselViewInstance');if ( carouselInstance ) carouselInstance.init();servicesBindCarouselSwipeInfiniteScroll($sectionThis);var loadedFilter = $newBlock.data('categories-filter');$sectionThis.triggerHandler('services.category.loaded', [loadedFilter]);},error: function() {$placeholder.removeAttr('data-loading').empty();}});}
jQuery(function($) {CustomFormModuleInitialize();});function CustomFormModuleInitialize() {$(document).on('s123.page.ready', function( event ) {var $section = $('section.s123-module-custom-form-builder');$section.each( function( index ) {var $sectionThis = $(this);initializeUniqueSubmission($sectionThis);$sectionThis.find('.customForm').each( function( index ) {var $form = $(this);var clickAction = $form.data('click-action');$form.append($('<div class="conv-code-container"></div>'));var $convCodeContainer = $form.find('.conv-code-container');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.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);}});});$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('.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);if ( !CustomForm_IsLastStep( $form ) ) {$form.find('.next-form-btn:visible').trigger('click');return false;}
if ( !CustomForm_IsFillOutAtLeastOneField($form) ) {bootbox.alert(translations.fillOutAtLeastOneField);return false;}
$form.find('button:submit').prop('disabled', true);if ( forms_GoogleRecaptcha.isActive && !forms_GoogleRecaptcha.isGotToken ) {forms_GoogleRecaptcha.getToken();return false;}
if ( clickAction == 'thankYouMessage' || clickAction == '' ) {var $sendingDialog = bootbox.alert({title: translations.sending,message: '<div id="customFormLoadingMessage">'+translations.loading+'</div>',className: 'contactUsConfirm',buttons: {ok: {label: translations.Ok}},backdrop: true});}
$.ajax({type: "POST",url: "/versions/2/include/customFormO.php",data: new FormData($form.get(0)),cache: false,contentType: false,processData: false,success: function( data ) {var dataObj = jQuery.parseJSON(data);var thankYouMessage = translations.ThankYouAfterSubmmit;if ( $form.data('thanks-msg') ) {thankYouMessage = $form.data('thanks-msg');}
$form.trigger("reset");if ( clickAction == 'thankYouMessage' || clickAction == '' ) {message = '<span>'+thankYouMessage+'<iframe src="/versions/2/include/customFormSentO.php?w='+$('#w').val()+'&websiteID='+dataObj.websiteID+'&moduleID='+dataObj.moduleID+'" style="width:100%;height:30px;" frameborder="0"></iframe></span>';var $sentMessage = $(message);$sendingDialog.find('.modal-title').html(translations.sent);$sendingDialog.find('.bootbox-body').append($sentMessage.hide());$('#customFormLoadingMessage').hide();$sentMessage.slideDown(200);} 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();$form.find('button:submit').prop('disabled', false);if ( clickAction == 'thankYouMessage' || clickAction == '' ) {$sendingDialog.on('hide.bs.modal', function (event) {initializeUniqueSubmission($sectionThis);});}
WizardNotificationUpdate();}});return false;}});CustomForm_DisableTwoColumns($form);});new UiRichSelect();});});function initializeUniqueSubmission($sectionThis) {if ( $('#w').val().length != 0 ) return;$sectionThis.find('#uniqueSubmission').each( function( index ) {var $uniqueSubmission = $(this);var websiteID = $('#websiteID').val();var uniqueSubmissionID = $uniqueSubmission.data('unique-id');var cookie = getCookie(websiteID + '-cfus-' + uniqueSubmissionID);if ( cookie == '1' ) {$sectionThis.find('.customForm').hide();$uniqueSubmission.fadeIn(350);}});};function getCookie(name) {var cookies = document.cookie ? document.cookie.split('; ') : [];for (var i = 0; i < cookies.length; i++) {var parts = cookies[i].split('=');if ( decodeURIComponent(parts[0]) !== name ) continue;var cookie = parts.slice(1).join('=');return decodeURIComponent(cookie);}
return '';};}
jQuery(function($) {RichPageModuleInitialize();});function RichPageModuleInitialize() {$(document).on('s123.page.ready', function( event ) {if ( !IsWizard() ) {RichPagePromosHandler.init();}});var RichPagePromosHandler = function() {var _ = {fixColors: false};_.init = function() {_.$section = $('section.s123-module-rich-page');if ( _.$section.length === 0 ) return;_.$sections = _.$section.siblings();_.$sections.each(function( index, section ) {var $thisSection = $(this);if ( $thisSection.attr('class').indexOf('s123-promo-module') != -1 ) {$thisSection.remove();_.fixColors = true;} else if ( !(whatScreen.any() == 'mobile' && $thisSection.hasClass('h-s-f-hm') ) ) {return false;}});if ( _.fixColors ) {fixModuleColors();}};function fixModuleColors() {_.$sections.filter(':visible').each( function( index, module ) {var $module = $(this);if ( index % 2 == 0 ) {$module.addClass('bg-primary');} else {$module.removeClass('bg-primary');}});}
return _;}();}
