PageSourceSearch

https://www.braumanufaktur.de/wp-content/themes/uncode/library/js/app.js?ver=1261983630

js braumanufaktur.de collected 2026-10-02 13:13:49 UTC 631,232 bytes, 19,713 lines download raw bytes

1/* ----------------------------------------------------------
2 * Uncode App
3 * ---------------------------------------------------------- */
4
5(function($) {
6	"use strict";
7	var UNCODE = window.UNCODE || {};
8	window.UNCODE = UNCODE;
9
10	window.requestAnimFrame = (function() {
11	return  window.requestAnimationFrame	   ||
12			window.webkitRequestAnimationFrame ||
13			window.mozRequestAnimationFrame	||
14			window.oRequestAnimationFrame	  ||
15			window.msRequestAnimationFrame	 ||
16			function(/* function */ callback, /* DOMElement */ element){
17				window.setTimeout(callback, 1000 / 60);
18			};
19})();
20
21window.requestTimeout = function(fn, delay) {
22	if( !window.requestAnimationFrame	  	&&
23		!window.webkitRequestAnimationFrame &&
24		!(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
25		!window.oRequestAnimationFrame	  &&
26		!window.msRequestAnimationFrame)
27			return window.setTimeout(fn, delay);
28
29	var start = new Date().getTime(),
30		handle = new Object();
31
32	function loop(){
33		var current = new Date().getTime(),
34			delta = current - start;
35
36		delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop);
37	};
38
39	handle.value = requestAnimFrame(loop);
40	return handle;
41};
42
43window.clearRequestTimeout = function(handle) {
44	if ( typeof handle !== 'undefined' ) {
45		window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
46		window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
47		window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
48		window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
49		window.oCancelRequestAnimationFrame	? window.oCancelRequestAnimationFrame(handle.value) :
50		window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
51		clearTimeout(handle);
52	}
53};
54
55function uncodeVisibilityChange() {
56	if (document.hidden) {
57		window.dispatchEvent(new CustomEvent('is-blur'));
58	} else {
59		window.dispatchEvent(new CustomEvent('is-focus'));
60	}
61  }
62document.addEventListener('visibilitychange', uncodeVisibilityChange, false);
63
64if ( SiteParameters.smoothScroll === 'on' && ! SiteParameters.is_frontend_editor ) {
65	window.lenis = new Lenis({
66		duration: 1
67	})
68
69	UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
70		document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
71
72	function raf(time) {
73		window.lenis.raf(time)
74		requestAnimationFrame(raf)
75		window.dispatchEvent(new CustomEvent('lenis-scroll'));
76
77		if ( SiteParameters.uncode_smooth_scroll_safe ) {
78			var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
79				document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
80			
81			if ( UNCODE.hDoc !== newHdoc ) {
82				UNCODE.hDoc = newHdoc;
83				window.lenis.resize();
84				//window.dispatchEvent(new CustomEvent('boxResized'));
85			}
86		}
87	}
88
89	requestAnimationFrame(raf)
90
91	$(window).on('unmodal-open uncode-sidecart-open', function(){
92		window.lenis.stop();
93	});
94
95	$(window).on('uncode-sidecart-closed', function(){
96		window.lenis.start();
97	});
98
99	$(document).on('unmodal-close', function(){
100		window.lenis.start();
101	});
102
103}
104
105var checkScrollTriggerRefresh;
106
107$(function(){
108	$(document).on('uncode-scrolltrigger-refresh', function(){
109		clearRequestTimeout(checkScrollTriggerRefresh);
110		checkScrollTriggerRefresh = requestTimeout(function(){
111			ScrollTrigger.refresh();
112			$('.scroll-refresh-hidden').removeClass('opacity_0');
113		}, 500);
114	});
115});
116
117UNCODE.checkImgLoad = function( src, cb, err, el ) {
118	var img = new Image();
119	img.onload = function () {
120		var result = (img.width > 0) && (img.height > 0);
121		cb(el);
122	};
123	img.onerror = function () {
124		err();
125	};
126	img.src = src
127};
128
129UNCODE.betterResize = function() {
130	var setResize,
131		doubleResize = true,
132		oldW = UNCODE.wwidth,
133		oldH = UNCODE.wheight,
134		setCTA;
135	$(window).on( 'resize orientationchange', function(){
136		if ( oldW === UNCODE.wwidth ) {
137			return;
138		} else {
139			oldW = UNCODE.wwidth;
140			$(window).trigger('wwResize');
141		}
142
143		if ( oldH === UNCODE.wheight ) {
144			return;
145		} else {
146			oldH = UNCODE.wheight;
147			$(window).trigger('whResize');
148		}
149	});
150
151	$(window).on( 'resize orientationchange', function(){
152		clearRequestTimeout(setCTA);
153		setCTA = requestTimeout( function(){ $(window).trigger('resize-int'); }, 100 );
154	});
155};
156
157UNCODE.shuffle = function(array) {
158	var currentIndex = array.length,
159		randomIndex;
160  
161	while (currentIndex > 0) {
162		randomIndex = Math.floor(Math.random() * currentIndex);
163		currentIndex--;
164		[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
165	}
166  
167	return array;
168};
169
170Number.isInteger = Number.isInteger || function(value) {
171    return typeof value === "number" &&
172           isFinite(value) &&
173           Math.floor(value) === value;
174};
175
176UNCODE.utils = function() {
177	$(document).on('mouseover', 'a', function () {
178		if (!$(this).hasClass('star')) {
179			$(this).attr('data-title', $(this).attr('title'));
180			$(this).removeAttr('title');
181		}
182	});
183	$(document).on('mouseout', 'a', function () {
184		if (!$(this).hasClass('star')) {
185			$(this).attr('title', $(this).attr('data-title'));
186			$(this).removeAttr('data-title');
187		}
188	});
189
190	this.get_scroll_offset = function(e) {
191
192		var scroll_offset = 0,
193			target,
194			trigger;
195
196		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
197			target = e.target;
198			trigger = e.currentTarget;
199		}
200
201		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
202			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
203				UNCODE.hideMenu(100);
204			}
205		}
206
207		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) {
208			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
209			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
210				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile && ! $('.menu-mobile-transparent').length ) ) {
211					if ( !$('.menu-hided').length ) {
212						if ( $('body').hasClass('hmenu-center') ) {
213							scroll_offset += ~~$('.menu-sticky .menu-container').outerHeight();
214						} else {
215							scroll_offset += ~~$('.logo-container:visible').outerHeight();
216						}
217					}
218				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && UNCODE.wwidth > UNCODE.mediaQuery ) {
219					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
220					scroll_offset += (~~$('.menu-sticky .menu-container').outerHeight()) - ( $('.navbar-brand').data('minheight') + shrink );
221				} else {
222					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
223						scroll_offset += UNCODE.menuMobileHeight;
224					} else {
225						if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('vmenu') && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) {
226							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
227						} else {
228							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
229								scroll_offset += UNCODE.menuMobileHeight;
230							}
231						}
232					}
233				}
234			}
235
236		}
237
238		scroll_offset += UNCODE.bodyBorder;
239
240		return scroll_offset;
241	}
242
243	if ( !UNCODE.isFullPage ) {
244		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
245
246			var hash = (e.currentTarget).hash,
247			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
248			anchor = '';
249			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
250			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
251				e.preventDefault();
252				if (!$('#tab-reviews').is(':visible')) {
253					$('a[href="#tab-reviews"]').trigger('click');
254				}
255				var calc_scroll = $('.wootabs .tab-content').offset().top;
256				calc_scroll -= UNCODE.get_scroll_offset(e);
257
258				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
259					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
260
261					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
262						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
263					}
264				}
265
266				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
267					delta = bodyTop - calc_scroll,
268					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
269				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
270
271				requestTimeout(function(){
272					if (scrollSpeed == 0) {
273						$('html, body').scrollTop(calc_scroll);
274						UNCODE.scrolling = false;
275					} else {
276   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
277							$(this).stop();
278						}).animate({
279								scrollTop: calc_scroll
280							}, scrollSpeed, 'easeInOutCubic', function() {
281								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
282								UNCODE.scrolling = false;
283							}
284						);
285					}
286				}, 200);
287				return;
288			}
289			if (hash != undefined) {
290				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
291				var anchor = this.hash.slice(1);
292				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
293			  		if ( !specialFormat.test(hash) ) {
294			  			if ( $(hash).length )
295			  				anchor = $(hash);
296			  		}
297				}
298			}
299
300			if (is_scrolltop || anchor != '') {
301				if (is_scrolltop) {
302					e.preventDefault();
303					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
304					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
305					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
306
307					if (scrollSpeed == 0) {
308						$('html, body').scrollTop(0);
309						UNCODE.scrolling = false;
310					} else {
311   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
312							$(this).stop();
313						}).animate({
314							scrollTop: 0
315						}, scrollSpeed, 'easeInOutCubic', function() {
316							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
317							UNCODE.scrolling = false;
318						});
319					}
320				} else {
321					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
322					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a, #uncode-mobile-menu-block .menu-item > a'), function(index, val) {
323						var get_href = $(val).attr('href');
324						if (get_href != undefined) {
325							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
326							else $(val).parent().removeClass('active');
327						}
328					});
329					if (scrollSection.length) {
330						if ( $('body').hasClass('uncode-scroll-no-history') ) {
331							e.preventDefault();
332						}
333
334						if (UNCODE.menuOpened) {
335							if (UNCODE.wwidth < UNCODE.mediaQuery) {
336								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
337							} else {
338								$('.mmb-container-overlay .overlay-close').trigger('click');
339								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
340							}
341						}
342
343						var calc_scroll = scrollSection.offset().top,
344							getOffset = UNCODE.get_scroll_offset(e),
345							$logo = $('.logo-container:visible'),
346							logoH,
347							$menu = $('#masthead .menu-container'),
348							menuH;
349
350						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
351
352						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
353							delta = bodyTop - calc_scroll,
354							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
355						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
356
357						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
358							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
359								logoH = $logo.outerHeight(),
360								menuH = $menu.outerHeight();
361								if ( calc_scroll < ( logoH + menuH ) ) {
362									calc_scroll = 0;
363								}
364							}
365						}
366
367						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
368							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
369						}
370
371						if (scrollSpeed == 0) {
372							$('html, body').scrollTop(calc_scroll);
373							UNCODE.scrolling = false;
374						} else {
375	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
376								$(this).stop();
377							}).animate({
378								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
379							}, scrollSpeed, 'easeInOutCubic', function() {
380								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
381								UNCODE.scrolling = false;
382								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
383								||
384								$('.menu-hided').length ) {
385									calc_scroll = scrollSection.offset().top;
386									getOffset = UNCODE.get_scroll_offset(e);
387									calc_scroll -= getOffset;
388									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
389										$(this).stop();
390									}).animate({
391										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
392										}, scrollSpeed, 'easeInOutCubic', function() {
393											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
394											UNCODE.scrolling = false;
395										}
396									);
397								}
398							});
399						}
400					}
401				}
402			}
403		});
404		$('.header-scrolldown').on('click', function(event) {
405
406			event.preventDefault();
407
408			var pageHeader = $(event.target).closest('#page-header'),
409				pageHeaderTop = pageHeader.offset().top,
410				pageHeaderHeight = pageHeader.outerHeight(),
411				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
412			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
413
414			var calc_scroll = pageHeaderTop + pageHeaderHeight,
415			getOffset = UNCODE.get_scroll_offset(event);
416			calc_scroll -= getOffset;
417
418			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
419				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
420
421				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
422					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
423				}
424			}
425
426			if (scrollSpeed == 0) {
427				$('html, body').scrollTop(calc_scroll);
428				UNCODE.scrolling = false;
429			} else {
430					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
431						$(this).stop();
432					}).animate({
433						scrollTop: calc_scroll
434					}, scrollSpeed, 'easeInOutCubic', function() {
435						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
436						UNCODE.scrolling = false;
437						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
438							calc_scroll = pageHeaderTop + pageHeaderHeight;
439							getOffset = UNCODE.get_scroll_offset(event);
440							calc_scroll -= getOffset;
441								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
442									$(this).stop();
443								}).animate({
444									scrollTop: calc_scroll
445								}, scrollSpeed, 'easeInOutCubic', function() {
446									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
447									UNCODE.scrolling = false;
448								}
449							);
450						}
451					}
452				);
453			}
454		});
455	}
456
457	// Colomun hover effect
458	// =================
459	$(document).on('mouseenter', '.col-link', function(e) {
460		var uncol = $(e.target).prev('.uncol'),
461		el = uncol.find('.column-background');
462		if (el) {
463			$('.btn-container .btn', uncol).addClass('active');
464			var elOverlay = $(el[0]).find('.block-bg-overlay');
465			if (elOverlay.length) {
466				var getOpacity = $(elOverlay).css('opacity');
467				if (getOpacity != 1) {
468					getOpacity = Math.round(getOpacity * 100) / 100;
469					var newOpacity = getOpacity + .1;
470					$(elOverlay).data('data-opacity', getOpacity);
471					$(elOverlay).css('opacity', newOpacity);
472				}
473			}
474		}
475	}).on('mouseleave', '.col-link', function(e) {
476		var uncol = $(e.target).prev('.uncol'),
477		el = uncol.find('.column-background');
478		$('.btn-container .btn', uncol).removeClass('active');
479		if (el) {
480			var elOverlay = $(el[0]).find('.block-bg-overlay');
481			if (elOverlay.length) {
482				var getOpacity = $(elOverlay).data('data-opacity');
483				$(elOverlay).css('opacity', getOpacity);
484			}
485		}
486	});
487
488	// Admin bar
489	// ============
490	var fixAdminBar = function() {
491		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
492			var getAdminBar = $('#wpadminbar');
493			if (getAdminBar.length) {
494				if (getAdminBar.css('position') !== 'hidden') {
495					var getAdminBarHeight = getAdminBar.height();
496					if (getAdminBar.css('position') === 'fixed') {
497						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
498						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
499					} else {
500						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
501						$('.body-borders .top-border').css({'margin-top':'0px'});
502					}
503				}
504			}
505		}
506	};
507	window.addEventListener('load', fixAdminBar);
508	window.addEventListener('resize', fixAdminBar);
509	// Print
510	// ===========
511	var beforePrint = function() {
512		window.dispatchEvent(new CustomEvent('resize'));
513		window.dispatchEvent(UNCODE.boxEvent);
514	};
515
516	if (window.matchMedia) {
517		var mediaQueryList = window.matchMedia('print');
518		mediaQueryList.addListener(function(mql) {
519			if (mql.matches) {
520				beforePrint();
521			}
522		});
523	}
524
525	window.onbeforeprint = beforePrint;
526
527	// Safari srcset
528	var safariSrcSet = function(){
529		if ( !SiteParameters.is_frontend_editor ) {
530			$('html.safari img[sizes]').each(function(){
531				var $img = $(this),
532					sizeImg = parseInt($img.attr('sizes'));
533				if ( typeof(sizeImg) === 'number' ) {
534					$img.attr('sizes', (sizeImg) + 'px');
535				}
536			});
537		}
538	};
539	window.addEventListener('load', safariSrcSet);
540}
541
542UNCODE.lettering = function() {
543
544	var setCTA;
545	var highlightStill = function(){
546
547		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
548
549		$.each($heading_texts, function(key, el) {
550			var $heading = $(el);
551
552			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
553				return;
554			}
555
556			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
557				return;
558			}
559
560			var waypoint = new Waypoint({
561				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
562				element: el,
563				handler: function() {
564					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
565						anims_l = $anims.length;
566					$anims.each(function(_key_, _el_){
567						var $anim = $(_el_);
568
569						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
570							$anim.addClass('heading-text-highlight-animated');
571
572							if ( $heading.data('animate') === true ) {
573								$anim.css({
574									'-webkit-transition-duration': '0ms',
575									'-moz-transition-duration': '0ms',
576									'-o-transition-duration': '0ms',
577									'transition-duration': '0ms',
578								});
579							} else {
580								$anim.css({
581									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
582									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
583									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
584									'transition-delay': ((_key_ + 2) * 200) + 'ms',
585								});
586							}
587						}
588
589					});
590					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
591						$heading.data('animate', true);
592					});
593					$anims.removeAttr('data-animated');
594				},
595				offset: '100%'
596			});
597
598		});
599
600		Waypoint.refreshAll();
601		$( document.body ).trigger('uncode_waypoints');
602		if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
603			$(document).trigger('uncode-scrolltrigger-refresh');
604		}
605
606	}
607
608	requestTimeout(function(){
609		highlightStill();
610		$(window).on( 'wwResize', function(){
611			clearRequestTimeout(setCTA);
612			setCTA = requestTimeout( highlightStill, 100 );
613		});
614	}, 400);
615
616};
617
618UNCODE.isUnmodalOpen = false;
619
620var manageVideoSize = function(){
621
622	var setVideoFit;
623	$('.wp-block-embed').each(function(){
624
625		var $this = $(this);
626
627		if ( $('iframe', $this).length ) {
628
629			var $iframe = $('> iframe, > a > iframe', $this),
630				w = parseFloat($iframe.attr('width')),
631				h = parseFloat($iframe.attr('height')),
632				url = $iframe.attr('src'),
633				ratio, frW;
634
635			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
636
637				ratio = h / w;
638				var setResizeiFto,
639					resizeiFrame = function(){
640					frW = $iframe.width();
641					$iframe.css({
642						height: frW * ratio
643					});
644				};
645				resizeiFrame();
646				$(window).on( 'wwResize load', function(){
647					clearRequestTimeout(setResizeiFto);
648					setResizeiFto = requestTimeout( function() {
649						resizeiFrame();
650					}, 10 );
651				});
652
653			}
654
655		}
656
657	});
658
659};
660
661manageVideoSize();
662
663UNCODE.vivus = function(icon, time, delay, file) {
664	if (typeof Vivus !== 'undefined') {
665		var icon_options = {
666			type: 'delayed',
667			pathTimingFunction: Vivus.EASE_OUT,
668			animTimingFunction: Vivus.LINEAR,
669			duration: time,
670		}
671
672		if (delay) {
673			icon_options.delayStart = delay;
674		}
675
676		if (file) {
677			icon_options.file = file;
678		}
679
680		new Vivus(icon, icon_options);
681	}
682};
683
684UNCODE.lastURL = '';
685
686UNCODE.getURLParams = function(current_location, is_string) {
687	var params = {};
688	if (is_string) {
689		var url = current_location.split('?')[1];
690	} else {
691		var url = current_location.search;
692		url = url.substring(1);
693	}
694	if (url) {
695		var parts = url.split('&');
696		for (var i = 0; i < parts.length; i++) {
697			var nv = parts[i].split('=');
698			if (!nv[0]) {
699				continue;
700			}
701			params[nv[0]] = nv[1] || true;
702		}
703	}
704	return params;
705}
706
707UNCODE.hasEqualURLParams = function(obj1, obj2) {
708	for (var i in obj1) {
709		if (obj1.hasOwnProperty(i)) {
710			if (!obj2.hasOwnProperty(i)) {
711				return false;
712			}
713			if (obj1[i] != obj2[i]) {
714				return false;
715			}
716		}
717	}
718	for (var i in obj2) {
719		if (obj2.hasOwnProperty(i)) {
720			if (!obj1.hasOwnProperty(i)) {
721				return false;
722			}
723			if (obj1[i] != obj2[i]) {
724				return false;
725			}
726		}
727	}
728    return true;
729}
730
731UNCODE.magnetic = function(){
732	
733	$(document).on('mousemove', '.un-magnetic-zone', function(e){
734
735		var $zone = $(this),
736			zoneOff = $zone.offset(),
737			$mgntcEl = $('.un-magnetic-el', this),
738			elBound = this.getBoundingClientRect(),
739			maxSize = Math.max($zone.outerWidth(), $zone.outerHeight());
740
741		var Xvalue = e.pageX - (zoneOff.left + maxSize / 2),
742	  		Yvalue = e.pageY - (zoneOff.top + maxSize / 2);
743	  
744		$mgntcEl.each(function(key, val){
745			var magneticValue = $(val).attr('data-mgntc') || 0.5;
746		
747			val.animate({
748				transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)',
749			},{
750				duration: 500,
751				fill: 'forwards',
752			})
753	  	});
754	})
755	
756	$(document).on('mouseleave', '.un-magnetic-zone', function(e){
757		var $mgntcEl = $('.un-magnetic-el', this);
758
759		$mgntcEl.each(function(key, val){
760			val.animate({
761		  		transform: 'translate(0)',
762			},{
763		  		duration: 500,
764		  		fill: 'forwards',
765			})
766	  	});
767	})
768};
769
770
771UNCODE.rowParallax = function(){
772
773	if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) {
774		return;
775	}
776
777	var $rows = $('.parallax-move'),
778		stableHeight = UNCODE.wheight;
779	$rows.each(function(){
780		var $row = $(this),
781			_row = $row[0],
782			dataMove = $row.attr('data-parallax-move'),
783			dataSafe = $row.attr('data-parallax-safe'),
784            rowInViewport = false,
785			trans;
786
787		if ( $row.find('.parallax-move').length ) {
788			return;
789		}
790
791		dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe;
792		dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove;           
793        dataMove = dataMove / 10;
794
795        if ( 'IntersectionObserver' in window ) {
796			var observer = new IntersectionObserver(function(entries) {
797	
798				entries.forEach(function(entry){
799					if ( entry.isIntersecting ) {
800						rowInViewport = true;
801					} else {
802						rowInViewport = false;
803					}
804				});
805	
806			}, { 
807				root: document,
808			});
809	
810			observer.observe(_row);
811		} else {
812            rowInViewport = true;
813		}
814
815		var loopRAF = function() {
816			if( rowInViewport ) {
817				var bound = _row.getBoundingClientRect(),
818					bound_top = bound.top,
819					bound_height = bound.height,
820					move = true,
821					scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
822					docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
823						document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ),
824					fromBottom = docH - (scrolled + bound_top + bound_height);
825
826                if ( bound_height > stableHeight && dataSafe === 'yes' ) {
827                    $row.find('>div').css({
828                        'transform':'none'
829                    });
830                    move = false;
831				}
832
833				if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) {
834					$row.find('>div').css({
835						'transform':'none'
836					});
837					move = false;
838				}
839
840				if ( move ) {
841
842					if ( fromBottom < stableHeight ) {
843						//maybe Footer
844						trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove);
845                    } else if ( scrolled + bound_top < stableHeight ) {
846						//maybe Header
847						trans = scrolled*(dataMove);
848					} else {
849						trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove);
850					}
851
852                    $row.find('>div').css({
853                        'transform':'translateY(' + (trans) + 'px) translateZ(0)',
854                    });
855                }
856			}
857	
858			requestAnimationFrame(loopRAF);
859		};
860		
861		requestAnimationFrame(loopRAF);
862
863	});
864
865	$(window).on( 'load resize', function(e) {
866		if ( ! UNCODE.isMobile ) {
867			stableHeight = UNCODE.wheight;
868		}
869	});
870
871	$(window).on( 'load wwResize', function(e) {
872		if ( UNCODE.isMobile ) {
873			stableHeight = UNCODE.wheight;
874		}
875	});
876
877}
878
879UNCODE.changeSkinOnScroll = function(){
880	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
881		return;
882	}
883	var $masthead = $('#masthead'),
884		transDesktop,
885		transMobile,
886		changeSkin,
887
888	checkTransparencyAndChange = function( $col ){
889		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
890		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
891		changeSkin = $masthead.hasClass('menu-change-skin');
892
893		if ( ! transDesktop && ! transMobile ) {
894			return false;
895		}
896
897		if ( ! changeSkin ) {
898			return false;
899		}
900
901		if ( $col.hasClass('style-light') ){
902			$masthead.removeClass('style-dark-override').addClass('style-light-override');
903			return false;
904		} else if ( $col.hasClass('style-dark') ) {
905			$masthead.removeClass('style-light-override').addClass('style-dark-override');
906			return false;
907		}
908	};
909
910	var prev_row = 'normal',
911		odd = true,
912		$rows = $('.vc_row[data-parent]:visible:not(.overlay-menu *):not(#uncode-mobile-menu-block *):not(.block-wrapper-parent *)');
913	$.each($rows, function(index, row){
914		var $row = $(row),
915			$col = $('.uncol', $row).first(),
916			$slider = $('.uncode-slider', $row);
917
918		if ( $row.closest('li.menu-item').length ) {
919			return;
920		}
921
922		var wayDown = new Waypoint({
923			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
924			element: row,
925			handler: function(direction) {
926				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
927					if ( $slider.length ) {
928						$col = $('.owl-item.index-active .uncol', $slider).first();
929					}
930					checkTransparencyAndChange($col);
931				}
932				if ( odd === false ) {
933					if ( row.hasAttribute('data-bg-changer') ) {
934						prev_row = 'bg-changer';
935					} else {
936						prev_row = 'normal';
937					}
938					odd = true;
939				} else {
940					odd = false;
941				}
942			},
943			offset: function() {
944				return UNCODE.menuHeight / 2
945			}
946		});
947		var wayUp = new Waypoint({
948			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
949			element: row,
950			handler: function(direction) {
951				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
952					if ( $slider.length ) {
953						$col = $('.owl-item.index-active .uncol', $slider).first();
954					}
955					checkTransparencyAndChange($col);
956				}
957				if ( odd === false ) {
958					if ( row.hasAttribute('data-bg-changer') ) {
959						prev_row = 'bg-changer';
960					} else {
961						prev_row = 'normal';
962					}
963					odd = true;
964				} else {
965					odd = false;
966				}
967			},
968			offset: function() {
969				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
970			}
971		});
972	});
973
974};
975
976UNCODE.share = function() {
977	if (typeof Share !== 'undefined') {
978		var share_button_element = $('.share-button');
979		var share_button_url = share_button_element.data('url');
980
981		var share_button_config = {
982			ui: {
983				flyout: "top center",
984				button_font: false,
985				button_text: '',
986				icon_font: false
987			}
988		};
989
990		if (share_button_url) {
991			share_button_config.url = share_button_url.replace("&", "%26");
992		}
993
994		var share_button_top = new Share('.share-button', share_button_config);
995
996		$('li[data-network]', share_button_element).each(function(){
997			var label = SiteParameters.uncode_share_label,
998				network = $(this).attr('data-network');
999			label = label.replace("%", network);
1000			$(this).attr('aria-label', label);
1001		});
1002	}
1003};
1004
1005UNCODE.tooltip = function() {
1006	if (typeof jQuery.fn.tooltip !== 'undefined') {
1007		$('.btn-tooltip').tooltip();
1008	}
1009};
1010
1011UNCODE.counters = function() {
1012	var $counters = $('.uncode-counter:not(.counter-init)');
1013	$counters.each(function(){
1014		var $counter = $(this).addClass('counter-init');
1015		if ( SiteParameters.is_frontend_editor ) {
1016			$counter.addClass('started');
1017		}
1018		if ( $counter.closest( '.owl-carousel' ).length ) {
1019			return;
1020		}
1021		$counter.addClass('started').counterUp({
1022			delay: 10,
1023			time: 1500
1024		});
1025	});
1026};
1027
1028UNCODE.countdowns = function() {
1029	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
1030	$countdowns.each(function() {
1031		var $this = $(this).addClass('counter-init'),
1032			finalDate = $(this).data('uncode-countdown');
1033		$this.countdown(finalDate, function(event) {
1034			$this.html(event.strftime('<span>%D <small>' + SiteParameters.days + '</small></span> <span>%H <small>' + SiteParameters.hours + '</small></span> <span>%M <small>' + SiteParameters.minutes + '</small></span> <span>%S <small>' + SiteParameters.seconds + '</small></span>'));
1035		});
1036	});
1037};
1038
1039UNCODE.tabs = function() {
1040
1041	var tabSwitcher = function($el){
1042		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1042ical):not(.tab-switch)', $el).each(function(key, value){
1043			var $navs = $(value),
1044				$active = $('li.active', $navs),
1045				$active_a = $('> a', $active),
1046				$active_span = $('> span', $active_a),
1047				vertical = $navs.closest('.vertical-tab-menu').length;
1048			
1049			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
1050				$navs.append('<span class="switcher-cursor" aria-hidden="true" tabindex="-1" />');
1051			}
1052
1053			var $cursor = $('.switcher-cursor', $navs),
1054				active_w = $('a', $active).outerWidth(),
1055				span_w = $active_span.outerWidth(),
1056				active_pos = $active.position(),
1057				active_a_pos = $active_a.position(),
1058				span_pos = $active_span.position(),
1059				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
1060				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
1061
1062			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
1063
1064			if ( ! vertical ) {
1065				$cursor.css({
1066					left: cursor_left,
1067					width: cursor_w
1068				});
1069			}
1070
1071			$navs.addClass('switch-init');
1072		});
1073	};
1074
1075	var $body = $('body');
1076	tabSwitcher($body);
1077
1078	var tabHoverIntent = function(){
1079		var setHover;
1080		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
1081			.on('mouseover', function(e){
1082				var $this = $(e.target);
1083				setHover = requestTimeout(function() {
1084					$this.trigger('hover-int');
1085				}, 50);
1086			})
1087			.on('mouseout', function(){
1088				clearRequestTimeout(setHover);
1089			});
1090	};
1091	tabHoverIntent();
1092
1093	var tabInit = function(){
1094		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
1095			e.preventDefault()
1096			var $el = $(this);
1097			$el.tab('show');
1098			var $container = $el.closest('.uncode-tabs');
1099			tabSwitcher($container);
1100			requestTimeout(function() {
1101				window.dispatchEvent(UNCODE.boxEvent);
1102				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
1103
1104				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
1105					window.dispatchEvent(new CustomEvent('boxResized'));
1106				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
1107					window.dispatchEvent(new Event('resize'));
1108					$(window).trigger('uncode.re-layout');
1109				} 
1110
1111				var $active_panel = $('.tab-pane.active', $tabs);
1112
1113				$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) {
1114					var element = $(val),
1115						delayAttr = element.attr('data-delay');
1116					if (delayAttr == undefined) delayAttr = 0;
1117					requestTimeout(function() {
1118						element.addClass('start_animation');
1119					}, delayAttr);
1120				});
1121
1122			}, 300);
1123
1124			var $tabs = $(e.currentTarget).closest('.uncode-tabs'),
1125				$non_active_panel = $('.tab-pane:not(.active)', $tabs);
1126			$.each($('.start_animation:not(.t-inside):not(.drop-image-separator)', $non_active_panel), function(index, val) {
1127				var element = $(val);
1128				element.removeClass('start_animation');
1129			});
1130
1131			var $li = $el.closest('li'),
1132				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1133			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1134			$('.tab-pane', $li).slideDown(250);
1135			var completeSlideDown = requestTimeout(function(){
1136				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1137					var pos = $el.offset(),
1138						rect = $el[0].getBoundingClientRect(),
1139						$masthead = $('#masthead > .menu-container'),
1140						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1141
1142					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1143						$('html, body').animate({
1144							scrollTop: ( pos.top ) - considerMenu
1145						},{
1146							easing: 'easeInOutQuad',
1147							duration: 250
1148						});
1149					}
1150				}
1151			}, 260);
1152		});
1153	}
1154	tabInit();
1155
1156	var tabResponsive = function(){
1157		if ( SiteParameters.is_frontend_editor ) {
1158			return true;
1159		}
1160		var $tabContainers = $('.tab-container.tabs-breakpoint');
1161		$tabContainers.each(function(){
1162			var $tabContainer = $(this),
1163				$tabContent = $('.tab-content', $tabContainer),
1164				$nav = $('.nav-tabs', $tabContainer),
1165				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1166
1167			$('> li', $nav).each(function(){
1168				var $li = $(this),
1169					dataID = $li.attr('data-tab-id');
1170
1171				if ( UNCODE.wwidth <= mQuery ) {
1172					if ( ! $('.tab-pane', $li ).length ) {
1173						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1174						$tabContainer.addClass('tabs-appended');
1175						$li.append($append_pane);
1176					}
1177
1178					if ( $li.hasClass('active') ) {
1179						$('> a', $li).triggerHandler('click.bs.tab.data-api');
1180					}
1181				} else {
1182					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1183						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1184						$tabContainer.removeClass('tabs-appended');
1185						$tabContent.prepend($append_pane.removeAttr('style'));
1186					}
1187				}
1188			});
1189		});
1190
1191	}
1192	tabResponsive();
1193
1194	$(window).on('wwResize', function(){
1195		tabHoverIntent();
1196		tabSwitcher($body);
1197	});
1198
1199	var setCTA;
1200	$(window).on( 'resize', function(){
1201		clearRequestTimeout(setCTA);
1202		setCTA = requestTimeout( tabResponsive, 100 );
1203	});
1204
1205	$('.nav-tabs').each(function(){
1206		var $nav = $(this),
1207			$lis = $('> li:not(.active)', $nav),
1208			$links = $('.tab-excerpt-link', $nav);
1209		$('.tab-excerpt', $lis).slideUp(400, function(){
1210			$(this).addClass('init');
1211		});
1212
1213		$links.each(function(){
1214			var $link = $(this),
1215				$par_a = $link.closest('a'),
1216				href = $link.attr('data-href'),
1217				target = $link.attr('data-target');
1218			$par_a.addClass('inner-link');
1219			$link.on('click', function(){
1220				var _link = document.createElement('a');
1221				_link.href = href;
1222				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1223				_link.click();
1224			});
1225		});
1226		$nav.addClass('tab-init');
1227	});
1228
1229	$('.uncode-tabs.tabs-no-lazy').each(function(){
1230		var $tabs = $(this),
1231			$panes = $('.tab-pane:not(.active)', $tabs);
1232		$panes.each(function(){
1233			var $pane = $(this),
1234				$imgs = $('img[loading="lazy"]', $pane);
1235			$imgs.removeAttr('loading');
1236			$imgs.removeAttr('decoding');
1237		});
1238	});
1239
1240};
1241UNCODE.collapse = function() {
1242	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1243		var $this = $(this),
1244			href
1245		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1246		var $target = $(target)
1247		var parent = $this.attr('data-parent')
1248		var $parent = parent && $(parent)
1249		var $title = $(this).parent()
1250		var $accordion = $(e.target).closest('.uncode-accordion')
1251		var $group = $this.closest('.group')
1252		var $panel_group = $this.closest('.panel-group')
1253		if ($parent) {
1254			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1255			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1256				$title.removeClass('active');
1257				$group.removeClass('active-group');
1258			} else {
1259				if ( $panel_group.attr('data-no-toggle') != true ) {
1260					$parent.find('.panel-title').removeClass('active')
1261					$parent.find('.group').removeClass('active-group')
1262				}
1263				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1264				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1265			}
1266		}
1267		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1268		requestTimeout(function() {
1269			var $accordion = $(e.target).closest('.uncode-accordion');
1270			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1271			  window.dispatchEvent(new CustomEvent('boxResized'));
1272			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1273				window.dispatchEvent(new Event('resize'));
1274				$(window).trigger('uncode.re-layout');
1275			} 
1276
1277			var $active_panel = $('.panel.active-group', $parent);
1278
1279			$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) {
1280				var element = $(val),
1281					delayAttr = element.attr('data-delay');
1282				if (delayAttr == undefined) delayAttr = 0;
1283				requestTimeout(function() {
1284					element.addClass('start_animation');
1285				}, delayAttr);
1286			});
1287
1288		}, 500);
1289
1290		$group.find('.panel-title:not(.active) > a').trigger('blur');
1291
1292	});
1293
1294	$('.uncode-accordion.tabs-no-lazy').each(function(){
1295		var $accordion = $(this),
1296			$panes = $('.panel:not(.active-group)', $accordion);
1297		$panes.each(function(){
1298			var $pane = $(this),
1299				$imgs = $('img[loading="lazy"]', $pane);
1300			$imgs.removeAttr('loading');
1301			$imgs.removeAttr('decoding');
1302		});
1303	});
1304};
1305
1306UNCODE.accessibility = function() {
1307    if ( ! SiteParameters.uncode_is_accessible ) {
1308        return;
1309    }
1310
1311    //
1312
1313};
1314UNCODE.bigText = function(el) {
1315	var bigTextLaunch = function(){
1316		if (el == undefined) {
1317			el = $('body');
1318		}
1319		$.each($('.bigtext', el), function(index, val) {
1320			$(val).bigtext({
1321				minfontsize: 24
1322			});
1323			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1324				opacity: 1
1325			});
1326			requestTimeout(function() {
1327				if ($(val).find('.animate_when_almost_visible').length != 0) {
1328					$(val).css({opacity: 1});
1329				}
1330			}, 400);
1331		});
1332	};
1333
1334	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1335		bigTextLaunch();
1336	}
1337	$(window).on( 'load', bigTextLaunch );
1338};
1339
1340UNCODE.process_shortpixel_image = function(image) {
1341	var data = {
1342		action: 'shortpixel_manual_optimization',
1343		image_id: image,
1344		cleanup: true
1345	};
1346
1347	$.get(SiteParameters.ajax_url, data);
1348};
1349
1350UNCODE.animateSubInside = function( _this, remove ){
1351	if ( typeof remove !== 'undefined' && remove === true ) {
1352		$(document).trigger('sub-menu-slide-up');
1353		$('.animate_when_almost_visible, .translate_when_almost_visible', _this).each(function(){
1354			$(this).removeClass('start_animation').css({ 'animation-delay': '0s', 'transition-delay': '0s'});
1355		});
1356	} else {
1357		$.each($('.translate_when_almost_visible:not(.start_animation), .animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', _this), function(index, val) {
1358			var element = $(val),
1359				delayAttr = element.attr('data-delay');
1360			if (delayAttr == undefined) delayAttr = 0;
1361			element.css({ 'animation-delay': delayAttr + 'ms', 'transition-delay': delayAttr + 'ms'});
1362			element.addClass('start_animation');
1363		});
1364		document.dispatchEvent(new CustomEvent('sub-menu-slide-down'));
1365	}
1366};
1367
1368
1369UNCODE.menuSystem = function() {
1370
1371	function menuMobile() {
1372		var $body = $('body'),
1373			scrolltop,
1374			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile:not(.vc_element)'),
1375			$masthead = $('#masthead'),
1376			$menuBlock = $('#uncode-mobile-menu-block'),
1377			$box,
1378			$el,
1379			$el_transp,
1380			elHeight,
1381			offCanvasAnim,
1382			check,
1383			animating = false,
1384			stickyMobile = false,
1385			menuClose = new CustomEvent('menuMobileClose'),
1386			menuOpen = new CustomEvent('menuMobileOpen');
1387		UNCODE.menuOpened = false;
1388		$mobileToggleButton.on('click', function(event) {
1389			event.stopPropagation();
1390			var btn = this;
1391			if ($(btn).hasClass('overlay-close')) return;
1392			event.preventDefault();
1393			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1394			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1395				$box = $(this).closest('.box-container').find('.main-menu-container:not(.no-mobile):not(.main-wrapper *)');
1396				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand):not(.main-wrapper *), .menu-sidebar-inner:not(.main-wrapper *)');
1397				$el_transp = $('.menu-absolute.menu-transparent');
1398				if (UNCODE.isMobile) {
1399					if ( $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical, .menu-mobile-centered, .menu-sticky-mobile').length ) {
1400						stickyMobile = true;
1401						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1402					} else {
1403						elHeight = 0;
1404						$.each($box.find('> div'), function(index, val) {
1405							elHeight += $(val).outerHeight();
1406						});
1407					}
1408				} else {
1409					elHeight = 0;
1410					$.each($el, function(index, val) {
1411						elHeight += $(val).outerHeight();
1412					});
1413				}
1414				var open = function() {
1415					clearTimeout(offCanvasAnim);
1416					if (!animating) {
1417						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1418						scrolltop = $(window).scrollTop();
1419						window.dispatchEvent(menuOpen);
1420						animating = true;
1421						UNCODE.menuOpened = true;
1422						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1423							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1424								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1425							}
1426							if ($('body.menu-offcanvas').length) {
1427								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1428								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1429							} else {
1430								if ( $('.menu-hide, .menu-sticky').length ) {
1431									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1432										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1433									}
1434								}
1435							}
1436						}
1437						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1438							//$("#masthead")[0].scrollIntoView();
1439							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + 
1439UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1440						}
1441						$box.addClass('open-items');
1442						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1443							$el_transp.addClass('is_mobile_open');
1444						}
1445						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1446							btn.classList.add('close');
1447							$box.animate({
1448								height: elHeight
1449							}, 600, "easeInOutCirc", function() {
1450								animating = false;
1451								if (!stickyMobile) $box.css('height', 'auto');
1452							});
1453						} else {
1454							animating = false;
1455						}
1456
1457						if ( $menuBlock.length ) {
1458							UNCODE.animateSubInside($menuBlock);
1459						}
1460					}
1461				};
1462
1463				var close = function() {
1464					clearTimeout(offCanvasAnim);
1465					if (!animating) {
1466						window.dispatchEvent(menuClose);
1467						animating = true;
1468						UNCODE.menuOpened = false;
1469						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1470							btn.classList.remove('close');
1471							btn.classList.add('closing');
1472						}
1473						$box.addClass('close');
1474						requestTimeout(function() {
1475							$box.removeClass('close');
1476							$box.removeClass('open-items');
1477							btn.classList.remove('closing');
1478							if ($el_transp.length) {
1479								$el_transp.removeClass('is_mobile_open');
1480							}
1481						}, 500);
1482						$body.removeClass('opening-overlay-menu');
1483						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1484							$box.animate({
1485								height: 0
1486							}, {
1487								duration: 600,
1488								easing: "easeInOutCirc",
1489								complete: function(elements) {
1490									$(elements).css('height', '');
1491									animating = false;
1492									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1493										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1494									}
1495									$body.removeClass('open-overlay-menu');
1496									if ( $menuBlock.length ) {
1497										UNCODE.animateSubInside($menuBlock, true);
1498									}
1499								}
1500							});
1501						} else {
1502							animating = false;
1503							offCanvasAnim = setTimeout(function(){
1504								$body.removeClass('open-overlay-menu');
1505								if ( $menuBlock.length ) {
1506									UNCODE.animateSubInside($menuBlock, true);
1507								}
1508							}, 1000);
1509						}
1510					}
1511				};
1512				check = (!UNCODE.menuOpened) ? open() : close();
1513			}
1514		});
1515
1516		$('html').on('click', function(event){
1517			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1518				$('.uncode-close-offcanvas-mobile:visible').trigger('click');
1519			}
1520		});
1521
1522		window.addEventListener('menuMobileTrigged', function(e) {
1523			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1524		});
1525		window.addEventListener('orientationchange', function(e) {
1526			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1527		});
1528		window.addEventListener("resize", function() {
1529			if ($(window).width() < UNCODE.mediaQuery) {
1530				if (UNCODE.isMobile) {
1531					var $box = $('.box-container .main-menu-container'),
1532						$el = $('.box-container .menu-horizontal-inner:not(.no-mobile), .box-container .menu-sidebar-inner:not(.no-mobile)');
1533					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1534						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1535							elHeight = 0;
1536							$.each($el, function(index, val) {
1537								elHeight += $(val).outerHeight();
1538							});
1539							elHeight = window.innerHeight - $('.menu-wrapper.menu-sticky .menu-container .row-menu-inner, .menu-wrapper.menu-hide-only .menu-container .row-menu-inner').height() - (UNCODE.bodyBorder * 2) + 1;
1540							$($box).css('height', elHeight + 'px');
1541						}
1542					}
1543				}
1544			} else {
1545				$('.menu-hide-vertical').removeAttr('style');
1546				$('.menu-container-mobile').removeAttr('style');
1547				$('.vmenu-container.menu-container').removeAttr('style');
1548
1549				if ( UNCODE.menuOpened ) {
1550					$('.open-items').removeClass('open-items');
1551					$('.is_mobile_open').removeClass('is_mobile_open');
1552					$('.open-overlay-menu').removeClass('open-overlay-menu');
1553					$('.opening-overlay-menu').removeClass('opening-overlay-menu');
1554				}
1555			}
1556		});
1557
1558		$(window).on('scroll', function(){
1559			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1560				$(window).scrollTop(scrolltop);
1561				return false;
1562			}
1563		});
1564
1565	};
1566
1567	function menuOffCanvas() {
1568		var menuClose = new CustomEvent('menuCanvasClose'),
1569			menuOpen = new CustomEvent('menuCanvasOpen');
1570		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1571			if ($(window).width() > UNCODE.mediaQuery) {
1572				if ( $('body.vmenu-offcanvas-overlay').length ) {
1573					if ($(event.currentTarget).hasClass('off-close')) {
1574						$(event.currentTarget).removeClass('off-close');
1575						requestTimeout(function() {
1576							window.dispatchEvent(menuClose);
1577						}, 500);
1578
1579					} else {
1580						$(event.currentTarget).addClass('off-close');
1581						window.dispatchEvent(menuOpen);
1582					}
1583				} else {
1584					if ($(event.currentTarget).hasClass('close')) {
1585						$(event.currentTarget).removeClass('close');
1586						$(event.currentTarget).addClass('closing');
1587						requestTimeout(function() {
1588							$(event.currentTarget).removeClass('closing');
1589							window.dispatchEvent(menuClose);
1590						}, 500);
1591
1592					} else {
1593						$(event.currentTarget).addClass('close');
1594						window.dispatchEvent(menuOpen);
1595					}
1596				}
1597			}
1598
1599			$('body').toggleClass('off-opened');
1600		});
1601
1602		$('body').on('click.menu-off-canvas-mobile', function(e){
1603			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1604				var $vMenuCont = $('#masthead .vmenu-container'),
1605					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1606
1607					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1608					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1609					vmenu_off = $vMenuCont.offset(),
1610					vmenu_l = parseFloat(vmenu_off.left),
1611					vmenu_t = parseFloat(vmenu_off.top),
1612					vmenu_r = vmenu_l + vmenu_w,
1613					vmenu_b = vmenu_t + vmenu_h,
1614
1615					close_h = parseFloat( $close_menu.outerHeight() ),
1616					close_w = parseFloat( $close_menu.outerWidth() ),
1617					close_off = $close_menu.offset(),
1618					close_l = parseFloat(close_off.left),
1619					close_t = parseFloat(close_off.top),
1620					close_r = close_l + close_w,
1621					close_b = close_t + close_h;
1622				if (
1623					!(
1624						e.clientX > vmenu_l &&
1625						e.clientX < vmenu_r
1626					)
1627					||
1628					(
1629						e.clientX > close_l &&
1630						e.clientX < close_r
1631					)
1632				) {
1633					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1634				}
1635			}
1636		});
1637	};
1638
1639	function menuOverlay() {
1640		if ( $('.overlay').length ) {
1641			$('.overlay').removeClass('hidden');
1642		}
1643		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1644			$('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li, .uncode-menu-additional-text').each(function(index, el) {
1645				var transDelay = (index / 20) + 0.1;
1646				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1647					transDelay = transDelay + 0.3;
1648				$(this)[0].setAttribute('style', '-webkit-transition-delay:' + transDelay + 's; -moz-transition-delay:' + transDelay + 's; -ms-transition-delay:' + transDelay + 's; -o-transition-delay:' + transDelay + 's; transition-delay:' + transDelay + 's');
1649			});
1650		}
1651	};
1652
1653	function menuToggleAnimation() {
1654		var $block = $('body'),
1655			$menuBlocks = $('.menu.unmenu-block', $block),
1656			$allSeqs = $('[data-delay-seq]', $block);
1657
1658		$allSeqs.each(function(key, seq){
1659			$(seq).removeAttr('data-delay');
1660		});
1661
1662		$menuBlocks.each(function(key, menu){
1663
1664			var $animatesHidden = $('.translate_when_almost_visible', menu).filter(':hidden');
1665			$animatesHidden.each(function(key_, seq){
1666				$(seq).removeClass('translate_when_almost_visible').addClass('not_translate_when_almost_visible');
1667			});
1668
1669			var $animatesVisibile = $('.not_translate_when_almost_visible', menu).filter(':visible');
1670			$animatesVisibile.each(function(key_, seq){
1671				$(seq).removeClass('not_translate_when_almost_visible').addClass('translate_when_almost_visible');
1672			});
1673
1674			var $delaySequentials = $('[data-delay-seq]', menu).filter(':visible'),
1675				delay = parseFloat( $delaySequentials.first().attr('data-delay-seq') ),
1676				interval = parseFloat( $delaySequentials.first().attr('data-interval') );
1677			$delaySequentials.each(function(_key, seq){
1678				$(seq).attr('data-delay', delay + (interval*_key));
1679			});
1680		});
1681	}
1682	//menuToggleAnimation();
1683	$(document).on('unblock-toggles-init', menuToggleAnimation);
1684
1685	var $secondary_parent;
1686	function menuAppend() {
1687
1688		var $menuBlock = $('#uncode-mobile-menu-block').length;
1689		if ( $menuBlock ) {
1690			return;
1691		}
1692		var $body = $('body'),
1693			$menuCont = $('.menu-container:not(.vmenu-container)'),
1694			$vMenuCont = $('.menu-container.vmenu-container'),
1695			$cta = $('.navbar-cta'),
1696			$socials = $('.navbar-social:not(.appended-navbar)'),
1697			$ul = $('.navbar-main ul.menu-primary-inner'),
1698			$ulCta,
1699			$ulSocials,
1700			$navLast,
1701			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1702			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1703			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1704			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1705			$ulFirst = $('> ul', $firstNav),
1706			setCTA,
1707			appendCTA = function(){
1708				return true;
1709			},
1710			appendSocials = function(){
1711				return true;
1712			},
1713			appendSplit = function(){
1714				return true;
1715			};
1716
1717		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1718			$ulCta = $('> ul', $cta);
1719			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1720
1721			appendCTA = function(){
1722				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1723					$ul.after($ulCta);
1724				} else {
1725					$cta.append($ulCta);
1726				}
1727			}
1728		}
1729
1730		if ( ! $body.hasClass('cta-not-appended') ) {
1731			appendCTA();
1732		}
1733
1734		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1735		$smartSocial.each(function(){
1736			var $_smartSocial = $(this);
1737			$('> li', $_smartSocial).each(function(){
1738				var $li = $(this);
1739				if ( $li.hasClass('mobile-hidden') ) {
1740					$_smartSocial.addClass('mobile-hidden');
1741				} else {
1742					$_smartSocial.removeClass('mobile-hidden');
1743					return false;
1744				}
1745			});
1746
1747			$('> li', $_smartSocial).each(function(){
1748				var $li = $(this);
1749				if ( $li.hasClass('tablet-hidden') ) {
1750					$_smartSocial.addClass('tablet-hidden');
1751				} else {
1752					$_smartSocial.removeClass('tablet-hidden');
1753					return false;
1754				}
1755			});
1756		});
1757
1758		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1759			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1760			if ( $body.hasClass('hmenu-center-split') ) {
1761				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1762			} else {
1763				$navLast = $('.navbar-nav-last', $vMenuCont);
1764			}
1765
1766			if ( ! $navLast.length ) {
1767				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1768				if ( $body.hasClass('hmenu-center-split') ) {
1769					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1770					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1771				} else {
1772					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1773					$navLast = $('.navbar-nav-last', $vMenuCont);
1774				}
1775			}
1776
1777			appendSocials = function(){
1778				if ( !$body.hasClass('menu-overlay-center') ) {
1779				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1780				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1781				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1782				// 		$ulSocials.each(function(){
1783				// 			var $li_social = $(this);
1784				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1785				// 		});
1786				// 	}
1787				// } else {
1788					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1789						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1790						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1791							$('> ul.menu-smart-social li', $socials).remove();
1792						}
1793						$navLast.append($ulSocials);
1794					} else {
1795						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1796							$('> ul.menu-smart-social li', $navLast).remove();
1797						}
1798						$socials.append($ulSocials);
1799					}
1800				}
1801			}
1802			appendSocials();
1803		}
1804
1805		if ( $vMenuCont.length ) {
1806			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1807		} else {
1808			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1809		}
1810		if ( $accordion_secondary.length ) {
1811			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1812			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1813				if ( !$accordion_secondary_ph.length ) {
1814					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1815				}
1816				if ( $vMenuCont.length ) {
1817					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1818				} else {
1819					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1820						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1821					} else {
1822						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1823					}
1824				}
1825			} else {
1826				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1827					$accordion_secondary_ph.before($accordion_secondary);
1828				}
1829			}
1830		}
1831
1832		if ( $vMenuCont.length ) {
1833			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1834		} else {
1835			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1836		}
1837
1838		if ( $extra_icons.length ) {
1839			if ( $vMenuCont.length ) {
1840				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1841					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1842						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1843							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1844						$not_social.each(function(){
1845							if ( ! $primary_after.length ) {
1846								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1847								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1848								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1849							}
1850							var $extra_li = $(this);
1851							$primary_after.find('> ul').append($extra_li);
1852						});
1853					} else {
1854						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1855							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1856						$not_social.each(function(){
1857							var $extra_li = $(this);
1858							$extra_icons.find('> ul').append($extra_li);
1859						});
1860					}
1861				} /*else {
1862					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1863					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1864						if ( !$extra_icons_ph.length ) {
1865							$extra_icons.after('<span class="extra-icons-ph" />');
1866						}
1867						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1868							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1869						} else {
1870							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1871						}
1872					} else {
1873						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1874							$extra_icons_ph.before($extra_icons);
1875						}
1876					}
1877				}*/
1878			} else {
1879				if ( ! $body.hasClass('hmenu-center-double') ) {
1880					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1881						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1882							$primary_after = $('.nav.navbar-main-after', $menuCont);
1883
1884						if ( ! $primary_after.length && $not_social.length ) {
1885							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1886								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1887							} else {
1888								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1889							}
1890							$primary_after = $('.nav.navbar-main-after', $menuCont);
1891							$primary_after.append('<ul class="menu-smart sm menu-smart-social" role="menu" />');
1892						}
1893						var tablet_hidden = true,
1894							mobile_hidden = true;
1895						$not_social.each(function(){
1896							var $extra_li = $(this);
1897							$primary_after.find('> ul').append($extra_li);
1898							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1899								tablet_hidden = false;
1900							}
1901							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1902								mobile_hidden = false;
1903							}
1904						});
1905						if ( tablet_hidden === true && $not_social.length ) {
1906							$primary_after.addClass('tablet-hidden');
1907						}
1908						if ( mobile_hidden === true && $not_social.length ) {
1909							$primary_after.addClass('mobile-hidden');
1910						}
1911					} else {
1912						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1913
1914						if ( $primary_after.length ) {
1915							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1916							$not_social.each(function(){
1917								var $extra_li = $(this);
1918								$extra_icons.find('> ul').append($extra_li);
1919							});
1920							$primary_after.remove();
1921						}
1922					}
1923				}
1924			}
1925		}
1926
1927		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1928			appendSplit = function(){
1929				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1930					if ( $extra_icons.length ) {
1931						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1932							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1933								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1934							$not_social.each(function(){
1935								var $extra_li = $(this);
1936								$append_ul.append($extra_li);
1937							});
1938							if ( $secondNav.length ) {
1939								$secondNav.append($append_ul);
1940							} else {
1941								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1942							}
1943						}
1944					}
1945					if ( $secondNav.length ) {
1946						$secondNav.prepend($ulFirst);
1947					} else {
1948						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1949					}
1950					$firstMenu.hide();
1951				} else {
1952					$firstNav.append($ulFirst);
1953					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1954					if ( $append_ul.length ) {
1955						var $not_social = $('> li:not(.social-icon)', $append_ul);
1956						$not_social.each(function(){
1957							var $extra_li = $(this);
1958							$extra_icons.find('> ul').append($extra_li);
1959						});
1960					}
1961					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1962					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1963					$firstMenu.css({
1964						'display': 'table-cell'
1965					});
1966				}
1967			}
1968		}
1969		appendSplit();
1970
1971		$(window).on( 'wwResize', function(){
1972			clearRequestTimeout(setCTA);
1973			setCTA = requestTimeout( function() {
1974				appendCTA();
1975				appendSocials();
1976				appendSplit();
1977			}, 10 );
1978		});
1979	}
1980	//menuMobileButton();
1981	menuMobile();
1982	menuOffCanvas();
1983	menuAppend();
1984	menuOverlay();
1985
1986	var stickyDropdownSearch = function(){
1987		var $masthead = $('#masthead'),
1988			$ddSearch = $('.overlay.overlay-search', $masthead),
1989			$styles = $('#stickyDropdownSearch').remove();
1990		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1991			var $menuWrapper = $('.menu-wrapper'),
1992				$navbar = $('.menu-container-mobile', $menuWrapper),
1993				navbarH = $navbar.outerHeight(),
1994				//$topbar = $('.top-menu', $menuWrapper),
1995				//topbarH = $topbar.outerHeight(),
1996				_css;
1997
1998			_css = '<style id="stickyDropdownSearch">';
1999			_css += '@media (max-width: 959px) {';
2000			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
2001			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
2002			_css += '}';
2003			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
2004			_css += 'position: fixed;';
2005			_css += 'top: 0;';
2006			_css += '}';
2007			_css += '</style>';
2008
2009			$(_css).appendTo($('head'));
2010		}
2011	}
2012	stickyDropdownSearch();
2013
2014	var setMenuOverlay;
2015	$(window).on( 'wwResize', function(){
2016		if ( $('.overlay').length && $(window).width() > 1024 ) {
2017			$('.overlay').addClass('hidden');
2018		}
2019		clearRequestTimeout(setMenuOverlay);
2020		setMenuOverlay = requestTimeout( function(){
2021			menuOverlay();
2022			menuAppend();
2023			stickyDropdownSearch();
2024		}, 150 );
2025	});
2026	UNCODE.menuMegaBlock();
2027	UNCODE.menuSmartInit();
2028	$(window).on('wwResize', function(){
2029		UNCODE.menuSmartInit();
2030	});
2031
2032	$(window).on('menuOpen', function(){
2033		var $overlay = $('.overlay.overlay-unblock');
2034		if ( $overlay.length ) {
2035			UNCODE.animateSubInside($overlay);
2036		}
2037	});
2038
2039	$(window).on('menuClosed', function(){
2040		var $overlay = $('.overlay.overlay-unblock');
2041		if ( $overlay.length ) {
2042			UNCODE.animateSubInside($overlay, true);
2043			var $smartMenus = $overlay.find('.menu-smart');
2044			$smartMenus.each(function(key, smartMenu){
2045				$(smartMenu).smartmenus('menuHideAll');
2046			});
2047		}
2048	});
2049};
2050
2051UNCODE.menuSmartInit = function() {
2052	var $menusmart = $('[class*="menu-smart"]'),
2053		$masthead = $('#masthead'),
2054		$hMenu = $('.menu-horizontal-inner', $masthead),
2055		$focus = $('.overlay-menu-focus'),
2056		$uls_anim = $('> li> ul[role="menu"]', $menusmart),
2057		showTimeout = 50,
2058		hideTimeout = 50,
2059		showTimeoutFunc, hideTimeoutFunc, subMenuRT;
2060
2061	if ( typeof $masthead.attr('data-menu-anim') !== 'undefined' && $masthead.attr('data-menu-anim') !== '' ) {
2062		var menu_anim = $masthead.attr('data-menu-anim');
2063		if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
2064			$uls_anim.each(function(){
2065				var $ul_anim = $(this);
2066				if ( !$('> li[data-block]', $ul_anim).length ) {
2067					$ul_anim.addClass('animate_when_almost_visible');
2068					$ul_anim.addClass(menu_anim);
2069				} else {
2070					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2071					if ( dataB !== 'no-anim' && !dataB.includes('slight-anim') ) {
2072						$ul_anim.addClass('animate_when_almost_visible');
2073						$ul_anim.addClass(dataB);
2074					}
2075				}
2076			});
2077		} else {
2078			$uls_anim.each(function(){
2079				var $ul_anim = $(this);
2080				if ( !$('> li[data-block]', $ul_anim).length ) {
2081					$ul_anim.removeClass('animate_when_almost_visible');
2082					$ul_anim.removeClass(menu_anim);
2083				} else {
2084					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2085					$ul_anim.removeClass('animate_when_almost_visible');
2086					$ul_anim.removeClass(dataB);
2087				}
2088			});
2089		}
2090	}
2091
2092	$('> li.menu-item-has-children', $menusmart).hover(function(){
2093		$(this).data('hover', true);
2094	}, function(){
2095		$(this).data('hover', false);
2096	});
2097
2098	$('> li.menu-item-has-children', $menusmart).each(function(){
2099		var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
2100	});
2101
2102	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
2103		e.preventDefault();
2104	});
2105
2106	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
2107			
2108		var $notLis = $('> .nav > ul > li a', $hMenu),
2109			$menuA = $('a', $masthead).not($notLis),
2110			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
2111			showFuncCond = function() { return true };
2112
2113		if ( $('body').hasClass('focus-megamenu') ) {
2114			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.need-focus');
2115			showFuncCond = function($ul) { return $ul.hasClass('need-focus') };
2116		} else if ( $('body').hasClass('focus-links') ) {
2117			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
2118		}
2119
2120		$hoverSelector.hover(function(){
2121			clearRequestTimeout(hideTimeoutFunc);
2122			showTimeoutFunc = requestTimeout(function(){
2123				$('body').addClass('navbar-hover');
2124			}, showTimeout*2);
2125		}, function(){
2126			hideTimeoutFunc = requestTimeout(function(){
2127				if ( ! $('.overlay-search.open', $masthead).length ) {
2128					$('body').removeClass('navbar-hover');
2129				}
2130			}, hideTimeout*2);
2131		});
2132	} else {
2133		showFuncCond = function() { return false };
2134	}
2135
2136	if ($menusmart.length > 0) {
2137		var objShowTimeout;
2138		$menusmart.smartmenus({
2139			subIndicators: false,
2140			subIndicatorsPos: 'append',
2141			//subMenusMinWidth: '13em',
2142			showOnClick: SiteParameters.menuShowOnClick,
2143			subIndicatorsText: '',
2144			showTimeout: showTimeout,
2145			hideTimeout: hideTimeout,
2146			scrollStep: 8,
2147			showFunction: function($ul, complete) {
2148				$(document).trigger('un-menu-show', $ul);
2149				clearRequestTimeout(showTimeoutFunc);
2150				$ul.fadeIn(0, 'linear', function(){
2151					complete();
2152					if ( $ul.hasClass('vc_row') ) {
2153						$ul.css({
2154							'display': 'table'
2155						});
2156					}
2157					if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') ) {
2158						$('body').addClass('open-megamenu');
2159					}
2160					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
2161						$('body').addClass('navbar-hover');
2162					}
2163					var showed = 0;
2164					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(index, val){
2165						var $element = $(this),
2166							delayAttr = $element.attr('data-delay');
2167						if ( !$element.closest('.owl-carousel').length && ! $element.closest('.cssgrid-animate-sequential').length ) {
2168							if (delayAttr == undefined) delayAttr = 0;
2169							requestTimeout(function() {
2170								$element.addClass('start_animation');
2171							}, delayAttr);
2172						} else if ( $element.closest('.cssgrid-animate-sequential').length ) {
2173							var grid = $element.closest('.cssgrid-animate-sequential');
2174
2175							var delay = index,
2176								delayAttr = parseInt($element.attr('data-delay'));
2177							if (isNaN(delayAttr)) delayAttr = 100;
2178							delay -= showed;
2179							objShowTimeout = requestTimeout(function() {
2180								$element.removeClass('zoom-reverse').addClass('start_animation');
2181								showed = index;
2182							}, delay * delayAttr);
2183						}
2184					});
2185					if ( $ul.is('.animate_when_almost_visible') ) {
2186						$ul.addClass('start_animation');
2187					}
2188				}).addClass('open-animated');
2189			},
2190			hideFunction: function($ul, complete) {
2191				if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') && ! $('.overlay-search.open', $masthead).length ) {
2192					$('body').removeClass('open-megamenu');
2193				}
2194				var fixIE = $('html.ie').length;
2195				if (fixIE) {
2196					var $rowParent = $($ul).closest('.main-menu-container');
2197					$rowParent.height('auto');
2198				}
2199				$ul.fadeOut(0, 'linear', function(){
2200					complete();
2201					$ul.removeClass('open-animated');
2202					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
2203						$('body').removeClass('open-submenu');
2204					}
2205					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(){
2206						$(this).removeClass('start_animation');
2207					});
2208					if ( $ul.is('.animate_when_almost_visible') ) {
2209						$ul.removeClass('start_animation');
2210					}
2211				});
2212				$ul.find('.start_animation').each(function(index, val) {
2213					clearRequestTimeout(subMenuRT);
2214					$(val).removeClass('start_animation');
2215				});
2216				$(document).trigger('un-menu-hide', $ul);
2217				clearRequestTimeout(objShowTimeout);
2218			},
2219			collapsibleShowFunction: function($ul, complete) {
2220				$ul.slideDown(400, 'easeInOutCirc', function(){
2221					UNCODE.animateSubInside($ul);
2222					complete();
2223				});
2224			},
2225			collapsibleHideFunction: function($ul, complete) {
2226				$ul.slideUp(200, 'easeInOutCirc', function(){
2227					complete();
2228				});
2229				$(document).trigger('sub-menu-slide-up');
2230			},
2231			hideOnClick: SiteParameters.menuHideOnClick,
2232		});
2233
2234		if ( $('body').hasClass('menu-accordion-active') ) {
2235			$menusmart.each(function(key, menu){
2236				$(menu).addClass('menu-smart-init');
2237				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2238			});
2239		}
2240
2241		$menusmart.each(function(key, menu){
2242			$(menu).on('beforecollapse.smapi', function( e, $sub ){
2243				if ( $('> .trigger-window-resize', $sub).length ) {
2244					window.dispatchEvent(new Event('resize'));
2245					$(window).trigger('uncode.re-layout');
2246				} else if ( $('> .trigger-box-resize', $sub).length ) {
2247					window.dispatchEvent(new CustomEvent('boxResized'));
2248				}
2249				return false;
2250			});
2251		});
2252		
2253		$(document).on( 'uncode.smartmenu-appended', function(){
2254			requestTimeout(function(){
2255				$menusmart.smartmenus( 'refresh' );
2256			}, 1000);
2257		});
2258
2259	}
2260
2261	$('.main-menu-container').each(function(){
2262		var $main_cont = $(this),
2263			$uls = $('ul:not(.nav-tabs)', $main_cont);
2264
2265		$uls.each(function(){
2266			var $ul = $(this),
2267				mobile_hidden = true,
2268				tablet_hidden = true;
2269			$('> li:not(.hidden)', $ul).each(function(){
2270				if ( !$(this).hasClass('mobile-hidden') ) {
2271					mobile_hidden = false;
2272					return false;
2273				}
2274			});
2275			$('> li:not(.hidden)', $ul).each(function(){
2276				if ( !$(this).hasClass('tablet-hidden') ) {
2277					tablet_hidden = false;
2278					return false;
2279				}
2280			});
2281			if ( mobile_hidden ) {
2282				$ul.addClass('mobile-hidden');
2283			}
2284			if ( tablet_hidden ) {
2285				$ul.addClass('tablet-hidden');
2286			}
2287		});
2288
2289		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2290
2291		$divUlsMB.each(function(){
2292			var $divUlMB = $(this),
2293				div_mobile_hidden = true,
2294				div_tablet_hidden = true;
2295
2296			$('> ul:not(.hidden)', $divUlMB).each(function(){
2297				if ( !$(this).hasClass('mobile-hidden') ) {
2298					div_mobile_hidden = false;
2299					return false;
2300				}
2301			});
2302			$('> ul:not(.hidden)', $divUlMB).each(function(){
2303				if ( !$(this).hasClass('tablet-hidden') ) {
2304					div_tablet_hidden = false;
2305					return false;
2306				}
2307			});
2308			if ( div_mobile_hidden ) {
2309				$divUlMB.addClass('mobile-hidden');
2310			}
2311			if ( div_tablet_hidden ) {
2312				$divUlMB.addClass('tablet-hidden');
2313			}
2314		});
2315	});
2316
2317	var overlaySearchButton = function(){
2318		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2319
2320		$search_wrap.each(function(){
2321			var $form = $('form', this),
2322				$icon = $('i', $form);
2323
2324			$icon.on('click', function(){
2325				$form.submit();
2326			});
2327		});
2328	};
2329	overlaySearchButton();
2330}
2331
2332UNCODE.menuMegaBlock = function() {
2333	var $megaBlocks = $('.megamenu-block-wrapper');
2334	if ( ! $megaBlocks.length ) {
2335		return;
2336	}
2337
2338	$megaBlocks.each(function(){
2339		var $megaLi = $(this),
2340			//$parentLi = $megaLi.closest('li.menu-item').addClass('mega-menu'),
2341			dataLi = $megaLi.attr('data-block'),
2342			$megaUl = $megaLi.closest('ul').addClass('block-wrapper-parent unmenu-inner-ul'),
2343			$innerUl = $megaLi.find('ul').addClass('unmenu-inner-ul');
2344		$megaUl.addClass(dataLi);
2345		//$('.column_parent > .uncol .uncont:not(.uncont *)', $megaLi).addClass(dataLi);
2346		$('img', $megaLi).removeAttr('loading');
2347	});
2348}
2349
2350UNCODE.unBlockMenu = function(){
2351	//Menu block
2352	var $unBlockMenus = $('.menu.unmenu-block');
2353
2354	$unBlockMenus.each(function(){
2355		var $unBlockMenu = $(this),
2356			$lastOnes;
2357
2358		if ( !$unBlockMenu.hasClass('first-grid') ) {
2359			$lastOnes = $('ul', $unBlockMenu).last();
2360			$lastOnes.each(function(){
2361                var _cols = $(this).css('grid-template-columns');
2362				if ( _cols.split(' ').length > 1 && !_cols.startsWith('repeat(1,')) {
2363					$unBlockMenu.addClass('has-last-ones');
2364					$(this).addClass('last-one');
2365				} else {
2366					var $parentLi = $(this).closest('li'),
2367						$siblingLi = $parentLi.next();
2368					if ( !$siblingLi.length ) {
2369						$unBlockMenu.addClass('has-last-ones');
2370						$(this).addClass('last-one');
2371					}
2372				}
2373			});
2374		} else {
2375			var checkGrids = function(){
2376				$unBlockMenu.find('.last-ul').removeClass('last-one');
2377				var _cols = $unBlockMenu.css('grid-template-columns'),
2378                    cols = _cols.match(/^repeat\(\s*(\d+)\s*,/) ? parseInt(_cols.match[1], 10) : _cols.split(' ').length,
2379					$lis = $('> li', $unBlockMenu),
2380					totLi = $lis.length,
2381					lastRowCount = totLi - (totLi % cols || cols),
2382					$lastLis = $lis.slice(cols).addClass('last-lis'),
2383    				$lastRowLis = $lis.slice(lastRowCount);
2384				$lastRowLis.each(function(){
2385					var $lastRowLi = $(this);
2386					$lastRowLi.find('ul').last().addClass('last-one');
2387				});
2388			}
2389			$(window).on('wwResize', checkGrids);
2390			checkGrids();
2391
2392		}
2393
2394	});
2395
2396	//Accordion
2397
2398	var $tgglBlocks = $('.unmenu-collapse');
2399	$tgglBlocks.each(function(key, val){
2400		var $acc = $(val),
2401			$titles = $('.menu-item-has-children > *:first-child', $acc),
2402			run = true;
2403
2404		var checkRun = function(){
2405			if ( $acc.hasClass('unmenu-collapse-mobile') && UNCODE.wwidth >= UNCODE.mediaQuery ) {
2406				run = false;
2407			} else {
2408				run = true;
2409			}
2410
2411			if ( $titles.length ) {
2412				$titles.each(function(_key, _val){
2413					var $title = $(_val),
2414						$sub = $title.closest('li').find('> ul.un-submenu');
2415
2416					$sub.each(function(key, val){
2417						if ( run ) {
2418
2419							var total = $sub.length;
2420							var completed = 0;
2421				
2422							$(val).slideUp({
2423								duration: 1,
2424								complete: function() {
2425									$(this).addClass('toggle-init');
2426
2427									completed++;
2428
2429									if ( completed === total ) {
2430										$(document).trigger('unblock-toggles-init');
2431										$( document.body ).trigger( 'uncode_waypoints' );
2432									}
2433								}
2434							});
2435						} else {
2436							$(val).show();
2437						}
2438					});
2439				});
2440			}
2441		}
2442		checkRun();
2443
2444		$(window).on('wwResize menuClosed', checkRun);
2445
2446		if ( $titles.length ) {
2447			$titles.each(function(_key, _val){
2448				var $title = $(_val),
2449					$sub = $title.closest('li').find('> ul.un-submenu'),
2450					$menu = $sub.closest('.menu.unmenu-block'),
2451					$ulS;
2452
2453				$title.off('click').on('click', function(e){
2454					e.preventDefault();
2455					$ulS = $menu.find('ul:visible').not($sub).not($sub.parents('ul'))
2456					if ( run ) {
2457						if ( $sub.is(':visible') ) {
2458							$sub.slideUp(200, 'easeInOutCirc', function(){
2459								$.each($('.start_animation', $sub), function(index, val) {
2460									var element = $(val);
2461									element.removeClass('start_animation');
2462
2463								});
2464								$sub.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2465								$(document).trigger('sub-menu-slide-up');
2466							});
2467						} else {
2468							$ulS.slideUp({
2469								duration: 200,
2470								easing: 'easeInOutCirc',
2471								start: function(){
2472									var _this = $(this);
2473									_this.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2474									$(document).trigger('sub-menu-slide-up');
2475								}
2476							});
2477
2478							$sub.slideDown({
2479								duration: 400,
2480								easing: 'easeInOutCirc',
2481								start: function() {
2482									var _this = $(this);
2483									_this.css('height', 0);
2484									if ( _this.hasClass('is-grid') ) {
2485										_this.css('display','grid');
2486									}
2487
2488									UNCODE.animateSubInside(_this)
2489									_this.parents('li').eq(0).addClass('un-submenu-open').removeClass('un-submenu-closed');
2490								}
2491							});
2492						}
2493
2494					}
2495				});
2496			});
2497
2498			if ( $acc.closest('#masthead').length ) {
2499				$(window).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
2500					$acc.find('ul.un-submenu').slideUp(200, 'easeInOutCirc');
2501				});
2502			}
2503		}
2504
2505	});
2506	
2507};
2508
2509UNCODE.mobileMenuBlockSkins = function(){
2510	var $mobileBlock = $('#uncode-mobile-menu-block'),
2511		$parentDark = $mobileBlock.closest('.submenu-dark'),
2512		$parentLight = $mobileBlock.closest('.submenu-light');
2513
2514
2515	if ( $parentDark.length ) {
2516		var $cols = $('.uncol.style-light:not(.style-spec):not(.style-run)', $mobileBlock);
2517		$cols.each(function(key, val){
2518			var $col = $(val).removeClass('style-light').addClass('style-dark style-run');
2519		});
2520	}
2521
2522	if ( $parentLight.length ) {
2523		var $cols = $('.uncol.style-dark:not(.style-spec):not(.style-run)', $mobileBlock);
2524		$cols.each(function(key, val){
2525			var $col = $(val).removeClass('style-dark').addClass('style-light style-run');
2526		});
2527	}
2528};
2529UNCODE.okvideo = function(ev) {
2530	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2531	$.okvideo = function(options) {
2532		// if the option var was just a string, turn it into an object
2533		if (typeof options !== 'object') options = {
2534			'video': options
2535		};
2536		var base = this;
2537		// kick things off
2538		base.init = function() {
2539			base.options = $.extend({}, $.okvideo.options, options);
2540			// support older versions of okvideo
2541			if (base.options.video === null) base.options.video = base.options.source;
2542			base.setOptions();
2543			var target = base.options.target || $('body');
2544			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2545			var zIndex = base.options.controls === 3 ? -999 : "auto";
2546			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2547				var mask = '<div id="okplayer-mask-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:-998;height:100%;width:100%;"></div>';
2548				if (OKEvents.utils.isMobile()) {
2549					target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
2550				} else {
2551					if (base.options.controls === 3) {
2552						target.append(mask)
2553					}
2554					if (base.options.adproof === 1) {
2555						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:-10%;top:-10%;overflow:hidden;z-index:' + zIndex + ';height:120%;width:120%;"></div>');
2556					} else {
2557						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
2558					}
2559				}
2560				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2561				if (base.options.playlist.list === null) {
2562					if (base.options.video.provider === 'youtube') {
2563						base.loadYouTubeAPI();
2564					} else if (base.options.video.provider === 'vimeo') {
2565						base.options.volume /= 100;
2566						base.loadVimeoAPI();
2567					}
2568				} else {
2569					base.loadYouTubeAPI();
2570				}
2571			}
2572		};
2573		// clean the options
2574		base.setOptions = function() {
2575			// exchange 'true' for '1' and 'false' for 3
2576			for (var key in this.options) {
2577				if (this.options[key] === true) this.options[key] = 1;
2578				if (this.options[key] === false) this.options[key] = 3;
2579			}
2580			if (base.options.playlist.list === null) {
2581				base.options.video = base.determineProvider();
2582			}
2583			// pass options to the window
2584			$(window).data('okoptions-' + base.options.id, base.options);
2585		};
2586		// insert js into the head and exectue a callback function
2587		base.insertJS = function(src, callback, provider){
2588			var tag;
2589			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2590				delete UNCODE.insertedSripts[src];
2591				var tags = document.getElementsByTagName('script');
2592				for (var i = tags.length; i >= 0; i--){
2593					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2594						tags[i].parentNode.removeChild(tags[i]);
2595					}
2596				}
2597			} else {
2598				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2599					tag = UNCODE.insertedSripts[src];
2600					if (callback){
2601						if (tag.readyState){  //IE
2602							tag.onreadystatechange = function(){
2603								if (tag.readyState === "loaded" ||
2604									tag.readyState === "complete"){
2605									tag.onreadystatechange = null;
2606									callback();
2607								}
2608							};
2609						} else {
2610							$(tag).on('load', callback);
2611						}
2612					}
2613					return;
2614				}
2615			}
2616			tag = document.createElement('script');
2617			if (callback){
2618				if (tag.readyState){  //IE
2619					tag.onreadystatechange = function(){
2620						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2621							tag.onreadystatechange = null;
2622							callback();
2623						}
2624					};
2625				} else {
2626					tag.onload = function() {
2627						callback();
2628					};
2629				}
2630			}
2631			tag.src = src;
2632			var firstScriptTag = document.getElementsByTagName('script')[0];
2633			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2634			if ( ! UNCODE.insertedSripts ) {
2635				UNCODE.insertedSripts = [];
2636			}
2637			UNCODE.insertedSripts[src] = tag;
2638		};
2639		// load the youtube api
2640		base.loadYouTubeAPI = function(callback) {
2641			if ( ev === 'uncode-more-items-loaded' ) {
2642				onYouTubeIframeAPIReady();
2643			} else {
2644				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2645			}
2646		};
2647		base.loadYouTubePlaylist = function() {
2648			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2649		};
2650		// load the vimeo api by replacing the div with an iframe and loading js
2651		base.loadVimeoAPI = function() {
2652			var source = '//player.vimeo.com/video/' + base.options.video.id + '?controls=0&api=1&title=0&byline=0&portrait=0&playbar=0&loop=' + base.options.loop + '&autoplay=' + (base.options.autoplay === 1 ? 1 : 0) + '&player_id=okplayer-' + base.options.id + '&autopause=0',
2653			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2654			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2655			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2656			base.insertJS('//player.vimeo.com/api/player.js', function() {
2657				vimeoPlayerReady(base.options.id);
2658			}, 'vimeo');
2659		};
2660		// is it from youtube or vimeo?
2661		base.determineProvider = function() {
2662			var a = document.createElement('a');
2663			a.href = base.options.video;
2664			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2665				var videoid = a.href.split('/')[3].toString();
2666				var query = videoid.substring(videoid.indexOf('?') + 1);
2667				if (query != '') {
2668					var vars = query.split('&');
2669					for (var i = 0; i < vars.length; i++) {
2670						var pair = vars[i].split('=');
2671						if (pair[0] == 'v') {
2672							videoid = pair[1];
2673						}
2674					}
2675				}
2676				return {
2677					"provider": "youtube",
2678					"id": videoid
2679				};
2680			} else if (/vimeo.com/.test(base.options.video)) {
2681				return {
2682					"provider": "vimeo",
2683					"id": (a.href.split('/')[3].toString()).split('#')[0],
2684				};
2685			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2686				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2687				if (id.length == 11) {
2688					return {
2689						"provider": "youtube",
2690						"id": id.toString()
2691					};
2692				} else {
2693					for (var i = 0; i < base.options.video.length; i++) {
2694						if (typeof parseInt(base.options.video[i]) !== "number") {
2695							throw 'not vimeo but thought it was for a sec';
2696						}
2697					}
2698					return {
2699						"provider": "vimeo",
2700						"id": base.options.video
2701					};
2702				}
2703			} else {
2704				throw "OKVideo: Invalid video source";
2705			}
2706		};
2707		base.init();
2708	};
2709
2710	var checkResize,
2711		newW = UNCODE.wwidth;
2712
2713	$.okvideo.options = {
2714		id: null,
2715		source: null, // Deprecate dis l8r
2716		video: null,
2717		playlist: { // eat ur heart out @brokyo
2718			list: null,
2719			index: 0,
2720			startSeconds: 0,
2721			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2722		},
2723		disableKeyControl: 1,
2724		captions: 0,
2725		loop: 1,
2726		hd: 1,
2727		volume: 0,
2728		adproof: false,
2729		unstarted: null,
2730		onFinished: null,
2731		onReady: null,
2732		onPlay: null,
2733		onPause: null,
2734		buffering: null,
2735		controls: false,
2736		autoplay: true,
2737		annotations: true,
2738		cued: null
2739	};
2740	$.fn.okvideo = function(options) {
2741		options.target = this;
2742		return this.each(function() {
2743			(new $.okvideo(options));
2744		});
2745	};
2746
2747	var checkForVideos = function(){
2748		$(".uncode-video-container.video").each(function(index, el) {
2749			var $this = $(this),
2750				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2751				url = $this.attr('data-video'),
2752				id = $this.attr('data-id'),
2753				cloned = $this.closest('.owl-item');
2754
2755			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2756				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2757					$this.okvideo({
2758						id: id,
2759						source: url.split('#')[0],
2760						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2761						autoplay: 1,
2762						controls: 0,
2763						volume: 0,
2764						adproof: 0,
2765						caller: $this,
2766						hd: 1,
2767						onReady: function(player) {
2768							var getPlayer = player.c || player.h || player,
2769							$iframe,
2770							getContainer = $(getPlayer).closest('.background-element');
2771							if (getContainer.length) {
2772								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2773							}
2774
2775							if ( $this.hasClass('drop-move') ) {
2776
2777								var $iframe = $(getPlayer),
2778									w = parseFloat($iframe.attr('width')),
2779									h = parseFloat($iframe.attr('height')),
2780									ratio = h / w,
2781									setResizeiFto,
2782								resizeiFrame = function(){
2783									var dataW = $this.attr('data-w'),
2784										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2785										newH = newW * ratio;
2786									$iframe.css({
2787										width: newW,
2788										height: newH
2789									});
2790								};
2791								resizeiFrame();
2792								$(window).on( 'load', resizeiFrame );
2793								$(window).on( 'resize', function(){
2794									clearRequestTimeout(setResizeiFto);
2795									setResizeiFto = requestTimeout( function() {
2796										resizeiFrame();
2797									}, 10 );
2798								});
2799
2800							}
2801
2802						}
2803					});
2804				}
2805			}
2806		});
2807	};
2808
2809	checkForVideos();
2810
2811	$(window).on('load', function(){
2812		$('.mejs-fullscreen-button button').on('click', function(){
2813			var $button = $(this),
2814				$stuck = $button.closest('.is_stucked');
2815
2816			if ( $stuck.length ) {
2817				$stuck = $(this).trigger("sticky_kit:detach");
2818				window.scrollTo(0, 0);
2819			}
2820		});
2821	});
2822
2823	var checkVideoResize = function(){
2824		clearRequestTimeout(checkResize);
2825		checkResize = requestTimeout(function(){
2826			if ( newW !== UNCODE.wwidth ) {
2827				newW = UNCODE.wwidth;
2828				checkForVideos();
2829			}
2830		}, 1000);
2831	};
2832
2833	$(window).off('resize', checkVideoResize)
2834	.on( 'resize', checkVideoResize);
2835
2836};
2837
2838$(document).on('uncode-ajax-filtered.videos', function(){
2839	UNCODE.okvideo("uncode-more-items-loaded");
2840});
2841UNCODE.backgroundSelfVideos = function( $ctx ) {
2842
2843	var backgroundSelfVideosInit = function( $ctx ) {
2844		if ( SiteParameters.block_mobile_videos === true ) {
2845			return false;
2846		}
2847		if (typeof MediaElement === "function") {
2848			if ( typeof $ctx === 'undefined' ) {
2849				$ctx = document;
2850			}
2851		
2852			$(".background-video-shortcode", $ctx).each(function(index, el) {
2853				if ( $(this).closest('mediaelementwrapper').length ) {
2854					return true;
2855				}
2856				var $video_el = $(this),
2857					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2858					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2859					video_id = $video_el.attr('id');
2860
2861				if ( SiteParameters.is_frontend_editor ) {
2862					video_id = video_id + '_' + index;
2863					$video_el.attr('id', video_id);
2864				}
2865
2866				var media = new MediaElement(video_id, {
2867					startVolume: 0,
2868					loop: true,
2869					success: function(mediaElement, domObject) {
2870						domObject.volume = 0;
2871						$(mediaElement).data('started', false);
2872						mediaElement.addEventListener('timeupdate', function(e) {
2873							if (!$(e.target).data('started')) {
2874								$(mediaElement).data('started', true);
2875							}
2876						});
2877						mediaElement.addEventListener('loadedmetadata', function(e) {
2878							$('body').removeClass('video-not-supported');
2879							mediaElement.play();
2880						});
2881						if (!UNCODE.isMobile) {
2882							requestTimeout(function() {
2883								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2884							}, 100);
2885						}
2886						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2887							mediaElement.play();
2888						}
2889
2890						if ( $parent_drop_move.length ) {
2891							var setResizeMEto,
2892								resizeMediaElement = function(){
2893								var dataW = $parent_drop_move.attr('data-w'),
2894									videoW = domObject.width,
2895									videoH = domObject.height,
2896									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2897									newH = newW / ( videoW / videoH );
2898
2899								$(domObject).css({
2900									'height': newH,
2901									'width': newW
2902								});
2903							};
2904							$(window).on( 'resize load', function(){
2905								clearRequestTimeout(setResizeMEto);
2906								setResizeMEto = requestTimeout( function() {
2907									resizeMediaElement();
2908								}, 10 );
2909							});
2910						}
2911
2912						mediaElement.addEventListener('play', function() {
2913							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2914							$(mediaElement).closest('#page-header').addClass('video-started');
2915							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2916						}, true);
2917
2918					},
2919					// fires when a problem is detected
2920					error: function() {}
2921				});
2922			});
2923		} else {
2924
2925			if ( typeof $ctx === 'undefined' ) {
2926				$ctx = document;
2927			}
2928		
2929			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2930			Array.from(videos).forEach(function(video_el) {
2931				video_el.addEventListener('loadedmetadata', function(e) {
2932					$('body').removeClass('video-not-supported');
2933					video_el.play();
2934				});
2935				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2936					video_el.muted = true;
2937					video_el.loop = true;
2938					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2939					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2940					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2941					$('body').removeClass('video-not-supported');
2942					video_el.play();
2943				} else {
2944					requestTimeout(function(){
2945                         backgroundSelfVideosInit( $ctx );
2946					}, 1000);
2947				}
2948			});
2949		}
2950	};
2951
2952	backgroundSelfVideosInit( $ctx );
2953
2954	$(document).on('un-menu-show', function(){
2955		setTimeout(function(){
2956			UNCODE.initVideoComponent(document.body, '.un-submenu .uncode-video-container.video:not(.drop-move):not(.fluid-object), .un-submenu .uncode-video-container.self-video:not(.drop-move)');
2957		}, 1);
2958	});
2959
2960
2961	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2962		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2963			var $el = model.view.$el,
2964				shortcode = model.attributes.shortcode;
2965
2966			if (typeof MediaElement === "function") {
2967				backgroundSelfVideosInit( $el );
2968			} else {
2969				backgroundSelfVideosInit( $el[0] );
2970			}
2971		});
2972	}
2973};
2974
2975UNCODE.is_scrolling = false;
2976
2977UNCODE.disableHoverScroll = function() {
2978
2979	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2980		var body = document.body,
2981		timer;
2982
2983		window.addEventListener('scroll', function() {
2984			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2985			clearRequestTimeout(timer);
2986			if ( body.classList && !body.classList.contains('disable-hover') ) {
2987				body.classList.add('disable-hover');
2988				window.dispatchEvent(new CustomEvent('disable-hover'));
2989			}
2990			UNCODE.is_scrolling = true;
2991
2992			timer = requestTimeout(function() {
2993				if ( body.classList ) {
2994					body.classList.remove('disable-hover');
2995					window.dispatchEvent(new CustomEvent('enable-hover'));
2996				}
2997				UNCODE.is_scrolling = false;
2998			}, delay);
2999		}, false);
3000	}
3001};
3002
3003UNCODE.isotopeLayout = function() {
3004	if ($('.isotope-layout').length > 0) {
3005		var isotopeContainersArray = [],
3006			typeGridArray = [],
3007			layoutGridArray = [],
3008			screenLgArray = [],
3009			screenMdArray = [],
3010			screenSmArray = [],
3011			transitionDuration = [],
3012			$filterItems = [],
3013			$filters = $('.isotope-system .isotope-filters'),
3014			$itemSelector = '.tmb-iso',
3015			$items,
3016			itemMargin,
3017			correctionFactor = 0,
3018			firstLoad = true,
3019			isOriginLeft = $('body').hasClass('rtl') ? false : true;
3020		$('[class*="isotope-container"]').each(function(index) {
3021			var _this = $(this);
3022			var isoData = _this.data(),
3023			$data_lg,
3024			$data_md,
3025			$data_sm;
3026			_this.children('.tmb').addClass('tmb-iso');
3027			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
3028			else $data_lg = '1000';
3029			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
3030			else $data_md = '600';
3031			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
3032			else $data_sm = '480';
3033			screenLgArray.push($data_lg);
3034			screenMdArray.push($data_md);
3035			screenSmArray.push($data_sm);
3036			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
3037			if (isoData.type == 'metro') typeGridArray.push(true);
3038			else typeGridArray.push(false);
3039			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
3040			else layoutGridArray.push('masonry');
3041			isotopeContainersArray.push(_this);
3042			_this.attr('data-iso-index', index);
3043		});
3044		var colWidth = function(index) {
3045				$(isotopeContainersArray[index]).width('');
3046				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
3047					widthAvailable = $(isotopeContainersArray[index]).width(),
3048					columnNum = 12,
3049					columnWidth = 0,
3050					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
3051					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
3052					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
3053					$rowContainer,
3054					paddingRow,
3055					$colContainer,
3056					paddingCol;
3057
3058				if ( consider_menu )
3059					winHeight = winHeight - UNCODE.menuHeight;
3060
3061				if ( data_vp_height === '1' ) {
3062					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
3063					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
3064					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
3065					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
3066					winHeight = winHeight - ( paddingRow + paddingCol );
3067				}
3068
3069				if (isPx) {
3070					columnWidth = Math.ceil(widthAvailable / columnNum);
3071					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
3072				} else {
3073					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
3074				}
3075				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
3076				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
3077				for (var i = 0, len = $items.length; i < len; i++) {
3078					var $item = $($items[i]),
3079						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
3080						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
3081						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
3082
3083
3084					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
3085						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
3086					}
3087
3088					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
3089						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
3090					}
3091
3092					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
3093						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3094							switch (parseInt(multiplier_w[1])) {
3095								case (5):
3096								case (4):
3097								case (3):
3098									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3099									multiplier_w[1] = 6;
3100									break;
3101								case (2):
3102								case (1):
3103									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
3104									multiplier_w[1] = 3;
3105									break;
3106								default:
3107									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3108									multiplier_w[1] = 12;
3109									break;
3110							}
3111
3112							if (multiplier_w[1] == 2.4) { // 5 columns
3113								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3114								multiplier_w[1] = 6;
3115							}
3116						}
3117					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
3118						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3119							switch (parseInt(multiplier_w[1])) {
3120								case (5):
3121								case (4):
3122								case (3):
3123								case (2):
3124								case (1):
3125									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3126									multiplier_w[1] = 6;
3127									break;
3128								default:
3129									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3130									multiplier_w[1] = 12;
3131									break;
3132							}
3133
3134							if (multiplier_w[1] == 2.4) { // 5 columns
3135								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3136								multiplier_w[1] = 6;
3137							}
3138						}
3139					} else if (widthAvailable < screenSmArray[index]) {
3140						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3141							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3142							multiplier_w[1] = 12;
3143							if (typeGridArray[index]) multiplier_h[1] = 12;
3144						}
3145					}
3146					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
3147						height;
3148
3149					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
3150						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
3151						if ( widthAvailable < screenSmArray[index] ) {
3152							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
3153						}
3154					} else {
3155						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
3156					}
3157
3158					if (width >= widthAvailable) {
3159						$item.css({
3160							width: widthAvailable
3161						});
3162						if (typeGridArray[index]) {
3163							$item.children().add($item.find('.backimg')).css({
3164								height: height
3165							});
3166						}
3167					} else {
3168						$item.css({
3169							width: width
3170						});
3171						if (typeGridArray[index]) {
3172							$item.children().add($item.find('.backimg')).css({
3173								height: height
3174							});
3175						}
3176					}
3177				}
3178				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
3179					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
3180				} else {
3181					return columnWidth;
3182				}
3183			},
3184			init_isotope = function() {
3185				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
3186					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
3187						isotopeId = isotopeSystem.attr('id'),
3188						$layoutMode = layoutGridArray[i],
3189						setIsotopeFirstRowTimeOut,
3190					setIsotopeFirstRow = function(items){
3191						var firstRow = true;
3192						$(items).each(function(index, val){
3193							var el = items[index].element,
3194								el_top = items[index].position.y,
3195								$el = $(el);
3196							if ( index > 0 && el_top > 0 && firstRow ) {
3197								firstRow = false;
3198							} else if ( index == 0 && el_top == 0 ) {
3199								firstRow = true;
3200							}
3201							if ( firstRow ) {
3202								$el.removeClass('tmb-isotope-further-row');
3203							} else {
3204								$el.addClass('tmb-isotope-further-row');
3205							}
3206						});
3207					};
3208					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
3209						//resizable: true,
3210						itemSelector: $itemSelector,
3211						layoutMode: $layoutMode,
3212						transitionDuration: transitionDuration[i],
3213						masonry: {
3214							columnWidth: colWidth(i)
3215						},
3216						vertical: {
3217							horizontalAlignment: 0.5,
3218						},
3219						sortBy: 'original-order',
3220						isOriginLeft: isOriginLeft
3221					})
3222					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
3223					.on('layoutComplete', function( event, items ){
3224						if ( typeof items[0] !== 'undefined' ) {
3225							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3226								setIsotopeFirstRow(items);
3227							}
3228						}
3229					})
3230					.on('arrangeComplete', function( event, items ){
3231						if ( typeof items[0] !== 'undefined' ) {
3232							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3233								clearRequestTimeout(setIsotopeFirstRowTimeOut);
3234								setIsotopeFirstRowTimeOut = requestTimeout(function(){
3235									setIsotopeFirstRow(items);
3236								}, 100);
3237							}
3238						}
3239					});
3240					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
3241						$(isotopeContainersArray[i]).infinitescroll({
3242								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
3243								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
3244								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
3245								animate: false,
3246								behavior: 'local',
3247								debug: false,
3248								loading: {
3249									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
3250									speed: 0,
3251									finished: undefined,
3252									msg: $('#' + isotopeId + ' .loadmore-button'),
3253								},
3254								errorCallback: function() {
3255									var isotope_system = $(this).closest('.isotope-system');
3256									$('.loading-button', isotope_system).hide();
3257									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
3258								}
3259							},
3260							// append the new items to isotope on the infinitescroll callback function.
3261							function(newElements, opts) {
3262								var $isotope = $(this),
3263									isotope_system = $isotope.closest('.isotope-system'),
3264									isotopeId = isotope_system.attr('id'),
3265									filters = new Array(),
3266									$loading_button = isotope_system.find('.loading-button'),
3267									$infinite_button = isotope_system.find('.loadmore-button'),
3268									$numPages = $('a', $infinite_button).data('pages'),
3269									$woo_results,
3270									delay = 300;
3271								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
3272								if ($isotope.hasClass('isotope-infinite-button') || $infinite_button.hasClass('loadmore-button--icon')) {
3273									$infinite_button.show();
3274								} else {
3275									$infinite_button.hide();
3276								}
3277								$loading_button.hide();
3278								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
3279								$('> li', $isotope).remove();
3280								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
3281								$.each($(newElements), function (index, val) {
3282									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
3283										$woo_results = $(val);
3284										delete newElements[index];
3285									} else {
3286										$(val).addClass('tmb-iso');
3287										if ($(val).is("li")) {
3288											filters.push($(val)[0]);
3289										}
3290									}
3291									$(val).addClass('uncode-appended');
3292								});
3293								newElements = newElements.filter(function(x) {
3294									return filters.indexOf(x) < 0
3295								});
3296								$.each($(filters), function(index, val) {
3297									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
3298								});
3299								if ($woo_results && $woo_results.length > 0) {
3300									var old_count = isotope_system.find('.woocommerce-result-count').text();
3301									var new_count = $woo_results.find('.woocommerce-result-count').text();
3302									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
3303									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
3304									function replaceMatch(match, p1, p2) {
3305        								return old_start + '–' + new_end;
3306									}
3307									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
3308									isotope_system.find('.woocommerce-result-count').text(new_count_text);
3309								}
3310								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
3311								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3312									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
3313									if (typeof getLightbox === 'object') {
3314										getLightbox.refresh();
3315									} else {
3316										UNCODE.lightbox();
3317									}
3318								}
3319								if ( typeof twttr !== 'undefined' )
3320									twttr.widgets.load(isotopeContainersArray[i]);
3321
3322								requestTimeout(function() {
3323									Waypoint.refreshAll();
3324									$isotope.trigger('more-items-loaded');
3325									$(window).trigger('more-items-loaded');
3326									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3327									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3328										$(document).trigger('uncode-scrolltrigger-refresh');
3329									}
3330									fillIfNotScrollable($isotope);
3331								}, 1000);
3332
3333							});
3334						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
3335							var $infinite_isotope = $(isotopeContainersArray[i]),
3336								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
3337							$infinite_isotope.infinitescroll('pause');
3338							$infinite_button.on('click', function(event) {
3339								event.preventDefault();
3340								var $infinite_system = $(event.target).closest('.isotope-system'),
3341								$infinite_isotope = $infinite_system.find('.isotope-container'),
3342								isotopeId = $infinite_system.attr('id');
3343								$(event.currentTarget).html(SiteParameters.loading);
3344								$infinite_isotope.infinitescroll('resume');
3345								$infinite_isotope.infinitescroll('retrieve');
3346								$infinite_isotope.infinitescroll('pause');
3347							});
3348						}
3349						(function ($c) {
3350							requestTimeout(function () { fillIfNotScrollable($c); }, 1000);
3351						})($(isotopeContainersArray[i]));
3352					}
3353				}
3354			},
3355			fillIfNotScrollable = function ($container) {
3356				if ($container.hasClass('isotope-infinite-button')) {
3357					return
3358				};
3359				if (!$container.hasClass('isotope-infinite')) {
3360					return
3361				};
3362				var infData = $container.data('infinitescroll');
3363				if (!infData || !infData.options || !infData.options.state) {
3364					return
3365				};
3366				var state = infData.options.state;
3367				if (state.isDuringAjax || state.isDestroyed || state.isBeyondMaxPage || state.isPau
3367sed) {
3368					return
3369				};
3370				var $loadMoreA = $container.closest('.isotope-system').find('.loadmore-button a');
3371				var numPages = parseInt($loadMoreA.data('pages'), 10);
3372				if (!numPages || state.currPage >= numPages) {
3373					return
3374				};
3375				if (document.documentElement.scrollHeight > window.innerHeight + 1) {
3376					return
3377				};
3378				console.log('fillIfNotScrollable');
3379				$container.infinitescroll('retrieve');
3380			},
3381			onLayout = function(isotopeObj, startIndex, needsReload) {
3382				var needsReload = needsReload ? true : false;
3383
3384				if (typeof UNCODE.bigText !== 'undefined') {
3385					UNCODE.bigText();
3386				}
3387				isotopeObj.css('opacity', 1);
3388				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
3389
3390				requestTimeout(function() {
3391					if (startIndex > 0) {
3392						reloadIsotope(isotopeObj);
3393						if (SiteParameters.dynamic_srcset_active === '1') {
3394							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3395							UNCODE.adaptive_srcset(isotopeObj);
3396						}
3397						// window.dispatchEvent(UNCODE.boxEvent);
3398					} else if (needsReload) {
3399						reloadIsotope(isotopeObj);
3400					}
3401
3402					UNCODE.adaptive();
3403					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
3404						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3405					}
3406					if (typeof MediaElement === "function") {
3407						$(isotopeObj).find('audio,video').each(function() {
3408							$(this).mediaelementplayer({
3409	 							pauseOtherPlayers: false,
3410							});
3411						});
3412					}
3413					if ($(isotopeObj).find('.nested-carousel').length) {
3414						if (typeof UNCODE.carousel !== 'undefined') {
3415							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
3416						}
3417						requestTimeout(function() {
3418							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3419						}, 200);
3420					} else {
3421						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3422					}
3423					isotopeObj.trigger('isotope-layout-complete');
3424
3425				}, 100);
3426
3427			},
3428			boxAnimation = function(items, startIndex, sequential, container) {
3429				var $allItems = items.length - startIndex,
3430					showed = 0,
3431					index = 0;
3432				if (container.closest('.owl-item').length == 1) return false;
3433				$.each(items, function(index, val) {
3434					var $this = $(val),
3435						elInner = $('> .t-inside', val);
3436					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3437						return;
3438					}
3439					if (val[0]) val = val[0];
3440					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
3441						new Waypoint({
3442							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3443							element: val,
3444							handler: function() {
3445								var element = $('> .t-inside', this.element),
3446									parent = $(this.element),
3447									currentIndex = parent.index();
3448								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
3449									delayAttr = parseInt(element.attr('data-delay'));
3450								if (isNaN(delayAttr)) delayAttr = 100;
3451								delay -= showed;
3452								var objTimeout = requestTimeout(function() {
3453									element.removeClass('zoom-reverse').addClass('start_animation');
3454									showed = parent.index();
3455									if ( container.data('isotope') ) {
3456										container.isotope('layout');
3457									}
3458								}, delay * delayAttr)
3459								parent.data('objTimeout', objTimeout);
3460								if (!UNCODE.isUnmodalOpen) {
3461									this.destroy();
3462								}
3463							},
3464							offset: '100%'
3465						})
3466					} else {
3467						if (elInner.hasClass('force-anim')) {
3468							elInner.addClass('start_animation');
3469						} else {
3470							elInner.css('opacity', 1);
3471						}
3472						container.isotope('layout');
3473					}
3474
3475					index++;
3476				});
3477			},
3478			reloadIsotope = function(isotopeObj) {
3479				var isoIndex = $(isotopeObj).attr('data-iso-index');
3480				var $layoutMode = ($(isotopeObj).data('layout'));
3481				if ($layoutMode === undefined) {
3482					$layoutMode = 'masonry';
3483				}
3484				if (isotopeObj.data('isotope')) {
3485					isotopeObj.isotope({
3486						itemSelector: $itemSelector,
3487						layoutMode: $layoutMode,
3488						transitionDuration: transitionDuration[isoIndex],
3489						masonry: {
3490							columnWidth: colWidth(isoIndex)
3491						},
3492						vertical: {
3493							horizontalAlignment: 0.5,
3494						},
3495						sortBy: 'original-order',
3496						isOriginLeft: isOriginLeft
3497					});
3498				}
3499			}
3500			;
3501		if ($('.isotope-pagination').length > 0) {
3502			$('.isotope-system').on('click', '.pagination a', function(evt) {
3503				evt.preventDefault();
3504
3505				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3506					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3507						container = $(this).closest('.isotope-system'),
3508						pagination_disable_scroll = container.attr('data-pagination-scroll'),
3509						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3510					calc_scroll -= UNCODE.get_scroll_offset();
3511
3512					if ( pagination_disable_scroll !== 'disabled' ) {
3513						var menu_container = $('.menu-sticky');
3514						var menu = menu_container.find('.menu-container');
3515
3516						if (menu_container.length > 0 && menu.length > 0) {
3517							calc_scroll = calc_scroll - menu.outerHeight();
3518						}
3519
3520						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3521							delta = bodyTop - calc_scroll,
3522							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3523						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3524
3525						if (!UNCODE.isFullPage) {
3526							if (scrollSpeed == 0) {
3527								$('html, body').scrollTop(calc_scroll);
3528							} else {
3529								$('html, body').animate({
3530									scrollTop: calc_scroll
3531								}, {
3532									easing: 'easeInOutQuad',
3533									duration: scrollSpeed,
3534									complete: function () {
3535										UNCODE.scrolling = false;
3536									}
3537								});
3538							}
3539						}
3540					}
3541				}
3542
3543				loadIsotope($(this), true);
3544			});
3545		}
3546		$filters.on('click', 'a.isotope-nav-link', function(evt) {
3547			if ($(this).hasClass('no-isotope-filter')) {
3548				return;
3549			}
3550			var $filter = $(this),
3551				filterContainer = $filter.closest('.isotope-filters'),
3552				filterValue = $filter.attr('data-filter'),
3553				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
3554				transitionDuration = container.data().isotope.options.transitionDuration,
3555				delay = 300,
3556				filterItems = [];
3557
3558			var filter_items = function(){
3559				if (filterValue !== undefined) {
3560					container.addClass('grid-filtering');
3561					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3562						var parent = $(val).parent(),
3563							objTimeout = parent.data('objTimeout');
3564						if (objTimeout) {
3565							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3566							clearRequestTimeout(objTimeout);
3567						}
3568						if (transitionDuration == 0) {
3569							if ($(val).hasClass('animate_when_almost_visible')) {
3570								$(val).addClass('zoom-reverse').removeClass('start_animation');
3571							} else {
3572								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3573							}
3574						}
3575					});
3576					requestTimeout(function(){
3577						if ( filterValue == '*' ) {
3578							container.removeClass('isotope-filtered');
3579						} else {
3580							container.addClass('isotope-filtered');
3581						}
3582						container.isotope({
3583							filter: function() {
3584								var block = $(this),
3585								filterable = (filterValue == '*') || block.hasClass(filterValue),
3586								lightboxElements = $('[data-lbox^=ilightbox]', block);
3587								if (filterable) {
3588									if (lightboxElements.length) {
3589										lightboxElements.removeClass('lb-disabled');
3590										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3591									}
3592									filterItems.push(block);
3593								} else {
3594									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3595								}
3596								container.trigger('more-items-loaded');
3597								$(window).trigger('more-items-loaded');
3598								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3599								return filterable;
3600							}
3601						});
3602						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3603
3604					}, delay);
3605
3606					/** once filtered - start **/
3607					container.isotope('once', 'arrangeComplete', function() {
3608						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3609							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3610							if (typeof getLightbox === 'object') {
3611								getLightbox.refresh();
3612							} else {
3613								UNCODE.lightbox();
3614							}
3615						}
3616						if (transitionDuration == 0) {
3617							requestTimeout(function() {
3618								boxAnimation(filterItems, 0, false, container);
3619							}, 100);
3620						}
3621						requestTimeout(function() {
3622							Waypoint.refreshAll();
3623							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3624								$(document).trigger('uncode-scrolltrigger-refresh');
3625							}
3626							container.removeClass('grid-filtering');
3627						}, 2000);
3628						requestTimeout(function () { fillIfNotScrollable(container); }, 600);
3629					});
3630					/** once filtered - end **/
3631				} else {
3632					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3633						$.each(UNCODE.lightboxArray, function(index, val) {
3634							UNCODE.lightboxArray[index].destroy();
3635						});
3636					}
3637					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3638						var parent = $(val).parent(),
3639							objTimeout = parent.data('objTimeout');
3640						if (objTimeout) {
3641							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3642							clearRequestTimeout(objTimeout);
3643						}
3644						if (transitionDuration == 0) {
3645							if ($(val).hasClass('animate_when_almost_visible')) {
3646								$(val).addClass('zoom-reverse').removeClass('start_animation');
3647							} else {
3648								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3649							}
3650						}
3651					});
3652					container.parent().addClass('grid-loading');
3653					loadIsotope($filter);
3654				}
3655			};
3656
3657			if (!$filter.hasClass('active')) {
3658				/** Scroll top with filtering */
3659				if (filterContainer.hasClass('filter-scroll')) {
3660                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3661                    calc_scroll -= UNCODE.get_scroll_offset();
3662
3663					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3664						delta = bodyTop - calc_scroll,
3665						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3666						filterTolerance = false,
3667						filter_timeout;
3668					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3669
3670					if ( !UNCODE.isFullPage ) {
3671						if (scrollSpeed == 0) {
3672							$('html, body').scrollTop(calc_scroll);
3673							UNCODE.scrolling = false;
3674							filter_items();
3675						} else {
3676
3677							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3678								filter_items();
3679								filterTolerance = true;
3680							}
3681
3682							$('html, body').animate({
3683								scrollTop: calc_scroll
3684							},{
3685								easing: 'easeInOutQuad',
3686								duration: scrollSpeed,
3687								complete: function(){
3688									UNCODE.scrolling = false;
3689									if ( !filterTolerance ) {
3690										filter_timeout = setTimeout(function(){
3691											clearTimeout(filter_timeout);
3692											filter_items();
3693										}, 200);
3694									}
3695								}
3696							});
3697						}
3698					}
3699				} else {
3700					filter_items();
3701				}
3702			}
3703			evt.preventDefault();
3704		});
3705
3706		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3707			var params = UNCODE.getURLParams(window.location);
3708			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3709
3710			UNCODE.lastURL = window.location.href;
3711
3712			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
3713				return;
3714			}
3715
3716			if (params.id === undefined) {
3717				$.each($('.isotope-system'), function(index, val) {
3718					loadIsotope($(val));
3719				});
3720			} else {
3721				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3722					loadIsotope($('#' + params.id));
3723				}
3724			}
3725		});
3726
3727		var loadIsotope = function($href, $paginating) {
3728			var is_paginating = false;
3729
3730			if (undefined !== $paginating && $paginating) {
3731				var is_paginating = $paginating;
3732			}
3733
3734			var href = ($href.is("a") ? $href.attr('href') : location),
3735				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3736				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3737				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3738				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3739				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3740				isotopeId = isotopeSystem.attr('id');
3741			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3742				UNCODE.lastURL = href;
3743				history.pushState({
3744					myIsotope: true
3745				}, document.title, href);
3746			}
3747			if (is_paginating) {
3748				isotopeWrapper.addClass('grid-filtering');
3749			}
3750			$.ajax({
3751				url: href
3752			}).done(function(data) {
3753				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3754					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3755					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3756				isotopeWrapper.addClass('isotope-reloaded');
3757				requestTimeout(function() {
3758					isotopeWrapper.removeClass('grid-loading');
3759					isotopeWrapper.removeClass('isotope-reloaded');
3760					isotopeWrapper.removeClass('grid-filtering');
3761				}, 500);
3762				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3763					var parent = $(val).parent(),
3764						objTimeout = parent.data('objTimeout');
3765					if (objTimeout) {
3766						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3767						clearRequestTimeout(objTimeout);
3768					}
3769					if ($(val).hasClass('animate_when_almost_visible')) {
3770						$(val).addClass('zoom-reverse').removeClass('start_animation');
3771					} else {
3772						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3773					}
3774				});
3775				requestTimeout(function() {
3776					if (isotopeContainer.data('isotope')) {
3777						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3778						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3779						UNCODE.adaptive();
3780						if (SiteParameters.dynamic_srcset_active === '1') {
3781							UNCODE.adaptive_srcset(isotopeContainer);
3782						}
3783						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3784							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3785							if (typeof getLightbox === 'object') {
3786								getLightbox.refresh();
3787							} else {
3788								UNCODE.lightbox();
3789							}
3790						}
3791					}
3792					isotopeContainer.trigger('more-items-loaded');
3793					$(window).trigger('more-items-loaded');
3794					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3795				}, 300);
3796				$('.pagination', isotopeFooter).remove();
3797				isotopeFooter.append($resultPagination);
3798
3799				if (isotopeResultCount.length > 0) {
3800					$('.woocommerce-result-count', isotopeResultCount).remove();
3801					isotopeResultCount.append($resultCount);
3802				}
3803			});
3804		};
3805		$filters.each(function(i, buttonGroup) {
3806			var $buttonGroup = $(buttonGroup);
3807			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3808				$buttonGroup.find('.active').removeClass('active');
3809				$(this).addClass('active');
3810
3811			});
3812
3813			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3814				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3815				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3816			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3817				e.preventDefault();
3818				$cats_filters.slideToggle(400, 'easeInOutCirc');
3819			});
3820
3821		});
3822		window.addEventListener('boxResized', function(e) {
3823			if (UNCODE.printDialogOpen !== false) {
3824				return false;
3825			}
3826			$.each($('.isotope-layout'), function(index, val) {
3827				var $layoutMode = ($(this).data('layout'));
3828				if ($layoutMode === undefined) $layoutMode = 'masonry';
3829				if ($(this).data('isotope')) {
3830					$(this).isotope({
3831						itemSelector: $itemSelector,
3832						layoutMode: $layoutMode,
3833						transitionDuration: transitionDuration[index],
3834						masonry: {
3835							columnWidth: colWidth(index)
3836						},
3837						vertical: {
3838							horizontalAlignment: 0.5,
3839						},
3840						sortBy: 'original-order',
3841						isOriginLeft: isOriginLeft
3842					});
3843					$(this).isotope('unbindResize');
3844					if (SiteParameters.dynamic_srcset_active === '1') {
3845						UNCODE.refresh_dynamic_srcset_size($(this));
3846					}
3847				}
3848				$(this).find('.mejs-video,.mejs-audio').each(function() {
3849					$(this).trigger('resize');
3850				});
3851			});
3852		}, false);
3853
3854		init_isotope();
3855	};
3856}
3857
3858UNCODE.lightbox = function() {
3859	if ( SiteParameters.lbox_enhanced ) {
3860		return true;
3861	}
3862	UNCODE.lightboxArray = {};
3863	requestTimeout(function() {
3864		var groupsArr = {};
3865		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3866			var group = this.getAttribute("data-lbox"),
3867				values = $(this).data();
3868			$(this).attr('data-lbox-init','true')
3869			groupsArr[group] = values;
3870		});
3871		for (var i in groupsArr) {
3872			var skin = groupsArr[i].skin || 'black',
3873				path = groupsArr[i].dir || 'horizontal',
3874				thumbs = !groupsArr[i].notmb || false,
3875				arrows = !groupsArr[i].noarr || false,
3876				social = groupsArr[i].social || false,
3877				deeplink = groupsArr[i].deep || false,
3878				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3879				counter = $els.length,
3880				dataAlbum = $els.attr('data-album');
3881			if (social) social = {
3882				facebook: true,
3883				twitter: true,
3884				reddit: true,
3885				digg: true
3886			};
3887			UNCODE.lightboxArray[i] = $els.iLightBox({
3888				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3889				skin: skin,
3890				path: path,
3891				linkId: deeplink,
3892				infinite: false,
3893				//fullViewPort: 'fit',
3894				smartRecognition: false,
3895				fullAlone: true,
3896				maxScale: 1,
3897				minScale: .02,
3898				//fullStretchTypes: 'flash, video',
3899				overlay: {
3900					opacity: .94
3901				},
3902				controls: {
3903					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3904					fullscreen: true,
3905					thumbnail: thumbs,
3906					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3907				},
3908				show: {
3909					speed: 200
3910				},
3911				hide: {
3912					speed: 200
3913				},
3914				social: {
3915					start: false,
3916					buttons: social
3917				},
3918				caption: {
3919					start: false
3920				},
3921				styles: {
3922					nextOpacity: 1,
3923					nextScale: 1,
3924					prevOpacity: 1,
3925					prevScale: 1
3926				},
3927				effects: {
3928					switchSpeed: 400
3929				},
3930				slideshow: {
3931					pauseTime: 5000
3932				},
3933				thumbnails: {
3934					maxWidth: 60,
3935					maxHeight: 60,
3936					activeOpacity: .2
3937				},
3938				html5video: {
3939					preload: true
3940				},
3941				callback: {
3942					onOpen: function(){
3943						$(window).trigger('uncode-custom-cursor');
3944						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3945							iNoBounce.enable();
3946						}
3947					},
3948					onHide: function(){
3949						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3950							iNoBounce.disable()
3951						}
3952					},
3953				}
3954			});
3955
3956			$(document).on('infinite-loaded', function(){
3957				UNCODE.lightboxArray[i].refresh();
3958			});
3959
3960			$(window).on('gdprOpen', function(){
3961				UNCODE.lightboxArray[i].close();
3962			});
3963		};
3964	}, 100);
3965
3966	$(document).on('click', '.lb-disabled', function(e){
3967		e.preventDefault();
3968	});
3969};
3970
3971UNCODE.lightgallery = function( $el ) {
3972	if (!document._uncodeMarqueeGalleryBind) {
3973		document._uncodeMarqueeGalleryBind = true;
3974
3975		$(document).on('uncode-marquee-updated', function(e, data){
3976			if (!data || !data.context) return;
3977
3978			var $context = $(data.context);
3979
3980			var $targets = $context.find('.isotope-container, .owl-carousel, .custom-grid-container, .index-scroll-wrapper, .justified-gallery, .linear-container, .uncode-single-media-wrapper, .woocommerce-product-gallery, .grid-container, .btn-container, .nested-carousel')
3981				.add($context.filter('.isotope-container, .owl-carousel, .custom-grid-container, .index-scroll-wrapper, .justified-gallery, .linear-container, .uncode-single-media-wrapper, .woocommerce-product-gallery, .grid-container, .btn-container, .nested-carousel'));
3982
3983			if (!$targets.length) {
3984				$targets = $context.closest('.isotope-container, .owl-carousel, .custom-grid-container, .index-scroll-wrapper, .justified-gallery, .linear-container, .uncode-single-media-wrapper, .woocommerce-product-gallery, .grid-container, .btn-container, .nested-carousel');
3985			}
3986
3987			if (!$targets.length) return;
3988
3989			$targets.each(function(){
3990				$(this).removeAttr('data-lbox-init');
3991				$(this).find('[data-lbox-init]').removeAttr('data-lbox-init');
3992			});
3993
3994			UNCODE.lightgallery($targets);
3995		});
3996	}
3997
3998	var createSelectors = function(){
3999		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
4000			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
4001				$(this).addClass('lbox-trigger-item');
4002			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
4003				$(this).addClass('lbox-nested-item');
4004			} else {
4005				$(this).removeClass('lbox-trigger-item');
4006				$(this).removeClass('lbox-nested-item');
4007			}
4008		});
4009	};
4010
4011	createSelectors();
4012
4013	var galleries = [],
4014		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4015			return !$(this).closest('.nested-carousel').length;
4016		}),
4017		$_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .linear-container:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box .icon-box-icon:not([data-lbox-init]), .icon-box .icon-box-content:not([data-lbox-init]), .grid-container:not([data-lbox-init]), .btn-container:not([data-lbox-init])' + SiteParameters.uncode_lb_add_galleries).has('.lbox-trigger-item').not('.isotope-container *, .owl-carousel *, .index-scroll-wrapper *, .justified-gallery *, .woocommerce-product-gallery *, .grid-container *, .linear-container *'), 
4018		$galleries = $_galleries.filter(function( index ) {
4019			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4020		}),
4021		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
4022
4023	if ( typeof $el === 'undefined' ) {
4024		$el = $galleries.add( $nested );
4025	}
4026
4027	var $disabled = $('a.lb-disabled');
4028	$disabled.on('click', function(e){
4029		e.preventDefault();
4030	});
4031
4032	var beforeSlide = function(event) {
4033		var detail = event.detail,
4034			info = detail.info,
4035			item = detail.item,
4036			$slide = $(detail.currentSlide.selector),
4037			$video = $('video', $slide),
4038			$previous = $(detail.previousSlide.selector),
4039			$prevVideo = $('video', $previous),
4040			isAudio = false;
4041
4042		if ( typeof info.src !== 'undefined' ) {
4043			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
4044		}
4045
4046		if ( ! $video.length && ( info.video || isAudio ) ) {
4047			if ( info.video ) {
4048				if ( typeof info.video === 'object' ) {
4049					var infoJson = info.video;
4050				} else {
4051					var infoJson = JSON.parse(info.video);
4052				}
4053				var src = infoJson.source[0].src,
4054					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
4055					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
4056					loop = $(item).attr('data-loop');
4057
4058			} else if ( isAudio ) {
4059				var src = info.src,
4060					autoplay = true,
4061					loop = false;
4062			}
4063			if ( typeof src !== 'undefined' ) {
4064				$slide.addClass('has-html5');
4065				var video = document.createElement('video');
4066				video.src = src;
4067				video.preload = 'auto';
4068				video.controls = 'controls';
4069				video.controlsList = 'nodownload';
4070				if ( autoplay ) {
4071					video.autoplay = 'autoplay';
4072				}
4073				if ( muted ) {
4074					video.muted = 'muted';
4075				}
4076				if ( loop ) {
4077					video.loop = 'loop';
4078				}
4079				$(video).appendTo($slide);
4080			}
4081		} else {
4082			var $video = $('video', $slide);
4083			if ( $video.length ) {
4084				$video[0].currentTime = 0;
4085				if ( $video[0].autoplay ) {
4086					$video[0].play();
4087				}
4088			}
4089		}
4090		if ( $prevVideo.length ) {
4091			$prevVideo[0].currentTime = 0;
4092			$prevVideo[0].pause();
4093		}
4094	};
4095
4096	var beforeOpen = function(event) {
4097		var detail = event.detail,
4098			items = detail.items,
4099			galleryItems = detail.galleryItems,
4100			outer = detail.outer.selector,
4101			i, ii;
4102		for ( i = 0; i < galleryItems.length; i++ ) {
4103			var item = galleryItems[i];
4104			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
4105				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
4106			}
4107		}
4108		for ( ii = 0; ii < items.length; ii++ ) {
4109			var item = items[ii];
4110			if ( $(item).attr('data-icon') === 'video' ) {
4111				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
4112			}
4113		}
4114
4115	};
4116
4117	//caption builder
4118	var captionBuilder = function($el){
4119		$el.each( function( index, val ) {
4120			var $gallery = $(this).attr('data-lbox-init','true'),
4121				$_a = '.lbox-trigger-item',
4122				$_nested_a = '.lbox-nested-item';
4123
4124			$gallery.find($_a).add($_nested_a).each(function(){
4125				var $a = $(this),
4126					$img = $('img', $a).first(),
4127					imgw = $img.attr('data-width'),
4128					imgh = $img.attr('data-height'),
4129					caption = $a.attr('data-caption'),
4130					title = $a.attr('data-title');
4131
4132				if ( $img.length && $img.attr('data-crop') != true ) {
4133					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
4134						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
4135					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
4136						$a.attr('data-external-thumb-image', $img[0].src);
4137					}
4138				}
4139
4140				if ( typeof title !== 'undefined' && title !== '' ) {
4141					title = '<h6>' + title + '</h6>';
4142				} else {
4143					title = '';
4144				}
4145
4146				if ( typeof caption !== 'undefined' && caption !== '' ) {
4147					caption = '<p>' + caption + '</p>';
4148					title += caption;
4149				}
4150
4151				if ( title !== '' ) {
4152					$a.attr( 'title', title );
4153				}
4154
4155				if ( $img.attr('data-crop') != true && typeof imgw !== 'undefined' && typeof imgh !== 'undefined' && imgw !== '' && imgh !== '' && ( typeof $a.attr('data-lg-size') === 'undefined' || !$a.attr('data-lg-size') ) ) {
4156					$a.attr('data-lg-size', imgw + '-' + imgh);
4157				}
4158			});
4159		});
4160	};
4161	captionBuilder($el);
4162
4163	//regular galleries
4164	$el.each( function( index, val ) {
4165		var $gallery = $(this),
4166			$_a = '.lbox-trigger-item',
4167			$_nested_a = '.lbox-nested-item',
4168			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
4169			galleryID = $_first.attr('data-lbox'),
4170			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
4171			tmb = $_first.attr('data-notmb'),
4172			social = $_first.attr('data-social'),
4173			deep = $_first.attr('data-deep'),
4174			zoom = $_first.attr('data-zoom-origin'),
4175			actual = $_first.attr('data-actual-size'),
4176			download = $_first.attr('data-download'),
4177			controls = $_first.attr('data-arrows') !== 'no',
4178			fullScreen = $_first.attr('data-full'),
4179			counter = $_first.attr('data-counter'),
4180			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
4181			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4182			connect = $_first.attr('data-connect'),
4183			lgPlugins = [lgVideo],
4184			itemsLoadedTimeOut;
4185
4186		if ( typeof galleryID === 'undefined' ) {
4187			galleryID = $gallery.attr('id');
4188		}
4189
4190		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4191		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4192
4193		if ( typeof tmb == 'undefined' || !tmb ) {
4194			lgPlugins.push(lgThumbnail);
4195		}
4196		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
4197			lgPlugins.push(lgZoom);
4198		}
4199		if ( typeof deep != 'undefined' && deep != '' ) {
4200			lgPlugins.push(lgHash);
4201		}
4202		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4203			lgPlugins.push(lgFullscreen);
4204		}
4205		if ( social ) {
4206			lgPlugins.push(lgShare);
4207		}
4208
4209		if ( galleries.indexOf( galleryID ) !== -1 ) {
4210			return true;
4211		}
4212
4213		galleries.push( galleryID );
4214		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
4215			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
4216		var gallery = lightGallery( $triggerGal[0], {
4217			addClass: containerClass,
4218			plugins: lgPlugins,
4219			mode: transition,
4220			selector: $selector,
4221			galleryId: galleryID,
4222			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4223			iframeWidth: '848px',
4224			iframeMaxWidth: '90%',
4225			iframeMaxHeight: '90%',
4226			exThumbImage: 'data-external-thumb-image',
4227			loadYouTubeThumbnail: false,
4228			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' || $gallery.closest('[data-lb-autoplay=yes]').length ),
4229			// autoplayFirstVideo: false,
4230			pager: false,
4231			startClass: 'lg-start-opacity',
4232			zoomFromOrigin: zoom,
4233			controls: controls,
4234			download: ( typeof download != 'undefined' && download != '' ),
4235			thumbWidth: 50,
4236			thumbHeight: '50px',
4237			counter: $triggerGal.find($selector).length > 1 ? counter : false,
4238			loadYouTubePoster: false,
4239			enableDrag: $triggerGal.find($selector).length > 1,
4240			mobileSettings: {
4241				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4242			},
4243		});
4244
4245		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
4246			e.preventDefault();
4247			var index = $(this).closest('.owl-item.cloned').attr('data-index');
4248			gallery.openGallery(index-1);
4249		});
4250
4251		$gallery.on('uncode-gallery-trigger', function(){
4252			gallery.openGallery(0);
4253		});
4254
4255		$triggerGal.on('more-items-loaded', function(e, items) {
4256			clearRequestTimeout(itemsLoadedTimeOut);
4257			itemsLoadedTimeOut = requestTimeout(function(){
4258				createSelectors();
4259				captionBuilder($triggerGal);
4260				gallery.refresh();
4261			}, 100);
4262		});
4263
4264		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4265			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4266				$el = model.view.$el;
4267				if ( $el.find($triggerGal).length ) {
4268					gallery.destroy();
4269				}
4270			});
4271		}
4272
4273		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
4274		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
4275		$triggerGal[0].addEventListener('lgAfterOpen', function(){
4276			$(window).trigger('uncode-custom-cursor');
4277		});
4278
4279	});
4280
4281	if ( typeof $el !== 'undefined' ) {
4282
4283		//album galleries
4284		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
4285			var album = val,
4286				galleryID = index,
4287				$album = $(album),
4288				params = $album.attr('data-album'),
4289				tmb = $(val).attr('data-notmb'),
4290				social = $(val).attr('data-social'),
4291				deep = $(val).attr('data-deep'),
4292				actual = $(val).attr('data-actual-size'),
4293				download = $(val).attr('data-download'),
4294				controls = $(val).attr('data-arrows') !== 'no',
4295				fullScreen = $(val).attr('data-full'),
4296				counter = $(val).attr('data-counter'),
4297				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
4298				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4299				lgPlugins = [lgVideo];
4300
4301			$(val).attr('data-lbox-init','true');
4302
4303			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4304			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4305
4306			if ( typeof tmb == 'undefined' || !tmb ) {
4307				lgPlugins.push(lgThumbnail);
4308			}
4309			if ( typeof actual != 'undefined' && actual != '' ) {
4310				lgPlugins.push(lgZoom);
4311			}
4312			if ( typeof deep != 'undefined' && deep != '' ) {
4313				lgPlugins.push(lgHash);
4314			}
4315			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4316				lgPlugins.push(lgFullscreen);
4317			}
4318			if ( social ) {
4319				lgPlugins.push(lgShare);
4320			}
4321
4322			var gallery = window.lightGallery(album, {
4323				dynamic: true,
4324				plugins: lgPlugins,
4325				dynamicEl: JSON.parse(params),
4326				galleryId: galleryID,
4327				addClass: containerClass,
4328				mode: transition,
4329				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4330				iframeWidth: '848px',
4331				iframeMaxWidth: '90%',
4332				iframeMaxHeight: '90%',
4333				loadYouTubeThumbnail: false,
4334				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
4335				// autoplayFirstVideo: false,
4336				pager: false,
4337				startClass: 'lg-start-opacity',
4338				zoomFromOrigin: false,
4339				controls: controls,
4340				download: ( typeof download != 'undefined' && download != '' ),
4341				thumbWidth: 50,
4342				thumbHeight: '50px',
4343				loadYouTubePoster: false,
4344				counter: counter,
4345				exThumbImage: 'data-external-thumb-image',
4346				loadYouTubePoster: false,
4347				mobileSettings: {
4348					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4349				},
4350			});
4351
4352			$album.on('click', function(){
4353				gallery.openGallery(0);
4354			});
4355
4356			album.addEventListener('lgBeforeSlide', beforeSlide);
4357			album.addEventListener('lgBeforeOpen', beforeOpen);
4358			album.addEventListener('lgAfterOpen', function(){
4359				$(window).trigger('uncode-custom-cursor');
4360			});
4361
4362			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4363				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4364					$el = model.view.$el;
4365					if ( $el.find($album).length ) {
4366						gallery.destroy();
4367					}
4368				});
4369			}
4370
4371		});
4372
4373		//single images
4374		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
4375			var gallery = lightGallery( $('.page-wrapper')[0], {
4376				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
4377				iframeWidth: '848px',
4378				iframeMaxWidth: '90%',
4379				iframeMaxHeight: '90%',
4380				loadYouTubeThumbnail: false,
4381				// autoplayFirstVideo: false,
4382				startClass: 'lg-start-opacity',
4383				thumbWidth: 50,
4384				thumbHeight: '50px',
4385				download: false,
4386				loadYouTubePoster: false,
4387				counter: false
4388			});
4389
4390			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
4391			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
4392		});
4393	}
4394
4395	var galleryButtons = function(){
4396		var $buttons = $('.btn-gallery-trigger');
4397		$buttons.each(function(key, val){
4398			var $button = $(val),
4399				target = $button.attr('data-target'),
4400				$gallery = $('.un-media-gallery').first(),
4401				$row = $button.closest('.vc_row[data-parent]');
4402			if ( typeof target !== 'undefined' && target !== '' && $('.un-media-gallery#' + target).length  ) {
4403				$gallery = $('.un-media-gallery#' + target);
4404			} else if ( $('.un-media-gallery', $row).length ) {
4405				$gallery = $('.un-media-gallery', $row).first();
4406			}
4407			
4408			$button.on('click', 'a', function(e){
4409				e.preventDefault();
4410				$gallery.find('[data-lbox-init]').first().trigger('uncode-gallery-trigger');
4411			});
4412		});
4413	};
4414	galleryButtons();
4415};
4416
4417UNCODE.carousel = function(container) {
4418	var $owlContainers = $('.owl-carousel-container', container);
4419	$owlContainers.each(function() {
4420		var $owlContainer = $(this),
4421			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
4422			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
4423			values = {},
4424			tempTimeStamp,
4425			newWidth = UNCODE.wwidth,
4426			$owlInsideEqual = [];
4427		$owlSelector.each(function() {
4428			var itemID = $(this).attr('id'),
4429				$elSelector = $(('#' + itemID).toString());
4430			values['id'] = itemID;
4431			values['items'] = 1;
4432			values['columns'] = 3;
4433			values['fade'] = false;
4434			values['nav'] = false;
4435			values['navmobile'] = false;
4436			values['navskin'] = 'light';
4437			values['navspeed'] = 400;
4438			values['dots'] = false;
4439			values['dotsmobile'] = false;
4440			values['loop'] = false;
4441			values['autoplay'] = false;
4442			values['timeout'] = 3000;
4443			values['autoheight'] = false;
4444			values['stagepadding'] = 0;
4445			values['margin'] = 0;
4446			values['lg'] = 1;
4447			values['md'] = 1;
4448			values['sm'] = 1;
4449			$.each($(this).data(), function(i, v) {
4450				values[i] = v;
4451			});
4452
4453			if ($(this).closest('.uncode-slider').length) {
4454				values['navskin'] = '';
4455				values['navmobile'] = false;
4456				//values['dotsmobile'] = true;
4457			} else {
4458				values['navskin'] = ' style-'+values['navskin']+' style-override';
4459			}
4460
4461			var setIndexActive = function(event, init){
4462				var init = typeof init === 'undefined' ? false : init,
4463					thiis = $(event.currentTarget);
4464				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
4465					var scrolltop = $(document).scrollTop(),
4466						size = event.page.size,
4467						i;
4468					var setIndex = requestTimeout(function() {
4469						for ( i = 0; i < size; i++ ) {
4470							var itemCont = event.item.index != null ? (event.item.index + i) : i;
4471							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
4472							if (thiis.closest('.row-slider').length) {
4473								if (currentItem == undefined) {
4474									currentItem = thiis.children()[i];
4475								}
4476								if ($(currentItem).closest('#page-header').length) {
4477									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4478										UNCODE.switchColorsMenu(scrolltop, 'dark');
4479									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4480										UNCODE.switchColorsMenu(scrolltop, 'light');
4481									}
4482								}
4483								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
4484								if (owlCustomNav.length) {
4485									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4486										owlCustomNav.addClass('style-dark').removeClass('style-light');
4487									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4488										owlCustomNav.addClass('style-light').removeClass('style-dark');
4489									}
4490								}
4491							}
4492							var itendIndex = $(currentItem).attr('data-index');
4493							if ( isNaN(itendIndex) ) {
4494								itendIndex = 1;
4495							}
4496							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
4497							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
4498							if ($.fn.counterUp) {
4499								if (size <= 1) {
4500									$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
4501										var $counter = $(this);
4502										$counter.addClass('started').counterUp({
4503											delay: 10,
4504											time: 1500
4505										});
4506									});
4507								} else {
4508									$('.owl-item', $elSelector).eq(itemCont).find('.uncode-counter:not(.started)').addClass('started').counterUp({
4509										delay: 10,
4510										time: 1500
4511									});
4512								}
4513							}
4514						}
4515						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
4516					}, 200);					
4517				}
4518				tempTimeStamp = event.timeStamp;
4519			}
4520
4521			/** Initialize */
4522			$elSelector.on('initialize.owl.carousel', function(event) {
4523				if (typeof UNCODE.owlNav !== 'undefined') {
4524					UNCODE.owlNav(itemID, event);
4525				}
4526
4527				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4528					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
4529						var shortcode = model.attributes.shortcode,
4530							$el = model.view.$el,
4531							$row_wrap = $el.closest('.row');
4532						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4533							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
4534						}
4535					});
4536					window.parent.vc.events.on('shortcodeView:updated', function(model) {
4537						var shortcode = model.attributes.shortcode;
4538						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4539							tempTimeStamp = Math.floor(Date.now() / 1000);
4540						}
4541					});
4542					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
4543						var shortcode = model.attributes.shortcode;
4544						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4545							UNCODE.owlNav(itemID, event);
4546							$elSelector.trigger('refresh.owl.carousel');
4547						}
4548					});
4549				}
4550				// if ( $elSelector.closest('.mega-menu-inner').length ) {
4551				// 	$elSelector.closest('.mega-menu-inner').css({
4552				// 		visibility: 'hidden',
4553				// 		display: 'block'
4554				// 	});
4555				// 	$elSelector.data('owl.carousel');
4556				// 	$elSelector.trigger('refresh.owl.carousel');
4557				// 	$elSelector.closest('.mega-menu-inner').css({
4558				// 		display: 'none',
4559				// 		visibility: '',
4560				// 	});
4561				// }
4562				// $elSelector.closest('[class*="menu-smart"]').on('show.smapi', function(e, p){
4563				// 	$elSelector.trigger("to.owl.carousel", 0);
4564				// });
4565			});
4566
4567			/** Initialized */
4568			$elSelector.on('initialized.owl.navigation', function(event) {
4569				$('.owl-dot', event.currentTarget).each(function(key, val){
4570					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4571				});
4572			});
4573
4574			$elSelector.on('initialized.owl.carousel', function(event) {
4575
4576				if ( $('.isotope-container', event.currentTarget).length ) {
4577					window.dispatchEvent(UNCODE.boxEvent);
4578				}
4579
4580				$('.owl-dot.active', $elSelector).on('click', function(){
4581					return false;
4582				});
4583
4584				var thiis = $(event.currentTarget),
4585					// get the time from the data method
4586					time = thiis.data("timer-id"),
4587					rowParent = thiis.closest('.row-parent');
4588
4589				if ( typeof rowParent[0] !== 'undefined' ) {
4590					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4591				}
4592
4593				if (time) {
4594					clearRequestTimeout(time);
4595				}
4596
4597				thiis.addClass('showControls');
4598				var new_time = requestTimeout(function() {
4599					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4600					if (thiis.hasClass('owl-height-viewport'))
4601						setItemsRelHeight(thiis);
4602					if (thiis.hasClass('owl-height-equal') || thiis.closest('.uncode-wrapper').length) {
4603						setItemsHeight(thiis);
4604					}
4605					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4606					if (thiis.closest('.unequal, .unexpand').length) {
4607						UNCODE.setRowHeight(rowParent[0], true);
4608					}
4609					if (SiteParameters.dynamic_srcset_active === '1') {
4610						UNCODE.refresh_dynamic_srcset_size(thiis);
4611					}
4612				}, 350);
4613				// save the new time
4614				thiis.data("timer-id", new_time);
4615
4616				var scrolltop = $(document).scrollTop();
4617				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4618
4619				//if (!UNCODE.isMobile) {
4620					/** fix autoplay when visible **/
4621				$(window).on('load', function(){
4622					if (thiis.data('autoplay')) {
4623						if ( !thiis.closest('.sticky-element').length || thiis.closest('.un-submenu').length || thiis.closest('.overlay').length ) {
4624							thiis.trigger('stop.owl.autoplay');
4625						} else {
4626							thiis.trigger('play.owl.autoplay');
4627						}
4628					}
4629					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4630						return;
4631					}
4632					if ( ! thiis.closest('.sticky-element').length && ! thiis.closest('.un-submenu').length && ! thiis.closest('.overlay').length ) {
4633						var carouselInView = new Waypoint.Inview({
4634							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4635							element: thiis[0],
4636							exited: function() {
4637								var el = $(this.element);
4638								if (el.data('autoplay') ) {
4639									el.trigger('stop.owl.autoplay');
4640									el.data('stopped','true');
4641								}
4642							},
4643							enter: function(direction) {
4644								var el = $(this.element);
4645								requestTimeout(function() {
4646									if (el.data('autoplay')) {
4647										el.trigger('play.owl.autoplay');
4648										el.data('stopped','false');
4649									}
4650								}, 100);
4651							}
4652						});
4653					}
4654					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4655						setTimeout(function(){
4656							window.lenis.resize();
4657						}, 1000);
4658					}
4659			  	
4660				});
4661				//}
4662
4663				// $(window).on('frontend:carousel_updated', function(){
4664				// 	Waypoint.refreshAll();
4665				// });
4666
4667				if (!thiis.closest('.isotope-system').length && !thiis.closest('.megamenu-block-wrapper').length && !thiis.closest('.overlay').length) {
4668					requestTimeout(function() {
4669						animate_thumb($('.t-inside', el), event);
4670					}, 400);
4671				} 
4672				if (thiis.closest('.isotope-system').length ) {
4673					requestTimeout(function() {
4674						thiis.closest('.isotope-container').isotope('layout');
4675					}, 400);
4676				}
4677				if (thiis.closest('.megamenu-block-wrapper').length ) {
4678					$(document).on('un-menu-show', function(e, $ul){
4679						if ( thiis.closest($ul).length ) {
4680							animate_thumb($('.t-inside', el), event);
4681						}
4682					});
4683				}
4684				if (thiis.closest('.overlay').length ) {
4685					$(window).on('menuOpen', function(e, $ul){
4686						animate_thumb($('.t-inside', el), event);
4687					});
4688				}
4689
4690				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4691				currentIndex = $(currentItem).attr('data-index');
4692
4693				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4694					if ($(val).closest('.uncode-slider').length) {
4695						$(val).removeClass('start_animation');
4696					}
4697				});
4698				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4699					if ($(val).closest('.uncode-slider').length) {
4700						$(val).removeClass('already-animated');
4701					}
4702				});
4703
4704				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4705					if ($(val).closest('.uncode-slider').length) {
4706						$(val).removeAttr('data-animated');
4707					}
4708				});
4709
4710				$.each($('.owl-item.cloned', thiis), function(index, val) {
4711					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4712				});
4713
4714				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4715					if ($(val).attr('data-index') != currentIndex) {
4716						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4717						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4718					}
4719					if ($(val).attr('data-index') != currentIndex) {
4720						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4721					}
4722					if ($(val).attr('data-index') == currentIndex) {
4723						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4724					}
4725				});
4726
4727				if (thiis.closest('.uncode-slider').length) {
4728					var el = thiis.closest('.row-parent')[0],
4729						section = thiis.closest('.vc_section');
4730					if ( section.length ) {
4731						el = $('> .row-parent', section)[0];
4732					}
4733					if ($(el).data('imgready')) {
4734						firstLoaded(el, event);
4735					} else {
4736						el.addEventListener("imgLoaded", function(el) {
4737							firstLoaded(el.target, event);
4738						}, false);
4739					}
4740					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4741					if (transHeight != null) {
4742						requestTimeout(function() {
4743							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4744						}, 100);
4745					}
4746				} else {
4747					var el = thiis;
4748					el.closest('.uncode-slider').addClass('slider-loaded');
4749				}
4750
4751				requestTimeout(function() {
4752					if (typeof UNCODE.bigText !== 'undefined') {
4753						UNCODE.bigText(thiis);
4754					}
4755					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4756						if (thiis.data('autoplay')) pauseOnHover(thiis);
4757					}
4758				}, 500);
4759
4760				if (thiis.closest('.unequal').length) {
4761					$owlInsideEqual.push(thiis.closest('.row-parent'));
4762				}
4763
4764				var containerClasses = '',
4765					containerStyle = '';
4766				if ( $('.owl-dots-classes', $owlContainer).length ) {
4767					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4768					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4769					$('.owl-dots-classes', $owlContainer).remove();
4770				}
4771
4772				if ( containerClasses !== '' ) {
4773					requestTimeout(function() {
4774						if ( containerClasses !== '' )
4775							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4776						if ( containerStyle !== '' )
4777							$('.owl-dots', $owlContainer).addClass(containerClasses);
4778					}, 100);
4779				}
4780
4781				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4782					$(val).closest('.row-inner').css({
4783						'margin-top': '-1px'
4784					});
4785				});
4786
4787				if ($.fn.isotope) {
4788					if ( thiis.closest('.isotope-container').length ) {
4789						if (thiis.closest('.isotope-container').data('isotope')) {
4790							requestTimeout(function(){
4791								thiis.closest('.isotope-container').isotope('layout');
4792							}, 300);
4793						}
4794						$(window).on('load', function(){
4795							if (thiis.closest('.isotope-container').data('isotope')) {
4796								thiis.closest('.isotope-container').isotope('layout');
4797							}
4798						});
4799					}
4800				}
4801
4802				if (thiis.data('autoplay')) {
4803					$(window).on('menuOpen', function(){
4804						if ( thiis.closest('.overlay').length ) {
4805							thiis.trigger('play.owl.autoplay');
4806							thiis.data('stopped','false');
4807						} else {
4808							thiis.trigger('stop.owl.autoplay');
4809							thiis.data('stopped','true');
4810						}
4811					});
4812					$(window).on('menuClose', function(){
4813						if ( thiis.closest('.overlay').length ) {
4814							thiis.trigger('stop.owl.autoplay');
4815							thiis.data('stopped','true');
4816						} else {
4817							thiis.trigger('play.owl.autoplay');
4818							thiis.data('stopped','false');
4819						}
4820					});
4821				}
4822
4823				setIndexActive(event, true);
4824
4825				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4826						return !$(this).closest('.nested-carousel').length;
4827					}),
4828					$_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box:not([data-lbox-init]), .grid-container:not([data-lbox-init])', thiis).has(nested_a),
4829					$galleries = $_galleries.filter(function( index ) {
4830						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4831					});
4832
4833				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4834					UNCODE.lightgallery( $galleries );
4835				}
4836
4837				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4838					$(document).trigger('uncode-scrolltrigger-refresh');
4839				}
4840
4841				if (thiis.closest('.overlay').length && thiis.data('autoplay')) {
4842					thiis.trigger('stop.owl.autoplay');
4843					thiis.data('stopped','true');
4844				}
4845
4846				if (thiis.closest('.un-submenu').length && thiis.data('autoplay')) {
4847					thiis.trigger('stop.owl.autoplay');
4848					thiis.data('stopped','false');
4849					$(document).on('un-menu-show', function(){
4850						thiis.trigger('play.owl.autoplay');
4851						thiis.data('stopped','false');
4852					}).on('un-menu-hide', function(){
4853						thiis.trigger('stop.owl.autoplay');
4854						thiis.data('stopped','true');
4855					});
4856				}
4857			});
4858
4859			$elSelector.on('resized.owl.carousel', function(event) {
4860				$('.owl-dot', event.currentTarget).each(function(key, val){
4861					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4862				});
4863			});
4864
4865			$elSelector.on('resized.owl.carousel', function(event) {
4866				var thiis = $(event.currentTarget);
4867				// if ($(this).closest('.nested-carousel').length) {
4868				// 	requestTimeout(function() {
4869				// 		window.dispatchEvent(UNCODE.boxEvent);
4870				// 	}, 200);
4871				// }
4872				if ( thiis.hasClass('owl-height-equal') )
4873					setItemsHeight(thiis);
4874
4875				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4876					newWidth = UNCODE.wwidth;
4877					setItemsRelHeight($elSelector);
4878				}
4879
4880				setIndexActive(event);
4881
4882				if (SiteParameters.dynamic_srcset_active === '1') {
4883					UNCODE.refresh_dynamic_srcset_size(thiis);
4884				}
4885
4886				if ($.fn.isotope) {
4887					$(window).on('load', function(){
4888						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4889							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4890						}
4891					});
4892				}
4893
4894				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4895					setTimeout(function(){
4896						window.lenis.resize();
4897					}, 1000);
4898				}
4899				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4900					$(document).trigger('uncode-scrolltrigger-refresh');
4901				}
4902			});
4903
4904			$elSelector.on('refreshed.owl.carousel', function(event) {
4905				setIndexActive(event);
4906			});
4907
4908			/** detect resize window for fluid height layout */
4909			var setFluidResize;
4910			function manageFluidCarouseHeight() {
4911				clearRequestTimeout(setFluidResize);
4912				setFluidResize = requestTimeout(function(){
4913					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4914						newWidth = UNCODE.wwidth;
4915						setItemsRelHeight($elSelector);
4916					}
4917				}, 100);
4918			}
4919			window.addEventListener('resize', manageFluidCarouseHeight);
4920
4921			/** Change */
4922			$elSelector.on('change.owl.carousel', function(event) {
4923				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4924			});
4925
4926			/** Changed */
4927			$elSelector.on('changed.owl.carousel', function(event) {
4928				var $row = $elSelector.parents('.row')[0];
4929				if ( typeof $row !== 'undefined' ) {
4930					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4931				}
4932				setIndexActive(event);
4933			});
4934
4935			var checkDrag = function(e) {
4936				$elSelector.addClass('owl-dragging');
4937			};
4938			$elSelector.on('drag.owl.carousel', function(event) {
4939				document.addEventListener("mousemove", checkDrag);
4940			});
4941
4942			$elSelector.on('dragged.owl.carousel', function(event) {
4943				$elSelector.removeClass('owl-dragging');
4944				document.removeEventListener("mousemove", checkDrag);
4945			});
4946
4947			$elSelector.on('translate.owl.carousel', function(event) {
4948				if (UNCODE.isMobile) {
4949					$(event.currentTarget).addClass('owl-translating');
4950				}
4951			});
4952
4953			/** Translated */
4954			$elSelector.on('translated.owl.carousel', function(event) {
4955
4956				var thiis = $(event.currentTarget),
4957					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4958					currentIndex = $(currentItem).attr('data-index'),
4959					stagePadding = thiis.data('stagepadding');
4960
4961				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4962
4963				if (!UNCODE.isMobile) {
4964					UNCODE.owlPlayVideo(thiis);
4965				}
4966
4967				requestTimeout(function(){
4968					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4969					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4970					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4971						if (lastDelayElems == undefined) lastDelayElems = 0;
4972						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4973						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4974						thiis.trigger('stop.owl.autoplay');
4975						requestTimeout(function() {
4976							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4977						}, maxDelay);
4978					}
4979				}, 200);
4980
4981				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4982					if ($(val).closest('.uncode-slider').length) {
4983						$(val).removeClass('start_animation');
4984					}
4985				});
4986
4987				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4988					if ($(val).closest('.uncode-slider').length) {
4989						$(val).removeClass('already-animated');
4990					}
4991				});
4992
4993				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4994					if ($(val).closest('.uncode-slider').length) {
4995						$(val).removeAttr('data-animated');
4996					}
4997				});
4998
4999				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
5000					if ($(val).attr('data-index') != currentIndex) {
5001						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
5002						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
5003					}
5004					if ($(val).attr('data-index') != currentIndex) {
5005						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
5006					}
5007					if ($(val).attr('data-index') == currentIndex) {
5008						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
5009					}
5010				});
5011
5012				if (UNCODE.isMobile) {
5013					thiis.removeClass('owl-translating');
5014				}
5015
5016				setIndexActive(event);
5017			});
5018
5019			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
5020
5021			/** Init carousel */
5022			$elSelector.not('.showControls').owlCarousel({
5023				items: values['items'],
5024				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
5025				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
5026				nav: values['nav'],
5027				dots: values['dots'],
5028				loop: values['loop'],
5029				stagePadding: values['stagepadding'],
5030				margin: 0,
5031				video: true,
5032				autoWidth: false,
5033				autoplay: false,
5034				autoplayTimeout: values['timeout'],
5035				autoplaySpeed: values['navspeed'],
5036				autoplayHoverPause: $(this).closest('.uncode-slider:not(.uncode-wrapper)').length || $(this).closest('.carousel-no-hover').length ? false : true,
5037				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
5038				itemSelector: SiteParameters.uncode_carousel_itemSelector,
5039				rtl: $('body').hasClass('rtl') ? true : false,
5040				fluidSpeed: true,
5041				navSpeed: values['navspeed'],
5042				dotsSpeed: values['navspeed'] / values['items'],
5043				navElement: ['button type="button" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" aria-label="' + SiteParameters.uncode_next_label + '"'],
5044				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
5045				navText: ['<div class="owl-nav-container btn-default btn-hover-nobg" tabindex="0"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg" aria-label="' + SiteParameters.uncode_next_label + '" tabindex="0"><i class="fa fa-fw fa-angle-right"></i></div>'],
5046				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
5047				responsiveClass: true,
5048				responsiveBaseElement: '.box-container',
5049				responsive: {
5050					0: {
5051						items: values['sm'],
5052						nav: values['navmobile'],
5053						dots: values['dotsmobile'],
5054						dotsSpeed: values['navspeed'] / values['sm'],
5055					},
5056					480: {
5057						items: values['sm'],
5058						nav: values['navmobile'],
5059						dots: values['dotsmobile'],
5060						dotsSpeed: values['navspeed'] / values['sm'],
5061					},
5062					570: {
5063						items: values['md'],
5064						nav: values['navmobile'],
5065						dots: values['dotsmobile'],
5066						dotsSpeed: values['navspeed'] / values['md'],
5067					},
5068					960: {
5069						items: values['lg'],
5070						dotsSpeed: values['navspeed'] / values['lg'],
5071					}
5072				}
5073			});
5074
5075			var transDuration = parseFloat(values['navspeed']) * 0.3;
5076			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
5077
5078			$('.owl-item .tmb', $elSelector).css({
5079				'-webkit-transition-delay': transDuration + 'ms',
5080				'-moz-transition-delay': transDuration + 'ms',
5081				'-o-transition-delay': transDuration + 'ms',
5082				'transition-delay': transDuration + 'ms',
5083				'-webkit-transition-duration': transDuration2 + 'ms',
5084				'-moz-transition-duration': transDuration2 + 'ms',
5085				'-o-transition-duration': transDuration2 + 'ms',
5086				'transition-duration': transDuration2 + 'ms',
5087			});
5088
5089			requestTimeout(function() {
5090				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5091					UNCODE.setRowHeight($owlInsideEqual[i]);
5092				};
5093			}, 300);
5094
5095			$(window).on('load', function(){
5096				var $elCarousel = $elSelector.data('owl.carousel');
5097				if ( typeof $elCarousel !== 'undefined' ) {
5098					$elCarousel.trigger('refreshed');
5099					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5100						UNCODE.setRowHeight($owlInsideEqual[i]);
5101					};
5102				}
5103			});
5104
5105			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
5106				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5107					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
5108					$('#' + carousel_id).find('.owl-item').each( function() {
5109						var $item = $(this),
5110							index = ( $item.index() + 1 );
5111						$item.attr('data-index', index);
5112					});
5113				}
5114			});
5115
5116			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5117				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
5118					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5119						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
5120						$('#' + carousel_id).find('.owl-item').each( function() {
5121							var $item = $(this),
5122								index = ( $item.index() + 1 );
5123							$item.attr('data-index', index);
5124						});
5125					}
5126				});
5127			}
5128
5129		});
5130
5131		function firstLoaded(el, event) {
5132			var el = $(el),
5133			uncode_slider = el.find('.uncode-slider');
5134			el.find('.owl-carousel').css('opacity', 1);
5135			uncode_slider.addClass('slider-loaded');
5136			if (typeof UNCODE.bigText !== 'undefined') {
5137				UNCODE.bigText(el.find('.owl-item.active'));
5138			}
5139			//if (!UNCODE.isMobile) {
5140				requestTimeout(function() {
5141					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
5142					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
5143					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
5144						if (lastDelayElems == undefined) lastDelayElems = 0;
5145						if (lastDelayThumb == undefined) lastDelayThumb = 0;
5146						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
5147						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
5148						requestTimeout(function() {
5149							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
5150						}, maxDelay);
5151					}
5152				}, 500);
5153
5154			//}
5155		}
5156
5157		function navHover(el) {
5158			var $owlCont = el,
5159				$owlPrev = $owlCont.find('.owl-prev'),
5160				$owlNext = $owlCont.find('.owl-next'),
5161				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
5162				$owlPagination = $owlCont.next(),
5163				owlPrevW = $owlPrev.outerWidth(),
5164				owlNextW = $owlNext.outerWidth(),
5165				owlDotsH = $owlDots.innerHeight(),
5166				owlTime = 400,
5167				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5168			if ( $('body').hasClass('rtl') ) {
5169				$owlPrev.css("margin-right", -owlPrevW);
5170				$owlNext.css("margin-left", -owlNextW);
5171			} else {
5172				$owlPrev.css("margin-left", -owlPrevW);
5173				$owlNext.css("margin-right", -owlNextW);
5174			}
5175			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
5176			$owlCont.mouseenter(function() {
5177				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5178				$owlPrev.add($owlNext).css({
5179					marginLeft: 0,
5180					marginRight: 0
5181				});
5182				if (!owlNested) {
5183					$owlDots.css({
5184						opacity: 1,
5185						bottom: 0
5186					});
5187				}
5188			}).mouseleave(function() {
5189				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5190				if ( $('body').hasClass('rtl') ) {
5191					$owlPrev.css("margin-right", -owlPrevW);
5192					$owlNext.css("margin-left", -owlNextW);
5193				} else {
5194					$owlPrev.css("margin-left", -owlPrevW);
5195					$owlNext.css("margin-right", -owlNextW);
5196				}
5197				if (!owlNested) {
5198					$owlDots.css({
5199						opacity: 1,
5200						bottom: -owlDotsH
5201					});
5202				}
5203			});
5204		};
5205
5206		function animate_elems($this) {
5207			var lastDelay;
5208			$.each($('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside), .animate_when_parent_almost_visible:not(.t-inside)', $this), function(index, val) {
5209				var element = $(val),
5210					delayAttr = element.attr('data-delay'),
5211					$first_item = element.closest('.owl-item[data-index="1"]');
5212
5213				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
5214					return false;
5215				}
5216
5217				if (delayAttr == undefined) delayAttr = 0;
5218				requestTimeout(function() {
5219					element.addClass('start_animation');
5220				}, delayAttr);
5221				lastDelay = delayAttr;
5222			});
5223			return lastDelay;
5224		}
5225
5226		function animate_thumb(items, event) {
5227			var lastDelay,
5228				itemIndex,
5229				thiis = $(event.currentTarget),
5230				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
5231				numActives = $('.owl-item.active', thiis).length,
5232				stagePadding = thiis.data('stagepadding');
5233
5234			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
5235
5236			thiis.data('tempIndex', event.item.index);
5237				$.each(items, function(index, val) {
5238					var parent = $(val).closest('.owl-item');
5239					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5240						return;
5241					}
5242					if (!$(val).hasClass('start_animation')) {
5243						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
5244							var thumbInView = new Waypoint.Inview({
5245							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5246							  element: val,
5247							  enter: function(direction) {
5248								var element = $(this.element),
5249										delayAttr = parseInt(element.attr('data-delay')),
5250										itemIndex = element.closest('.owl-item').index() + 1,
5251										menuIndex = parseFloat(element.closest('.owl-item').attr('data-index')),
5252										diffItem = Math.abs(itemIndex - tempIndex) - 1;
5253									if ( thiis.closest('.megamenu-block-wrapper').length ) {
5254										diffItem = menuIndex;
5255									} else {
5256										if (itemIndex > tempIndex) {
5257											thiis.data('tempIndex', itemIndex);
5258										}
5259									}
5260									if (isNaN(delayAttr)) delayAttr = 100;
5261									if (stagePadding) {
5262										var objTimeout = requestTimeout(function() {
5263											if ( !element.closest('.overlay:not(.open)').length ) {
5264												element.addClass('start_animation');
5265											}
5266										}, index * delayAttr);
5267										lastDelay = index * delayAttr;
5268									} else {
5269										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
5270										var objTimeout = requestTimeout(function() {
5271											element.attr('data-test', diffItem + ' ' + delayAttr).addClass('start_animation');
5272										}, diffItem * delayAttr);
5273										lastDelay = diffItem * delayAttr;
5274									}
5275									parent.data('objTimeout', objTimeout);
5276									if (!UNCODE.isUnmodalOpen) {
5277										this.destroy();
5278									}
5279								}
5280							});
5281						}
5282					}
5283				});
5284				return lastDelay;
5285			}
5286
5287		function setItemsHeight(item) {
5288			$.each($('.owl-item', item), function(index, val) {
5289				var availableThumbHeight = $('.t-inside', $(val)).height(),
5290				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
5291				difference = availableThumbHeight - innerThumbHeight;
5292				if ($('.tmb-content-under', val).length) {
5293					var visualPart = $('.t-entry-visual', val);
5294					if (visualPart.length) {
5295						difference -= $('.t-entry-visual', val).height();
5296					}
5297				}
5298				if (! $('.tmb-content-lateral', val).length)
5299					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
5300			});
5301		}
5302
5303		function setItemsRelHeight(item) {
5304			$.each($('.owl-item', item), function(index, val) {
5305				var $rowContainer = $(item).parents('.row-parent').eq(0),
5306					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
5307					$colContainer = $(item).parents('.uncell').eq(0),
5308					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
5309					winHeight = UNCODE.wheight,
5310					multiplier_h = parseInt($(item).attr('data-vp-height')),
5311					data_viewport_h,
5312					consider_menu = $(item).data('vp-menu');
5313
5314				if ( consider_menu ) {
5315					winHeight = winHeight - UNCODE.menuHeight;
5316				}
5317
5318				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
5319				$('.t-inside', val).css( 'height', data_viewport_h );
5320			});
5321		}
5322
5323		function pauseOnHover(slider) {
5324			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
5325			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
5326				mouseenter: function () {
5327					$(slider).addClass('owl-mouseenter');
5328					$(slider).trigger('stop.owl.autoplay');
5329				},
5330				mouseleave: function () {
5331					$(slider).removeClass('owl-mouseenter');
5332					$(slider).trigger('play.owl.autoplay');
5333				}
5334			});
5335		}
5336	});
5337};
5338
5339UNCODE.owlPlayVideo = function(carousel) {
5340	var player, iframe;
5341	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
5342		var content = $(val).html();
5343		if (content == '') {
5344			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
5345			$(val).append(getCloned);
5346		}
5347		if ($(this).attr('data-provider') == 'vimeo') {
5348			iframe = $(this).find('iframe');
5349			player = new Vimeo.Player(iframe[0]);
5350			player.play();
5351		} else if ($(this).attr('data-provider') == 'youtube') {
5352			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
5353		} else {
5354			var player = $(this).find('video');
5355			if (player.length) {
5356				$(this).find('video')[0].volume = 0;
5357				$(this).find('video')[0].play();
5358				$(val).css('opacity', 1);
5359			}
5360		}
5361	});
5362};
5363
5364UNCODE.owlStopVideo = function(carousel) {
5365	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
5366		var player, iframe;
5367		if ($(this).attr('data-provider') == 'vimeo') {
5368			iframe = $(this).find('iframe');
5369			player = new Vimeo.Player(iframe[0]);
5370			player.pause();
5371		} else if ($(this).attr('data-provider') == 'youtube') {
5372			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
5373		} else {
5374			var player = $(this).find('video');
5375			if (player.length) {
5376				$(this).find('video')[0].volume = 0;
5377				$(this).find('video')[0].play();
5378			}
5379		}
5380	});
5381};
5382
5383UNCODE.animations = function() {
5384
5385	var runWaypoints_TO,
5386		runWaypoints_carousel_TO,
5387		runWaypoints_delay = 0,
5388	highlightComplexFunc = function($wrap, ev){
5389
5390		var $lines = $('.heading-line-wrap', $wrap),
5391			not_animate = false;
5392
5393		if ( $wrap.data('animate') === true ) {
5394			not_animate = true;
5395		}
5396
5397		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
5398		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
5399			return;
5400		}
5401
5402		$lines.each(function(_key, _value){
5403			var $line = $(_value),
5404				$inners = $('.split-word-inner', $line),
5405				$highlights = $('.heading-text-highlight-inner', $line);
5406
5407			var highlitInnerFunc = function(ev){
5408				var delay = 0;
5409				$highlights.each(function(h_key, high){
5410					var $highlight = $(high),
5411						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
5412						$nextSplit = $split.nextUntil(),
5413						$next = $('.heading-text-highlight-inner', $nextSplit),
5414						countCh = $split.text().length;
5415
5416					$highlight.css({
5417						'-webkit-transition-duration': (30 * countCh) + 'ms',
5418						'-moz-transition-duration': (30 * countCh) + 'ms',
5419						'-o-transition-duration': (30 * countCh) + 'ms',
5420						'transition-duration': (30 * countCh) + 'ms',
5421					});
5422
5423					delay += (30 * countCh);
5424
5425					$next.css({
5426						'-webkit-transition-delay': delay + 'ms',
5427						'-moz-transition-delay': delay + 'ms',
5428						'-o-transition-delay': delay + 'ms',
5429						'transition-delay': delay + 'ms',
5430					});
5431				});
5432				$highlights.removeAttr('data-animated');
5433				if ( _key+1 === $lines.length ) {
5434					$wrap.data('animate', true);
5435				}
5436			};
5437
5438			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
5439				if ( not_animate ) {
5440					$highlights.each(function(h_key, high){
5441						var $highlight = $(high);
5442						$highlight.css({
5443							'-webkit-transition-duration': '0ms',
5444							'-moz-transition-duration': '0ms',
5445							'-o-transition-duration': '0ms',
5446							'transition-duration': '0ms',
5447						});
5448					});
5449					$highlights.removeAttr('data-animated');
5450				} else {
5451					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
5452						highlitInnerFunc();
5453					} else {
5454						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
5455					}
5456				}
5457			}
5458		});
5459	};
5460
5461	$.each($('.header-content-inner'), function(index, val) {
5462		var element = $(val),
5463			transition = '';
5464		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
5465		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
5466		if (element.hasClass('left-t-right')) transition = 'left-t-right';
5467		if (element.hasClass('right-t-left')) transition = 'right-t-left';
5468		if (element.hasClass('zoom-in')) transition = 'zoom-in';
5469		if (element.hasClass('zoom-out')) transition = 'zoom-out';
5470		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
5471		if (element.hasClass('slight-anim')) transition = 'slight-anim';
5472		if (transition != '') {
5473			$(val).removeClass(transition);
5474			var container = element,
5475				containerDelay = container.attr('data-delay'),
5476				containerSpeed = container.attr('data-speed'),
5477				items = $('.header-title > *, .post-info', container);
5478			$.each(items, function(index, val) {
5479				var element = $(val),
5480					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
5481					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
5482				if (!element.hasClass('animate_when_almost_visible') && !element.hasClass('translate_when_almost_visible')) {
5483					delayAttr = Number(delayAttr) + (400 * index);
5484					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
5485					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
5486				}
5487			});
5488			container.css('opacity', 1);
5489		}
5490	});
5491
5492	function animate_css_grids_on_load() {
5493		$('.cssgrid-system').each(function() {
5494			var grid = $(this);
5495			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
5496			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
5497		});
5498	}
5499
5500	var delayAdd = 0;
5501
5502	window.waypoint_animation = function(ev) {
5503		$.each($('.translate_when_almost_visible:not(.start_animation), .animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-linear .animate_when_almost_visible:not(.start_animation), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)').filter(function(){
5504				var $el = $(this);
5505				if (!$el.is('[data-delay-seq]')) return true;
5506				return $el.is('[data-delay]');
5507			}), function(index, val) {
5508			if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length || $(val).closest('.tab-pane:not(.active)').length || $(val).closest('.panel:not(.active-group)').length || $(val).closest('.un-submenu').length || $(val).closest('#uncode-mobile-menu-block').length || $(val).closest('.has-unblock').length ) && !SiteParameters.is_frontend_editor ) ) {
5509				return true;
5510			}
5511			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5512				return;
5513			}
5514			var run = true,
5515				$carousel = $(val).closest('.owl-carousel'),
5516				marquee = $(val).closest('.tmb-linear').length;
5517			if ( $carousel.length ) {
5518				run = false;
5519			}
5520			if ( $(val).closest('.megamenu-block-wrapper').length ) {
5521				run = false;
5522			}
5523			if (run) {
5524				new Waypoint({
5525					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5526					element: val,
5527					handler: function() {
5528						var element = $(this.element),
5529							index = element.index(),
5530							delayAttr = element.attr('data-delay');
5531						if (delayAttr == undefined) delayAttr = 0;
5532						// delayAttr = parseFloat(delayAttr) + delayAdd;
5533						// if ( marquee ) {
5534						// 	delayAdd += 50;
5535						// } else {
5536						// 	delayAdd = 0;
5537						// }
5538						requestTimeout(function() {
5539							element.addClass('start_animation');
5540						}, delayAttr);
5541						if (!UNCODE.isUnmodalOpen) {
5542							this.destroy();
5543						}
5544					},
5545					offset: UNCODE.isFullPage ? '100%' : '90%'
5546				});
5547			}
5548		});
5549		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
5550			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5551				return;
5552			}
5553			var run = true,
5554				$carousel = $(val).closest('.owl-carousel');
5555			if ( $carousel.length ) {
5556				run = false;
5557			}
5558			if (run) {
5559				new Waypoint({
5560					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5561					element: val,
5562					handler: function() {
5563						var $element = $(this.element),
5564							$childs = $('.animate_when_parent_almost_visible', $element);
5565						$childs.each(function(key,el){
5566							var $child = $(el),
5567								delaySpeed = $child.attr('data-speed'),
5568								delayAttr = $child.attr('data-delay'),
5569								intervalAttr = $child.attr('data-interval');
5570							if (delayAttr == undefined) {
5571								delayAttr = 50*key;
5572							}
5573							requestTimeout(function() {
5574								$child.addClass('start_animation');
5575								if ( $child.hasClass('anim-line-checker') ) {
5576									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5577										var $line = $child.closest('.heading-line-wrap');
5578									});
5579								}
5580								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5581								highlightComplexFunc($wrapText, ev);
5582								if ( $child.hasClass('anim-tot-checker') ) {
5583									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5584										if ( $child.hasClass('anim-tot-checker') ) {
5585											$wrapText.addClass('already-animated');
5586											$element.trigger('already-animated');
5587										}
5588									});
5589								}
5590							}, delayAttr );
5591						});
5592						$element.addClass('start_animation');
5593						if (!UNCODE.isUnmodalOpen) {
5594							this.destroy();
5595						}
5596					},
5597					offset: UNCODE.isFullPage ? '100%' : '90%'
5598				});
5599			}
5600		});
5601	}
5602	window.waypoint_carousel_animation = function(ev) {
5603		$.each($('.owl-carousel').find('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-media .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
5604			if ( $(val).hasClass('el-text-split') ) {
5605				return true;
5606			}
5607			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5608				return;
5609			}
5610			var run = true,
5611				$carousel = $(val).closest('.owl-carousel'),
5612				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5613				$all_first = $('.owl-item[data-index="1"]', $carousel);
5614			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5615				run = false;
5616			}
5617			if (run) {
5618				new Waypoint({
5619					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5620					element: val,
5621					handler: function() {
5622						var element = $(this.element),
5623							index = element.index(),
5624							delayAttr = element.attr('data-delay');
5625						if (delayAttr == undefined) delayAttr = 0;
5626						requestTimeout(function() {
5627							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5628								$all_first.attr('data-already-reached', 'true');
5629							}
5630							element.addClass('start_animation');
5631						}, delayAttr);
5632						if (!UNCODE.isUnmodalOpen) {
5633							this.destroy();
5634						}
5635					},
5636					offset: UNCODE.isFullPage ? '100%' : '90%'
5637				});
5638			}
5639		});
5640		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
5641			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5642				return;
5643			}
5644			var run = true,
5645				$carousel = $(val).closest('.owl-carousel'),
5646				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5647				$all_first = $('.owl-item[data-index="1"]', $carousel);
5648			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5649				run = false;
5650			}
5651			if (run) {
5652				new Waypoint({
5653					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5654					element: val,
5655					handler: function() {
5656						var $element = $(this.element),
5657							$childs = $('.animate_when_parent_almost_visible', $element);
5658						$childs.each(function(key,el){
5659							var $child = $(el),
5660								delaySpeed = $child.attr('data-speed'),
5661								delayAttr = $child.attr('data-delay'),
5662								intervalAttr = $child.attr('data-interval');
5663							if (delayAttr == undefined) {
5664								delayAttr = 50*key;
5665							}
5666							requestTimeout(function() {
5667								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5668									$all_first.attr('data-already-reached', 'true');
5669								}
5670								$child.addClass('start_animation');
5671								if ( $child.hasClass('anim-line-checker') ) {
5672									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5673										var $line = $child.closest('.heading-line-wrap');
5674									});
5675								}
5676								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5677								highlightComplexFunc($wrapText, ev);
5678								if ( $child.hasClass('anim-tot-checker') ) {
5679									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5680										if ( $child.hasClass('anim-tot-checker') ) {
5681											$wrapText.addClass('already-animated');
5682										}
5683									});
5684								}
5685							}, delayAttr );
5686						});
5687						$element.addClass('start_animation');
5688						if (!UNCODE.isUnmodalOpen) {
5689							this.destroy();
5690						}
5691					},
5692					offset: UNCODE.isFullPage ? '100%' : '90%'
5693				});
5694			}
5695		});
5696	}
5697
5698	var runWaypoints = function(ev){
5699		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5700			runWaypoints_delay = 400;
5701		}
5702		clearRequestTimeout(runWaypoints_TO);
5703		runWaypoints_TO = requestTimeout(function() {
5704			window.waypoint_animation(ev);
5705		}, runWaypoints_delay);
5706
5707		clearRequestTimeout(runWaypoints_carousel_TO);
5708		runWaypoints_carousel_TO = requestTimeout(function() {
5709			window.waypoint_carousel_animation(ev);
5710		}, 400);
5711	};
5712	runWaypoints();
5713	animate_css_grids_on_load();
5714
5715	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5716		runWaypoints(ev);
5717	});
5718	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5719		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5720		window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints );
5721	}
5722};
5723
5724UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5725	var $allItems = elements.length - startIndex,
5726		showed = 0,
5727		index = 0,
5728		use_index = false
5729		;
5730
5731	if (filtering) {
5732		if (sequential) {
5733			use_index = true;
5734		}
5735		sequential = false;
5736	}
5737
5738	$.each(elements, function(index, val) {
5739		var $this = $(val),
5740			elInner = $('> .t-inside', val);
5741
5742		if ( ( UNCODE.isUnmodalOpen && !val.closest('#unmodal-content') ) || $(val).closest('.un-submenu').length || $(val).closest('uncode-mobile-menu-block').length ) {
5743			return;
5744		}
5745		if (val[0]) val = val[0];
5746
5747		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5748			new Waypoint({
5749				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5750				element: val,
5751				handler: function() {
5752					var element = $('> .t-inside', this.element),
5753						parent = $(this.element);
5754					var _index = use_index? index : 0;
5755
5756					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5757						delayAttr = parseInt(element.attr('data-delay'));
5758					if (isNaN(delayAttr)) delayAttr = 100;
5759					if (sequential || use_index) {
5760						delay -= showed;
5761					}
5762					var objTimeout = requestTimeout(function() {
5763						element.removeClass('zoom-reverse').addClass('start_animation');
5764						showed = index;
5765					}, delay * delayAttr);
5766					parent.data('objTimeout', objTimeout);
5767					if (!UNCODE.isUnmodalOpen) {
5768						this.destroy();
5769					}
5770				},
5771				offset: UNCODE.isFullPage ? '100%' : '90%'
5772			});
5773		}
5774
5775		index++;
5776	});
5777};
5778
5779UNCODE.tapHover = function() {
5780
5781	var isTouch = (
5782		'ontouchstart' in window ||
5783		navigator.maxTouchPoints > 0 ||
5784		navigator.msMaxTouchPoints > 0
5785	);
5786
5787	if (isTouch) {
5788		var $el = $('.tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), 
5789			elClass = "hover";
5790
5791		$(window).on('click', function() {
5792			$el.removeClass(elClass);
5793		});
5794
5795		$el.on('click', function(e) {
5796			e.stopPropagation();
5797			var link = $(this);
5798			if ( ! link.hasClass(elClass)) {
5799				e.preventDefault();
5800				link.addClass("hover");
5801				$el.not(this).removeClass(elClass);
5802				return false;
5803			}
5804		});
5805	}
5806};
5807
5808UNCODE.onePage = function(isMobile) {
5809	var current = 0,
5810		last = 0,
5811		lastScrollTop = 0,
5812		forceScroll = false,
5813		lastScrolled = 0,
5814		isSectionscroller = ($('.main-onepage').length) ? true : false,
5815		isOnePage = false,
5816		getOffset = function () {
5817			var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container').outerHeight() : 0);
5818			return calculateOffset;
5819		}
5820
5821	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5822
5823	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5824	// 	return false;
5825
5826	function init_onepage() {
5827		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5828			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5829		}
5830		last = $('.onepage-pagination li').last().find('a').data('index');
5831		$.each($('div[data-parent="true"]'), function(index, val) {
5832			$(this).attr('data-section', index);
5833			if (isMobile) return;
5834			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5835				return;
5836			}
5837			var sectionDown = new Waypoint({
5838				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5839				element: val,
5840				handler: function(direction) {
5841					if (direction == 'down') {
5842						changeMenuActive(this.element, index);
5843					}
5844				},
5845				offset: function() {
5846					return 5 + getOffset()
5847				}
5848			});
5849			var sectionUp = new Waypoint({
5850				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5851				element: val,
5852				handler: function(direction) {
5853					if (direction == 'up') {
5854						changeMenuActive(this.element, index);
5855					}
5856				},
5857				offset: function() {
5858					return -5 - getOffset()
5859				}
5860			});
5861
5862			if (isSectionscroller) {
5863				var label;
5864				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5865				else label = '';
5866				var getName = $(this).attr('data-name');
5867				if (getName == undefined) getName = index;
5868				if (label != '') {
5869					isOnePage = true;
5870					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5871					$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + label + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
5872				}
5873			}
5874		});
5875
5876		if (isSectionscroller) {
5877			$.each($('ul.onepage-pagination li'), function(index, val) {
5878				var $this = $(val),
5879					$a = ('a', $this);
5880				$a.on('click', function(evt) {
5881					if ( $('.is-selected', $this).length || UNCODE.scrolling ) {
5882						return false;
5883					}
5884					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5885						evt.preventDefault();
5886					}
5887					Waypoint.refreshAll();
5888					var el = $('a', evt.currentTarget);
5889					current = lastScrolled = parseInt(el.attr('data-index'));
5890					lastScrolled += 1;
5891					scrollBody(current);
5892				});
5893			});
5894		}
5895
5896		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5897		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5898			goToSection = String(window.location.hash).replace(/^#/, "");
5899			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5900		}
5901
5902		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5903			current = lastScrolled = goToSection;
5904			$(window).on('load', function(){
5905				if ( $('.owl-carousel').length ) {
5906					requestTimeout(function(){
5907						scrollBody(goToSection);
5908					}, 400);
5909				} else {
5910					scrollBody(goToSection);
5911				}
5912			});
5913		}
5914
5915	}
5916
5917	function changeMenuActive(section, index) {
5918		current = lastScrolled = parseInt($(section).attr('data-section'));
5919		if (isOnePage) {
5920			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5921			if (newSection.length) {
5922				$('ul.onepage-pagination li a').removeClass('is-selected');
5923				newSection.addClass('is-selected');
5924			}
5925			var getName = $('[data-section="' + index + '"]').attr('data-name');
5926			if (getName != undefined && getName !== '') {
5927				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5928					var get_href = $(val).attr('href');
5929					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5930						$(val).closest('.menu-smart').find('.active').removeClass('active');
5931						$(val).parent().addClass('active');
5932					}
5933				});
5934			}
5935		}
5936	}
5937
5938	if (isOnePage) {
5939		$(window).on('scroll', function() {
5940			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5941			if (bodyTop == 0) {
5942				$('ul.onepage-pagination li a').removeClass('is-selected');
5943				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5944				var getName = $('[data-section=0]').attr('data-name');
5945				if (getName != undefined && getName !== '') {
5946					$.each($('.menu-container .menu-item > a'), function(i, val) {
5947						var get_href = $(val).attr('href');
5948						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5949							$(val).closest('ul').find('.active').removeClass('active');
5950							$(val).parent().addClass('active');
5951						}
5952					});
5953				}
5954			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5955				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5956				if (lastSection.length) {
5957					$('ul.onepage-pagination li a').removeClass('is-selected');
5958					lastSection.addClass('is-selected');
5959				}
5960			}
5961		});
5962	}
5963
5964	var scrollBody = function(index) {
5965		$('ul.onepage-pagination li a').removeClass('is-selected');
5966		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5967
5968		var getSection = $('[data-section=' + index + ']'),
5969			scrollTo;
5970
5971		if (getSection == undefined) return;
5972
5973		var body = $("html, body"),
5974			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5975			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5976			getOffset = UNCODE.get_scroll_offset(index);
5977		if ( typeof getSection.offset() === 'undefined' )
5978			return;
5979		scrollTo = getSection.offset().top;
5980
5981		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5982		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5983			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5984			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5985				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5986			}
5987
5988			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5989				if ( index === 0 ) {
5990					scrollTo = 0;
5991				} else {
5992					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5993				}
5994			} else {
5995				scrollTo -= getOffset;
5996			}
5997		}
5998
5999		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6000		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6001
6002		if (index != 0) {
6003			UNCODE.scrolling = true;
6004		}
6005
6006		if (scrollSpeed == 0) {
6007			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
6008			UNCODE.scrolling = false;
6009		} else {
6010			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
6011				$(this).stop();
6012			}).animate({
6013				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6014			}, scrollSpeed, 'easeInOutCubic', function() {
6015				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
6016				UNCODE.scrolling = false;
6017				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
6018				||
6019				$('.menu-hided').length ) {
6020					scrollTo = getSection.offset().top;
6021					getOffset = UNCODE.get_scroll_offset(index);
6022					scrollTo -= getOffset;
6023					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
6024						$(this).stop();
6025					}).animate({
6026						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6027						}, scrollSpeed, 'easeInOutCubic', function() {
6028							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
6029							UNCODE.scrolling = false;
6030						}
6031					);
6032				}
6033			});
6034		}
6035
6036	};
6037
6038	init_onepage();
6039};
6040
6041UNCODE.stickyElements = function() {
6042	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
6043	if (!isMobile_wide ) {
6044
6045		var $pageHeader = $('#page-header'),
6046			$headerRow = $('.vc_row', $pageHeader),
6047			$headerSection = $headerRow.closest('section[data-parent]'),
6048			startSticky = false;
6049
6050		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
6051			$headerRow.removeClass('sticky-element');
6052			$pageHeader.addClass('sticky-element');
6053			startSticky = true;
6054		}
6055
6056		var calculateOffset = function(el) {
6057			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
6058				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
6059				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
6060				elTop = window.pageYOffset + el.getBoundingClientRect().top;
6061
6062			sideOffset += UNCODE.bodyBorder;
6063
6064			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
6065			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
6066				if ($('.menu-shrink').length) {
6067					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
6068				} else {
6069					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
6070				}
6071			}
6072
6073			return sideOffset;
6074
6075		},
6076
6077		initStickyElement = function($els) {
6078			if ( $('body').hasClass('vc-safe-mode') ) {
6079				return true;
6080			}
6081			if ( typeof $els === 'undefined' ) {
6082				$els = $('.sticky-element');
6083			}
6084			$.each($els, function(index, element) {
6085				if ($(element).closest('.tab-pane').length) {
6086					var $paneParent = $(element).closest('.tab-pane');
6087					if ( !$paneParent.hasClass('active') ) {
6088						return true;
6089					}
6090				}
6091				$(element).stick_in_parent({
6092					sticky_class: 'is_stucked',
6093					offset_top: calculateOffset(element),
6094					bottoming: true,
6095					inner_scrolling: SiteParameters.sticky_elements === 'on'
6096				});
6097			});
6098		};
6099
6100		var oldW = UNCODE.wwidth,
6101			oldH = UNCODE.wHeight;
6102
6103		requestTimeout(function() {
6104			if ($('.sticky-element').length) {
6105
6106				if ($(window).width() > UNCODE.mediaQuery) {
6107					initStickyElement();
6108
6109					if ( startSticky === true ) {
6110						$('#page-header').trigger('sticky_kit:recalc');
6111					}
6112				}
6113
6114				$(window).on('resize lateral_resize', function(event) {
6115					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
6116						$(".sticky-element").trigger("sticky_kit:detach");
6117						if ($(window).width() > UNCODE.mediaQuery) {
6118							initStickyElement();
6119						}
6120						oldW = UNCODE.wwidth;
6121						oldH = UNCODE.wHeight;
6122					}
6123				});
6124			}
6125		}, 1000);
6126
6127		if ($('.sticky-element').length) {
6128			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
6129				requestTimeout(function() {
6130					$(document.body).trigger("sticky_kit:recalc");
6131				}, 100);
6132			});
6133		}
6134
6135		var $panels = $('.panel-collapse');
6136		if ( $panels.length ) {
6137			$panels.each(function(){
6138				var $panel = $(this);
6139				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
6140					$(document.body).trigger("sticky_kit:recalc");
6141				});
6142			});
6143		}
6144
6145		$('.nav-tabs a').on('shown.bs.tab', function(e){
6146			var $tabs = $(e.target).closest('.tab-container'),
6147				$panel = $('.tab-pane.active', $tabs),
6148				$els = $(e.target).nextAll(".sticky-element");
6149
6150			$els.trigger("sticky_kit:detach");
6151			initStickyElement($els);
6152		});
6153
6154		$(window).on('vc-safe-mode-on', function(){
6155			$(".sticky-element").trigger("sticky_kit:detach");
6156		});
6157
6158		$(window).on('vc-safe-mode-off', function(){
6159			initStickyElement();
6160		});
6161	}
6162};
6163
6164UNCODE.twentytwenty = function() {
6165
6166  if (!$('.twentytwenty-container').length) return;
6167
6168// DOM.event.move
6169//
6170// 2.0.0
6171//
6172// Stephen Band
6173//
6174// Triggers 'movestart', 'move' and 'moveend' events after
6175// mousemoves following a mousedown cross a distance threshold,
6176// similar to the native 'dragstart', 'drag' and 'dragend' events.
6177// Move events are throttled to animation frames. Move event objects
6178// have the properties:
6179//
6180// pageX:
6181// pageY:     Page coordinates of pointer.
6182// startX:
6183// startY:    Page coordinates of pointer at movestart.
6184// distX:
6185// distY:     Distance the pointer has moved since movestart.
6186// deltaX:
6187// deltaY:    Distance the finger has moved since last event.
6188// velocityX:
6189// velocityY: Average velocity over last few events.
6190
6191
6192(function(fn) {
6193	if (typeof define === 'function' && define.amd) {
6194        define([], fn);
6195    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
6196        module.exports = fn;
6197	} else {
6198		fn();
6199	}
6200})(function(){
6201	var assign = Object.assign || window.jQuery && jQuery.extend;
6202
6203	// Number of pixels a pressed pointer travels before movestart
6204	// event is fired.
6205	var threshold = 8;
6206
6207	// Shim for requestAnimationFrame, falling back to timer. See:
6208	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
6209	var requestFrame = (function(){
6210		return (
6211			window.requestAnimationFrame ||
6212			window.webkitRequestAnimationFrame ||
6213			window.mozRequestAnimationFrame ||
6214			window.oRequestAnimationFrame ||
6215			window.msRequestAnimationFrame ||
6216			function(fn, element){
6217				return window.setTimeout(function(){
6218					fn();
6219				}, 25);
6220			}
6221		);
6222	})();
6223
6224	// Shim for customEvent
6225	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
6226	(function () {
6227		if ( typeof window.CustomEvent === "function" ) return false;
6228		function CustomEvent ( event, params ) {
6229			params = params || { bubbles: false, cancelable: false, detail: undefined };
6230			var evt = document.createEvent( 'CustomEvent' );
6231			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
6232			return evt;
6233		}
6234
6235		CustomEvent.prototype = window.Event.prototype;
6236		window.CustomEvent = CustomEvent;
6237	})();
6238
6239	var ignoreTags = {
6240			textarea: true,
6241			input: true,
6242			select: true,
6243			button: true
6244		};
6245
6246	var mouseevents = {
6247		move:   'mousemove',
6248		cancel: 'mouseup dragstart',
6249		end:    'mouseup'
6250	};
6251
6252	var touchevents = {
6253		move:   'touchmove',
6254		cancel: 'touchend',
6255		end:    'touchend'
6256	};
6257
6258	var rspaces = /\s+/;
6259
6260
6261	// DOM Events
6262
6263	var eventOptions = { bubbles: true, cancelable: true };
6264
6265	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
6266
6267	function createEvent(type) {
6268		return new CustomEvent(type, eventOptions);
6269	}
6270
6271	function getEvents(node) {
6272		return node[eventsSymbol] || (node[eventsSymbol] = {});
6273	}
6274
6275	function on(node, types, fn, data, selector) {
6276		types = types.split(rspaces);
6277
6278		var events = getEvents(node);
6279		var i = types.length;
6280		var handlers, type;
6281
6282		function handler(e) { fn(e, data); }
6283
6284		while (i--) {
6285			type = types[i];
6286			handlers = events[type] || (events[type] = []);
6287			handlers.push([fn, handler]);
6288			node.addEventListener(type, handler);
6289		}
6290	}
6291
6292	function off(node, types, fn, selector) {
6293		types = types.split(rspaces);
6294
6295		var events = getEvents(node);
6296		var i = types.length;
6297		var type, handlers, k;
6298
6299		if (!events) { return; }
6300
6301		while (i--) {
6302			type = types[i];
6303			handlers = events[type];
6304			if (!handlers) { continue; }
6305			k = handlers.length;
6306			while (k--) {
6307				if (handlers[k][0] === fn) {
6308					node.removeEventListener(type, handlers[k][1]);
6309					handlers.splice(k, 1);
6310				}
6311			}
6312		}
6313	}
6314
6315	function trigger(node, type, properties) {
6316		// Don't cache events. It prevents you from triggering an event of a
6317		// given type from inside the handler of another event of that type.
6318		var event = createEvent(type);
6319		if (properties) { assign(event, properties); }
6320		node.dispatchEvent(event);
6321	}
6322
6323
6324	// Constructors
6325
6326	function Timer(fn){
6327		var callback = fn,
6328		    active = false,
6329		    running = false;
6330
6331		function trigger(time) {
6332			if (active){
6333				callback();
6334				requestFrame(trigger);
6335				running = true;
6336				active = false;
6337			}
6338			else {
6339				running = false;
6340			}
6341		}
6342
6343		this.kick = function(fn) {
6344			active = true;
6345			if (!running) { trigger(); }
6346		};
6347
6348		this.end = function(fn) {
6349			var cb = callback;
6350
6351			if (!fn) { return; }
6352
6353			// If the timer is not running, simply call the end callback.
6354			if (!running) {
6355				fn();
6356			}
6357			// If the timer is running, and has been kicked lately, then
6358			// queue up the current callback and the end callback, otherwise
6359			// just the end callback.
6360			else {
6361				callback = active ?
6362					function(){ cb(); fn(); } :
6363					fn ;
6364
6365				active = true;
6366			}
6367		};
6368	}
6369
6370
6371	// Functions
6372
6373	function noop() {}
6374
6375	function preventDefault(e) {
6376		e.preventDefault();
6377	}
6378
6379	function isIgnoreTag(e) {
6380		return !!ignoreTags[e.target.tagName.toLowerCase()];
6381	}
6382
6383	function isPrimaryButton(e) {
6384		// Ignore mousedowns on any button other than the left (or primary)
6385		// mouse button, or when a modifier key is pressed.
6386		return (e.which === 1 && !e.ctrlKey && !e.altKey);
6387	}
6388
6389	function identifiedTouch(touchList, id) {
6390		var i, l;
6391
6392		if (touchList.identifiedTouch) {
6393			return touchList.identifiedTouch(id);
6394		}
6395
6396		// touchList.identifiedTouch() does not exist in
6397		// webkit yet… we must do the search ourselves...
6398
6399		i = -1;
6400		l = touchList.length;
6401
6402		while (++i < l) {
6403			if (touchList[i].identifier === id) {
6404				return touchList[i];
6405			}
6406		}
6407	}
6408
6409	function changedTouch(e, data) {
6410		var touch = identifiedTouch(e.changedTouches, data.identifier);
6411
6412		// This isn't the touch you're looking for.
6413		if (!touch) { return; }
6414
6415		// Chrome Android (at least) includes touches that have not
6416		// changed in e.changedTouches. That's a bit annoying. Check
6417		// that this touch has changed.
6418		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
6419
6420		return touch;
6421	}
6422
6423
6424	// Handlers that decide when the first movestart is triggered
6425
6426	function mousedown(e){
6427		// Ignore non-primary buttons
6428		if (!isPrimaryButton(e)) { return; }
6429
6430		// Ignore form and interactive elements
6431		if (isIgnoreTag(e)) { return; }
6432
6433		on(document, mouseevents.move, mousemove, e);
6434		on(document, mouseevents.cancel, mouseend, e);
6435	}
6436
6437	function mousemove(e, data){
6438		checkThreshold(e, data, e, removeMouse);
6439	}
6440
6441	function mouseend(e, data) {
6442		removeMouse();
6443	}
6444
6445	function removeMouse() {
6446		off(document, mouseevents.move, mousemove);
6447		off(document, mouseevents.cancel, mouseend);
6448	}
6449
6450	function touchstart(e) {
6451		// Don't get in the way of interaction with form elements
6452		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
6453
6454		var touch = e.changedTouches[0];
6455
6456		// iOS live updates the touch objects whereas Android gives us copies.
6457		// That means we can't trust the touchstart object to stay the same,
6458		// so we must copy the data. This object acts as a template for
6459		// movestart, move and moveend event objects.
6460		var data = {
6461			target:     touch.target,
6462			pageX:      touch.pageX,
6463			pageY:      touch.pageY,
6464			identifier: touch.identifier,
6465
6466			// The only way to make handlers individually unbindable is by
6467			// making them unique.
6468			touchmove:  function(e, data) { touchmove(e, data); },
6469			touchend:   function(e, data) { touchend(e, data); }
6470		};
6471
6472		on(document, touchevents.move, data.touchmove, data);
6473		on(document, touchevents.cancel, data.touchend, data);
6474	}
6475
6476	function touchmove(e, data) {
6477		var touch = changedTouch(e, data);
6478		if (!touch) { return; }
6479		checkThreshold(e, data, touch, removeTouch);
6480	}
6481
6482	function touchend(e, data) {
6483		var touch = identifiedTouch(e.changedTouches, data.identifier);
6484		if (!touch) { return; }
6485		removeTouch(data);
6486	}
6487
6488	function removeTouch(data) {
6489		off(document, touchevents.move, data.touchmove);
6490		off(document, touchevents.cancel, data.touchend);
6491	}
6492
6493	function checkThreshold(e, data, touch, fn) {
6494		var distX = touch.pageX - data.pageX;
6495		var distY = touch.pageY - data.pageY;
6496
6497		// Do nothing if the threshold has not been crossed.
6498		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
6499
6500		triggerStart(e, data, touch, distX, distY, fn);
6501	}
6502
6503	function triggerStart(e, data, touch, distX, distY, fn) {
6504		var touches = e.targetTouches;
6505		var time = e.timeStamp - data.timeStamp;
6506
6507		// Create a movestart object with some special properties that
6508		// are passed only to the movestart handlers.
6509		var template = {
6510			altKey:     e.altKey,
6511			ctrlKey:    e.ctrlKey,
6512			shiftKey:   e.shiftKey,
6513			startX:     data.pageX,
6514			startY:     data.pageY,
6515			distX:      distX,
6516			distY:      distY,
6517			deltaX:     distX,
6518			deltaY:     distY,
6519			pageX:      touch.pageX,
6520			pageY:      touch.pageY,
6521			velocityX:  distX / time,
6522			velocityY:  distY / time,
6523			identifier: data.identifier,
6524			targetTouches: touches,
6525			finger: touches ? touches.length : 1,
6526			enableMove: function() {
6527				this.moveEnabled = true;
6528				this.enableMove = noop;
6529				e.preventDefault();
6530			}
6531		};
6532
6533		// Trigger the movestart event.
6534		trigger(data.target, 'movestart', template);
6535
6536		// Unbind handlers that tracked the touch or mouse up till now.
6537		fn(data);
6538	}
6539
6540
6541	// Handlers that control what happens following a movestart
6542
6543	function activeMousemove(e, data) {
6544		var timer  = data.timer;
6545
6546		data.touch = e;
6547		data.timeStamp = e.timeStamp;
6548		timer.kick();
6549	}
6550
6551	function activeMouseend(e, data) {
6552		var target = data.target;
6553		var event  = data.event;
6554		var timer  = data.timer;
6555
6556		removeActiveMouse();
6557
6558		endEvent(target, event, timer, function() {
6559			// Unbind the click suppressor, waiting until after mouseup
6560			// has been handled.
6561			setTimeout(function(){
6562				off(target, 'click', preventDefault);
6563			}, 0);
6564		});
6565	}
6566
6567	function removeActiveMouse() {
6568		off(document, mouseevents.move, activeMousemove);
6569		off(document, mouseevents.end, activeMouseend);
6570	}
6571
6572	function activeTouchmove(e, data) {
6573		var event = data.event;
6574		var timer = data.timer;
6575		var touch = changedTouch(e, event);
6576
6577		if (!touch) { return; }
6578
6579		// Stop the interface from gesturing
6580		e.preventDefault();
6581
6582		event.targetTouches = e.targetTouches;
6583		data.touch = touch;
6584		data.timeStamp = e.timeStamp;
6585
6586		timer.kick();
6587	}
6588
6589	function activeTouchend(e, data) {
6590		var target = data.target;
6591		var event  = data.event;
6592		var timer  = data.timer;
6593		var touch  = identifiedTouch(e.changedTouches, event.identifier);
6594
6595		// This isn't the touch you're looking for.
6596		if (!touch) { return; }
6597
6598		removeActiveTouch(data);
6599		endEvent(target, event, timer);
6600	}
6601
6602	function removeActiveTouch(data) {
6603		off(document, touchevents.move, data.activeTouchmove);
6604		off(document, touchevents.end, data.activeTouchend);
6605	}
6606
6607
6608	// Logic for triggering move and moveend events
6609
6610	function updateEvent(event, touch, timeStamp) {
6611		var time = timeStamp - event.timeStamp;
6612
6613		event.distX =  touch.pageX - event.startX;
6614		event.distY =  touch.pageY - event.startY;
6615		event.deltaX = touch.pageX - event.pageX;
6616		event.deltaY = touch.pageY - event.pageY;
6617
6618		// Average the velocity of the last few events using a decay
6619		// curve to even out spurious jumps in values.
6620		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
6621		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
6622		event.pageX =  touch.pageX;
6623		event.pageY =  touch.pageY;
6624	}
6625
6626	function endEvent(target, event, timer, fn) {
6627		timer.end(function(){
6628			trigger(target, 'moveend', event);
6629			return fn && fn();
6630		});
6631	}
6632
6633
6634	// Set up the DOM
6635
6636	function movestart(e) {
6637		if (e.defaultPrevented) { return; }
6638		if (!e.moveEnabled) { return; }
6639
6640		var event = {
6641			startX:        e.startX,
6642			startY:        e.startY,
6643			pageX:         e.pageX,
6644			pageY:         e.pageY,
6645			distX:         e.distX,
6646			distY:         e.distY,
6647			deltaX:        e.deltaX,
6648			deltaY:        e.deltaY,
6649			velocityX:     e.velocityX,
6650			velocityY:     e.velocityY,
6651			identifier:    e.identifier,
6652			targetTouches: e.targetTouches,
6653			finger:        e.finger
6654		};
6655
6656		var data = {
6657			target:    e.target,
6658			event:     event,
6659			timer:     new Timer(update),
6660			touch:     undefined,
6661			timeStamp: e.timeStamp
6662		};
6663
6664		function update(time) {
6665			updateEvent(event, data.touch, data.timeStamp);
6666			trigger(data.target, 'move', event);
6667		}
6668
6669		if (e.identifier === undefined) {
6670			// We're dealing with a mouse event.
6671			// Stop clicks from propagating during a move
6672			on(e.target, 'click', preventDefault);
6673			on(document, mouseevents.move, activeMousemove, data);
6674			on(document, mouseevents.end, activeMouseend, data);
6675		}
6676		else {
6677			// In order to unbind correct handlers they have to be unique
6678			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6679			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6680
6681			// We're dealing with a touch.
6682			on(document, touchevents.move, data.activeTouchmove, data);
6683			on(document, touchevents.end, data.activeTouchend, data);
6684		}
6685	}
6686
6687	on(document, 'mousedown', mousedown);
6688	on(document, 'touchstart', touchstart);
6689	on(document, 'movestart', movestart);
6690
6691
6692	// jQuery special events
6693	//
6694	// jQuery event objects are copies of DOM event objects. They need
6695	// a little help copying the move properties across.
6696
6697	if (!window.jQuery) { return; }
6698
6699	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6700
6701	function enableMove1(e) { e.enableMove(); }
6702	function enableMove2(e) { e.enableMove(); }
6703	function enableMove3(e) { e.enableMove(); }
6704
6705	function add(handleObj) {
6706		var handler = handleObj.handler;
6707
6708		handleObj.handler = function(e) {
6709			// Copy move properties across from originalEvent
6710			var i = properties.length;
6711			var property;
6712
6713			while(i--) {
6714				property = properties[i];
6715				e[property] = e.originalEvent[property];
6716			}
6717
6718			handler.apply(this, arguments);
6719		};
6720	}
6721
6722	jQuery.event.special.movestart = {
6723		setup: function() {
6724			// Movestart must be enabled to allow other move events
6725			on(this, 'movestart', enableMove1);
6726
6727			// Do listen to DOM events
6728			return false;
6729		},
6730
6731		teardown: function() {
6732			off(this, 'movestart', enableMove1);
6733			return false;
6734		},
6735
6736		add: add
6737	};
6738
6739	jQuery.event.special.move = {
6740		setup: function() {
6741			on(this, 'movestart', enableMove2);
6742			return false;
6743		},
6744
6745		teardown: function() {
6746			off(this, 'movestart', enableMove2);
6747			return false;
6748		},
6749
6750		add: add
6751	};
6752
6753	jQuery.event.special.moveend = {
6754		setup: function() {
6755			on(this, 'movestart', enableMove3);
6756			return false;
6757		},
6758
6759		teardown: function() {
6760			off(this, 'movestart', enableMove3);
6761			return false;
6762		},
6763
6764		add: add
6765	};
6766});
6767
6768  $.fn.twentytwenty = function(options) {
6769    var options = $.extend({
6770      default_offset_pct: 0.5,
6771      orientation: 'horizontal',
6772      before_label: 'Before',
6773      after_label: 'After',
6774      no_overlay: false,
6775      move_slider_on_hover: false,
6776      move_with_handle_only: true,
6777      click_to_move: false
6778    }, options);
6779
6780    return this.each(function() {
6781
6782      var sliderPct = options.default_offset_pct;
6783      var container = $(this);
6784      var sliderOrientation = options.orientation;
6785      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6786      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6787
6788
6789      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6790      if(!options.no_overlay) {
6791        container.append("<div class='twentytwenty-overlay'></div>");
6792        var overlay = container.find(".twentytwenty-overlay");
6793        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6794        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6795      }
6796      var beforeImg = container.find("img:first");
6797      var afterImg = container.find("img:last");
6798      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6799      var slider = container.find(".twentytwenty-handle");
6800      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6801      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6802      container.addClass("twentytwenty-container");
6803      beforeImg.addClass("twentytwenty-before");
6804      afterImg.addClass("twentytwenty-after");
6805
6806      var calcOffset = function(dimensionPct) {
6807        var w = beforeImg.width();
6808        var h = beforeImg.height();
6809        return {
6810          w: w+"px",
6811          h: h+"px",
6812          cw: (dimensionPct*w)+"px",
6813          ch: (dimensionPct*h)+"px"
6814        };
6815      };
6816
6817      var adjustContainer = function(offset) {
6818      	if (sliderOrientation === 'vertical') {
6819          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6820          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6821      	}
6822      	else {
6823          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6824          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6825    	}
6826        container.css("height", offset.h);
6827      };
6828
6829      var adjustSlider = function(pct) {
6830        var offset = calcOffset(pct);
6831        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6832        adjustContainer(offset);
6833      };
6834
6835      // Return the number specified or the min/max number if it outside the range given.
6836      var minMaxNumber = function(num, min, max) {
6837        return Math.max(min, Math.min(max, num));
6838      };
6839
6840      // Calculate the slider percentage based on the position.
6841      var getSliderPercentage = function(positionX, positionY) {
6842        var sliderPercentage = (sliderOrientation === 'vertical') ?
6843          (positionY-offsetY)/imgHeight :
6844          (positionX-offsetX)/imgWidth;
6845
6846        return minMaxNumber(sliderPercentage, 0, 1);
6847      };
6848
6849
6850      $(window).on("resize.twentytwenty", function(e) {
6851        adjustSlider(sliderPct);
6852      });
6853
6854      var offsetX = 0;
6855      var offsetY = 0;
6856      var imgWidth = 0;
6857      var imgHeight = 0;
6858      var onMoveStart = function(e) {
6859        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6860          e.preventDefault();
6861        }
6862        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6863          e.preventDefault();
6864        }
6865        container.addClass("active");
6866        offsetX = container.offset().left;
6867        offsetY = container.offset().top;
6868        imgWidth = beforeImg.width();
6869        imgHeight = beforeImg.height();
6870      };
6871      var onMove = function(e) {
6872        if (container.hasClass("active")) {
6873          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6874          adjustSlider(sliderPct);
6875        }
6876      };
6877      var onMoveEnd = function() {
6878          container.removeClass("active");
6879      };
6880
6881      var moveTarget = options.move_with_handle_only ? slider : container;
6882      moveTarget.on("movestart",onMoveStart);
6883      moveTarget.on("move",onMove);
6884      moveTarget.on("moveend",onMoveEnd);
6885
6886      if (options.move_slider_on_hover) {
6887        container.on("mouseenter", onMoveStart);
6888        container.on("mousemove", onMove);
6889        container.on("mouseleave", onMoveEnd);
6890      }
6891
6892      slider.on("touchmove", function(e) {
6893        e.preventDefault();
6894      });
6895
6896      container.find("img").on("mousedown", function(event) {
6897        event.preventDefault();
6898      });
6899
6900      if (options.click_to_move) {
6901        container.on('click', function(e) {
6902          offsetX = container.offset().left;
6903          offsetY = container.offset().top;
6904          imgWidth = beforeImg.width();
6905          imgHeight = beforeImg.height();
6906
6907          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6908          adjustSlider(sliderPct);
6909        });
6910      }
6911
6912      $(window).trigger("resize.twentytwenty");
6913    });
6914  };
6915
6916
6917  $(window).on("load", function(e) {
6918  	$('.twentytwenty-container').each(function(){
6919  		var $container = $(this);
6920  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6921  			$container.twentytwenty();
6922  		}
6923  		$('img', $container).on('async-done', function(){
6924	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6925	  			$container.twentytwenty();
6926	  		}
6927	    });
6928  	});
6929  });
6930}
6931
6932UNCODE.justifiedGallery = function() {
6933
6934	var breakPointMe = function( val ) {
6935		val = parseInt( val );
6936		if ( isNaN(val) ) {
6937			return false;
6938		}
6939		if ( val >= 1500 ) {
6940			return 1;
6941		} else if ( val < 1500 && val >= 960 ) {
6942			return 2;
6943		} else if ( val < 960 && val >= 570 ) {
6944			return 3;
6945		} else if ( val < 570 ) {
6946			return 4;
6947		}
6948	}
6949
6950	var gutterByBreakpoint = function( bp, gutter ) {
6951		var ret;
6952		switch(gutter) {
6953		    case 'no-gutter':
6954		    	ret = 0;
6955		        break;
6956		    case 'px-gutter':
6957		    	ret = 1;
6958		        break;
6959		    case 'half-gutter':
6960		    	ret = 18;
6961		        break;
6962		    case 'double-gutter':
6963				switch(bp) {
6964				    case 3:
6965				    case 4:
6966				    	ret = 36;
6967				        break;
6968				    default:
6969				    	ret = 72;
6970				        break;
6971				}
6972		        break;
6973		    case 'triple-gutter':
6974				switch(bp) {
6975				    case 3:
6976				    case 4:
6977				    	ret = 36;
6978				        break;
6979				    default:
6980				    	ret = 108;
6981				        break;
6982				}
6983		        break;
6984		    case 'quad-gutter':
6985				switch(bp) {
6986				    case 2:
6987				    	ret = 108;
6988				        break;
6989				    case 3:
6990				    	ret = 72;
6991				        break;
6992				    case 4:
6993				    	ret = 36;
6994				        break;
6995				    default:
6996				    	ret = 144;
6997				        break;
6998				}
6999		        break;
7000		    default:
7001		    	ret = 36;//single-gutter
7002		}
7003		return ret;
7004	}
7005
7006	if ($('.justified-layout').length > 0) {
7007		var justifiedContainersArray = [],
7008			typeGridArray = [],
7009			layoutGridArray = [],
7010			transitionDuration = [],
7011			$filterItems = [],
7012			$filters = $('.justified-system .isotope-filters'),
7013			$itemSelector = '.tmb',
7014			$items,
7015			itemMargin,
7016			correctionFactor = 0,
7017			firstLoad = true,
7018			isOriginLeft = $('body').hasClass('rtl') ? false : true,
7019			prevW = breakPointMe(UNCODE.wwidth);
7020		$('[class*="justified-container"]').each(function() {
7021			var isoData = $(this).data();
7022			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
7023			if (isoData.type == 'metro') typeGridArray.push(true);
7024			else typeGridArray.push(false);
7025			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
7026			else layoutGridArray.push('justified');
7027			justifiedContainersArray.push($(this));
7028		});
7029		var init_justifiedGallery = function() {
7030			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
7031				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
7032					justifiedId = justifiedSystem.attr('id'),
7033					$layoutMode = layoutGridArray[i],
7034					gutter = $(justifiedContainersArray[i]).data('gutter'),
7035					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
7036					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
7037					lastRow = $(justifiedContainersArray[i]).data('last-row'),
7038					margins;
7039
7040				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
7041				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
7042				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
7043
7044				margins = gutterByBreakpoint(prevW, gutter);
7045
7046				$(justifiedContainersArray[i]).justifiedGallery({
7047					rowHeight: rowHeight,
7048					maxRowHeight: maxRowHeight,
7049					margins: margins,
7050					cssAnimation: true,
7051					lastRow: lastRow,
7052					waitThumbnailsLoad: false
7053				}).one('jg.complete', function(){ onLayout($(this), 0); } );
7054
7055				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
7056					$(justifiedContainersArray[i]).infinitescroll({
7057							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
7058							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
7059							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
7060							animate: false,
7061							behavior: 'local',
7062							debug: false,
7063							loading: {
7064								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
7065								speed: 0,
7066								finished: undefined,
7067								msg: $('#' + justifiedId + ' .loadmore-button'),
7068							},
7069							errorCallback: function() {
7070								var justified_system = $(this).closest('.justified-system');
7071								$('.loading-button', justified_system).hide();
7072								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
7073							}
7074						},
7075						// append the new items to galleryJustified on the infinitescroll callback function.
7076						function(newElements, opts) {
7077							var $galleryJustified = $(this),
7078								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
7079								filters = new Array(),
7080								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
7081								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
7082								$numPages = $('a', $infinite_button).data('pages'),
7083								delay = 300;
7084							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7085							if ($galleryJustified.hasClass('isotope-infinite-button') || $infinite_button.hasClass('loadmore-button--icon')) {
7086								$infinite_button.show();
7087							} else {
7088								$infinite_button.hide();
7089							}
7090							$loading_button.hide();
7091							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7092							$('> li', $galleryJustified).remove();
7093							$.each($(newElements), function(index, val) {
7094								$(val).addClass('tmb-iso');
7095								if ($(val).is("li")) {
7096									filters.push($(val)[0]);
7097								}
7098								$(val).addClass('uncode-appended');
7099							});
7100							newElements = newElements.filter(function(x) {
7101								return filters.indexOf(x) < 0
7102							});
7103							$.each($(filters), function(index, val) {
7104								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
7105							});
7106							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
7107							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7108								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
7109								if (typeof getLightbox === 'object') {
7110									getLightbox.refresh();
7111								} else {
7112									UNCODE.lightbox();
7113								}
7114							}
7115							if ( typeof twttr !== 'undefined' )
7116								twttr.widgets.load(justifiedContainersArray[i]);
7117
7118							requestTimeout(function() {
7119								$galleryJustified.trigger('more-items-loaded');
7120								$(window).trigger('more-items-loaded');
7121								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7122								fillIfNotScrollable($galleryJustified);
7123							}, 1000);
7124						});
7125					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
7126						var $infinite_justified = $(justifiedContainersArray[i]),
7127							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
7128						$infinite_justified.infinitescroll('pause');
7129						$infinite_button.on('click', function(event) {
7130							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7131								$.each(UNCODE.lightboxArray, function(index, val) {
7132									UNCODE.lightboxArray[index].destroy();
7133								});
7134							}
7135							event.preventDefault();
7136							var $justified_system = $(event.target).closest('.justified-system'),
7137							$infinite_justified = $justified_system.find('.justified-container'),
7138							justifiedId = $justified_system.attr('id');
7139							$(event.currentTarget).html(SiteParameters.loading);
7140							$infinite_justified.infinitescroll('resume');
7141							$infinite_justified.infinitescroll('retrieve');
7142							$infinite_justified.infinitescroll('pause');
7143							$infinite_justified.trigger('more-items-loaded');
7144							$(window).trigger('more-items-loaded');
7145							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7146						});
7147					}
7148					(function ($c) {
7149						requestTimeout(function () { fillIfNotScrollable($c); }, 1000);
7150					})($(justifiedContainersArray[i]));
7151				}
7152			}
7153		},
7154		fillIfNotScrollable = function ($container) {
7155			if ($container.hasClass('isotope-infinite-button')) return;
7156			if (!$container.hasClass('isotope-infinite')) return;
7157			var infData = $container.data('infinitescroll');
7158			if (!infData || !infData.options || !infData.options.state) return;
7159			var state = infData.options.state;
7160			if (state.isDuringAjax || state.isDestroyed || state.isBeyondMaxPage || state.isPaused) return;
7161			var $loadMoreA = $container.closest('.justified-system').find('.loadmore-button a');
7162			var numPages = parseInt($loadMoreA.data('pages'), 10);
7163			if (!numPages || state.currPage >= numPages) return;
7164			if (document.documentElement.scrollHeight > window.innerHeight + 1) return;
7165			$container.infinitescroll('retrieve');
7166		},
7167		onLayout = function(justifiedObj, startIndex) {
7168			justifiedObj.css('opacity', 1);
7169			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
7170			$('.tmb', justifiedObj).addClass('justified-object-loaded');
7171
7172			requestTimeout(function() {
7173				// window.dispatchEvent(UNCODE.boxEvent);
7174				UNCODE.adaptive();
7175				if (SiteParameters.dynamic_srcset_active === '1') {
7176					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
7177				}
7178				if (typeof MediaElement === "function") {
7179					$(justifiedObj).find('audio,video').each(function() {
7180						$(this).mediaelementplayer({
7181								pauseOtherPlayers: false,
7182						});
7183					});
7184				}
7185				if ($(justifiedObj).find('.nested-carousel').length) {
7186					if (typeof UNCODE.carousel !== 'undefined') {
7187						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
7188					}
7189					requestTimeout(function() {
7190						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7191						justifiedObj.addClass('justified-gallery-finished')
7192						Waypoint.refreshAll();
7193					}, 200);
7194				} else {
7195					requestTimeout(function() {
7196						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7197						justifiedObj.addClass('justified-gallery-finished')
7198						Waypoint.refreshAll();
7199					}, 300);
7200				}
7201			}, 100);
7202
7203		},
7204		boxAnimation = function(items, startIndex, sequential, container) {
7205			var $allItems = items.length - startIndex,
7206				showed = 0,
7207				index = 0;
7208			if (container.closest('.owl-item').length == 1) return false;
7209			$.each(items, function(index, val) {
7210				var elInner = $('> .t-inside', val);
7211				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
7212					return;
7213				}
7214				if (val[0]) val = val[0];
7215				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
7216					new Waypoint({
7217						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
7218						element: val,
7219						handler: function() {
7220							var element = $('> .t-inside', this.element),
7221								parent = $(this.element),
7222								currentIndex = parent.index();
7223							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
7224								delayAttr = parseInt(element.attr('data-delay'));
7225							if (isNaN(delayAttr)) delayAttr = 100;
7226							delay -= showed;
7227							var objTimeout = requestTimeout(function() {
7228								element.removeClass('zoom-reverse').addClass('start_animation');
7229								showed = parent.index();
7230							}, delay * delayAttr);
7231							parent.data('objTimeout', objTimeout);
7232							if (!UNCODE.isUnmodalOpen) {
7233								this.destroy();
7234							}
7235						},
7236						offset: '100%'
7237					})
7238				} else {
7239					elInner.removeClass('animate_when_almost_visible');
7240					$(val).addClass('no-waypoint-animation');
7241					/*if (elInner.hasClass('force-anim')) {
7242						elInner.addClass('start_animation');
7243					} else {
7244						elInner.css('opacity', 1);
7245					}*/
7246				}
7247				index++;
7248			});
7249		};
7250		$filters.on('click', 'a[data-filter]', function(evt) {
7251			var $filter = $(this),
7252				filterContainer = $filter.closest('.isotope-filters'),
7253				filterValue = $filter.attr('data-filter'),
7254				container = $filter.closest('.justified-system').find($('.justified-layout')),
7255				lastRow = container.data('last-row'),
7256				transitionDuration = 0,
7257				delay = 300,
7258				filterItems = [];
7259
7260			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
7261
7262			var filter_items = function(){
7263				if (filterValue !== undefined) {
7264					$.each($('> .tmb > .t-inside', container), function(index, val) {
7265						var parent = $(val).parent(),
7266							objTimeout = parent.data('objTimeout');
7267						if (objTimeout) {
7268							$(val).removeClass('zoom-reverse');
7269							clearRequestTimeout(objTimeout);
7270						}
7271						if (transitionDuration == 0) {
7272							if ($(val).hasClass('animate_when_almost_visible')) {
7273								$(val).addClass('zoom-reverse').removeClass('start_animation');
7274							} else {
7275								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7276							}
7277						}
7278					});
7279
7280					requestTimeout(function() {
7281						var $block,
7282							selector,
7283							lightboxElements,
7284							$boxes;
7285
7286						if ( filterValue !== '' && filterValue !== '*' ) {
7287							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
7288							selector = '.' + filterValue;
7289							$.each($(selector, container), function(index, block) {
7290								lightboxElements = $('[data-lbox^=ilightbox]', block);
7291								if (lightboxElements.length) {
7292									lightboxElements.removeClass('lb-disabled');
7293									container.data('lbox', $(lightboxElements[0]).data('lbox'));
7294								}
7295								filterItems.push(block);
7296							});
7297							container.justifiedGallery({
7298								filter: selector,
7299								lastRow: 'nojustify'
7300							});
7301						} else {
7302							container.justifiedGallery({
7303								filter: false,
7304								lastRow: lastRow
7305							});
7306							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
7307							filterItems = $('> .tmb', container);
7308						}
7309						container.trigger('more-items-loaded');
7310						$(window).trigger('more-items-loaded');
7311						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7312
7313						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7314						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7315							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
7316							if (typeof getLightbox === 'object') {
7317								getLightbox.refresh();
7318							} else {
7319								UNCODE.lightbox();
7320							}
7321						}
7322
7323						if (transitionDuration == 0) {
7324							requestTimeout(function() {
7325								boxAnimation(filterItems, 0, false, container);
7326							}, 100);
7327						}
7328						requestTimeout(function() {
7329							Waypoint.refreshAll();
7330							container.trigger('more-items-loaded');
7331							$(window).trigger('more-items-loaded');
7332							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7333							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
7334								$(document).trigger('uncode-scrolltrigger-refresh');
7335							}
7336						}, 2000);
7337						requestTimeout(function () { fillIfNotScrollable(container); }, 600);
7338
7339					}, delay);
7340				} else {
7341					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7342						$.each(UNCODE.lightboxArray, function(index, val) {
7343							UNCODE.lightboxArray[index].destroy();
7344						});
7345					}
7346					$.each($('> .tmb > .t-inside', container), function(index, val) {
7347						var parent = $(val).parent(),
7348							objTimeout = parent.data('objTimeout');
7349						if (objTimeout) {
7350							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7351							clearRequestTimeout(objTimeout);
7352						}
7353						if (transitionDuration == 0) {
7354							if ($(val).hasClass('animate_when_almost_visible')) {
7355								$(val).addClass('zoom-reverse').removeClass('start_animation');
7356							} else {
7357								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7358							}
7359						}
7360					});
7361					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7362						UNCODE.lightbox();
7363					}
7364					container.parent().addClass('justified-loading');
7365					container.trigger('more-items-loaded');
7366					$(window).trigger('more-items-loaded');
7367					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7368				}
7369			};
7370
7371			if (!$filter.hasClass('active')) {
7372				/** Scroll top with filtering */
7373				if (filterContainer.hasClass('filter-scroll')) {
7374                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7375                    calc_scroll -= UNCODE.get_scroll_offset();
7376
7377					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7378						delta = bodyTop - calc_scroll,
7379						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7380						filterTolerance = false,
7381						filter_timeout;
7382					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7383
7384					if ( !UNCODE.isFullPage ) {
7385						if (scrollSpeed == 0) {
7386							$('html, body').scrollTop(calc_scroll);
7387							UNCODE.scrolling = false;
7388							filter_items();
7389						} else {
7390
7391							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7392								filter_items();
7393								filterTolerance = true;
7394							}
7395
7396							$('html, body').animate({
7397								scrollTop: calc_scroll
7398							},{
7399								easing: 'easeInOutQuad',
7400								duration: scrollSpeed,
7401								complete: function(){
7402									UNCODE.scrolling = false;
7403									if ( !filterTolerance ) {
7404										filter_timeout = setTimeout(function(){
7405											clearTimeout(filter_timeout);
7406											filter_items();
7407										}, 200);
7408									}
7409								}
7410							});
7411						}
7412					}
7413				} else {
7414					filter_items();
7415				}
7416			}
7417			evt.preventDefault();
7418		});
7419
7420		$filters.each(function(i, buttonGroup) {
7421			var $buttonGroup = $(buttonGroup);
7422			$buttonGroup.on('click', 'a', function() {
7423				$buttonGroup.find('.active').removeClass('active');
7424				$(this).addClass('active');
7425			});
7426
7427			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7428				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7429				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7430			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7431				e.preventDefault();
7432				$cats_filters.slideToggle(400, 'easeInOutCirc');
7433			});
7434		});
7435		window.addEventListener('boxResized', function(e) {
7436			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
7437				prevW = breakPointMe(UNCODE.wwidth);
7438				$.each($('.justified-layout'), function(index, val) {
7439					var gutter = $(this).data('gutter'),
7440						margins = gutterByBreakpoint( prevW, gutter);
7441					$(this).justifiedGallery({
7442						margins: margins
7443					});
7444					$(this).find('.mejs-video,.mejs-audio').each(function() {
7445						$(this).trigger('resize');
7446					});
7447				});
7448			}
7449		}, false);
7450
7451		init_justifiedGallery();
7452	};
7453};
7454
7455UNCODE.cssGrid = function() {
7456	if ($('.cssgrid-layout').length > 0) {
7457		var cssGridContainersArray = [];
7458		var transitionDuration = [];
7459		var $filters = $('.cssgrid-system .cssgrid-filters');
7460
7461		$('[class*="cssgrid-container"]').each(function() {
7462			cssGridContainersArray.push($(this));
7463			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
7464		});
7465
7466		var init_cssGridAjax = function() {
7467			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
7468				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
7469					cssGridId = cssGridSystem.attr('id');
7470
7471				cssGridSystem.data('transitionDuration', transitionDuration[i]);
7472
7473				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
7474					$(cssGridContainersArray[i]).infinitescroll({
7475						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
7476						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
7477						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
7478						animate: false,
7479						behavior: 'local',
7480						debug: false,
7481						loading: {
7482							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
7483							speed: 0,
7484							finished: undefined,
7485							msg: $('#' + cssGridId + ' .loadmore-button'),
7486						},
7487						errorCallback: function() {
7488							var cssgrid_system = $(this).closest('.cssgrid-system');
7489							$('.loading-button', cssgrid_system).hide();
7490							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
7491						}
7492					},
7493					// append the new items to cssGrid on the infinitescroll callback function.
7494					function(newElements, opts) {
7495						var $cssGrid = $(this),
7496							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
7497							cssGridId = cssGridSystemCont.attr('id'),
7498							filters = new Array(),
7499							$loading_button = cssGridSystemCont.find('.loading-button'),
7500							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
7501							$numPages = $('a', $infinite_button).data('pages'),
7502							$woo_results,
7503							delay = 300;
7504						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7505						$infinite_button.show();
7506						$loading_button.hide();
7507						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7508						$('> li', $cssGrid).remove();
7509						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
7510						$.each($(newElements), function (index, val) {
7511							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
7512								$woo_results = $(val);
7513								delete newElements[index];
7514							} else {
7515								$(val).addClass('tmb-grid');
7516								if ($(val).is("li")) {
7517									filters.push($(val)[0]);
7518								}
7519							}
7520							$(val).addClass('uncode-appended');
7521						});
7522						newElements = newElements.filter(function(x) {
7523							return filters.indexOf(x) < 0
7524						});
7525						$.each($(filters), function(index, val) {
7526							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
7527						});
7528						if ($woo_results && $woo_results.length > 0) {
7529							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
7530							var new_count = $woo_results.find('.woocommerce-result-count').text();
7531							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
7532							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
7533							function replaceMatch(match, p1, p2) {
7534        						return old_start + '–' + new_end;
7535							}
7536							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
7537							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
7538						}
7539
7540						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
7541						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
7542						if (filterValue !== undefined && filterValue != '*') {
7543							$(newElements).hide();
7544							var els_to_show = $();
7545							$(newElements).each(function() {
7546								var el = $(this);
7547								if (el.hasClass(filterValue)) {
7548									els_to_show = els_to_show.add(el);
7549									el.show();
7550								}
7551							});
7552							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
7553						} else {
7554							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
7555						}
7556
7557						UNCODE.adaptive();
7558						if (SiteParameters.dynamic_srcset_active === '1') {
7559							UNCODE.refresh_dynamic_srcset_size($cssGrid);
7560						}
7561						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7562							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
7563							if (typeof getLightbox === 'object') {
7564								getLightbox.refresh();
7565							} else {
7566								UNCODE.lightbox();
7567							}
7568						}
7569						if ( typeof twttr !== 'undefined' ) {
7570							twttr.widgets.load(cssGridContainersArray[i]);
7571						}
7572
7573						UNCODE.carousel($(newElements));
7574						requestTimeout(function() {
7575							$cssGrid.trigger('more-items-loaded');
7576							$(window).trigger('more-items-loaded');
7577							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7578						}, 1000);
7579
7580					});
7581					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
7582						var $cssgrid_el = $(cssGridContainersArray[i]),
7583							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
7584						$cssgrid_el.infinitescroll('pause');
7585						$infinite_button.on('click', function(event) {
7586							event.preventDefault();
7587							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
7588							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
7589							cssGridId = $cssgrid_system.attr('id');
7590							$(event.currentTarget).html(SiteParameters.loading);
7591							$cssgrid_el.infinitescroll('resume');
7592							$cssgrid_el.infinitescroll('retrieve');
7593							$cssgrid_el.infinitescroll('pause');
7594						});
7595					}
7596				}
7597			}
7598		};
7599
7600		init_cssGridAjax();
7601
7602		if ($('.cssgrid-pagination').length > 0) {
7603			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
7604				evt.preventDefault();
7605
7606				if (SiteParameters.index_pagination_disable_scroll !== '1') {
7607					var container = $(this).closest('.cssgrid-system'),
7608						pagination_disable_scroll = container.attr('data-pagination-scroll'),
7609						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7610
7611					if ( pagination_disable_scroll !== 'disabled' ) {
7612						calc_scroll -= UNCODE.get_scroll_offset();
7613
7614						var menu_container = $('.menu-sticky');
7615						var menu = menu_container.find('.menu-container');
7616
7617						if (menu_container.length > 0 && menu.length > 0) {
7618							calc_scroll = calc_scroll - menu.outerHeight();
7619						}
7620
7621						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7622							delta = bodyTop - calc_scroll,
7623							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7624						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7625
7626						if ( !UNCODE.isFullPage ) {
7627							if (scrollSpeed == 0) {
7628								$('html, body').scrollTop(calc_scroll);
7629							} else {
7630								$('html, body').animate({
7631									scrollTop: calc_scroll
7632								},{
7633									easing: 'easeInOutQuad',
7634									duration: scrollSpeed,
7635									complete: function(){
7636										UNCODE.scrolling = false;
7637									}
7638								});
7639							}
7640						}
7641					}
7642				}
7643
7644				loadCssGrid($(this), true);
7645			});
7646		}
7647
7648		$filters.on('click', 'a.grid-nav-link', function(evt) {
7649			if ($(this).hasClass('no-grid-filter')) {
7650				return;
7651			}
7652			var $filter = $(this),
7653				filterContainer = $filter.closest('.cssgrid-filters'),
7654				filterValue = $filter.attr('data-filter'),
7655				containerSystem = $filter.closest('.cssgrid-system'),
7656				container = containerSystem.find($('.cssgrid-layout')),
7657				transitionDuration = containerSystem.data('transitionDuration'),
7658				delay = 300,
7659				filterItems = [],
7660				all_thumbs = container.find('.tmb-grid');
7661
7662			var filter_items = function(){
7663				if (filterValue !== undefined) {
7664					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7665						var parent = $(val).parent(),
7666							objTimeout = parent.data('objTimeout');
7667						if (objTimeout) {
7668							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7669							clearRequestTimeout(objTimeout);
7670						}
7671						if (transitionDuration == 0) {
7672							if ($(val).hasClass('animate_when_almost_visible')) {
7673								$(val).addClass('zoom-reverse').removeClass('start_animation');
7674							} else {
7675								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7676							}
7677						}
7678					});
7679					requestTimeout(function(){
7680						if ( filterValue == '*' ) {
7681							all_thumbs.show();
7682							all_thumbs.each(function(index, val) {
7683								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7684								filterItems.push($(this));
7685							});
7686						} else {
7687							all_thumbs.each(function() {
7688								var _tmb = $(this);
7689								if (_tmb.hasClass(filterValue)) {
7690									_tmb.show();
7691									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7692									filterItems.push(_tmb);
7693								} else {
7694									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7695									_tmb.hide();
7696								}
7697							});
7698						}
7699
7700						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7701
7702						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7703						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7704						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7705						if (lightboxElements.length) {
7706							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7707							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7708								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7709								if (typeof getLightbox === 'object') {
7710									getLightbox.refresh();
7711								} else {
7712									UNCODE.lightbox();
7713								}
7714							}
7715						}
7716						container.trigger('more-items-loaded');
7717						$(window).trigger('more-items-loaded');
7718						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7719					}, delay);
7720				} else {
7721					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7722						var parent = $(val).parent(),
7723							objTimeout = parent.data('objTimeout');
7724						if (objTimeout) {
7725							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7726							clearRequestTimeout(objTimeout);
7727						}
7728						if (transitionDuration == 0) {
7729							if ($(val).hasClass('animate_when_almost_visible')) {
7730								$(val).addClass('zoom-reverse').removeClass('start_animation');
7731							} else {
7732								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7733							}
7734						}
7735					});
7736					loadCssGrid($filter);
7737				}
7738			};
7739
7740			if (!$filter.hasClass('active')) {
7741				/** Scroll top with filtering */
7742				if (filterContainer.hasClass('filter-scroll')) {
7743                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7744                    calc_scroll -= UNCODE.get_scroll_offset();
7745
7746					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7747						delta = bodyTop - calc_scroll,
7748						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7749						filterTolerance = false,
7750						filter_timeout;
7751					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7752
7753					if ( !UNCODE.isFullPage ) {
7754						if (scrollSpeed == 0) {
7755							$('html, body').scrollTop(calc_scroll);
7756							UNCODE.scrolling = false;
7757							filter_items();
7758						} else {
7759
7760							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7761								filter_items();
7762								filterTolerance = true;
7763							}
7764
7765							$('html, body').animate({
7766								scrollTop: calc_scroll
7767							},{
7768								easing: 'easeInOutQuad',
7769								duration: scrollSpeed,
7770								complete: function(){
7771									UNCODE.scrolling = false;
7772									if ( !filterTolerance ) {
7773										filter_timeout = setTimeout(function(){
7774											clearTimeout(filter_timeout);
7775											filter_items();
7776										}, 200);
7777									}
7778								}
7779							});
7780						}
7781					}
7782				} else {
7783					filter_items();
7784				}
7785			}
7786			evt.preventDefault();
7787		});
7788
7789		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7790			var params = UNCODE.getURLParams(window.location);
7791			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7792
7793			UNCODE.lastURL = window.location.href;
7794
7795			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
7796				return;
7797			}
7798
7799			if (params.id === undefined) {
7800				$.each($('.cssgrid-system'), function(index, val) {
7801					loadCssGrid($(val));
7802				});
7803			} else {
7804				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7805					loadCssGrid($('#' + params.id));
7806				}
7807			}
7808		});
7809
7810		var loadCssGrid = function($href, $paginating) {
7811			var is_paginating = false;
7812
7813			if (undefined !== $paginating && $paginating) {
7814				var is_paginating = $paginating;
7815			}
7816
7817			var href = ($href.is("a") ? $href.attr('href') : location),
7818				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7819				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7820				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7821				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7822				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7823				cssgridId = cssgridSystem.attr('id');
7824			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7825				UNCODE.lastURL = href;
7826				history.pushState({
7827					myCSSgrid: true
7828				}, document.title, href);
7829			}
7830			cssgridWrapper.addClass('cssgrid-loading');
7831			if (is_paginating) {
7832				cssgridWrapper.addClass('grid-filtering');
7833			}
7834			$.ajax({
7835				url: href
7836			}).done(function(data) {
7837				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7838					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7839					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7840				requestTimeout(function() {
7841					cssgridContainer.html($resultItems);
7842					cssgridWrapper.removeClass('cssgrid-loading');
7843					cssgridWrapper.removeClass('grid-filtering');
7844					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7845					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7846					UNCODE.adaptive();
7847					if (SiteParameters.dynamic_srcset_active === '1') {
7848						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7849					}
7850					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7851						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7852						if (typeof getLightbox === 'object') {
7853							getLightbox.refresh();
7854						} else {
7855							UNCODE.lightbox();
7856						}
7857					}
7858					cssgridContainer.trigger('more-items-loaded');
7859					$(window).trigger('more-items-loaded');
7860					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7861				}, 300);
7862
7863				$('.pagination', cssgridFooter).remove();
7864				cssgridFooter.append($resultPagination);
7865
7866				if (cssgridResultCount.length > 0) {
7867					$('.woocommerce-result-count', cssgridResultCount).remove();
7868					cssgridResultCount.append($resultCount);
7869				}
7870			});
7871		};
7872
7873		$filters.each(function(i, buttonGroup) {
7874			var $buttonGroup = $(buttonGroup);
7875			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7876				$buttonGroup.find('.active').removeClass('active');
7877				$(this).addClass('active');
7878
7879			});
7880
7881			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7882				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7883				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7884			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7885				e.preventDefault();
7886				$cats_filters.slideToggle(400, 'easeInOutCirc');
7887			});
7888
7889		});
7890	};
7891};
7892
7893UNCODE.linearGrid = function(){
7894	$('.linear-wrapper').each(function(){
7895		var $wrap = $(this),
7896			$system = $wrap.closest('.linear-system'),
7897			$dragger = $('[data-dragger]', $system),
7898			$row = $wrap.closest('.vc_row[data-parent]'),
7899			_row = $row[0],
7900			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7901			vertical = $cont.hasClass('linear-or-vertical'),
7902			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7903			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7904			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7905			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7906			isInMenu = $wrap.closest('.megamenu-block-wrapper').length,
7907			isInViewport = false,
7908			isHover = false,
7909			init = false,
7910			stableHeight = UNCODE.wheight,
7911			wCont, hCont, docH, marqueeTL;
7912
7913		if ( ! $('.tmb', $cont).length ) {
7914			return;
7915		}
7916
7917		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7918		var dataX = dataSpeed;
7919
7920		dataSpeed += 5;
7921
7922		var checkLinearGridSize = function(){
7923			if ( !$wrap.is(':visible') )  {
7924				return;
7925			}
7926			$wrap.find('.cont-appended').remove();
7927
7928			if ( vertical ) {
7929				if ( ! SiteParameters.is_frontend_editor ) {
7930					hCont = $cont.outerHeight();
7931					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7932					if ( hCont < docH ) {
7933						var res = docH - hCont * 3,
7934							times = 2 * Math.round((res/hCont+1) / 2);
7935					}
7936					for ( var i = 0; i < times; i++ ) {
7937						var $cloneCont = $cont.clone(),
7938							$cloneCont2 = $cont.clone(),
7939							trans = ( (i+2) ) * 100;
7940						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7941						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7942						$cloneCont.find('a[data-lbox]').each(function(){
7943							var dataLbox = $(this).attr('data-lbox');
7944							$(this).attr('data-lbox', dataLbox + '_' + i);
7945						});
7946						$cloneCont.find('.wp-video-shortcode').each(function(){
7947							var thisID = $(this).attr('id');
7948							$(this).attr('id', thisID + '_' + i);
7949						});
7950						$cloneCont2.find('a[data-lbox]').each(function(){
7951							var dataLbox = $(this).attr('data-lbox');
7952							$(this).attr('data-lbox', dataLbox + '_2' + i);
7953						});
7954						$cloneCont2.find('.wp-video-shortcode').each(function(){
7955							var thisID = $(this).attr('id');
7956							$(this).attr('id', thisID + '__' + i);
7957						});
7958						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7959							UNCODE.lightgallery($cloneCont);
7960							UNCODE.lightgallery($cloneCont2);
7961						}
7962					}
7963                }
7964			} else {
7965				wCont = $cont.outerWidth();
7966				if ( (wCont) < UNCODE.wwidth*2 ) {
7967					var res = UNCODE.wwidth*2 - (wCont),
7968						times = 2 * Math.round((res/wCont+1) / 2);
7969				}
7970				for ( var i = 0; i < times; i++ ) {
7971					var $cloneCont = $cont.clone(),
7972						$cloneCont2 = $cont.clone(),
7973						trans = ( (i+2) ) * 100;
7974					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7975					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7976					$cloneCont.find('a[data-lbox]').each(function(){
7977						var dataLbox = $(this).attr('data-lbox');
7978						$(this).attr('data-lbox', dataLbox + '_' + i);
7979					});
7980					$cloneCont.find('[id]').each(function(){
7981						var thisID = $(this).attr('id');
7982						$(this).attr('id', thisID + '_' + i);
7983					});
7984					$cloneCont2.find('a[data-lbox]').each(function(){
7985						var dataLbox = $(this).attr('data-lbox');
7986						$(this).attr('data-lbox', dataLbox + '_2' + i);
7987					});
7988					$cloneCont2.find('[id]').each(function(){
7989						var thisID = $(this).attr('id');
7990						$(this).attr('id', thisID + '__' + i);
7991					});
7992                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
7993                        UNCODE.lightgallery($cloneCont);
7994                        UNCODE.lightgallery($cloneCont2);
7995                    }
7996                }
7997			}
7998		};
7999		if ( clone ) {
8000			checkLinearGridSize();
8001			$(window).on('resize.linearGrid', function(){
8002				checkLinearGridSize();
8003			});
8004		}
8005
8006		var continuousLinearMarquee = function(_xStrt){
8007			if ( !$wrap.is(':visible') )  {
8008				return;
8009			}
8010			var ease = 'none';
8011			wCont = $cont.outerWidth();
8012			hCont = $cont.outerHeight();
8013
8014			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
8015				xEnd = vertical ? hCont : wCont,
8016				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
8017				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
8018				speedSlow = (xEnd + xStrt) / 45,
8019				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
8020
8021			marqueeTL = new TimelineMax({paused:true, reversed:true});
8022
8023			if ( (isInViewport && !isHover && !freezed) || isInMenu ) {
8024				marqueeTL.play();
8025
8026				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
8027					var $column = $wrap.closest('.wpb_column'),
8028						$col_link = $('.col-link', $column),
8029						$hover_sel = $wrap;
8030
8031					if ( $col_link.length ) {
8032						$hover_sel = $wrap.add($column);
8033					}
8034
8035					$hover_sel.on('mouseover', function(){
8036						if ( $wrap.attr('data-hover') === 'yes' ) {
8037							//speed = ( 10 - dataSpeed ) * 5;
8038							ease = 'power2.out';
8039							marqueeTL.duration( speedSlow );
8040						} else {
8041							marqueeTL.pause();
8042						}
8043						isHover = true;
8044					}).on('mouseout', function(){
8045						if ( $wrap.attr('data-hover') === 'yes' ) {
8046							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
8047							ease = 'power2.in';
8048							marqueeTL.duration( speed );
8049						} else {
8050							marqueeTL.play();
8051						}
8052						isHover = false;
8053					});
8054				}
8055
8056				$(document).on('sub-menu-slide-up', function(){
8057					if ( isInMenu ) {
8058						marqueeTL.pause();
8059					}
8060				});
8061
8062			}
8063	
8064			gsap.killTweensOf($wrap);
8065			if ( vertical ) {
8066				marqueeTL.fromTo( $wrap, {
8067					y: xStrt * direction
8068				},
8069				{
8070					duration: speed,
8071					y: xEnd * direction * -1,
8072					onComplete: function(){
8073						continuousLinearMarquee();
8074					},
8075					ease: ease,
8076					paused: freezed
8077				});
8078			} else {
8079				marqueeTL.fromTo( $wrap, {
8080					x: xStrt * direction
8081				},
8082				{
8083					duration: speed,
8084					x: xEnd * direction * -1,
8085					onComplete: function(){
8086						continuousLinearMarquee();
8087					},
8088					ease: ease,
8089					paused: freezed
8090				});
8091			}
8092		};
8093
8094		var dragLinearContinuous = function(){
8095			if ( !$wrap.is(':visible') )  {
8096				return;
8097			}
8098			var matrix, _x, _y,
8099				dragAction = false;
8100			Draggable.create($wrap[0], {
8101				type: vertical ? "y" : "x",
8102				bounds: document.getElementById("container"),
8103				inertia: false,
8104				onPress: function (e) {
8105				},
8106				onRelease: function (e) {
8107					if ( dragAction === true ) {
8108						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8109						_x = matrix[12] || matrix[4];
8110						_y = matrix[13] || matrix[5];
8111						if ( vertical ) {
8112							continuousLinearMarquee(_y * -1);
8113						} else {
8114							continuousLinearMarquee(_x * -1);
8115						}
8116						$wrap.removeClass('linear-dragging');
8117					}
8118				},
8119				onDrag: function (e) {
8120					dragAction = true;
8121					$wrap.addClass('linear-dragging');
8122				},
8123				onDragEnd: function (e) {
8124					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8125					_x = matrix[12] || matrix[4];
8126					_y = matrix[13] || matrix[5];
8127					wCont = $cont.outerWidth();
8128					hCont = $cont.outerHeight();
8129					if ( vertical ) {
8130						if ( Math.abs(_y) > hCont ) {
8131							if ( _y < 0 ) {
8132								_y = hCont + parseFloat( _y );
8133							} else {
8134								_y = parseFloat( _y ) - hCont;
8135							}
8136						}
8137						continuousLinearMarquee(_y * -1);
8138					} else {
8139						if ( Math.abs(_x) > wCont ) {
8140							if ( _x < 0 ) {
8141								_x = wCont + parseFloat( _x );
8142							} else {
8143								_x = parseFloat( _x ) - wCont;
8144							}
8145						}
8146						continuousLinearMarquee(_x * -1);
8147					}
8148					$wrap.removeClass('linear-dragging');
8149					dragAction = false;
8150				},
8151			});
8152		};
8153
8154		var runScrollLinear = function(){
8155			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
8156			if ( (!$wrap.is(':visible') || freezed) )  {
8157				return;
8158			}
8159			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
8160				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
8161			
8162			var linearGridScroll = function(){
8163				if ( isInViewport ) {
8164					var bound = _row.getBoundingClientRect();
8165
8166					var bound_top = bound.top,
8167						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
8168
8169					if ( vertical ) {
8170						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8171					} else {
8172						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8173					}
8174					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8175						requestAnimationFrame(linearGridScroll);
8176					}
8177				}
8178				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
8179					window.addEventListener("scroll", linearGridScroll);
8180				}
8181			};
8182
8183			$(window).on( 'load wwResize', function(e) {
8184				stableHeight = UNCODE.wheight;
8185				linearGridScroll();
8186			});
8187			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8188				requestAnimationFrame(linearGridScroll);
8189			}
8190		};
8191		
8192		var dragLinear = function(){
8193			if ( !$wrap.is(':visible') )  {
8194				return;
8195			}
8196			var matrix, _x, _y;
8197			Draggable.create($dragger[0], {
8198				type: vertical ? "y" : "x",
8199				bounds: document.getElementById("container"),
8200				inertia: false,
8201				onPress: function (e) {
8202				},
8203				onRelease: function (e) {
8204				},
8205				onDrag: function (e) {
8206					$wrap.addClass('linear-dragging');
8207				},
8208				onDragEnd: function (e) {
8209					matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8210					_x = matrix[12] || matrix[4];
8211					_y = matrix[13] || matrix[5];
8212					wCont = $cont.outerWidth();
8213					hCont = $cont.outerHeight();
8214					if ( vertical ) {
8215						if ( Math.abs(_y) > hCont ) {
8216							if ( _y < 0 ) {
8217								_y = hCont + parseFloat( _y );
8218							} else {
8219								_y = parseFloat( _y ) - hCont;
8220							}
8221							gsap.to( $dragger[0], {
8222								duration: 0,
8223								y: _y,
8224							});
8225						}
8226					} else {
8227						if ( Math.abs(_x) > wCont ) {
8228							if ( _x < 0 ) {
8229								_x = wCont + parseFloat( _x );
8230							} else {
8231								_x = parseFloat( _x ) - wCont;
8232							}
8233							gsap.to( $dragger[0], {
8234								duration: 0,
8235								x: _x,
8236							});
8237						}
8238					}
8239					$wrap.removeClass('linear-dragging');
8240				},
8241			});
8242		};
8243
8244		if ( ! $('body').hasClass('compose-mode') ) {
8245			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
8246				continuousLinearMarquee();
8247				$(window).on( 'wwResize', function(e) {
8248					continuousLinearMarquee();
8249				});	
8250				$(document).on('sub-menu-slide-down', function(){
8251					if ( isInMenu ) {
8252						continuousLinearMarquee();
8253					}
8254				});
8255				if ( $wrap.attr('data-draggable') === 'yes' ) {
8256					dragLinearContinuous();
8257				}
8258			}
8259
8260			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8261				runScrollLinear();
8262				if ( $wrap.attr('data-draggable') === 'yes' ) {
8263					dragLinear();
8264				}
8265			}
8266
8267			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8268				var observer = new IntersectionObserver(function(entries) {
8269						
8270					entries.forEach(function(entry){
8271						if ( entry.isIntersecting ) {
8272							isInViewport = true;
8273							if ( !init ) {
8274								init = true;
8275								continuousLinearMarquee();
8276							} else {
8277								if ( typeof marqueeTL !== 'undefined' ) {
8278									marqueeTL.play();
8279								}
8280							}
8281							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8282								requestAnimFrame(runScrollLinear);
8283							}
8284						} else {
8285							isInViewport = false;
8286							if ( typeof marqueeTL !== 'undefined' ) {
8287								marqueeTL.pause();
8288							}
8289						}
8290					});
8291				}, { 
8292					root: document,
8293				});
8294
8295				observer.observe(_row);
8296
8297			} else {
8298
8299				var checkVisible = function( el, off ) {
8300					if (typeof jQuery === "function" && el instanceof jQuery) {
8301						el = el[0];
8302					}
8303			
8304					off = typeof off=='undefined' ? 50 : off;
8305			
8306					var rect = el.getBoundingClientRect();
8307			
8308					return (
8309						(
8310							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8311							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8312							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8313						)
8314					);
8315				};
8316				
8317				var checkVisibility = function(){
8318
8319					if ( checkVisible($row) ) {
8320						isInViewport = true;
8321						if ( typeof marqueeTL !== 'undefined' ) {
8322							marqueeTL.play();
8323						}
8324					} else {
8325						isInViewport = false;
8326						if ( typeof marqueeTL !== 'undefined' ) {
8327							marqueeTL.pause();
8328						}
8329					}
8330				}
8331
8332				window.addEventListener("scroll", checkVisibility);
8333				checkVisibility();
8334
8335			}
8336		}
8337	});
8338};
8339UNCODE.wrapperMarquee = function () {
8340
8341	function createMarquee(opts) {
8342		if (!opts) return;
8343
8344		var parent = opts.parent;
8345		var originals = opts.originals;
8346
8347		if (!parent || !originals) return;
8348		if (parent.getAttribute('data-marquee-init') === '1') return;
8349		parent.setAttribute('data-marquee-init', '1');
8350
8351		function raf(cb) {
8352			return (window.requestAnimationFrame ||
8353				window.webkitRequestAnimationFrame ||
8354				window.mozRequestAnimationFrame ||
8355				function (fn) { return window.setTimeout(fn, 16); }
8356			)(cb);
8357		}
8358
8359		function caf(id) {
8360			return (window.cancelAnimationFrame ||
8361				window.webkitCancelAnimationFrame ||
8362				window.mozCancelAnimationFrame ||
8363				function (tid) { window.clearTimeout(tid); }
8364			)(id);
8365		}
8366
8367		function getWidth(el) {
8368			if (!el) return 0;
8369			if (el.getBoundingClientRect) return el.getBoundingClientRect().width;
8370			return el.offsetWidth || 0;
8371		}
8372
8373		function getPointX(e) {
8374			if (e.touches && e.touches.length) return e.touches[0].clientX;
8375			if (e.changedTouches && e.changedTouches.length) return e.changedTouches[0].clientX;
8376			return e.clientX;
8377		}
8378
8379		function getPointY(e) {
8380			if (e.touches && e.touches.length) return e.touches[0].clientY;
8381			if (e.changedTouches && e.changedTouches.length) return e.changedTouches[0].clientY;
8382			return e.clientY;
8383		}
8384
8385		function getPageY() {
8386			if (typeof window.pageYOffset === 'number') return window.pageYOffset;
8387			return (document.documentElement ? document.documentElement.scrollTop : 0);
8388		}
8389
8390		function getViewportW() {
8391			return window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
8392		}
8393
8394		var baseSpeed = (typeof opts.speed === 'number') ? opts.speed : 50;
8395		var direction = (typeof opts.direction === 'number') ? opts.direction : -1;
8396		var maxReps = (typeof opts.maxReps === 'number') ? opts.maxReps : 12;
8397
8398		var scrollDriven = (opts.scrollDriven === true);
8399		var scrollFactor = (typeof opts.scrollFactor === 'number') ? opts.scrollFactor : 0.6;
8400		var isScrollControlled = (opts.isScrollControlled === true);
8401
8402		var inViewOnly = (opts.inViewOnly !== false);
8403		var viewMargin = (typeof opts.viewMargin === 'number') ? opts.viewMargin : 80;
8404
8405		var hoverSpeed = (typeof opts.hoverSpeed === 'number') ? opts.hoverSpeed : null;
8406		var isHover = false;
8407
8408		var infinite = (opts.infinite === true) && !SiteParameters.is_frontend_editor;
8409		var draggable = (opts.draggable === true);
8410
8411		var freezeMode = (typeof opts.freeze === 'string') ? opts.freeze : null;
8412		var freezeBp = (typeof opts.freezeBp === 'number') ? opts.freezeBp : 960;
8413
8414		function isFrozenNow() {
8415			if (!freezeMode) return false;
8416
8417			var w = getViewportW();
8418			if (freezeMode === 'always') return true;
8419			if (freezeMode === 'desktop') return w >= freezeBp;
8420			if (freezeMode === 'mobile') return w < freezeBp;
8421
8422			return false;
8423		}
8424
8425		function closestRowParent(el) {
8426			if (!el || !el.closest) return null;
8427			return el.closest('[data-parent="true"]') || null;
8428		}
8429
8430		function ensureId(el, prefix) {
8431			if (!el) return null;
8432			if (el.id && el.id.length) return el.id;
8433
8434			var p = prefix || 'uncode-row';
8435			var rnd = (Math.random().toString(36).slice(2) + Date.now().toString(36)).slice(0, 12);
8436			el.id = p + '-' + rnd;
8437			return el.id;
8438		}
8439
8440		function dispatchClonesEvent(payload) {
8441			try {
8442				parent.dispatchEvent(new CustomEvent('uncode:marquee:clones-built', {
8443					bubbles: true,
8444					detail: payload
8445				}));
8446			} catch (e) {}
8447		}
8448
8449		var clonesEventRaf = 0;
8450		function dispatchClonesEventDebounced(payload) {
8451			if (clonesEventRaf) return;
8452			clonesEventRaf = raf(function () {
8453				clonesEventRaf = 0;
8454				dispatchClonesEvent(payload);
8455			});
8456		}
8457
8458		var base = [];
8459		var i;
8460		for (i = 0; i < originals.length; i++) base.push(originals[i]);
8461		if (!base.length) return;
8462
8463		var track = document.createElement('div');
8464		track.className = (opts.trackClassName ? opts.trackClassName : 'cs-track');
8465
8466		gsap.set(track, {
8467			x: 0,
8468			force3D: true,
8469			willChange: 'transform'
8470		});
8471
8472		var baseWrap = document.createElement('div');
8473		baseWrap.className = 'cs-base';
8474
8475		var leftWrap = null;
8476		var rightWrap = null;
8477
8478		parent.insertBefore(track, parent.firstChild);
8479
8480		if (infinite) {
8481			leftWrap = document.createElement('div');
8482			leftWrap.className = 'cs-clones cs-clones--left';
8483
8484			rightWrap = document.createElement('div');
8485			rightWrap.className = 'cs-clones cs-clones--right';
8486
8487			track.appendChild(leftWrap);
8488			track.appendChild(baseWrap);
8489			track.appendChild(rightWrap);
8490		} else {
8491			track.appendChild(baseWrap);
8492		}
8493
8494		var sourceWrap = document.createElement('div');
8495		sourceWrap.className = 'cs-source';
8496		sourceWrap.style.display = 'none';
8497
8498		track.parentNode.insertBefore(sourceWrap, track);
8499
8500		for (i = 0; i < base.length; i++) {
8501			sourceWrap.appendChild(base[i]);
8502		}
8503
8504		function fillBaseWrapFromSource() {
8505			baseWrap.innerHTML = '';
8506
8507			var fragBase = document.createDocumentFragment();
8508			var k, clone;
8509
8510			for (k = 0; k < base.length; k++) {
8511				clone = base[k].cloneNode(true);
8512				clone.setAttribute('data-marquee-clone', '1');
8513				clone.setAttribute('data-marquee-origin-index', k);
8514				clone.setAttribute('aria-hidden', 'true');
8515				fragBase.appendChild(clone);
8516			}
8517
8518			baseWrap.appendChild(fragBase);
8519		}
8520
8521		fillBaseWrapFromSource();
8522
8523		var cycleW = 1;
8524
8525		function clearClones() {
8526			if (!infinite) return;
8527			leftWrap.innerHTML = '';
8528			rightWrap.innerHTML = '';
8529		}
8530
8531		function measureCycle() {
8532			cycleW = baseWrap.scrollWidth || 0;
8533			if (!cycleW || cycleW < 1) cycleW = 1;
8534
8535			track.style.width = cycleW + 'px';
8536		}
8537
8538		function buildClones() {
8539			fillBaseWrapFromSource();
8540			
8541			measureCycle();
8542
8543			if (!infinite) {
8544				var rowP0 = closestRowParent(parent);
8545				var rowId0 = ensureId(rowP0, 'uncode-row');
8546
8547				dispatchClonesEventDebounced({
8548					type: 'measured-only',
8549					parent: parent,
8550					track: track,
8551					baseWrap: baseWrap,
8552					leftWrap: leftWrap,
8553					rightWrap: rightWrap,
8554					rowParent: rowP0,
8555					rowParentId: rowId0,
8556					infinite: false,
8557					cycleW: cycleW,
8558					reps: 0
8559				});
8560
8561				triggerMarqueeRefreshDebounced(baseWrap);
8562				dispatchMarqueeReady();
8563				return true;
8564			}
8565
8566			clearClones();
8567
8568			var parentW = getWidth(parent);
8569			if (!cycleW || !parentW) return false;
8570
8571			var reps = Math.ceil((parentW * 2) / cycleW) + 1;
8572			if (reps < 1) reps = 1;
8573			if (reps > maxReps) reps = maxReps;
8574
8575			var fragL = document.createDocumentFragment();
8576			var fragR = document.createDocumentFragment();
8577			var r, k, clone;
8578
8579			for (r = 0; r < reps; r++) {
8580				for (k = 0; k < base.length; k++) {
8581					clone = base[k].cloneNode(true);
8582					clone.setAttribute('data-marquee-clone', '1');
8583					clone.setAttribute('data-marquee-origin-index', k);
8584					clone.setAttribute('aria-hidden', 'true');
8585					fragL.appendChild(clone);
8586				}
8587			}
8588
8589			for (r = 0; r < reps; r++) {
8590				for (k = 0; k < base.length; k++) {
8591					clone = base[k].cloneNode(true);
8592					clone.setAttribute('data-marquee-clone', '1');
8593					clone.setAttribute('data-marquee-origin-index', k);
8594					clone.setAttribute('aria-hidden', 'true');
8595					fragR.appendChild(clone);
8596				}
8597			}
8598
8599			leftWrap.appendChild(fragL);
8600			rightWrap.appendChild(fragR);
8601
8602			measureCycle();
8603
8604			var rowP = closestRowParent(parent);
8605			var rowId = ensureId(rowP, 'uncode-row');
8606
8607			dispatchClonesEventDebounced({
8608				type: 'clones-built',
8609				parent: parent,
8610				track: track,
8611				baseWrap: baseWrap,
8612				leftWrap: leftWrap,
8613				rightWrap: rightWrap,
8614				rowParent: rowP,
8615				rowParentId: rowId,
8616				infinite: true,
8617				cycleW: cycleW,
8618				reps: reps
8619			});
8620
8621			triggerMarqueeRefreshDebounced(baseWrap);
8622			dispatchMarqueeReady();
8623
8624			return true;
8625		}
8626
8627		function findClosestClone(node) {
8628			while (node && node !== parent) {
8629				if (node.getAttribute && node.getAttribute('data-marquee-clone') === '1') {
8630					return node;
8631				}
8632				node = node.parentNode;
8633			}
8634			return null;
8635		}
8636
8637		function findClickableInsideClone(node, cloneRoot) {
8638			while (node && node !== cloneRoot) {
8639				if (node.matches && node.matches('a[href], [data-lbox], [data-lightbox], .uncode-lbox')) {
8640					return node;
8641				}
8642				node = node.parentNode;
8643			}
8644			return null;
8645		}
8646
8647		function findMatchingOriginalClickable(originalRoot, clickedEl) {
8648			if (!originalRoot || !clickedEl) return null;
8649
8650			var all = originalRoot.querySelectorAll('a[href], [data-lbox], [data-lightbox], .uncode-lbox');
8651			if (!all.length) return null;
8652
8653			var href = clickedEl.getAttribute && clickedEl.getAttribute('href');
8654			var dataLbox = clickedEl.getAttribute && clickedEl.getAttribute('data-lbox');
8655
8656			var i, el;
8657			for (i = 0; i < all.length; i++) {
8658				el = all[i];
8659
8660				if (dataLbox && el.getAttribute('data-lbox') === dataLbox) return el;
8661				if (href && el.getAttribute('href') === href) return el;
8662			}
8663
8664			return all[0];
8665		}
8666
8667		function onCloneDelegatedClick(e) {
8668			var cloneRoot = findClosestClone(e.target);
8669			if (!cloneRoot) return;
8670
8671			var clickedEl = findClickableInsideClone(e.target, cloneRoot);
8672			if (!clickedEl) return;
8673
8674			var idx = parseInt(cloneRoot.getAttribute('data-marquee-origin-index'), 10);
8675			if (isNaN(idx) || !base[idx]) return;
8676
8677			var originalClickable = findMatchingOriginalClickable(base[idx], clickedEl);
8678			if (!originalClickable) return;
8679
8680			if (e.preventDefault) e.preventDefault();
8681			if (e.stopPropagation) e.stopPropagation();
8682			e.cancelBubble = true;
8683
8684			originalClickable.dispatchEvent(new MouseEvent('click', {
8685				bubbles: true,
8686				cancelable: true,
8687				view: window
8688			}));
8689
8690			return false;
8691		}
8692
8693		var xRaw = 0;
8694		var manualOffset = 0;
8695		var lastTs = 0;
8696		var frameId = 0;
8697		var isActive = true;
8698
8699		var lastVisibilityCheck = 0;
8700		var visibilityCheckEvery = 120;
8701
8702		var isDragging = false;
8703		var isTouchDragging = false;
8704		var touchDirectionLocked = null;
8705		var dragStartX = 0;
8706		var dragStartY = 0;
8707		var dragStartOffset = 0;
8708		var hasDragged = false;
8709		var dragThreshold = 6;
8710		var touchDirectionThreshold = 8;
8711
8712		var throwV = 0;
8713		var lastDragX = 0;
8714		var lastDragT = 0;
8715
8716		var lastPageY = getPageY();
8717		var scrollVelocity = 0;
8718
8719		var io = new IntersectionObserver(function(entries) {
8720			isActive = entries[0].isIntersecting;
8721		}, { rootMargin: viewMargin + 'px' });
8722
8723		io.observe(parent);
8724
8725		function updateInView() {
8726			if (!inViewOnly) isActive = true;
8727		}
8728
8729		function getEffectiveSpeed() {
8730			if (hoverSpeed !== null && isHover) return hoverSpeed;
8731			return baseSpeed;
8732		}
8733
8734		function dispatchMarqueeReady() {
8735			if ( SiteParameters.is_frontend_editor ) return;
8736			requestTimeout(function() {
8737
8738				var rowP = closestRowParent(parent);
8739				var rowId = ensureId(rowP, 'uncode-row');
8740
8741				document.dispatchEvent(new CustomEvent('uncode:marquee:ready', {
8742					bubbles: true,
8743					detail: {
8744						parent: parent,
8745						baseWrap: baseWrap,
8746						leftWrap: leftWrap,
8747						rightWrap: rightWrap,
8748						infinite: infinite,
8749						rowParent: rowP,
8750						rowParentId: rowId,
8751					}
8752				}));
8753			}, 0);
8754		}
8755
8756		function triggerMarqueeReinit(contextEl) {
8757			try {
8758				$(document).trigger('uncode-marquee-updated', {
8759					parent: parent,
8760					context: contextEl || baseWrap,
8761					baseWrap: baseWrap,
8762					leftWrap: leftWrap,
8763					rightWrap: rightWrap
8764				});
8765			} catch (e) {}
8766		}
8767
8768		var marqueeRefreshT = 0;
8769		function triggerMarqueeRefreshDebounced(contextEl) {
8770			if (marqueeRefreshT) {
8771				window.clearTimeout(marqueeRefreshT);
8772			}
8773			marqueeRefreshT = window.setTimeout(function() {
8774				triggerMarqueeReinit(contextEl || baseWrap);
8775				marqueeRefreshT = 0;
8776			}, 60);
8777		}
8778		
8779		function render() {
8780			var x;
8781			var totalX = xRaw + manualOffset;
8782
8783			if (infinite) {
8784				var m = totalX % cycleW;
8785				if (m > 0) m -= cycleW;
8786				x = m;
8787			} else {
8788				x = totalX;
8789			}
8790
8791			gsap.set(track, {
8792				x: x,
8793				force3D: true
8794			});
8795		}
8796
8797		function tick(ts) {
8798			if (!lastTs) lastTs = ts;
8799			var dt = (ts - lastTs) / 1000;
8800			lastTs = ts;
8801
8802			if (dt > 0.05) dt = 0.05;
8803
8804			updateInView();
8805
8806			if (!isActive) {
8807				frameId = raf(tick);
8808				return;
8809			}
8810
8811			if (!isDragging) {
8812
8813				if (isFrozenNow()) {
8814					throwV = 0;
8815					frameId = raf(tick);
8816					return;
8817				}
8818
8819				if (isScrolling) {
8820					frameId = raf(tick);
8821					return;
8822				}
8823
8824				if (!scrollDriven) {
8825					var s = getEffectiveSpeed();
8826					if (s) xRaw += (direction * s * dt);
8827				}
8828
8829				if (throwV) {
8830					xRaw += (throwV * dt);
8831					throwV *= Math.pow(0.04, dt);
8832					if (throwV < 8 && throwV > -8) throwV = 0;
8833				}
8834
8835				render();
8836			}
8837
8838			frameId = raf(tick);
8839		}
8840
8841		function start() {
8842			if (!buildClones()) {
8843				window.setTimeout(start, 50);
8844				return;
8845			}
8846
8847			lastTs = 0;
8848
8849			if (isScrollControlled) {
8850				render();
8851				return;
8852			}
8853
8854			if (frameId) caf(frameId);
8855			frameId = raf(tick);
8856			render();
8857		}
8858
8859		function stop() {
8860			if (frameId) caf(frameId);
8861			frameId = 0;
8862		}
8863
8864		function onDown(e) {
8865			if (e.type === 'mousedown' && e.button !== 0) return;
8866			if (isFrozenNow()) return;
8867
8868			dragStartX = getPointX(e);
8869			dragStartY = getPointY(e);
8870			dragStartOffset = manualOffset;
8871			hasDragged = false;
8872
8873			throwV = 0;
8874			lastDragX = dragStartX;
8875			lastDragT = (new Date()).getTime();
8876
8877			isTouchDragging = e.type === 'touchstart';
8878			touchDirectionLocked = null;
8879
8880			if (!isTouchDragging) {
8881				isDragging = true;
8882
8883				if (e.preventDefault) e.preventDefault();
8884				if (e.stopPropagation) e.stopPropagation();
8885			} else {
8886				isDragging = false;
8887			}
8888
8889			bindMoveUp(true);
8890		}
8891
8892		function onMove(e) {
8893			var nowX = getPointX(e);
8894			var nowY = getPointY(e);
8895			var dx = nowX - dragStartX;
8896			var dy = nowY - dragStartY;
8897
8898			if (isTouchDragging && touchDirectionLocked === null) {
8899				if (Math.abs(dx) < touchDirectionThreshold && Math.abs(dy) < touchDirectionThreshold) {
8900					return;
8901				}
8902
8903				if (Math.abs(dy) > Math.abs(dx)) {
8904					touchDirectionLocked = 'vertical';
8905					isDragging = false;
8906					bindMoveUp(false);
8907					return;
8908				}
8909
8910				touchDirectionLocked = 'horizontal';
8911				isDragging = true;
8912			}
8913
8914			if (!isDragging) return;
8915
8916			if (!hasDragged && (dx < -dragThreshold || dx > dragThreshold)) hasDragged = true;
8917
8918			manualOffset = dragStartOffset + dx;
8919			render();
8920
8921			var nowT = (new Date()).getTime();
8922			var dtMs = nowT - lastDragT;
8923			if (dtMs > 0) {
8924				var vx = (nowX - lastDragX) / (dtMs / 1000);
8925				if (vx > 2500) vx = 2500;
8926				if (vx < -2500) vx = -2500;
8927				throwV = vx * 0.5;
8928			}
8929
8930			lastDragX = nowX;
8931			lastDragT = nowT;
8932
8933			if (e.preventDefault) e.preventDefault();
8934		}
8935
8936		function onUp(e) {
8937			if (!isDragging && !isTouchDragging) return;
8938
8939			isDragging = false;
8940			isTouchDragging = false;
8941			touchDirectionLocked = null;
8942
8943			lastTs = 0;
8944			lastPageY = getPageY();
8945
8946			render();
8947			bindMoveUp(false);
8948
8949			if (e && hasDragged && e.preventDefault) e.preventDefault();
8950
8951			setTimeout(function () { hasDragged = false; }, 0);
8952		}
8953
8954		function bindMoveUp(bind) {
8955			if (bind) {
8956				document.addEventListener('mousemove', onMove, false);
8957				document.addEventListener('mouseup', onUp, false);
8958				document.addEventListener('touchmove', onTouchMoveDetect, { passive: true });
8959				document.addEventListener('touchend', onUp, false);
8960				document.addEventListener('touchcancel', onUp, false);
8961			} else {
8962				document.removeEventListener('mousemove', onMove, false);
8963				document.removeEventListener('mouseup', onUp, false);
8964				document.removeEventListener('touchmove', onTouchMoveDetect, { passive: true });
8965				document.removeEventListener('touchmove', onMove, { passive: false });
8966				document.removeEventListener('touchend', onUp, false);
8967				document.removeEventListener('touchcancel', onUp, false);
8968			}
8969		}
8970
8971		function onTouchMoveDetect(e) {
8972			var dx = Math.abs(getPointX(e) - dragStartX);
8973			var dy = Math.abs(getPointY(e) - dragStartY);
8974			if (dx < touchDirectionThreshold && dy < touchDirectionThreshold) return;
8975
8976			document.removeEventListener('touchmove', onTouchMoveDetect, { passive: true });
8977
8978			if (dy > dx) {
8979				isDragging = false;
8980				touchDirectionLocked = 'vertical';
8981				bindMoveUp(false);
8982			} else {
8983				touchDirectionLocked = 'horizontal';
8984				isDragging = true;
8985				document.addEventListener('touchmove', onMove, { passive: false });
8986			}
8987		}
8988
8989		if (parent.addEventListener) {
8990			if (draggable) {
8991				parent.addEventListener('mousedown', onDown, false);
8992				parent.addEventListener('touchstart', onDown, { passive: true });
8993			}
8994
8995			if (hoverSpeed !== null) {
8996				parent.addEventListener('mouseenter', function () { isHover = true; }, false);
8997				parent.addEventListener('mouseleave', function () { isHover = false; }, false);
8998			}
8999
9000			parent.addEventListener('click', onCloneDelegatedClick, false);
9001
9002		} else {
9003			if (draggable) {
9004				parent.onmousedown = onDown;
9005				parent.ontouchstart = onDown;
9006			}
9007		}
9008
9009		function onClickCapture(e) {
9010			if (hasDragged) {
9011				if (e.preventDefault) e.preventDefault();
9012				if (e.stopPropagation) e.stopPropagation();
9013				e.cancelBubble = true;
9014				return false;
9015			}
9016		}
9017
9018		if (draggable) {
9019			if (parent.addEventListener) parent.addEventListener('click', onClickCapture, true);
9020			else parent.onclick = onClickCapture;
9021		}
9022
9023		var resizeTimer = 0;
9024		var lastResizeW = getViewportW();
9025
9026		function onResize() {
9027			var currentW = getViewportW();
9028
9029			if (Math.abs(currentW - lastResizeW) < 2) {
9030				return;
9031			}
9032
9033			lastResizeW = currentW;
9034
9035			if (resizeTimer) window.clearTimeout(resizeTimer);
9036
9037			resizeTimer = window.setTimeout(function () {
9038				buildClones();
9039				render();
9040			}, 150);
9041		}
9042
9043		if (window.addEventListener) window.addEventListener('resize', onResize, false);
9044		else window.onresize = onResize;
9045
9046		var isScrolling = false;
9047		var scrollEndTimer = 0;
9048
9049		function onWindowScroll() {
9050			isScrolling = true;
9051			if (scrollEndTimer) clearTimeout(scrollEndTimer);
9052			scrollEndTimer = setTimeout(function () {
9053				isScrolling = false;
9054				lastTs = 0; // evita spike dt alla ripresa
9055			}, 80);
9056		}
9057
9058		if (scrollDriven) {
9059			if (window.addEventListener) window.addEventListener('scroll', onWindowScroll, { passive: true });
9060			else window.onscroll = onWindowScroll;
9061		}
9062
9063		start();
9064
9065		window.setTimeout(function () {
9066			buildClones();
9067			render();
9068			triggerMarqueeRefreshDebounced(baseWrap);
9069		}, 500);
9070
9071		return {
9072			start: start,
9073			stop: stop,
9074			setX: function (value) { xRaw = value; render(); },
9075			addX: function (delta) { xRaw += delta; render(); },
9076			setManualOffset: function (value) { manualOffset = value; render(); },
9077			getManualOffset: function () { return manualOffset; },
9078			resetManualOffset: function () { manualOffset = 0; render(); },
9079			getCycleW: function () { return cycleW; },
9080			update: function () {
9081				buildClones();
9082				render();
9083			},
9084			isFrozen: function () { return isFrozenNow(); }
9085		};
9086	}
9087
9088	function initMarqueesOnce() {
9089		if (typeof gsap === 'undefined' || typeof ScrollTrigger === 'undefined') {
9090			return false;
9091		}
9092		gsap.registerPlugin(ScrollTrigger);
9093		function getViewportW() {
9094			return window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
9095		}
9096		var wrappers = document.querySelectorAll('.cs-wrapper-marquee, .cs-wrapper');
9097
9098		if (!wrappers || !wrappers.length) wrappers = document.getElementsByClassName('cs-wrapper');
9099
9100		var itemClass = 'cs-container';
9101
9102		if (!wrappers || !wrappers.length) {
9103			return false;
9104		}
9105
9106		function isScrollMode(wrapper) {
9107			var mode = wrapper.getAttribute('data-mode');
9108			return mode === 'marquee-scroll' || mode === 'marquee-scroll-opposite';
9109		}
9110
9111		function getDirection(wrapper) {
9112			var mode = wrapper.getAttribute('data-mode');
9113			if (mode === 'marquee-opposite' || mode === 'marquee-scroll-opposite') return 1;
9114			return -1;
9115		}
9116
9117		function clamp(v, a, b) { return v < a ? a : (v > b ? b : v); }
9118
9119		function readStep(wrapper) {
9120			var v = parseFloat(wrapper.getAttribute('data-speed'));
9121			if (isNaN(v)) v = 0;
9122			return clamp(v, -4, 4);
9123		}
9124
9125		function stepToPxPerSec(step, baseDefault) {
9126			return (baseDefault / 5) * (step + 5);
9127		}
9128
9129		function readFreeze(wrapper) {
9130			var f = wrapper.getAttribute('data-freeze');
9131			if (f !== 'always' && f !== 'desktop' && f !== 'mobile') return null;
9132			return f;
9133		}
9134
9135		function isFrozenByAttr(freezeMode, bp) {
9136			if (!freezeMode) return false;
9137			var w = window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 0);
9138			if (freezeMode === 'always') return true;
9139			if (freezeMode === 'desktop') return w >= bp;
9140			if (freezeMode === 'mobile') return w < bp;
9141			return false;
9142		}
9143
9144		var baseDefault = 50;
9145		var autoFactor = 5;
9146		var freezeBp = 960;
9147
9148		var inited = 0;
9149
9150		for (var i = 0; i < wrappers.length; i++) {
9151			(function (wrapper) {
9152
9153				if (wrapper.getAttribute('data-anim') !== 'uncode_slider_marquee') {
9154					return;
9155				}
9156
9157				var items = wrapper.getElementsByClassName(itemClass);
9158				if (!items || !items.length) {
9159					return;
9160				}
9161
9162				var scrollMode = isScrollMode(wrapper);
9163				var dir = getDirection(wrapper);
9164
9165				var step = readStep(wrapper);
9166				var pxPerSec = stepToPxPerSec(step, baseDefault);
9167				var autoplayPxPerSec = pxPerSec * autoFactor;
9168
9169				var needHover = wrapper.getAttribute('data-hover');
9170				var hoverSpeed;
9171				if (needHover === 'yes') hoverSpeed = autoplayPxPerSec * 0.2;
9172				else if (needHover === 'pause') hoverSpeed = 0;
9173				else hoverSpeed = autoplayPxPerSec;
9174
9175				var freeze = readFreeze(wrapper);
9176
9177				var marquee = createMarquee({
9178					parent: wrapper,
9179					originals: items,
9180					infinite: wrapper.getAttribute('data-infinite') === 'yes' && !SiteParameters.is_frontend_editor,
9181					speed: scrollMode ? 0 : autoplayPxPerSec,
9182					draggable: wrapper.getAttribute('data-draggable') === 'yes' || SiteParameters.is_frontend_editor,
9183					scrollDriven: false,
9184					isScrollControlled: scrollMode,
9185					inViewOnly: true,
9186					viewMargin: 300,
9187					maxReps: getViewportW() < 570 ? 4 : 8,
9188					direction: dir,
9189					hoverSpeed: scrollMode || SiteParameters.is_frontend_editor ? 0 : hoverSpeed,
9190					freeze: freeze && !SiteParameters.is_frontend_editor,
9191					freezeBp: freezeBp
9192				});
9193
9194				if (!marquee) {
9195					return;
9196				}
9197
9198				wrapper._uncodeMarqueeApi = marquee;
9199	
9200				inited++;
9201
9202				if (!scrollMode || SiteParameters.is_frontend_editor) {
9203					ScrollTrigger.create({
9204						trigger: wrapper,
9205						start: 'top bottom',
9206						end: 'bottom top',
9207						invalidateOnRefresh: true,
9208						refreshPriority: -1,
9209						onEnter: function () {
9210							if (isFrozenByAttr(freeze, freezeBp)) return;
9211							marquee.start();
9212						},
9213						onEnterBack: function () {
9214							if (isFrozenByAttr(freeze, freezeBp)) return;
9215							marquee.start();
9216						},
9217						onLeave: function () { marquee.stop(); },
9218						onLeaveBack: function () { marquee.stop(); }
9219					});
9220				} else {
9221					ScrollTrigger.create({
9222						trigger: wrapper,
9223						start: 'top bottom',
9224						end: 'bottom top',
9225						scrub: true,
9226						invalidateOnRefresh: true,
9227						refreshPriority: -1,
9228						onUpdate: function (self) {
9229							if (isFrozenByAttr(freeze, freezeBp)) return;
9230
9231							var w = marquee.getCycleW();
9232							if (!w) return;
9233
9234							var cycles = pxPerSec / baseDefault;
9235
9236							if (getViewportW() < 570) {
9237								cycles *= 0.55;
9238							}
9239
9240							marquee.setX(dir * self.progress * cycles * w);
9241						}
9242					});
9243				}
9244
9245			})(wrappers[i]);
9246		}
9247
9248		if (typeof ResizeObserver !== 'undefined' && typeof ScrollTrigger !== 'undefined') {
9249			var t = 0;
9250			function refreshST() {
9251				if (t) window.clearTimeout(t);
9252				t = window.setTimeout(function () {
9253					ScrollTrigger.refresh();
9254				}, 150);
9255			}
9256
9257			var ro = new ResizeObserver(function () {
9258				refreshST();
9259			});
9260
9261			if (getViewportW() >= 960) {
9262				ro.observe(document.body);
9263			}
9264		}
9265
9266		window.setTimeout(function () {
9267			if (typeof ScrollTrigger !== 'undefined') {
9268				ScrollTrigger.sort();
9269				ScrollTrigger.refresh();
9270			}
9271		}, 0);
9272		
9273		return true;
9274	}
9275
9276	(function retryInit() {
9277		var tries = 0;
9278		var maxTries = 40;
9279		function go() {
9280			tries++;
9281			var ok = initMarqueesOnce();
9282			if (ok) return;
9283			if (tries >= maxTries) {
9284				return;
9285			}
9286			window.setTimeout(go, 100);
9287		}
9288		go();
9289	})();
9290};
9291UNCODE.wrapperSticky = function(){
9292    (function () {
9293        if (typeof gsap === 'undefined' || typeof ScrollTrigger === 'undefined') return;
9294        gsap.registerPlugin(ScrollTrigger);
9295
9296        var wrappers = document.getElementsByClassName('cs-wrapper-sticky');
9297        var i;
9298
9299        function ensureTrack(wrapper) {
9300            var track = wrapper.querySelector('.cs-track');
9301            if (track) return track;
9302
9303            track = document.createElement('div');
9304            track.className = 'cs-track';
9305
9306            var items = wrapper.getElementsByClassName('cs-container');
9307            var list = [];
9308            var k;
9309            for (k = 0; k < items.length; k++) list.push(items[k]);
9310
9311            wrapper.insertBefore(track, wrapper.firstChild);
9312            for (k = 0; k < list.length; k++) track.appendChild(list[k]);
9313
9314            return track;
9315        }
9316
9317        function setupHorizontalPin(wrapper) {
9318            var track = ensureTrack(wrapper);
9319            var tween = null;
9320            var st = null;
9321
9322            function getTriggerElement() {
9323                if (wrapper.closest) {
9324                    return wrapper.closest('.vc_row[data-parent]') || wrapper;
9325                }
9326                return wrapper;
9327            }
9328
9329            function isStickyDisabled() {
9330                var w = window.innerWidth || document.documentElement.clientWidth;
9331
9332                if (wrapper.getAttribute('data-disable-sticky-mobile') === 'yes' && w < 570) {
9333                    return true;
9334                }
9335
9336                if (wrapper.getAttribute('data-disable-sticky-tablet') === 'yes' && w < 960) {
9337                    return true;
9338                }
9339
9340                return false;
9341            }
9342
9343            function getDirection() {
9344                var d = wrapper.getAttribute('data-direction');
9345                if (d === 'reverse' || d === 'rtl' || d === 'right') return 1;
9346                return -1;
9347            }
9348
9349            function getStartPosition() {
9350                var align = wrapper.getAttribute('data-align');
9351                return align ? align : 'top top';
9352            }
9353
9354            function getDistance() {
9355                var wrapperW = wrapper.getBoundingClientRect
9356                    ? wrapper.getBoundingClientRect().width
9357                    : wrapper.offsetWidth;
9358
9359                var dist = track.scrollWidth - wrapperW;
9360                if (dist < 0) dist = 0;
9361                return dist;
9362            }
9363
9364            function destroy() {
9365                if (st) {
9366                    st.kill();
9367                    st = null;
9368                }
9369
9370                if (tween) {
9371                    tween.kill();
9372                    tween = null;
9373                }
9374
9375                gsap.set(track, { clearProps: 'transform' });
9376            }
9377
9378            function make() {
9379                destroy();
9380
9381                if (isStickyDisabled()) {
9382                    return;
9383                }
9384
9385                var dist = getDistance();
9386                if (!dist) return;
9387
9388                var dir = getDirection();
9389                var startPos = getStartPosition();
9390                var triggerEl = getTriggerElement();
9391
9392                gsap.set(track, { x: 0 });
9393
9394                tween = gsap.to(track, {
9395                    x: dist * dir,
9396                    ease: 'none',
9397                    scrollTrigger: {
9398                        trigger: triggerEl,
9399                        start: startPos,
9400                        end: function () { return '+=' + dist; },
9401                        scrub: true,
9402                        pin: triggerEl,
9403                        anticipatePin: 1,
9404                        invalidateOnRefresh: true
9405                    }
9406                });
9407
9408                st = tween.scrollTrigger;
9409            }
9410
9411            make();
9412
9413            ScrollTrigger.addEventListener('refreshInit', function () {
9414                if (!isStickyDisabled()) {
9415                    gsap.set(track, { x: 0 });
9416                }
9417            });
9418
9419            var resizeT = 0;
9420            var lastResizeW = window.innerWidth || document.documentElement.clientWidth;
9421
9422            window.addEventListener('resize', function () {
9423                var currentW = window.innerWidth || document.documentElement.clientWidth;
9424
9425                if (Math.abs(currentW - lastResizeW) < 2) {
9426                    return;
9427                }
9428
9429                lastResizeW = currentW;
9430
9431                if (resizeT) window.clearTimeout(resizeT);
9432
9433                resizeT = window.setTimeout(function () {
9434                    make();
9435                    ScrollTrigger.refresh();
9436                }, 150);
9437            }, false);
9438
9439            setTimeout(function () {
9440                ScrollTrigger.refresh();
9441            }, 500);
9442        }
9443
9444        for (i = 0; i < wrappers.length; i++) {
9445            setupHorizontalPin(wrappers[i]);
9446        }
9447    })();
9448
9449};
9450UNCODE.mouseTrail = (function () {
9451
9452	"use strict";
9453
9454	var __globalDestroy = null;
9455
9456	return function () {
9457
9458		if (typeof __globalDestroy === "function") {
9459			try { __globalDestroy(); } catch (e) {}
9460			__globalDestroy = null;
9461		}
9462
9463		function initImageTrail(options) {
9464
9465			options = options || {};
9466
9467			var area = options.area;
9468			var hoverArea = options.hoverArea;
9469
9470			var images       = options.images || [];
9471			var size         = options.size != null ? options.size : 120;
9472
9473			var minWidth = (options.minWidth != null) ? options.minWidth : null;
9474			var maxWidth = (options.maxWidth != null) ? options.maxWidth : null;
9475
9476			var life         = options.life != null ? options.life : 1.6;
9477			var spawnEvery   = options.spawnEvery != null ? options.spawnEvery : 60;
9478			var touchSpawnEvery = options.touchSpawnEvery != null
9479				? options.touchSpawnEvery
9480				: spawnEvery * 2;
9481			var minDistance  = options.minDistance != null ? options.minDistance : 18;
9482			var rotateRange  = options.rotateRange != null ? options.rotateRange : 10;
9483			var scaleRange   = options.scaleRange || [0.9, 1.05];
9484			var zIndex       = options.zIndex != null ? options.zIndex : 10;
9485			var inOpacity    = options.inOpacity != null ? options.inOpacity : 0;
9486			var midOpacity   = options.midOpacity != null ? options.midOpacity : 1;
9487			var outOpacity   = options.outOpacity != null ? options.outOpacity : 0;
9488			var drift        = options.drift != null ? options.drift : true;
9489
9490			var poolSize     = options.poolSize != null ? options.poolSize : 16;
9491
9492			var inScale      = options.inScale != null ? options.inScale : 0.6;
9493			var outScale     = options.outScale != null ? options.outScale : 0.6;
9494			var inDuration   = options.inDuration != null ? options.inDuration : 0.2;
9495			var outDuration  = options.outDuration != null ? options.outDuration : 0.35;
9496			var inEase       = options.inEase || "power3.out";
9497			var outEase      = options.outEase || "power3.in";
9498
9499			var scrollOn     = options.scrollOn != null ? options.scrollOn : true;
9500
9501			if (!area || !hoverArea) return null;
9502
9503			var areaStyle = window.getComputedStyle(area);
9504			if (areaStyle.position === "static") area.style.position = "relative";
9505
9506			var lastTime = 0;
9507			var lastX = null;
9508			var lastY = null;
9509
9510			var pointerX = null;
9511			var pointerY = null;
9512
9513			var scrollLastTime = 0;
9514			var scrollLastPageY = null;
9515			var scrollSpawnEvery = options.scrollSpawnEvery != null ? options.scrollSpawnEvery : 220;
9516			var scrollMinDistance = options.scrollMinDistance != null ? options.scrollMinDistance : 40;
9517
9518			var touchViewportOn = options.touchViewportOn !== false;
9519			var desktopAutoOn = options.desktopAutoOn === true;
9520
9521			var safeW = options.safeW != null ? options.safeW : 0;
9522			var safeH = options.safeH != null ? options.safeH : 0;
9523			var safeMode = options.safeMode || "avoid";
9524			var particleSafeAreaOn = options.particleSafeAreaOn === true;
9525
9526			var isTouchDevice = (
9527				("ontouchstart" in window) ||
9528				(navigator.maxTouchPoints && navigator.maxTouchPoints > 0) ||
9529				(navigator.msMaxTouchPoints && navigator.msMaxTouchPoints > 0)
9530			) && !window.matchMedia("(pointer: fine)").matches;
9531
9532			var useAutoViewportTrail = isTouchDevice
9533				? touchViewportOn
9534				: desktopAutoOn;
9535
9536			var autoSpawnEvery = isTouchDevice
9537				? touchSpawnEvery
9538				: spawnEvery;
9539
9540			var autoTimer = null;
9541			var autoRunning = false;
9542			var rafWatch = 0;
9543			var watchActive = true;
9544
9545			var i = 0;
9546
9547			for (var p = 0; p < images.length; p++) {
9548				var preload = new Image();
9549				preload.src = images[p];
9550			}
9551
9552			var pool = [];
9553			var poolIndex = 0;
9554
9555			function rectVisible(rect, vh) {
9556				return rect.bottom > 0 && rect.top < vh && rect.height > 0;
9557			}
9558
9559			function buildSafeRect(rect) {
9560				if (!particleSafeAreaOn || !safeW || !safeH) return null;
9561
9562				var w = rect.width * (safeW / 100);
9563				var h = rect.height * (safeH / 100);
9564
9565				if (!w || !h) return null;
9566
9567				return {
9568					left: rect.left + (rect.width - w) / 2,
9569					top: rect.top + (rect.height - h) / 2,
9570					right: rect.left + (rect.width + w) / 2,
9571					bottom: rect.top + (rect.height + h) / 2,
9572					width: w,
9573					height: h
9574				};
9575			}
9576
9577			function pointInSafeRect(x, y, safeRect) {
9578				if (!safeRect) return false;
9579				return (
9580					x >= safeRect.left &&
9581					x <= safeRect.right &&
9582					y >= safeRect.top &&
9583					y <= safeRect.bottom
9584				);
9585			}
9586
9587			function randomPointInRect(rect) {
9588				var safeRect = buildSafeRect(rect);
9589
9590				if (!safeRect) {
9591					return {
9592						x: gsap.utils.random(rect.left + 1, rect.right - 1, 1),
9593						y: gsap.utils.random(rect.top + 1, rect.bottom - 1, 1)
9594					};
9595				}
9596
9597				if (safeMode === "soft") {
9598					var best = null;
9599					var cx = safeRect.left + safeRect.width / 2;
9600					var cy = safeRect.top + safeRect.height / 2;
9601
9602					for (var i = 0; i < 40; i++) {
9603						var x = gsap.utils.random(rect.left + 1, rect.right - 1, 1);
9604						var y = gsap.utils.random(rect.top + 1, rect.bottom - 1, 1);
9605
9606						var dx = x - cx;
9607						var dy = y - cy;
9608						var dist = Math.sqrt(dx * dx + dy * dy);
9609
9610						if (pointInSafeRect(x, y, safeRect)) {
9611							dist -= 99999;
9612						}
9613
9614						if (!best || dist > best.score) {
9615							best = {
9616								x: x,
9617								y: y,
9618								score: dist
9619							};
9620						}
9621					}
9622
9623					return {
9624						x: best.x,
9625						y: best.y
9626					};
9627				}
9628
9629				for (var j = 0; j < 40; j++) {
9630					var px = gsap.utils.random(rect.left + 1, rect.right - 1, 1);
9631					var py = gsap.utils.random(rect.top + 1, rect.bottom - 1, 1);
9632
9633					if (!pointInSafeRect(px, py, safeRect)) {
9634						return {
9635							x: px,
9636							y: py
9637						};
9638					}
9639				}
9640
9641				return {
9642					x: gsap.utils.random(rect.left + 1, rect.right - 1, 1),
9643					y: gsap.utils.random(rect.top + 1, rect.bottom - 1, 1)
9644				};
9645			}
9646
9647			function spawnRandomInViewportArea() {
9648				var rect = hoverArea.getBoundingClientRect();
9649				var vh = window.innerHeight || document.documentElement.clientHeight;
9650
9651				if (!rectVisible(rect, vh)) return;
9652
9653				var p = randomPointInRect(rect);
9654
9655				lastX = null;
9656				lastY = null;
9657
9658				spawn(p.x, p.y);
9659			}
9660
9661			function startAutoViewportTrail() {
9662				if (!useAutoViewportTrail || autoRunning) return;
9663
9664				autoRunning = true;
9665
9666				function loop() {
9667					if (!autoRunning) return;
9668					spawnRandomInViewportArea();
9669					autoTimer = setTimeout(loop, autoSpawnEvery);
9670				}
9671
9672				loop();
9673			}
9674
9675			function stopAutoViewportTrail() {
9676				autoRunning = false;
9677				if (autoTimer) {
9678					clearTimeout(autoTimer);
9679					autoTimer = null;
9680				}
9681			}
9682
9683			function resetPool() {
9684				for (var ii = 0; ii < pool.length; ii++) {
9685					var img = pool[ii];
9686					if (!img) continue;
9687
9688					img.__trailToken = (img.__trailToken || 0) + 1;
9689					gsap.killTweensOf(img);
9690
9691					gsap.set(img, {
9692						x: -9999,
9693						y: -9999,
9694						opacity: 0,
9695						scale: inScale,
9696						rotation: 0
9697					});
9698				}
9699			}
9700
9701			function onVisibilityChange() {
9702				if (document.visibilityState === "hidden") {
9703					stopAutoViewportTrail();
9704					resetPool();
9705					lastX = null;
9706					lastY = null;
9707					scrollLastPageY = null;
9708					pointerX = null;
9709					pointerY = null;
9710					lastTime = 0;
9711					scrollLastTime = 0;
9712					if (rafWatch) {
9713						cancelAnimationFrame(rafWatch);
9714						rafWatch = 0;
9715					}
9716				} else {
9717					resetPool();
9718					if (useAutoViewportTrail) {
9719						watchViewportAutoState();
9720					}
9721				}
9722			}
9723
9724			function watchViewportAutoState() {
9725				if (!watchActive || rafWatch) return;
9726
9727				function tick() {
9728					if (!watchActive) {
9729						rafWatch = 0;
9730						return;
9731					}
9732
9733					if (useAutoViewportTrail) {
9734						var rect = hoverArea.getBoundingClientRect();
9735						var vh = window.innerHeight || document.documentElement.clientHeight;
9736
9737						if (rectVisible(rect, vh)) startAutoViewportTrail();
9738						else stopAutoViewportTrail();
9739					}
9740
9741					rafWatch = requestAnimationFrame(tick);
9742				}
9743
9744				rafWatch = requestAnimationFrame(tick);
9745			}
9746
9747			function endsWith(str, suffix) {
9748				str = String(str);
9749				suffix = String(suffix);
9750				return str.indexOf(suffix, str.length - suffix.length) !== -1;
9751			}
9752
9753			function cssSizeToPx(value, referenceEl) {
9754				if (value == null) return null;
9755				if (typeof value === "number") return value;
9756
9757				value = String(value).trim();
9758
9759				if (endsWith(value, "px")) return parseFloat(value);
9760				if (endsWith(value, "vw")) return window.innerWidth * parseFloat(value) / 100;
9761				if (endsWith(value, "vh")) return window.innerHeight * parseFloat(value) / 100;
9762
9763				if (endsWith(value, "%")) {
9764					var rect = referenceEl.getBoundingClientRect();
9765					return rect.width * parseFloat(value) / 100;
9766				}
9767
9768				if (!isNaN(value)) return parseFloat(value);
9769
9770				return null;
9771			}
9772
9773			function getRandomWidthPx() {
9774
9775				if (minWidth == null && maxWidth == null) return null;
9776
9777				var minPx = cssSizeToPx(minWidth, area);
9778				var maxPx = cssSizeToPx(maxWidth, area);
9779
9780				if (minPx == null && maxPx == null) return null;
9781
9782				if (minPx == null) minPx = maxPx;
9783				if (maxPx == null) maxPx = minPx;
9784
9785				if (maxPx < minPx) {
9786					var t = minPx;
9787					minPx = maxPx;
9788					maxPx = t;
9789				}
9790
9791				return gsap.utils.random(minPx, maxPx, 1);
9792			}
9793
9794			function applySizing(el) {
9795				el.style.minWidth = "";
9796				el.style.maxWidth = "";
9797
9798				if (size !== "auto" && size != null) {
9799					el.style.width = (typeof size === "number") ? (size + "px") : String(size);
9800					el.style.height = "auto";
9801					return;
9802				}
9803
9804				el.style.width = "";
9805				el.style.height = "auto";
9806
9807				if (minWidth != null && minWidth !== "") el.style.minWidth = String(minWidth);
9808				if (maxWidth != null && maxWidth !== "") el.style.maxWidth = String(maxWidth);
9809			}
9810
9811			for (var k = 0; k < poolSize; k++) {
9812				var el = document.createElement("img");
9813				el.className = "trail-img";
9814
9815				applySizing(el);
9816
9817				el.style.zIndex = zIndex;
9818				el.style.position = "absolute";
9819				el.style.left = "0";
9820				el.style.top = "0";
9821				el.style.pointerEvents = "none";
9822				el.style.userSelect = "none";
9823				el.style.willChange = "transform,opacity";
9824
9825				el.__trailToken = 0;
9826
9827				area.appendChild(el);
9828
9829				gsap.set(el, {
9830					x: -9999,
9831					y: -9999,
9832					opacity: 0,
9833					scale: inScale,
9834					rotation: 0,
9835					transformOrigin: "50% 50%"
9836				});
9837
9838				pool.push(el);
9839			}
9840
9841			function whenDecoded(img, cb) {
9842				if (img && img.decode) {
9843					img.decode().then(function () { cb(); }).catch(function () { cb(); });
9844				} else {
9845					cb();
9846				}
9847			}
9848
9849			function spawn(clientX, clientY) {
9850
9851				if (!images.length) return;
9852
9853				var src = images[i % images.length];
9854				i++;
9855
9856				var img = pool[poolIndex % pool.length];
9857				poolIndex++;
9858
9859				if (img.parentNode !== area) area.appendChild(img);
9860
9861				img.__trailToken = (img.__trailToken || 0) + 1;
9862				var token = img.__trailToken;
9863
9864				gsap.killTweensOf(img);
9865
9866				applySizing(img);
9867
9868				if (img.getAttribute("src") !== src) {
9869					img.setAttribute("src", src);
9870				}
9871
9872				var rect = area.getBoundingClientRect();
9873				var localX = clientX - rect.left;
9874				var localY = clientY - rect.top;
9875
9876				var rot = gsap.utils.random(-rotateRange, rotateRange, 0.1);
9877				var scl = gsap.utils.random(scaleRange[0], scaleRange[1], 0.01);
9878
9879				var randomWidth = getRandomWidthPx();
9880				if (randomWidth) {
9881					img.style.width = randomWidth + "px";
9882					img.style.height = "auto";
9883				}
9884
9885				gsap.set(img, {
9886					x: localX,
9887					y: localY,
9888					xPercent: -50,
9889					yPercent: -50,
9890					rotation: rot,
9891					scale: inScale,
9892					opacity: inOpacity,
9893					transformOrigin: "50% 50%"
9894				});
9895
9896				whenDecoded(img, function () {
9897
9898					if (img.__trailToken !== token) return;
9899
9900					var tl = gsap.timeline({
9901						onComplete: function () {
9902							if (img.__trailToken !== token) return;
9903							gsap.set(img, { x: -9999, y: -9999, opacity: 0, scale: inScale, rotation: 0 });
9904						}
9905					});
9906
9907					tl.to(img, {
9908						opacity: midOpacity,
9909						scale: scl,
9910						duration: inDuration,
9911						ease: inEase
9912					}, 0);
9913
9914					if (drift) {
9915						tl.to(img, {
9916							x: "+=" + gsap.utils.random(-12, 12, 1),
9917							y: "+=" + gsap.utils.random(-18, 18, 1),
9918							rotation: rot + gsap.utils.random(-6, 6, 0.1),
9919							duration: life,
9920							ease: inEase
9921						}, 0);
9922					}
9923
9924					tl.to(img, {
9925						opacity: outOpacity,
9926						scale: outScale,
9927						duration: outDuration,
9928						ease: outEase
9929					}, Math.max(0, life - outDuration));
9930
9931				});
9932			}
9933
9934			function onMove(e) {
9935
9936				pointerX = e.clientX;
9937				pointerY = e.clientY;
9938
9939				var now = Date.now();
9940				if (now - lastTime < spawnEvery) return;
9941
9942				var x = e.clientX;
9943				var y = e.clientY;
9944
9945				if (lastX !== null) {
9946					var dx = x - lastX;
9947					var dy = y - lastY;
9948					var dist = Math.sqrt(dx * dx + dy * dy);
9949					if (dist < minDistance) return;
9950				}
9951
9952				lastTime = now;
9953				lastX = x;
9954				lastY = y;
9955
9956				spawn(x, y);
9957			}
9958
9959			function onLeave() {
9960				lastX = null;
9961				lastY = null;
9962				scrollLastPageY = null;
9963			}
9964
9965			function onPointerMove(e) {
9966				pointerX = e.clientX;
9967				pointerY = e.clientY;
9968			}
9969
9970			function pointInRect(x, y, rect) {
9971				return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
9972			}
9973
9974			function onScroll() {
9975
9976				if (pointerX === null || pointerY === null) return;
9977
9978				var now = Date.now();
9979				if (now - scrollLastTime < scrollSpawnEvery) return;
9980
9981				var rect = hoverArea.getBoundingClientRect();
9982				if (!pointInRect(pointerX, pointerY, rect)) return;
9983
9984				var pageY = window.pageYOffset || document.documentElement.scrollTop || 0;
9985
9986				if (scrollLastPageY !== null) {
9987					var scrollDelta = Math.abs(pageY - scrollLastPageY);
9988					if (scrollDelta < scrollMinDistance) return;
9989				}
9990
9991				var x = Math.min(Math.max(pointerX, rect.left + 1), rect.right - 1);
9992				var y = Math.min(Math.max(pointerY, rect.top + 1), rect.bottom - 1);
9993
9994				scrollLastTime = now;
9995				scrollLastPageY = pageY;
9996
9997				spawn(x, y);
9998			}
9999
10000			if (!useAutoViewportTrail) {
10001				hoverArea.addEventListener("mousemove", onMove);
10002				hoverArea.addEventListener("mouseleave", onLeave);
10003
10004				if (scrollOn) {
10005					window.addEventListener("mousemove", onPointerMove, { passive: true });
10006					window.addEventListener("scroll", onScroll, { passive: true });
10007				}
10008			} else {
10009				watchViewportAutoState();
10010			}
10011
10012			document.addEventListener("visibilitychange", onVisibilityChange);
10013
10014			return function () {
10015
10016				document.removeEventListener("visibilitychange", onVisibilityChange);
10017
10018				if (!useAutoViewportTrail) {
10019					hoverArea.removeEventListener("mousemove", onMove);
10020					hoverArea.removeEventListener("mouseleave", onLeave);
10021
10022					if (scrollOn) {
10023						window.removeEventListener("mousemove", onPointerMove);
10024						window.removeEventListener("scroll", onScroll);
10025					}
10026				}
10027
10028				stopAutoViewportTrail();
10029
10030				watchActive = false;
10031				if (rafWatch) {
10032					cancelAnimationFrame(rafWatch);
10033					rafWatch = 0;
10034				}
10035
10036				for (var ii = 0; ii < pool.length; ii++) {
10037					if (pool[ii] && pool[ii].parentNode) {
10038						gsap.killTweensOf(pool[ii]);
10039						pool[ii].parentNode.removeChild(pool[ii]);
10040					}
10041				}
10042				pool.length = 0;
10043			};
10044
10045		}
10046
10047		function getTrailImagesFromArea(area, useParticleImages) {
10048			var node = null;
10049
10050			if (useParticleImages) {
10051				node = area.querySelector(".particle-images");
10052				if (!node) node = area.querySelector(".trail-images");
10053			} else {
10054				node = area.querySelector(".trail-images");
10055				if (!node) node = area.querySelector(".particle-images");
10056			}
10057
10058			if (!node) return [];
10059
10060			var json = node.textContent || node.innerText || "[]";
10061			try {
10062				return JSON.parse(json);
10063			} catch (e) {
10064				return [];
10065			}
10066		}
10067
10068		function closestPolyfill(el, selector) {
10069			while (el && el.nodeType === 1) {
10070				if (matchesSelector(el, selector)) return el;
10071				el = el.parentNode;
10072			}
10073			return null;
10074		}
10075
10076		function matchesSelector(el, selector) {
10077			var p = Element.prototype;
10078			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
10079			if (!fn) return false;
10080			return fn.call(el, selector);
10081		}
10082
10083		function getDataFromArea(area, key, fallback) {
10084			if (!area || !key) return fallback;
10085
10086			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
10087			var raw = area.getAttribute(attr);
10088			if (raw == null) return fallback;
10089
10090			raw = String(raw).trim();
10091
10092			if (raw === "true") return true;
10093			if (raw === "false") return false;
10094			if (raw === "null") return null;
10095
10096			var num = raw.replace(",", ".");
10097			if (num !== "" && isFinite(num)) return parseFloat(num);
10098
10099			if (
10100				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
10101				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
10102			) {
10103				try { return JSON.parse(raw); } catch (e) {}
10104			}
10105
10106			return raw;
10107		}
10108
10109		var destroyers = [];
10110
10111		var areas = document.querySelectorAll(".uncode-bg-trail");
10112		for (var n = 0; n < areas.length; n++) {
10113
10114			var renderArea = areas[n];
10115
10116			if (renderArea.__trailDestroy && typeof renderArea.__trailDestroy === "function") {
10117				try { renderArea.__trailDestroy(); } catch (e) {}
10118				renderArea.__trailDestroy = null;
10119			}
10120
10121			var hoverArea = renderArea.closest
10122				? renderArea.closest('.vc_row[data-parent="true"]')
10123				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
10124
10125			if (!hoverArea) continue;
10126
10127			var isTouchDevice = (
10128				("ontouchstart" in window) ||
10129				(navigator.maxTouchPoints && navigator.maxTouchPoints > 0) ||
10130				(navigator.msMaxTouchPoints && navigator.msMaxTouchPoints > 0)
10131			) && !window.matchMedia("(pointer: fine)").matches;
10132
10133			var desktopAutoOn = String(getDataFromArea(renderArea, "desktop-auto", "no")) === "yes";
10134			var mobileAutoOn = String(getDataFromArea(renderArea, "mobile-no-auto", "no")) !== "yes";
10135
10136			var useParticleImages = isTouchDevice ? mobileAutoOn : desktopAutoOn;
10137
10138			var images = getTrailImagesFromArea(renderArea, useParticleImages);
10139
10140			renderArea.__trailDestroy = initImageTrail({
10141				area: renderArea,
10142				hoverArea: hoverArea,
10143				images: images,
10144				size: "auto",
10145
10146				minWidth: getDataFromArea(renderArea, "min-width", null),
10147				maxWidth: getDataFromArea(renderArea, "max-width", null),
10148
10149				life: (getDataFromArea(renderArea, "life", 1) +
10150					getDataFromArea(renderArea, "in-duration", 0.25) +
10151					getDataFromArea(renderArea, "out-duration", 0.3)),
10152
10153				spawnEvery: getDataFromArea(renderArea, "interval", 100),
10154				minDistance: getDataFromArea(renderArea, "distance", 150),
10155				scrollSpawnEvery: Math.max(180, getDataFromArea(renderArea, "interval", 100) * 2),
10156				scrollMinDistance: 30,
10157
10158				poolSize: getDataFromArea(renderArea, "count", 16),
10159
10160				inScale: 0,
10161				outScale: 0,
10162				inDuration: getDataFromArea(renderArea, "in-duration", 0.25),
10163				outDuration: getDataFromArea(renderArea, "out-duration", 0.3),
10164
10165				rotateRange: getDataFromArea(renderArea, "rotate", 10),
10166
10167				inOpacity: 0,
10168				midOpacity: 1,
10169				outOpacity: 0,
10170				drift: getDataFromArea(renderArea, "drift", false),
10171				scrollOn: getDataFromArea(renderArea, "scroll", false),
10172
10173				touchViewportOn: String(getDataFromArea(renderArea, "mobile-no-auto", "no")) !== "yes",
10174				touchSpawnEvery: getDataFromArea(renderArea, "mobile-interval", 1750),
10175				desktopAutoOn: String(getDataFromArea(renderArea, "desktop-auto", "no")) === "yes",
10176
10177				particleSafeAreaOn: useParticleImages,
10178				safeW: getDataFromArea(renderArea, "safe-w", 0),
10179				safeH: getDataFromArea(renderArea, "safe-h", 0),
10180				safeMode: String(getDataFromArea(renderArea, "safe-mode", "avoid")),
10181
10182				inEase: "power3.out",
10183				outEase: "power3.in"
10184			}) || null;
10185
10186			if (renderArea.__trailDestroy) {
10187				destroyers.push(renderArea.__trailDestroy);
10188			}
10189		}
10190
10191		__globalDestroy = function () {
10192			for (var i = 0; i < destroyers.length; i++) {
10193				try { destroyers[i](); } catch (e) {}
10194			}
10195			destroyers.length = 0;
10196		};
10197
10198	};
10199
10200})();
10201UNCODE.magneticPattern = (function () {
10202
10203	"use strict";
10204
10205	var __globalDestroy = null;
10206
10207	return function () {
10208
10209		if (typeof __globalDestroy === "function") {
10210			try { __globalDestroy(); } catch (e) {}
10211			__globalDestroy = null;
10212		}
10213
10214		function getMagneticImagesFromArea(area) {
10215			var node = area.querySelector(".magnetic-images");
10216			if (!node) return [];
10217			var json = node.textContent || node.innerText || "[]";
10218			try { return JSON.parse(json); } catch (e) { return []; }
10219		}
10220
10221		function closestPolyfill(el, selector) {
10222			while (el && el.nodeType === 1) {
10223				if (matchesSelector(el, selector)) return el;
10224				el = el.parentNode;
10225			}
10226			return null;
10227		}
10228
10229		function matchesSelector(el, selector) {
10230			var p = Element.prototype;
10231			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
10232			if (!fn) return false;
10233			return fn.call(el, selector);
10234		}
10235
10236		function clamp01(v) {
10237			if (v < 0) return 0;
10238			if (v > 1) return 1;
10239			return v;
10240		}
10241
10242		function toNumber(value, fallback) {
10243			if (value == null) return fallback;
10244			var s = String(value).trim();
10245			if (!s) return fallback;
10246			s = s.replace(",", ".");
10247			var m = s.match(/-?\d+(\.\d+)?/);
10248			if (!m) return fallback;
10249			var n = parseFloat(m[0]);
10250			return isFinite(n) ? n : fallback;
10251		}
10252
10253		function getDataFromArea(area, key, fallback) {
10254			if (!area || !key) return fallback;
10255
10256			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
10257			var raw = area.getAttribute(attr);
10258			if (raw == null) return fallback;
10259
10260			raw = String(raw).trim();
10261
10262			if (raw === "true") return true;
10263			if (raw === "false") return false;
10264			if (raw === "null") return null;
10265
10266			var num = raw.replace(",", ".");
10267			if (num !== "" && isFinite(num)) return parseFloat(num);
10268
10269			if (
10270				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
10271				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
10272			) {
10273				try { return JSON.parse(raw); } catch (e) {}
10274			}
10275
10276			return raw;
10277		}
10278
10279		function dedupeImages(list) {
10280			var uniq = [];
10281			var seen = {};
10282			for (var i = 0; i < list.length; i++) {
10283				var src = list[i];
10284				if (src == null) continue;
10285				src = String(src);
10286				if (!seen[src]) {
10287					seen[src] = true;
10288					uniq.push(src);
10289				}
10290			}
10291			return uniq;
10292		}
10293
10294		function rectsOverlap(a, b) {
10295			return !(
10296				a.x + a.w <= b.x ||
10297				b.x + b.w <= a.x ||
10298				a.y + a.h <= b.y ||
10299				b.y + b.h <= a.y
10300			);
10301		}
10302
10303		function initMagneticPattern(options) {
10304
10305			options = options || {};
10306
10307			var renderArea = options.area;
10308			var hoverArea  = options.hoverArea;
10309			var images     = options.images || [];
10310
10311			if (!renderArea || !hoverArea || !images.length) return null;
10312
10313			var count      = (options.count != null) ? options.count : 12;
10314			var padding    = (options.padding != null) ? options.padding : 24;
10315			var jitter     = (options.jitter != null) ? options.jitter : 0.35;
10316
10317			var rawMoveX   = (options.moveX != null) ? options.moveX : 200;
10318			var rawMoveY   = (options.moveY != null) ? options.moveY : 150;
10319			var rawSpillX  = (options.spillX != null) ? options.spillX : 0;
10320			var rawSpillY  = (options.spillY != null) ? options.spillY : 0;
10321
10322			var moveX      = cssLengthToPx(rawMoveX, hoverArea, 200);
10323			var moveY      = cssLengthToPx(rawMoveY, hoverArea, 150);
10324			var spillX     = cssLengthToPx(rawSpillX, renderArea, 0);
10325			var spillY     = cssLengthToPx(rawSpillY, renderArea, 0);
10326
10327			var easeDur    = (options.easeDur != null) ? options.easeDur : 0.6;
10328			var easeLeave  = (options.easeLeave != null) ? options.easeLeave : 1.2;
10329			var ease       = options.ease || "power3.out";
10330
10331			var opacityMin = (options.opacityMin != null) ? options.opacityMin : 0.25;
10332			var opacityMax = (options.opacityMax != null) ? options.opacityMax : 0.9;
10333
10334			var enableBlur = options.enableBlur === true;
10335			var blurMin    = (options.blurMin != null) ? options.blurMin : 0;
10336			var blurMax    = (options.blurMax != null) ? options.blurMax : 6;
10337
10338			var scaleMin   = (options.scaleMin != null) ? options.scaleMin : 0.6;
10339			var scaleMax   = (options.scaleMax != null) ? options.scaleMax : 1;
10340
10341			var depthMin   = (options.depthMin != null) ? options.depthMin : 0.3;
10342			var depthMax   = (options.depthMax != null) ? options.depthMax : 1;
10343
10344			var unique     = options.unique === true;
10345
10346			var zIndexBase     = (options.zIndexBase != null) ? options.zIndexBase : 1;
10347			var zIndexRange    = (options.zIndexRange != null) ? options.zIndexRange : 30;
10348			var enableRotation = options.enableRotation !== false;
10349			var rotationRange  = (options.rotationRange != null) ? options.rotationRange : 8;
10350
10351			var noOverlap = options.noOverlap === true;
10352			var attempts  = (options.attempts != null) ? options.attempts : 120;
10353			var gap       = (options.gap != null) ? options.gap : 8;
10354
10355			var baseWidth = (options.baseWidth != null) ? options.baseWidth : 300;
10356
10357			var depthEnabled = options.flatDepth !== true;
10358
10359			var enableScrollMotion = options.scrollMotion !== false;
10360
10361			var safeW = (options.safeW != null) ? options.safeW : 0;
10362			var safeH = (options.safeH != null) ? options.safeH : 0;
10363			var safeMode = options.safeMode || "avoid";
10364
10365			var items = [];
10366
10367			function cssLengthToPx(value, el, fallback) {
10368				if (value == null) return fallback;
10369
10370				if (typeof value === "number") return isFinite(value) ? value : fallback;
10371
10372				var s = String(value).trim();
10373				if (!s) return fallback;
10374
10375				var n = parseFloat(s.replace(",", "."));
10376				if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
10377
10378				var probe = document.createElement("div");
10379				probe.style.position = "absolute";
10380				probe.style.visibility = "hidden";
10381				probe.style.pointerEvents = "none";
10382				probe.style.width = s;
10383				probe.style.height = "0";
10384
10385				var parent = (el && el.parentNode) ? el.parentNode : document.body;
10386				parent.appendChild(probe);
10387
10388				var px = probe.getBoundingClientRect().width;
10389				parent.removeChild(probe);
10390
10391				return (px && isFinite(px)) ? px : fallback;
10392			}
10393
10394			if (window.getComputedStyle(renderArea).position === "static") {
10395				renderArea.style.position = "relative";
10396			}
10397
10398			function lerp(a, b, t) {
10399				return a + (b - a) * t;
10400			}
10401
10402			function clearAll() {
10403				var nodes = renderArea.querySelectorAll(".pattern-img");
10404				for (var i = nodes.length - 1; i >= 0; i--) {
10405					if (nodes[i] && nodes[i].parentNode) nodes[i].parentNode.removeChild(nodes[i]);
10406				}
10407				items.length = 0;
10408			}
10409
10410			function buildSafeRect(virtualW, virtualH, originX, originY) {
10411				if (!safeW || !safeH) return null;
10412
10413				var szW = (safeW / 100) * virtualW;
10414				var szH = (safeH / 100) * virtualH;
10415
10416				if (!szW || !szH) return null;
10417
10418				return {
10419					x: originX + (virtualW - szW) / 2,
10420					y: originY + (virtualH - szH) / 2,
10421					w: szW,
10422					h: szH
10423				};
10424			}
10425
10426			var rafWatch = 0;
10427			var lastTop = null;
10428			var lastHeight = null;
10429			var watchActive = true;
10430
10431			function watchPosition() {
10432				if (!watchActive) return;
10433
10434				var rect = hoverArea.getBoundingClientRect();
10435				var top = Math.round(rect.top);
10436				var height = Math.round(rect.height);
10437
10438				var movedEnough =
10439					lastTop === null ||
10440					Math.abs(top - lastTop) > 1 ||
10441					Math.abs(height - lastHeight) > 1;
10442
10443				if (movedEnough) {
10444					lastTop = top;
10445					lastHeight = height;
10446					onScroll();
10447				}
10448
10449				rafWatch = requestAnimationFrame(watchPosition);
10450			}
10451			
10452			function buildLayout() {
10453
10454				clearAll();
10455
10456				var rect = renderArea.getBoundingClientRect();
10457
10458				var width  = rect.width  + spillX * 2;
10459				var height = rect.height + spillY * 2;
10460
10461				var originX = -spillX;
10462				var originY = -spillY;
10463
10464				var safeRect = buildSafeRect(width, height, originX, originY);
10465
10466				var imgs = unique ? dedupeImages(images) : images;
10467				var effectiveCount = unique ? Math.min(count, imgs.length) : count;
10468
10469				var cols = Math.ceil(Math.sqrt(effectiveCount));
10470				var rows = Math.ceil(effectiveCount / cols);
10471
10472				var cellW = (width  - padding * 2) / cols;
10473				var cellH = (height - padding * 2) / rows;
10474
10475				var frag = document.createDocumentFragment();
10476				var placed = [];
10477
10478				for (var i = 0; i < effectiveCount; i++) {
10479
10480					var src = imgs[i % imgs.length];
10481
10482					var el = document.createElement("img");
10483					el.className = "pattern-img";
10484					el.src = src;
10485
10486					el.style.position = "absolute";
10487					el.style.left = "0";
10488					el.style.top = "0";
10489					el.style.pointerEvents = "none";
10490					el.style.userSelect = "none";
10491					el.style.willChange = "transform,opacity,filter";
10492
10493					el.style.width = baseWidth + "px";
10494					el.style.height = "auto";
10495
10496					var col = i % cols;
10497					var row = Math.floor(i / cols);
10498
10499					var baseCellX = originX + padding + col * cellW;
10500					var baseCellY = originY + padding + row * cellH;
10501
10502					var baseX = baseCellX + cellW / 2 + (Math.random() - 0.5) * cellW * jitter;
10503					var baseY = baseCellY + cellH / 2 + (Math.random() - 0.5) * cellH * jitter;
10504
10505					var placedOk = true;
10506
10507					function isBadCandidate(x, y) {
10508						var cand = { x: x, y: y, w: baseWidth + gap, h: baseWidth + gap };
10509
10510						if (safeRect && rectsOverlap(cand, safeRect)) {
10511							if (safeMode === "avoid") return true;
10512						}
10513
10514						if (noOverlap) {
10515							for (var p = 0; p < placed.length; p++) {
10516								if (rectsOverlap(cand, placed[p])) return true;
10517							}
10518						}
10519
10520						return false;
10521					}
10522
10523					if (safeRect && safeMode === "soft") {
10524						var best = { x: baseX, y: baseY, score: -999999 };
10525						var softTries = Math.max(20, Math.min(120, attempts));
10526
10527						for (var st = 0; st < softTries; st++) {
10528							var rxS = baseCellX + (Math.random() * cellW);
10529							var ryS = baseCellY + (Math.random() * cellH);
10530
10531							var candS = { x: rxS, y: ryS, w: baseWidth + gap, h: baseWidth + gap };
10532
10533							var score = 0;
10534
10535							if (noOverlap) {
10536								for (var pp = 0; pp < placed.length; pp++) {
10537									if (rectsOverlap(candS, placed[pp])) { score -= 1000; break; }
10538								}
10539							}
10540
10541							if (rectsOverlap(candS, safeRect)) score -= 500;
10542
10543							var sx = safeRect.x + safeRect.w / 2;
10544							var sy = safeRect.y + safeRect.h / 2;
10545							var dxs = (rxS - sx);
10546							var dys = (ryS - sy);
10547							score += Math.sqrt(dxs * dxs + dys * dys);
10548
10549							if (score > best.score) best = { x: rxS, y: ryS, score: score };
10550						}
10551
10552						baseX = best.x;
10553						baseY = best.y;
10554
10555						if (noOverlap) {
10556							if (isBadCandidate(baseX, baseY)) {
10557								placedOk = false;
10558							}
10559						}
10560
10561					} else {
10562						if (noOverlap || safeRect) {
10563							placedOk = false;
10564
10565							for (var a = 0; a < attempts; a++) {
10566								var rx = baseCellX + (Math.random() * cellW);
10567								var ry = baseCellY + (Math.random() * cellH);
10568
10569								if (safeRect && safeMode === "avoid") {
10570									var cx = rx + (baseWidth / 2);
10571									var cy = ry + (baseWidth / 2);
10572									if (cx >= safeRect.x && cx <= safeRect.x + safeRect.w &&
10573										cy >= safeRect.y && cy <= safeRect.y + safeRect.h) {
10574										continue;
10575									}
10576								}
10577
10578								var cand = { x: rx, y: ry, w: baseWidth + gap, h: baseWidth + gap };
10579
10580								var collides = false;
10581								if (noOverlap) {
10582									for (var p = 0; p < placed.length; p++) {
10583										if (rectsOverlap(cand, placed[p])) { collides = true; break; }
10584									}
10585								}
10586
10587								if (!collides) {
10588									baseX = rx;
10589									baseY = ry;
10590									placed.push(cand);
10591									placedOk = true;
10592									break;
10593								}
10594							}
10595
10596							if (!placedOk) continue;
10597						}
10598					}
10599
10600					if (noOverlap && placedOk) {
10601						placed.push({ x: baseX, y: baseY, w: baseWidth + gap, h: baseWidth + gap });
10602					}
10603
10604					var rnd = Math.random();
10605					var tDepth = depthEnabled ? rnd : 0;
10606
10607					var tScale = depthEnabled ? (1 - tDepth) : Math.random();
10608					tScale = clamp01(tScale);
10609
10610					var scale = lerp(scaleMin, scaleMax, tScale);
10611
10612					var moveFactor = depthEnabled ? lerp(1, 0.25, tDepth) : 1;
10613
10614					var opacity = depthEnabled
10615						? lerp(opacityMax, opacityMin, tDepth)
10616						: lerp(opacityMin, opacityMax, Math.random());
10617
10618					var blur = 0;
10619					if (enableBlur) {
10620						blur = depthEnabled
10621							? lerp(blurMin, blurMax, tDepth)
10622							: lerp(blurMin, blurMax, Math.random());
10623					}
10624
10625					var tZ = depthEnabled
10626						? (1 - tDepth)
10627						: ((scaleMax === scaleMin) ? 1 : (scale - scaleMin) / (scaleMax - scaleMin));
10628					tZ = clamp01(tZ);
10629
10630					el.style.zIndex = zIndexBase + Math.round(zIndexRange * tZ);
10631
10632					var rot = 0;
10633					if (enableRotation) {
10634						rot = gsap.utils.random(-rotationRange, rotationRange, 0.1);
10635					}
10636
10637					gsap.set(el, {
10638						x: baseX,
10639						y: baseY,
10640						scale: scale,
10641						rotation: rot,
10642						opacity: opacity,
10643						filter: enableBlur ? "blur(" + blur.toFixed(2) + "px)" : "none"
10644					});
10645
10646					items.push({
10647						el: el,
10648						baseX: baseX,
10649						baseY: baseY,
10650						moveFactor: moveFactor
10651					});
10652
10653					frag.appendChild(el);
10654				}
10655
10656				renderArea.appendChild(frag);
10657			}
10658
10659			buildLayout();
10660
10661			function onMove(e) {
10662
10663				var rect = hoverArea.getBoundingClientRect();
10664				if (!rect.width || !rect.height) return;
10665
10666				var nx = (e.clientX - rect.left - rect.width / 2) / (rect.width / 2);
10667				var ny = (e.clientY - rect.top  - rect.height / 2) / (rect.height / 2);
10668
10669				for (var i = 0; i < items.length; i++) {
10670					var it = items[i];
10671
10672					var dx = -nx * moveX * it.moveFactor;
10673					var dy = -ny * moveY * it.moveFactor;
10674
10675					gsap.to(it.el, {
10676						x: it.baseX + dx,
10677						y: it.baseY + dy,
10678						duration: easeDur,
10679						ease: ease,
10680						overwrite: true
10681					});
10682				}
10683			}
10684
10685			function onScroll() {
10686
10687				if (!enableScrollMotion) return;
10688
10689				var rect = hoverArea.getBoundingClientRect();
10690				var vh = window.innerHeight || document.documentElement.clientHeight;
10691
10692				if (!rect.height) return;
10693
10694				// completamente fuori
10695				if (rect.bottom <= 0 || rect.top >= vh) {
10696					for (var k = 0; k < items.length; k++) {
10697						var it0 = items[k];
10698						gsap.to(it0.el, {
10699							x: it0.baseX,
10700							y: it0.baseY,
10701							duration: easeLeave,
10702							ease: ease,
10703							overwrite: true
10704						});
10705					}
10706					return;
10707				}
10708
10709				var travel = vh + rect.height;
10710				var progress = (vh - rect.top) / travel;
10711
10712				if (progress < 0) progress = 0;
10713				if (progress > 1) progress = 1;
10714
10715				var ny = progress * 2 - 1;
10716				var nx = ny * 0.35;
10717
10718				for (var i = 0; i < items.length; i++) {
10719					var it = items[i];
10720
10721					var dx = -nx * moveX * 0.35 * it.moveFactor;
10722					var dy = -ny * moveY * 0.35 * it.moveFactor;
10723
10724					gsap.to(it.el, {
10725						x: it.baseX + dx,
10726						y: it.baseY + dy,
10727						duration: easeDur,
10728						ease: ease,
10729						overwrite: true
10730					});
10731				}
10732			}
10733
10734			function onLeave() {
10735				for (var i = 0; i < items.length; i++) {
10736					var it = items[i];
10737					gsap.to(it.el, {
10738						x: it.baseX,
10739						y: it.baseY,
10740						duration: easeLeave,
10741						ease: ease,
10742						overwrite: true
10743					});
10744				}
10745			}
10746
10747			var sizeObserver = null;
10748			var lastLayoutW = 0;
10749			var lastLayoutH = 0;
10750
10751			function updateLayoutSizeCache() {
10752				var r = renderArea.getBoundingClientRect();
10753				lastLayoutW = Math.round(r.width);
10754				lastLayoutH = Math.round(r.height);
10755			}
10756
10757			function shouldRebuildLayout() {
10758				var r = renderArea.getBoundingClientRect();
10759				var newW = Math.round(r.width);
10760				var newH = Math.round(r.height);
10761
10762				var dw = Math.abs(newW - lastLayoutW);
10763				var dh = Math.abs(newH - lastLayoutH);
10764
10765				// rebuild sempre se cambia la larghezza
10766				// sull'altezza, tollera micro-variazioni tipiche del browser mobile durante lo scroll
10767				var mustRebuild = dw > 1 || dh > 80;
10768
10769				if (mustRebuild) {
10770					lastLayoutW = newW;
10771					lastLayoutH = newH;
10772				}
10773
10774				return mustRebuild;
10775			}
10776
10777			updateLayoutSizeCache();
10778
10779			if ("ResizeObserver" in window) {
10780				sizeObserver = new ResizeObserver(function () {
10781					if (shouldRebuildLayout()) {
10782						buildLayout();
10783					}
10784					onScroll();
10785				});
10786				sizeObserver.observe(renderArea);
10787			}
10788
10789			hoverArea.addEventListener("mousemove", onMove);
10790			hoverArea.addEventListener("mouseleave", onLeave);
10791
10792			function onWindowResize() {
10793				if (shouldRebuildLayout()) {
10794					buildLayout();
10795				}
10796				onScroll();
10797			}
10798
10799			window.addEventListener("resize", onWindowResize);
10800			window.addEventListener("scroll", onScroll, { passive: true });
10801			onScroll();
10802			watchPosition();
10803
10804			return function () {
10805				hoverArea.removeEventListener("mousemove", onMove);
10806				hoverArea.removeEventListener("mouseleave", onLeave);
10807				window.removeEventListener("resize", onWindowResize);
10808				window.removeEventListener("scroll", onScroll);
10809
10810				if (sizeObserver) {
10811					sizeObserver.disconnect();
10812					sizeObserver = null;
10813				}
10814
10815				watchActive = false;
10816				if (rafWatch) {
10817					cancelAnimationFrame(rafWatch);
10818					rafWatch = 0;
10819				}
10820				
10821				clearAll();
10822			};
10823
10824		}
10825
10826		var destroyers = [];
10827
10828		var areas = document.querySelectorAll(".uncode-bg-magnetic");
10829		for (var n = 0; n < areas.length; n++) {
10830			var renderArea = areas[n];
10831
10832			if (renderArea.__magneticDestroy && typeof renderArea.__magneticDestroy === "function") {
10833				try { renderArea.__magneticDestroy(); } catch (e) {}
10834				renderArea.__magneticDestroy = null;
10835			}
10836
10837			var hoverArea = renderArea.closest
10838				? renderArea.closest('.vc_row[data-parent="true"]')
10839				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
10840
10841			if (!hoverArea) continue;
10842
10843			var images = getMagneticImagesFromArea(renderArea);
10844			if (!images.length) continue;
10845
10846			function cssLengthToPx(value, el, fallback) {
10847				if (value == null) return fallback;
10848
10849				if (typeof value === "number") return isFinite(value) ? value : fallback;
10850
10851				var s = String(value).trim();
10852				if (!s) return fallback;
10853
10854				var n = parseFloat(s.replace(",", "."));
10855				if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
10856
10857				var probe = document.createElement("div");
10858				probe.style.position = "absolute";
10859				probe.style.visibility = "hidden";
10860				probe.style.pointerEvents = "none";
10861				probe.style.width = s;
10862				probe.style.height = "0";
10863
10864				var parent = (el && el.parentNode) ? el.parentNode : document.body;
10865				parent.appendChild(probe);
10866
10867				var px = probe.getBoundingClientRect().width;
10868				parent.removeChild(probe);
10869
10870				return (px && isFinite(px)) ? px : fallback;
10871			}
10872
10873			var rawMin = getDataFromArea(renderArea, "min-width", "100px");
10874			var rawMax = getDataFromArea(renderArea, "max-width", "300px");
10875
10876			var minW = cssLengthToPx(rawMin, renderArea, 100);
10877			var maxW = cssLengthToPx(rawMax, renderArea, 300);
10878			if (maxW < minW) { var tmp = minW; minW = maxW; maxW = tmp; }
10879
10880			var scaleMin = (maxW > 0) ? (minW / maxW) : 1;
10881
10882			var rawMoveX = getDataFromArea(renderArea, "move-x", "400px");
10883			var rawMoveY = getDataFromArea(renderArea, "move-y", "300px");
10884			var rawSpillX = getDataFromArea(renderArea, "spill-x", null);
10885			var rawSpillY = getDataFromArea(renderArea, "spill-y", null);
10886
10887			if (rawSpillX == null || rawSpillX === "") {
10888				if (typeof rawMoveX === "number") rawSpillX = rawMoveX / 2;
10889				else rawSpillX = "calc((" + rawMoveX + ") / 2)";
10890			}
10891
10892			if (rawSpillY == null || rawSpillY === "") {
10893				if (typeof rawMoveY === "number") rawSpillY = rawMoveY / 2;
10894				else rawSpillY = "calc((" + rawMoveY + ") / 2)";
10895			}
10896
10897			renderArea.__magneticDestroy = initMagneticPattern({
10898				area: renderArea,
10899				hoverArea: hoverArea,
10900				images: images,
10901
10902				count: toNumber(getDataFromArea(renderArea, "count", 16), 16),
10903
10904				padding: 27,
10905				jitter: 0.35,
10906
10907				moveX: rawMoveX,
10908				moveY: rawMoveY,
10909				spillX: rawSpillX,
10910				spillY: rawSpillY,
10911
10912				easeDur: 0.7,
10913				easeLeave: 1.7,
10914				ease: "power3.out",
10915
10916				opacityMin: toNumber(getDataFromArea(renderArea, "min-opacity", 0.25), 0.25),
10917				opacityMax: toNumber(getDataFromArea(renderArea, "max-opacity", 1), 1),
10918
10919				zIndexBase: 1,
10920				zIndexRange: 30,
10921
10922				enableRotation: false,
10923				rotationRange: 8,
10924
10925				enableBlur: String(getDataFromArea(renderArea, "blur", "no")) === "yes",
10926				blurMin: 0,
10927				blurMax: 1.5,
10928
10929				baseWidth: maxW,
10930				scaleMin: scaleMin,
10931				scaleMax: 1,
10932
10933				flatDepth: String(getDataFromArea(renderArea, "depth", "no")) !== "yes",
10934
10935				noOverlap: String(getDataFromArea(renderArea, "no-overlap", "no")) === "yes",
10936				attempts: toNumber(getDataFromArea(renderArea, "attempts", 120), 120),
10937				gap: toNumber(getDataFromArea(renderArea, "gap", 8), 8),
10938
10939				depthMin: 0.25,
10940				depthMax: 1.0,
10941
10942				unique: String(getDataFromArea(renderArea, "unique", "no")) === "yes",
10943
10944				safeW: toNumber(getDataFromArea(renderArea, "safe-w", 0), 0),
10945				safeH: toNumber(getDataFromArea(renderArea, "safe-h", 0), 0),
10946				safeMode: String(getDataFromArea(renderArea, "safe-mode", "avoid")),
10947
10948				scrollMotion: String(getDataFromArea(renderArea, "stop-scroll", "no")) !== "yes",
10949			}) || null;
10950
10951			if (renderArea.__magneticDestroy) {
10952				destroyers.push(renderArea.__magneticDestroy);
10953			}
10954		}
10955
10956		__globalDestroy = function () {
10957			for (var i = 0; i < destroyers.length; i++) {
10958				try { destroyers[i](); } catch (e) {}
10959			}
10960			destroyers.length = 0;
10961		};
10962
10963	};
10964
10965})();
10966UNCODE.thumbDrop = (function () {
10967
10968	"use strict";
10969
10970	var __globalDestroy = null;
10971
10972	return function () {
10973
10974		if (!window.Matter) return;
10975
10976		if (typeof __globalDestroy === "function") {
10977			try { __globalDestroy(); } catch (e) {}
10978			__globalDestroy = null;
10979		}
10980
10981		var Engine = Matter.Engine;
10982		var World  = Matter.World;
10983		var Bodies = Matter.Bodies;
10984		var Body   = Matter.Body;
10985		var Mouse  = Matter.Mouse;
10986		var MouseConstraint = Matter.MouseConstraint;
10987
10988		function getDropImagesFromArea(area) {
10989			var node = area.querySelector("script.drop-images");
10990			if (!node) return [];
10991			var json = node.textContent || node.innerText || "[]";
10992			try { return JSON.parse(json); } catch (e) { return []; }
10993		}
10994
10995		function matchesSelector(el, selector) {
10996			var p = Element.prototype;
10997			var fn = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector;
10998			if (!fn) return false;
10999			return fn.call(el, selector);
11000		}
11001
11002		function closestPolyfill(el, selector) {
11003			while (el && el.nodeType === 1) {
11004				if (matchesSelector(el, selector)) return el;
11005				el = el.parentNode;
11006			}
11007			return null;
11008		}
11009
11010		function debounce(fn, wait) {
11011			var t = null;
11012			return function () {
11013				var ctx = this;
11014				var args = arguments;
11015				clearTimeout(t);
11016				t = setTimeout(function () { fn.apply(ctx, args); }, wait);
11017			};
11018		}
11019
11020		function clamp(v, a, b) {
11021			return v < a ? a : (v > b ? b : v);
11022		}
11023
11024		function toNumber(value, fallback) {
11025			if (value == null) return fallback;
11026			var s = String(value).trim();
11027			if (!s) return fallback;
11028			s = s.replace(",", ".");
11029			var m = s.match(/-?\d+(\.\d+)?/);
11030			if (!m) return fallback;
11031			var n = parseFloat(m[0]);
11032			return isFinite(n) ? n : fallback;
11033		}
11034
11035		function cssLengthToPx(value, el, fallback) {
11036			if (value == null) return fallback;
11037
11038			if (typeof value === "number") return isFinite(value) ? value : fallback;
11039
11040			var s = String(value).trim();
11041			if (!s) return fallback;
11042
11043			var n = parseFloat(s.replace(",", "."));
11044			if (isFinite(n) && String(n) === s.replace(",", ".")) return n;
11045
11046			var probe = document.createElement("div");
11047			probe.style.position = "absolute";
11048			probe.style.visibility = "hidden";
11049			probe.style.pointerEvents = "none";
11050			probe.style.width = "0";
11051			probe.style.height = "0";
11052
11053			var parent = (el && el.parentNode) ? el.parentNode : document.body;
11054			parent.appendChild(probe);
11055
11056			probe.style.width = s;
11057			var px = probe.getBoundingClientRect().width;
11058
11059			parent.removeChild(probe);
11060
11061			if (!px || !isFinite(px)) return fallback;
11062			return px;
11063		}
11064
11065		function getDataFromArea(area, key, fallback) {
11066			if (!area || !key) return fallback;
11067
11068			var attr = key.indexOf("data-") === 0 ? key : "data-" + key;
11069			var raw = area.getAttribute(attr);
11070			if (raw == null) return fallback;
11071
11072			raw = String(raw).trim();
11073
11074			if (raw === "true") return true;
11075			if (raw === "false") return false;
11076			if (raw === "null") return null;
11077
11078			var num = raw.replace(",", ".");
11079			if (num !== "" && isFinite(num)) return parseFloat(num);
11080
11081			if (
11082				(raw.charAt(0) === "{" && raw.charAt(raw.length - 1) === "}") ||
11083				(raw.charAt(0) === "[" && raw.charAt(raw.length - 1) === "]")
11084			) {
11085				try { return JSON.parse(raw); } catch (e) {}
11086			}
11087
11088			return raw;
11089		}
11090
11091		function raf2(cb) {
11092			requestAnimationFrame(function () {
11093				requestAnimationFrame(function () {
11094					cb();
11095				});
11096			});
11097		}
11098
11099		function normalizeDragMode(v) {
11100			if (v == null) return "";
11101			if (v === true) return "drag";
11102			var s = String(v).trim().toLowerCase();
11103			if (!s) return "";
11104			if (s === "1" || s === "yes" || s === "true") return "drag";
11105			if (s === "drag" || s === "hover") return s;
11106			return "";
11107		}
11108
11109		function initMatterDrop(options) {
11110			options = options || {};
11111
11112			var area    = options.area;
11113			var surface = options.surface;
11114			var images  = options.images || [];
11115
11116			var maxAvailable = images.length;
11117			var duplicateImages = options.duplicateImages !== false;
11118			var count = options.count != null ? options.count : Math.min(18, maxAvailable);
11119
11120			if (!duplicateImages && count > maxAvailable) {
11121				count = maxAvailable;
11122			}
11123
11124			var sizeMin    = options.sizeMin != null ? options.sizeMin : 140;
11125			var sizeMax    = options.sizeMax != null ? options.sizeMax : 260;
11126			var spawnEvery = options.spawnEvery != null ? options.spawnEvery : 160;
11127			var startDelay = options.startDelay != null ? options.startDelay : 0;
11128
11129			var gravityY    = options.gravityY != null ? options.gravityY : 1.25;
11130			var restitution = options.restitution != null ? options.restitution : 0.35;
11131			var frictionAir = options.frictionAir != null ? options.frictionAir : 0.02;
11132			var friction    = options.friction != null ? options.friction : 0.25;
11133			var density     = options.density != null ? options.density : 0.001;
11134
11135			var wallThickness = options.wallThickness != null ? options.wallThickness : 80;
11136			var floorPadding  = options.floorPadding != null ? options.floorPadding : 0;
11137
11138			var rotateRange = options.rotateRange != null ? options.rotateRange : 18;
11139
11140			var once       = options.once !== false;
11141			var threshold  = options.threshold != null ? options.threshold : 0.25;
11142			var rootMargin = options.rootMargin || "0px 0px -10% 0px";
11143
11144			var dragMode = normalizeDragMode(options.enableDrag);
11145			var enableDrag = dragMode === "drag";
11146			var enableHoverRepel = dragMode === "hover";
11147
11148			var dragStiffness = options.dragStiffness != null ? options.dragStiffness : 0.18;
11149			var dragDamping   = options.dragDamping != null ? options.dragDamping : 0.06;
11150
11151			var hoverRadius = options.hoverRadius != null ? options.hoverRadius : 260;
11152			var spawnXMode = String(options.spawnXMode || "random").toLowerCase();
11153			var spawnXFixed = options.spawnXFixed != null ? options.spawnXFixed : 50;
11154			var spawnXJitter = options.spawnXJitter != null ? options.spawnXJitter : 0;	
11155
11156			if (!area || !surface || !images.length) return null;
11157
11158			var cs = window.getComputedStyle(area);
11159			if (cs.position === "static") area.style.position = "absolute";
11160			if (!area.style.left) area.style.left = "0";
11161			if (!area.style.top) area.style.top = "0";
11162			if (!area.style.width) area.style.width = "100%";
11163			if (!area.style.height) area.style.height = "100%";
11164
11165			area.style.pointerEvents = enableDrag ? "auto" : "none";
11166
11167			var engine = Engine.create();
11168			engine.enableSleeping = false;
11169			engine.gravity.y = gravityY;
11170
11171			var alive = true;
11172			var started = false;
11173
11174			var bounds = { w: 0, h: 0 };
11175			var walls = null;
11176			var items = [];
11177
11178			var spawnTimer = null;
11179			var spawned = 0;
11180
11181			var ro = null;
11182			var pollTimer = null;
11183			var lastW = 0;
11184			var lastH = 0;
11185
11186			var mouseConstraint = null;
11187
11188			var rafId = 0;
11189			var io = null;
11190			var scrollHandler = null;
11191			var dragMousemoveHandler = null;
11192
11193			var hoverMoveHandler = null;
11194			var hoverLeaveHandler = null;
11195			var hoverX = null;
11196			var hoverY = null;
11197			var hoverActive = false;
11198
11199			function updateRects() {
11200				bounds.w = area.offsetWidth;
11201				bounds.h = area.offsetHeight;
11202			}
11203
11204			function removeWalls() {
11205				if (!walls) return;
11206				World.remove(engine.world, walls.floor);
11207				World.remove(engine.world, walls.left);
11208				World.remove(engine.world, walls.right);
11209				walls = null;
11210			}
11211
11212			function createWalls() {
11213				updateRects();
11214
11215				var w = bounds.w;
11216				var h = bounds.h;
11217				if (!w || !h) return false;
11218
11219				var t = wallThickness;
11220				var floorY = h + t * 0.5 + floorPadding;
11221
11222				var floor = Bodies.rectangle(w * 0.5, floorY, w + t * 2, t, { isStatic: true, restitution: 0, friction: 1 });
11223				var left  = Bodies.rectangle(-t * 0.5, h * 0.5, t, h + t * 2, { isStatic: true, restitution: 0, friction: 1 });
11224				var right = Bodies.rectangle(w + t * 0.5, h * 0.5, t, h + t * 2, { isStatic: true, restitution: 0, friction: 1 });
11225
11226				walls = { floor: floor, left: left, right: right };
11227				World.add(engine.world, [floor, left, right]);
11228
11229				return true;
11230			}
11231
11232			function setTransform(el, x, y, a) {
11233				el.style.transform = "translate3d(" + x + "px," + y + "px,0) rotate(" + a + "deg)";
11234			}
11235
11236			function preloadAll(list) {
11237				for (var i = 0; i < list.length; i++) {
11238					var im = new Image();
11239					im.src = list[i];
11240				}
11241			}
11242
11243			function recalcSpawnSizes() {
11244				if (!options.rawMin && !options.rawMax) return;
11245
11246				var newMin = cssLengthToPx(options.rawMin, area, sizeMin);
11247				var newMax = cssLengthToPx(options.rawMax, area, sizeMax);
11248
11249				if (newMax < newMin) { var t = newMin; newMin = newMax; newMax = t; }
11250
11251				sizeMin = newMin;
11252				sizeMax = newMax;
11253			}
11254
11255			function setupDrag() {
11256				if (!enableDrag || !Mouse || !MouseConstraint) return;
11257
11258				var mouse = Mouse.create(area);
11259				mouse.pixelRatio = 1;
11260
11261				mouseConstraint = MouseConstraint.create(engine, {
11262					mouse: mouse,
11263					constraint: {
11264						stiffness: dragStiffness,
11265						damping: dragDamping,
11266						render: { visible: false }
11267					}
11268				});
11269
11270				World.add(engine.world, mouseConstraint);
11271
11272				dragMousemoveHandler = function () {
11273					mouse.offset.x = 0;
11274					mouse.offset.y = 0;
11275				};
11276				area.addEventListener("mousemove", dragMousemoveHandler);
11277
11278				area.style.userSelect = "none";
11279				area.style.webkitUserSelect = "none";
11280			}
11281
11282			function setupHoverRepel() {
11283				if (!enableHoverRepel) return;
11284
11285				area.style.pointerEvents = "auto";
11286
11287				hoverMoveHandler = function (e) {
11288					var r = area.getBoundingClientRect();
11289					hoverX = e.clientX - r.left;
11290					hoverY = e.clientY - r.top;
11291
11292					hoverActive = true;
11293				};
11294
11295				hoverLeaveHandler = function () {
11296					hoverActive = false;
11297					hoverX = null;
11298					hoverY = null;
11299				};
11300
11301				area.addEventListener("mousemove", hoverMoveHandler);
11302				area.addEventListener("mouseleave", hoverLeaveHandler);
11303			}
11304
11305			function getSpawnX(w) {
11306				var minX = w * 0.5;
11307				var maxX = Math.max(minX, bounds.w - w * 0.5);
11308
11309				if (spawnXMode === "fixed") {
11310					var pct = clamp(spawnXFixed, 0, 100) / 100;
11311					var baseX = minX + (maxX - minX) * pct;
11312
11313					if (spawnXJitter > 0) {
11314						var jitterPx = (bounds.w * spawnXJitter / 100) * (Math.random() - 0.5);
11315						baseX += jitterPx;
11316					}
11317
11318					return clamp(baseX, minX, maxX);
11319				}
11320
11321				if (spawnXMode === "sequence") {
11322					var total = Math.max(1, count);
11323
11324					if (total === 1) {
11325						return (minX + maxX) * 0.5;
11326					}
11327
11328					var progress = duplicateImages
11329						? ((spawned % total) / (total - 1))
11330						: (spawned / Math.max(1, total - 1));
11331
11332					return minX + (maxX - minX) * progress;
11333				}
11334
11335				return minX + Math.random() * Math.max(0, maxX - minX);
11336			}
11337
11338			function spawnOne() {
11339				if (!alive) return;
11340				if (spawned >= count) return;
11341
11342				updateRects();
11343				if (!bounds.w || !bounds.h) return;
11344
11345				if (!duplicateImages && spawned >= images.length) return;
11346
11347				var src = duplicateImages
11348					? images[spawned % images.length]
11349					: images[spawned];
11350
11351				var w = Math.round(Matter.Common.random(sizeMin, sizeMax));
11352				var x = getSpawnX(w);
11353
11354				var img = new Image();
11355				img.onload = function () {
11356					if (!alive) return;
11357
11358					var css = getComputedStyle(area);
11359					var ratioVar = (css.getPropertyValue("--bgm-ratio") || "").trim();
11360					var ratio = null;
11361
11362					if (ratioVar) {
11363						var parts = ratioVar.split("/");
11364						if (parts.length === 2) {
11365							var rw = parseFloat(parts[0]);
11366							var rh = parseFloat(parts[1]);
11367							if (rw > 0 && rh > 0) ratio = rh / rw;
11368						}
11369					}
11370
11371					var r = ratio;
11372					if (!r) {
11373						if (img.naturalWidth && img.naturalHeight) r = img.naturalHeight / img.naturalWidth;
11374						else r = 1;
11375					}
11376
11377					var h = Math.max(20, Math.round(w * r));
11378
11379					var startY = -(h + 300);
11380
11381					var el = document.createElement("img");
11382					el.className = "drop-img";
11383					el.setAttribute("src", src);
11384					el.style.width = w + "px";
11385					el.style.height = h + "px";
11386					el.style.position = "absolute";
11387					el.style.left = "0";
11388					el.style.top = "0";
11389					el.style.willChange = "transform";
11390					el.style.pointerEvents = "none";
11391					el.style.userSelect = "none";
11392
11393					el.style.opacity = "0";
11394
11395					setTransform(el, x - w * 0.5, startY - h * 0.5, 0);
11396
11397					area.appendChild(el);
11398
11399					var body = Bodies.rectangle(x, startY, w, h, {
11400						restitution: restitution,
11401						frictionAir: frictionAir,
11402						friction: friction,
11403						density: density
11404					});
11405
11406					Body.setVelocity(body, {
11407						x: (Math.random() - 0.5) * 4,
11408						y: Math.random() * 2
11409					});
11410
11411					World.add(engine.world, body);
11412					items.push({ el: el, body: body, w: w, h: h });
11413
11414					requestAnimationFrame(function () {
11415						el.style.opacity = "1";
11416					});
11417
11418					setTransform(el, body.position.x - w * 0.5, body.position.y - h * 0.5, body.angle * 180 / Math.PI);
11419				};
11420				img.onerror = function () {};
11421				img.src = src;
11422
11423				spawned++;
11424			}
11425
11426			function applyHoverRepel() {
11427
11428				if (!enableHoverRepel) return;
11429				if (!hoverActive || hoverX == null || hoverY == null) return;
11430
11431				var radius = hoverRadius;
11432				var r2 = radius * radius;
11433
11434				for (var i = 0; i < items.length; i++) {
11435
11436					var b = items[i].body;
11437
11438					var dx = b.position.x - hoverX;
11439					var dy = b.position.y - hoverY;
11440
11441					var d2 = dx * dx + dy * dy;
11442					if (d2 > r2 || d2 < 0.001) continue;
11443
11444					var d = Math.sqrt(d2);
11445
11446					var nx = dx / d;
11447					var ny = dy / d;
11448
11449					var strength = (1 - d / radius) * 25;
11450
11451					Body.setVelocity(b, {
11452						x: b.velocity.x + nx * strength,
11453						y: b.velocity.y + ny * strength - strength * 0.6
11454					});
11455
11456					for (var j = 0; j < items.length; j++) {
11457
11458						if (i === j) continue;
11459
11460						var nb = items[j].body;
11461
11462						var ddx = nb.position.x - b.position.x;
11463						var ddy = nb.position.y - b.position.y;
11464
11465						var dist = Math.sqrt(ddx * ddx + ddy * ddy);
11466
11467						if (dist < 120 && dist > 0.001) {
11468
11469							var nnx = ddx / dist;
11470							var nny = ddy / dist;
11471
11472							Body.setVelocity(nb, {
11473								x: nb.velocity.x + nnx * 2,
11474								y: nb.velocity.y + nny * 2
11475							});
11476
11477						}
11478					}
11479				}
11480			}
11481
11482			function tick() {
11483				if (!alive) return;
11484
11485				applyHoverRepel();
11486
11487				if (mouseConstraint && mouseConstraint.body) {
11488					var dragged = mouseConstraint.body;
11489
11490					for (var di = 0; di < items.length; di++) {
11491						if (items[di].body === dragged) {
11492							var halfW = items[di].w * 0.5;
11493							var halfH = items[di].h * 0.5;
11494
11495							var clampedX = clamp(dragged.position.x, halfW + 2, bounds.w - halfW - 2);
11496							var clampedY = clamp(dragged.position.y, halfH + 2, bounds.h - halfH - 2);
11497
11498							if (clampedX !== dragged.position.x || clampedY !== dragged.position.y) {
11499								Body.setPosition(dragged, { x: clampedX, y: clampedY });
11500								Body.setVelocity(dragged, { x: 0, y: 0 });
11501							}
11502							break;
11503						}
11504					}
11505				}
11506	
11507				Engine.update(engine, 1000 / 60);
11508
11509				var sideLimit = Math.max(120, wallThickness * 1.5);
11510				var bottomLimit = bounds.h + Math.max(160, wallThickness * 1.5);
11511
11512				for (var i = 0; i < items.length; i++) {
11513					var it0 = items[i];
11514					var b0 = it0.body;
11515
11516					var halfW = it0.w * 0.5;
11517					var halfH = it0.h * 0.5;
11518
11519					var minX = halfW + 2;
11520					var maxX = bounds.w - halfW - 2;
11521					var rescueY = Math.max(halfH + 2, 20);
11522					var floorY = bounds.h - halfH - 2;
11523
11524					var outLeft = b0.position.x < -sideLimit;
11525					var outRight = b0.position.x > bounds.w + sideLimit;
11526					var outBottom = b0.position.y > bottomLimit;
11527
11528					if (outLeft || outRight || outBottom) {
11529						var safeX = clamp(b0.position.x, minX, maxX);
11530						var safeY = clamp(b0.position.y, rescueY, floorY);
11531
11532						if (outBottom) safeY = floorY;
11533
11534						Body.setPosition(b0, { x: safeX, y: safeY });
11535						Body.setVelocity(b0, { x: 0, y: 0 });
11536						Body.setAngularVelocity(b0, 0);
11537					}
11538				}
11539
11540				for (var j = 0; j < items.length; j++) {
11541					var it = items[j];
11542					var b = it.body;
11543					setTransform(it.el, b.position.x - it.w * 0.5, b.position.y - it.h * 0.5, b.angle * 180 / Math.PI);
11544				}
11545
11546				rafId = requestAnimationFrame(tick);
11547			}
11548
11549			function resetToNewSize() {
11550				if (!started) return;
11551
11552				removeWalls();
11553				if (!createWalls()) return;
11554
11555				updateRects();
11556
11557				var w = bounds.w;
11558				var h = bounds.h;
11559
11560				for (var i = 0; i < items.length; i++) {
11561					var it = items[i];
11562					var bw = it.w;
11563					var bh = it.h;
11564
11565					var px = clamp(it.body.position.x, bw * 0.5 + 2, w - bw * 0.5 - 2);
11566					var py = clamp(it.body.position.y, -2000, h - bh * 0.5 - 2);
11567					Body.setPosition(it.body, { x: px, y: py });
11568				}
11569			}
11570
11571			function startSizeObserver() {
11572				updateRects();
11573				lastW = bounds.w;
11574				lastH = bounds.h;
11575
11576				if ("ResizeObserver" in window) {
11577					ro = new ResizeObserver(function () {
11578						raf2(function () {
11579							updateRects();
11580							if (bounds.w !== lastW || bounds.h !== lastH) {
11581								lastW = bounds.w;
11582								lastH = bounds.h;
11583								resetToNewSize();
11584							}
11585						});
11586					});
11587					ro.observe(area);
11588					return;
11589				}
11590
11591				pollTimer = setInterval(function () {
11592					updateRects();
11593					if (bounds.w !== lastW || bounds.h !== lastH) {
11594						lastW = bounds.w;
11595						lastH = bounds.h;
11596						resetToNewSize();
11597					}
11598				}, 200);
11599			}
11600
11601			function stopSizeObserver() {
11602				if (ro) { ro.disconnect(); ro = null; }
11603				if (pollTimer) { clearInterval(pollTimer); pollTimer = null; }
11604			}
11605
11606			function startSpawning() {
11607				if (!alive) return;
11608				if (started) return;
11609
11610				var tries = 0;
11611				var stable = 0;
11612				var prevW = 0;
11613				var prevH = 0;
11614
11615				function check() {
11616					if (!alive) return;
11617
11618					updateRects();
11619
11620					if (!bounds.w || !bounds.h) {
11621						tries++;
11622						if (tries < 40) setTimeout(check, 150);
11623						return;
11624					}
11625
11626					if (bounds.w === prevW && bounds.h === prevH) stable++;
11627					else {
11628						stable = 0;
11629						prevW = bounds.w;
11630						prevH = bounds.h;
11631					}
11632
11633					if (stable < 2) {
11634						setTimeout(check, 150);
11635						return;
11636					}
11637
11638					started = true;
11639
11640					removeWalls();
11641					if (!createWalls()) {
11642						started = false;
11643						setTimeout(check, 200);
11644						return;
11645					}
11646
11647					setupDrag();
11648					setupHoverRepel();
11649					tick();
11650
11651					var start = function () {
11652						spawnOne();
11653						spawnTimer = setInterval(function () {
11654							if (!alive) return;
11655							if (spawned >= count) {
11656								clearInterval(spawnTimer);
11657								spawnTimer = null;
11658								return;
11659							}
11660							spawnOne();
11661						}, spawnEvery);
11662					};
11663
11664					if (startDelay > 0) setTimeout(start, startDelay);
11665					else start();
11666				}
11667
11668				check();
11669			}
11670
11671			function setupViewportTrigger() {
11672				if ("IntersectionObserver" in window) {
11673					io = new IntersectionObserver(function (entries) {
11674						for (var i = 0; i < entries.length; i++) {
11675							if (entries[i].isIntersecting) {
11676								startSpawning();
11677								if (once && io) { io.disconnect(); io = null; }
11678								break;
11679							}
11680						}
11681					}, { root: null, rootMargin: rootMargin, threshold: threshold });
11682
11683					io.observe(surface);
11684					return;
11685				}
11686
11687				scrollHandler = debounce(function () {
11688					var r = surface.getBoundingClientRect();
11689					var vh = window.innerHeight || document.documentElement.clientHeight;
11690					if (r.top < vh * 0.9 && r.bottom > vh * 0.1) {
11691						startSpawning();
11692						if (once && scrollHandler) {
11693							window.removeEventListener("scroll", scrollHandler);
11694							scrollHandler = null;
11695						}
11696					}
11697				}, 100);
11698
11699				window.addEventListener("scroll", scrollHandler);
11700				scrollHandler();
11701			}
11702
11703			recalcSpawnSizes();
11704			preloadAll(images);
11705			startSizeObserver();
11706			setupViewportTrigger();
11707
11708			return function destroy() {
11709				alive = false;
11710
11711				if (rafId) { cancelAnimationFrame(rafId); rafId = 0; }
11712
11713				stopSizeObserver();
11714
11715				if (io) { try { io.disconnect(); } catch (e) {} io = null; }
11716
11717				if (scrollHandler) {
11718					window.removeEventListener("scroll", scrollHandler);
11719					scrollHandler = null;
11720				}
11721
11722				if (spawnTimer) { clearInterval(spawnTimer); spawnTimer = null; }
11723
11724				if (dragMousemoveHandler) {
11725					area.removeEventListener("mousemove", dragMousemoveHandler);
11726					dragMousemoveHandler = null;
11727				}
11728
11729				if (hoverMoveHandler) {
11730					area.removeEventListener("mousemove", hoverMoveHandler);
11731					hoverMoveHandler = null;
11732				}
11733				if (hoverLeaveHandler) {
11734					area.removeEventListener("mouseleave", hoverLeaveHandler);
11735					hoverLeaveHandler = null;
11736				}
11737
11738				removeWalls();
11739
11740				if (mouseConstraint) {
11741					World.remove(engine.world, mouseConstraint);
11742					mouseConstraint = null;
11743				}
11744
11745				for (var i = 0; i < items.length; i++) {
11746					try { World.remove(engine.world, items[i].body); } catch (e) {}
11747					if (items[i].el && items[i].el.parentNode) items[i].el.parentNode.removeChild(items[i].el);
11748				}
11749				items.length = 0;
11750
11751				var nodes = area.querySelectorAll(".drop-img");
11752				for (var n = nodes.length - 1; n >= 0; n--) {
11753					if (nodes[n] && nodes[n].parentNode) nodes[n].parentNode.removeChild(nodes[n]);
11754				}
11755			};
11756		}
11757
11758		var destroyers = [];
11759
11760		var areas = document.querySelectorAll(".uncode-bg-drop");
11761		for (var n = 0; n < areas.length; n++) {
11762
11763			var renderArea = areas[n];
11764
11765			if (renderArea.__thumbDropDestroy && typeof renderArea.__thumbDropDestroy === "function") {
11766				try { renderArea.__thumbDropDestroy(); } catch (e) {}
11767				renderArea.__thumbDropDestroy = null;
11768			}
11769
11770			var surface = renderArea.closest
11771				? renderArea.closest('.vc_row[data-parent="true"]')
11772				: closestPolyfill(renderArea, '.vc_row[data-parent="true"]');
11773
11774			if (!surface) continue;
11775
11776			var images = getDropImagesFromArea(renderArea);
11777			if (!images.length) continue;
11778
11779			var rawMin = getDataFromArea(renderArea, "min-width", "140px");
11780			var rawMax = getDataFromArea(renderArea, "max-width", "260px");
11781
11782			var minW = cssLengthToPx(rawMin, renderArea, 140);
11783			var maxW = cssLengthToPx(rawMax, renderArea, 260);
11784			if (maxW < minW) { var tmp = minW; minW = maxW; maxW = tmp; }
11785
11786			renderArea.__thumbDropDestroy = initMatterDrop({
11787				area: renderArea,
11788				surface: surface,
11789				images: images,
11790
11791				rawMin: rawMin,
11792				rawMax: rawMax,
11793
11794				count: toNumber(getDataFromArea(renderArea, "count", 14), 14),
11795				duplicateImages: String(getDataFromArea(renderArea, "unique", "no")) !== "yes",
11796				sizeMin: minW,
11797				sizeMax: maxW,
11798
11799				spawnEvery: toNumber(getDataFromArea(renderArea, "interval", 160), 160),
11800				startDelay: toNumber(getDataFromArea(renderArea, "delay", 0), 0
11800),
11801
11802				gravityY: toNumber(getDataFromArea(renderArea, "gravity", 1.25), 1.25),
11803				restitution: toNumber(getDataFromArea(renderArea, "restitution", 0.35), 0.35),
11804				frictionAir: toNumber(getDataFromArea(renderArea, "friction-air", 0.02), 0.02),
11805				friction: toNumber(getDataFromArea(renderArea, "friction", 0.25), 0.25),
11806				density: toNumber(getDataFromArea(renderArea, "density", 0.001), 0.001),
11807
11808				wallThickness: toNumber(getDataFromArea(renderArea, "wall", 80), 80),
11809				floorPadding: toNumber(getDataFromArea(renderArea, "floor", 0), 0),
11810
11811				rotateRange: toNumber(getDataFromArea(renderArea, "rotate", 18), 18),
11812
11813				once: String(getDataFromArea(renderArea, "once", "yes")) !== "no",
11814				threshold: toNumber(getDataFromArea(renderArea, "threshold", 0.25), 0.25),
11815				rootMargin: String(getDataFromArea(renderArea, "root-margin", "0px 0px -10% 0px")),
11816
11817				enableDrag: String(getDataFromArea(renderArea, "interactive", "")),
11818
11819				dragStiffness: toNumber(getDataFromArea(renderArea, "drag-stiffness", 0.18), 0.18),
11820				dragDamping: toNumber(getDataFromArea(renderArea, "drag-damping", 0.06), 0.06),
11821
11822				hoverRadius: toNumber(getDataFromArea(renderArea, "hover-radius", 50), 50),
11823
11824				spawnXMode: String(getDataFromArea(renderArea, "spawn-x-mode", "random")),
11825				spawnXFixed: toNumber(getDataFromArea(renderArea, "spawn-x-fixed", 50), 50),
11826				spawnXMode: String(getDataFromArea(renderArea, "spawn-x-mode", "random")),
11827				spawnXFixed: toNumber(getDataFromArea(renderArea, "spawn-x-fixed", 50), 50),
11828				spawnXJitter: toNumber(getDataFromArea(renderArea, "spawn-x-jitter", 13), 13),
11829
11830			}) || null;
11831
11832			if (renderArea.__thumbDropDestroy) {
11833				destroyers.push(renderArea.__thumbDropDestroy);
11834			}
11835		}
11836
11837		__globalDestroy = function () {
11838			for (var i = 0; i < destroyers.length; i++) {
11839				try { destroyers[i](); } catch (e) {}
11840			}
11841			destroyers.length = 0;
11842		};
11843
11844	};
11845
11846})();
11847UNCODE.preventDoubleTransition = function() {
11848	$('.sticky-element .animate_when_almost_visible').each(function(){
11849		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
11850			$el.addClass('do_not_reanimate');
11851		});
11852	});
11853};
11854
11855UNCODE.checkScrollForTabs = function(){
11856	var goToSection = window.location.hash.replace('#', ''),
11857		$index;
11858
11859	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
11860	goToSection = encodeURIComponent(goToSection);
11861	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
11862
11863	$index.attr('data-parent', 'parent-' + goToSection);
11864
11865	if (window.location.hash != undefined && window.location.hash != '') {
11866		requestTimeout(function() {
11867			scrollBody('parent-' + goToSection);
11868		}, 500);
11869	}
11870
11871	$('.page-body a[href^="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
11872		var hash = (e.currentTarget).hash;
11873		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
11874			$('a[href="' + hash + '"][data-tab-history]').click();
11875			scrollBody(hash);
11876		}
11877	});
11878
11879	var scrollBody = function(index) {
11880
11881		var getSection = $('a[href="' + index + '"][data-tab-history]'),
11882			scrollTo,
11883			safeGap = 27;
11884
11885		if ( ! getSection.length ) {
11886			getSection = $('div[data-parent="' + index + '"]');
11887
11888			if ( getSection.attr('data-target') == 'row' ) {
11889				getSection = getSection.closest('.vc_row');
11890				safeGap = 0;
11891			}
11892		}
11893
11894		if (typeof getSection === 'undefined' || ! getSection.length ) {
11895			return;
11896		}
11897
11898		var body = $("html, body"),
11899		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
11900		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
11901		getOffset = UNCODE.get_scroll_offset();
11902		if ( typeof getSection.offset() === 'undefined' )
11903			return;
11904		scrollTo = getSection.offset().top - safeGap;
11905		scrollTo -= getOffset;
11906
11907		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
11908		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
11909
11910		if (index != 0) {
11911			UNCODE.scrolling = true;
11912		}
11913
11914		if (scrollSpeed == 0) {
11915			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
11916			UNCODE.scrolling = false;
11917		} else {
11918			body.animate({
11919				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
11920			}, scrollSpeed, 'easeInOutQuad', function() {
11921				requestTimeout(function() {
11922					UNCODE.scrolling = false;
11923					if (getOffset != UNCODE.get_scroll_offset()) {
11924						scrollBody(index);
11925					}
11926				}, 100);
11927			});
11928		}
11929
11930	};
11931};
11932
11933UNCODE.printScreen = function() {
11934	var inlineMediaStyle = null,
11935		setResize;
11936
11937    function changeMediaStyle() {
11938		clearRequestTimeout(setResize);
11939		setResize = requestTimeout(function(){
11940	        var $head = document.getElementsByTagName('head')[0],
11941	        	$newStyle = document.createElement('style'),
11942	        	winW = window.innerWidth,
11943	        	printH = window.innerHeight;
11944
11945	        $newStyle.setAttribute('type', 'text/css');
11946	        $newStyle.setAttribute('media', 'print');
11947	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
11948
11949	        if (inlineMediaStyle != null) {
11950	            $head.replaceChild($newStyle, inlineMediaStyle)
11951	        } else {
11952	            $head.appendChild($newStyle);
11953	        }
11954	        inlineMediaStyle = $newStyle;
11955	    }, 1000);
11956    }
11957
11958    changeMediaStyle();
11959    window.addEventListener('resize', changeMediaStyle);
11960};
11961
11962UNCODE.fullPage = function() {
11963	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
11964		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
11965		return false;
11966	} else {
11967		requestTimeout(function() {
11968			window.scrollTo(0, 0);
11969		}, 10);
11970	}
11971
11972	var $masthead = $('#masthead'),
11973		$logo = $('#logo-container-mobile'),
11974		$logolink = $('[data-minheight]', $logo),
11975		logoMinScale = $logolink.data('minheight'),
11976		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
11977		$container = $('.main-container .post-content'),
11978		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
11979		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
11980		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
11981		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
11982		headerWithOpacity = $('.header-scroll-opacity', $header).length,
11983		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
11984		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
11985		scrollBar = true,
11986		effect,
11987		animationEndTimeOut,
11988		fp_anim_time = 900,
11989		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
11990		is_scrolling = false,
11991		dataNames = [],
11992		is_first = true,
11993		no_history = $('body').hasClass('uncode-scroll-no-history'),
11994		theres_footer = true;
11995
11996	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
11997		$('> div', $footer).each(function(index, el){
11998			if ( $(el).outerHeight() < 2 )
11999				theres_footer = false;
12000			else
12001				theres_footer = true;
12002		});
12003	}
12004
12005	if ( !$footer.length )
12006		theres_footer = false;
12007
12008	if ( !UNCODE.isFullPageSnap ) {
12009
12010		if ( $('body').hasClass('uncode-fullpage-zoom') )
12011			effect = 'scaleDown';
12012		else if ( $('body').hasClass('uncode-fullpage-parallax') )
12013			effect = 'moveparallax';
12014		else
12015			effect = 'movecurtain';
12016	}
12017
12018	if ( $('body').hasClass('uncode-fullpage-trid') )
12019		fp_anim_time = fp_anim_time*2;
12020
12021	if ( $header.length ) {
12022		if ( headerName !== '' )
12023			$header.attr('data-name', headerName);
12024		if ( headerLabel !== '' )
12025			$header.attr('data-label', headerLabel);
12026		$container.prepend($header);
12027	}
12028	if ( theres_footer ) {
12029		$container.append($footer);
12030		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
12031		$('aside.widget ul', $footer).addClass('no-list');
12032	}
12033
12034	var $all = $rows.add($header);
12035
12036	if ( theres_footer )
12037		$all = $all.add($footer);
12038
12039	$all.each(function(index, row) {
12040		if( index === 0 )
12041			$(row).addClass('uncode-scroll-active');
12042	});
12043
12044    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
12045
12046	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
12047		$("<ul class='onepage-pagination'></ul>").prependTo("body");
12048	}
12049
12050	$all.each(function(index, val) {
12051		var getName = $(val).data('name'),
12052			label;
12053
12054		if (typeof getName == 'undefined' || getName == 'undefined')
12055			getName = SiteParameters.slide_name + '-' + index;
12056
12057		//if ( dataNames.includes(getName) ) {
12058		if ( dataNames.indexOf(getName) > 0 ) {
12059			getName += '_' + index;
12060			$(val).data('name', getName);
12061		}
12062
12063		dataNames.push(getName);
12064
12065		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
12066
12067		if (typeof $(val).attr('data-label') !== 'undefined')
12068			label = $(val).attr('data-label');
12069		else label = '';
12070
12071		if ( $(val).is($footer) )
12072			return;
12073
12074		if (label != '' ) {
12075			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
12076			$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + label + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
12077		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
12078			$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + SiteParameters.uncode_one_dot_label + " " + index + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span></a></li>");
12079		}
12080	});
12081
12082	var checkVisible = function( el, off ) {
12083		if (typeof jQuery === "function" && el instanceof jQuery) {
12084			el = el[0];
12085		}
12086
12087		off = typeof off=='undefined' ? 50 : off;
12088
12089		var rect = el.getBoundingClientRect();
12090
12091		return (
12092			(
12093				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
12094				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
12095				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
12096			)
12097		);
12098	};
12099
12100	var animationEndAction = function( index, nextIndex ) {
12101		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
12102			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12103			player, iframe;
12104
12105		if ( !$nextSlide.is($footer) ) {
12106			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
12107		}
12108
12109		if ( !UNCODE.isFullPageSnap ) {
12110			activateKBurns( nextIndex );
12111		}
12112
12113		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
12114			if ($(this).attr('data-provider') == 'vimeo') {
12115				iframe = $(this).find('iframe');
12116				player = new Vimeo.Player(iframe[0]);
12117				player.pause();
12118			} else if ($(this).attr('data-provider') == 'youtube') {
12119				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
12120			} else {
12121				if ($(this).is('video')) {
12122					$(this)[0].volume = 0;
12123					$(this)[0].pause();
12124				}
12125			}
12126		});
12127
12128		if ( ! UNCODE.isMobile && headerWithOpacity ) {
12129			if ( $nextSlide.is($header) )
12130				$header.removeClass('header-scrolled');
12131		}
12132
12133		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
12134		$otherEl.each(function(){
12135			var $otherThis = $(this),
12136				$bgwrapperOther = $('.background-inner', $otherThis);
12137			if ( !checkVisible($otherThis) )
12138				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
12139
12140		});
12141
12142		if ( !checkVisible($currentSlide) ) {
12143			$currentSlide.removeClass('uncode-scroll-visible');
12144			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
12145			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
12146				currentScroll.scrollTo(0, 0, 0);
12147		}
12148
12149		clearRequestTimeout(animationEndTimeOut);
12150		animationEndTimeOut = requestTimeout(function(){
12151			Waypoint.refreshAll();
12152			$( document.body ).trigger('uncode_waypoints');
12153			var eventFP = new CustomEvent('fp-slide-changed');
12154			window.dispatchEvent(eventFP);
12155			is_scrolling = false;
12156
12157			if ( is_first ) {
12158				$('ul.onepage-pagination a').removeClass('is-selected');
12159				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
12160				is_first = false;
12161			}
12162
12163		}, 500);
12164	};
12165
12166	var postLeaveActions = function( nextIndex ){
12167		if ( menuHidden && ! UNCODE.isMobile )
12168			return false;
12169
12170		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12171			$cols = $('.uncol', $el),
12172			anchor = $el.data('anchor');
12173
12174		if ( ! UNCODE.isFullPageSnap ) {
12175			$.each($cols, function(index, val){
12176				if ( $(val).hasClass('style-light') ){
12177					$masthead.removeClass('style-dark-override').addClass('style-light-override');
12178					return false;
12179				} else if ( $(val).hasClass('style-dark') ) {
12180					$masthead.removeClass('style-light-override').addClass('style-dark-override');
12181					return false;
12182				}
12183			});
12184		}
12185
12186		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
12187			$('.menu-item' ).removeClass('active');
12188			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
12189		}
12190
12191		if ( !UNCODE.isFullPageSnap ) {
12192			activateBackWash( nextIndex );
12193		}
12194	};
12195
12196	var activateBackWash = function( nextIndex ){
12197		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12198			$bgwrapper;
12199
12200		if ( $el.length ) {
12201			if ( $el.hasClass('with-zoomout') ) {
12202				$bgwrapper = $('.background-inner:nth-child(1)', $el);
12203			} else if ( $('.with-zoomout', $el).length ) {
12204				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
12205			} else {
12206				return false;
12207			}
12208		} else {
12209			return false;
12210		}
12211
12212		$bgwrapper.addClass('uncode-zoomout');
12213
12214	};
12215
12216	var activateKBurns = function( nextIndex ){
12217		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12218			$bgwrapper;
12219
12220		if ( $el.length ) {
12221			if ( $el.hasClass('with-kburns') ) {
12222				$bgwrapper = $('.background-inner:nth-child(1)', $el);
12223			} else if ( $('.with-kburns', $el).length ) {
12224				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
12225			} else {
12226				return false;
12227			}
12228		} else {
12229			return false;
12230		}
12231
12232		$bgwrapper.addClass('uncode-kburns');
12233
12234	};
12235
12236	var activateParallax = function( nextIndex, direction ){
12237
12238		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12239			$cell = $('.fp-tableCell', $el),
12240			animationEnd = 'webkitAnimationEnd animationend',
12241			cellAnim;
12242
12243		switch( direction ) {
12244			case 'up':
12245				cellAnim = 'moveFromTopInner';
12246				break;
12247			default:
12248				cellAnim = 'moveFromBottomInner';
12249		}
12250
12251		$cell.css({
12252			'animation-name': cellAnim,
12253			'animation-duration': fp_anim_time + 'ms',
12254			'animation-delay': '',
12255			'animation-timing-function': fp_easing,
12256			'animation-fill-mode': 'both',
12257		}).off(animationEnd)
12258		.on(animationEnd, function(event) {
12259			if ( event.originalEvent.animationName === cellAnim ) {
12260				$cell
12261					.css({
12262						'animation-name': '',
12263						'animation-duration': '',
12264						'animation-delay': '',
12265						'animation-timing-function': '',
12266						'animation-fill-mode': '',
12267					});
12268			}
12269		});
12270	};
12271
12272	var scrollHashes = function(){
12273		var hash = window.location.hash.replace('#', '').split('/'),
12274			hashInd;
12275		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
12276			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
12277				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
12278				$.fn.fullpage.moveTo(hashInd+1);
12279			}
12280		} else if( hash[0] === '' ) {
12281			$.fn.fullpage.moveTo(1);
12282		}
12283	};
12284
12285	var hideMenu = function( index, nextIndex ){
12286		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
12287			return false;
12288
12289		var hMenu = UNCODE.menuHeight,
12290			transTime = hMenu * 2;
12291
12292		if ( index === 1 && nextIndex > 1 ) {
12293			hMenu = hMenu * -1;
12294		} else if  ( index !== 1 && nextIndex === 1 ) {
12295			hMenu = 0;
12296		} else {
12297			return false;
12298		}
12299
12300		$masthead.css({
12301			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
12302			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
12303			'-webkit-transition': 'transform 0.5s ease-in-out',
12304			'transition': 'transform 0.5s ease-in-out'
12305		});
12306	};
12307
12308	var shrinkMenu = function( index, nextIndex ){
12309		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
12310			return false;
12311
12312		if ( index === 1 && nextIndex > 1 ) {
12313			$logo.addClass('shrinked');
12314			$('div', $logo).each(function(index, val){
12315				$(val).css({
12316					'height': logoMinScale,
12317					'line-height': logoMinScale
12318				});
12319				if ($(val).hasClass('text-logo')) {
12320					$(val).css({
12321						'font-size': logoMinScale + 'px'
12322					});
12323				}
12324			});
12325			requestTimeout(function() {
12326				UNCODE.menuMobileHeight = $masthead.outerHeight();
12327			}, 300);
12328		} else if ( index !== 1 && nextIndex === 1 ) {
12329			$logo.removeClass('shrinked');
12330			$('div', $logo).each(function(index, val){
12331				$(val).css({
12332					'height': logoMaxScale,
12333					'line-height': logoMaxScale
12334				});
12335				if ($(val).hasClass('text-logo')) {
12336					$(val).css({
12337						'font-size': logoMaxScale + 'px'
12338					});
12339				}
12340			});
12341			requestTimeout(function() {
12342				UNCODE.menuMobileHeight = $masthead.outerHeight();
12343			}, 300);
12344		} else {
12345			return false;
12346		}
12347
12348	};
12349
12350	var anchorLink = function(){
12351
12352		$container.add('.menu-item').find('a[href*="#"]').on('click', function(e) {
12353			var $this = $(e.currentTarget),
12354				hash = e.currentTarget.href.split('#'),
12355				current = window.location.href.split('#'),
12356				ind,
12357				currentMenuOpened = UNCODE.menuOpened,
12358				go = false;
12359
12360			var hash_url = hash[0].replace(/\/?$/, '/'),
12361				current_url = current[0].replace(/\/?$/, '/');
12362
12363			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
12364				hash = '#'+hash[1];
12365				e.preventDefault();
12366				go = true;
12367			}
12368
12369			if ( go ) {
12370
12371				if ( $(hash).length ) {
12372					ind = $(hash).closest('.fp-section').index();
12373				} else {
12374					hash = hash.slice(1);
12375					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
12376				}
12377
12378				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
12379					ind = $this.closest('.fp-section').index();
12380
12381				UNCODE.menuOpened = false;
12382
12383				$.fn.fullpage.moveTo(ind+1);
12384
12385				UNCODE.menuOpened = currentMenuOpened;
12386				if (UNCODE.menuOpened) {
12387					if (UNCODE.wwidth < UNCODE.mediaQuery) {
12388						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
12389					} else {
12390						$('.mmb-container-overlay .overlay-close').trigger('click');
12391						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
12392					}
12393				}
12394
12395			}
12396
12397		});
12398
12399		$('.header-scrolldown').on('click', function(event) {
12400			event.preventDefault();
12401			var scrollDown = $(this),
12402				ind = scrollDown.closest('.fp-section').index();
12403
12404			$.fn.fullpage.moveTo(ind+2);
12405		});
12406
12407		var anchor = $('.fp-section.active').data('anchor');
12408
12409		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
12410			$('.menu-item').removeClass('active');
12411			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
12412		}
12413
12414	};
12415
12416	var slideLeave = function( index, nextIndex, direction ) {
12417		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
12418			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
12419			animationEnd = 'webkitAnimationEnd animationend',
12420			transitionEnd = 'webkitTransitionEnd transitionend',
12421			animOut = effect != 'scaleDown' ? effect + direction : effect,
12422			animIn,
12423			isFooter = false,
12424			isFooterNext = false,
12425			footerH = $footer.outerHeight(),
12426			timeout,
12427			player, iframe,
12428			footerCoeff;
12429		switch( direction ) {
12430			case 'up':
12431				animIn = 'moveFromTop';
12432				break;
12433			default:
12434				animIn = 'moveFromBottom';
12435		}
12436
12437		if ( $('body').hasClass('uncode-fullpage-trid') ) {
12438			animOut = animIn + 'trid';
12439			animIn = animOut + 'In';
12440		} else if ( UNCODE.isFullPageSnap ) {
12441			animIn = animOut = 'none';
12442		}
12443
12444		hideMenu(index, nextIndex);
12445		shrinkMenu(index, nextIndex);
12446
12447		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
12448			if ($(this).attr('data-provider') == 'vimeo') {
12449				iframe = $(this).find('iframe');
12450				player = new Vimeo.Player(iframe[0]);
12451				player.pause();
12452			} else if ($(this).attr('data-provider') == 'youtube') {
12453				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
12454			} else {
12455				if ($(this).is('video')) {
12456					$(this)[0].volume = 0;
12457					$(this)[0].pause();
12458				}
12459			}
12460		});
12461
12462		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
12463			if ($(this).attr('data-provider') == 'vimeo') {
12464				iframe = $(this).find('iframe');
12465				iframe.on('load', function(){
12466					player = new Vimeo.Player(iframe);
12467					player.setVolume(0);
12468					player.play();
12469				});
12470				player = new Vimeo.Player(iframe);
12471				player.setVolume(0);
12472				player.play();
12473			} else if ($(this).attr('data-provider') == 'youtube') {
12474				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
12475			} else {
12476				if ($(this).is('video')) {
12477					$(this)[0].volume = 0;
12478					$(this)[0].play();
12479				}
12480			}
12481		});
12482
12483		if ( $currentSlide.is($footer) )
12484			isFooter = true;
12485
12486		if ( $nextSlide.is($footer) )
12487			isFooterNext = true;
12488
12489		if ( ! UNCODE.isMobile && headerWithOpacity ) {
12490			if ( $currentSlide.is($header) )
12491				$header.addClass('header-scrolled');
12492		}
12493
12494		footerCoeff = footerH;
12495
12496		if ( UNCODE.isFullPageSnap ) {
12497			postLeaveActions( nextIndex );
12498			activateBackWash( nextIndex );
12499			activateKBurns( nextIndex );
12500			requestTimeout(function(){
12501				animationEndAction( index, nextIndex );
12502			}, fp_anim_time+150);
12503		} else {
12504			if ( isFooterNext ) {
12505
12506				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
12507				$iscrollWrapper.addClass('no-scrolloverflow');
12508
12509				$nextSlide
12510				.add($currentSlide)
12511				.addClass('uncode-scroll-front')
12512				.addClass('uncode-scroll-active')
12513				.addClass('uncode-scroll-visible');
12514				$container.css({
12515					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
12516					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
12517					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12518					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12519				}).off(transitionEnd)
12520				.one(transitionEnd, function(){
12521					animationEndAction( index, nextIndex );
12522				});
12523
12524			} else if ( isFooter ) {
12525
12526				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
12527				.add($currentSlide)
12528				.addClass('uncode-scroll-front')
12529				.addClass('uncode-scroll-active')
12530				.addClass('uncode-scroll-visible');
12531				$container.css({
12532					'-webkit-transform': 'translate3d(0, 0, 0)',
12533					'transform': 'translate3d(0, 0, 0)',
12534					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12535					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
12536				})
12537				.one(transitionEnd, function(){
12538					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
12539						clearRequestTimeout(timeout);
12540						timeout = requestTimeout(function(){
12541							$.fn.fullpage.moveTo(nextIndex);
12542							slideLeave( index-1, nextIndex, 'up' );
12543							$container.off(transitionEnd);
12544						}, 50);
12545					}
12546					animationEndAction( index, nextIndex );
12547				});
12548
12549			} else {
12550
12551				postLeaveActions( nextIndex );
12552
12553				if ( !$('body').hasClass('uncode-fullpage-trid') )
12554					activateParallax( nextIndex, direction );
12555
12556				var $outBg = $('.background-wrapper', $currentSlide);
12557
12558				$nextSlide
12559				.addClass('uncode-scroll-front')
12560				.addClass('uncode-scroll-active')
12561				.addClass('uncode-scroll-visible')
12562				.addClass('uncode-scroll-animating-in')
12563				.css({
12564					'z-index':4,
12565					'animation-name': animIn,
12566					'animation-duration': fp_anim_time + 'ms',
12567					'animation-delay': '',
12568					'animation-timing-function': fp_easing,
12569					'animation-fill-mode': 'both',
12570					'transition': 'initial',
12571				}).off(animationEnd)
12572				.on(animationEnd, function(event) {
12573					if ( event.originalEvent.animationName === animIn ) {
12574						$(this)
12575							.addClass('uncode-scroll-already')
12576							.removeClass('uncode-scroll-front')
12577							.removeClass('uncode-scroll-animating-in')
12578							.css({
12579								'animation-name': '',
12580								'animation-duration': '',
12581								'animation-delay': '',
12582								'animation-timing-function': '',
12583								'animation-fill-mode': '',
12584								'transition': 'initial',
12585							});
12586
12587						$currentSlide
12588							.removeClass('uncode-scroll-active')
12589							.add($outBg)
12590							.css({
12591								'animation-name': '',
12592								'animation-duration': '',
12593								'animation-delay': '',
12594								'animation-timing-function': '',
12595								'animation-fill-mode': '',
12596								'transition': 'initial',
12597							});
12598
12599						animationEndAction( index, nextIndex );
12600
12601					}
12602
12603					if ( nextIndex > 1 )
12604						$('body').addClass('window-scrolled');
12605					else
12606						$('body').removeClass('window-scrolled');
12607				});
12608
12609				$currentSlide
12610					.addClass('uncode-scroll-animating-out')
12611					.removeClass('uncode-scroll-front')
12612					.css({
12613						'z-index':'1',
12614						'animation-name': animOut,
12615						'animation-duration': fp_anim_time + 'ms',
12616						'animation-delay': '',
12617						'animation-timing-function': fp_easing,
12618						'animation-fill-mode': 'both',
12619						'transition': 'initial',
12620						'will-change': 'auto'
12621					}).off(animationEnd)
12622					.on(animationEnd, function(event) {
12623						if ( event.originalEvent.animationName === animOut ) {
12624							$currentSlide.removeClass('uncode-scroll-animating-out');
12625						}
12626					});
12627
12628				if ( $('body').hasClass('uncode-fp-opacity') ) {
12629					$currentSlide.find('> div').css({
12630						'animation-name': 'opacityout',
12631						'animation-duration': fp_anim_time + 'ms',
12632						'animation-delay': '',
12633						'animation-timing-function': fp_easing,
12634						'animation-fill-mode': 'both',
12635						'transition': 'initial',
12636					}).off(animationEnd)
12637					.on(animationEnd, function(event) {
12638						if ( event.originalEvent.animationName === 'opacityout' ) {
12639							$(event.currentTarget).css({
12640								'animation-name': '',
12641								'animation-duration': '',
12642								'animation-delay': '',
12643								'animation-timing-function': '',
12644								'animation-fill-mode': '',
12645								'transition': '',
12646							});
12647						}
12648					});
12649				}
12650			}
12651		}
12652
12653		$('.scroll-top').on('click', function(e){
12654			$.fn.fullpage.moveTo(1);
12655			return false;
12656		});
12657
12658	};
12659
12660	var init_fullPage = function(mode){
12661
12662		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
12663		// 	scrollBar = false;
12664		// }
12665
12666		var checkFPeffects;
12667
12668		$container.fullpage({
12669			sectionSelector: '.uncode-scroll-lock',
12670			scrollOverflow: true,
12671			scrollOverflowOptions: {
12672				click: false,
12673				preventDefaultException: { tagName:/.*/ }
12674			},
12675			normalScrollElements: ".masthead-vertical",
12676			navigation: false,
12677			scrollBar: scrollBar,
12678			scrollingSpeed: fp_anim_time,
12679			verticalCentered: true,
12680			anchors: no_history ? false : dataNames,
12681			recordHistory: !no_history,
12682			afterRender: function(){
12683				$('body').removeClass('fp-waiting');
12684				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
12685					var $invisible = $(this).addClass('hidden-scroll');//,
12686				});
12687				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
12688					var $visible = $(this).addClass('uncode-scroll-visible'),
12689						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
12690					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
12691				});
12692
12693				$('ul.onepage-pagination a').on('click', function(e){
12694					e.preventDefault();
12695					var $a = $(this),
12696						toIndex = $a.data('index');
12697
12698					$.fn.fullpage.moveTo(toIndex+1);
12699				});
12700
12701				requestTimeout(function(){
12702					scrollHashes();
12703				}, 1000);
12704
12705				$(window).on('hashchange', function(e){
12706					requestTimeout(function(){
12707						scrollHashes();
12708					}, 500);
12709				});
12710
12711				anchorLink();
12712
12713				if ( $('body').hasClass('uncode-fp-opacity') ) {
12714					$all.each(function(index, row) {
12715						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
12716							classBg;
12717
12718						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
12719							classBg = testmatch[0];
12720							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
12721						}
12722					});
12723				}
12724
12725				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
12726					$(window).on('menuOpen gdprOpen', function(){
12727						$.fn.fullpage.setAutoScrolling(false);
12728					}).on('menuClose gdprClose', function(){
12729						$.fn.fullpage.setAutoScrolling(true);
12730					});
12731				}
12732
12733				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
12734					requestTimeout(function(){
12735						$.fn.fullpage.setAutoScrolling(false);
12736					}, 1000);
12737				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
12738					$.fn.fullpage.setAutoScrolling(true);
12739				});
12740
12741				if ( !UNCODE.isFullPageSnap ) {
12742					clearRequestTimeout(checkFPeffects);
12743					checkFPeffects = requestTimeout(function(){
12744						activateBackWash( 1 );
12745						activateKBurns( 1 );
12746					}, 100);
12747				}
12748
12749			},
12750			onLeave: function( index, nextIndex, direction ){
12751
12752				if ( UNCODE.menuOpened || is_scrolling )
12753					return false;
12754
12755				is_scrolling = true;
12756
12757				var event = new CustomEvent('fp-slide-leave');
12758				window.dispatchEvent(event);
12759
12760				slideLeave( index, nextIndex, direction );
12761
12762				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
12763					if ( direction === 'up' ) {
12764						$.fn.fullpage.moveTo(nextIndex-1);
12765					} else {
12766						$.fn.fullpage.moveTo(nextIndex+1);
12767					}
12768					return false;
12769				}
12770
12771				$('ul.onepage-pagination a').removeClass('is-selected');
12772				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
12773
12774			}
12775		});
12776	};
12777
12778	init_fullPage();
12779	$(window).on('load', function(){
12780		requestTimeout(function(){
12781			$.fn.fullpage.reBuild();
12782		}, 3000);
12783	});
12784
12785	var addScrollingClass,
12786		removeScrollingClass;
12787
12788	window.addEventListener("fp-slide-scroll", function(){
12789		addScrollingClass = requestTimeout( function(){
12790			$('body').addClass('fp-slide-scrolling');
12791		}, 10 );
12792
12793		clearRequestTimeout(removeScrollingClass);
12794		removeScrollingClass = requestTimeout( function(){
12795			$('body').removeClass('fp-slide-scrolling');
12796		}, 150 );
12797
12798		Waypoint.refreshAll();
12799	}, false);
12800
12801	var setFPheight = function(){
12802		var $body = document.body,
12803			$footer = document.getElementById('colophon'),
12804			$maincontainer = document.querySelector('.main-wrapper'),
12805			$boxcontainer = document.querySelector('.box-container'),
12806			$sections = document.querySelectorAll('.fp-section'),
12807			rect = $maincontainer.getBoundingClientRect(),
12808			rect2 = $boxcontainer.getBoundingClientRect(),
12809			$masthead = document.getElementById('masthead'),
12810			_hideMenu = false,
12811			menuHeight = UNCODE.menuHeight;
12812		$body.style.height = UNCODE.wheight + 'px';
12813
12814		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
12815			_hideMenu = true;
12816		}
12817		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
12818			menuHeight = 0
12819		}
12820
12821
12822		if ( theres_footer )
12823			$footer.style.top = (rect.height || rect2.height) + 'px';
12824
12825		for (var i = 0; i < $sections.length; i++) {
12826			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
12827		}
12828	};
12829
12830	setFPheight();
12831
12832	window.addEventListener('resize', setFPheight, false);
12833	window.addEventListener('orientationchange', setFPheight, false);
12834
12835};
12836
12837UNCODE.particles = function() {
12838	$(".vc-particles-background").each(function() {
12839		var $particle = $(this);
12840		var $parent = $particle.closest('[data-parent]');
12841
12842		$parent.prepend($particle);
12843		// $(window).trigger('resize');
12844	})
12845};
12846
12847
12848UNCODE.readMoreCol = function( $el ){
12849	if ( typeof $el === 'undefined' || $el === null ) {
12850		$el = $('body');
12851	}
12852	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
12853	$readMoreCols.each(function(){
12854		var $uncont = $(this),
12855			$row = $uncont.closest('.row-container'),
12856			max_h = $uncont.attr('data-ov-height'),
12857			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
12858			actual_max_h = $uncont.outerHeight(),
12859			inner_h,
12860			$read_more = $('+ .btn-more-wrap', $uncont),
12861			read_more_resize = $read_more.hasClass('trigger-resize'),
12862			marginClosedBtn = $uncont.attr('data-margin-closed'),
12863			marginClosed = 0,
12864			marginOpenBtn = $uncont.attr('data-margin-open'),
12865			marginOpen = 0,
12866			anim_t = 250,
12867			resized = false;
12868
12869		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
12870
12871		switch (marginClosedBtn) {
12872			case 'sm':
12873				marginClosed = 18
12874				break;
12875				
12876			case 'std':
12877				marginClosed = 36
12878				break;
12879				
12880			case 'lg':
12881				marginClosed = 72
12882				break;
12883				
12884			case '':
12885			default:
12886				marginClosed = 0
12887				break;
12888				
12889		}
12890
12891		switch (marginOpenBtn) {
12892			case 'sm':
12893				marginOpen = 18
12894				break;
12895				
12896			case 'std':
12897				marginOpen = 36
12898				break;
12899				
12900			case 'lg':
12901				marginOpen = 72
12902				break;
12903				
12904			case 'no':
12905				marginOpen = 0
12906				break;
12907				
12908		}
12909
12910		var checkToggleMobile = function(){
12911			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
12912				resized = true;
12913				if ( $read_more.hasClass('state-closed') ) {
12914					$uncont[0].style.height = '';
12915					$uncont[0].style.maxHeight = max_h_mobile;
12916				}
12917			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
12918				if ( $read_more.hasClass('state-closed') ) {
12919					$uncont[0].style.height = '';
12920					$uncont[0].style.maxHeight = max_h;
12921				}
12922				resized = false;
12923			}
12924		}
12925		checkToggleMobile();
12926		$(window).on('resize', function() {
12927			checkToggleMobile();
12928		});
12929
12930		$('a', $read_more).on('click', function(e){
12931			e.preventDefault();
12932
12933			var $a = $(this);
12934
12935			if ( $read_more.hasClass('state-closed') ) {
12936
12937				$read_more
12938					.removeClass('state-closed')
12939					.addClass('state-open');
12940
12941				$uncont.css({
12942					'max-height': 'none',
12943					'height': 'auto',
12944				});
12945	
12946				inner_h = parseFloat( $uncont.outerHeight() );
12947
12948				$uncont.css({
12949					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
12950				});
12951		
12952				anim_t = inner_h - actual_max_h;
12953				if ( anim_t < 250 ) {
12954					anim_t = 250;
12955				} else if ( anim_t > 1000 ) {
12956					anim_t = 1000;
12957				}
12958
12959				$uncont.css({
12960					'transition-duration' : anim_t + 'ms'
12961				}).addClass('overflow-mask-animation').animate({
12962					'height': inner_h
12963				}, anim_t, 'easeInOutCubic', function(){
12964					$uncont.css({
12965						'height' : 'auto'
12966					}).removeClass('overflow-mask');
12967					if ( read_more_resize === true ) {
12968						window.dispatchEvent(new Event('resize'));
12969						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12970							ScrollTrigger.refresh(true);
12971						}
12972					}
12973				});
12974
12975				if ( marginOpen != '' ) {
12976					$read_more.animate({
12977						'margin-top' : marginOpen
12978					}, anim_t, 'easeInOutCubic');
12979				}
12980
12981			} else {
12982				$read_more
12983					.removeClass('state-open')
12984					.addClass('state-closed');
12985
12986				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
12987					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
12988				}, anim_t, 'easeInOutCubic', function(){
12989					if ( read_more_resize === true ) {
12990						window.dispatchEvent(new Event('resize'));
12991						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12992							ScrollTrigger.refresh(true);
12993						}
12994					}
12995				});
12996
12997				if ( marginClosed !== '' ) {
12998					$read_more.animate({
12999						'margin-top' : marginClosed
13000					}, anim_t, 'easeInOutCubic');
13001				}
13002
13003				if ( $a.hasClass('toggle-scroll') ) {
13004                    var $masthead = $('#masthead > div:first-child'),
13005                        headH = $masthead.outerHeight(),
13006						rectTop = $row[0].getBoundingClientRect().top,
13007						checkNavBar = $a.hasClass('toggle-navbar'),
13008						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
13009                        offCont = ( $row.offset().top );
13010
13011					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
13012						checkNavBar = checkNavBarMobile;
13013					}
13014
13015					if ( checkNavBar ) {
13016						offCont = offCont - headH;
13017					}
13018			
13019					if ( rectTop < headH ) {
13020						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
13021							$(this).stop();
13022						}).animate({
13023							scrollTop: offCont
13024						}, anim_t, 'easeInOutCubic');
13025					}
13026				}
13027
13028			}
13029		});
13030	});
13031}
13032UNCODE.filters = function() {
13033	var $systems = $('.isotope-system, .cssgrid-system');
13034
13035	$systems.each(function(index, val){
13036		var $system = $(this),
13037			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
13038			$widgets = $('.widgetized-cb-wrapper', $system),
13039			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
13040			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
13041			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
13042			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
13043
13044		if ($system.hasClass('isotope-processed')) {
13045			return;
13046		}
13047
13048		$cats_trigger.on('click', function(e) {
13049			if ( ! $('html').hasClass('screen-sm') ) {
13050				// $widgets.add($sorting_dd).slideUp(400);
13051				e.preventDefault();
13052				$widgets.slideUp(400, 'easeInOutCirc');
13053			}
13054		});
13055
13056		$('.filters-toggle-trigger', $system).on('click', function(e) {
13057			e.preventDefault();
13058			var $filters = $('.isotope-filters .menu-horizontal', $system);
13059			$filters.slideToggle(400, 'easeInOutCirc');
13060			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
13061		});
13062
13063		$widget_trgr.on('click', function(e) {
13064			e.preventDefault();
13065			$widgets.slideToggle(400, 'easeInOutCirc');
13066			if (!$('html').hasClass('screen-sm')) {
13067				$cats_filters.slideUp(400, 'easeInOutCirc');
13068			}
13069			window.dispatchEvent(new CustomEvent('boxResized'));
13070		});
13071
13072		$sorting_trgr.on('click', function(e) {
13073			e.preventDefault();
13074			if (!$('html').hasClass('screen-sm')) {
13075				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
13076			}
13077		});
13078
13079		$system.addClass('isotope-processed');
13080	});
13081
13082};
13083
13084UNCODE.widgets = function() {
13085	var widget_collapses = $('.widget-collapse');
13086
13087	widget_collapses.each(function(){
13088		var widget_collapse = $(this),
13089			widget_title = widget_collapse.find('.widget-title'),
13090			widget = widget_title.closest('.widget'),
13091			content = widget.children().not('.widget-title'),
13092			setCTA;
13093
13094		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
13095			widget_title.toggleClass('open');
13096		}
13097
13098		widget_title.each(function() {
13099			var _this = $(this);
13100			var content = _this.closest('.widget').find('.widget-collapse-content');
13101
13102			$(window).on('load resize', function(){
13103				clearRequestTimeout(setCTA);
13104				setCTA = requestTimeout( function() {
13105					if ( content.is(':visible') ) {
13106						_this.addClass( 'open' );
13107					} else {
13108						_this.removeClass( 'open' );
13109					}
13110				}, 10 );
13111			})
13112
13113			_this.on( 'click', function(){
13114
13115				// Get content of :after element (+ icon) to check the visibility
13116				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
13117
13118				if (icon_content === 'none' || !icon_content) {
13119					return false;
13120				}
13121
13122				_this.toggleClass('open');
13123				var isOpen = _this.hasClass('open'),
13124					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
13125				content.animate({
13126					height: 'toggle',
13127					padding: 'toggle',
13128					opacity: 'toggle',
13129					top: isOpen ? 0 : hasBorder
13130				}, {
13131					duration: 400,
13132					easing: "easeInOutCirc",
13133				});
13134
13135				return false;
13136
13137			});
13138		});
13139	});
13140
13141	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
13142};
13143
13144UNCODE.unmodal = function() {
13145	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
13146		$('.unmodal-overlay').fadeIn();
13147		$('.unmodal-overlay').addClass('loading');
13148		$('body').addClass('uncode-unmodal-overlay-visible');
13149		$(window).trigger('unmodal-open');
13150	});
13151
13152	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
13153		$('.unmodal-overlay').fadeOut();
13154		$('.unmodal').fadeOut();
13155		$('body').removeClass('uncode-unmodal-overlay-visible');
13156		$('body').removeClass('uncode-unmodal-open');
13157		$('html').removeClass('uncode-unmodal-body-disable-scroll');
13158		$(document).trigger('unmodal-close');
13159		UNCODE.isUnmodalOpen = false;
13160	});
13161
13162	$(document).on('uncode-unmodal-show-content', function() {
13163		$('.unmodal-overlay').removeClass('loading');
13164		$('.unmodal').show();
13165		$('.unmodal').addClass('show-unmodal-with-animation');
13166		$('.unmodal-content')[0].scrollTop = 0;
13167		$('body').addClass('uncode-unmodal-open');
13168		UNCODE.isUnmodalOpen = true;
13169
13170		if ($('body').hasClass('qw-body-scroll-disabled')) {
13171			$('html').addClass('uncode-unmodal-body-disable-scroll');
13172		}
13173
13174		if ($('.unmodal').hasClass('auto-height')) {
13175			set_modal_height();
13176		}
13177	});
13178
13179	var set_modal_height = function() {
13180		var modal = $('.unmodal').css({height: 'auto'});
13181		var window_height = $(window).outerHeight();
13182		var modal_height = modal.outerHeight();
13183
13184		modal.css('height', 'auto');
13185
13186		if (modal_height > window_height) {
13187			modal.outerHeight(window_height);
13188		}
13189	}
13190
13191	if ($('.unmodal').hasClass('auto-height')) {
13192		var setCTA;
13193
13194		$(window).on('resize', function() {
13195			clearRequestTimeout(setCTA);
13196			setCTA = requestTimeout(function() {
13197				set_modal_height();
13198			}, 100);
13199		});
13200	}
13201};
13202
13203UNCODE.bgChanger = function() {
13204	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
13205		$bg_first = $('.vc_row[data-bg-remove]'),
13206		bg_remove = $bg_first.attr('data-bg-remove'),
13207		$first = $bg_changers.first(),
13208		$last = $bg_changers.last(),
13209		$bg_wrapper = $('#changer-back-color'),
13210		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
13211		setCTA, localH = UNCODE.wheight,
13212		isScrolling;
13213
13214	$bg_first.removeClass(bg_remove);
13215
13216	var bgChange = function($col, bgColor, skin, tmbskin){
13217		$bg_wrapper.attr( 'class', bgColor );
13218		var menuskin;
13219		if ( typeof skin !== 'undefined' ) {
13220			menuskin = skin.replace('style', 'menu')
13221		}
13222
13223		if ( $col.length ) {
13224			$('.uncol[data-skin-change]').each(function(){
13225				var $isoFooter = $('.isotope-footer', this);
13226				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
13227				if ( menuskin !== '' ) {
13228					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
13229				}
13230			});
13231
13232			$('.tmb[data-skin-change]').each(function(){
13233				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
13234			});
13235		}
13236	};
13237
13238	var $masthead = $('#masthead'),
13239		transDesktop,
13240		transMobile,
13241		changeSkin,
13242
13243	checkTransparencyAndChange = function( skin ){
13244		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
13245		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
13246		changeSkin = $masthead.hasClass('menu-change-skin');
13247
13248		if ( ! transDesktop && ! transMobile ) {
13249			return false;
13250		}
13251
13252		if ( ! changeSkin ) {
13253			return false;
13254		}
13255
13256		if ( skin === 'style-light' ){
13257			$masthead.removeClass('style-dark-override').addClass('style-light-override');
13258			return false;
13259		} else if ( skin === 'style-dark' ) {
13260			$masthead.removeClass('style-light-override').addClass('style-dark-override');
13261			return false;
13262		}
13263	};
13264
13265	var bg_waypoints = function(){
13266		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
13267
13268			$.each($bg_changers, function(index, row) {
13269
13270				var $row = $(row),
13271					$col = $('.uncol[data-skin-change]', $row).eq(0),
13272					skin,
13273					$tmbs,
13274					tmbskin,
13275					bgColor = $row.attr('data-bg-color');
13276
13277				if ( ! $row.is(':visible') ) {
13278					return false;
13279				}
13280
13281				if ( $col.length ) {
13282					skin = $col.attr('data-skin-change');
13283					$tmbs = $('.tmb[data-skin-change]', $row);
13284					tmbskin = skin.replace('style', 'tmb');
13285				}
13286
13287				if ( ! $row.hasClass('unscroll-horizontal') ) {
13288					$row.waypoint(function( dir ) {
13289						if ( dir === 'down' ) {
13290							bgChange($col, bgColor, skin, tmbskin);
13291							checkTransparencyAndChange(skin);
13292						} else {
13293							return;
13294						}
13295					}, {
13296						offset: '50%'
13297		  			});
13298
13299					$row.waypoint(function( dir ) {
13300						if ( dir === 'up' ) {
13301							bgChange($col, bgColor, skin, tmbskin);
13302							checkTransparencyAndChange(skin);
13303						} else {
13304							return;
13305						}
13306					}, {
13307						offset: function() {
13308							var clH = this.element.clientHeight,
13309								wH = window.innerHeight,
13310								ret = clH > 200 ? -100 : clH * -0.5;
13311							return ( wH / 2 ) - clH;
13312						}
13313					});
13314				}
13315
13316			});
13317
13318			$('body').addClass('bg-changer-init');
13319
13320		}
13321	};
13322
13323	var body = document.body,
13324	edges = false;
13325
13326	var throttle = function(fn, wait) {
13327		var time = Date.now();
13328		return function() {
13329			if ((time + wait - Date.now()) < 0) {
13330				fn();
13331				time = Date.now();
13332			}
13333		}
13334	}
13335
13336	var $wrapper = document.querySelector(".main-wrapper"),
13337		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
13338
13339	var $title = document.querySelector('#rotating');
13340	if ( $title !== null ) {
13341		$title.style.whiteSpace = 'nowrap';
13342		$title.style.transition = 'transform 200ms linear';
13343	}
13344
13345	window.addEventListener( 'scroll', throttle( function() {
13346		window.clearRequestTimeout( isScrolling );
13347
13348		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
13349
13350			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
13351				body = document.body,
13352				html = document.documentElement,
13353				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
13354				$row = false,
13355				firstOff,
13356				lastOff;
13357
13358			if ( scrolled < 100 && $first.length ) {
13359				firstOff = $first.offset().top;
13360				if ( firstOff < 100 ) {
13361					var $row = $first;
13362				}
13363			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
13364				lastOff = $last.offset().top + $last.outerHeight();
13365				if ( lastOff > ( docH - 100 ) ) {
13366					var $row = $last;
13367				}
13368			}
13369
13370			if ( $row.length ) {
13371				var $col = $('.uncol[data-skin-change]', $row).eq(0),
13372					skin,
13373					$tmbs,
13374					tmbskin,
13375					bgColor = $row.attr('data-bg-color');
13376
13377				if ( $col.length ) {
13378					skin = $col.attr('data-skin-change');
13379					$tmbs = $('.tmb[data-skin-change]', $row);
13380					tmbskin = skin.replace('style', 'tmb');
13381				}
13382
13383				bgChange($col, bgColor, skin, tmbskin);
13384				checkTransparencyAndChange(skin);
13385				edges = true;
13386			}
13387
13388		}, 150);
13389
13390		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
13391			bg_waypoints();
13392			Waypoint.refreshAll();
13393			edges = false;
13394		}
13395
13396	}, 100), false);
13397
13398	$(window).on('resize', function() {
13399		clearRequestTimeout(setCTA);
13400		setCTA = requestTimeout(function() {
13401			if ( localH != UNCODE.wheight ) {
13402				localH = UNCODE.wheight;
13403				bg_waypoints();
13404				Waypoint.refreshAll();
13405			}
13406		}, 100);
13407	});
13408
13409	bg_waypoints();
13410
13411};
13412
13413UNCODE.skewIt = function() {
13414
13415	if ( $('body').hasClass('compose-mode') ) {
13416		return;
13417	}
13418
13419	var justscrolled = false;
13420
13421	var loadSkewIt = function(){
13422
13423		var $pageHeader = $('#page-header'),
13424			$page_body = $('.page-body'),
13425			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
13426
13427		if ( $header_skew.length ) {
13428			$pageHeader.addClass('uncode-skew').css({
13429				position: 'relative',
13430				zIndex: 1
13431			});
13432			$header_skew.removeClass('uncode-skew');
13433			$page_body.css({
13434				position: 'relative',
13435				zIndex: 0
13436			});
13437		}
13438
13439		var $skew = $('.uncode-skew'),
13440			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
13441			horizontal = $horizontal.length,
13442			stopSkewing,
13443			lastOffset = 0,
13444			lastDate = Date.now();
13445
13446		if ( ! $skew.length ) {
13447			return;
13448		}
13449
13450		var dropSkew = function(){
13451			if ( UNCODE.wwidth < UNCODE.mediaQuery )
13452				return;
13453
13454			$skew.each(function(){
13455				var $this = $(this),
13456					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
13457
13458				if ( $drop.length ) {
13459					$this.css({
13460						'transform': 'skew(0)'
13461					});
13462					var bound = $this[0].getBoundingClientRect();
13463					$drop.css({
13464						left: bound.x * -1,
13465						top: bound.y * -1,
13466					});
13467				}
13468			});
13469		};
13470		dropSkew();
13471
13472		$(window).on('resize', dropSkew);
13473
13474		window.addEventListener( 'scroll', function() {
13475
13476			if ( justscrolled !== true ) {
13477				justscrolled = true;
13478				return;
13479			}
13480
13481			window.clearRequestTimeout( stopSkewing );
13482
13483			var now = Date.now(),
13484				delayInMs = now - lastDate,
13485				offset = window.pageYOffset || window.document.documentElement.scrollTop,
13486				newOffset = offset - lastOffset,
13487				speed = Math.pow((newOffset / delayInMs), 3) * -1,
13488				body = document.body,
13489				html = document.documentElement,
13490				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
13491				wait = 50,
13492				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
13493
13494			if ((lastDate + wait - now) < 0) {
13495
13496				lastDate = now;
13497				lastOffset = offset;
13498
13499				if ( speed > 6 ) {
13500					speed = 6;
13501				} else if ( speed < -6 ) {
13502					speed = -6;
13503				}
13504
13505				if ( speed > 2 && offset < UNCODE.wheight ) {
13506					speed = 2;
13507				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
13508					speed = -2;
13509				}
13510
13511				var speedY = speed,
13512					speedX = speed * 1.25;
13513
13514				if ( horizontal ) {
13515					speedY = 0;
13516					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13517						speedX = 0;
13518						return;
13519					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13520						speedX = 0;
13521						return;
13522					}
13523				} else {
13524					speedX = 0;
13525				}
13526
13527				if ( ! $skew.closest('.enter-st').length ) {
13528					speedX = 0;
13529				}
13530
13531				gsap.killTweensOf($skew);
13532				gsap.to( $skew, {
13533					duration: 0.2,
13534					skewY: (speedY * maxSpeed) + "deg",
13535					skewX: (speedX * maxSpeed) + "deg",
13536					ease: Power0.easeNone,
13537					transformOrigin: 'center',
13538				});
13539
13540			}
13541
13542			stopSkewing = requestTimeout(function() {
13543				gsap.killTweensOf($skew);
13544				gsap.to( $skew, {
13545					duration: 0.5,
13546					skewY: "0deg",
13547					skewX: "0deg",
13548					transformOrigin: 'center',
13549					ease: Expo.easeOut,
13550				});
13551
13552				$skew.each(function(){
13553					var $this = $(this),
13554						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
13555
13556					if ( $drop.length ) {
13557						var bound = $this[0].getBoundingClientRect()
13558						$drop.css({
13559							left: bound.x * -1,
13560							top: bound.y * -1,
13561						});
13562					}
13563				});
13564
13565			}, 200);
13566
13567		}, false);
13568
13569	};
13570
13571	$(window).on('load', loadSkewIt);
13572
13573};
13574
13575UNCODE.rotateIt = function() {
13576
13577	if ( $('body').hasClass('compose-mode') ) {
13578		return;
13579	}
13580
13581	var frameRotate = false;
13582	var loadRotateIt = function(){
13583
13584		var $toRotate = $('.uncode-rotate');
13585
13586		$toRotate.each(function(){
13587			var $rotate = $(this),
13588				deg = 0,
13589				dir = true,
13590				coeff = 1,
13591				lastOffset = 0,
13592				lastDate = Date.now();
13593
13594			var checkScroll = function($rotate){
13595				// if ( ! $rotate.length ) {
13596				// 	return;
13597				// }
13598
13599				var now = Date.now(),
13600					delayInMs = now - lastDate,
13601					offset = window.pageYOffset || window.document.documentElement.scrollTop,
13602					newOffset = offset - lastOffset,
13603					speed = (newOffset / delayInMs) * 5,
13604					body = document.body,
13605					html = document.documentElement,
13606					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
13607
13608				lastDate = now;
13609				lastOffset = offset;
13610
13611				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
13612					deg = 0;
13613				}
13614
13615				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
13616					deg = parseFloat(deg) + parseFloat(speed);
13617				}
13618
13619				if ( $rotate.hasClass('uncode-rotate-hover') ) {
13620					$rotate.hover(function(){
13621						coeff = 1.75;
13622					}, function(){
13623						coeff = 1;
13624					});
13625				}
13626
13627				// if ( speed > 0 ) {
13628				// 	dir = true
13629				// } else if ( speed < 0 ) {
13630				// 	dir = false
13631				// }
13632
13633				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
13634					deg = deg+coeff;
13635					// if ( dir ) {
13636					// 	deg = deg+coeff;
13637					// } else {
13638					// 	deg = deg-coeff;
13639					// }
13640				}
13641
13642				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13643					return false;
13644				}
13645				
13646				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
13647					var undeg = deg*-1;
13648					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
13649				} else {
13650					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
13651				}
13652
13653				requestAnimationFrame(function() {
13654					if ( frameRotate === true ) {
13655						frameRotate = false;
13656						return;
13657					}
13658					checkScroll($rotate);
13659				});
13660			};
13661
13662			checkScroll($rotate);
13663
13664		});
13665
13666	};
13667
13668	$(window).on('load', loadRotateIt);
13669
13670	var checkRotate;
13671	var resizeRotate = function(){
13672		var $inlineRotates = $('.inline-rotate');
13673		$inlineRotates.each(function(){
13674			$(this).addClass('inline-rotate-standby');
13675		});
13676		clearTimeout(checkRotate);
13677		checkRotate = setTimeout(function(){
13678			$('.inline-rotate').each(function(){
13679				$(this).removeClass('inline-rotate-standby');
13680				frameRotate = true;
13681			});
13682			loadRotateIt();
13683		}, 500);
13684	};
13685
13686	$(window).off('resize.inline-rotate', resizeRotate)
13687	.on('resize.inline-rotate', resizeRotate);
13688
13689};
13690
13691var marqueeAttempts = 0,
13692	marqueeTO,
13693	marqueeCheckResize,
13694	initMarquee;
13695
13696UNCODE.textMarquee = function( $titles ) {
13697
13698	var isInitMarque = false;
13699	var lastMarqueeDocH = Math.round($(document).height());
13700
13701	var initTextMarquee = function( $titles ){
13702
13703		if ( typeof $titles == 'undefined' ) {
13704			$titles = $('.un-text-marquee');
13705		}
13706
13707		if ( ! $titles.length ) {
13708			return;
13709		}
13710
13711		isInitMarque = true;
13712
13713		var stableHeight = UNCODE.wheight;
13714
13715		$titles.each(function(){
13716			var $title = $(this),
13717				marqueeNS = '.textMarquee-' + Math.random().toString(36).slice(2),
13718				$span = $('> span, > i > span', $title),
13719				txt,
13720				first = true,
13721				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
13722				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
13723				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
13724				hasSticky = false,
13725				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
13726				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
13727				newW = UNCODE.wwidth,
13728				marqueeTL, inview,
13729				isInMenu = $title.closest('.megamenu-block-wrapper').length;
13730
13731
13732			var getStickyBound = function() {
13733				var $sticky = $title.closest('.sticky-trigger, .sticky-element');
13734
13735				if ( $sticky.length ) {
13736					var $pinSpacer = $sticky.closest('.pin-spacer');
13737					return $pinSpacer.length ? $pinSpacer : $sticky;
13738				}
13739
13740				var $pinSpacerOnly = $title.closest('.pin-spacer');
13741
13742				if ( $pinSpacerOnly.length ) {
13743					return $pinSpacerOnly;
13744				}
13745
13746				return $title.closest('.vc_row');
13747			};
13748
13749			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
13750				hasSticky = true;
13751				dataTrigger = 'row';
13752			}
13753
13754			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
13755				dataNavBar = dataNavBarMobile;
13756			}
13757
13758			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
13759			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
13760			var dataX = dataSpeed;
13761
13762			dataSpeed += 5;
13763
13764			$('.marquee-clone-wrap', $title).remove();
13765
13766			txt = $span.html();
13767
13768			if ( ! $('.marquee-original-core', $span).length ) {
13769				txt = $span.html();
13770				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
13771			} else {
13772				txt = $('.marquee-original-core', $span).html();
13773			}
13774
13775			var spanW,
13776				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
13777				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
13778				speed = 10 - dataSpeed;
13779
13780			$span.prepend($prepended);
13781			$span.append($appended);
13782
13783			var continuousTextMarquee = function () {
13784				var bound = $title
13785						.css({
13786							transform: "none",
13787							opacity: 0,
13788						})
13789						.offset(),
13790					ease = "none";
13791
13792				var xStrt =
13793						first || $title.hasClass("un-marquee-infinite")
13794							? 0
13795							: UNCODE.wwidth - bound.left,
13796					xEnd = $title.hasClass("un-marquee-infinite")
13797						? spanW
13798						: spanW + bound.left,
13799					xSpeed =
13800						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
13801						dataSpeed,
13802					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
13803					speedSlow = (xEnd + xStrt) / 45,
13804					transFormVal,
13805					translX;
13806
13807				if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
13808					marqueeTL.kill();
13809				}
13810
13811				marqueeTL = new TimelineMax({ paused: true, reversed: true });
13812				marqueeTL.play();
13813
13814				var inViewElement =
13815						dataTrigger === "row" ? ( hasSticky ? getStickyBound()[0] : $title.closest(".vc_row")[0] ) : $title[0],
13816					wayOff =
13817						dataTrigger === "row" && dataNavBar === "yes"
13818							? UNCODE.menuHeight
13819							: 0;
13820
13821				if ( isInMenu ) {
13822					$(document).on('un-menu-show.marquee', function(e, $ul){
13823						marqueeTL.restart();
13824					});
13825					$(document).on('un-menu-hide.marquee', function(e, $ul){
13826						marqueeTL.pause();
13827					});
13828				} else {
13829					inview = new Waypoint.Inview({
13830						element: inViewElement,
13831						offset: wayOff,
13832						enter: function (direction) {
13833							marqueeTL.play();
13834						},
13835						exited: function (direction) {
13836							if (!$title.closest(".pin-spacer").length) {
13837								marqueeTL.pause();
13838							}
13839						},
13840					});
13841				}
13842
13843				if ($title.hasClass("un-marquee-hover")) {
13844					var $column = $title.closest(".wpb_column"),
13845						$col_link = $(".col-link", $column),
13846						$hover_sel = $title;
13847
13848					if ($col_link.length) {
13849						$hover_sel = $title.add($column);
13850					}
13851					$hover_sel
13852						.on("mouseover", function () {
13853							ease = "power2.out";
13854							transFormVal = $title.css("transform").split(/[()]/)[1];
13855							translX = transFormVal.split(",")[4];
13856							speedSlow = (xEnd + (xStrt - translX)) / 45;
13857							marqueeTL.duration(speedSlow);
13858						})
13859						.on("mouseout", function () {
13860							ease = "power2.in";
13861							transFormVal = $title.css("transform").split(/[()]/)[1];
13862							translX = transFormVal.split(",")[4];
13863							speedSlow =
13864								((xEnd + (xStrt - translX)) /
13865									(dataSpeed * dataSpeed * dataSpeed) /
13866									5) *
13867								dataSpeed;
13868							marqueeTL.duration(speedSlow);
13869						});
13870				}
13871		
13872				gsap.killTweensOf($title);
13873				marqueeTL.fromTo( $title, {
13874					opacity: 1,
13875					x: xStrt * direction * -1
13876				},
13877				{
13878					duration: xSpeed,
13879					x: xEnd * direction,
13880					onComplete: function(){
13881						first = false;
13882						if ( isInMenu ) {
13883							marqueeTL.restart();
13884						} else {
13885							continuousTextMarquee();
13886						}
13887					},
13888					onUpdate: function(){
13889						if ( ! $title[0].isConnected ) {
13890							marqueeTL.kill();
13891							initTextMarquee();
13892						}
13893					},
13894					ease: ease
13895				});
13896		
13897			};
13898			
13899			var runTextMarquee = function(){
13900				var time = Date.now();
13901
13902				var textMarqueeScroll = function(){
13903					var $row = $title.closest('.vc_row');
13904					if ( hasSticky ) {
13905						$row = getStickyBound();
13906					}
13907					var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
13908
13909					if ( !$bound.length ) {
13910						return;
13911					}
13912
13913					var bound = $bound[0].getBoundingClientRect(),
13914						wait = 100,
13915						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
13916						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
13917
13918					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
13919						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
13920						marqueeAttempts < 2 ) {
13921
13922						clearRequestTimeout(marqueeTO);
13923
13924						marqueeTO = requestTimeout(function(){
13925							marqueeAttempts++;
13926							runTextMarquee();
13927						}, 100);
13928					}
13929
13930
13931					var bound_top = bound.top,
13932						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
13933
13934					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
13935						if ( dataTrigger === 'row-middle' ) {
13936							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5)
13937						}
13938						if ( dataNavBar === 'yes' ) {
13939							bound_top = bound_top - UNCODE.menuHeight;
13940						}
13941						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
13942					}
13943
13944					gsap.killTweensOf($title);
13945					gsap.to( $title, {
13946						duration: 0.24,
13947						x: gsap_calc,
13948					});
13949				};
13950
13951				textMarqueeScroll();
13952				$(window)
13953					.off('load' + marqueeNS + ' scroll' + marqueeNS)
13954					.on('load' + marqueeNS + ' scroll' + marqueeNS, function(e) {
13955						textMarqueeScroll();
13956				});
13957			};
13958
13959			var cloneSpan = function($_title, cntnt){
13960
13961				if ( $_title.hasClass('un-marquee-infinite') ) {
13962					$('> span.marquee-clone-wrap', $_title).text('');
13963				}
13964
13965				gsap.to( $_title, {
13966					duration: 0,
13967					x: 0
13968				});
13969				spanW = $span.outerWidth();
13970
13971
13972				if ( !spanW ) {
13973					return;
13974				}
13975
13976				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
13977					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
13978
13979				if ( $_title.hasClass('un-marquee-infinite') ) {
13980
13981					for ( var i = 0; i < part; i++ ) {
13982						$prepended.append(cntnt + spaceSpan);
13983						$appended.append(cntnt + spaceSpan);
13984					}
13985				}
13986
13987				if ( $('body').hasClass('compose-mode') ) {
13988					$('.uncode_fe_safe').remove();
13989					return;
13990				}
13991
13992				if ( $title.closest('.marquee-freezed').length ) {
13993					return;
13994				}
13995
13996				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
13997					continuousTextMarquee();
13998				}
13999
14000				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
14001					runTextMarquee();
14002				}
14003
14004			};
14005
14006			var marqueeResize = function(e){
14007				if ( isInMenu ) {
14008					return;
14009				}
14010				var tOut = 1000;
14011				if ( isInMenu ) {
14012						gsap.killTweensOf($title);
14013						if ( typeof inview !== 'undefined' && inview !== null ) {
14014							inview.destroy();
14015						}
14016						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
14017							marqueeTL.kill();
14018						}
14019						first = true;
14020						$(window).off(marqueeNS);
14021						$(document).off(marqueeNS);
14022						initTextMarquee();
14023				} else {
14024					clearRequestTimeout(marqueeCheckResize);
14025					marqueeCheckResize = requestTimeout(function(){
14026						if ( newW !== UNCODE.wwidth ) {
14027							gsap.killTweensOf($title);
14028							if ( typeof inview !== 'undefined' && inview !== null ) {
14029								inview.destroy();
14030							}
14031							if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
14032								marqueeTL.kill();
14033							}
14034							first = true;
14035							$(window).off(marqueeNS);
14036							$(document).off(marqueeNS);
14037							initTextMarquee();
14038							newW = UNCODE.wwidth;
14039						}
14040					}, tOut);
14041				}
14042			};
14043
14044			$(window).off('resize', marqueeResize)
14045			.on( 'resize', marqueeResize);
14046			$(window).off('uncode.re-layout', marqueeResize)
14047			.on( 'uncode.re-layout', marqueeResize);
14048
14049			cloneSpan($title, txt);
14050
14051			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14052				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
14053					var $_titles = $('.un-text-marquee',e.view.$el);
14054					clearRequestTimeout(marqueeCheckResize);
14055					marqueeCheckResize = requestTimeout(function(){
14056						initTextMarquee($_titles);
14057					}, 1000);
14058				});
14059			}
14060		});
14061
14062		$(window).on( 'load wwResize', function(e) {
14063			stableHeight = UNCODE.wheight;
14064		});
14065
14066	};
14067
14068	document.addEventListener("DOMContentLoaded", function() {
14069		if ( isInitMarque !== true ) {
14070			initTextMarquee();
14071		}
14072	});
14073
14074	$(window).on('focus load resize',function(){
14075		clearTimeout(initMarquee);
14076		initMarquee = setTimeout(function(){
14077			if ( isInitMarque !== true ) {
14078				initTextMarquee();
14079			}
14080		}, 500);
14081	});
14082	
14083	$(document).on('pumAfterOpen pumAfterClose', function(args){
14084		initTextMarquee();
14085	});
14086
14087	$(document).on('uncode-scrolltrigger-refresh', function(args){
14088		var nextDocH = Math.round($(document).height());
14089
14090		if ( Math.abs(nextDocH - lastMarqueeDocH) <= 2 ) {
14091			return;
14092		}
14093
14094		lastMarqueeDocH = nextDocH;
14095
14096		clearRequestTimeout(marqueeCheckResize);
14097
14098		marqueeCheckResize = requestTimeout(function(){
14099			initTextMarquee();
14100		}, 250);
14101	});
14102};
14103	
14104UNCODE.parallax = function() {
14105	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
14106		if ($('.parallax-el').length > 0) {
14107			var parallax_elements = new Rellax('.parallax-el');
14108			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
14109			window.addEventListener('boxResized', function(e) {
14110				parallax_elements.refresh();
14111			}, false);
14112			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
14113				requestTimeout(function() {
14114					parallax_elements.refresh();
14115				}, 100);
14116			});
14117
14118			if ( typeof UNCODE.hDoc === 'undefined' ) {
14119				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
14120					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
14121			}
14122		
14123			function paralraf(time) {
14124				requestAnimationFrame(paralraf)
14125		
14126				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
14127					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
14128				
14129				if ( UNCODE.hDoc !== newHdoc ) {
14130					UNCODE.hDoc = newHdoc;
14131					parallax_elements.refresh();
14132				}
14133			}
14134		
14135			requestAnimationFrame(paralraf)
14136		
14137		}
14138	}
14139};
14140
14141UNCODE.magicCursor = function(){
14142	var $customCursor = $('#uncode-custom-cursor'),
14143		$customPilot = $('#uncode-custom-cursor-pilot'),
14144		$tooltip = $('.title-tooltip', $customCursor),
14145		$cursorSpan = $('> span', $tooltip),
14146		currentBg = false,
14147		fromTitle = false,
14148		setTime,
14149		mouseEvent;
14150
14151		var spanW, spanH,
14152		maxW = false;
14153
14154	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
14155		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
14156			$tooltip.css({opacity: 0});
14157			delayt_time += 400;
14158		}
14159		clearRequestTimeout(setTime);
14160		setTime = requestTimeout(function() {
14161
14162			$tooltip.css({opacity: ''});
14163
14164			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
14165
14166			if ( cursorTitle !== '' ) {
14167				if ( fromTitle && dataTitle === 'boing' ) {
14168					setTimeout(function(){
14169						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
14170					}, 5);
14171				}
14172				$cursorSpan.attr('class', fontClass).html( cursorTitle );
14173			} else {
14174				if ( cursorType !== 'auto' ) {
14175					$cursorSpan.html('');
14176				}
14177			}
14178
14179			$cursorSpan.addClass('in-tooltip');
14180
14181			$customCursor.attr('data-cursor', cursorType);
14182
14183			if ( fromTitle ) {
14184				$customCursor.addClass('from-tooltip-title');
14185			} else {
14186				$customCursor.removeClass('from-tooltip-title');
14187			}
14188
14189			if ( cursorBg !== false ) {
14190				$customCursor.attr('data-bg', 'transparent');
14191			} else {
14192				$customCursor.removeAttr('data-bg');
14193			}
14194
14195			currentBg = cursorBg;
14196
14197			if ( cursorTitle !== '' ) {
14198				fromTitle = true;
14199				$customCursor.attr('data-cursor', cursorType);
14200				$customCursor.attr('data-title', 'true');
14201				$cursorSpan.css({width: ''});
14202			} else {
14203				fromTitle = false;
14204				$customCursor.removeAttr('data-title');
14205			}
14206			spanW = $cursorSpan.outerWidth();
14207			
14208			if ( spanW >= maxW && maxW !== false ) {
14209				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
14210				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
14211					width: maxW
14212				});
14213				spanW = maxW;
14214			} else {
14215				$customCursor.find('> span:first-child').removeClass('max-width');
14216			}
14217			spanH = $cursorSpan.outerHeight();
14218			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
14219				$customCursor.find('> span:first-child').add($tooltip).css({
14220					width: spanW,
14221					height: spanH
14222				});
14223			} else {
14224				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
14225			}
14226			if ( $customPilot.length ) {
14227				$customPilot.attr('data-cursor', cursorType);
14228			}
14229		}, delayt_time);
14230	}
14231
14232	function changeCursor($wrap){
14233		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
14234		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
14235			$href = $wrap.find(href),
14236			cursorType,
14237			cursorTitle = '',
14238			tooltip_class = '',
14239			cursorBg = false;
14240
14241		$wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) {
14242			var $this = $(this).addClass("cursor-init"),
14243				$tmb = $this.closest('.tmb'),
14244				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
14245				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
14246				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
14247				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
14248				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
14249				$title = $('.t-entry-title', $tmb),
14250				is_frontend_editor = $this.closest('.vc_controls').length,
14251				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
14252				$parent_cursor = $this.closest('[class*="custom-cursor"]');
14253
14254			if ( is_frontend_editor ) {
14255				cursorType = 'auto';
14256			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
14257				cursorType = data_cursor;
14258			} else if ( $parent_cursor.length ) {
14259				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
14260					cursorType = 'icon-light';
14261				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
14262					cursorType = 'icon-diff';
14263				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
14264					cursorType = 'icon-accent';
14265				} else {
14266					cursorType = 'icon-dark';
14267				}
14268			} else {
14269				cursorType = 'pointer';
14270			}
14271
14272			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
14273				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
14274					cursorTitle = custom_text;
14275				} else {
14276					cursorTitle = $title.clone();
14277					$('a', cursorTitle).replaceWith(function() {
14278						return this.childNodes;
14279					});
14280					$('*', cursorTitle).replaceWith(function(){
14281						return $(this).removeAttr('class');
14282					});
14283					cursorTitle = cursorTitle.html();
14284				}
14285			} else {
14286				cursorTitle = '';
14287			}
14288
14289			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
14290				tooltip_class = data_class;
14291			} else {
14292				tooltip_class = '';
14293			}
14294
14295			if ( cursor_bg == 'true' ) {
14296				cursorBg = true;
14297			} else {
14298				cursorBg = false;
14299			}
14300
14301			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
14302		}).on("mouseleave.cursor", href, function(e) {
14303			var outTime = 150;
14304			if ( currentBg !== false && cursorBg === false ) {
14305				outTime = 0;
14306			}
14307			delayChangeCursor('auto', '', false, outTime, false, '');
14308		});
14309
14310		$(window).on('disable-hover', function(event) {
14311			document.addEventListener("mousemove", function(e) {
14312				mouseEvent = e;
14313			});
14314			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
14315		});
14316
14317		$(window).on('enable-hover', function(event) {
14318			if ( typeof mouseEvent !== 'undefined' ) {
14319				var x = mouseEvent.clientX,
14320					y = mouseEvent.clientY;
14321
14322				var elements = document.elementsFromPoint(x, y),
14323					$element = $(elements[0]);
14324
14325				$element.closest(href).trigger('mouseenter');
14326			}
14327		});
14328
14329	}
14330
14331	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
14332		changeCursor();
14333	});
14334
14335	$(document).ajaxComplete(function( event, xhr, settings ) {
14336		changeCursor();
14337	});
14338
14339	$('.isotope-container').on('isotope-layout-complete', function() {
14340		var $this = $(this);
14341		changeCursor($this);
14342	});
14343
14344};
14345
14346UNCODE.magneticCursor = function(){
14347	function magneticCursor($wrap){
14348		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
14349		var $magnetics = $wrap.find('.tmb-image-anim-magnetic .t-entry-visual').has('img:not(.avatar), .t-background-cover, .dummy.secondary-dummy-image, .t-secondary-background-cover').add($('.magnetic').has('.background-inner, .header-bg'));
14350
14351		$magnetics.on('mousemove', function(e){
14352			var $this = $(this),
14353				$el,
14354				bound = e.currentTarget.getBoundingClientRect(),
14355				coeff = 30,
14356				hor = (bound.width / 2) - (e.clientX - bound.left),
14357				ver = (bound.height / 2) - (e.clientY - bound.top),
14358				toX = hor / bound.width * coeff,
14359				toY = ver / bound.height * coeff,
14360				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
14361				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
14362				toScale = Math.max(scaleX, scaleY);
14363
14364			if ( $this.hasClass('magnetic') ) {
14365				$el = $('.background-inner, .header-bg', $this);
14366			} else {
14367				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
14368			}
14369
14370			gsap.killTweensOf($el);
14371			gsap.to( $el, {
14372				duration: 0.75,
14373				x: toX,
14374				y: toY,
14375				scale: toScale,
14376				ease: Power1.easeOut,
14377				transformPerspective: 900,
14378				transformOrigin: 'center',
14379				force3D: true
14380			});
14381		}).on('mouseout', function(e){
14382			var $this = $(this),
14383				$el
14384			if ( $this.hasClass('magnetic') ) {
14385				$el = $('.background-inner, .header-bg', $this);
14386			} else {
14387				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
14388			}
14389			gsap.killTweensOf($el);
14390			gsap.to( $el, {
14391				duration: 0.6,
14392				y: 0,
14393				x: 0,
14394				scale: 1,
14395				ease: Power1.easeOut,
14396				transformPerspective: 900,
14397				transformOrigin: 'center',
14398				force3D: true
14399			});
14400		});
14401	};
14402
14403	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
14404		magneticCursor();
14405	});
14406
14407	$(document).ajaxComplete(function( event, xhr, settings ) {
14408		magneticCursor();
14409	});
14410
14411	$('.isotope-container').on('isotope-layout-complete', function() {
14412		var $this = $(this);
14413		magneticCursor($this);
14414	});
14415
14416};
14417
14418UNCODE.dropImage = function() {
14419
14420	/****************************
14421	 * Image hover *
14422	****************************/
14423	function imageHover(){
14424		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14425			return;
14426		}
14427
14428		var $postLists = $('.uncode-post-titles');
14429		$postLists.each(function(){
14430			var $list = $(this),
14431				timing = parseFloat( $list.attr('data-timing') ),
14432				default_image = $list.hasClass('uncode-post-titles-default-image'),
14433				default_title = $list.hasClass('uncode-post-titles-default-title'),
14434				$tmbs = $('.tmb', $list),
14435				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
14436				clientX,
14437				clientY,
14438				$row_parent = $list.closest('.vc_row'),
14439				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
14440				$col_parent = $list.closest('.uncell'),
14441				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
14442				stoppedScrolling = true,
14443				setCTA;
14444
14445			timing *= 0.001;
14446
14447			var drop_bgs = function(){
14448				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
14449					var $drop = $(this),
14450						srcset = $drop.attr('data-bgset'),
14451						setArr = srcset.split(","),
14452						setArrOrder = [],
14453						biggest = 0,
14454						checkBg = false,
14455						desktopBG = $drop.data('[data-background-image]'),
14456						mobileBG = $drop.data('[data-mobile-background-image]');
14457
14458					if ( $drop.hasClass('srcset-bg-async') ) {
14459
14460						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
14461							return;
14462						}
14463						
14464					}
14465
14466					if ( SiteParameters.uncode_adaptive == true ) {
14467						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
14468							$drop.css({
14469								'background-image' : 'url(' + setArr[0] + ')'
14470							});
14471						}
14472					} else {
14473						for ( var i = 0; i < setArr.length; i++ ) {
14474							var setLoop = setArr[i].trim().split(" ");
14475							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
14476								var parseSet = parseFloat(setLoop[1]);
14477								if ( biggest < parseSet ) {
14478									biggest = parseSet;
14479								}
14480								setArrOrder[parseSet] = setLoop[0];
14481								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
14482									checkBg = true;
14483									$drop.css({
14484										'background-image' : 'url(' + setLoop[0] + ')'
14485									});
14486								}
14487							}
14488						}
14489
14490						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
14491							$drop.css({
14492								'background-image' : 'url(' + setArrOrder[biggest] + ')'
14493							});
14494						}
14495					}
14496
14497				});
14498			};
14499
14500			drop_bgs();
14501
14502			var dropMovesSize = function(){
14503				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
14504					return;
14505				}
14506				$drop_moves.each(function(){
14507					var $drop_move = $(this),
14508						dataW = $drop_move.attr('data-w'),
14509						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
14510					if ( typeof dataW !== 'undefined' && dataW !== null ) {
14511						dataW = screenInfo.width / 12 * parseFloat( dataW );
14512					}
14513					$drop_moves.css({
14514						width: dataW
14515					});
14516
14517					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14518						$anim_parent.on('animationend', function(){
14519							var bound = $anim_parent[0].getBoundingClientRect();
14520							$drop_move.css({
14521								left: bound.x * -1,
14522								top: bound.y * -1,
14523							});
14524						});
14525					}
14526				});
14527
14528
14529			};
14530
14531			dropMovesSize();
14532
14533			$(window).on( 'resize', function(){
14534				clearRequestTimeout(setCTA);
14535				setCTA = requestTimeout( function() {
14536					drop_bgs();
14537					dropMovesSize();
14538				}, 100 );
14539			});
14540
14541			if ( $drop_row_parents.length ) {
14542				$row_parent.addClass( 'drop-added' );
14543			}
14544
14545			$drop_row_parents.each(function(index, val){
14546				var $drop = $(val);
14547				$row_parent.prepend($drop);
14548				manageVideos($drop, false);
14549				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
14550					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
14551				}
14552				if ( default_image && index == 0 ) {
14553					manageVideos($drop, true);
14554					var bgStyle = $drop.css('background-image');
14555					var match = bgStyle && bgStyle.match(/url\(["']?([^"')]+)["']?\)/);
14556					var bg_img = match ? match[1] : null;
14557					var image_ph = new Image();
14558
14559					if (bg_img) {
14560						image_ph.onload = function() {
14561							$drop.addClass('active');
14562							if (default_title) {
14563								$list.addClass('drop-hover');
14564								$tmbs.first().addClass('drop-active');
14565							}
14566						};
14567						image_ph.src = bg_img;
14568					}
14569					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
14570						image_ph.onload = function() {
14571							$drop.addClass('active');
14572							if ( default_title ) {
14573								$list.addClass('drop-hover');
14574								$tmbs.first().addClass('drop-active');
14575							}
14576						};
14577						image_ph.src = bg_img;
14578					}
14579				}
14580			});
14581
14582			if ( $drop_col_parents.length ) {
14583				$col_parent.addClass( 'drop-added' );
14584			}
14585
14586			$drop_col_parents.each(function(index, val){
14587				var $drop = $(this);
14588				$col_parent.prepend($drop);
14589				manageVideos($drop, false);
14590				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
14591					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
14592				}
14593				if ( default_image && index == 0 ) {
14594					manageVideos($drop, true);
14595					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
14596						image_ph = new Image();
14597					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
14598						image_ph.onload = function() {
14599							$drop.addClass('active');
14600							if ( default_title ) {
14601								$list.addClass('drop-hover');
14602								$tmbs.first().addClass('drop-active');
14603							}
14604						};
14605						image_ph.src = bg_img;
14606					}
14607				}
14608			});
14609
14610			function manageVideos( $el, start ) {
14611				var videoElem = $('video', $el),
14612					$iframe = $('iframe', $el),
14613					iframeID = $iframe.attr('id');
14614				if ( videoElem.length ) {
14615					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
14616						if ( start ) {
14617							videoElem[0].setCurrentTime(0);
14618							videoElem[0].play();
14619						} else {
14620							videoElem[0].pause();
14621							videoElem[0].setCurrentTime(0);
14622						}
14623					} else {
14624						if ( start ) {
14625							videoElem[0].currentTime = 0;
14626							videoElem[0].play();
14627						} else {
14628							videoElem[0].pause();
14629							videoElem[0].currentTime = 0;
14630						}
14631					}
14632				}
14633
14634				$el.data('active', start);
14635
14636				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
14637					var iframeIDv = iframeID.replace('okplayer-', ''),
14638						optionsV = $(window).data('okoptions-' + iframeIDv),
14639						vimeo = $iframe[0],
14640						playerV = new Vimeo.Player(vimeo),
14641						timeV = 0;
14642
14643					if (optionsV.time != null) {
14644						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
14645						for ( var i = 0; i < timeArr.length; i++ ) {
14646							if ( timeArr[i] === 'h' ) {
14647								timeV += parseFloat(timeArr[i-1]) * 3600;
14648							} else if ( timeArr[i] === 'm' ) {
14649								timeV += parseFloat(timeArr[i-1]) * 60;
14650							} else if ( timeArr[i] === 's' ) {
14651								timeV += parseFloat(timeArr[i-1]);
14652							}
14653						}
14654					}
14655					playerV.setCurrentTime(timeV);
14656					if ( start ) {
14657						playerV.setVolume(0);
14658						playerV.play();
14659					} else {
14660						playerV.pause();
14661					}
14662				} else if ( $el.attr('data-provider') === 'youtube' ) {
14663					if ( start ) {
14664						$el.trigger('uncode-resume');
14665					} else {
14666						$el.trigger('uncode-pause');
14667					}
14668				}
14669
14670			}
14671
14672			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
14673
14674				document.addEventListener("mousemove", function(e) {
14675					$drop_moves.each(function(){
14676						var $drop_move = $(this),
14677							duration = 0.4;
14678
14679						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
14680							duration = 0.8;
14681						}
14682
14683						clientX = e.clientX;
14684						clientY = e.clientY;
14685
14686						gsap.to( $drop_move, {
14687							duration: duration,
14688							x: clientX,
14689							y: clientY,
14690							ease: Power1.easeOut,
14691						});
14692					});
14693				});
14694
14695			} else {
14696
14697				$(window).on("touchend scroll", function(e) {
14698					$list.removeClass('drop-hover');
14699					$drop_moves.removeClass('active');
14700					$tmbs.removeClass('drop-active');
14701				});
14702
14703				$drop_moves.each(function(){
14704					var $drop_move = $(this),
14705						$tmb = $drop_move.closest('.tmb'),
14706						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
14707
14708					if ( $anim_parent.hasClass('uncode-skew') ) {
14709						$anim_parent.css({
14710							'transform': 'skew(0)'
14711						});
14712					}
14713
14714					$tmb.on('touchend', function(e){
14715						e.stopPropagation();
14716
14717						$drop_moves.removeClass('active');
14718						$tmbs.removeClass('drop-active');
14719
14720						$list.addClass('drop-hover');
14721						$tmb.addClass('drop-active');
14722						$drop_move.addClass('active');
14723						manageVideos($drop_move, true);
14724						clientX = e.changedTouches[0].clientX;
14725						clientY = e.changedTouches[0].clientY;
14726
14727						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14728							var bound = $anim_parent[0].getBoundingClientRect();
14729							clientX = clientX - bound.x;
14730							clientY = clientY - bound.y;
14731						}
14732
14733						$drop_move.css({
14734							left: clientX,
14735							top: clientY
14736						});
14737					});
14738				});
14739
14740			}
14741
14742			$tmbs.each(function(e){
14743				var $tmb = $(this),
14744					// $trgr = $('a', $tmb),
14745					$trgr = $tmb,
14746					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
14747					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
14747(.t-inside), .parallax-el'),
14748					$video = $('video', $tmb),
14749					$iframe = $('iframe', $tmb),
14750					$entryTxt = $('.t-entry-text', $tmb),
14751					stopBounding;
14752
14753				$entryTxt.add($drop_move).css({
14754					'transition-duration': timing + 's'
14755				});
14756
14757				if ( $video.length ) {
14758					var vidH = $video[0].videoHeight,
14759						vidW = $video[0].videoWidth;
14760					$video.css({
14761						'height': vidH,
14762						'width': vidW
14763					});
14764				}
14765
14766				if ( $iframe.length ) {
14767					var vidH = $drop_move.attr('data-height'),
14768						vidW = $drop_move.attr('data-width');
14769					$iframe.css({
14770						'height': vidH,
14771						'width': vidW
14772					});
14773				}
14774
14775				$iframe.each(function(){
14776					var $video = $(this),
14777						vidH = $video[0].videoHeight,
14778						vidW = $video[0].videoWidth;
14779					$video.css({
14780						'height': vidH,
14781						'width': vidW
14782					});
14783				});
14784
14785				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
14786					$trgr.on('mouseenter',function(e){
14787
14788						$list.addClass('drop-hover');
14789						$tmbs.removeClass('drop-active');
14790						$tmb.addClass('drop-active');
14791						$drop_move.addClass('active');
14792						manageVideos($drop_move, true);
14793
14794						var clientX = e.clientX,
14795							clientY = e.clientY;
14796						$drop_move.css({
14797							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
14798						});
14799
14800					})
14801					.on('mouseleave', function(e){
14802						$list.removeClass('drop-hover');
14803						$drop_move.css({
14804							'transition-duration': ( timing*1.25 ) + 's'
14805						});
14806						$drop_move.removeClass('active');
14807						$tmb.removeClass('drop-active');
14808						$drop_move.on('transitionend', function(e){
14809							$drop_move.off('transitionend');
14810							$drop_move.css({
14811								'transition-duration': timing + 's'
14812							});
14813							manageVideos($drop_move,false);
14814						});
14815					});
14816
14817					document.addEventListener('visibilitychange', function(){
14818						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
14819							$drop_move.css({
14820								'transition-duration': '0s'
14821							});
14822							$drop_move.removeClass('active');
14823							manageVideos($drop_move, false);
14824						}
14825					});
14826
14827					document.addEventListener('scroll', function(){
14828						window.clearRequestTimeout( stopBounding );
14829						if ( stoppedScrolling ) {
14830							stoppedScrolling = false;
14831							if ( $drop_move.hasClass('active') ) {
14832								$list.removeClass('drop-hover');
14833								$tmbs.removeClass('drop-active');
14834								$drop_move.removeClass('active');
14835								$drop_move.on('transitionend', function(e){
14836									$drop_move.off('transitionend');
14837									$drop_move.css({
14838										'transition-duration': timing + 's'
14839									});
14840									manageVideos($drop_move,false);
14841								});
14842							}
14843						}
14844
14845						stopBounding = requestTimeout(function() {
14846							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
14847								var bound = $anim_parent[0].getBoundingClientRect();
14848								$drop_move.css({
14849									left: bound.x * -1,
14850									top: bound.y * -1,
14851								});
14852							}
14853							stoppedScrolling = true;
14854						}, 500);
14855					});
14856				}
14857
14858				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
14859					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
14860
14861				$drop.css({
14862					'transition-duration': timing + 's'
14863				});
14864
14865				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
14866					$trgr.on('mouseenter',function(e){
14867						$row_parent.add($col_parent).addClass('drop-list-loaded');
14868						$list.addClass('drop-hover');
14869
14870						if ( !$tmb.hasClass('drop-active') ) {
14871							$tmbs.removeClass('drop-active');
14872							$tmb.addClass('drop-active');
14873							if ( default_image && !$drop.hasClass('active') ) {
14874								var $prev = $('[data-drop].active', $row_parent);
14875								$prev.css({
14876									'transition-duration': (timing*1.5) + 's'
14877								});
14878								$prev.removeClass('active');
14879								$prev.on('transitionend', function(e){
14880									$prev.off('transitionend');
14881									manageVideos($prev,false);
14882								});
14883							}
14884							$drop.css({
14885								'transition-duration': timing + 's'
14886							});
14887							$drop.off('transitionend');
14888							$drop.addClass('active');
14889							manageVideos($drop, true);
14890						}
14891					})
14892					.on('mouseleave', function(e){
14893						if ( ( default_image && !default_title ) || !default_image ) {
14894							$list.removeClass('drop-hover');
14895							$tmb.removeClass('drop-active');
14896						}
14897						if ( ! default_image ) {
14898							$drop.css({
14899								'transition-duration': (timing*1.5) + 's'
14900							});
14901							$drop.removeClass('active');
14902
14903							$drop.on('transitionend', function(e){
14904								$drop.off('transitionend');
14905								manageVideos($drop,false);
14906							});
14907						}
14908					});
14909
14910					document.addEventListener('visibilitychange', function(){
14911						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
14912							$drop.css({
14913								'transition-duration': '0s'
14914							});
14915							$drop.removeClass('active');
14916							manageVideos($drop, false);
14917						}
14918					});
14919				}
14920			});
14921
14922		});
14923	};
14924
14925	$(window).on('load', function(event) {
14926		imageHover();
14927	});
14928
14929	var drop_wp_animation = function() {
14930		var $postLists = $('.uncode-post-titles');
14931		$postLists.each(function(){
14932			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
14933				new Waypoint({
14934					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
14935					element: val,
14936					handler: function() {
14937						var element = $(this.element),
14938							parent = element.closest('.tmb'),
14939							currentIndex = parent.index(),
14940							delay = currentIndex,
14941							delayAttr = parseInt(element.attr('data-delay'));
14942						if (isNaN(delayAttr)) delayAttr = 100;
14943						var objTimeout = requestTimeout(function() {
14944							element.addClass('start_animation');
14945
14946							var nextTimeout = requestTimeout(function() {
14947								$('.drop-image-separator', parent).addClass('start_animation');
14948							}, 50);
14949
14950						}, delay * delayAttr);
14951						if (!UNCODE.isUnmodalOpen) {
14952							this.destroy();
14953						}
14954					},
14955					offset: UNCODE.isFullPage ? '100%' : '90%'
14956				})
14957			});
14958		});
14959	}
14960
14961	var runWaypoints_TO,
14962		runWaypoints_delay = 0;
14963
14964	var runWaypoints = function(){
14965		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
14966			runWaypoints_delay = 400;
14967		}
14968		clearRequestTimeout(runWaypoints_TO);
14969		runWaypoints_TO = requestTimeout(function() {
14970			drop_wp_animation();
14971		}, runWaypoints_delay);
14972	};
14973	runWaypoints();
14974	$( document.body ).on( 'uncode_waypoints', runWaypoints );
14975	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
14976		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
14977			// imageHover();
14978			runWaypoints();
14979		});
14980	}
14981};
14982
14983UNCODE.postTable = function() {
14984
14985	var clickRow = function(){
14986		var $postLists = $('.uncode-post-table');
14987
14988		$postLists.each(function(){
14989			var $postList = $(this),
14990				$tmbClicks = $('.tmb.tmb-click-row', $postList);
14991
14992			$tmbClicks.each(function(){
14993				var $tmb = $(this),
14994					$click = $('.table-click-row', $tmb);
14995				$('*:not(.table-click-row)', $tmb).on('click', function(e){
14996					e.preventDefault();
14997					e.stopPropagation();
14998					$click[0].click();
14999					return false;
15000				});
15001			});
15002
15003		})
15004	};
15005
15006	clickRow();
15007
15008	var hoverRow = function(){
15009		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
15010
15011		$postLists.on('mouseenter', function(){
15012			$(this).addClass('post-table-hover');
15013		});
15014		$postLists.on('mouseleave', function(){
15015			$(this).removeClass('post-table-hover');
15016		});
15017	}
15018
15019	hoverRow();
15020
15021	var drop_wp_animation = function() {
15022		var $postLists = $('.uncode-post-table');
15023		$postLists.each(function(){
15024			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
15025				new Waypoint({
15026					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
15027					element: val,
15028					handler: function() {
15029						var element = $(this.element),
15030							parent = element.closest('.tmb'),
15031							currentIndex = parent.index(),
15032							delay = currentIndex,
15033							delayAttr = parseInt(element.attr('data-delay'));
15034						if (isNaN(delayAttr)) delayAttr = 100;
15035						var objTimeout = requestTimeout(function() {
15036							element.addClass('start_animation');
15037						}, delay * delayAttr);
15038						if (!UNCODE.isUnmodalOpen) {
15039							this.destroy();
15040						}
15041					},
15042					offset: UNCODE.isFullPage ? '100%' : '90%'
15043				})
15044			});
15045		});
15046	}
15047
15048	var runWaypoints_TO,
15049		runWaypoints_delay = 0;
15050
15051	var runWaypoints = function(){
15052		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
15053			runWaypoints_delay = 400;
15054		}
15055		clearRequestTimeout(runWaypoints_TO);
15056		runWaypoints_TO = requestTimeout(function() {
15057			drop_wp_animation();
15058		}, runWaypoints_delay);
15059	};
15060	runWaypoints();
15061	$( document.body ).on( 'uncode_waypoints', runWaypoints );
15062	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
15063		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
15064			runWaypoints();
15065			// clickRow();
15066		});
15067	}
15068};
15069
15070UNCODE.rotatingTxt = function($ctxt) {
15071
15072	if ( $('body').hasClass('compose-mode') ) {
15073		return;
15074	}
15075
15076	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
15077	var setCTA;
15078
15079	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
15080		var $heading = $(this),
15081			// debug = 0,
15082			cycle = 0,
15083			$trgt,
15084			$toMove,
15085			$highl,
15086			$col = $heading.closest('.uncont'),
15087			txt,
15088			arrTxt,
15089			textFadeIn, textFadeOut,
15090			removeWraps;
15091
15092		var defineObjs = function() {
15093			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
15094				var $rtx = $(this),
15095					fx = $rtx.attr('data-fx'),
15096					wait = $rtx.attr('data-wait'),
15097					$prev = $(this).prev().addClass('prev-rotating-start'),
15098					splitToMove = [],
15099					splitArray = [],
15100					lineArray = [],
15101					lineIndex = 0,
15102					lineStart = true,
15103					lineEnd = false,
15104					startSplit = false,
15105					$line_wrap = $rtx.closest('.heading-line-wrap'),
15106					same_line = true,
15107					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
15108					indexRtx = $splits.index($rtx);
15109
15110				fx = typeof fx === 'undefined' ? '' : fx;
15111				wait = typeof wait === 'undefined' ? '' : wait;
15112
15113				$splits.each(function(key, val){
15114					var $split = $(this),
15115						$new_line_wrap = $split.closest('.heading-line-wrap');
15116
15117					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
15118						splitArray.push( $split );
15119					}
15120
15121					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
15122						startSplit = false;
15123					}
15124
15125					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
15126						splitArray.push( $split );
15127
15128						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
15129							same_line = true;
15130						} else {
15131							same_line = false;
15132						}
15133					}
15134
15135					if ( key == indexRtx ) {
15136						if ( /\S/.test($split.text()) ) {
15137							startSplit = true;
15138							$line_wrap = $split.closest('.heading-line-wrap');
15139							splitArray.push( $split );
15140						} else {
15141							indexRtx++;
15142						}
15143					}
15144
15145					$line_wrap = $new_line_wrap;
15146				});
15147
15148				$toMove = $($.map(splitToMove, function(el){return el.get();}));
15149				$trgt = $($.map(splitArray, function(el){return el.get();}));
15150
15151				if ( same_line ) {
15152					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
15153					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
15154				}
15155
15156				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
15157					$prev.addClass('empty-span-hidden');
15158				}
15159
15160				$highl = $('.heading-text-highlight-inner', $trgt);
15161
15162				$rtx.attr('data-animated', 'true');
15163				if ( cycle == 0 ) {
15164					$( document.body ).trigger('defer-highlights');
15165					cycle++;
15166					defineObjs();
15167					return;
15168				}
15169				cycle++;
15170
15171				txt = $rtx.attr('data-text');
15172				arrTxt = txt.split("|");
15173
15174				textFadeOut($trgt);
15175
15176			});
15177		};
15178
15179		removeWraps = function(){
15180
15181			// if ( debug == 1 ) return;
15182			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
15183			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
15184
15185
15186				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
15187					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
15188
15189				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
15190
15191				$splitFlow.each(function(){
15192					$(this).append($temp_highl);
15193				});
15194
15195				var $line_wrap = $wraps[wrap_k];
15196				var $parent_wrap = $line_wrap.parentNode;
15197				if ( $parent_wrap !== null ) {
15198					while ( $line_wrap.firstChild ) {
15199						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
15200					}
15201					$parent_wrap.removeChild($line_wrap);
15202				}
15203			}
15204			// debug++;
15205			defineObjs();
15206		};
15207
15208		var loop = 0;
15209		textFadeIn = function($trgt){
15210			var word = arrTxt[loop].split(" "),
15211				worsSpan = '',
15212				$wrap = $trgt.closest('.uncode-rotating-wrap'),
15213				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
15214				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
15215
15216			for (var w = 0; w < word.length; w++) {
15217				var highl;
15218				if ( $highl.length ) {
15219					highl = $highl[0].outerHTML;
15220				} else {
15221					highl = '';
15222				}
15223
15224				if ( w > 0 ) {
15225					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
15226				}
15227				var charachters = word[w].split('');
15228				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
15229				if ( ! SiteParameters.uncode_has_ligatures ) {
15230					for (var c = 0; c < charachters.length; c++) {
15231						worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
15232					}
15233				} else {
15234					worsSpan += word[w];
15235				}
15236				worsSpan += '</span>' + highl + '</span></span>';
15237			}
15238
15239			if ( $wrap.length && $wrap_inner.length ) {
15240				var words_w = $wrap_inner.outerWidth();
15241				$wrap.css({
15242					width: words_w
15243				});
15244
15245				$highl = $('.heading-text-highlight-inner', $wrap);
15246				$highl.prependTo($wrap);
15247
15248				$wrap_inner.css({
15249					opacity: 0
15250				});
15251
15252				$wrap_inner.html(worsSpan);
15253				$('.heading-text-highlight-inner', $wrap_inner).remove();
15254				words_w = $wrap_inner.innerWidth();
15255
15256				var duration = 0.45;
15257
15258				$heading.removeClass('auto-width');
15259				if ( words_w > $col.width() ) {
15260					$heading.addClass('auto-width');
15261					words_w = 'auto';
15262					duration = 0;
15263				}
15264
15265				$wrap.css({
15266					'width': words_w,
15267					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
15268				});
15269
15270				var $word_inner = $('.split-word-inner', $wrap_inner),
15271					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
15272
15273				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
15274
15275				if ( !$target_fx.length ) {
15276					return;
15277				}
15278
15279				gsap.killTweensOf($target_fx);
15280
15281				if ( fx !== 'zoom' ) {
15282					gsap.fromTo( $target_fx, {
15283						y: fx === 'opacity' ? '0%' : '-10%'
15284					},{
15285						delay: duration,
15286						duration: 0.25,
15287						y: '0%',
15288						ease: Circ.easeOut,
15289					});
15290
15291					if ( !$wrap_inner.length ) {
15292						return;
15293					}
15294
15295					gsap.fromTo( $wrap_inner, {
15296						opacity: 0,
15297					},{
15298						delay: duration,
15299						duration: 0.25,
15300						opacity: 1,
15301						ease: Circ.easeOut,
15302						onComplete: function(){
15303							$('> .heading-text-highlight-inner', $wrap).remove();
15304							$wrap_inner.html(worsSpan);
15305							removeWraps();
15306						}
15307					})
15308
15309				} else {
15310					gsap.fromTo( $target_fx, {
15311						transformOrigin: '50%',
15312						opacity: 0,
15313						scale: 0.875,
15314					},{
15315						opacity: 1,
15316						delay: duration,
15317						duration: 0.25,
15318						scale: 1,
15319						ease: Circ.easeOut,
15320						onComplete: function(){
15321							$('> .heading-text-highlight-inner', $wrap).remove();
15322							$wrap_inner.html(worsSpan);
15323							removeWraps();
15324						}
15325					});
15326				}
15327
15328			} else {
15329
15330				if ( !$wrap_inner.length ) {
15331					return;
15332				}
15333
15334				gsap.to( $wrap_inner, {
15335					duration: 0.4,
15336					opacity: 0,
15337					ease: Power1.easeOut,
15338					onComplete: function(){
15339						$wrap_inner.html(worsSpan);
15340						words_w = $wrap_inner.innerWidth();
15341
15342						gsap.to( $wrap_inner, {
15343							duration: 0.2,
15344							opacity: 1,
15345							ease: Power1.easeOut,
15346							onComplete: function(){
15347								$('> .heading-text-highlight-inner', $wrap).remove();
15348								$wrap_inner.html(worsSpan);
15349								removeWraps();
15350							}
15351						})
15352					}
15353				});
15354			}
15355
15356			if ( loop < arrTxt.length-1 ) {
15357				loop++;
15358			} else {
15359				loop = 0;
15360			}
15361
15362		};
15363
15364		textFadeOut = function($trgt){
15365			var $word_inner = $('.split-word-inner', $trgt),
15366				$wrap = $trgt.closest('.uncode-rotating-wrap'),
15367				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
15368				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
15369				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
15370
15371			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
15372
15373			var gsap_param = {
15374					delay: wait,
15375					duration: 0.25,
15376					y: fx === '' ? '10%' : '0%',
15377					opacity: 0,
15378					ease: Circ.easeOut,
15379					onStart: function(){
15380						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
15381							$highl = $('.heading-text-highlight-inner', $wrap);
15382							$highl.prependTo($wrap);
15383						}
15384					},
15385					onComplete: textFadeIn,
15386					onCompleteParams: [$trgt]
15387				};
15388
15389			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
15390
15391			if ( fx === '' ) {
15392				gsap_param.y = '10%';
15393			} else if ( fx === 'zoom' ) {
15394				gsap_param.scale = '1.045';
15395			}
15396
15397			if ( !$target_fx.length ) {
15398				return;
15399			}
15400
15401			if ( $heading.data('waypoint') !== true ) {
15402				var textInView = new Waypoint.Inview({
15403					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
15404					element: $heading[0],
15405					enter: function(direction) {
15406						$heading.data('waypoint',true);
15407						gsap.fromTo( $target_fx, {
15408							transformOrigin: '50%'
15409						}, gsap_param );
15410					}
15411				});
15412			} else {
15413				gsap.fromTo( $target_fx, {
15414					transformOrigin: '50%'
15415				}, gsap_param );
15416			}
15417		};
15418
15419		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
15420			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
15421				var $el = model.view.$el,
15422					shortcode = model.attributes.shortcode;
15423
15424				UNCODE.rotatingTxt($el);
15425			});
15426		} else {
15427			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
15428				$heading.on('already-animated', function(){
15429					removeWraps();
15430					window.addEventListener('removeOldLines', function(){
15431						clearRequestTimeout(setCTA);
15432						setCTA = requestTimeout( removeWraps, 150 );
15433					});
15434				});
15435			} else {
15436				$(window).on('load', function(){
15437					removeWraps();
15438					window.addEventListener('removeOldLines', function(){
15439						clearRequestTimeout(setCTA);
15440						setCTA = requestTimeout( removeWraps, 150 );
15441					});
15442				});
15443			}
15444		}
15445	});
15446
15447};
15448
15449UNCODE.verticalText = function() {
15450	$(window).on('menuCanvasOpen', function(){
15451		$('.vertical-text--fixed').fadeOut(500);
15452		$('.horizontal-text--fixed').fadeOut(500);
15453	}).on('menuCanvasClose', function(){
15454		$('.vertical-text--fixed').fadeIn(500);
15455		$('.horizontal-text--fixed').fadeIn(500);
15456	});
15457
15458	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
15459	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
15460	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
15461	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
15462
15463	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
15464		window.addEventListener('scroll', function(e) {
15465			var totalPageHeight = document.body.scrollHeight;
15466			var scrollPoint = window.scrollY + window.innerHeight;
15467
15468			if (window.scrollY > 0) {
15469				showOnTopVerticalTexts.fadeOut();
15470				showOnTopHorizontalTexts.fadeOut();
15471			} else {
15472				showOnTopVerticalTexts.fadeIn();
15473				showOnTopHorizontalTexts.fadeIn();
15474			}
15475
15476			if (scrollPoint >= totalPageHeight) {
15477				hideOnBottomVerticalTexts.fadeOut();
15478				hideOnBottomHorizontalTexts.fadeOut();
15479			} else {
15480				hideOnBottomVerticalTexts.fadeIn();
15481				hideOnBottomHorizontalTexts.fadeIn();
15482			}
15483		}, false);
15484	}
15485};
15486
15487UNCODE.stickyScroll = function( $el ) {
15488	if ( typeof $el === 'undefined' || $el === null ) {
15489		$el = $('body');
15490	}
15491	var checkVisible = function( el, dir ) {
15492		if (typeof jQuery === "function" && el instanceof jQuery) {
15493			el = el[0];
15494		}
15495
15496		var off = 50;
15497		dir = typeof dir=='undefined' ? 'right' : dir;
15498		var rect = el.getBoundingClientRect();
15499
15500		return (
15501			(
15502				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
15503				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
15504				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
15505			) &&
15506			(
15507				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
15508				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
15509				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
15510				( rect.right <= window.innerWidth && rect.left >= 0 )
15511			)
15512		);
15513	};
15514
15515	var setItemsRelHeight = function(reset) {
15516		var $_el = $el;
15517		if ( $el.is('.index-scroll') ) {
15518			var $_el = $el.closest('.uncont');
15519		}
15520		// $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
15521		// 	$.each($('.tmb', item), function(index, val) {
15522		// 		if ( reset === true ) {
15523		// 			$(val).css( 'visibility', 'hidden' );
15524		// 		} else {
15525		// 			$(val).css( 'visibility', 'visible' );
15526		// 		}
15527		// 	});
15528		// });
15529		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
15530			$.each($('.tmb', item), function(index, val) {
15531				if ( reset === true ) {
15532					$(val).css( 'visibility', 'hidden' );
15533					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
15534				} else {
15535					var $rowParent = $(item).closest('.row-parent'),
15536						rowRatio = $rowParent.attr('data-height-ratio'),
15537						$rowInner = $(item).closest('.row-child'),
15538						rowRatioInner = $rowInner.attr('data-height'),
15539						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
15540						$colContainer = $(item).closest('.uncell'),
15541						$uncont = $(item).closest('.uncont'),
15542						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
15543						safe_heigth = $(item).data('safe-height'),
15544						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
15545						offSet = $(item).offset().top - $uncont.offset().top,
15546						multiplier_h,
15547						data_viewport_h,
15548						body_border = $('.body-borders .top-border').outerHeight() * 2,
15549						remove_menu = $(item).data('vp-menu');
15550
15551					if ( rowRatio === 'full' || rowRatio === '' ) {
15552						rowRatio = 1;
15553					} else {
15554						rowRatio = rowRatio / 100;
15555					}
15556
15557					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
15558						rowRatio = rowRatio;
15559					} else {
15560						rowRatio = rowRatio * rowRatioInner / 100;
15561					}
15562
15563					winHeight = winHeight * rowRatio;
15564
15565					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
15566						multiplier_h = parseInt($(item).attr('data-vp-height'));
15567					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
15568						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
15569					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
15570						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
15571					}
15572
15573					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
15574						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
15575						if ( remove_menu === true ) {
15576							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
15577						}
15578						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
15579					} else {
15580						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
15581					}
15582
15583				}
15584			});
15585		});
15586		$('.index-scroll', $_el).each(function(i, item){
15587			var $uncoltable = $(item).closest('.uncoltable'),
15588				$rowParent = $(item).closest('.row-parent'),
15589				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
15590				body_border = $('.body-borders .top-border').outerHeight() * 2,
15591				$index_row = $('.index-row', item),
15592				safe_heigth = $index_row.data('safe-height'),
15593				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
15594			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
15595				var data_viewport_h = winHeight - ( paddingRow + body_border );
15596				$uncoltable.css({
15597					'min-height': data_viewport_h
15598				});
15599			} else {
15600				$uncoltable.css({
15601					'min-height': 'auto'
15602				});
15603			}
15604		});
15605
15606	}
15607	setItemsRelHeight();
15608
15609	var $index_scrolls = $('.index-scroll', $el);
15610
15611	$index_scrolls.each(function(key, value){
15612		var $index = $(this),
15613			$parent_row = $index.closest('.vc_row[data-parent]'),
15614			$index_row = $('.index-row', $index),
15615			dir = $index_row.attr('data-direction');
15616		dir = typeof dir === 'undefined' ? 'right' : dir;
15617
15618		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
15619
15620		if ( $('.animate_when_almost_visible', $index).length ) {
15621			$index.addClass('opacity_0').addClass('scroll-refresh-hidden');
15622		}
15623
15624	});
15625
15626	var $horScrolls = $('.unscroll-horizontal', $el);
15627
15628	if ( $horScrolls.length ) {
15629
15630		$('body').addClass('scrolling-trigger');
15631
15632		$horScrolls.each(function(key, value){
15633			var $section = $(this),
15634				$index_scroll = $('.index-scroll', $section),
15635				$index_row = $('.index-row', $index_scroll),
15636				dir = $section.attr('data-direction'),
15637				wrap = $index_row.attr('data-wrap'),
15638				$pinWrap,
15639				$pinTrigger;
15640
15641			dir = typeof dir === 'undefined' ? 'right' : dir;
15642			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
15643			$pinWrap = $('<div class="pin-wrap" />');
15644			if ( SiteParameters.is_frontend_editor ) {
15645				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
15646				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
15647			} else {
15648				if ( wrap === 'column' ) {
15649					$index_scroll.wrapInner( $pinWrap );
15650				} else {
15651					$('> .row', $section).wrap( $pinWrap );
15652				}
15653				$section.wrapInner( $pinTrigger );
15654			}
15655
15656		});
15657
15658		var $pinWraps = $('.pin-wrap', $el);
15659
15660		var horScrollSizes = function(){
15661
15662			$pinWraps.each(function(key, val){
15663				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
15664					$pinTrigger = $pinWrap.closest('.pin-trigger'),
15665					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
15666					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
15667					$boxContainer = $('.box-container'),
15668					box_m = $boxContainer.css('margin-left'),
15669					st_active = true;
15670
15671				var setHorW,
15672				horWidth = function(){
15673					$index_scroll.each(function(){
15674						var $this = $(this),
15675							$index_row = $('.index-row', $this),
15676							$rowContainer = $index_row.closest('.vc_row'),
15677							$rowInner = $index_row.closest('.wpb_row'),
15678							$rowParent = $index_row.closest('.row-parent'),
15679							$tmbs = $('.tmb', $index_row),
15680							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
15681							$uncont = $index_row.closest('.uncont'),
15682							$parent_col = $index_row.closest('.wpb_column'),
15683							col_w = $uncont.width(),
15684							data_lg = parseFloat( $index_row.attr('data-lg') ),
15685							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
15686							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
15687							tmb_w;
15688
15689						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
15690						tmb_w = ( col_w + padding_tmb ) / data_lg;
15691
15692						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
15693							tmb_w = ( col_w + padding_tmb ) / data_sm;
15694						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
15695							tmb_w = ( col_w + padding_tmb ) / data_md;
15696						}
15697
15698						if ( !isNaN(tmb_w) ) {
15699							$tmbs.css({
15700								'width': tmb_w
15701							});
15702						}
15703
15704						$tmbs.css({
15705							'visibility': 'visible'
15706						});
15707
15708					});
15709				};
15710
15711				horWidth();
15712				clearRequestTimeout(setHorW);
15713				setHorW = requestTimeout( function(){
15714					setItemsRelHeight();
15715					horWidth();
15716				}, 100 );
15717
15718				if ( SiteParameters.is_frontend_editor ) {
15719					return;
15720				}
15721
15722				var $vmenu = $('body.vmenu .vmenu-container'),
15723					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
15724					winWidth = window.innerWidth - vmenuW,
15725					$tmb = $('.tmb', $index_scroll).eq(0),
15726					paddingRight = parseFloat( $tmb.css('padding-right') ),
15727					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_
15727scroll.width() + paddingRight ) ),
15728					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
15729					scroll_anim;
15730
15731				if ( $('body').hasClass('rtl') ) {
15732					if ( dir === 'left' ) {
15733						scroll_anim = gsap.fromTo( $pinWrap, {
15734							x: stickyScrollLength
15735						},{
15736							x: 0,
15737							ease: "none"
15738						});
15739					} else {
15740						scroll_anim = gsap.fromTo( $pinWrap, {
15741							x: 0
15742						},{
15743							x: stickyScrollLength,
15744							ease: "none"
15745						});
15746					}
15747				} else {
15748					if ( dir === 'left' ) {
15749						scroll_anim = gsap.fromTo( $pinWrap, {
15750							x: -stickyScrollLength
15751						},{
15752							x: 0,
15753							ease: "none"
15754						});
15755					} else {
15756						scroll_anim = gsap.fromTo( $pinWrap, {
15757							x: 0
15758						},{
15759							x: -stickyScrollLength,
15760							ease: "none"
15761						});
15762					}
15763				}
15764
15765				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
15766					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
15767				}
15768
15769				var animationIncrease;
15770
15771				var checkForAnimations = function(){
15772					animationIncrease = 0
15773					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
15774						var _this = this;
15775						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
15776							var delayAttr = parseFloat( $(_this).attr('data-delay') );
15777							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
15778							requestTimeout(function() {
15779								$(_this).addClass('start_animation');
15780							}, delayAttr + animationIncrease);
15781							animationIncrease += 150;
15782						}
15783						$(_this).on([
15784							'webkitAnimationEnd',
15785							'mozAnimationEnd',
15786							'MSAnimationEnd',
15787							'oanimationend',
15788							'animationend'
15789						].join(' '), function(e) {
15790							$(e.currentTarget).removeClass('animate_when_almost_visible');
15791						});
15792					});
15793
15794					var batchTime = 0;
15795
15796					var resetBatch = function(){
15797						batchTime = 0;
15798					}
15799
15800					if (ScrollTrigger.isScrolling()) {
15801						resetBatch();
15802					}
15803					
15804					$('.tmb-mask-reveal', $pinTrigger).each(function(){
15805						var _this = this,
15806							$this = $(_this),
15807							$inside = $('.t-inside', $this),
15808							delay = parseFloat( $inside.attr('data-delay') ),
15809							speed = parseFloat( $inside.attr('data-speed') ),
15810							easing = $inside.attr('data-easing'),
15811							bgDelay = parseFloat( $inside.attr('data-bg-delay') );
15812
15813						delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
15814						speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
15815						easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
15816						bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
15817
15818						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) {
15819							$this.addClass('tmb-mask-init');
15820							if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) {
15821								gsap.to($('.t-entry-visual-tc', $this), speed, {
15822									clipPath: 'inset(0% 0% 0% 0%)',
15823									delay: delay + batchTime,
15824									ease: easing,
15825								});
15826								gsap.to($('.t-entry-visual-cont', $this), speed, {
15827									clipPath: 'inset(0% 0% 0% 0%)',
15828									scale: 1,
15829									delay: delay + batchTime + (speed*bgDelay),
15830									ease: easing,
15831									onComplete: resetBatch,
15832								});
15833							} else {
15834								gsap.to($('.t-entry-visual-cont', $this), speed, {
15835									clipPath: 'inset(0% 0% 0% 0%)',
15836									scale: 1,
15837									delay: delay + batchTime,
15838									ease: easing,
15839									onComplete: resetBatch,
15840								});
15841							}
15842							batchTime += 0.1;
15843						}
15844					});
15845				
15846				};
15847				checkForAnimations();
15848
15849				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
15850				var start = 0;
15851
15852				var horST = ScrollTrigger.create({
15853					id: "stickySectionScrolling" + key,
15854					scrub: true,
15855					trigger: $pinTrigger[0],
15856					pin: true,
15857					anticipatePin: 1,
15858					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
15859					end: function() { return "+="+stickyScrollLength; },
15860					animation: scroll_anim,
15861					ease: Sine.easeOut,
15862					onUpdate: checkForAnimations,
15863					invalidateOnRefresh: true,
15864					onEnter: function(){
15865						$pinTrigger.addClass('enter-st');
15866					},
15867					onEnterBack: function(){
15868						$pinTrigger.addClass('enter-st');
15869					},
15870					onLeave: function(){
15871						$pinTrigger.removeClass('enter-st');
15872					},
15873					onLeaveBack: function(){
15874						$pinTrigger.removeClass('enter-st');
15875					}
15876				});
15877
15878				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
15879				window.dispatchEvent(new CustomEvent('boxResized'));
15880
15881				var testSecondTrigger = function(){
15882					animationIncrease = 0
15883					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
15884						var _this = this;
15885						if ( checkVisible(_this) ) {
15886							var delayAttr = parseFloat( $(_this).attr('data-delay') );
15887							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
15888							requestTimeout(function() {
15889								$(_this).addClass('start_animation');
15890							}, delayAttr + animationIncrease);
15891							animationIncrease += 150;
15892						}
15893					});
15894
15895				};
15896
15897				var verST = ScrollTrigger.create({
15898					id: "verticalSectionScrolling" + key,
15899					trigger: $pinTrigger[0],
15900					start: "top center",
15901					end: function() { return "+="+UNCODE.wheight; },
15902					onUpdate: testSecondTrigger,
15903					invalidateOnRefresh: true
15904				});
15905
15906				var setCTA,
15907
15908				dis_enable_ST = function(){
15909					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
15910						horST.kill();
15911						verST.kill();
15912						$pinTrigger.addClass('disabled');
15913						st_active = false;
15914					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
15915						horST.kill();
15916						verST.kill();
15917						$pinTrigger.addClass('disabled');
15918						st_active = false;
15919					}
15920				};
15921
15922				$(window).on('resize load', function() {
15923					clearRequestTimeout(setCTA);
15924					setCTA = requestTimeout(function() {
15925						dis_enable_ST();
15926						checkForAnimations();
15927					}, 500);
15928				});
15929
15930			});
15931		};
15932
15933		$(window).on( 'load', function(){
15934			horScrollSizes();
15935		});
15936		var setResize,
15937			setReLayout,
15938			doubleResize = true;
15939		$(window).on( 'load', function(){
15940			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
15941				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
15942				Array.prototype.forEach.call($row_inners, function(el) {
15943					el.style.height = '';
15944					el.style.marginBottom = '';
15945				});
15946				setItemsRelHeight();
15947				horScrollSizes();
15948				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
15949					$(document).trigger('uncode-scrolltrigger-refresh');
15950				}
15951			}
15952			var carousel = document.querySelector(".owl-carousel"),
15953				grid = document.querySelector(".isotope-container"),
15954				stickyAll = document.querySelectorAll(".index-scroll");
15955
15956			if ( stickyAll.length ) {
15957				var sticky = stickyAll[(stickyAll.length-1)];
15958			}
15959
15960			if ( typeof sticky !== "undefined" ) {
15961
15962				if ( typeof carousel !== "undefined" && carousel !== null ) {
15963					var carousel_position = sticky.compareDocumentPosition(carousel);
15964				}
15965				if ( typeof grid !== "undefined" && grid !== null ) {
15966					var grid_position = sticky.compareDocumentPosition(grid);
15967				}
15968
15969				if ( carousel_position === 2 || grid_position === 2 ) {
15970					setTimeout(function(){
15971						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
15972							$(document).trigger('uncode-scrolltrigger-refresh');
15973						}
15974					}, 500);
15975				}
15976
15977			}
15978			
15979		});
15980        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
15981            android = /Android/.test(navigator.userAgent) && !window.MSStream;
15982		$(window).on( 'resize orientationchange', function(e){
15983			if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
15984				return;
15985			}
15986			setItemsRelHeight(true);
15987			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
15988			Array.prototype.forEach.call($row_inners, function(el) {
15989				el.style.height = '';
15990				el.style.marginBottom = '';
15991			});
15992			clearRequestTimeout(setResize);
15993			setResize = requestTimeout( function(){
15994				setItemsRelHeight();
15995				horScrollSizes();
15996				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
15997					$(document).trigger('uncode-scrolltrigger-refresh');
15998				}
15999				if ( doubleResize === true ) {
16000					window.dispatchEvent(new Event('resize'));
16001					doubleResize = false;
16002				} else {
16003					doubleResize = true;
16004				}
16005				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
16006			}, 100 );
16007		});
16008
16009		var show_pins = function(){
16010			$('.index-scroll').css({'opacity':'1'});
16011		};
16012		ScrollTrigger.addEventListener("refresh", show_pins);
16013		$(window).on( 'uncode.re-layout', function(){
16014			//$('.index-scroll').css({'opacity':'0'});
16015			$('.pin-spacer').each(function(){
16016				var space_h = $(this).outerHeight(),
16017					$row = $(this).closest('.row-container');
16018				$row.css({
16019					'height': space_h,
16020					'overflow': 'hidden'
16021				});
16022			});
16023			if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
16024				ScrollTrigger.refresh(true);
16025			}
16026			clearRequestTimeout(setReLayout);
16027			setReLayout = requestTimeout( function(){
16028				$('.row-container').each(function(){
16029					$(this).css({
16030						'height': '',
16031						'overflow': ''
16032					});
16033				});
16034			}, 1000);
16035		});
16036	}
16037
16038};
16039
16040UNCODE.stickyTrigger = function($el) {
16041	if (SiteParameters.is_frontend_editor) {
16042		return false;
16043	}
16044
16045	var resizeTimer;
16046	var oldW = UNCODE.wwidth;
16047	var stickyObservers = [];
16048	var stickyInstances = [];
16049	var isRefreshing = false;
16050	var pendingRefresh = false;
16051	var lastStickyMetrics = {
16052		rowH: 0,
16053		uncontH: 0
16054	};
16055
16056	function clearStickyInstances() {
16057		stickyInstances.forEach(function(st) {
16058			if (st && st.kill) {
16059				st.kill();
16060			}
16061		});
16062		stickyInstances = [];
16063	}
16064
16065	function clearStickyObservers() {
16066		stickyObservers.forEach(function(observer) {
16067			try {
16068				observer.disconnect();
16069			} catch (e) {}
16070		});
16071		stickyObservers = [];
16072	}
16073
16074	function getStickyMetrics() {
16075		var $firstSticky = $('.sticky-trigger').first();
16076		if (!$firstSticky.length) {
16077			return {
16078				rowH: 0,
16079				uncontH: 0
16080			};
16081		}
16082
16083		var $row = $firstSticky.closest('.vc_row');
16084		var $uncont = $firstSticky.closest('.uncont');
16085
16086		return {
16087			rowH: $row.length ? Math.round($row.outerHeight()) : 0,
16088			uncontH: $uncont.length ? Math.round($uncont.outerHeight()) : 0
16089		};
16090	}
16091
16092	function metricsChanged(nextMetrics) {
16093		return (
16094			Math.abs(nextMetrics.rowH - lastStickyMetrics.rowH) > 1 ||
16095			Math.abs(nextMetrics.uncontH - lastStickyMetrics.uncontH) > 1
16096		);
16097	}
16098
16099	function buildSticky() {
16100		clearStickyInstances();
16101		clearStickyObservers();
16102
16103		$('.sticky-trigger').each(function() {
16104			var $sticky = $(this);
16105			var $inside = $sticky.children('div').first();
16106			var $row = $sticky.closest('.vc_row');
16107			var $uncont = $sticky.closest('.uncont');
16108
16109			if (!$inside.length || !$row.length || !$uncont.length) {
16110				return;
16111			}
16112
16113			var st = ScrollTrigger.create({
16114				trigger: $sticky[0],
16115				start: function() {
16116					var insideH = $inside.outerHeight() || 0;
16117					return 'top center-=' + (insideH / 2);
16118				},
16119				endTrigger: $row[0],
16120				end: function() {
16121					var insideH = $inside.outerHeight() || 0;
16122					var rowBottom = $row.offset().top + $row.outerHeight();
16123					var uncontBottom = $uncont.offset().top + $uncont.outerHeight();
16124					var diffBottom = rowBottom - uncontBottom;
16125
16126					return 'bottom center+=' + (insideH / 2 + diffBottom);
16127				},
16128				anticipatePin: true,
16129				pin: true,
16130				pinSpacing: false,
16131				scrub: true,
16132				invalidateOnRefresh: true
16133			});
16134
16135			stickyInstances.push(st);
16136
16137			if (typeof ResizeObserver !== 'undefined') {
16138				var ro = new ResizeObserver(function() {
16139					if (isRefreshing) {
16140						pendingRefresh = true;
16141						return;
16142					}
16143
16144					var nextMetrics = getStickyMetrics();
16145
16146					if (!metricsChanged(nextMetrics)) {
16147						return;
16148					}
16149
16150					refreshSticky(true);
16151				});
16152
16153				try {
16154					// NON osservare $inside: tende a creare loop continui
16155					ro.observe($row[0]);
16156					ro.observe($uncont[0]);
16157					stickyObservers.push(ro);
16158				} catch (e) {}
16159			}
16160		});
16161
16162		lastStickyMetrics = getStickyMetrics();
16163	}
16164
16165	function refreshSticky(fromObserver) {
16166		clearRequestTimeout(resizeTimer);
16167
16168		resizeTimer = requestTimeout(function() {
16169			if (isRefreshing) {
16170				pendingRefresh = true;
16171				return;
16172			}
16173
16174			isRefreshing = true;
16175			pendingRefresh = false;
16176
16177			if (!fromObserver) {
16178				buildSticky();
16179			}
16180
16181			requestTimeout(function() {
16182				isRefreshing = false;
16183
16184				lastStickyMetrics = getStickyMetrics();
16185
16186				if (!fromObserver) {
16187					$(document).trigger('uncode-scrolltrigger-refresh');
16188				} else {
16189					$(document).trigger('uncode-scrolltrigger-refresh');
16190				}
16191
16192				if (pendingRefresh) {
16193					pendingRefresh = false;
16194					refreshSticky(true);
16195				}
16196			}, 120);
16197		}, fromObserver ? 160 : 100);
16198	}
16199
16200	function maybeDelayedRefresh() {
16201		var carousel = document.querySelector('.owl-carousel');
16202		var grid = document.querySelector('.isotope-container');
16203		var stickyAll = document.querySelectorAll('.sticky-trigger');
16204		var sticky = stickyAll.length ? stickyAll[stickyAll.length - 1] : null;
16205		var carousel_position;
16206		var grid_position;
16207
16208		if (!sticky) {
16209			return;
16210		}
16211
16212		if (carousel) {
16213			carousel_position = sticky.compareDocumentPosition(carousel);
16214		}
16215		if (grid) {
16216			grid_position = sticky.compareDocumentPosition(grid);
16217		}
16218
16219		if (carousel_position === 2 || grid_position === 2) {
16220			setTimeout(function() {
16221				refreshSticky(false);
16222			}, 500);
16223		}
16224	}
16225
16226	$(window).on('load', function() {
16227		buildSticky();
16228		maybeDelayedRefresh();
16229	});
16230
16231	$(window).on('resize uncode.re-layout', function(e) {
16232		if (e.type === 'resize' && oldW === UNCODE.wwidth) {
16233			return;
16234		}
16235
16236		oldW = UNCODE.wwidth;
16237		refreshSticky(false);
16238	});
16239
16240	$(document).on('uncode-sticky-refresh uncode-toggle-change', function() {
16241		refreshSticky(false);
16242	});
16243};
16244UNCODE.areaTextReveal = function() {
16245    if ( ! $('.text-reveal, .scroll-trigger-el').length ) {
16246        return;
16247    }
16248	if ( ! SiteParameters.is_frontend_editor ) {
16249        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
16250            android = /Android/.test(navigator.userAgent) && !window.MSStream,
16251            prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
16252            prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
16253                document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
16254            firstObs = true,
16255            isMobileUsing = false;
16256
16257        var observer = new ResizeObserver(function(){
16258            var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
16259                newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
16260                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
16261                set = false;
16262            if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
16263                set = true;
16264                prevW = newW;
16265            } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
16266                set = true;
16267                prevH = newH;
16268            }
16269            if ( set || firstObs ) {
16270                window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe'));
16271                firstObs = false;
16272            }
16273        }).observe(document.body);
16274
16275        if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
16276            window.scrollTo = function() {
16277                return;
16278            };
16279            isMobileUsing = true;
16280
16281            $('html, body').css({
16282                'overscroll-behavior': 'none'
16283            });
16284        }
16285
16286        var setTriggerObserve;
16287
16288        ScrollTrigger.observe({
16289            trigger: 'body',
16290            type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
16291            onUp: function() { ScrollTrigger.update(); },
16292        });
16293    }
16294
16295    var textReveal = function(){
16296
16297        if ( SiteParameters.is_frontend_editor ) {
16298            return;
16299        }
16300
16301        var setTxtReveal,
16302            txtTrggrStart = false;
16303
16304        function headingReveal($sel){
16305            txtTrggrStart = true;
16306            $('.text-reveal', $sel).each(function(val, key){
16307                var $txtReveal = $(this).attr('data-init-reveal', true),
16308                    $trigger = $txtReveal,
16309                    $rowParent = $txtReveal.closest('.row-container[data-parent]'),
16310                    hReveal = $txtReveal.outerHeight(),
16311                    $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'),
16312                    $sticky = $txtReveal.closest('.sticky-element'),
16313                    dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
16314                    dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
16315                    dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')),
16316                    $lines = $('.heading-line-wrap', $txtReveal),
16317                    $words = $('.split-word-inner', $txtReveal),
16318                    $chars = $('.split-char', $txtReveal),
16319                    $elToReveal = $words;
16320
16321                if ( $pin.length ) {
16322                    return;
16323                } else if ( $sticky.length ) {
16324                    hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop);
16325                    $trigger = $sticky.parent();
16326                }
16327
16328                if ( dataReveal === 'chars' ) {
16329                    $elToReveal = $chars;
16330                } else if ( dataReveal === 'lines' ) {
16331                    $elToReveal = $lines;
16332                }
16333                
16334                var tl = gsap.timeline({
16335                    scrollTrigger: {
16336                        trigger: $trigger,
16337                        start: "top +=" + (window.innerHeight/100*dataTop) + "px",
16338                        end: "+=" + hReveal + "px",
16339                        id: "txt_reveal_" + key,
16340                        scrub: true,
16341                    }
16342                });
16343                gsap.set(
16344                    $elToReveal, {
16345                        opacity: dataRevealOpacity,
16346                    }
16347                )
16348                tl.fromTo($elToReveal, {
16349                    opacity: dataRevealOpacity,
16350                    duration: 1,
16351                }, {
16352                    opacity: 1,
16353                    stagger: 0.05,
16354                    duration: 1,
16355
16356                });
16357                $(window).on('uncode.tl-refresh', function(){
16358                    if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
16359                        tl.scrollTrigger.refresh();
16360                    }
16361                });
16362
16363                $rowParent.one( 'uncodeWordLines', function(){
16364                    clearRequestTimeout(setTxtReveal);
16365                    setTxtReveal = requestTimeout( function(){
16366                        gsap.set($elToReveal, {clearProps: true});
16367                        tl.kill(true);
16368                        if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) {
16369                            ScrollTrigger.getById("txt_reveal_" + key).kill(true);
16370                        }
16371                        headingReveal($sel)
16372                    }, 100);
16373                });
16374
16375            });
16376        };
16377
16378        window.addEventListener("load", function (e) {
16379            if (!txtTrggrStart) {
16380                headingReveal($("body"));
16381                $(window).trigger("resize");
16382            }
16383        });
16384
16385        $('.row-container[data-parent]').each(function(){
16386            if (!txtTrggrStart) {
16387                var $this = $(this);
16388                $this.on('uncodeWordLines', function(){
16389                    headingReveal($this);
16390                });
16391            }
16392        });
16393
16394        $(window).on('uncode-sticky-trigger-observe', function(e){
16395            clearRequestTimeout(setTriggerObserve);
16396            setTriggerObserve = requestTimeout( function(){
16397                $(window).trigger('uncode.tl-refresh');
16398            }, 2000 );
16399        });
16400    
16401    };
16402    textReveal();
16403
16404    var areaReveal = function(){
16405        if ( SiteParameters.is_frontend_editor ) {
16406            return;
16407        }
16408
16409        $('.scroll-trigger-el').each(function(){
16410            var $scrollTrgrEl = $(this),
16411                $row = $('> .row', $scrollTrgrEl),
16412                $row_in = $('> .row-inner', $row),
16413                cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length,
16414                stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows',
16415                animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes',
16416                stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false,
16417                $animateTrgrEl = $scrollTrgrEl,
16418                noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes',
16419                noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'),
16420                els = $scrollTrgrEl.attr('data-anim-els'),
16421                sticky = $scrollTrgrEl.attr('data-anim-sticky'),
16422                noSpace = $scrollTrgrEl.attr('data-anim-no-space'),
16423                state = $scrollTrgrEl.attr('data-anim-state'),
16424                target = $scrollTrgrEl.attr('data-anim-target'),
16425                origin = $scrollTrgrEl.attr('data-anim-origin'),
16426                mask = $scrollTrgrEl.attr('data-anim-mask'),
16427                _scale = $scrollTrgrEl.attr('data-anim-scale'),
16428                stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes',
16429                opacity = $scrollTrgrEl.attr('data-anim-opacity'),
16430                radius = $scrollTrgrEl.attr('data-anim-radius'),
16431                radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'),
16432                clip_path = $scrollTrgrEl.attr('data-clip-path'),
16433                animation_x = $scrollTrgrEl.attr('data-anim-x'),
16434                animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'),
16435                animation_y = $scrollTrgrEl.attr('data-anim-y'),
16436                blur = $scrollTrgrEl.attr('data-anim-blur'),
16437                perspective = $scrollTrgrEl.attr('data-anim-perspective'),			
16438                rotate = $scrollTrgrEl.attr('data-anim-rotate'),	
16439                rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'),
16440                topBottom = $scrollTrgrEl.attr('data-anim-start'),	
16441                offTop = $scrollTrgrEl.attr('data-anim-top'),
16442                offBottom = $scrollTrgrEl.attr('data-anim-bottom'),
16443                safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0,
16444                animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'),
16445                mobile_rows_start = $scrollTrgrEl.attr('data-mobile-start-point'),
16446                mobile_start_add = $scrollTrgrEl.attr('data-mobile-start-point-add'),
16447                easeOut = $scrollTrgrEl.attr('data-anim-ease'),
16448                offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'),
16449                stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards,
16450                $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(),
16451                setTxtReveal,
16452                txtTrggrStart = false,
16453                alreadyareaAnimateScrollTl = false;
16454    
16455            _scale = _scale === '' ? 0 : parseFloat( _scale );
16456            perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001;	
16457            offTop = offTop === '' ? 0 : parseFloat( offTop );
16458            offBottom = offBottom === '' ? 0 : parseFloat( offBottom );
16459            offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard );
16460
16461            function areaAnimateScrollTl($el, id, last) {
16462                alreadyareaAnimateScrollTl = true;
16463
16464                var pTop = parseFloat( $row.css('padding-top') ),
16465                    innerGap = pTop + offSetCard * id,
16466                    scale = _scale,
16467                    rows_start = animation_rows_start;
16468                    
16469                if ( isMobileUsing && typeof mobile_rows_start !== 'undefined' ) {
16470                    rows_start = mobile_rows_start;
16471                    innerGap = 0 + parseFloat(mobile_start_add);
16472                }
16473
16474                if ( stepScale ) {
16475                    if ( _scale < 100 ) {
16476                        scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) );
16477                    }
16478                }
16479
16480                if ( els === 'content' ) {
16481                    $animateTrgrEl = $('> .row', $scrollTrgrEl);
16482                } else if ( els === 'bg' ) {
16483                    $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl);
16484                } else {
16485                    $animateTrgrEl = $el;
16486                }
16487
16488                if ( rotate_alt === 'yes') {
16489                    rotate *= -1;
16490                    perspective *= -1;
16491                }
16492                
16493                if ( animation_x_alt === 'yes') {
16494                    animation_x *= -1;
16495                }
16496
16497                var $parentDiv = $el.closest('div[data-sticky]');
16498
16499                var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px";
16500
16501                var scrllTrggr = {
16502                    trigger: $parentDiv,
16503                    end: function(){
16504                        return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom)))
16505                    },
16506                    start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
16507                    pin: sticky === 'yes' || stickyCards ? true : false,
16508                    pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0),
16509                    scrub: true,
16510                    id: 'sticky_' + id,
16511                    anticipatePin: 1,
16512                    invalidateOnRefresh: true,
16513                    // markers: {
16514                    //     indent: 150 * id
16515                    // },
16516                    onToggle: function(){
16517                        $scrollTrgrEl.attr('data-revealed', true);
16518                    },
16519                };
16520
16521
16522                if ( !stickyLast && state === 'end' ) {
16523                    last = false;
16524                } 
16525
16526                if ( stickyCards ) {
16527                    if ( state !== 'end' ) {
16528                        if ( rows_start === 'center' ) {
16529                            scrllTrggr.start = "center center";
16530                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight);
16531                        } else if ( rows_start === 'bottom' ) {
16532                            if ( stickyOpts !== 'no' ) {
16533                                scrllTrggr.start = "bottom bottom-=" + (innerGap-1)
16534                                scrllTrggr.end = "bottom bottom";
16535                            }
16536                        } else {
16537                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2);
16538                        } 
16539                        if ( stickyOpts === 'no' ) {
16540                            scrllTrggr.endTrigger = $el;
16541                            scrllTrggr.end = "+=100%";
16542                        } else {
16543                            scrllTrggr.endTrigger = $row;
16544                        }
16545                    } else {
16546                        if ( rows_start === 'center' ) {
16547                            scrllTrggr.start = "center center";
16548                        } else if ( rows_start === 'bottom' ) {
16549                            scrllTrggr.start = "bottom bottom";
16550                        } 
16551                        if ( stickyOpts !== 'no' ) {
16552                            scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1));
16553                            scrllTrggr.endTrigger = $lastEl;
16554                        } else {
16555                            scrllTrggr.end = "bottom bottom";
16556                        }
16557                    }
16558                }
16559                
16560                var tl = gsap.timeline({
16561                    scrollTrigger: scrllTrggr
16562                });
16563
16564                // var mark = last ? {
16565                //         startColor:"blue",
16566                //         endColor:"orange",
16567                //     } : false;
16568
16569                if ( !stickyCards ) {
16570                    var tlConds = tl;
16571                } else {
16572                    var scrllTrggrConds = {
16573                        trigger: $parentDiv,
16574                        end: function(){
16575                            return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom)))
16576                        }, 
16577                        pin: (state === 'end' && last),
16578                        pinSpacing: false,
16579                        scrub: true,
16580                        id: 'card_' + id,
16581                        invalidateOnRefresh: true,
16582                        // markers: true,
16583                    };
16584
16585                    if ( stickyCards ) {
16586                        if ( state !== 'end' ) {
16587                            if ( stickyOpts === '' ) {
16588                                scrllTrggrConds.end = "bottom bottom-=100%";
16589                                scrllTrggrConds.endTrigger = $row_in;
16590                            }
16591
16592                            if ( rows_start === 'bottom' ) {
16593                                if ( stickyOpts !== 'no') {
16594                                    scrllTrggrConds.start = "top top+=" + window.innerHeight;
16595                                    scrllTrggrConds.end = "bottom bottom";
16596                                }
16597                            } else if ( rows_start === 'center' ) {
16598                                scrllTrggrConds.start =  "center center";
16599                            } else {
16600                                scrllTrggrConds.start = "top top+=" + (innerGap + 1);
16601                            }
16602                            
16603                        } else {
16604                            if ( stickyOpts === '' ) {
16605                                if ( animLast ) {
16606                                    scrllTrggrConds.end = "bottom bottom-=100%";
16607                                } else {
16608                                    scrllTrggrConds.end = "bottom bottom";
16609                                }
16610                                scrllTrggrConds.endTrigger = $lastEl;
16611                            }
16612
16613                            if ( rows_start === 'bottom' && stickyOpts !== 'no' ) {
16614                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16615                                    scrllTrggrConds.start = "bottom bottom";
16616                                } else {
16617                                    scrllTrggrConds.start = "top top+=" + $el.outerHeight();
16618                                }
16619                            } else if ( rows_start === 'center' ) {
16620                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16621                                    scrllTrggrConds.start =  "center center";
16622                                } else {
16623                                scrllTrggrConds.start =  "top+=" + ($el.outerHeight()/2) + " top+=" 
16623+ window.innerHeight/2;
16624                                }
16625                            } else {
16626                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
16627                                    scrllTrggrConds.start = "top top";
16628                                } else {
16629                                    scrllTrggrConds.start = "top top+=" + (innerGap + 1);
16630                                }
16631                            }
16632
16633                        }
16634
16635                    } else {
16636                        scrllTrggrConds.start =  start_topBottom;
16637                    }
16638
16639                    var tlConds = gsap.timeline({
16640                        scrollTrigger: scrllTrggrConds
16641                    });
16642                }
16643
16644                if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) {
16645                    if ( target === 'mask' ) {
16646                        if ( state !== 'end' ) {
16647                            if ( mask === 'auto' ) {
16648                                gsap.set(
16649                                    $animateTrgrEl, {
16650                                        clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16651                                        opacity: parseFloat(opacity)/100,
16652                                        filter: 'blur(' + blur + 'px)',
16653                                        visibility: 'visible',
16654                                    }
16655                                )
16656                                tlConds.fromTo($animateTrgrEl, {
16657                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16658                                    opacity: parseFloat(opacity)/100,
16659                                    filter: 'blur(' + blur + 'px)',
16660                                    duration: 1,
16661                                }, {
16662                                    opacity: 1,
16663                                    clipPath: 'inset(0% 0px round 0' + radiu
16663s_unit + ')',
16664                                    filter: 'blur(0px)',
16665                                    duration: 1,
16666                                    ease: easeOut,
16667                                    //delay: 0.1
16668                                });	
16669                            } else {
16670                                tlConds.fromTo($animateTrgrEl, {
16671                                    opacity: parseFloat(opacity)/100,
16672                                    clipPath: clip_path,
16673                                    filter: 'blur(' + blur + 'px)',
16674                                    duration: 1,
16675                                }, {
16676                                    opacity: 1,
16677                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
16678                                    filter: 'blur(0px)',
16679                                    duration: 1,
16680                                    ease: easeOut,
16681                                    //delay: 0.1
16682                                });	
16683                            }
16684                        } else {
16685                            if ( mask === 'auto' ) {
16686                                tlConds.fromTo($animateTrgrEl, {
16687                                    opacity: 1,
16688                                    clipPath: 'inset(0% 0px round 0' + radiu
16688s_unit + ')',
16689                                    filter: 'blur(0px)',
16690                                    duration: 1,
16691                                },{
16692                                    opacity: parseFloat(opacity)/100,
16693                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
16694                                    filter: 'blur(' + blur + 'px)',
16695                                    ease: easeOut,
16696                                    duration: 1,
16697                                    //delay: 0.1
16698                                });	
16699                            } else {
16700                                tlConds.fromTo($animateTrgrEl, {
16701                                    opacity: 1,
16702                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
16703                                    filter: 'blur(0px)',
16704                                    duration: 1,
16705                                },{
16706                                    opacity: parseFloat(opacity)/100,
16707                                    clipPath: clip_path,
16708                                    filter: 'blur(' + blur + 'px)',
16709                                    duration: 1,
16710                                    ease: easeOut,
16711                                    //delay: 0.1
16712                                });	
16713                            }
16714                        }
16715                    } else {
16716                        if ( state !== 'end' ) {
16717                            if ( scale === 'auto' ) {
16718                                if ( radius ) {
16719                                    gsap.set(
16720                                        $animateTrgrEl, {
16721                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16722                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16723                                            x: animation_x + 'vw',
16724                                            y: animation_y + 'vh',
16725                                            filter: 'blur(' + blur + 'px)',
16726                                            rotation: rotate,
16727                                            rotationX: rotate == 0 ? perspective : 0,
16728                                            transformPerspective: '100vw',
16729                                            opacity: parseFloat(opacity)/100,
16730                                            transformOrigin: origin,
16731                                            borderRadius: radius + radius_unit,
16732                                            visibility: 'visible',
16733                                        }
16734                                    )
16735                                    tlConds.fromTo($animateTrgrEl, {
16736                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16737                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16738                                        x: animation_x + 'vw',
16739                                        y: animation_y + 'vh',
16740                                        filter: 'blur(' + blur + 'px)',
16741                                        rotation: rotate,
16742                                        rotationX: rotate == 0 ? perspective : 0,
16743                                        transformPerspective: '100vw',
16744                                        opacity: parseFloat(opacity)/100,
16745                                        borderRadius: radius + radius_unit,
16746                                        transformOrigin: origin,
16747                                        duration: 1,
16748                                    }, {
16749                                        scaleX: 1,
16750                                        scaleY: 1,
16751                                        x: 0,
16752                                        y: 0,
16753                                        filter: 'blur(0px)',
16754                                        rotation: 0,
16755                                        rotationX: 0,
16756                                        opacity: 1,
16757                                        borderRadius: 0 + radius_unit,
16758                                        transformOrigin: origin,
16759                                        duration: 1,
16760                                        ease: easeOut,
16761                                        //delay: 0.1
16762                                    });	
16763                                } else {
16764                                    gsap.set(
16765                                        $animateTrgrEl, {
16766                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16767                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16768                                            x: animation_x + 'vw',
16769                                            y: animation_y + 'vh',
16770                                            filter: 'blur(' + blur + 'px)',
16771                                            rotation: rotate,
16772                                            rotationX: rotate == 0 ? perspective : 0,
16773                                            transformPerspective: '100vw',
16774                                            opacity: parseFloat(opacity)/100,
16775                                            transformOrigin: origin,
16776                                            visibility: 'visible',
16777                                        }
16778                                    )
16779                                    tlConds.fromTo($animateTrgrEl, {
16780                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16781                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16782                                        x: animation_x + 'vw',
16783                                        y: animation_y + 'vh',
16784                                        filter: 'blur(' + blur + 'px)',
16785                                        rotation: rotate,
16786                                        rotationX: rotate == 0 ? perspective : 0,
16787                                        transformPerspective: '100vw',
16788                                        opacity: parseFloat(opacity)/100,
16789                                        transformOrigin: origin,
16790                                        duration: 1,
16791                                    }, {
16792                                        scaleX: 1,
16793                                        scaleY: 1,
16794                                        x: 0,
16795                                        y: 0,
16796                                        filter: 'blur(0px)',
16797                                        rotation: 0,
16798                                        rotationX: 0,
16799                                        opacity: 1,
16800                                        transformOrigin: origin,
16801                                        duration: 1,
16802                                        ease: easeOut,
16803                                        //delay: 0.1
16804                                    });	
16805                                }
16806                            } else {
16807                                if ( radius ) {
16808                                    gsap.set(
16809                                        $animateTrgrEl, {
16810                                            scaleX: parseFloat( scale ) / 100,
16811                                            scaleY: parseFloat( scale ) / 100,
16812                                            opacity: parseFloat(opacity)/100,
16813                                            x: animation_x + 'vw',
16814                                            y: animation_y + 'vh',
16815                                            filter: 'blur(' + blur + 'px)',
16816                                            rotation: rotate,
16817                                            rotationX: rotate == 0 ? perspective : 0,
16818                                            transformPerspective: '100vw',
16819                                            transformOrigin: origin,
16820                                            borderRadius: radius + radius_unit,
16821                                            visibility: 'visible',
16822                                        }
16823                                    )
16824                                    tlConds.fromTo($animateTrgrEl, {
16825                                        scaleX: parseFloat( scale ) / 100,
16826                                        scaleY: parseFloat( scale ) / 100,
16827                                        opacity: parseFloat(opacity)/100,
16828                                        x: animation_x + 'vw',
16829                                        y: animation_y + 'vh',
16830                                        filter: 'blur(' + blur + 'px)',
16831                                        rotation: rotate,
16832                                        rotationX: rotate == 0 ? perspective : 0,
16833                                        transformPerspective: '100vw',
16834                                        borderRadius: radius + radius_unit,
16835                                        transformOrigin: origin,
16836                                        duration: 1,
16837                                    }, {
16838                                        scaleX: 1,
16839                                        scaleY: 1,
16840                                        opacity: 1,
16841                                        x: 0,
16842                                        y: 0,
16843                                        filter: 'blur(0px)',
16844                                        rotation: 0,
16845                                        rotationX: 0,
16846                                        transformOrigin: origin,
16847                                        ease: easeOut,
16848                                        duration: 1,
16849                                        borderRadius: 0 + radius_unit,
16850                                        //delay: 0.1
16851                                    });	
16852                                } else {
16853                                    gsap.set(
16854                                        $animateTrgrEl, {
16855                                            scaleX: parseFloat( scale ) / 100,
16856                                            scaleY: parseFloat( scale ) / 100,
16857                                            opacity: parseFloat(opacity)/100,
16858                                            x: animation_x + 'vw',
16859                                            y: animation_y + 'vh',
16860                                            filter: 'blur(' + blur + 'px)',
16861                                            rotation: rotate,
16862                                            rotationX: rotate == 0 ? perspective : 0,
16863                                            transformPerspective: '100vw',
16864                                            transformOrigin: origin,
16865                                            visibility: 'visible',
16866                                        }
16867                                    )
16868                                    tlConds.fromTo($animateTrgrEl, {
16869                                        scaleX: parseFloat( scale ) / 100,
16870                                        scaleY: parseFloat( scale ) / 100,
16871                                        opacity: parseFloat(opacity)/100,
16872                                        x: animation_x + 'vw',
16873                                        y: animation_y + 'vh',
16874                                        filter: 'blur(' + blur + 'px)',
16875                                        rotation: rotate,
16876                                        rotationX: rotate == 0 ? perspective : 0,
16877                                        transformPerspective: '100vw',
16878                                        transformOrigin: origin,
16879                                        duration: 1,
16880                                    }, {
16881                                        scaleX: 1,
16882                                        scaleY: 1,
16883                                        opacity: 1,
16884                                        x: 0,
16885                                        y: 0,
16886                                        filter: 'blur(0px)',
16887                                        rotation: 0,
16888                                        rotationX: 0,
16889                                        transformOrigin: origin,
16890                                        duration: 1,
16891                                        ease: easeOut,
16892                                        //delay: 0.1
16893                                    });
16894                                }
16895                            }
16896                        } else {
16897                            if ( scale === 'auto' ) {
16898                                tlConds.fromTo($animateTrgrEl, {
16899                                    scaleX: 1,
16900                                    scaleY: 1,
16901                                    opacity: 1,
16902                                    x: 0,
16903                                    y: 0,
16904                                    filter: 'blur(0px)',
16905                                    rotation: 0,
16906                                    rotationX: 0,
16907                                    transformOrigin: origin,
16908                                    duration: 1,
16909                                }, {
16910                                    scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16911                                    scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
16912                                    opacity: parseFloat(opacity)/100,
16913                                    x: animation_x + 'vw',
16914                                    y: animation_y + 'vh',
16915                                    filter: 'blur(' + blur + 'px)',
16916                                    rotation: rotate,
16917                                    rotationX: rotate == 0 ? perspective : 0,
16918                                    transformPerspective: '100vw',
16919                                    transformOrigin: origin,
16920                                    duration: 1,
16921                                    ease: easeOut,
16922                                    //delay: 0.1
16923                                })
16924                            } else {
16925                                tlConds.fromTo($animateTrgrEl, {
16926                                    scaleX: 1,
16927                                    scaleY: 1,
16928                                    opacity: 1,
16929                                    x: 0,
16930                                    y: 0,
16931                                    filter: 'blur(0px)',
16932                                    rotation: 0,
16933                                    rotationX: 0,
16934                                    transformPerspective: '100vw',
16935                                    transformOrigin: origin,
16936                                    borderRadius: 0 + radius_unit,
16937                                    duration: 1,
16938                                }, {
16939                                    scaleX: parseFloat( scale ) / 100,
16940                                    scaleY: parseFloat( scale ) / 100,
16941                                    opacity: parseFloat(opacity)/100,
16942                                    x: animation_x + 'vw',
16943                                    y: animation_y + 'vh',
16944                                    filter: 'blur(' + blur + 'px)',
16945                                    rotation: rotate,
16946                                    rotationX: rotate == 0 ? perspective : 0,
16947                                    transformPerspective: '100vw',
16948                                    transformOrigin: origin,
16949                                    borderRadius: radius + radius_unit,
16950                                    duration: 1,
16951                                    ease: easeOut,
16952                                    //delay: 0.1
16953                                })
16954                            }
16955                        }
16956                    }
16957                }
16958
16959                function headingReveal($el){
16960                    txtTrggrStart = true;
16961                    $('.text-reveal', $el).each(function(_key, _val){
16962                        var $txtReveal = $(_val),
16963                            dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
16964                            dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
16965                            $lines = $('.heading-line-wrap', $txtReveal),
16966                            $words = $('.split-word-inner', $txtReveal),
16967                            $chars = $('.split-char', $txtReveal),
16968                            _setTxtReveal,
16969                            $elToReveal = $words;
16970
16971                        if ( !(sticky === 'yes' || stickyCards) ) {
16972                            return;
16973                        }
16974            
16975                        easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut;
16976
16977                        if ( dataReveal === 'chars' ) {
16978                            $elToReveal = $chars;
16979                        } else if ( dataReveal === 'lines' ) {
16980                            $elToReveal = $lines;
16981                        }
16982
16983                        var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr;
16984                        scrllTrggrTxt.id = "txt_reveal_" + _key; 
16985                        scrllTrggrTxt.pin = false;
16986
16987                        gsap.set($elToReveal, {opacity: dataRevealOpacity});
16988                        var _tl = gsap.timeline({
16989                            scrollTrigger: scrllTrggrTxt
16990                        });
16991                        _tl.fromTo($elToReveal, {
16992                            opacity: dataRevealOpacity,
16993                        }, {
16994                            opacity: 1,
16995                            stagger: 0.05
16996                        });
16997
16998                        $scrollTrgrEl.one( 'uncodeWordLines', function(){
16999                            clearRequestTimeout(_setTxtReveal);
17000                            _setTxtReveal = requestTimeout( function(){
17001                                gsap.set($elToReveal, {clearProps: true});
17002                                _tl.kill(true);
17003                                if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) {
17004                                    ScrollTrigger.getById("txt_reveal_" + _key).kill(true);
17005                                }
17006                                headingReveal($el)
17007                            }, 100);
17008                        });
17009
17010                    });
17011                };
17012
17013                if (!txtTrggrStart) {
17014                    headingReveal($el);
17015                }
17016
17017                $scrollTrgrEl.one( 'uncodeWordLines', function(){
17018                    if (!txtTrggrStart) {
17019                        headingReveal($el);
17020                    }
17021                });
17022                
17023                var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
17024                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight );
17025                var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 
17026                    document.documentElement.clientWidth,  document.documentElement.scrollWidth,  document.documentElement.offsetWidth );
17027                    
17028                $(window).on('uncode-sticky-trigger-observe', function(e){
17029                    var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
17030                    var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );
17031                    $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false});
17032                    //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style');
17033                    if ( stickyCards ) {
17034                        $('.tmb', $scrollTrgrEl).removeAttr('style');
17035                    }
17036                    var scrollnow = document.body.scrollTop || document.documentElement.scrollTop;
17037                    clearRequestTimeout(setTxtReveal);
17038                    setTxtReveal = requestTimeout( function(){
17039                        $(document).trigger('uncode-scrolltrigger-refresh');
17040                        if ( isMobileUsing ) {
17041                            if ( typeof tl !== 'undefined' ) {
17042                                tl.scrollTrigger.refresh();
17043                            }
17044                            if ( typeof tlConds !== 'undefined' ) {
17045                                tlConds.scrollTrigger.refresh();
17046                            }
17047                            $(window).trigger('scroll');
17048                            _width = __width;
17049                        } else if ( _width !== __width && ( isMobileUsing ) ) {
17050                            window.dispatchEvent(new CustomEvent('vc-resize'));
17051                            if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
17052                                window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){
17053                                    if ( typeof tl !== 'undefined' ) {
17054                                        tl.scrollTrigger.refresh();
17055                                    }
17056                                    if ( typeof tlConds !== 'undefined' ) {
17057                                        tlConds.scrollTrigger.refresh();
17058                                    }
17059                                    window.lenis.scrollTo(scrollnow, {duration: 0.01});
17060                                }});
17061                            } else {
17062                                if ( typeof tl !== 'undefined' ) {
17063                                    tl.scrollTrigger.refresh();
17064                                }
17065                                if ( typeof tlConds !== 'undefined' ) {
17066                                    tlConds.scrollTrigger.refresh();
17067                                }
17068                                $(window).trigger('scroll');
17069                            }
17070                            _height = __height;
17071                        }
17072                    }, 500);
17073                });
17074
17075
17076                $(window).on('load ', function(e){
17077                    var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
17078                    if ( _height !== ___height ) {
17079                        $scrollTrgrEl.attr('data-toggled', true);
17080                        $(window).trigger('resize');
17081                        if ( typeof tl !== 'undefined' ) {
17082                            tl.scrollTrigger.refresh();
17083                        }
17084                        if ( typeof tlConds !== 'undefined' ) {
17085                            tlConds.scrollTrigger.refresh();
17086                        }
17087                        _height = ___height;
17088                    }
17089
17090                    
17091                    
17092                    $(document).trigger('uncode-scrolltrigger-refresh');
17093
17094                });
17095
17096            };
17097
17098            var callAreaAnimateScrollTl = function() {
17099                if ( stickyCards ) {
17100                    $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){
17101                        if ( key+1 < cardL || animLast || state !== 'end' ) {
17102                            var $this = $(val),
17103                                last = key+1===cardL;
17104                            areaAnimateScrollTl($this, key, last);
17105                        }
17106                    });
17107                } else {
17108                    areaAnimateScrollTl($scrollTrgrEl, 0, false);
17109                }    
17110            };
17111
17112            $(window).on('wwResize', function(){
17113                if ( !alreadyareaAnimateScrollTl ) {
17114                    if ( noMobile ) {
17115                        if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
17116                            return;
17117                        } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
17118                            return;
17119                        }
17120                    }
17121                    
17122                    callAreaAnimateScrollTl();
17123                }
17124            })
17125
17126            if ( noMobile ) {
17127                if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
17128                    return;
17129                } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
17130                    return;
17131                }
17132            }
17133
17134            callAreaAnimateScrollTl();
17135
17136        });
17137
17138    };
17139
17140    areaReveal();
17141
17142};
17143UNCODE.thumbsReveal = function() {
17144
17145    var recalc = false,
17146        thumbsRevealResizeTO;
17147
17148    var isTouchDevice = function() {
17149        return (
17150            'ontouchstart' in window ||
17151            navigator.maxTouchPoints > 0 ||
17152            navigator.msMaxTouchPoints > 0
17153        );
17154    };
17155
17156    var resetThumbsReveal = function() {
17157        $('.tmb-mask-init').each(function(){
17158            var el = this;
17159
17160            if ( el._thumbsRevealST ) {
17161                el._thumbsRevealST.kill();
17162                el._thumbsRevealST = null;
17163            }
17164
17165            if ( el._thumbsRevealIO ) {
17166                el._thumbsRevealIO.disconnect();
17167                el._thumbsRevealIO = null;
17168            }
17169
17170            gsap.set($('img, video, .fluid-object', el), {
17171                clearProps: 'transform'
17172            });
17173
17174            $(el).removeClass('tmb-mask-init');
17175        });
17176
17177        revealThumbs();
17178    };
17179
17180    var revealThumbs = function( $el ){
17181        if ( typeof $el === 'undefined' || $el === null || !$el.length ) {
17182            $el = $('body');
17183        }
17184
17185        $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){
17186            var $container = $(this),
17187                $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container),
17188                isContainer = false;
17189
17190            if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) {
17191                $stickys.each(function(){
17192                    var $sticky = $(this).addClass('tmb-mask-init'),
17193                        $rellax = $sticky.closest('.parallax-el'),
17194                        $inside = $('.t-inside', $sticky),
17195                        $media = $('img, video, .fluid-object', $sticky).attr('loading', ''),
17196                        val = parseFloat( $inside.attr('data-scroll-val') ),
17197                        no_device = $inside.attr('data-anim-no-mobile') === 'yes';
17198
17199                    if ( no_device && isTouchDevice() ) {
17200                        gsap.set($media, {
17201                            clearProps: 'transform'
17202                        });
17203
17204                        return;
17205                    }
17206
17207                    if ( $rellax.length ) {
17208                        recalc = true;
17209                    }
17210
17211                    val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val;
17212                    
17213                    if ( $sticky.hasClass('tmb-mask-scroll') ) {
17214
17215                        var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both'))
17216                            ? val * 0.05 : 0;
17217
17218                        var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
17219                            ? val * 4 : 0;
17220
17221                        var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
17222                            ? parax * 0.01 : 0;
17223
17224                        var isThumbVisible = false;
17225                        var lastProgress = 0;
17226
17227                        var io = null;
17228
17229                        if (typeof IntersectionObserver !== 'undefined') {
17230                            io = new IntersectionObserver(function(entries){
17231                                var entry = entries[0];
17232
17233                                isThumbVisible = !!(
17234                                    entry &&
17235                                    entry.isIntersecting &&
17236                                    entry.intersectionRect &&
17237                                    entry.intersectionRect.width > 0 &&
17238                                    entry.intersectionRect.height > 0
17239                                );
17240
17241                                if (!isThumbVisible) {
17242                                    gsap.set($media, {
17243                                        yPercent: 0,
17244                                        scale: 1 + extra
17245                                    });
17246                                }
17247                            }, {
17248                                root: null,
17249                                threshold: 0.01
17250                            });
17251
17252                            io.observe($sticky[0]);
17253
17254                            $sticky[0]._thumbsRevealIO = io;
17255                        }
17256
17257                        var st = ScrollTrigger.create({
17258                            trigger: $sticky[0],
17259                            scrub: true,
17260                            start: 'top bottom',
17261                            end: 'bottom top',
17262                            onUpdate: function(self) {
17263                                lastProgress = self.progress;
17264
17265                                if (!isThumbVisible) return;
17266
17267                                var currentY = gsap.utils.interpolate(-parax, parax, lastProgress);
17268                                var currentScale = gsap.utils.interpolate(1 + zoom + extra, 1 + extra, lastProgress);
17269
17270                                gsap.set($media, {
17271                                    yPercent: currentY,
17272                                    scale: currentScale
17273                                });
17274                            }
17275                        });
17276
17277                        $sticky[0]._thumbsRevealST = st;
17278
17279                        if ( recalc ) {
17280                            $(window).on('uncode-thumbsreveal-refresh', function(){
17281                                if ( st ) {
17282                                    st.refresh();
17283                                }
17284                            });
17285                        }
17286                    }
17287                });
17288            }
17289
17290            if ( $container.has('.tmb-mask-reveal') ) {
17291                var $markTrigger = ".tmb-mask-reveal .t-entry-visual",
17292                    staggerTime = 0.1;
17293
17294                $('.t-inside', $container).each(function(){
17295                    var checkEasing = $(this).attr('data-easing');
17296
17297                    if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') {
17298                        gsap.registerPlugin(CustomEase);
17299                        return false;
17300                    }
17301                });
17302
17303                if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) {
17304                    $markTrigger = $container;
17305                    isContainer = true;
17306                    staggerTime = 0;
17307                }
17308
17309                ScrollTrigger.batch( $markTrigger, {
17310                    start: function( el ){
17311                        return "top 96%";
17312                    },
17313                    onEnter: function(batch){
17314                        var $inside = $(batch).closest('.t-inside');
17315
17316                        if ( isContainer ) {
17317                            $inside = $(batch).find('.t-inside').first();
17318                        }
17319
17320                        var delay = parseFloat( $inside.attr('data-delay') ),
17321                            speed = parseFloat( $inside.attr('data-speed') ),
17322                            easing = $inside.attr('data-easing'),
17323                            bgDelay = parseFloat( $inside.attr('data-bg-delay') );
17324
17325                        delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay / 1000;
17326                        speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed / 1000;
17327                        easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
17328                        bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
17329
17330                        if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) {
17331                            gsap.to($('.t-entry-visual-tc', batch), speed, {
17332                                clipPath: 'inset(0% 0% 0% 0%)',
17333                                stagger: staggerTime,
17334                                delay: delay,
17335                                ease: easing
17336                            });
17337
17338                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
17339                                clipPath: 'inset(0% 0% 0% 0%)',
17340                                stagger: staggerTime,
17341                                scale: 1,
17342                                delay: delay + (speed * bgDelay),
17343                                ease: easing
17344                            });
17345                        } else {
17346                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
17347                                clipPath: 'inset(0% 0% 0% 0%)',
17348                                stagger: staggerTime,
17349                                scale: 1,
17350                                delay: delay,
17351                                ease: easing
17352                            });
17353                        }
17354                    }
17355                });
17356            }
17357        });
17358
17359        function raf(time) {
17360            requestAnimationFrame(raf);
17361            $(window).trigger('uncode-thumbsreveal-refresh');
17362        }
17363
17364        if ( recalc ) {
17365            requestAnimationFrame(raf);
17366        }
17367    };
17368
17369    $(window).on( 'load more-items-loaded', function(){
17370        revealThumbs();
17371    });
17372
17373    $(document).on('uncode-ajax-filtered', function(){
17374        revealThumbs();
17375    });
17376
17377    $(window).on('resize orientationchange', function(){
17378        clearTimeout(thumbsRevealResizeTO);
17379
17380        thumbsRevealResizeTO = setTimeout(function(){
17381            resetThumbsReveal();
17382        }, 150);
17383    });
17384
17385    document.addEventListener('uncode:marquee:ready', function(e) {
17386        if (!e || !e.detail || !e.detail.baseWrap) return;
17387
17388        var parent = e.detail.parent || e.detail.baseWrap;
17389        var $marquee = $(e.detail.baseWrap);
17390
17391        if (e.detail.leftWrap) {
17392            $marquee = $marquee.add(e.detail.leftWrap);
17393        }
17394
17395        if (e.detail.rightWrap) {
17396            $marquee = $marquee.add(e.detail.rightWrap);
17397        }
17398
17399        if (parent._uncodeThumbsRevealT) {
17400            clearRequestTimeout(parent._uncodeThumbsRevealT);
17401        }
17402
17403        parent._uncodeThumbsRevealT = requestTimeout(function() {
17404            $('.tmb-mask-init', $marquee).removeClass('tmb-mask-init');
17405            revealThumbs($marquee);
17406            parent._uncodeThumbsRevealT = null;
17407        }, 20);
17408    }, false);
17409    
17410    if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
17411        window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
17412            var $el = model.view.$el,
17413                shortcode = model.attributes.shortcode;
17414
17415            if ( $el.is('.custom-grid-container') ) {
17416                $el = $el.parent();
17417            }
17418
17419            if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') {
17420                revealThumbs($el);
17421            }
17422        });
17423    }
17424
17425};
17426UNCODE.revslider = function() {
17427	var revSlider6In = function(){
17428		$('rs-module').each(function(){
17429			var $slider = $(this);
17430
17431			$slider.on('revolution.slide.onloaded', function(e, data){
17432				if ( $(e.currentTarget).closest(".header-revslider").length ) {
17433					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
17434						scrolltop = $(document).scrollTop();
17435					if ( style != undefined ) {
17436						UNCODE.switchColorsMenu(scrolltop, style);
17437					}
17438				}
17439			});
17440
17441			$slider.on('revolution.slide.onchange', function(e, data){
17442				if ( $(e.currentTarget).closest(".header-revslider").length ) {
17443					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
17444						scrolltop = $(document).scrollTop();
17445					if ( style != undefined ) {
17446						UNCODE.switchColorsMenu(scrolltop, style);
17447					}
17448				}
17449			});
17450
17451		});
17452
17453	};
17454	revSlider6In();
17455	$(window).on("load", revSlider6In );
17456
17457	document.addEventListener("sr.module.ready", function(e) { 
17458		var $slider = $('#'+e.id),
17459			settings = SR7.JSON[e.id];
17460
17461		if ( typeof settings !== 'undefined' && settings !== null ) {
17462			if ( $slider.closest(".header-revslider").length ) {
17463				var style = settings.slides[1].slide.attr.data,
17464					scrolltop = $(document).scrollTop();
17465				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
17466				style = style[1];
17467				if ( style[1] != undefined ) {
17468					UNCODE.switchColorsMenu(scrolltop, style);
17469				}
17470			}
17471		}
17472	});
17473
17474	document.addEventListener("sr.slide.afterChange", function(e) {
17475		var $slider = $('#'+e.id),
17476			settings = SR7.JSON[e.id];
17477
17478		if ( typeof settings !== 'undefined' && settings !== null ) {
17479			if ( $slider.closest(".header-revslider").length ) {
17480				var style = settings.slides[e.current.id].slide.attr.data,
17481					scrolltop = $(document).scrollTop();
17482				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
17483				style = style[1];
17484				if ( style != undefined ) {
17485					UNCODE.switchColorsMenu(scrolltop, style);
17486				}
17487			}
17488		}
17489	});
17490
17491};
17492UNCODE.layerslider = function() {
17493	$(window).on("load", function() {
17494
17495		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
17496
17497			var slideData = slider.slides.current.data,
17498				scrolltop = $(document).scrollTop();
17499			if( slideData && slideData.skin ) {
17500
17501				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
17502
17503			}
17504		});
17505
17506	});
17507};
17508
17509UNCODE.ajax_filters = function () {
17510	var isAjaxing = false;
17511
17512/*************************
17513 *
17514 * Filters Menu and Widgets Area
17515 *
17516 ************************/
17517
17518 	var clear_clicked = false;
17519
17520 	var init_ajax_grid = function(){
17521
17522		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
17523		$grids.each(function(index, val){
17524			var $body = $('body'),
17525				$grid = $(val).addClass('init-ajax-grid'),
17526				starting_point = $grid.attr('data-toggle'),
17527				$trigger = $('.uncode-toggle-ajax-filters', $grid),
17528				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
17529				$isotope_wrapper = $('.isotope-wrapper', $grid),
17530				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
17531				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
17532				$footprint = $('.ajax-filter-footprint', $grid),
17533				sidebar_w,
17534				data_w = parseFloat( $sidebar.attr('data-max-width') ),
17535				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
17536				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
17537				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
17538				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
17539				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
17540				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
17541				sidew,
17542				$inside_row = $('> .row-parent', $vc_row),
17543				bg_row,
17544				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
17545				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
17546				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
17547				sidebar_overlay = false,
17548				sidebar_hover = false,
17549				switchMobile = false,
17550				scrollTop;
17551
17552			if ( $vc_row.attr('class') ) {
17553				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
17554			}
17555
17556			if ( bg_row != null ) {
17557				$side_header.add($side_footer).addClass(bg_row[0]);
17558			}
17559
17560			$trigger.add($apply_filters).on('click', function(e){
17561				e.preventDefault();
17562				e.stopPropagation();
17563				$grid = $('.ajax-grid-system').eq(0);
17564				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
17565				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
17566				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17567				sidebar_w = $sidebar_wrapper.width();
17568				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17569				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
17570					$(this).trigger('uncode-ajax-clear-filters');
17571				}
17572				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
17573					$grid.toggleClass('ajax-hide-filters-blanks');
17574					$sidebar.slideToggle({
17575						duration: 400,
17576						easing: 'easeOutQuad',
17577					});
17578				} else {
17579					$grid.removeClass('ajax-hide-filters-blanks');
17580					$grid.toggleClass('ajax-hide-filters');
17581					if ( $grid.hasClass('ajax-hide-filters') ) {
17582						$body.addClass('ajax-hide-filters');
17583					} else {
17584						scrollTop = $('html, body').scrollTop();
17585						$body.removeClass('ajax-hide-filters');
17586					}
17587				}
17588				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
17589					$('html, body').scrollTop(scrollTop);
17590				}
17591				return false;
17592			});
17593
17594			$close_btn.on('click', function(e){
17595				e.preventDefault();
17596				$grid = $('.ajax-grid-system').eq(0);
17597				$grid.addClass('ajax-hide-filters');
17598				if ( $grid.hasClass('ajax-hide-filters') ) {
17599					$body.addClass('ajax-hide-filters');
17600				} else {
17601					scrollTop = $('html, body').scrollTop();
17602					$body.removeClass('ajax-hide-filters');
17603				}
17604				$('html, body').scrollTop(scrollTop);
17605			});
17606
17607			$sidebar_wrapper.on('mouseover',function(){
17608				sidebar_hover = true;
17609			}).on('mouseout', function(){
17610				sidebar_hover = false;
17611			});
17612
17613			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
17614				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
17615					return;
17616				}
17617				if (undefined !== from && from === 'select_active_attributes') {
17618					return;
17619				}
17620				if ($(e.target).closest('.select2-container--open').length ) {
17621					return;
17622				}
17623				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
17624					$grid.add($body).addClass('ajax-hide-filters');
17625				}
17626			});
17627
17628			$sorting_trgr.on('click', function(e) {
17629				e.preventDefault();
17630			});
17631
17632			var inside_width = function(){
17633				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17634				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17635				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
17636				$inside_row = $('> .row-parent', $vc_row);
17637				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
17638					sidew = $sidebar.width();
17639					$inside_row.css({
17640						width: sidew
17641					});
17642				} else {
17643					$inside_row.css({
17644						width: ''
17645					});
17646				}
17647			};
17648			inside_width();
17649
17650			var ajax_sidebar_position = function(e, f_editor){
17651				$grid = $('.ajax-grid-system').eq(0);
17652				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
17653				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
17654				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
17655				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
17656				$inside_row = $('> .row-parent', $vc_row);
17657				scrollTop = $('html, body').scrollTop();
17658				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery) || overlay_desktop ) ) {
17659					if ( switchMobile !== true ) {
17660						$grid.add($body).addClass('ajax-hide-filters');
17661						$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
17662						$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
17663						sidebar_overlay = true;
17664						$body.addClass('ajax-filter-sidebar-overlay');
17665						$sidebar_wrapper.addClass(skin);
17666						var sideHeadH = $side_header.outerHeight(),
17667							sideFooterH = $side_footer.outerHeight();
17668						if ( data_w !== '' && data_w > 0 ) {
17669							if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
17670								$sidebar.css({
17671									'max-width': data_w
17672								});
17673							} else {
17674								$sidebar.css({
17675									'max-width':'none'
17676								});
17677							}
17678						}
17679						$vc_row.css({
17680							'padding-top':sideHeadH,
17681							'padding-bottom':sideFooterH
17682						}).attr('data-lenis-prevent', true);
17683						var sidew = $sidebar.width();
17684						$inside_row.css({
17685							width: sidew
17686						});
17687						switchMobile = true;
17688					}
17689				} else {
17690					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
17691						scrollTop = $('html, body').scrollTop();
17692						$grid.add($body).removeClass('ajax-hide-filters');
17693					}
17694					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
17695						$grid.addClass('ajax-hide-filters-blanks');
17696						$sidebar.hide();
17697					}
17698					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
17699					$('.ajax-sidebar-placeholder', $grid).remove();
17700					sidebar_overlay = false;
17701					$body.removeClass('ajax-filter-sidebar-overlay');
17702					$sidebar_wrapper.removeClass(skin);
17703					if ( data_w !== '' && data_w > 0 ) {
17704						$sidebar.css({
17705							'max-width':'none'
17706						});
17707					}
17708					$vc_row.css({
17709						'padding-top':0,
17710						'padding-bottom':0,
17711					}).removeAttr('data-lenis-prevent');
17712
17713					$inside_row.css({
17714						width: ''
17715					});
17716
17717					if ( f_editor === true ) {
17718						UNCODE.ajax_filters();
17719					}
17720
17721					switchMobile = false;
17722				}
17723				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
17724					$('html, body').scrollTop(scrollTop);
17725				}
17726			};
17727
17728			var sidebar_width = function(){
17729				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
17730					sidebar_w = $footprint.width();
17731					$sidebar.css({ width: sidebar_w });
17732				} else {
17733					$sidebar.css({ width: '' });
17734				}
17735			};
17736			sidebar_width();
17737
17738			if ( SiteParameters.is_frontend_editor ) {
17739				ajax_sidebar_position();
17740			}
17741
17742			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
17743				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
17744					ajax_sidebar_position(e);
17745				}
17746				sidebar_width();
17747			});
17748
17749			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
17750				ajax_sidebar_position(e, true);
17751			});
17752
17753			$isotope_wrapper.on('transitionend', function(e){
17754				if ( $(e.target).hasClass('isotope-wrapper') ) {
17755					window.dispatchEvent(new CustomEvent('boxResized'));
17756				}
17757				return false;
17758			});
17759
17760			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
17761				var $grid = $('.ajax-grid-system').eq(0);
17762				$grid.addClass('ajax-hide-filters');
17763			}
17764
17765		});
17766	};
17767
17768	init_ajax_grid();
17769	$(document).on('uncode-ajax-filtered', init_ajax_grid);
17770
17771/*************************
17772 *
17773 * Hover hack
17774 *
17775 ************************/
17776 	var widget_hover_hack = function() {
17777 		$('.widget, .uncode_widget').each(function(){
17778			var $widget = $(this),
17779				class_w = $widget.attr('class'),
17780				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
17781				$footer = $widget.closest('#colophon');
17782
17783			if ( class_w.indexOf('widget_yith') > 0 ) {
17784				return true;
17785			}
17786
17787			$lis.each(function(){
17788 				var $li = $(this),
17789 					$a = $('a', $li),
17790 					$label = $a.closest('label');
17791
17792				if ( !$footer.length ) {
17793					$li.addClass('no-evts');
17794				}
17795
17796				if ( ! $('span', $a).length ) {
17797 					$li.addClass( 'li-hover' );
17798 				}
17799
17800 				$('li', $li).hover(function(e){
17801 					$(e.target).parents('li').each(function(){
17802 						$(this).addClass( 'parent-li-hover' );
17803 					});
17804					}, function (e) {
17805 					$(e.target).parents('li').each(function(key, val){
17806 						if ( key === 0) {
17807	 						$(val).removeClass( 'parent-li-hover' );
17808	 					}
17809 					});
17810 				});
17811
17812				$li.off('mouseup').on('mouseup', function (e) {
17813					if (e.which !== 3) {
17814						e.stopPropagation();
17815						var $a = $('a', this).first();
17816						$a[0].click();
17817					}
17818	 			});
17819 			});
17820 		});
17821	  }
17822
17823	var ajax_filters_button_mode = $('body').hasClass('ajax-filters-button-mode');
17824
17825	if (!ajax_filters_button_mode && SiteParameters.disable_hover_hack !== '1') {
17826		widget_hover_hack();
17827		$(document).on('uncode-ajax-filtered', widget_hover_hack);
17828	}
17829
17830/*************************
17831 *
17832 * Init Filters
17833 *
17834 ************************/
17835
17836	function init_filters() {
17837		$(document).on('click', '.term-filter-link', function(e) {
17838			var _this = $(this);
17839			var widget = _this.closest('.uncode_widget');
17840			var container = get_filters_container();
17841
17842			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
17843				return true;
17844			}
17845
17846			e.preventDefault();
17847
17848			if (widget.hasClass('widget-ajax-filters--checkbox')) {
17849				_this.parent().find('input[type="checkbox"]').trigger('click');
17850			} else {
17851				if (_this.hasClass('term-filter-link--active')) {
17852					_this.removeClass('term-filter-link--active');
17853				} else {
17854					_this.addClass('term-filter-link--active');
17855
17856					if (widget.hasClass('widget-ajax-filters--single')) {
17857						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
17858					}
17859				}
17860
17861				if (!ajax_filters_button_mode) {
17862					var url = _this.attr('href');
17863
17864					reload_items(container, url, true);
17865				}
17866			}
17867		});
17868
17869		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
17870			var _this = $(this);
17871			var widget = _this.closest('.uncode_widget');
17872			var link = _this.closest('.term-filter').find('.term-filter-link');
17873			var url = link.attr('href');
17874			var container = get_filters_container();
17875
17876			if (!ajax_filters_button_mode && widget.hasClass('widget-ajax-filters--no-ajax')) {
17877				window.location = url;
17878				return;
17879			}
17880
17881			if (widget.hasClass('widget-ajax-filters--single')) {
17882				widget.find('input[type="checkbox"]').each(function() {
17883					if (_this.attr('id') !== $(this).attr('id')) {
17884						$(this).prop('checked', false);
17885						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
17886					}
17887				});
17888			}
17889
17890			if (_this.prop('checked')) {
17891				link.addClass('term-filter-link--active');
17892			} else {
17893				link.removeClass('term-filter-link--active');
17894			}
17895
17896			if (!ajax_filters_button_mode) {
17897				reload_items(container, url, true);
17898			}
17899		});
17900
17901		$(document).on('change', 'select.select--term-filters', function(e) {
17902			var _this = $(this);
17903			var selected = _this.find('option:selected');
17904			var option = $(selected);
17905			var url = option.attr('data-term-filter-url');
17906			var container = get_filters_container();
17907			var widget = _this.closest('.uncode_widget');
17908
17909			if (!ajax_filters_button_mode) {
17910				if (widget.hasClass('widget-ajax-filters--no-ajax')) {
17911					window.location = url;
17912				} else {
17913					reload_items(container, url, true);
17914				}
17915			}
17916		});
17917
17918		$(document).on('click', '.filter-list__link', function(e) {
17919			if (SiteParameters.is_frontend_editor) {
17920				return false;
17921			}
17922
17923			e.preventDefault();
17924
17925			var _this = $(this);
17926			var container = get_filters_container();
17927			var url = _this.attr('href');
17928			reload_items(container, url, true);
17929		});
17930
17931		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
17932			var _this = $(this);
17933			var container = get_filters_container();
17934			var url = _this.attr('href');
17935			reload_items(container, url, true);
17936		});
17937
17938		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
17939
17940			var _this = $(this);
17941			var container = get_filters_container();
17942			var url = _this.attr('href');
17943
17944			if ( container.length ) {
17945				e.preventDefault();
17946				reload_items(container, url, true);
17947			}
17948		});
17949
17950		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
17951			var _this = $(this);
17952			var container = get_filters_container();
17953
17954			if (container.length > 0) {
17955				e.preventDefault();
17956
17957				var min_price = $('#min_price').val();
17958				var max_price = $('#max_price').val();
17959				var location = window.location;
17960				var url = location.href;
17961				var page_uri = location.origin + location.pathname;
17962				var is_filtered = page_uri !== url;
17963
17964				if (is_filtered) {
17965					url = remove_parameter_from_url(url, 'min_price');
17966					url = remove_parameter_from_url(url, 'max_price');
17967				}
17968
17969				var concat = page_uri === url ? '?' : '&';
17970				var params = {'min_price': min_price, 'max_price': max_price};
17971
17972				url = url + concat + $.param(params);
17973
17974				reload_items(container, url, true);
17975			}
17976		});
17977
17978		if (!ajax_filters_button_mode && !window._uncode_search_bound) {
17979			window._uncode_search_bound = true;
17980			var search_timeout = parseInt(SiteParameters.ajax_filter_search_timeout, 10);
17981
17982			$(document).on('input', '.term-filters-search-input', function () {
17983				var _this = $(this);
17984				var container = get_filters_container();
17985				var value = _this.val();
17986
17987				if (window._uncode_search_timer) {
17988					clearTimeout(window._uncode_search_timer);
17989				}
17990
17991				window._uncode_search_timer = setTimeout(function () {
17992					update_search_url(container, value);
17993				}, search_timeout);
17994			});
17995		}
17996
17997		$(document).on('click', '.btn-ajax-filters-trigger', function (e) {
17998			var container = get_filters_container();
17999
18000			if (container.length) {
18001				e.preventDefault();
18002				var paramMap = {};
18003
18004				$('.term-filter-link--active').each(function () {
18005					collect_from_query(paramMap, this.href.split('?')[1] || '');
18006				});
18007
18008				$('.select--term-filters').each(function () {
18009					var select = $(this);
18010					var val = select.val();
18011
18012					if (!val) {
18013						return
18014					};
18015
18016					var selected_option = select.find('option:selected');
18017					var qUrl = selected_option.data('term-filter-url') || '';
18018
18019					collect_from_query(paramMap, qUrl.split('?')[1] || '');
18020				});
18021
18022				var search = $('.term-filters-search-input');
18023
18024				if (search.length > 0) {
18025					var search_value = search.val().trim();
18026					if (search_value) {
18027						paramMap[SiteParameters.ajax_filter_key_search] = {};
18028						paramMap[SiteParameters.ajax_filter_key_search][search_value] = 1;
18029					}
18030				}
18031
18032				var qsParts = [];
18033				$.each(paramMap, function (key, valSet) {
18034					var vals = Object.keys(valSet);
18035					qsParts.push(key + '=' + vals.join(','));
18036				});
18037
18038				var final_url = window.location.origin + window.location.pathname;
18039
18040				if (qsParts.length > 0) {
18041					qsParts.push('unfilter=1');
18042
18043					var qs = qsParts.join('&');
18044					final_url = '?' + qs;
18045				}
18046
18047				reload_items(container, final_url, true);
18048			}
18049		});
18050	}
18051
18052	function collect_from_query(paramMap, query) {
18053		$.each(query.split('&'), function (_, pair) {
18054			if (!pair) {
18055				return
18056			};
18057
18058			var kv  = pair.split('=');
18059			var key = kv[0];
18060			var val = kv[1] || '';
18061
18062			if (key === 'unfilter') {
18063				return;
18064			}
18065			if (!paramMap[key]) {
18066				paramMap[key] = {}
18067			};
18068
18069			paramMap[key][val] = 1;
18070		});
18071	}
18072
18073	function update_search_url(container, search_value) {
18074		var location = window.location;
18075		var url = location.href;
18076		var page_uri = location.origin + location.pathname;
18077		var is_filtered = page_uri !== url;
18078		var key_search = SiteParameters.ajax_filter_key_search;
18079		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
18080
18081		if (is_filtered) {
18082			url = remove_parameter_from_url(url, key_search);
18083			url = remove_parameter_from_url(url, key_unfilter);
18084		}
18085
18086		if (search_value) {
18087			var concat = page_uri === url ? '?' : '&';
18088			var params = {};
18089
18090			params[key_search] = search_value;
18091			params[key_unfilter] = 1;
18092			url = url + concat + $.param(params);
18093		} else {
18094			url = remove_parameter_from_url(url, key_search);
18095		}
18096
18097		reload_items(container, url, true);
18098	}
18099
18100	function remove_parameter_from_url(url, parameter) {
18101		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
18102	}
18103
18104	function get_filters_container() {
18105		var container = $('.ajax-grid-system');
18106
18107		if (container.length == 0) {
18108			container = $('.ajax-filters-target');
18109		}
18110
18111		return container;
18112	}
18113
18114	function update_widgets_state(widgets_states, container) {
18115		for (var i = widgets_states.length - 1; i >= 0; i--) {
18116			var state = widgets_states[i];
18117
18118			if (!state.collapse) {
18119				continue;
18120			}
18121
18122			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
18123
18124			if (state.open) {
18125				new_widget.find('.widget-title').addClass('open');
18126				if (state.css) {
18127					new_widget.find('.widget-collapse-content').attr('style', state.css);
18128				}
18129			} else {
18130				new_widget.find('.widget-title').removeClass('open');
18131				if (state.css) {
18132					new_widget.find('.widget-collapse-content').attr('style', state.css);
18133				}
18134			}
18135		}
18136	}
18137
18138	// Find filters container
18139	function find_filters_container(context) {
18140		const widget = context.find('.widget-ajax-filters').first();
18141		if (!widget.length) return $();
18142
18143		const sidebar = widget.closest('.ajax-filters-sidebar');
18144		if (sidebar.length) {
18145			return sidebar.find('.uncol').last();
18146		}
18147
18148		const col = widget.closest('.uncol');
18149		if (col.length) {
18150			return col;
18151		}
18152
18153		return $();
18154	}
18155
18156	// Reload items via AJAX
18157	function reload_items(container, url, push) {
18158		if (isAjaxing) {
18159			return
18160		};
18161
18162		isAjaxing = true;
18163
18164		container.addClass('grid-filtering');
18165
18166		$.ajax({
18167			url     : url,
18168			success : function(response) {
18169				if (!response) {
18170					return;
18171				}
18172
18173				$(document).trigger('uncode-ajax-pre-filtered');
18174
18175				var container_id = container.attr('id');
18176				var pagination = $('.row-navigation');
18177				var filters_container;
18178
18179				var isTargetFilterMode = container.hasClass('ajax-filters-target');
18180
18181				if (isTargetFilterMode) {
18182					filters_container = find_filters_container($(document));
18183				}
18184
18185				if (container_id) {
18186					var container_to_append = $(response).find('#' + container_id);
18187					var pagination_to_append = $(response).find('.row-navigation');
18188					var filters_to_append;
18189					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18190
18191					if (isTargetFilterMode) {
18192						filters_to_append = find_filters_container($(response));
18193					}
18194
18195					// Remember open/closed widgets
18196					var widgets = $('.uncode_widget');
18197					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
18198					var widgets_states = [];
18199
18200					widgets.each(function() {
18201						var widget = $(this);
18202						var id = widget.attr('data-id');
18203						var state = {
18204							'id': id,
18205							'collapse': false,
18206							'open': false,
18207							'css': false,
18208						};
18209
18210						var collapse_wrapper = widget.find('.widget-collapse-content');
18211
18212						if (collapse_wrapper.length > 0) {
18213							state.collapse = true;
18214
18215							var collapse_wrapper_css = collapse_wrapper.attr('style');
18216							var title = widget.find('.widget-title');
18217
18218							state.css = collapse_wrapper_css;
18219
18220							if (title.hasClass('open')) {
18221								state.open = true;
18222							} else {
18223								state.open = false;
18224							}
18225						}
18226
18227						widgets_states.push(state);
18228					});
18229
18230					// Update widgets state when it is not in target mode
18231					if (! isTargetFilterMode && offcanvas_sidebar_wrapper.length === 0) {
18232						update_widgets_state(widgets_states, container_to_append);
18233					}
18234
18235					// Update default sidebar state
18236					if (!container.hasClass('ajax-hide-filters')) {
18237						container_to_append.removeClass('ajax-hide-filters');
18238					}
18239
18240					// Update horizontal sidebar
18241					if (!container.hasClass('ajax-hide-filters-blanks')) {
18242						container_to_append.removeClass('ajax-hide-filters-blanks');
18243					}
18244					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
18245					if (horizontal_sidebar_wrapper.length > 0) {
18246						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
18247						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
18248						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
18249						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
18250
18251						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
18252						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
18253					}
18254
18255					// Append container
18256					container.replaceWith(container_to_append);
18257
18258					// Hide first thumbnail until the new srcset is loaded
18259					if (SiteParameters.dynamic_srcset_active === '1') {
18260						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
18261					}
18262
18263					// Remove loading attribute to images
18264					container_to_append.find('img').attr('loading', '');
18265
18266					// Append pagination
18267					if (pagination.length > 0) {
18268						if (pagination_to_append.length > 0) {
18269							pagination.html(pagination_to_append.html());
18270						} else {
18271							pagination.html('');
18272						}
18273					} else {
18274						if (pagination_to_append.length > 0) {
18275							$('.post-wrapper').append(pagination_to_append);
18276						}
18277					}
18278
18279					// Append filters
18280					if (isTargetFilterMode && filters_container.length > 0) {
18281						filters_container.html(filters_to_append.html());
18282					}
18283
18284					// Update widgets state when it is in target mode
18285					if (isTargetFilterMode && filters_container.length > 0) {
18286						update_widgets_state(widgets_states, filters_container);
18287					}
18288
18289					// Update off canvas sidebar (mobile and overlay)
18290					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18291
18292					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
18293						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
18294						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
18295						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
18296						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
18297
18298						// Update widgets state
18299						update_widgets_state(widgets_states, sidebar_to_append);
18300
18301						// Update sidebar
18302						sidebar_container.html(sidebar_to_append.html());
18303					}
18304
18305					if (push) {
18306						UNCODE.lastURL = url;
18307						window.history.pushState(
18308							{ pageTitle: document.title },
18309							'',
18310							url
18311						);
18312					}
18313
18314					if (typeof UNCODE.isotopeLayout !== 'undefined') {
18315						UNCODE.isotopeLayout();
18316					}
18317					if (typeof UNCODE.justifiedGallery !== 'undefined') {
18318						UNCODE.justifiedGallery();
18319					}
18320					if (typeof UNCODE.cssGrid !== 'undefined') {
18321						UNCODE.cssGrid();
18322					}
18323					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
18324						UNCODE.lightbox();
18325					}
18326					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
18327						UNCODE.lightgallery();
18328					}
18329					if (typeof UNCODE.carousel !== 'undefined') {
18330						UNCODE.carousel($('body'));
18331					}
18332					UNCODE.animations();
18333					if (typeof UNCODE.filters !== 'undefined') {
18334						UNCODE.filters();
18335					}
18336					if (typeof UNCODE.widgets !== 'undefined' && !(isTargetFilterMode && filters_container.length > 0)) {
18337						UNCODE.widgets();
18338					}
18339
18340					if (SiteParameters.dynamic_srcset_active === '1') {
18341						UNCODE.refresh_dynamic_srcset_size();
18342					}
18343
18344					if (typeof UNCODE.menuSmartInit !== 'undefined') {
18345						UNCODE.menuSmartInit();
18346					}
18347
18348					if (typeof UNCODE.parallax !== 'undefined') {
18349						UNCODE.parallax();
18350					}
18351
18352					maybe_scroll_to_top();
18353
18354					var woo_select2_cats = $('.dropdown_product_cat');
18355
18356					if (woo_select2_cats.length > 0) {
18357						woo_select2_cats.on( 'change', function() {
18358							if ( $(this).val() != '' ) {
18359								var this_page = '';
18360								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
18361								if ( home_url.indexOf( '?' ) > 0 ) {
18362									this_page = home_url + '&product_cat=' + $(this).val();
18363								} else {
18364									this_page = home_url + '?product_cat=' + $(this).val();
18365								}
18366								location.href = this_page;
18367							} else {
18368								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
18369							}
18370						});
18371
18372						if ( $().selectWoo ) {
18373							var wc_product_cat_select = function() {
18374								woo_select2_cats.selectWoo( {
18375									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
18376									minimumResultsForSearch: 5,
18377									width: '100%',
18378									allowClear: true,
18379									language: {
18380										noResults: function() {
18381											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
18382										}
18383									}
18384								} );
18385							};
18386							wc_product_cat_select();
18387						}
18388					}
18389
18390					$(document).trigger('uncode-ajax-filtered');
18391					$(document.body).trigger('init_price_filter');
18392					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
18393					window.document.dispatchEvent(new Event("DOMContentLoaded", {
18394						bubbles: true,
18395						cancelable: true
18396					}));
18397
18398					isAjaxing = false;
18399				}
18400			},
18401			error: function() {
18402				container.removeClass('grid-filtering');
18403
18404				isAjaxing = false;
18405
18406				if (SiteParameters.enable_debug == true) {
18407					// This console log is disabled by default
18408					// So nothing is printed in a typical installation
18409					//
18410					// It can be enabled for debugging purposes setting
18411					// the 'uncode_enable_debug_on_js_scripts' filter to true
18412					console.log('There was an error retrieving the products');
18413				}
18414			}
18415		});
18416	}
18417
18418	// Scroll to top after filtering
18419	function maybe_scroll_to_top() {
18420		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
18421
18422		if (offcanvas_sidebar_wrapper.length > 0) {
18423			return;
18424		}
18425
18426		var container = get_filters_container();
18427		var bound = container[0].getBoundingClientRect();
18428
18429		if (bound.y < 0) {
18430			$(window).scrollTop(container.offset().top);
18431		}
18432	}
18433
18434	// Back/forward browser buttons
18435	$(window).on("popstate.ajaxfilters", function(e) {
18436		var location = window.location;
18437		var url = location.href;
18438		var params = UNCODE.getURLParams(window.location);
18439		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
18440
18441		UNCODE.lastURL = url;
18442
18443		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
18444			return;
18445		}
18446
18447		var container = get_filters_container();
18448
18449		reload_items(container, url, false);
18450	});
18451
18452	// Destroy load more before to init a new one
18453	$(window).on('uncode-ajax-pre-filtered', function() {
18454		if ($.fn.infinitescroll) {
18455			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
18456		}
18457	});
18458
18459	init_filters();
18460};
18461
18462UNCODE.videoThumbs = function() {
18463	var checkResize,
18464		newW = UNCODE.wwidth;
18465	var checkForVideos = function(){
18466
18467		$(window).on('okevents.y.change', function(e, y){
18468			var $video = $(y.target.g),
18469				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18470				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18471				restart = !$video_wrap.hasClass('play-pause'),
18472				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
18473				setTime;
18474			if ( newW >= UNCODE.mediaQuery ) {
18475
18476				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
18477					$video_wrap.data('hovered', true);
18478					$video_wrap.addClass('played-on');
18479					y.target.pauseVideo();
18480					$tmb.on('mouseenter', function(){
18481						if ( restart ) {
18482							y.target.seekTo(0);
18483						}
18484						y.target.playVideo();
18485					}).on('mouseleave', function(){
18486						clearTimeout(setTime);
18487						setTime = setTimeout(function(){
18488							y.target.pauseVideo();
18489						}, 300);
18490					});
18491				}
18492
18493			} else {
18494				if( $mobile_video_wrap.length ) {
18495					$video_wrap.addClass('played-on');
18496					y.target.playVideo();
18497				}
18498			}
18499
18500		});
18501
18502		$(window).on('okevents.v.loaded', function(e, playerV){
18503			var $video = $(playerV.element),
18504				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18505				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18506				restart = !$video_wrap.hasClass('play-pause'),
18507				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
18507: $video.closest('.t-entry-visual, .un-inline-image'),
18508				setTime;
18509
18510			if ( newW >= UNCODE.mediaQuery ) {
18511				
18512				if( $video_wrap.length ) {
18513
18514					var playPromise = playerV.play();
18515					if (playPromise !== undefined) {
18516						playPromise.then(function( value ) {
18517							playerV.pause();
18518						});
18519					}
18520					$video_wrap.addClass('played-on');
18521					$tmb.on('mouseenter', function(){
18522						if ( restart ) {
18523							playerV.setCurrentTime(0)
18524						}
18525						playerV.play();
18526					}).on('mouseleave', function(){
18527						clearTimeout(setTime);
18528						setTime = setTimeout(function(){
18529							playerV.pause();
18530						}, 300);
18531					});
18532				}
18533
18534			} else {
18535
18536				if( $mobile_video_wrap.length ) {
18537					var playPromise = playerV.play();
18538					if (playPromise !== undefined) {
18539						playPromise.then(function( value ) {
18540							playerV.play();
18541						});
18542					}
18543					$video_wrap.addClass('played-on');
18544				}
18545			}
18546		});
18547
18548		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
18549			var $video = $(video),
18550				$noscript = $('noscript', $video),
18551				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
18552				restart = !$video_wrap.hasClass('play-pause'),
18553				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
18554				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
18555				setTime,
18556			manageVideo = function(){
18557				video.currentTime = 0;
18558				video.pause();
18559				if ( newW >= UNCODE.mediaQuery ) {
18560					if ( $video_wrap.length ) {
18561						$video_wrap.addClass('played-on');
18562						$tmb.on('mouseenter', function(){
18563							if ( restart ) {
18564								video.currentTime = 0;
18565							}
18566							video.play();
18567						}).on('mouseleave', function(){
18568							clearTimeout(setTime);
18569							setTime = setTimeout(function(){
18570								video.pause();
18571							}, 300);
18572						});
18573					} else {
18574						video.play();
18575					}
18576				} else {
18577					if ( $mobile_video_wrap.length ) {
18578						$mobile_video_wrap.addClass('played-on');
18579						video.play();
18580					}
18581				}
18582
18583			};
18584			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
18585				$noscript.each(function(key, val){
18586					$noscript.after(val.textContent || val.innerText || val.innerHTML);
18587					$noscript.remove();
18588				});
18589			}
18590
18591			if (typeof MediaElement === "function") {
18592				$video.has('source[src]').mediaelementplayer({
18593					pauseOtherPlayers: false,
18594				});
18595			}
18596			if (video.readyState > 0) {
18597				manageVideo();
18598			} else {
18599				window.addEventListener("pageshow", function (event) {
18600					if (event.persisted) {
18601						manageVideo();
18602					}
18603				});				
18604				$video.on("loadedmetadata", function(_event) {
18605					manageVideo();
18606				});
18607			};
18608		});
18609	
18610	};
18611	
18612	checkForVideos();
18613
18614	var checkVideoResize = function(){
18615		clearRequestTimeout(checkResize);
18616		checkResize = requestTimeout(function(){
18617			if ( newW !== UNCODE.wwidth ) {
18618				checkForVideos();
18619				newW = UNCODE.wwidth;
18620			}
18621		}, 1000);
18622	};
18623
18624	$(window).off('resize.videos', checkVideoResize)
18625	.on( 'resize.videos', checkVideoResize);
18626
18627	$(window).off('more-items-loaded.videos', checkForVideos)
18628	.on('more-items-loaded.videos', checkForVideos);
18629
18630	$(document).off('uncode-ajax-filtered.videos', checkForVideos)
18631	.on('uncode-ajax-filtered.videos', checkForVideos);
18632
18633};
18634UNCODE.inlineImgs = function() {
18635    var linkInlineImgs = function(){
18636        $('.un-inline-image').each(function(){
18637            var $img = $(this),
18638                href = $(this).attr('data-link-href'),
18639                dataImg = $img.data();
18640			if ( dataImg != '' && href != null && href !== '' ) {
18641                var class_stra_a = 'unline-image-link';
18642                if ( $(this).hasClass('un-inline-space-over') ) {
18643                    class_stra_a += ' un-inline-space-over';
18644                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
18645                    class_stra_a += ' un-inline-space-gutter';
18646                }
18647                var str_a = '<a class="' + class_stra_a + '" ';
18648                for (var key in dataImg) {
18649                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
18650                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
18651                    }
18652                }
18653                str_a += ' />';
18654                $img.wrap(str_a);
18655			}
18656        });
18657    };
18658    $(window).on('load', linkInlineImgs );
18659};
18660UNCODE.lottie = function() {
18661    if ( SiteParameters.is_frontend_editor ) {
18662        var $lottie_wraps = $('div.uncode-lottie-wrap');
18663        $lottie_wraps.each(function(){
18664            var $lottie_wrap = $(this),
18665                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
18666                $player_clone = $div_player.clone(),
18667                player_id = $div_player.attr('data-id'),
18668                $lottie_players = $('lottie-player', $lottie_wrap).remove();
18669            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
18670                if ( $('#'+player_id).length ) {
18671                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
18672                }
18673                $player_clone.attr('id', player_id);
18674                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
18675                $div_player.after($player_clone);
18676                $div_player.attr('data-init',true);
18677            }
18678        });
18679    }
18680    var $players = $('.uncode-lottie-wrap lottie-player');
18681    $players.each(function(){
18682        var player = this,
18683            this_id = $(player).attr('id'),
18684            _player = document.getElementById(this_id),
18685            trigger = $(player).attr('data-trigger'),
18686            pFrames = $(player).attr('data-frames').split(','),
18687            srcPlayer = $(player).attr('src');
18688
18689        _player.load(srcPlayer);
18690
18691        _player.addEventListener("ready", function() {
18692
18693            var $_shadow = _player.shadowRoot;
18694            $($_shadow).find('.error').remove();
18695
18696            var tFrames = _player.getLottie().totalFrames / 100,
18697                pFrame_from = Math.round(tFrames * pFrames[0]),
18698                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
18699                loop = $(player).attr('loop'),
18700                mode,
18701                actions;
18702
18703            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
18704                if ( trigger === 'scroll' ) {
18705                    mode = 'scroll';
18706                    actions = [
18707                        {
18708                            visibility:[0, 1.0],
18709                            type: "seek",
18710                            frames: [pFrame_from, pFrame_to],
18711                        }
18712                    ];
18713                } else if ( trigger === 'viewport') {
18714                    mode = 'scroll';
18715                    actions = [
18716                        {
18717                            visibility: [0.20, 1.0],
18718                            frames: [pFrame_from, pFrame_to],
18719                            type: loop ? "loop" : "play"
18720                        }
18721                    ];
18722                } else if ( trigger === 'hover') {
18723                    $(player).on('mouseenter', function(){
18724                        _player.play();
18725                    }).on('mouseleave', function(){
18726                        _player.pause();
18727                    });
18728                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
18729                        _player.seek(pFrame_from);
18730                        _player.addEventListener("frame", function(){
18731                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
18732                                _player.seek(pFrame_from);
18733                            }
18734                        });
18735                    }
18736                }
18737                LottieInteractivity.create({
18738                    player: '#' + this_id,
18739                    mode: mode,
18740                    actions: actions
18741                });
18742            } else {
18743                if ( pFrame_from > 0 && pFrame_from < 99 ) {
18744                    _player.seek(pFrame_from);
18745                    _player.addEventListener("frame", function(){
18746                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
18747                            _player.seek(pFrame_from);
18748                        }
18749                    });
18750                }
18751            }
18752        });
18753
18754        $(window).on('unlottie-destroy', function(){
18755            _player.destroy();
18756        });
18757    });
18758};
18759
18760UNCODE.animatedBgGradient = function( _el ) {
18761
18762    var ev;
18763
18764	if ( typeof _el === 'undefined' || _el === null ) {
18765        _el = document;
18766        ev = false;
18767	} else {
18768        _el = _el[0];
18769        ev = 'shortcode:update';
18770    }
18771
18772    var simplex = new SimplexNoise();
18773
18774    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
18775		this.block = blockOverlay;
18776		this.wrap = canvasWrap;
18777		this.config();
18778		this.checker();
18779		this.loopRAF();
18780        this.animLoader();
18781    };
18782
18783    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
18784
18785    AnimGradient.config = function() {
18786        this.canvas = document.createElement('canvas');
18787        this.wrap.appendChild(this.canvas);
18788        this.ctx = this.canvas.getContext('2d');
18789        this.count = 0;        
18790        this.isOrientationChanged = false;
18791        this.res = UNCODE.isMobile ? 90 : 110;
18792        this.resPercent = 100/this.res;
18793        this.resAround = this.resPercent/100;
18794        this.size = typeof this.block.getAttribute('data-bg-noise-size') !== 'undefined' && this.block.getAttribute('data-bg-noise-size') !== null && this.block.getAttribute('data-bg-noise-size') !== '' ? this.block.getAttribute('data-bg-noise-size') : 1;
18795
18796        this.canvas.classList.add('uncode-bg-animated-gradient');
18797        this.canvas.setAttribute('height', this.res);
18798        this.canvas.setAttribute('width', this.res);
18799        this.canvas.style = 'height: 100%; position: relative; width:100%;';
18800
18801        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
18802
18803        this.cx = this.canvas.width/2;
18804        this.cy = this.canvas.height/2;
18805        this.data = this.imgdata.data;
18806
18807        this.opts = {
18808            col_1st: typeof this.block.getAttribute('data-bg-noise-1') !== 'undefined' && this.block.getAttribute('data-bg-noise-1') !== null && this.block.getAttribute('data-bg-noise-1') !== '' ? this.block.getAttribute('data-bg-noise-1') : false,
18809            col_2nd: typeof this.block.getAttribute('data-bg-noise-2') !== 'undefined' && this.block.getAttribute('data-bg-noise-2') !== null && this.block.getAttribute('data-bg-noise-2') !== '' ? this.block.getAttribute('data-bg-noise-2') : false,
18810            time: typeof this.block.getAttribute('data-bg-noise-speed') !== 'undefined' && this.block.getAttribute('data-bg-noise-speed') !== null && this.block.getAttribute('data-bg-noise-speed') !== '' ? parseFloat(this.block.getAttribute('data-bg-noise-speed')) : 250,//100,250,1500
18811        };
18812
18813        this.lavaTime = 1;
18814        this.bg_colors = [];
18815
18816        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
18817            return;
18818        }
18819
18820        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
18821            this.singleColor = true;
18822        }
18823
18824        if( this.opts.col_1st ) {
18825
18826            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
18827
18828            this.bg_colors.push({
18829                r: rgbColor1.r,
18830                g: rgbColor1.g,
18831                b: rgbColor1.b
18832            });
18833        }
18834
18835        if( this.opts.col_2nd ) {
18836
18837            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
18838
18839            this.bg_colors.push({
18840                r: rgbColor2.r,
18841                g: rgbColor2.g,
18842                b: rgbColor2.b
18843            });
18844        }
18845
18846    };
18847
18848    AnimGradient.checker = function() {
18849        var scope = this;
18850        this.checkInViewPort();
18851      
18852        window.addEventListener('resize', function() {
18853            if(UNCODE.isMobile && !scope.isOrientationChanged) {
18854                return;
18855            }
18856            scope.ratioCalc();
18857        });
18858
18859        window.addEventListener("orientationchange", function() {
18860            scope.isOrientationChanged = true;
18861        });
18862
18863        this.ratioCalc();
18864    }; 
18865
18866    AnimGradient.ratioCalc = function() {
18867      
18868        var blockW = this.block.clientWidth,
18869            blockH = this.block.clientHeight;
18870
18871        if ( blockH == 0 || blockW == 0 )
18872            return;
18873
18874        var blockRatio = blockH/blockW;
18875
18876        if(blockRatio < 1) {
18877            this.ratioParam = {
18878                x: 1.4,
18879                y: blockRatio*1.4
18880            }
18881        } else {
18882            this.ratioParam = {
18883                x: blockRatio/3,
18884                y: 1
18885            }
18886        }
18887         
18888    };
18889
18890    AnimGradient.checkInViewPort = function() {
18891        var scope = this;
18892        if ( $(scope.block).closest('.unmenu-inner-ul').length ) {
18893            scope.isInViewport = true;
18894        } else if( 'IntersectionObserver' in window ) {
18895		    var observer = new IntersectionObserver(function(entries) {
18896  
18897                entries.forEach(function(entry){
18898                    if ( entry.isIntersecting ) {
18899                        scope.isInViewport = true;
18900                    } else {
18901                        scope.isInViewport = false;
18902                    }
18903                });
18904  
18905		    }, { 
18906			root: document,
18907		  });
18908  
18909		  observer.observe(scope.block);
18910		}
18911	};
18912	
18913    AnimGradient.hexToRGB = function(hexval) {
18914        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
18915        if (!hexecuted) {
18916            return false;
18917        }
18918        return {
18919            r: parseInt(hexecuted[1], 16),
18920            g: parseInt(hexecuted[2], 16),
18921            b: parseInt(hexecuted[3], 16)
18922        }
18923    };
18924
18925    AnimGradient.factor = function(val_1, val_2, lava) { 
18926        return val_1 * (1 - lava) + val_2 * lava;
18927    };
18928
18929    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
18930        if (this.singleColor) {
18931            return this.bg_colors[0][wave_l];
18932        }
18933        return this.factor(this.bg_colors[0][wave_l], this.bg_colors[1][wave_l], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*3.5)*noise/2 );
18934        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
18935    };
18936
18937    AnimGradient.lava = function(x, y, grade) {
18938        var radians = (Math.PI / 180) * grade,
18939        cos = Math.cos(radians),
18940        sin = Math.sin(radians),
18941        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
18942        return nx;
18943    };
18944    
18945    AnimGradient.loopRAF = function() {
18946
18947      var scope = this;
18948
18949        if( this.isInViewport && typeof this.ratioParam !== 'undefined' ) {
18950            for (var x = 0; x < this.res; x++) {
18951                for (var y = 0; y < this.res; y++) {
18952                    
18953                    var noise = simplex.noise3D((x / this.res * this.ratioParam.x)*this.size, (y / this.res * this.ratioParam.y)*this.size, this.count/this.opts.time); //original
18954        
18955                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
18956                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
18957                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
18958                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
18959                  
18960                }
18961            }
18962   
18963            this.count++;
18964          
18965            this.ctx.putImageData(this.imgdata, 0, 0);
18966         
18967        }
18968
18969        requestAnimationFrame(function() {
18970            scope.loopRAF();
18971        });
18972    };
18973
18974    AnimGradient.animLoader = function() {
18975        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
18976    };
18977
18978    var anim_init = function() {
18979        var bgs = _el.querySelectorAll('.block-bg-overlay');
18980      
18981        bgs.forEach(function(blockOverlay) {
18982            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
18983            if( !blockOverlay || !canvasWrap ) {
18984                return;
18985            }
18986            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
18987        });
18988    }
18989
18990    $(window).on('load', function(){
18991        anim_init();
18992    });
18993
18994    if ( ev === 'shortcode:update' ) {
18995        anim_init();
18996    }
18997
18998};
18999UNCODE.multibg = function(){
19000	var $bgsWraps = $('.uncode-multi-bgs'),
19001		$body = $('body');
19002	$bgsWraps.each(function(){
19003		var $bgWrap = $(this),
19004			transition = $bgWrap.attr('data-transition'),
19005			transitionTime = $bgWrap.attr('data-transition-time'),
19006			dataPace = $bgWrap.attr('data-transition-pace'),
19007			dataThreshold = $bgWrap.attr('data-transition-threshold'),
19008			dataTime = $bgWrap.attr('data-carousel-time'),
19009			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
19010			random = $bgWrap.attr('data-multi-random'),
19011			_bgWrap = $bgWrap[0],
19012			$multiBgs = $('.multi-background', $bgWrap),
19013			imgFirst,
19014			bgAmount = $multiBgs.length,
19015			isInViewport = false,
19016			lastScrollTop = 0,
19017			counter = 0,
19018			totMove = 0,
19019			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
19020			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
19021			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
19022			offX, offY,
19023			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
19024			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
19025			requestCarousel,
19026			is_header = $bgWrap.closest('#page-header').length,
19027			startTime = new Date();
19028
19029		transition = typeof transition === 'undefined' ? '' : transition;
19030
19031		if ( random === 'true' ) {
19032			UNCODE.shuffle($multiBgs);
19033		}
19034
19035		$multiBgs.find('.background-inner').attr('data-active','false');
19036
19037		imgFirst = $multiBgs.first().find('.background-inner').attr('data-active','true').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
19038
19039		var loadFirst = function(){
19040			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
19041				opacity: 1
19042			}, 250, 'easeInQuad').css({
19043				zIndex: 1
19044			});	
19045		}
19046
19047		var loadError = function(){
19048			console.log('Multi BG loading error');
19049		}
19050
19051		if ( imgFirst && imgFirst !== 'none' ) {
19052			UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
19053		} else {
19054			loadFirst();
19055		}
19056
19057		var loadSlides = function( $thisBg ){
19058			$thisBg.attr('data-load', 'loaded');	
19059		}
19060
19061		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
19062			var $thisBg = $(val);
19063
19064			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
19065
19066				var _imgBg = $(val).find('.background-inner').css('background-image');
19067
19068				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
19069					$thisBg.attr('data-load', 'loaded');
19070				} else {
19071					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
19072					if ( typeof _imgBg !== 'undefined' ) {
19073						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
19074					}
19075				}
19076			}
19077		});
19078					
19079		var multiCarousel = function(e) {
19080
19081			clearRequestTimeout(requestCarousel);
19082
19083			var checkTime = new Date();
19084			if ( checkTime - startTime >= carouselTime && isInViewport ) {
19085				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
19086
19087				if ( $checkEl.attr('data-load') !== 'loaded' ) {
19088					requestTimeout(function(){
19089						multiCarousel();
19090					}, 100);
19091					return;
19092				}
19093
19094				counter++;
19095
19096				$multiBgs.each(function(ind, val){
19097					if ( ind === counter%bgAmount ) {
19098						$(val).stop(true,false).animate({
19099							opacity: 1
19100						}, wait, 'easeInQuad').css({
19101							zIndex: 1
19102						}).find('.background-inner').attr('data-active','true');
19103					} else {
19104						$(val).stop(true,false).animate({
19105							opacity: 0
19106						}, wait, 'easeInQuad', function(){
19107							$(val).find('.background-inner').attr('data-active','false');
19108						}).css({
19109							zIndex: 0
19110						});
19111					}
19112				});
19113
19114			}
19115
19116			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
19117				requestCarousel = requestTimeout(multiCarousel, carouselTime);
19118			}
19119	
19120		};
19121
19122		var multiMove = function(e) {
19123			if ( $body.hasClass('navbar-hover') ) {
19124				return;
19125			}
19126			var checkTime = new Date(),
19127                bound = $bgWrap[0].getBoundingClientRect(),
19128                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
19129			if (offX) {
19130				totMove += Math.sqrt(
19131					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
19132				);
19133			}
19134			if (
19135                totMove >= pace && 
19136                checkTime - startTime >= wait &&
19137                e.clientX <= (bound.left + bound.width) &&
19138                e.clientX >= bound.left &&
19139                e.clientY <= (bound.top + bound.height) &&
19140                e.clientY >= bound.top
19141            ) {
19142				counter++;
19143				startTime = checkTime;
19144				$multiBgs.each(function(ind, val){
19145					if ( ind === counter%bgAmount ) {
19146						$(val).stop(true,false).animate({
19147							opacity: 1
19148						}, wait, 'easeInQuad').css({
19149							zIndex: 1
19150						}).find('.background-inner').attr('data-active','true');
19151					} else {
19152						$(val).stop(true,false).animate({
19153							opacity: 0
19154						}, wait, 'easeInQuad', function(){
19155							$(val).find('.background-inner').attr('data-active','false');
19156						}).css({
19157							zIndex: 0
19158						});
19159					}
19160				});
19161
19162				totMove = 0;
19163			}
19164			
19165			offX = e.clientX;
19166			offY = e.clientY;
19167			
19168		};
19169
19170		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
19171			document.addEventListener("mousemove", multiMove);
19172		}
19173
19174		window.addEventListener('resize', function() {
19175			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
19176				document.removeEventListener("mousemove", multiMove);
19177				document.addEventListener("mousemove", multiMove);
19178			}
19179		});
19180
19181		var lightLoopRAF = function() {
19182
19183			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
19184				checkTime = new Date(),
19185				bound = $bgWrap[0].getBoundingClientRect(),
19186				thresholdHeader = is_header ? 100 : threshold,
19187				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
19188			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
19189				counter++;
19190				lastScrollTop = scrollTop;
19191				startTime = checkTime;
19192
19193				$multiBgs.each(function(ind, val){
19194					if ( ind === counter%bgAmount ) {
19195						$(val).stop(true,false).animate({
19196							opacity: 1
19197						}, wait, 'easeInQuad').css({
19198							zIndex: 1
19199						}).find('.background-inner').attr('data-active','true');
19200					} else {
19201						$(val).stop(true,false).animate({
19202							opacity: 0
19203						}, wait, 'easeInQuad', function(){
19204							$(val).find('.background-inner').attr('data-active','false');
19205						}).css({
19206							zIndex: 0
19207						});
19208					}
19209				});
19210
19211			}
19212
19213			requestAnimationFrame(function() {
19214				if ( isInViewport ) {
19215					lightLoopRAF();
19216				}
19217			});
19218		};
19219
19220		var currentInd = 0;
19221
19222		var loopRAF = function() {
19223
19224			var multiBgRotate = function(slideInd){
19225				currentInd = slideInd;
19226				$multiBgs.each(function(ind, val){
19227					if ( ind === slideInd ) {
19228						$(val).stop(true,false).animate({
19229							opacity: 1
19230						}, wait, 'easeInQuad').css({
19231							zIndex: 1
19232						}).find('.background-inner').attr('data-active','true');
19233					} else {
19234						$(val).stop(true,false).animate({
19235							opacity: 0
19236						}, wait, 'easeInQuad', function(){
19237							$(val).find('.background-inner').attr('data-active','false');
19238						}).css({
19239							zIndex: 0
19240						});
19241					}
19242				});
19243			};
19244			var bound = $bgWrap[0].getBoundingClientRect(),
19245				thresholdPX = UNCODE.wheight * threshold / 100,
19246				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
19247				movePX = totMove / bgAmount,
19248				moving = UNCODE.wheight - (bound.top + thresholdPX),
19249				slideInd = 0;
19250
19251			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
19252				multiBgRotate(0);
19253			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
19254				multiBgRotate(bgAmount-1);
19255			} else {
19256				slideInd = Math.ceil(moving/movePX) - 1;
19257				if ( slideInd < 0 ) {
19258					slideInd = 0;
19259				} else if ( slideInd >= bgAmount ) {
19260					slideInd = bgAmount-1;
19261				}
19262				if ( slideInd !== currentInd ) {
19263					multiBgRotate(slideInd);
19264				}
19265			}
19266
19267			requestAnimationFrame(function() {
19268				if ( isInViewport ) {
19269					loopRAF();
19270				}
19271			});
19272		};
19273
19274		if( 'IntersectionObserver' in window ) {
19275		    var observer = new IntersectionObserver(function(entries) {
19276  
19277                entries.forEach(function(entry){
19278                    if ( entry.isIntersecting ) {
19279                        isInViewport = true;
19280						if ( transition === 'scroll' ) {
19281							if ( autoScroll ) {
19282								loopRAF();
19283							} else {
19284								lightLoopRAF();
19285							}
19286						} else {
19287							multiCarousel();
19288						}
19289                    } else {
19290                        isInViewport = false;
19291                   }
19292                });
19293  
19294		    }, { 
19295				root: document,
19296				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
19297		  	});
19298
19299			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
19300		  		observer.observe(_bgWrap);
19301			}
19302
19303			window.addEventListener('resize', function() {
19304				observer.unobserve(_bgWrap);
19305				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
19306					observer.observe(_bgWrap);
19307				}
19308			});
19309	
19310		}
19311
19312	});
19313}
19314
19315UNCODE.owlNav = function(target, ev) {
19316    target = target.replace(/#\S+/g, '');
19317    var $carousel = $('#'+target),
19318        $slider = $carousel.closest('.uncode-slider'),
19319        $checkNavs = $('.uncode-owl-nav');
19320    if ( !$checkNavs.length ) {
19321        return;
19322    }
19323
19324    if ( $slider.length ){
19325        target = $slider.attr('id');
19326    }
19327
19328    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
19329        $row;
19330
19331    if ( ! $navs.length ) {
19332        $row = $carousel.closest('.vc_row.row-container');
19333        $navs = $('.uncode-owl-nav:not([data-target])', $row);
19334    }
19335        
19336    if ( ! $navs.length ) {
19337        return;
19338    }
19339
19340    $navs.each(function(){
19341        var $nav = $(this),
19342            $outer = $nav.closest('.uncode-owl-nav-out'),
19343            $inner = $nav.find('.uncode-owl-nav-in'),
19344            $navDots = $('.uncode-nav-dots', $nav),
19345            $navCounter = $('.uncode-nav-counter', $nav),
19346            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
19347            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
19348            skinInherit = $nav.hasClass('skin-inherit'),
19349            digit = parseFloat($nav.attr('data-digit')),
19350            counterDigit = parseFloat($nav.attr('data-counter-digit')),
19351            navSpeed = parseFloat($carousel.attr('data-navspeed'));
19352        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
19353
19354        if ( $nav.hasClass('pos-abs') ){
19355            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
19356                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
19357            }
19358            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
19359        } 
19360
19361        $carousel.on('refreshed.owl.carousel', counter);
19362        $carousel.on('resized.owl.carousel', counter);
19363        $carousel.on('changed.owl.carousel', counter);
19364
19365        if ( $carousel.closest('.un-submenu').length ) {
19366            $carousel.on('initialized.owl.carousel', counter);
19367        }
19368
19369        var totalSlides = 0;
19370
19371        function counter(event) {
19372            if (!event.namespace) {
19373                return;
19374            }
19375            var slides = event.relatedTarget,
19376                current = slides._current,
19377                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
19378                item = event.item,
19379                page = event.page,
19380                countPages = Math.ceil(item.count / page.size),
19381                $currentSlide = $carousel.find('.owl-item').eq(current),
19382                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
19383                activeSlide = Math.ceil(itemIndex / page.size),
19384                $prev = $nav.find('.uncode-nav-prev'),
19385                $next = $nav.find('.uncode-nav-next'),
19386                $col = $currentSlide.find('.uncol').first();
19387
19388            if ( totalSlides != countPages ) {
19389                totalSlides = countPages;
19390                $navDots.html('');
19391                var nav_html = '';
19392                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
19393                    var padN = sl_ind+1;
19394                    if ( digit && digit > 1 ) {
19395                        padN = String(padN).padStart(digit, '0');
19396                    }
19397                    nav_html += '<button class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '" tabindex="0"><span>' + padN + '</span></button>';
19398                }
19399                $navDots.html(nav_html);
19400
19401                var totalSlidesDigit = totalSlides;
19402
19403                if ( counterDigit && counterDigit > 1 ) {
19404                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
19405                }
19406                $counterTotal.html(totalSlidesDigit);
19407            }
19408
19409            if ( loop !== true ) {
19410                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
19411                if ( itemIndex === 1 ) {
19412                    $prev.addClass('uncode-nav-disabled');
19413                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
19414                    $next.addClass('uncode-nav-disabled');
19415                    activeSlide = Math.ceil(item.count / page.size);
19416                }
19417            }
19418
19419            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
19420            var activeSlideDigit = activeSlide;
19421
19422            if ( counterDigit && counterDigit > 1 ) {
19423                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
19424            }
19425            $counterIndex.html(activeSlideDigit);
19426
19427            if ( skinInherit ) {
19428                if ( $col.hasClass('style-light') ){
19429                    $nav.removeClass('style-dark').addClass('style-light');
19430                } else if ( $col.hasClass('style-dark') ) {
19431                    $nav.removeClass('style-light').addClass('style-dark');
19432                }
19433            }
19434
19435            $inner.removeClass('uncode-owl-nav-waiting');
19436
19437            if ( $nav.hasClass('outer-width') ) {
19438                var navW = $nav.outerWidth(),
19439                    nexW = $next.outerWidth(),
19440                    prevW = $prev.outerWidth(),
19441                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
19442
19443                if ( $nav.hasClass('h-align-justify') ) {
19444                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
19445                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
19446                        $inner.css({'margin': 'auto'});
19447                    } else {
19448                        $inner.css({'margin': ''});
19449                    }
19450                } else {
19451                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
19452                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
19453                        $inner.css({'margin': 'auto'});
19454                    } else {
19455                        $inner.css({'margin': ''});
19456                    }
19457                }
19458            }
19459        }
19460
19461        $nav.on('click', '.uncode-nav-index', function(){
19462            var $bullet = $(this),
19463                slide_index = parseFloat( $bullet.attr('data-key') );
19464            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
19465        });
19466        $nav.on('click', '.uncode-nav-prev', function(){
19467            $carousel.trigger('prev.owl.carousel', [navSpeed]);
19468        });
19469        $nav.on('click', '.uncode-nav-next', function(){
19470            $carousel.trigger('next.owl.carousel', [navSpeed]);
19471        });
19472
19473        if ( $nav.hasClass('animated-arrows') ) {
19474            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
19475                $(this).addClass("hover"); 
19476            }).on('animationend', function(){
19477                $(this).removeClass("hover");  
19478            });
19479        }
19480
19481        var positionNav = function(){
19482            if ( $nav.hasClass('window-width') ) {
19483                var navOff = parseFloat( $nav.offset().left ) * -1;
19484                if ( navOff > 0 ) {
19485                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
19486                } else {
19487                    $inner.css({ transform: 'none' });
19488                }
19489            }
19490        }
19491        positionNav();
19492        $(window).on('resize', positionNav);
19493        $(document).on('un-menu-show', positionNav);
19494    });
19495
19496    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
19497};
19498
19499	UNCODE.init = function() {
19500		var wfl_check = false, wfl_request, waypoint_request;
19501		UNCODE.preventDoubleTransition();
19502		UNCODE.betterResize();
19503		UNCODE.utils();
19504		UNCODE.unBlockMenu();
19505		UNCODE.mobileMenuBlockSkins();
19506		UNCODE.magnetic();
19507		if (typeof UNCODE.accessibility !== 'undefined') {
19508			UNCODE.accessibility();
19509		}
19510		if (typeof UNCODE.rowParallax !== 'undefined') {
19511			UNCODE.rowParallax();
19512		}
19513		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
19514			UNCODE.changeSkinOnScroll();
19515		}
19516		if (typeof UNCODE.share !== 'undefined') {
19517			UNCODE.share();
19518		}
19519		if (typeof UNCODE.tooltip !== 'undefined') {
19520			UNCODE.tooltip();
19521		}
19522		if (typeof UNCODE.counters !== 'undefined') {
19523			UNCODE.counters();
19524		}
19525		if (typeof UNCODE.countdowns !== 'undefined') {
19526			UNCODE.countdowns();
19527		}
19528		if (typeof UNCODE.tabs !== 'undefined') {
19529			UNCODE.tabs();
19530		}
19531		if (typeof UNCODE.collapse !== 'undefined') {
19532			UNCODE.collapse();
19533		}
19534		if (typeof UNCODE.bigText !== 'undefined') {
19535			UNCODE.bigText();
19536		}
19537		UNCODE.menuSystem();
19538		if (typeof UNCODE.bgChanger !== 'undefined') {
19539			UNCODE.bgChanger();
19540		}
19541		if (typeof UNCODE.magicCursor !== 'undefined') {
19542			UNCODE.magicCursor();
19543		}
19544		if (typeof UNCODE.magneticCursor !== 'undefined') {
19545			UNCODE.magneticCursor();
19546		}
19547		if (typeof UNCODE.dropImage !== 'undefined') {
19548			UNCODE.dropImage();
19549		}
19550		if (typeof UNCODE.postTable !== 'undefined') {
19551			UNCODE.postTable();
19552		}
19553		if (typeof UNCODE.rotatingTxt !== 'undefined') {
19554			UNCODE.rotatingTxt();
19555		}
19556		if (typeof UNCODE.okvideo !== 'undefined') {
19557			UNCODE.okvideo();
19558			window.addEventListener( "uncode-more-items-loaded", function() {
19559				UNCODE.okvideo("uncode-more-items-loaded");
19560			});
19561		}
19562		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
19563			UNCODE.backgroundSelfVideos();
19564		}
19565		UNCODE.tapHover();
19566		if (typeof UNCODE.isotopeLayout !== 'undefined') {
19567			UNCODE.isotopeLayout();
19568		}
19569		if (typeof UNCODE.justifiedGallery !== 'undefined') {
19570			UNCODE.justifiedGallery();
19571		}
19572		if (typeof UNCODE.cssGrid !== 'undefined') {
19573			UNCODE.cssGrid();
19574		}
19575		if (typeof UNCODE.linearGrid !== 'undefined') {
19576			UNCODE.linearGrid();
19577		}
19578		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
19579			UNCODE.lightbox();
19580		}
19581		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
19582			$(window).on('load more-items-loaded',function(){
19583				UNCODE.lightgallery();
19584			});
19585		}
19586		if (typeof UNCODE.carousel !== 'undefined') {
19587			UNCODE.carousel($('body'));
19588		}
19589		if (typeof UNCODE.lettering !== 'undefined') {
19590			UNCODE.lettering();
19591		}
19592		UNCODE.animations();
19593		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
19594			UNCODE.stickyElements();
19595		}
19596		if (typeof UNCODE.twentytwenty !== 'undefined') {
19597			UNCODE.twentytwenty();
19598		}
19599		UNCODE.disableHoverScroll();
19600		UNCODE.printScreen();
19601		if (typeof UNCODE.particles !== 'undefined') {
19602			UNCODE.particles();
19603		}
19604		if (typeof UNCODE.filters !== 'undefined') {
19605			UNCODE.filters();
19606		}
19607		if (typeof UNCODE.ajax_filters !== 'undefined') {
19608			UNCODE.ajax_filters();
19609		}
19610		if (typeof UNCODE.widgets !== 'undefined') {
19611			UNCODE.widgets();
19612		}
19613		if (typeof UNCODE.unmodal !== 'undefined') {
19614			UNCODE.unmodal();
19615		}
19616		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
19617			if ( !UNCODE.isFullPage ) {
19618				UNCODE.checkScrollForTabs();
19619			}
19620		}
19621		if (typeof UNCODE.onePage !== 'undefined') {
19622			UNCODE.onePage(UNCODE.isMobile);
19623		}
19624		if (typeof UNCODE.fullPage !== 'undefined') {
19625			$(document).ready(function(){
19626				UNCODE.fullPage();
19627			});
19628		}
19629		if (typeof UNCODE.skewIt !== 'undefined') {
19630			UNCODE.skewIt();
19631		}
19632		if (typeof UNCODE.rotateIt !== 'undefined') {
19633			UNCODE.rotateIt();
19634		}
19635		if (typeof UNCODE.textMarquee !== 'undefined') {
19636			UNCODE.textMarquee();
19637		}
19638		if (typeof UNCODE.stickyScroll !== 'undefined') {
19639			UNCODE.stickyScroll();
19640		}
19641		if (typeof UNCODE.stickyTrigger !== 'undefined') {
19642			UNCODE.stickyTrigger();
19643		}
19644		if (typeof UNCODE.areaTextReveal !== 'undefined') {
19645			UNCODE.areaTextReveal();
19646		}
19647		if (typeof UNCODE.thumbsReveal !== 'undefined') {
19648			UNCODE.thumbsReveal();
19649		}
19650		if (typeof UNCODE.verticalText !== 'undefined') {
19651			UNCODE.verticalText();
19652		}
19653		if (typeof UNCODE.videoThumbs !== 'undefined') {
19654			UNCODE.videoThumbs();
19655		}
19656		if (typeof UNCODE.revslider !== 'undefined') {
19657			UNCODE.revslider();
19658		}
19659		if (typeof UNCODE.layerslider !== 'undefined') {
19660			UNCODE.layerslider();
19661		}
19662		if (typeof UNCODE.lottie !== 'undefined') {
19663			UNCODE.lottie();
19664		}
19665		if (typeof UNCODE.inlineImgs !== 'undefined') {
19666			UNCODE.inlineImgs();
19667		}
19668		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
19669			UNCODE.animatedBgGradient();
19670		}
19671		if (typeof UNCODE.readMoreCol !== 'undefined') {
19672			UNCODE.readMoreCol();
19673		}
19674		if (typeof UNCODE.multibg !== 'undefined') {
19675			UNCODE.multibg();
19676		}
19677		if (typeof UNCODE.flexEqual !== 'undefined') {
19678			UNCODE.flexEqual();
19679		}
19680		if (typeof UNCODE.wrapperMarquee !== 'undefined') {
19681			UNCODE.wrapperMarquee();
19682		}
19683		if (typeof UNCODE.wrapperSticky !== 'undefined') {
19684			UNCODE.wrapperSticky();
19685		}
19686		if (typeof UNCODE.mouseTrail !== 'undefined') {
19687			UNCODE.mouseTrail();
19688		}
19689		if (typeof UNCODE.magneticPattern !== 'undefined') {
19690			UNCODE.magneticPattern();
19691		}
19692		if (typeof UNCODE.thumbDrop !== 'undefined') {
19693			UNCODE.thumbDrop();
19694		}
19695		$(window).on('load',function(){
19696			clearRequestTimeout(waypoint_request);
19697			waypoint_request = requestTimeout( function(){
19698				Waypoint.refreshAll();
19699			}, 1000);
19700		});
19701		$(window).one('load',function(){
19702			if (typeof UNCODE.parallax !== 'undefined') {
19703				UNCODE.parallax();
19704			}
19705		});
19706	}
19707
19708	if ( ! SiteParameters.is_frontend_editor ) {
19709		UNCODE.init();
19710	}
19711
19712
19713})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.