jQuery(function($) {TeamModuleInitialize();$(document).on('s123.page.ready.carousels', function( event ) {TeamMemberCarouselsInit();});});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 $categoryItems = $sectionThis.find('.team-category-block');if ( $categoryItems.length === 0 ) $categoryItems = $sectionThis.find('.team-category');var sectionContext = $sectionThis.find('.team-category-block').first().data('context') || 'modulepage';$sectionThis.data('teamContext', sectionContext);$sectionThis.off('module_layout_categories.shown.teamInfiniteScroll')
.on('module_layout_categories.shown.teamInfiniteScroll', function( event, filter ) {var $section = $(this);var $placeholder = $section.find('.team-category-block[data-categories-filter="' + filter + '"][data-needs-load="true"]');if ( $placeholder.length > 0 ) {teamLoadCategoryItems($section, $placeholder);} else {teamDisableEnableInfiniteScroll($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);teamAddInfiniteScroll($sectionThis);var hashCategoryUniqueID = window.location.hash ? window.location.hash.substring(1) : '';if ( hashCategoryUniqueID ) {var $hashBlock = $sectionThis.find('.team-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-13') ) {var layout13DetectOverflow = function( $scope ) {$scope = $scope || $sectionThis;$scope.find('.team-item-description').each(function() {var $paragraph = $(this);if ( $paragraph.data('overflowChecked') ) return;$paragraph.data('overflowChecked', true);var 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({className: 'item-show-more-popup',title: $this.data('title'),message: `<p class="item-show-more-text">${$this.html()}</p>`,backdrop: true});});}});};layout13DetectOverflow();$sectionThis.off('team.items.appended.layout13')
.on('team.items.appended.layout13', function( event, filter ) {var $category = $(this).find('.team-category[data-categories-filter="' + filter + '"]');layout13DetectOverflow($category.length ? $category : $sectionThis);});$sectionThis.off('team.category.loaded.layout13')
.on('team.category.loaded.layout13', function( event, filter ) {var $category = $(this).find('.team-category[data-categories-filter="' + filter + '"]');layout13DetectOverflow($category.length ? $category : $sectionThis);});}});TeamMemberCarouselsInit();});}
function teamAddInfiniteScroll( $sectionThis ) {var sectionContext = $sectionThis.data('teamContext') || 'modulepage';$.each($sectionThis.find('.team-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/team/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('> .team-images').length > 0 && $itemsContainer.find('> .team-members').length > 0 ) {var $tempL14 = $('<div>').append(data.itemsHtml);$itemsContainer.find('> .team-images').append($tempL14.find('.l14-images-batch').children());$itemsContainer.find('> .team-members').append($tempL14.find('.l14-members-batch').children());if ( window.myLazyLoad ) window.myLazyLoad.update();TeamMemberCarouselsInit();$this.closest('section').triggerHandler('team.items.appended', [$this.data('categories-filter')]);return;}
$itemsContainer.append(data.itemsHtml);if ( window.myLazyLoad ) window.myLazyLoad.update();TeamMemberCarouselsInit();$this.closest('section').triggerHandler('team.items.appended', [$this.data('categories-filter')]);}}});});teamDisableEnableInfiniteScroll($sectionThis);}
function teamDisableEnableInfiniteScroll( $sectionThis ) {$.each($sectionThis.find('.team-category-block.s123-infinity-scroll'), function() {var $this = $(this);var instance = $this.data('s123InfiniteScroll');if ( !instance ) return;if ( $this.is(':visible') ) {instance.enable();} else {instance.disable();}});}
function teamLoadCategoryItems( $sectionThis, $placeholder ) {if ( $placeholder.attr('data-loading') === 'true' ) return;$placeholder.attr('data-loading', 'true');$placeholder.html('<div class="team-category-loading text-center">' + S123.s123IconToSvg.getHtml('spinner','fa-spin fa-4x primary-color','') + '</div>');$.ajax({type: 'GET',url: '/versions/2/wizard/modules/team/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('.team-category-block');}
if ( window.myLazyLoad ) window.myLazyLoad.update();teamAddInfiniteScroll($sectionThis);TeamMemberCarouselsInit();var loadedFilter = $newBlock.data('categories-filter');$sectionThis.triggerHandler('team.category.loaded', [loadedFilter]);},error: function() {$placeholder.removeAttr('data-loading').empty();}});}
function TeamMemberCarouselsInit() {var $memberCarousels = $('.s123-module-team .team-member-images-carousel, .s123-module-team .team-module-images-carousel');$memberCarousels.each(function() {var $carousel = $(this);var carouselId = $carousel.attr('data-carousel-id');if ($carousel.attr('data-carousel-initialized') === 'true' && $carousel.hasClass('owl-loaded')) return;var isLayout9 = $carousel.closest('.s123-module-team').hasClass('layout-9');if (isLayout9) {var isInActiveItem = $carousel.closest('.owl-item.active').length > 0;if (!isInActiveItem && !$carousel.is(':visible')) return;if ($carousel.hasClass('owl-loaded') && !$carousel.find('.owl-stage').length) {$carousel.trigger('destroy.owl.carousel');$carousel.removeClass('owl-loaded owl-initialized');$carousel.removeAttr('data-carousel-initialized');}} else {if (carouselId && $('[data-carousel-id="' + carouselId + '"][data-carousel-initialized="true"]').length > 0) return;if ($carousel.closest('.owl-item.cloned').length > 0 && !$carousel.is(':visible')) return;}
var rtl = $('html[dir=rtl]').length === 1;var isLayout11 = $carousel.closest('.s123-module-team').hasClass('layout-11');$carousel.owlCarousel({items: 1,loop: true,nav: isLayout11 ? false : true,dots: false,slideTransition: 'ease',center: false,autoplay: isLayout11 ? true : false,rtl: rtl,navText: isLayout11 ? [] : [S123.s123IconToSvg.getHtml('angle-' + (rtl ? 'right' : 'left'), '', ''),S123.s123IconToSvg.getHtml('angle-' + (rtl ? 'left' : 'right'), '', '')],lazyLoad: true,smartSpeed: 300,mouseDrag: false,touchDrag: isLayout11 ? false : true});$carousel.attr('data-carousel-initialized', 'true');if (!$carousel.is(':visible')) {$carousel.addClass('owl-hidden');}
$carousel.trigger('refresh.owl.carousel');$carousel.on('initialized.owl.carousel changed.owl.carousel', function(e) {$carousel.find('.owl-stage').css('height', 'auto');});$carousel.on('click', '.owl-nav button, .owl-nav [class*=owl-]', function(e) {e.stopPropagation();e.preventDefault();});});}
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 $sectionEl = $(this);var $placeholder = $sectionEl.find('.team-category-block[data-categories-filter="'+catID+'"][data-needs-load="true"]');if ( $placeholder.length > 0 ) {if ( typeof teamLoadCategoryItems === 'function' ) {teamLoadCategoryItems($sectionEl, $placeholder);}
return;}
var $category = $sectionEl.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() {var $memberWrap = $(this);var memberHeight = calculateTeamMemberHeight($memberWrap);if (memberHeight > highestMember) {highestMember = memberHeight;}});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',smartSpeed: 300,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(event) {initializeTeamPhone($sectionThis);window.myLazyLoad.update();setTimeout(function() {TeamMemberCarouselsInit();$( document ).trigger( 's123.page.ready.carousels' );recalculateTeamMemberHeights($category);}, 100);},onResize: function() {window.myLazyLoad.update();recalculateTeamMemberHeights($category);},onDrag: function() {window.myLazyLoad.update();},onChanged: function(event) {var $activeItems = $(event.target).find('.owl-item.active');$activeItems.find('.team-member-images-carousel, .team-module-images-carousel').removeAttr('data-carousel-initialized');setTimeout(function() {TeamMemberCarouselsInit();}, 100);},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']);}
$sectionThis.off('module_layout_categories.shown.changed').on('module_layout_categories.shown.changed', function( event, catID ) {setTimeout(function() {var $category = $sectionThis.find('.team-category[data-categories-filter="'+catID+'"]');$category.find('.team-member-images-carousel, .team-module-images-carousel').removeAttr('data-carousel-initialized');TeamMemberCarouselsInit();$( document ).trigger( 's123.page.ready.carousels' );recalculateTeamMemberHeights($category);}, 300);});$sectionThis.off('team.category.loaded.layout9').on('team.category.loaded.layout9', function( event, filter ) {$(this).trigger('module_layout_categories.shown',[filter]);});var $categoryItems = $sectionThis.find('.team-category-block');if ( $categoryItems.length === 0 ) $categoryItems = $sectionThis.find('.team-category');$sectionThis.data('teamContext', $sectionThis.find('.team-category-block').first().data('context') || 'modulepage');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);});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;}
function calculateTeamMemberHeight($memberWrap) {var $teamMember = $memberWrap.find('.team-member');var $teamImage = $teamMember.find('.team-image');var $teamDetails = $teamMember.find('.team-details');var imageHeight = $teamImage.outerHeight(true);var detailsHeight = $teamDetails.outerHeight(true);var memberPadding = parseInt($teamMember.css('padding-top')) + parseInt($teamMember.css('padding-bottom'));return imageHeight + detailsHeight + memberPadding;}
function recalculateTeamMemberHeights($category) {var highestMember = 0;var spaceBetween = 30;var $firstWrap = $category.find('.team-member-wrap').first();if ( !$category.is(':visible') || $firstWrap.width() <= 0 || $firstWrap.find('.team-details').outerHeight() <= 10 ) {return;}
$category.find('.team-member-wrap').each(function() {var memberHeight = calculateTeamMemberHeight($(this));if (memberHeight > highestMember) {highestMember = memberHeight;}});if (highestMember > 0) {if (findBootstrapEnvironment() === 'xs') {highestMember += spaceBetween;}
var currentHeight = parseFloat($firstWrap.css('height')) || 0;if (highestMember < currentHeight) {highestMember = currentHeight;}
$category.find('.team-member-wrap').css({height: highestMember + 'px'});if ($firstWrap.find('.team-member').length > 0) {$category.find('.s123-module-shadows').css({height: $firstWrap.height() + 'px'});}}}
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);var layout14ActivateFirst = function( $category ) {var $firstMember = $category.find('.team-members .team-member').first();if ( $firstMember.length === 0 ) return;var imgKey = $firstMember.data('img-key');if ( imgKey === undefined ) return;$sectionThis.find('.team-members .team-member').removeClass('active');$sectionThis.find('.team-image-wrapper').hide().removeClass('active');$sectionThis.find('.team-memeber-info').addClass('team-more-info-hidden');$sectionThis.find('.team-members .team-member[data-img-key="' + imgKey + '"]').addClass('active');$sectionThis.find('.team-image-wrapper[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.find('.team-category').each(function() {layout14ActivateFirst($(this));});$sectionThis.off('click.layout14 mouseenter.layout14', '.team-members .team-member')
.on('click.layout14 mouseenter.layout14', '.team-members .team-member', function() {var $this = $(this);if ( $this.hasClass('active') ) return;var imgKey = $this.data('img-key');$sectionThis.find('.team-members .team-member').removeClass('active');$sectionThis.find('.team-members .team-member[data-img-key="' + imgKey + '"]').addClass('active');$sectionThis.find('.team-memeber-info').addClass('team-more-info-hidden');$sectionThis.find('.team-image-wrapper').hide().removeClass('active');if ( $sectionThis.find('.team-image-wrapper[data-img-key="' + imgKey + '"]').length > 0 ) {var $wrapper = $sectionThis.find('.team-image-wrapper[data-img-key="' + imgKey + '"]');$wrapper.stop().fadeIn(500).addClass('active');} else {$sectionThis.find('.team-image[data-img-key="' + imgKey + '"]').stop().fadeIn(500);}
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.layout14')
.on('module_layout_categories.shown.layout14', function( event, catID ) {var $category = $(this).find('.team-category[data-categories-filter="' + catID + '"]');layout14ActivateFirst($category);});$sectionThis.off('team.category.loaded.layout14')
.on('team.category.loaded.layout14', function( event, catID ) {var $category = $(this).find('.team-category[data-categories-filter="' + catID + '"]');layout14ActivateFirst($category);});$sectionThis.off('team.items.appended.layout14')
.on('team.items.appended.layout14', function( event, catID ) {var $category = $(this).find('.team-category[data-categories-filter="' + catID + '"]');$category.find('.team-image-wrapper:not(.active)').hide();});});});}
