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 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() {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({className: 'item-show-more-popup',title: $this.data('title'),message: `<p class="item-show-more-text">${$this.html()}</p>`,backdrop: true});});}});}});TeamMemberCarouselsInit();});}
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 $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() {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);});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;}
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;$category.find('.team-member-wrap').each(function() {var memberHeight = calculateTeamMemberHeight($(this));if (memberHeight > highestMember) {highestMember = memberHeight;}});if (highestMember > 0) {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'});}}}
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-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 ) {let $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').on('module_layout_categories.shown', function( event, catID ) {$category = $(this).find('.team-category[data-categories-filter="'+catID+'"]');$category.find(`.team-members .team-member`).first().trigger('click');});var $activeCategory = $sectionThis.find('.team-category:visible').first();if ($activeCategory.length === 0) {$activeCategory = $sectionThis.find('.team-category[data-categories-filter="s123-g-show-all"]');}
if ($activeCategory.length > 0) {var $firstMember = $activeCategory.find('.team-members .team-member').first();if ($firstMember.length > 0 && !$firstMember.hasClass('active')) {$firstMember.trigger('click');}}});});}
jQuery(function($) {TwitterTweetsModuleInitialize();});function TwitterTweetsModuleInitialize() {$(document).on('s123.page.ready', function( event ) {var $section = $('section.s123-module-twitter-tweets');$section.each(function( index ) {var $sectionThis = $(this);$sectionThis.find('.tweet-settings').each(function(){const $settings = $(this);const settings = tryParseJSON($settings.val());if ( !settings ) return;$settings.replaceWith(`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${settings.theme}"><a href="${settings.tweetURL}">${settings.title}</a></blockquote><script class="twitter-tweet-script" async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>`);});});});}
jQuery(function($) {TwitterTweetsLayout2ModuleInitialize();});function TwitterTweetsLayout2ModuleInitialize() {$(document).on('s123.page.ready', function(event) {var $sections = $('section.s123-module-twitter-tweets.layout-2');$sections.each(function(index) {var $sectionThis = $(this);initializeTwitterTweetsLayout2($sectionThis);});});}
var twitterWidgetsLoaded = false;var twitterWidgetsLoading = false;var logCounters = {initializeSection: 0,loadWidgets: 0,setupEventListeners: 0,monitoringSetup: 0,tweetProcessing: 0};function initializeTwitterTweetsLayout2($section) {logCounters.initializeSection++;if (logCounters.initializeSection > 3) {return;}
var tweetSettings = $section.find('.item-set-1 .tweet-settings').length;var existingTweets = $section.find('.item-set-1 .twitter-tweet').length;if (tweetSettings === 0 && existingTweets === 0) {return;}
if (existingTweets > 0) {setTimeout(function() {var $allTwitterIframes = $('iframe[id*="twitter-widget"]');if ($allTwitterIframes.length > 0) {$allTwitterIframes.each(function() {var $iframe = $(this);var currentLoading = $iframe.attr('loading');if (currentLoading !== 'lazy') {$iframe.attr('loading', 'lazy');}});}}, 2000);}
if (tweetSettings > 0) {$section.find('.item-set-1 .tweet-settings').each(function(index) {const $settings = $(this);const $tweetBody = $settings.closest('.tweet-body');if ($tweetBody.find('[data-tweet-processed="true"]').length > 0) {return;}
logCounters.tweetProcessing++;const settings = tryParseJSON($settings.val());if (!settings) {$tweetBody.html('<div class="tweet-error">Invalid tweet configuration</div>');return;}
const $existingTweet = $tweetBody.find('.twitter-tweet[data-iframe-loaded="true"], .twitter-tweet[data-iframe-preserved="true"]');if ($existingTweet.length > 0) {return; // Skip recreating tweet
}
$tweetBody.html('<div class="tweet-loading"></div>');try {const tweetHTML = `<blockquote class="twitter-tweet" data-dnt="true" data-theme="${settings.theme}" data-conversation="none" data-cards="hidden" data-width="300" data-lang="en" data-limit="1" data-tweet-url="${settings.tweetURL}" data-tweet-title="${settings.title}">
<div class="tweet-placeholder" style="min-height: 200px; border: 1px solid #e1e8ed; border-radius: 12px; padding: 20px; background: #f7f9fa; display: flex; align-items: center; justify-content: center; color: #657786; font-size: 14px;">
<div style="text-align: center;">
<div style="margin-bottom: 8px;">🐦</div>
<div>Tweet will load when visible</div>
</div>
</div>
<a href="${settings.tweetURL}" style="display: none;">${settings.title}</a>
</blockquote>`;$settings.replaceWith(tweetHTML);const $newTweet = $tweetBody.find('.twitter-tweet');$newTweet.attr('role', 'article');$newTweet.attr('aria-label', 'Twitter Tweet');const $correspondingItem = $tweetBody.closest('.global-layout-2-item');const uniqueId = $correspondingItem.data('unique-id');if (uniqueId) {const $correspondingItemSet2 = $section.find('.item-set-2 .global-layout-2-item[data-unique-id="' + uniqueId + '-copy"]');if ($correspondingItemSet2.length > 0) {const $tweetBodySet2 = $correspondingItemSet2.find('.tweet-body');$tweetBodySet2.html($tweetBody.html());}}} catch (error) {$tweetBody.html('<div class="tweet-error">Error loading tweet</div>');}});}
loadTwitterWidgetsOnce();if (!$section.data('twitter-monitoring-setup')) {logCounters.monitoringSetup++;$section.data('twitter-monitoring-setup', true);monitorTweetLoading($section);}}
function loadTwitterWidgetsOnce() {logCounters.loadWidgets++;if (logCounters.loadWidgets > 5) {return;}
if (twitterWidgetsLoaded || twitterWidgetsLoading) {return;}
if (typeof twttr !== 'undefined') {twitterWidgetsLoaded = true;setupTwitterEventListeners();return;}
if (!document.querySelector('script[src*="platform.twitter.com/widgets.js"]')) {twitterWidgetsLoading = true;const script = document.createElement('script');script.async = true;script.src = 'https://platform.twitter.com/widgets.js';
script.charset = 'utf-8';script.className = 'twitter-widgets-script';script.onload = function() {twitterWidgetsLoaded = true;twitterWidgetsLoading = false;if (typeof twttr !== 'undefined') {setupTwitterEventListeners();}};script.onerror = function() {twitterWidgetsLoading = false;$('.tweet-loading').each(function() {$(this).replaceWith('<div class="tweet-error">Failed to load Twitter widgets</div>');});};document.head.appendChild(script);} else {twitterWidgetsLoading = true;}}
function setupTwitterEventListeners() {logCounters.setupEventListeners++;if (logCounters.setupEventListeners > 2) {return;}
if (window.twitterEventListenersSetup) {return;}
window.twitterEventListenersSetup = true;if (typeof twttr !== 'undefined') {twttr.events.bind('rendered', function(event) {const $iframe = $(event.target);if ($iframe.length) {const iframeId = $iframe.attr('id');if (iframeId && iframeId.includes('twitter-widget')) {$iframe.attr('loading', 'lazy');try {const iframeDoc = $iframe[0].contentDocument || $iframe[0].contentWindow.document;const images = iframeDoc.querySelectorAll('img');images.forEach(function(img) {img.setAttribute('loading', 'lazy');});} catch (e) {}}
$iframe.css({'width': '100%','max-width': 'none','height': '240px','max-height': '240px'});try {$iframe.contents().find('span').css('font-size', '13px');$iframe.contents().find('body').css('font-size', '13px');} catch (e) {$iframe.closest('.twitter-tweet').css({'font-size': '13px','line-height': '1.3'});}
applyLazyLoadingToTweetImages($iframe);$iframe.closest('.twitter-tweet').attr('data-iframe-loaded', 'true');$iframe.closest('.global-layout-2-item').find('.tweet-loading').remove();}});twttr.events.bind('loaded', function(event) {});}}
function monitorTweetLoading($section) {setTimeout(function() {$section.find('.twitter-tweet').each(function() {const $tweet = $(this);if (!$tweet.attr('data-rendered') && !$tweet.find('iframe').length) {const $errorDiv = $('<div class="tweet-error">Tweet could not be loaded</div>');$tweet.replaceWith($errorDiv);}});}, 15000); // Wait 15 seconds for tweets to load (increased from 10s)
}
function refreshTwitterTweetsLayout2($section) {initializeTwitterTweetsLayout2($section);}
function initializeTwitterTweetsLayout2ManualCarousel($section) {$section.find('.global-layout-2-column').each(function() {var $column = $(this);var $grid = $column.find('.global-layout-2-grid');if ($grid.length > 0 && $column.data('animate') === true) {var animationDuration = $column.data('animation-duration') || 60;var direction = $column.data('direction') || 'up';$grid.css('animation-duration', animationDuration + 's');$column.on('mouseenter', function() {$grid.css('animation-play-state', 'paused');});$column.on('mouseleave', function() {$grid.css('animation-play-state', 'running');});}});}
function tryParseJSON(jsonString) {try {return JSON.parse(jsonString);} catch (e) {return null;}}
window.TwitterTweetsLayout2 = {initialize: TwitterTweetsLayout2ModuleInitialize,refresh: refreshTwitterTweetsLayout2,loadWidgets: loadTwitterWidgetsOnce};function showLoggingSummary() {if (logCounters.initializeSection > 5) {}
if (logCounters.loadWidgets > 3) {}
if (logCounters.setupEventListeners > 1) {}
if (logCounters.tweetProcessing > 20) {}}
setTimeout(function() {showLoggingSummary();setInterval(showLoggingSummary, 30000); // Every 30 seconds
}, 10000); // First summary after 10 seconds
function optimizeTwitterIframeRendering($section) {$section.find('iframe[id^="twitter-widget"]').each(function() {const iframe = this;$(iframe).css({'transform': 'translateZ(0)','backface-visibility': 'hidden','will-change': 'auto'});});}
$(document).ready(function() {if (typeof window.GlobalLayout2 === 'undefined') {const script = document.createElement('script');script.src = '/versions/2/wizard/modules/globalLayouts/globalLayout-vertical-scroll/js/module.globalLayout-2.js';document.head.appendChild(script);}
setTimeout(function() {$('.s123-module-twitter-tweets.layout-2').each(function() {optimizeTwitterIframeRendering($(this));});}, 2000); // Wait for tweets to load
});function addLazyLoadingToExistingTwitterIframes($section) {const $twitterIframes = $section.find('iframe[id*="twitter-widget"]');if ($twitterIframes.length === 0) {return;}
$twitterIframes.each(function(index) {const $iframe = $(this);const iframeId = $iframe.attr('id');const currentLoading = $iframe.attr('loading');if (currentLoading !== 'lazy') {$iframe.attr('loading', 'lazy');try {const iframeDoc = $iframe[0].contentDocument || $iframe[0].contentWindow.document;const images = iframeDoc.querySelectorAll('img');images.forEach(function(img) {if (img.getAttribute('loading') !== 'lazy') {img.setAttribute('loading', 'lazy');}});} catch (e) {}}});}
function setupPeriodicTwitterIframeScan($section) {if ($section.data('twitter-iframe-scanner-setup')) {return;}
$section.data('twitter-iframe-scanner-setup', true);let scanCount = 0;const maxScans = 30; // Safety limit to prevent infinite scanning
const scanInterval = setInterval(function() {scanCount++;const $pendingBlockquotes = $section.find('.twitter-tweet-lazy');if ($pendingBlockquotes.length === 0) {clearInterval(scanInterval);return;}
const $newIframes = $section.find('iframe[id*="twitter-widget"]:not([loading="lazy"])');if ($newIframes.length > 0) {$newIframes.each(function() {const $iframe = $(this);const iframeId = $iframe.attr('id');$iframe.attr('loading', 'lazy');try {const iframeDoc = $iframe[0].contentDocument || $iframe[0].contentWindow.document;const images = iframeDoc.querySelectorAll('img:not([loading="lazy"])');images.forEach(function(img) {img.setAttribute('loading', 'lazy');});} catch (e) {}});}
if (scanCount >= maxScans) {clearInterval(scanInterval);}}, 1000); // Scan every 1 second
}
function setupTwitterIframeLazyLoading($section) {const $lazyTweets = $section.find('.twitter-tweet-lazy[data-lazy-load="true"]');if ($lazyTweets.length === 0) {const $allTweets = $section.find('.twitter-tweet');return;}
const observer = new IntersectionObserver(function(entries) {entries.forEach(function(entry) {if (entry.isIntersecting) {const $tweet = $(entry.target);if ($tweet.data('loading') || $tweet.attr('data-iframe-loaded') === 'true') {return;}
$tweet.data('loading', true);const tweetURL = $tweet.attr('data-tweet-url');const tweetTitle = $tweet.attr('data-tweet-title');if (tweetURL && tweetTitle) {$tweet.html(`<a href="${tweetURL}">${tweetTitle}</a>`);$tweet.removeAttr('data-lazy-load')
.removeAttr('data-tweet-url')
.removeAttr('data-tweet-title')
.removeClass('twitter-tweet-lazy');if (typeof twttr !== 'undefined' && twttr.widgets && twttr.widgets.load) {twttr.widgets.load($tweet[0]);}}
observer.unobserve(entry.target);}});}, {root: null, // Use viewport as root
threshold: 0.1, // Trigger when 10% visible
rootMargin: '100px' // Start loading 100px before entering viewport
});$lazyTweets.each(function(index) {observer.observe(this);});}
function applyLazyLoadingToTweetImages($iframe) {try {const iframe = $iframe[0];if (!iframe || !iframe.contentDocument) {return;}
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;const images = iframeDoc.querySelectorAll('img');if (images.length === 0) {return;}
const observer = new IntersectionObserver(function(entries) {entries.forEach(function(entry) {if (entry.isIntersecting) {const img = entry.target;const lazySrc = img.getAttribute('data-src') || img.getAttribute('data-lazy-src');if (lazySrc && !img.src) {img.src = lazySrc;img.removeAttribute('data-src');img.removeAttribute('data-lazy-src');}
observer.unobserve(img);}});}, {root: null, // Use viewport as root
threshold: 0.1,rootMargin: '50px' // Start loading 50px before image enters viewport
});images.forEach(function(img) {if (img.src && !img.getAttribute('data-src') && !img.getAttribute('data-lazy-src')) {img.setAttribute('data-lazy-src', img.src);img.removeAttribute('src');}
observer.observe(img);});} catch (error) {}}
function addSmoothAnimationResetHandling($iframe) {try {const $grid = $iframe.closest('.global-layout-2-grid');const $column = $iframe.closest('.global-layout-2-column');if ($grid.length === 0 || $column.length === 0) {return;}
const animationDuration = parseFloat($column.data('animation-duration')) || 17;const animationDurationMs = animationDuration * 1000;let lastTransform = '';let resetCount = 0;const checkAnimationReset = () => {const currentTransform = window.getComputedStyle($grid[0]).transform;if (currentTransform.includes('matrix(1, 0, 0, 1, 0, 0)') ||currentTransform.includes('matrix(1, 0, 0, 1, 0, -')) {if (lastTransform && lastTransform !== currentTransform) {resetCount++;$grid.css('opacity', '0.98');setTimeout(() => {$grid.css('opacity', '1');}, 50); // Very brief opacity change to mask the flash
}}
lastTransform = currentTransform;};const resetInterval = setInterval(checkAnimationReset, animationDurationMs / 10);setTimeout(() => {clearInterval(resetInterval);}, 300000); // 5 minutes
} catch (error) {}}
