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 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') ) {$sectionThis.find('.services-category').each(function() {$sectionThis.find('.service-item').removeClass('active');$sectionThis.find('.service-image').removeClass('active');$sectionThis.find('.service-info').addClass('service-more-info-hidden');var $firstItem = $(this).find('.service-item').first();$firstItem.addClass('active');var imgKey = $firstItem.data('img-key');if (imgKey !== undefined) {$sectionThis.find('.service-image[data-img-key="' + imgKey + '"]').addClass('active');var $firstInfo = $sectionThis.find('.service-info[data-img-key="' + imgKey + '"]');if ($firstInfo.length > 0) {$firstInfo.removeClass('service-more-info-hidden');}}});$sectionThis.find('.service-items .service-item').on('click mouseenter',function() {let $this = $(this);if ( $this.hasClass('active') ) return;let 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').on('module_layout_categories.shown', function( event, catID ) {var $category = $(this).find('.services-category[data-categories-filter="'+catID+'"]');$sectionThis.find('.service-item').removeClass('active');$sectionThis.find('.service-image.active').fadeOut(500).removeClass('active');$sectionThis.find('.service-image').removeClass('active');$sectionThis.find('.service-info').addClass('service-more-info-hidden');var imgKey = $category.find('.service-item:first-child').data('img-key');if (imgKey !== undefined) {$sectionThis.find(`.service-item[data-img-key="${imgKey}"]`).addClass('active');$sectionThis.find(`.service-image[data-img-key="${imgKey}"]`).addClass('active').fadeIn(500);var $targetInfo = $sectionThis.find(`.service-info[data-img-key="${imgKey}"]`);if ($targetInfo.length > 0) {$targetInfo.removeClass('service-more-info-hidden');}}});}
$modulesMobileCarouselViewOBJ = new ModulesMobileCarouselView({$section : $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>'});});}}
