PageSourceSearch

https://wwf.hu/wp-content/themes/uncode/library/js/app.js?ver=1564250100

js wwf.hu collected 2026-10-02 04:17:11 UTC 523,318 bytes, 15,705 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};
769UNCODE.rowParallax = function(){
770
771	if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) {
772		return;
773	}
774
775	var $rows = $('.parallax-move'),
776		stableHeight = UNCODE.wheight;
777	$rows.each(function(){
778		var $row = $(this),
779			_row = $row[0],
780			dataMove = $row.attr('data-parallax-move'),
781			dataSafe = $row.attr('data-parallax-safe'),
782            rowInViewport = false,
783			trans;
784
785		if ( $row.find('.parallax-move').length ) {
786			return;
787		}
788
789		dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe;
790		dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove;           
791        dataMove = dataMove / 10;
792
793        if ( 'IntersectionObserver' in window ) {
794			var observer = new IntersectionObserver(function(entries) {
795	
796				entries.forEach(function(entry){
797					if ( entry.isIntersecting ) {
798						rowInViewport = true;
799					} else {
800						rowInViewport = false;
801					}
802				});
803	
804			}, { 
805				root: document,
806			});
807	
808			observer.observe(_row);
809		} else {
810            rowInViewport = true;
811		}
812
813		var loopRAF = function() {
814			if( rowInViewport ) {
815				var bound = _row.getBoundingClientRect(),
816					bound_top = bound.top,
817					bound_height = bound.height,
818					move = true,
819					scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
820					docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
821						document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ),
822					fromBottom = docH - (scrolled + bound_top + bound_height);
823
824                if ( bound_height > stableHeight && dataSafe === 'yes' ) {
825                    $row.find('>div').css({
826                        'transform':'none'
827                    });
828                    move = false;
829				}
830
831				if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) {
832					$row.find('>div').css({
833						'transform':'none'
834					});
835					move = false;
836				}
837
838				if ( move ) {
839
840					if ( fromBottom < stableHeight ) {
841						//maybe Footer
842						trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove);
843                    } else if ( scrolled + bound_top < stableHeight ) {
844						//maybe Header
845						trans = scrolled*(dataMove);
846					} else {
847						trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove);
848					}
849
850                    $row.find('>div').css({
851                        'transform':'translateY(' + (trans) + 'px) translateZ(0)',
852                    });
853                }
854			}
855	
856			requestAnimationFrame(loopRAF);
857		};
858		
859		requestAnimationFrame(loopRAF);
860
861	});
862
863	$(window).on( 'load resize', function(e) {
864		if ( ! UNCODE.isMobile ) {
865			stableHeight = UNCODE.wheight;
866		}
867	});
868
869	$(window).on( 'load wwResize', function(e) {
870		if ( UNCODE.isMobile ) {
871			stableHeight = UNCODE.wheight;
872		}
873	});
874
875}
876
877UNCODE.changeSkinOnScroll = function(){
878	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
879		return;
880	}
881	var $masthead = $('#masthead'),
882		transDesktop,
883		transMobile,
884		changeSkin,
885
886	checkTransparencyAndChange = function( $col ){
887		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
888		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
889		changeSkin = $masthead.hasClass('menu-change-skin');
890
891		if ( ! transDesktop && ! transMobile ) {
892			return false;
893		}
894
895		if ( ! changeSkin ) {
896			return false;
897		}
898
899		if ( $col.hasClass('style-light') ){
900			$masthead.removeClass('style-dark-override').addClass('style-light-override');
901			return false;
902		} else if ( $col.hasClass('style-dark') ) {
903			$masthead.removeClass('style-light-override').addClass('style-dark-override');
904			return false;
905		}
906	};
907
908	var prev_row = 'normal',
909		odd = true,
910		$rows = $('.vc_row[data-parent]:visible:not(.overlay-menu *):not(#uncode-mobile-menu-block *)');
911	$.each($rows, function(index, row){
912		var $row = $(row),
913			$col = $('.uncol', $row).first(),
914			$slider = $('.uncode-slider', $row);
915
916		if ( $row.closest('li.menu-item').length ) {
917			return;
918		}
919
920		var wayDown = new Waypoint({
921			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
922			element: row,
923			handler: function(direction) {
924				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
925					if ( $slider.length ) {
926						$col = $('.owl-item.index-active .uncol', $slider).first();
927					}
928					checkTransparencyAndChange($col);
929				}
930				if ( odd === false ) {
931					if ( row.hasAttribute('data-bg-changer') ) {
932						prev_row = 'bg-changer';
933					} else {
934						prev_row = 'normal';
935					}
936					odd = true;
937				} else {
938					odd = false;
939				}
940			},
941			offset: function() {
942				return UNCODE.menuHeight / 2
943			}
944		});
945		var wayUp = new Waypoint({
946			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
947			element: row,
948			handler: function(direction) {
949				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
950					if ( $slider.length ) {
951						$col = $('.owl-item.index-active .uncol', $slider).first();
952					}
953					checkTransparencyAndChange($col);
954				}
955				if ( odd === false ) {
956					if ( row.hasAttribute('data-bg-changer') ) {
957						prev_row = 'bg-changer';
958					} else {
959						prev_row = 'normal';
960					}
961					odd = true;
962				} else {
963					odd = false;
964				}
965			},
966			offset: function() {
967				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
968			}
969		});
970	});
971
972};
973
974UNCODE.share = function() {
975	if (typeof Share !== 'undefined') {
976		var share_button_element = $('.share-button');
977		var share_button_url = share_button_element.data('url');
978
979		var share_button_config = {
980			ui: {
981				flyout: "top center",
982				button_font: false,
983				button_text: '',
984				icon_font: false
985			}
986		};
987
988		if (share_button_url) {
989			share_button_config.url = share_button_url.replace("&", "%26");
990		}
991
992		var share_button_top = new Share('.share-button', share_button_config);
993
994		$('li[data-network]', share_button_element).each(function(){
995			var label = SiteParameters.uncode_share_label,
996				network = $(this).attr('data-network');
997			label = label.replace("%", network);
998			$(this).attr('aria-label', label);
999		});
1000	}
1001};
1002
1003UNCODE.tooltip = function() {
1004	if (typeof jQuery.fn.tooltip !== 'undefined') {
1005		$('.btn-tooltip').tooltip();
1006	}
1007};
1008
1009UNCODE.counters = function() {
1010	var $counters = $('.uncode-counter:not(.counter-init)');
1011	$counters.each(function(){
1012		var $counter = $(this).addClass('counter-init');
1013		if ( SiteParameters.is_frontend_editor ) {
1014			$counter.addClass('started');
1015		}
1016		if ( $counter.closest( '.owl-carousel' ).length ) {
1017			return;
1018		}
1019		$counter.addClass('started').counterUp({
1020			delay: 10,
1021			time: 1500
1022		});
1023	});
1024};
1025
1026UNCODE.countdowns = function() {
1027	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
1028	$countdowns.each(function() {
1029		var $this = $(this).addClass('counter-init'),
1030			finalDate = $(this).data('uncode-countdown');
1031		$this.countdown(finalDate, function(event) {
1032			$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>'));
1033		});
1034	});
1035};
1036
1037UNCODE.tabs = function() {
1038
1039	var tabSwitcher = function($el){
1040		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1040ical):not(.tab-switch)', $el).each(function(key, value){
1041			var $navs = $(value),
1042				$active = $('li.active', $navs),
1043				$active_a = $('> a', $active),
1044				$active_span = $('> span', $active_a),
1045				vertical = $navs.closest('.vertical-tab-menu').length;
1046			
1047			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
1048				$navs.append('<span class="switcher-cursor" aria-hidden="true" tabindex="-1" />');
1049			}
1050
1051			var $cursor = $('.switcher-cursor', $navs),
1052				active_w = $('a', $active).outerWidth(),
1053				span_w = $active_span.outerWidth(),
1054				active_pos = $active.position(),
1055				active_a_pos = $active_a.position(),
1056				span_pos = $active_span.position(),
1057				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
1058				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
1059
1060			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
1061
1062			if ( ! vertical ) {
1063				$cursor.css({
1064					left: cursor_left,
1065					width: cursor_w
1066				});
1067			}
1068
1069			$navs.addClass('switch-init');
1070		});
1071	};
1072
1073	var $body = $('body');
1074	tabSwitcher($body);
1075
1076	var tabHoverIntent = function(){
1077		var setHover;
1078		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
1079			.on('mouseover', function(e){
1080				var $this = $(e.target);
1081				setHover = requestTimeout(function() {
1082					$this.trigger('hover-int');
1083				}, 50);
1084			})
1085			.on('mouseout', function(){
1086				clearRequestTimeout(setHover);
1087			});
1088	};
1089	tabHoverIntent();
1090
1091	var tabInit = function(){
1092		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
1093			e.preventDefault()
1094			var $el = $(this);
1095			$el.tab('show');
1096			var $container = $el.closest('.uncode-tabs');
1097			tabSwitcher($container);
1098			requestTimeout(function() {
1099				window.dispatchEvent(UNCODE.boxEvent);
1100				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
1101
1102				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
1103					window.dispatchEvent(new CustomEvent('boxResized'));
1104				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
1105					window.dispatchEvent(new Event('resize'));
1106					$(window).trigger('uncode.re-layout');
1107				} 
1108
1109				var $active_panel = $('.tab-pane.active', $tabs);
1110
1111				$.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) {
1112					var element = $(val),
1113						delayAttr = element.attr('data-delay');
1114					if (delayAttr == undefined) delayAttr = 0;
1115					requestTimeout(function() {
1116						element.addClass('start_animation');
1117					}, delayAttr);
1118				});
1119
1120			}, 300);
1121
1122			var $li = $el.closest('li'),
1123				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1124			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1125			$('.tab-pane', $li).slideDown(250);
1126			var completeSlideDown = requestTimeout(function(){
1127				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1128					var pos = $el.offset(),
1129						rect = $el[0].getBoundingClientRect(),
1130						$masthead = $('#masthead > .menu-container'),
1131						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1132
1133					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1134						$('html, body').animate({
1135							scrollTop: ( pos.top ) - considerMenu
1136						},{
1137							easing: 'easeInOutQuad',
1138							duration: 250
1139						});
1140					}
1141				}
1142			}, 260);
1143		});
1144	}
1145	tabInit();
1146
1147	var tabResponsive = function(){
1148		if ( SiteParameters.is_frontend_editor ) {
1149			return true;
1150		}
1151		var $tabContainers = $('.tab-container.tabs-breakpoint');
1152		$tabContainers.each(function(){
1153			var $tabContainer = $(this),
1154				$tabContent = $('.tab-content', $tabContainer),
1155				$nav = $('.nav-tabs', $tabContainer),
1156				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1157
1158			$('> li', $nav).each(function(){
1159				var $li = $(this),
1160					dataID = $li.attr('data-tab-id');
1161
1162				if ( UNCODE.wwidth <= mQuery ) {
1163					if ( ! $('.tab-pane', $li ).length ) {
1164						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1165						$tabContainer.addClass('tabs-appended');
1166						$li.append($append_pane);
1167					}
1168
1169					if ( $li.hasClass('active') ) {
1170						$('> a', $li).triggerHandler('click.bs.tab.data-api');
1171					}
1172				} else {
1173					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1174						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1175						$tabContainer.removeClass('tabs-appended');
1176						$tabContent.prepend($append_pane.removeAttr('style'));
1177					}
1178				}
1179			});
1180		});
1181
1182	}
1183	tabResponsive();
1184
1185	$(window).on('wwResize', function(){
1186		tabHoverIntent();
1187		tabSwitcher($body);
1188	});
1189
1190	var setCTA;
1191	$(window).on( 'resize', function(){
1192		clearRequestTimeout(setCTA);
1193		setCTA = requestTimeout( tabResponsive, 100 );
1194	});
1195
1196	$('.nav-tabs').each(function(){
1197		var $nav = $(this),
1198			$lis = $('> li:not(.active)', $nav),
1199			$links = $('.tab-excerpt-link', $nav);
1200		$('.tab-excerpt', $lis).slideUp(400, function(){
1201			$(this).addClass('init');
1202		});
1203
1204		$links.each(function(){
1205			var $link = $(this),
1206				$par_a = $link.closest('a'),
1207				href = $link.attr('data-href'),
1208				target = $link.attr('data-target');
1209			$par_a.addClass('inner-link');
1210			$link.on('click', function(){
1211				var _link = document.createElement('a');
1212				_link.href = href;
1213				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1214				_link.click();
1215			});
1216		});
1217		$nav.addClass('tab-init');
1218	});
1219
1220	$('.uncode-tabs.tabs-no-lazy').each(function(){
1221		var $tabs = $(this),
1222			$panes = $('.tab-pane:not(.active)', $tabs);
1223		$panes.each(function(){
1224			var $pane = $(this),
1225				$imgs = $('img[loading="lazy"]', $pane);
1226			$imgs.removeAttr('loading');
1227			$imgs.removeAttr('decoding');
1228		});
1229	});
1230
1231};
1232UNCODE.collapse = function() {
1233	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1234		var $this = $(this),
1235			href
1236		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1237		var $target = $(target)
1238		var parent = $this.attr('data-parent')
1239		var $parent = parent && $(parent)
1240		var $title = $(this).parent()
1241		var $accordion = $(e.target).closest('.uncode-accordion')
1242		var $group = $this.closest('.group')
1243		var $panel_group = $this.closest('.panel-group')
1244		if ($parent) {
1245			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1246			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1247				$title.removeClass('active');
1248				$group.removeClass('active-group');
1249			} else {
1250				if ( $panel_group.attr('data-no-toggle') != true ) {
1251					$parent.find('.panel-title').removeClass('active')
1252					$parent.find('.group').removeClass('active-group')
1253				}
1254				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1255				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1256			}
1257		}
1258		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1259		requestTimeout(function() {
1260			var $accordion = $(e.target).closest('.uncode-accordion');
1261			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1262			  window.dispatchEvent(new CustomEvent('boxResized'));
1263			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1264				window.dispatchEvent(new Event('resize'));
1265				$(window).trigger('uncode.re-layout');
1266			} 
1267
1268			var $active_panel = $('.panel.active-group', $parent);
1269
1270			$.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) {
1271				var element = $(val),
1272					delayAttr = element.attr('data-delay');
1273				if (delayAttr == undefined) delayAttr = 0;
1274				requestTimeout(function() {
1275					element.addClass('start_animation');
1276				}, delayAttr);
1277			});
1278
1279		}, 500);
1280
1281		$group.find('.panel-title:not(.active) > a').trigger('blur');
1282
1283	});
1284
1285	$('.uncode-accordion.tabs-no-lazy').each(function(){
1286		var $accordion = $(this),
1287			$panes = $('.panel:not(.active-group)', $accordion);
1288		$panes.each(function(){
1289			var $pane = $(this),
1290				$imgs = $('img[loading="lazy"]', $pane);
1291			$imgs.removeAttr('loading');
1292			$imgs.removeAttr('decoding');
1293		});
1294	});
1295};
1296
1297UNCODE.accessibility = function() {
1298    if ( ! SiteParameters.uncode_is_accessible ) {
1299        return;
1300    }
1301
1302    //
1303
1304};
1305UNCODE.bigText = function(el) {
1306	var bigTextLaunch = function(){
1307		if (el == undefined) {
1308			el = $('body');
1309		}
1310		$.each($('.bigtext', el), function(index, val) {
1311			$(val).bigtext({
1312				minfontsize: 24
1313			});
1314			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1315				opacity: 1
1316			});
1317			requestTimeout(function() {
1318				if ($(val).find('.animate_when_almost_visible').length != 0) {
1319					$(val).css({opacity: 1});
1320				}
1321			}, 400);
1322		});
1323	};
1324
1325	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1326		bigTextLaunch();
1327	}
1328	$(window).on( 'load', bigTextLaunch );
1329};
1330
1331UNCODE.process_shortpixel_image = function(image) {
1332	var data = {
1333		action: 'shortpixel_manual_optimization',
1334		image_id: image,
1335		cleanup: true
1336	};
1337
1338	$.get(SiteParameters.ajax_url, data);
1339};
1340
1341UNCODE.animateSubInside = function( _this, remove ){
1342	if ( typeof remove !== 'undefined' && remove === true ) {
1343		$('.animate_when_almost_visible', _this).each(function(){
1344			$(this).removeClass('start_animation');
1345		});
1346		$(document).trigger('sub-menu-slide-up');
1347	} else {
1348		$.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)', _this), function(index, val) {
1349			var element = $(val),
1350				delayAttr = element.attr('data-delay');
1351			if (delayAttr == undefined) delayAttr = 0;
1352			requestTimeout(function() {
1353				element.addClass('start_animation');
1354			}, delayAttr);
1355		});
1356		document.dispatchEvent(new CustomEvent('sub-menu-slide-down'));
1357	}
1358};
1359
1360
1361UNCODE.menuSystem = function() {
1362
1363	function menuMobile() {
1364		var $body = $('body'),
1365			scrolltop,
1366			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile:not(.vc_element)'),
1367			$masthead = $('#masthead'),
1368			$menuBlock = $('#uncode-mobile-menu-block'),
1369			$box,
1370			$el,
1371			$el_transp,
1372			elHeight,
1373			offCanvasAnim,
1374			check,
1375			animating = false,
1376			stickyMobile = false,
1377			menuClose = new CustomEvent('menuMobileClose'),
1378			menuOpen = new CustomEvent('menuMobileOpen');
1379		UNCODE.menuOpened = false;
1380		$mobileToggleButton.on('click', function(event) {
1381			event.stopPropagation();
1382			var btn = this;
1383			if ($(btn).hasClass('overlay-close')) return;
1384			event.preventDefault();
1385			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1386			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1387				$box = $(this).closest('.box-container').find('.main-menu-container:not(.no-mobile):not(.main-wrapper *)');
1388				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand):not(.main-wrapper *), .menu-sidebar-inner:not(.main-wrapper *)');
1389				$el_transp = $('.menu-absolute.menu-transparent');
1390				if (UNCODE.isMobile) {
1391					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 ) {
1392						stickyMobile = true;
1393						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1394					} else {
1395						elHeight = 0;
1396						$.each($box.find('> div'), function(index, val) {
1397							elHeight += $(val).outerHeight();
1398						});
1399					}
1400				} else {
1401					elHeight = 0;
1402					$.each($el, function(index, val) {
1403						elHeight += $(val).outerHeight();
1404					});
1405				}
1406				var open = function() {
1407					clearTimeout(offCanvasAnim);
1408					if (!animating) {
1409						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1410						scrolltop = $(window).scrollTop();
1411						window.dispatchEvent(menuOpen);
1412						animating = true;
1413						UNCODE.menuOpened = true;
1414						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1415							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1416								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1417							}
1418							if ($('body.menu-offcanvas').length) {
1419								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1420								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1421							} else {
1422								if ( $('.menu-hide, .menu-sticky').length ) {
1423									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1424										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1425									}
1426								}
1427							}
1428						}
1429						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1430							//$("#masthead")[0].scrollIntoView();
1431							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + 
1431UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1432						}
1433						$box.addClass('open-items');
1434						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1435							$el_transp.addClass('is_mobile_open');
1436						}
1437						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1438							btn.classList.add('close');
1439							$box.animate({
1440								height: elHeight
1441							}, 600, "easeInOutCirc", function() {
1442								animating = false;
1443								if (!stickyMobile) $box.css('height', 'auto');
1444							});
1445						} else {
1446							animating = false;
1447						}
1448
1449						if ( $menuBlock.length ) {
1450							UNCODE.animateSubInside($menuBlock);
1451						}
1452					}
1453				};
1454
1455				var close = function() {
1456					clearTimeout(offCanvasAnim);
1457					if (!animating) {
1458						window.dispatchEvent(menuClose);
1459						animating = true;
1460						UNCODE.menuOpened = false;
1461						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1462							btn.classList.remove('close');
1463							btn.classList.add('closing');
1464						}
1465						$box.addClass('close');
1466						requestTimeout(function() {
1467							$box.removeClass('close');
1468							$box.removeClass('open-items');
1469							btn.classList.remove('closing');
1470							if ($el_transp.length) {
1471								$el_transp.removeClass('is_mobile_open');
1472							}
1473						}, 500);
1474						$body.removeClass('opening-overlay-menu');
1475						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1476							$box.animate({
1477								height: 0
1478							}, {
1479								duration: 600,
1480								easing: "easeInOutCirc",
1481								complete: function(elements) {
1482									$(elements).css('height', '');
1483									animating = false;
1484									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1485										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1486									}
1487									$body.removeClass('open-overlay-menu');
1488									if ( $menuBlock.length ) {
1489										UNCODE.animateSubInside($menuBlock, true);
1490									}
1491								}
1492							});
1493						} else {
1494							animating = false;
1495							offCanvasAnim = setTimeout(function(){
1496								$body.removeClass('open-overlay-menu');
1497								if ( $menuBlock.length ) {
1498									UNCODE.animateSubInside($menuBlock, true);
1499								}
1500							}, 1000);
1501						}
1502					}
1503				};
1504				check = (!UNCODE.menuOpened) ? open() : close();
1505			}
1506		});
1507
1508		$('html').on('click', function(event){
1509			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1510				$('.uncode-close-offcanvas-mobile:visible').trigger('click');
1511			}
1512		});
1513
1514		window.addEventListener('menuMobileTrigged', function(e) {
1515			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1516		});
1517		window.addEventListener('orientationchange', function(e) {
1518			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1519		});
1520		window.addEventListener("resize", function() {
1521			if ($(window).width() < UNCODE.mediaQuery) {
1522				if (UNCODE.isMobile) {
1523					var $box = $('.box-container .main-menu-container'),
1524						$el = $('.box-container .menu-horizontal-inner:not(.no-mobile), .box-container .menu-sidebar-inner:not(.no-mobile)');
1525					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1526						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1527							elHeight = 0;
1528							$.each($el, function(index, val) {
1529								elHeight += $(val).outerHeight();
1530							});
1531							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;
1532							$($box).css('height', elHeight + 'px');
1533						}
1534					}
1535				}
1536			} else {
1537				$('.menu-hide-vertical').removeAttr('style');
1538				$('.menu-container-mobile').removeAttr('style');
1539				$('.vmenu-container.menu-container').removeAttr('style');
1540
1541				if ( UNCODE.menuOpened ) {
1542					$('.open-items').removeClass('open-items');
1543					$('.is_mobile_open').removeClass('is_mobile_open');
1544					$('.open-overlay-menu').removeClass('open-overlay-menu');
1545					$('.opening-overlay-menu').removeClass('opening-overlay-menu');
1546				}
1547			}
1548		});
1549
1550		$(window).on('scroll', function(){
1551			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1552				$(window).scrollTop(scrolltop);
1553				return false;
1554			}
1555		});
1556
1557	};
1558
1559	function menuOffCanvas() {
1560		var menuClose = new CustomEvent('menuCanvasClose'),
1561			menuOpen = new CustomEvent('menuCanvasOpen');
1562		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1563			if ($(window).width() > UNCODE.mediaQuery) {
1564				if ( $('body.vmenu-offcanvas-overlay').length ) {
1565					if ($(event.currentTarget).hasClass('off-close')) {
1566						$(event.currentTarget).removeClass('off-close');
1567						requestTimeout(function() {
1568							window.dispatchEvent(menuClose);
1569						}, 500);
1570
1571					} else {
1572						$(event.currentTarget).addClass('off-close');
1573						window.dispatchEvent(menuOpen);
1574					}
1575				} else {
1576					if ($(event.currentTarget).hasClass('close')) {
1577						$(event.currentTarget).removeClass('close');
1578						$(event.currentTarget).addClass('closing');
1579						requestTimeout(function() {
1580							$(event.currentTarget).removeClass('closing');
1581							window.dispatchEvent(menuClose);
1582						}, 500);
1583
1584					} else {
1585						$(event.currentTarget).addClass('close');
1586						window.dispatchEvent(menuOpen);
1587					}
1588				}
1589			}
1590
1591			$('body').toggleClass('off-opened');
1592		});
1593
1594		$('body').on('click.menu-off-canvas-mobile', function(e){
1595			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1596				var $vMenuCont = $('#masthead .vmenu-container'),
1597					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1598
1599					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1600					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1601					vmenu_off = $vMenuCont.offset(),
1602					vmenu_l = parseFloat(vmenu_off.left),
1603					vmenu_t = parseFloat(vmenu_off.top),
1604					vmenu_r = vmenu_l + vmenu_w,
1605					vmenu_b = vmenu_t + vmenu_h,
1606
1607					close_h = parseFloat( $close_menu.outerHeight() ),
1608					close_w = parseFloat( $close_menu.outerWidth() ),
1609					close_off = $close_menu.offset(),
1610					close_l = parseFloat(close_off.left),
1611					close_t = parseFloat(close_off.top),
1612					close_r = close_l + close_w,
1613					close_b = close_t + close_h;
1614				if (
1615					!(
1616						e.clientX > vmenu_l &&
1617						e.clientX < vmenu_r &&
1618						e.clientY > vmenu_t &&
1619						e.clientY < vmenu_b
1620					)
1621					||
1622					(
1623						e.clientX > close_l &&
1624						e.clientX < close_r &&
1625						e.clientY > close_t &&
1626						e.clientY < close_b
1627					)
1628				) {
1629					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1630				}
1631			}
1632		});
1633	};
1634
1635	function menuOverlay() {
1636		if ( $('.overlay').length ) {
1637			$('.overlay').removeClass('hidden');
1638		}
1639		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1640			$('.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) {
1641				var transDelay = (index / 20) + 0.1;
1642				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1643					transDelay = transDelay + 0.3;
1644				$(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');
1645			});
1646		}
1647
1648	};
1649	var $secondary_parent;
1650	function menuAppend() {
1651
1652		var $menuBlock = $('#uncode-mobile-menu-block').length;
1653		if ( $menuBlock ) {
1654			return;
1655		}
1656		var $body = $('body'),
1657			$menuCont = $('.menu-container:not(.vmenu-container)'),
1658			$vMenuCont = $('.menu-container.vmenu-container'),
1659			$cta = $('.navbar-cta'),
1660			$socials = $('.navbar-social:not(.appended-navbar)'),
1661			$ul = $('.navbar-main ul.menu-primary-inner'),
1662			$ulCta,
1663			$ulSocials,
1664			$navLast,
1665			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1666			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1667			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1668			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1669			$ulFirst = $('> ul', $firstNav),
1670			setCTA,
1671			appendCTA = function(){
1672				return true;
1673			},
1674			appendSocials = function(){
1675				return true;
1676			},
1677			appendSplit = function(){
1678				return true;
1679			};
1680
1681		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1682			$ulCta = $('> ul', $cta);
1683			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1684
1685			appendCTA = function(){
1686				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1687					$ul.after($ulCta);
1688				} else {
1689					$cta.append($ulCta);
1690				}
1691			}
1692		}
1693
1694		if ( ! $body.hasClass('cta-not-appended') ) {
1695			appendCTA();
1696		}
1697
1698		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1699		$smartSocial.each(function(){
1700			var $_smartSocial = $(this);
1701			$('> li', $_smartSocial).each(function(){
1702				var $li = $(this);
1703				if ( $li.hasClass('mobile-hidden') ) {
1704					$_smartSocial.addClass('mobile-hidden');
1705				} else {
1706					$_smartSocial.removeClass('mobile-hidden');
1707					return false;
1708				}
1709			});
1710
1711			$('> li', $_smartSocial).each(function(){
1712				var $li = $(this);
1713				if ( $li.hasClass('tablet-hidden') ) {
1714					$_smartSocial.addClass('tablet-hidden');
1715				} else {
1716					$_smartSocial.removeClass('tablet-hidden');
1717					return false;
1718				}
1719			});
1720		});
1721
1722		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1723			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1724			if ( $body.hasClass('hmenu-center-split') ) {
1725				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1726			} else {
1727				$navLast = $('.navbar-nav-last', $vMenuCont);
1728			}
1729
1730			if ( ! $navLast.length ) {
1731				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1732				if ( $body.hasClass('hmenu-center-split') ) {
1733					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1734					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1735				} else {
1736					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1737					$navLast = $('.navbar-nav-last', $vMenuCont);
1738				}
1739			}
1740
1741			appendSocials = function(){
1742				if ( !$body.hasClass('menu-overlay-center') ) {
1743				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1744				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1745				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1746				// 		$ulSocials.each(function(){
1747				// 			var $li_social = $(this);
1748				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1749				// 		});
1750				// 	}
1751				// } else {
1752					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1753						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1754						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1755							$('> ul.menu-smart-social li', $socials).remove();
1756						}
1757						$navLast.append($ulSocials);
1758					} else {
1759						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1760							$('> ul.menu-smart-social li', $navLast).remove();
1761						}
1762						$socials.append($ulSocials);
1763					}
1764				}
1765			}
1766			appendSocials();
1767		}
1768
1769		if ( $vMenuCont.length ) {
1770			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1771		} else {
1772			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1773		}
1774		if ( $accordion_secondary.length ) {
1775			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1776			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1777				if ( !$accordion_secondary_ph.length ) {
1778					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1779				}
1780				if ( $vMenuCont.length ) {
1781					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1782				} else {
1783					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1784						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1785					} else {
1786						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1787					}
1788				}
1789			} else {
1790				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1791					$accordion_secondary_ph.before($accordion_secondary);
1792				}
1793			}
1794		}
1795
1796		if ( $vMenuCont.length ) {
1797			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1798		} else {
1799			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1800		}
1801
1802		if ( $extra_icons.length ) {
1803			if ( $vMenuCont.length ) {
1804				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1805					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1806						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1807							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1808						$not_social.each(function(){
1809							if ( ! $primary_after.length ) {
1810								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1811								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1812								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1813							}
1814							var $extra_li = $(this);
1815							$primary_after.find('> ul').append($extra_li);
1816						});
1817					} else {
1818						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1819							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1820						$not_social.each(function(){
1821							var $extra_li = $(this);
1822							$extra_icons.find('> ul').append($extra_li);
1823						});
1824					}
1825				} /*else {
1826					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1827					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1828						if ( !$extra_icons_ph.length ) {
1829							$extra_icons.after('<span class="extra-icons-ph" />');
1830						}
1831						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1832							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1833						} else {
1834							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1835						}
1836					} else {
1837						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1838							$extra_icons_ph.before($extra_icons);
1839						}
1840					}
1841				}*/
1842			} else {
1843				if ( ! $body.hasClass('hmenu-center-double') ) {
1844					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1845						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1846							$primary_after = $('.nav.navbar-main-after', $menuCont);
1847
1848						if ( ! $primary_after.length && $not_social.length ) {
1849							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1850								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1851							} else {
1852								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1853							}
1854							$primary_after = $('.nav.navbar-main-after', $menuCont);
1855							$primary_after.append('<ul class="menu-smart sm menu-smart-social" role="menu" />');
1856						}
1857						var tablet_hidden = true,
1858							mobile_hidden = true;
1859						$not_social.each(function(){
1860							var $extra_li = $(this);
1861							$primary_after.find('> ul').append($extra_li);
1862							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1863								tablet_hidden = false;
1864							}
1865							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1866								mobile_hidden = false;
1867							}
1868						});
1869						if ( tablet_hidden === true && $not_social.length ) {
1870							$primary_after.addClass('tablet-hidden');
1871						}
1872						if ( mobile_hidden === true && $not_social.length ) {
1873							$primary_after.addClass('mobile-hidden');
1874						}
1875					} else {
1876						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1877
1878						if ( $primary_after.length ) {
1879							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1880							$not_social.each(function(){
1881								var $extra_li = $(this);
1882								$extra_icons.find('> ul').append($extra_li);
1883							});
1884							$primary_after.remove();
1885						}
1886					}
1887				}
1888			}
1889		}
1890
1891		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1892			appendSplit = function(){
1893				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1894					if ( $extra_icons.length ) {
1895						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1896							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1897								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1898							$not_social.each(function(){
1899								var $extra_li = $(this);
1900								$append_ul.append($extra_li);
1901							});
1902							if ( $secondNav.length ) {
1903								$secondNav.append($append_ul);
1904							} else {
1905								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1906							}
1907						}
1908					}
1909					if ( $secondNav.length ) {
1910						$secondNav.prepend($ulFirst);
1911					} else {
1912						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1913					}
1914					$firstMenu.hide();
1915				} else {
1916					$firstNav.append($ulFirst);
1917					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1918					if ( $append_ul.length ) {
1919						var $not_social = $('> li:not(.social-icon)', $append_ul);
1920						$not_social.each(function(){
1921							var $extra_li = $(this);
1922							$extra_icons.find('> ul').append($extra_li);
1923						});
1924					}
1925					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1926					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1927					$firstMenu.css({
1928						'display': 'table-cell'
1929					});
1930				}
1931			}
1932		}
1933		appendSplit();
1934
1935		$(window).on( 'wwresize', function(){
1936			clearRequestTimeout(setCTA);
1937			setCTA = requestTimeout( function() {
1938				appendCTA();
1939				appendSocials();
1940				appendSplit();
1941			}, 10 );
1942		});
1943	}
1944	//menuMobileButton();
1945	menuMobile();
1946	menuOffCanvas();
1947	menuAppend();
1948	menuOverlay();
1949
1950	var stickyDropdownSearch = function(){
1951		var $masthead = $('#masthead'),
1952			$ddSearch = $('.overlay.overlay-search', $masthead),
1953			$styles = $('#stickyDropdownSearch').remove();
1954		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1955			var $menuWrapper = $('.menu-wrapper'),
1956				$navbar = $('.menu-container-mobile', $menuWrapper),
1957				navbarH = $navbar.outerHeight(),
1958				//$topbar = $('.top-menu', $menuWrapper),
1959				//topbarH = $topbar.outerHeight(),
1960				_css;
1961
1962			_css = '<style id="stickyDropdownSearch">';
1963			_css += '@media (max-width: 959px) {';
1964			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
1965			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
1966			_css += '}';
1967			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
1968			_css += 'position: fixed;';
1969			_css += 'top: 0;';
1970			_css += '}';
1971			_css += '</style>';
1972
1973			$(_css).appendTo($('head'));
1974		}
1975	}
1976	stickyDropdownSearch();
1977
1978	var setMenuOverlay;
1979	$(window).on( 'wwResize', function(){
1980		if ( $('.overlay').length && $(window).width() > 1024 ) {
1981			$('.overlay').addClass('hidden');
1982		}
1983		clearRequestTimeout(setMenuOverlay);
1984		setMenuOverlay = requestTimeout( function(){
1985			menuOverlay();
1986			menuAppend();
1987			stickyDropdownSearch();
1988		}, 150 );
1989	});
1990	UNCODE.menuMegaBlock();
1991	UNCODE.menuSmartInit();
1992	$(window).on('wwresize', function(){
1993		UNCODE.menuSmartInit();
1994	});
1995};
1996
1997UNCODE.menuSmartInit = function() {
1998	var $menusmart = $('[class*="menu-smart"]'),
1999		$masthead = $('#masthead'),
2000		$hMenu = $('.menu-horizontal-inner', $masthead),
2001		$focus = $('.overlay-menu-focus'),
2002		$uls_anim = $('> li> ul[role="menu"]', $menusmart),
2003		showTimeout = 50,
2004		hideTimeout = 50,
2005		showTimeoutFunc, hideTimeoutFunc, subMenuRT;
2006
2007	if ( typeof $masthead.attr('data-menu-anim') !== 'undefined' && $masthead.attr('data-menu-anim') !== '' ) {
2008		var menu_anim = $masthead.attr('data-menu-anim');
2009		$uls_anim.each(function(){
2010			var $ul_anim = $(this);
2011			if ( !$('> li[data-block]', $ul_anim).length ) {
2012				$ul_anim.addClass('animate_when_almost_visible');
2013				$ul_anim.addClass(menu_anim);
2014			} else {
2015				var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2016				if ( dataB !== 'no-anim' && !dataB.includes('slight-anim') ) {
2017					$ul_anim.addClass('animate_when_almost_visible');
2018					$ul_anim.addClass(dataB);
2019				}
2020			}
2021		});
2022	}
2023
2024	$('> li.menu-item-has-children', $menusmart).hover(function(){
2025		$(this).data('hover', true);
2026	}, function(){
2027		$(this).data('hover', false);
2028	});
2029
2030	$('> li.menu-item-has-children', $menusmart).each(function(){
2031		var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
2032	});
2033
2034	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
2035		e.preventDefault();
2036	});
2037
2038	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
2039			
2040		var $notLis = $('> .nav > ul > li a', $hMenu),
2041			$menuA = $('a', $masthead).not($notLis),
2042			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
2043			showFuncCond = function() { return true };
2044
2045		if ( $('body').hasClass('focus-megamenu') ) {
2046			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.need-focus');
2047			showFuncCond = function($ul) { return $ul.hasClass('need-focus') };
2048		} else if ( $('body').hasClass('focus-links') ) {
2049			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
2050		}
2051
2052		$hoverSelector.hover(function(){
2053			clearRequestTimeout(hideTimeoutFunc);
2054			showTimeoutFunc = requestTimeout(function(){
2055				$('body').addClass('navbar-hover');
2056			}, showTimeout*2);
2057		}, function(){
2058			hideTimeoutFunc = requestTimeout(function(){
2059				if ( ! $('.overlay-search.open', $masthead).length ) {
2060					$('body').removeClass('navbar-hover');
2061				}
2062			}, hideTimeout*2);
2063		});
2064	} else {
2065		showFuncCond = function() { return false };
2066	}
2067
2068	if ($menusmart.length > 0) {
2069		var objShowTimeout;
2070		$menusmart.smartmenus({
2071			subIndicators: false,
2072			subIndicatorsPos: 'append',
2073			//subMenusMinWidth: '13em',
2074			showOnClick: SiteParameters.menuShowOnClick,
2075			subIndicatorsText: '',
2076			showTimeout: showTimeout,
2077			hideTimeout: hideTimeout,
2078			scrollStep: 8,
2079			showFunction: function($ul, complete) {
2080				$(document).trigger('un-menu-show', $ul);
2081				clearRequestTimeout(showTimeoutFunc);
2082				$ul.fadeIn(0, 'linear', function(){
2083					complete();
2084					if ( $ul.hasClass('vc_row') ) {
2085						$ul.css({
2086							'display': 'table'
2087						});
2088					}
2089					if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') ) {
2090						$('body').addClass('open-megamenu');
2091					}
2092					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
2093						$('body').addClass('navbar-hover');
2094					}
2095					var showed = 0;
2096					$('.animate_when_almost_visible', $ul).each(function(index, val){
2097						var $element = $(this),
2098							delayAttr = $element.attr('data-delay');
2099						if ( !$element.closest('.owl-carousel').length && ! $element.closest('.cssgrid-animate-sequential').length ) {
2100							if (delayAttr == undefined) delayAttr = 0;
2101							requestTimeout(function() {
2102								$element.addClass('start_animation');
2103							}, delayAttr);
2104						} else if ( $element.closest('.cssgrid-animate-sequential').length ) {
2105							var grid = $element.closest('.cssgrid-animate-sequential');
2106
2107							var delay = index,
2108								delayAttr = parseInt($element.attr('data-delay'));
2109							if (isNaN(delayAttr)) delayAttr = 100;
2110							delay -= showed;
2111							objShowTimeout = requestTimeout(function() {
2112								$element.removeClass('zoom-reverse').addClass('start_animation');
2113								showed = index;
2114							}, delay * delayAttr);
2115						}
2116					});
2117					if ( $ul.is('.animate_when_almost_visible') ) {
2118						$ul.addClass('start_animation');
2119					}
2120				}).addClass('open-animated');
2121				menuStartBuilderAnimations($ul);
2122			},
2123			hideFunction: function($ul, complete) {
2124				if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') && ! $('.overlay-search.open', $masthead).length ) {
2125					$('body').removeClass('open-megamenu');
2126				}
2127				var fixIE = $('html.ie').length;
2128				if (fixIE) {
2129					var $rowParent = $($ul).closest('.main-menu-container');
2130					$rowParent.height('auto');
2131				}
2132				$ul.fadeOut(0, 'linear', function(){
2133					complete();
2134					$ul.removeClass('open-animated');
2135					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
2136						$('body').removeClass('open-submenu');
2137					}
2138					$('.animate_when_almost_visible', $ul).each(function(){
2139						$(this).removeClass('start_animation');
2140					});
2141					if ( $ul.is('.animate_when_almost_visible') ) {
2142						$ul.removeClass('start_animation');
2143					}
2144				});
2145				$ul.find('.start_animation').each(function(index, val) {
2146					clearRequestTimeout(subMenuRT);
2147					$(val).removeClass('start_animation');
2148				});
2149				$(document).trigger('un-menu-hide', $ul);
2150				clearRequestTimeout(objShowTimeout);
2151			},
2152			collapsibleShowFunction: function($ul, complete) {
2153				$ul.slideDown(400, 'easeInOutCirc', function(){
2154					UNCODE.animateSubInside($ul);
2155					complete();
2156				});
2157			},
2158			collapsibleHideFunction: function($ul, complete) {
2159				$ul.slideUp(200, 'easeInOutCirc', function(){
2160					complete();
2161				});
2162				$(document).trigger('sub-menu-slide-up');
2163			},
2164			hideOnClick: SiteParameters.menuHideOnClick,
2165		});
2166
2167		if ( $('body').hasClass('menu-accordion-active') ) {
2168			$menusmart.each(function(key, menu){
2169				$(menu).addClass('menu-smart-init');
2170				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2171			});
2172		}
2173
2174		$menusmart.each(function(key, menu){
2175			$(menu).on('beforecollapse.smapi', function( e, $sub ){
2176				if ( $('> .trigger-window-resize', $sub).length ) {
2177					window.dispatchEvent(new Event('resize'));
2178					$(window).trigger('uncode.re-layout');
2179				} else if ( $('> .trigger-box-resize', $sub).length ) {
2180					window.dispatchEvent(new CustomEvent('boxResized'));
2181				}
2182				return false;
2183			});
2184		});
2185		
2186		$(document).on( 'uncode.smartmenu-appended', function(){
2187			requestTimeout(function(){
2188				$menusmart.smartmenus( 'refresh' );
2189			}, 1000);
2190		});
2191
2192		function menuStartBuilderAnimations($ul){
2193			/*$ul.find('.animate_when_almost_visible:not(.t-inside):not(.drop-image-separator), .tmb-linear .animate_when_almost_visible, .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible, .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible').each(function(index, val) {
2194					var $elAnim = $(val);
2195					if ( $elAnim.hasClass('el-text-split') || ( ( $elAnim.closest('.unscroll-horizontal').length || $elAnim.closest('.index-scroll').length || $elAnim.closest('.tab-pane:not(.active)').length || $elAnim.closest('.panel:not(.active-group)').length ) && !SiteParameters.is_frontend_editor ) ) {
2196						return true;
2197					}
2198					var run = true,
2199						$carousel = $elAnim.closest('.owl-carousel'),
2200						marquee = $elAnim.closest('.tmb-linear').length;
2201					if ( $carousel.length ) {
2202						run = false;
2203					}
2204					if (run) {
2205						var delayAttr = $elAnim.attr('data-delay');
2206						if (delayAttr == undefined) delayAttr = 0;
2207						subMenuRT = requestTimeout(function() {
2208							$elAnim.addClass('start_animation');
2209						}, delayAttr);
2210					}
2211			});*/
2212		};
2213	}
2214
2215	$('.main-menu-container').each(function(){
2216		var $main_cont = $(this),
2217			$uls = $('ul:not(.nav-tabs)', $main_cont);
2218
2219		$uls.each(function(){
2220			var $ul = $(this),
2221				mobile_hidden = true,
2222				tablet_hidden = true;
2223			$('> li:not(.hidden)', $ul).each(function(){
2224				if ( !$(this).hasClass('mobile-hidden') ) {
2225					mobile_hidden = false;
2226					return false;
2227				}
2228			});
2229			$('> li:not(.hidden)', $ul).each(function(){
2230				if ( !$(this).hasClass('tablet-hidden') ) {
2231					tablet_hidden = false;
2232					return false;
2233				}
2234			});
2235			if ( mobile_hidden ) {
2236				$ul.addClass('mobile-hidden');
2237			}
2238			if ( tablet_hidden ) {
2239				$ul.addClass('tablet-hidden');
2240			}
2241		});
2242
2243		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2244
2245		$divUlsMB.each(function(){
2246			var $divUlMB = $(this),
2247				div_mobile_hidden = true,
2248				div_tablet_hidden = true;
2249
2250			$('> ul:not(.hidden)', $divUlMB).each(function(){
2251				if ( !$(this).hasClass('mobile-hidden') ) {
2252					div_mobile_hidden = false;
2253					return false;
2254				}
2255			});
2256			$('> ul:not(.hidden)', $divUlMB).each(function(){
2257				if ( !$(this).hasClass('tablet-hidden') ) {
2258					div_tablet_hidden = false;
2259					return false;
2260				}
2261			});
2262			if ( div_mobile_hidden ) {
2263				$divUlMB.addClass('mobile-hidden');
2264			}
2265			if ( div_tablet_hidden ) {
2266				$divUlMB.addClass('tablet-hidden');
2267			}
2268		});
2269	});
2270
2271	var overlaySearchButton = function(){
2272		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2273
2274		$search_wrap.each(function(){
2275			var $form = $('form', this),
2276				$icon = $('i', $form);
2277
2278			$icon.on('click', function(){
2279				$form.submit();
2280			});
2281		});
2282	};
2283	overlaySearchButton();
2284}
2285
2286UNCODE.menuMegaBlock = function() {
2287	var $megaBlocks = $('.megamenu-block-wrapper');
2288	if ( ! $megaBlocks.length ) {
2289		return;
2290	}
2291
2292	$megaBlocks.each(function(){
2293		var $megaLi = $(this),
2294			//$parentLi = $megaLi.closest('li.menu-item').addClass('mega-menu'),
2295			dataLi = $megaLi.attr('data-block'),
2296			$megaUl = $megaLi.closest('ul').addClass('block-wrapper-parent unmenu-inner-ul'),
2297			$innerUl = $megaLi.find('ul').addClass('unmenu-inner-ul');
2298		$megaUl.addClass(dataLi);
2299		//$('.column_parent > .uncol .uncont:not(.uncont *)', $megaLi).addClass(dataLi);
2300		$('img', $megaLi).removeAttr('loading');
2301	});
2302}
2303
2304UNCODE.unBlockMenu = function(){
2305	//Menu block
2306	var $unBlockMenus = $('.menu.unmenu-block');
2307
2308	$unBlockMenus.each(function(){
2309		var $unBlockMenu = $(this),
2310			$lastOnes;
2311
2312		if ( !$unBlockMenu.hasClass('first-grid') ) {
2313			$lastOnes = $('ul', $unBlockMenu).last();
2314			$lastOnes.each(function(){
2315                var _cols = $(this).css('grid-template-columns');
2316				if ( _cols.split(' ').length > 1 && !_cols.startsWith('repeat(1,')) {
2317					$unBlockMenu.addClass('has-last-ones');
2318					$(this).addClass('last-one');
2319				} else {
2320					var $parentLi = $(this).closest('li'),
2321						$siblingLi = $parentLi.next();
2322					if ( !$siblingLi.length ) {
2323						$unBlockMenu.addClass('has-last-ones');
2324						$(this).addClass('last-one');
2325					}
2326				}
2327			});
2328		} else {
2329			var checkGrids = function(){
2330				$unBlockMenu.find('.last-ul').removeClass('last-one');
2331				var _cols = $unBlockMenu.css('grid-template-columns'),
2332                    cols = _cols.match(/^repeat\(\s*(\d+)\s*,/) ? parseInt(_cols.match[1], 10) : _cols.split(' ').length,
2333					$lis = $('> li', $unBlockMenu),
2334					totLi = $lis.length,
2335					lastRowCount = totLi - (totLi % cols || cols),
2336					$lastLis = $lis.slice(cols).addClass('last-lis'),
2337    				$lastRowLis = $lis.slice(lastRowCount);
2338				$lastRowLis.each(function(){
2339					var $lastRowLi = $(this);
2340					$lastRowLi.find('ul').last().addClass('last-one');
2341				});
2342			}
2343			$(window).on('wwResize', checkGrids);
2344			checkGrids();
2345
2346		}
2347
2348	});
2349
2350	//Accordion
2351	var $tgglBlocks = $('.unmenu-collapse');
2352	$tgglBlocks.each(function(key, val){
2353		var $acc = $(val),
2354			$titles = $('.menu-item-has-children > *:first-child', $acc),
2355			run = true;
2356
2357		var checkRun = function(){
2358			if ( $acc.hasClass('unmenu-collapse-mobile') && UNCODE.wwidth >= UNCODE.mediaQuery ) {
2359				run = false;
2360			} else {
2361				run = true;
2362			}
2363
2364			if ( $titles.length ) {
2365				$titles.each(function(_key, _val){
2366					var $title = $(_val),
2367						$sub = $title.closest('li').find('> ul.un-submenu');
2368
2369					$sub.each(function(key, val){
2370						if ( run ) {
2371							$(val).slideUp({
2372								duration: 1,
2373								complete: function() {
2374									$(this).addClass('toggle-init');
2375								}
2376							});
2377						} else {
2378							$(val).show();
2379						}
2380					});
2381				});
2382			}
2383		}
2384		checkRun();
2385
2386		$(window).on('wwResize', checkRun);
2387
2388		if ( $titles.length ) {
2389			$titles.each(function(_key, _val){
2390				var $title = $(_val),
2391					$sub = $title.closest('li').find('> ul.un-submenu'),
2392					$menu = $sub.closest('.menu.unmenu-block'),
2393					$ulS;
2394
2395				$title.off('click').on('click', function(e){
2396					e.preventDefault();
2397					$ulS = $menu.find('ul:visible').not($sub).not($sub.parents('ul'))
2398					if ( run ) {
2399						if ( $sub.is(':visible') ) {
2400							$sub.slideUp(200, 'easeInOutCirc', function(){
2401								$.each($('.start_animation', $sub), function(index, val) {
2402									var element = $(val);
2403									element.removeClass('start_animation');
2404
2405								});
2406								$sub.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2407								$(document).trigger('sub-menu-slide-up');
2408							});
2409						} else {
2410							$ulS.slideUp({
2411								duration: 200,
2412								easing: 'easeInOutCirc',
2413								start: function(){
2414									var _this = $(this);
2415									_this.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2416									$(document).trigger('sub-menu-slide-up');
2417								}
2418							});
2419
2420							$sub.slideDown({
2421								duration: 400,
2422								easing: 'easeInOutCirc',
2423								start: function() {
2424									var _this = $(this);
2425									_this.css('height', 0);
2426									if ( _this.hasClass('is-grid') ) {
2427										_this.css('display','grid');
2428									}
2429
2430									UNCODE.animateSubInside(_this)
2431									_this.parents('li').eq(0).addClass('un-submenu-open').removeClass('un-submenu-closed');
2432								}
2433							});
2434						}
2435
2436					}
2437				});
2438			});
2439
2440			if ( $acc.closest('#masthead').length ) {
2441				$(window).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
2442					$acc.find('ul.un-submenu').slideUp(200, 'easeInOutCirc');
2443				});
2444			}
2445		}
2446
2447	});
2448};
2449
2450UNCODE.mobileMenuBlockSkins = function(){
2451	var $mobileBlock = $('#uncode-mobile-menu-block'),
2452		$parentDark = $mobileBlock.closest('.submenu-dark'),
2453		$parentLight = $mobileBlock.closest('.submenu-light');
2454
2455
2456	if ( $parentDark.length ) {
2457		var $cols = $('.uncol.style-light:not(.style-spec):not(.style-run)', $mobileBlock);
2458		$cols.each(function(key, val){
2459			var $col = $(val).removeClass('style-light').addClass('style-dark style-run');
2460		});
2461	}
2462
2463	if ( $parentLight.length ) {
2464		var $cols = $('.uncol.style-dark:not(.style-spec):not(.style-run)', $mobileBlock);
2465		$cols.each(function(key, val){
2466			var $col = $(val).removeClass('style-dark').addClass('style-light style-run');
2467		});
2468	}
2469};
2470UNCODE.okvideo = function(ev) {
2471	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2472	$.okvideo = function(options) {
2473		// if the option var was just a string, turn it into an object
2474		if (typeof options !== 'object') options = {
2475			'video': options
2476		};
2477		var base = this;
2478		// kick things off
2479		base.init = function() {
2480			base.options = $.extend({}, $.okvideo.options, options);
2481			// support older versions of okvideo
2482			if (base.options.video === null) base.options.video = base.options.source;
2483			base.setOptions();
2484			var target = base.options.target || $('body');
2485			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2486			var zIndex = base.options.controls === 3 ? -999 : "auto";
2487			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2488				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>';
2489				if (OKEvents.utils.isMobile()) {
2490					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>');
2491				} else {
2492					if (base.options.controls === 3) {
2493						target.append(mask)
2494					}
2495					if (base.options.adproof === 1) {
2496						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>');
2497					} else {
2498						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>');
2499					}
2500				}
2501				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2502				if (base.options.playlist.list === null) {
2503					if (base.options.video.provider === 'youtube') {
2504						base.loadYouTubeAPI();
2505					} else if (base.options.video.provider === 'vimeo') {
2506						base.options.volume /= 100;
2507						base.loadVimeoAPI();
2508					}
2509				} else {
2510					base.loadYouTubeAPI();
2511				}
2512			}
2513		};
2514		// clean the options
2515		base.setOptions = function() {
2516			// exchange 'true' for '1' and 'false' for 3
2517			for (var key in this.options) {
2518				if (this.options[key] === true) this.options[key] = 1;
2519				if (this.options[key] === false) this.options[key] = 3;
2520			}
2521			if (base.options.playlist.list === null) {
2522				base.options.video = base.determineProvider();
2523			}
2524			// pass options to the window
2525			$(window).data('okoptions-' + base.options.id, base.options);
2526		};
2527		// insert js into the head and exectue a callback function
2528		base.insertJS = function(src, callback, provider){
2529			var tag;
2530			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2531				delete UNCODE.insertedSripts[src];
2532				var tags = document.getElementsByTagName('script');
2533				for (var i = tags.length; i >= 0; i--){
2534					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2535						tags[i].parentNode.removeChild(tags[i]);
2536					}
2537				}
2538			} else {
2539				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2540					tag = UNCODE.insertedSripts[src];
2541					if (callback){
2542						if (tag.readyState){  //IE
2543							tag.onreadystatechange = function(){
2544								if (tag.readyState === "loaded" ||
2545									tag.readyState === "complete"){
2546									tag.onreadystatechange = null;
2547									callback();
2548								}
2549							};
2550						} else {
2551							$(tag).on('load', callback);
2552						}
2553					}
2554					return;
2555				}
2556			}
2557			tag = document.createElement('script');
2558			if (callback){
2559				if (tag.readyState){  //IE
2560					tag.onreadystatechange = function(){
2561						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2562							tag.onreadystatechange = null;
2563							callback();
2564						}
2565					};
2566				} else {
2567					tag.onload = function() {
2568						callback();
2569					};
2570				}
2571			}
2572			tag.src = src;
2573			var firstScriptTag = document.getElementsByTagName('script')[0];
2574			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2575			if ( ! UNCODE.insertedSripts ) {
2576				UNCODE.insertedSripts = [];
2577			}
2578			UNCODE.insertedSripts[src] = tag;
2579		};
2580		// load the youtube api
2581		base.loadYouTubeAPI = function(callback) {
2582			if ( ev === 'uncode-more-items-loaded' ) {
2583				onYouTubeIframeAPIReady();
2584			} else {
2585				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2586			}
2587		};
2588		base.loadYouTubePlaylist = function() {
2589			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2590		};
2591		// load the vimeo api by replacing the div with an iframe and loading js
2592		base.loadVimeoAPI = function() {
2593			var source = '//player.vimeo.com/video/' + base.options.video.id + '?background=1&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',
2594			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2595			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2596			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2597			base.insertJS('//player.vimeo.com/api/player.js', function() {
2598				vimeoPlayerReady(base.options.id);
2599			}, 'vimeo');
2600		};
2601		// is it from youtube or vimeo?
2602		base.determineProvider = function() {
2603			var a = document.createElement('a');
2604			a.href = base.options.video;
2605			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2606				var videoid = a.href.split('/')[3].toString();
2607				var query = videoid.substring(videoid.indexOf('?') + 1);
2608				if (query != '') {
2609					var vars = query.split('&');
2610					for (var i = 0; i < vars.length; i++) {
2611						var pair = vars[i].split('=');
2612						if (pair[0] == 'v') {
2613							videoid = pair[1];
2614						}
2615					}
2616				}
2617				return {
2618					"provider": "youtube",
2619					"id": videoid
2620				};
2621			} else if (/vimeo.com/.test(base.options.video)) {
2622				return {
2623					"provider": "vimeo",
2624					"id": (a.href.split('/')[3].toString()).split('#')[0],
2625				};
2626			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2627				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2628				if (id.length == 11) {
2629					return {
2630						"provider": "youtube",
2631						"id": id.toString()
2632					};
2633				} else {
2634					for (var i = 0; i < base.options.video.length; i++) {
2635						if (typeof parseInt(base.options.video[i]) !== "number") {
2636							throw 'not vimeo but thought it was for a sec';
2637						}
2638					}
2639					return {
2640						"provider": "vimeo",
2641						"id": base.options.video
2642					};
2643				}
2644			} else {
2645				throw "OKVideo: Invalid video source";
2646			}
2647		};
2648		base.init();
2649	};
2650
2651	var checkResize,
2652		newW = UNCODE.wwidth;
2653
2654	$.okvideo.options = {
2655		id: null,
2656		source: null, // Deprecate dis l8r
2657		video: null,
2658		playlist: { // eat ur heart out @brokyo
2659			list: null,
2660			index: 0,
2661			startSeconds: 0,
2662			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2663		},
2664		disableKeyControl: 1,
2665		captions: 0,
2666		loop: 1,
2667		hd: 1,
2668		volume: 0,
2669		adproof: false,
2670		unstarted: null,
2671		onFinished: null,
2672		onReady: null,
2673		onPlay: null,
2674		onPause: null,
2675		buffering: null,
2676		controls: false,
2677		autoplay: true,
2678		annotations: true,
2679		cued: null
2680	};
2681	$.fn.okvideo = function(options) {
2682		options.target = this;
2683		return this.each(function() {
2684			(new $.okvideo(options));
2685		});
2686	};
2687
2688	var checkForVideos = function(){
2689		$(".uncode-video-container.video").each(function(index, el) {
2690			var $this = $(this),
2691				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2692				url = $this.attr('data-video'),
2693				id = $this.attr('data-id'),
2694				cloned = $this.closest('.owl-item');
2695
2696			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2697				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2698					$this.okvideo({
2699						id: id,
2700						source: url.split('#')[0],
2701						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2702						autoplay: 1,
2703						controls: 0,
2704						volume: 0,
2705						adproof: 0,
2706						caller: $this,
2707						hd: 1,
2708						onReady: function(player) {
2709							var getPlayer = player.c || player.h || player,
2710							$iframe,
2711							getContainer = $(getPlayer).closest('.background-element');
2712							if (getContainer.length) {
2713								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2714							}
2715
2716							if ( $this.hasClass('drop-move') ) {
2717
2718								var $iframe = $(getPlayer),
2719									w = parseFloat($iframe.attr('width')),
2720									h = parseFloat($iframe.attr('height')),
2721									ratio = h / w,
2722									setResizeiFto,
2723								resizeiFrame = function(){
2724									var dataW = $this.attr('data-w'),
2725										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2726										newH = newW * ratio;
2727									$iframe.css({
2728										width: newW,
2729										height: newH
2730									});
2731								};
2732								resizeiFrame();
2733								$(window).on( 'load', resizeiFrame );
2734								$(window).on( 'resize', function(){
2735									clearRequestTimeout(setResizeiFto);
2736									setResizeiFto = requestTimeout( function() {
2737										resizeiFrame();
2738									}, 10 );
2739								});
2740
2741							}
2742
2743						}
2744					});
2745				}
2746			}
2747		});
2748	};
2749
2750	checkForVideos();
2751
2752	$(window).on('load', function(){
2753		$('.mejs-fullscreen-button button').on('click', function(){
2754			var $button = $(this),
2755				$stuck = $button.closest('.is_stucked');
2756
2757			if ( $stuck.length ) {
2758				$stuck = $(this).trigger("sticky_kit:detach");
2759				window.scrollTo(0, 0);
2760			}
2761		});
2762	});
2763
2764	var checkVideoResize = function(){
2765		clearRequestTimeout(checkResize);
2766		checkResize = requestTimeout(function(){
2767			if ( newW !== UNCODE.wwidth ) {
2768				newW = UNCODE.wwidth;
2769				checkForVideos();
2770			}
2771		}, 1000);
2772	};
2773
2774	$(window).off('resize', checkVideoResize)
2775	.on( 'resize', checkVideoResize);
2776
2777};
2778
2779$(document).on('uncode-ajax-filtered.videos', function(){
2780	UNCODE.okvideo("uncode-more-items-loaded");
2781});
2782UNCODE.backgroundSelfVideos = function( $ctx ) {
2783
2784	var backgroundSelfVideosInit = function( $ctx ) {
2785		if ( SiteParameters.block_mobile_videos === true ) {
2786			return false;
2787		}
2788		if (typeof MediaElement === "function") {
2789			if ( typeof $ctx === 'undefined' ) {
2790				$ctx = document;
2791			}
2792		
2793			$(".background-video-shortcode", $ctx).each(function(index, el) {
2794				if ( $(this).closest('mediaelementwrapper').length ) {
2795					return true;
2796				}
2797				var $video_el = $(this),
2798					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2799					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2800					video_id = $video_el.attr('id');
2801
2802				if ( SiteParameters.is_frontend_editor ) {
2803					video_id = video_id + '_' + index;
2804					$video_el.attr('id', video_id);
2805				}
2806
2807				var media = new MediaElement(video_id, {
2808					startVolume: 0,
2809					loop: true,
2810					success: function(mediaElement, domObject) {
2811						domObject.volume = 0;
2812						$(mediaElement).data('started', false);
2813						mediaElement.addEventListener('timeupdate', function(e) {
2814							if (!$(e.target).data('started')) {
2815								$(mediaElement).data('started', true);
2816							}
2817						});
2818						mediaElement.addEventListener('loadedmetadata', function(e) {
2819							$('body').removeClass('video-not-supported');
2820							mediaElement.play();
2821						});
2822						if (!UNCODE.isMobile) {
2823							requestTimeout(function() {
2824								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2825							}, 100);
2826						}
2827						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2828							mediaElement.play();
2829						}
2830
2831						if ( $parent_drop_move.length ) {
2832							var setResizeMEto,
2833								resizeMediaElement = function(){
2834								var dataW = $parent_drop_move.attr('data-w'),
2835									videoW = domObject.width,
2836									videoH = domObject.height,
2837									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2838									newH = newW / ( videoW / videoH );
2839
2840								$(domObject).css({
2841									'height': newH,
2842									'width': newW
2843								});
2844							};
2845							$(window).on( 'resize load', function(){
2846								clearRequestTimeout(setResizeMEto);
2847								setResizeMEto = requestTimeout( function() {
2848									resizeMediaElement();
2849								}, 10 );
2850							});
2851						}
2852
2853						mediaElement.addEventListener('play', function() {
2854							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2855							$(mediaElement).closest('#page-header').addClass('video-started');
2856							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2857						}, true);
2858
2859					},
2860					// fires when a problem is detected
2861					error: function() {}
2862				});
2863			});
2864		} else {
2865
2866			if ( typeof $ctx === 'undefined' ) {
2867				$ctx = document;
2868			}
2869		
2870			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2871			Array.from(videos).forEach(function(video_el) {
2872				video_el.addEventListener('loadedmetadata', function(e) {
2873					$('body').removeClass('video-not-supported');
2874					video_el.play();
2875				});
2876				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2877					video_el.muted = true;
2878					video_el.loop = true;
2879					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2880					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2881					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2882					$('body').removeClass('video-not-supported');
2883					video_el.play();
2884				} else {
2885					requestTimeout(function(){
2886                         backgroundSelfVideosInit( $ctx );
2887					}, 1000);
2888				}
2889			});
2890		}
2891	};
2892
2893	backgroundSelfVideosInit( $ctx );
2894
2895	$(document).on('un-menu-show', function(){
2896		setTimeout(function(){
2897			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)');
2898		}, 1);
2899	});
2900
2901
2902	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2903		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2904			var $el = model.view.$el,
2905				shortcode = model.attributes.shortcode;
2906
2907			if (typeof MediaElement === "function") {
2908				backgroundSelfVideosInit( $el );
2909			} else {
2910				backgroundSelfVideosInit( $el[0] );
2911			}
2912		});
2913	}
2914};
2915
2916UNCODE.is_scrolling = false;
2917
2918UNCODE.disableHoverScroll = function() {
2919
2920	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2921		var body = document.body,
2922		timer;
2923
2924		window.addEventListener('scroll', function() {
2925			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2926			clearRequestTimeout(timer);
2927			if ( body.classList && !body.classList.contains('disable-hover') ) {
2928				body.classList.add('disable-hover');
2929				window.dispatchEvent(new CustomEvent('disable-hover'));
2930			}
2931			UNCODE.is_scrolling = true;
2932
2933			timer = requestTimeout(function() {
2934				if ( body.classList ) {
2935					body.classList.remove('disable-hover');
2936					window.dispatchEvent(new CustomEvent('enable-hover'));
2937				}
2938				UNCODE.is_scrolling = false;
2939			}, delay);
2940		}, false);
2941	}
2942};
2943
2944UNCODE.isotopeLayout = function() {
2945	if ($('.isotope-layout').length > 0) {
2946		var isotopeContainersArray = [],
2947			typeGridArray = [],
2948			layoutGridArray = [],
2949			screenLgArray = [],
2950			screenMdArray = [],
2951			screenSmArray = [],
2952			transitionDuration = [],
2953			$filterItems = [],
2954			$filters = $('.isotope-system .isotope-filters'),
2955			$itemSelector = '.tmb-iso',
2956			$items,
2957			itemMargin,
2958			correctionFactor = 0,
2959			firstLoad = true,
2960			isOriginLeft = $('body').hasClass('rtl') ? false : true;
2961		$('[class*="isotope-container"]').each(function(index) {
2962			var _this = $(this);
2963			var isoData = _this.data(),
2964			$data_lg,
2965			$data_md,
2966			$data_sm;
2967			_this.children('.tmb').addClass('tmb-iso');
2968			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
2969			else $data_lg = '1000';
2970			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
2971			else $data_md = '600';
2972			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
2973			else $data_sm = '480';
2974			screenLgArray.push($data_lg);
2975			screenMdArray.push($data_md);
2976			screenSmArray.push($data_sm);
2977			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
2978			if (isoData.type == 'metro') typeGridArray.push(true);
2979			else typeGridArray.push(false);
2980			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
2981			else layoutGridArray.push('masonry');
2982			isotopeContainersArray.push(_this);
2983			_this.attr('data-iso-index', index);
2984		});
2985		var colWidth = function(index) {
2986				$(isotopeContainersArray[index]).width('');
2987				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
2988					widthAvailable = $(isotopeContainersArray[index]).width(),
2989					columnNum = 12,
2990					columnWidth = 0,
2991					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
2992					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
2993					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
2994					$rowContainer,
2995					paddingRow,
2996					$colContainer,
2997					paddingCol;
2998
2999				if ( consider_menu )
3000					winHeight = winHeight - UNCODE.menuHeight;
3001
3002				if ( data_vp_height === '1' ) {
3003					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
3004					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
3005					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
3006					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
3007					winHeight = winHeight - ( paddingRow + paddingCol );
3008				}
3009
3010				if (isPx) {
3011					columnWidth = Math.ceil(widthAvailable / columnNum);
3012					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
3013				} else {
3014					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
3015				}
3016				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
3017				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
3018				for (var i = 0, len = $items.length; i < len; i++) {
3019					var $item = $($items[i]),
3020						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
3021						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
3022						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
3023
3024
3025					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
3026						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
3027					}
3028
3029					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
3030						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
3031					}
3032
3033					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
3034						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3035							switch (parseInt(multiplier_w[1])) {
3036								case (5):
3037								case (4):
3038								case (3):
3039									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3040									multiplier_w[1] = 6;
3041									break;
3042								case (2):
3043								case (1):
3044									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
3045									multiplier_w[1] = 3;
3046									break;
3047								default:
3048									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3049									multiplier_w[1] = 12;
3050									break;
3051							}
3052
3053							if (multiplier_w[1] == 2.4) { // 5 columns
3054								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3055								multiplier_w[1] = 6;
3056							}
3057						}
3058					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
3059						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3060							switch (parseInt(multiplier_w[1])) {
3061								case (5):
3062								case (4):
3063								case (3):
3064								case (2):
3065								case (1):
3066									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3067									multiplier_w[1] = 6;
3068									break;
3069								default:
3070									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3071									multiplier_w[1] = 12;
3072									break;
3073							}
3074
3075							if (multiplier_w[1] == 2.4) { // 5 columns
3076								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3077								multiplier_w[1] = 6;
3078							}
3079						}
3080					} else if (widthAvailable < screenSmArray[index]) {
3081						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3082							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3083							multiplier_w[1] = 12;
3084							if (typeGridArray[index]) multiplier_h[1] = 12;
3085						}
3086					}
3087					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
3088						height;
3089
3090					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
3091						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
3092						if ( widthAvailable < screenSmArray[index] ) {
3093							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
3094						}
3095					} else {
3096						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
3097					}
3098
3099					if (width >= widthAvailable) {
3100						$item.css({
3101							width: widthAvailable
3102						});
3103						if (typeGridArray[index]) {
3104							$item.children().add($item.find('.backimg')).css({
3105								height: height
3106							});
3107						}
3108					} else {
3109						$item.css({
3110							width: width
3111						});
3112						if (typeGridArray[index]) {
3113							$item.children().add($item.find('.backimg')).css({
3114								height: height
3115							});
3116						}
3117					}
3118				}
3119				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
3120					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
3121				} else {
3122					return columnWidth;
3123				}
3124			},
3125			init_isotope = function() {
3126				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
3127					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
3128						isotopeId = isotopeSystem.attr('id'),
3129						$layoutMode = layoutGridArray[i],
3130						setIsotopeFirstRowTimeOut,
3131					setIsotopeFirstRow = function(items){
3132						var firstRow = true;
3133						$(items).each(function(index, val){
3134							var el = items[index].element,
3135								el_top = items[index].position.y,
3136								$el = $(el);
3137							if ( index > 0 && el_top > 0 && firstRow ) {
3138								firstRow = false;
3139							} else if ( index == 0 && el_top == 0 ) {
3140								firstRow = true;
3141							}
3142							if ( firstRow ) {
3143								$el.removeClass('tmb-isotope-further-row');
3144							} else {
3145								$el.addClass('tmb-isotope-further-row');
3146							}
3147						});
3148					};
3149					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
3150						//resizable: true,
3151						itemSelector: $itemSelector,
3152						layoutMode: $layoutMode,
3153						transitionDuration: transitionDuration[i],
3154						masonry: {
3155							columnWidth: colWidth(i)
3156						},
3157						vertical: {
3158							horizontalAlignment: 0.5,
3159						},
3160						sortBy: 'original-order',
3161						isOriginLeft: isOriginLeft
3162					})
3163					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
3164					.on('layoutComplete', function( event, items ){
3165						if ( typeof items[0] !== 'undefined' ) {
3166							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3167								setIsotopeFirstRow(items);
3168							}
3169						}
3170					})
3171					.on('arrangeComplete', function( event, items ){
3172						if ( typeof items[0] !== 'undefined' ) {
3173							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3174								clearRequestTimeout(setIsotopeFirstRowTimeOut);
3175								setIsotopeFirstRowTimeOut = requestTimeout(function(){
3176									setIsotopeFirstRow(items);
3177								}, 100);
3178							}
3179						}
3180					});
3181					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
3182						$(isotopeContainersArray[i]).infinitescroll({
3183								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
3184								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
3185								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
3186								animate: false,
3187								behavior: 'local',
3188								debug: false,
3189								loading: {
3190									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
3191									speed: 0,
3192									finished: undefined,
3193									msg: $('#' + isotopeId + ' .loadmore-button'),
3194								},
3195								errorCallback: function() {
3196									var isotope_system = $(this).closest('.isotope-system');
3197									$('.loading-button', isotope_system).hide();
3198									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
3199								}
3200							},
3201							// append the new items to isotope on the infinitescroll callback function.
3202							function(newElements, opts) {
3203								var $isotope = $(this),
3204									isotope_system = $isotope.closest('.isotope-system'),
3205									isotopeId = isotope_system.attr('id'),
3206									filters = new Array(),
3207									$loading_button = isotope_system.find('.loading-button'),
3208									$infinite_button = isotope_system.find('.loadmore-button'),
3209									$numPages = $('a', $infinite_button).data('pages'),
3210									$woo_results,
3211									delay = 300;
3212								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
3213								$infinite_button.show();
3214								$loading_button.hide();
3215								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
3216								$('> li', $isotope).remove();
3217								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
3218								$.each($(newElements), function (index, val) {
3219									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
3220										$woo_results = $(val);
3221										delete newElements[index];
3222									} else {
3223										$(val).addClass('tmb-iso');
3224										if ($(val).is("li")) {
3225											filters.push($(val)[0]);
3226										}
3227									}
3228									$(val).addClass('uncode-appended');
3229								});
3230								newElements = newElements.filter(function(x) {
3231									return filters.indexOf(x) < 0
3232								});
3233								$.each($(filters), function(index, val) {
3234									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
3235								});
3236								if ($woo_results && $woo_results.length > 0) {
3237									var old_count = isotope_system.find('.woocommerce-result-count').text();
3238									var new_count = $woo_results.find('.woocommerce-result-count').text();
3239									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
3240									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
3241									function replaceMatch(match, p1, p2) {
3242        								return old_start + '–' + new_end;
3243									}
3244									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
3245									isotope_system.find('.woocommerce-result-count').text(new_count_text);
3246								}
3247								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
3248								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3249									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
3250									if (typeof getLightbox === 'object') {
3251										getLightbox.refresh();
3252									} else {
3253										UNCODE.lightbox();
3254									}
3255								}
3256								if ( typeof twttr !== 'undefined' )
3257									twttr.widgets.load(isotopeContainersArray[i]);
3258
3259								requestTimeout(function() {
3260									Waypoint.refreshAll();
3261									$isotope.trigger('more-items-loaded');
3262									$(window).trigger('more-items-loaded');
3263									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3264									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3265										$(document).trigger('uncode-scrolltrigger-refresh');
3266									}
3267								}, 1000);
3268
3269							});
3270						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
3271							var $infinite_isotope = $(isotopeContainersArray[i]),
3272								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
3273							$infinite_isotope.infinitescroll('pause');
3274							$infinite_button.on('click', function(event) {
3275								event.preventDefault();
3276								var $infinite_system = $(event.target).closest('.isotope-system'),
3277								$infinite_isotope = $infinite_system.find('.isotope-container'),
3278								isotopeId = $infinite_system.attr('id');
3279								$(event.currentTarget).html(SiteParameters.loading);
3280								$infinite_isotope.infinitescroll('resume');
3281								$infinite_isotope.infinitescroll('retrieve');
3282								$infinite_isotope.infinitescroll('pause');
3283							});
3284						}
3285					}
3286				}
3287			},
3288			onLayout = function(isotopeObj, startIndex, needsReload) {
3289				var needsReload = needsReload ? true : false;
3290
3291				if (typeof UNCODE.bigText !== 'undefined') {
3292					UNCODE.bigText();
3293				}
3294				isotopeObj.css('opacity', 1);
3295				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
3296
3297				requestTimeout(function() {
3298					if (startIndex > 0) {
3299						reloadIsotope(isotopeObj);
3300						if (SiteParameters.dynamic_srcset_active === '1') {
3301							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3302							UNCODE.adaptive_srcset(isotopeObj);
3303						}
3304						// window.dispatchEvent(UNCODE.boxEvent);
3305					} else if (needsReload) {
3306						reloadIsotope(isotopeObj);
3307					}
3308
3309					UNCODE.adaptive();
3310					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
3311						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3312					}
3313					if (typeof MediaElement === "function") {
3314						$(isotopeObj).find('audio,video').each(function() {
3315							$(this).mediaelementplayer({
3316	 							pauseOtherPlayers: false,
3317							});
3318						});
3319					}
3320					if ($(isotopeObj).find('.nested-carousel').length) {
3321						if (typeof UNCODE.carousel !== 'undefined') {
3322							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
3323						}
3324						requestTimeout(function() {
3325							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3326						}, 200);
3327					} else {
3328						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3329					}
3330					isotopeObj.trigger('isotope-layout-complete');
3331
3332				}, 100);
3333
3334			},
3335			boxAnimation = function(items, startIndex, sequential, container) {
3336				var $allItems = items.length - startIndex,
3337					showed = 0,
3338					index = 0;
3339				if (container.closest('.owl-item').length == 1) return false;
3340				$.each(items, function(index, val) {
3341					var $this = $(val),
3342						elInner = $('> .t-inside', val);
3343					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3344						return;
3345					}
3346					if (val[0]) val = val[0];
3347					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
3348						new Waypoint({
3349							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3350							element: val,
3351							handler: function() {
3352								var element = $('> .t-inside', this.element),
3353									parent = $(this.element),
3354									currentIndex = parent.index();
3355								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
3356									delayAttr = parseInt(element.attr('data-delay'));
3357								if (isNaN(delayAttr)) delayAttr = 100;
3358								delay -= showed;
3359								var objTimeout = requestTimeout(function() {
3360									element.removeClass('zoom-reverse').addClass('start_animation');
3361									showed = parent.index();
3362									if ( container.data('isotope') ) {
3363										container.isotope('layout');
3364									}
3365								}, delay * delayAttr)
3366								parent.data('objTimeout', objTimeout);
3367								if (!UNCODE.isUnmodalOpen) {
3368									this.destroy();
3369								}
3370							},
3371							offset: '100%'
3372						})
3373					} else {
3374						if (elInner.hasClass('force-anim')) {
3375							elInner.addClass('start_animation');
3376						} else {
3377							elInner.css('opacity', 1);
3378						}
3379						container.isotope('layout');
3380					}
3381
3382					index++;
3383				});
3384			},
3385			reloadIsotope = function(isotopeObj) {
3386				var isoIndex = $(isotopeObj).attr('data-iso-index');
3387				var $layoutMode = ($(isotopeObj).data('layout'));
3388				if ($layoutMode === undefined) {
3389					$layoutMode = 'masonry';
3390				}
3391				if (isotopeObj.data('isotope')) {
3392					isotopeObj.isotope({
3393						itemSelector: $itemSelector,
3394						layoutMode: $layoutMode,
3395						transitionDuration: transitionDuration[isoIndex],
3396						masonry: {
3397							columnWidth: colWidth(isoIndex)
3398						},
3399						vertical: {
3400							horizontalAlignment: 0.5,
3401						},
3402						sortBy: 'original-order',
3403						isOriginLeft: isOriginLeft
3404					});
3405				}
3406			}
3407			;
3408		if ($('.isotope-pagination').length > 0) {
3409			$('.isotope-system').on('click', '.pagination a', function(evt) {
3410				evt.preventDefault();
3411
3412				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3413					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3414						container = $(this).closest('.isotope-system'),
3415						pagination_disable_scroll = container.attr('data-pagination-scroll'),
3416						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3417					calc_scroll -= UNCODE.get_scroll_offset();
3418
3419					if ( pagination_disable_scroll !== 'disabled' ) {
3420						var menu_container = $('.menu-sticky');
3421						var menu = menu_container.find('.menu-container');
3422
3423						if (menu_container.length > 0 && menu.length > 0) {
3424							calc_scroll = calc_scroll - menu.outerHeight();
3425						}
3426
3427						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3428							delta = bodyTop - calc_scroll,
3429							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3430						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3431
3432						if (!UNCODE.isFullPage) {
3433							if (scrollSpeed == 0) {
3434								$('html, body').scrollTop(calc_scroll);
3435							} else {
3436								$('html, body').animate({
3437									scrollTop: calc_scroll
3438								}, {
3439									easing: 'easeInOutQuad',
3440									duration: scrollSpeed,
3441									complete: function () {
3442										UNCODE.scrolling = false;
3443									}
3444								});
3445							}
3446						}
3447					}
3448				}
3449
3450				loadIsotope($(this), true);
3451			});
3452		}
3453		$filters.on('click', 'a.isotope-nav-link', function(evt) {
3454			if ($(this).hasClass('no-isotope-filter')) {
3455				return;
3456			}
3457			var $filter = $(this),
3458				filterContainer = $filter.closest('.isotope-filters'),
3459				filterValue = $filter.attr('data-filter'),
3460				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
3461				transitionDuration = container.data().isotope.options.transitionDuration,
3462				delay = 300,
3463				filterItems = [];
3464
3465			var filter_items = function(){
3466				if (filterValue !== undefined) {
3467					container.addClass('grid-filtering');
3468					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3469						var parent = $(val).parent(),
3470							objTimeout = parent.data('objTimeout');
3471						if (objTimeout) {
3472							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3473							clearRequestTimeout(objTimeout);
3474						}
3475						if (transitionDuration == 0) {
3476							if ($(val).hasClass('animate_when_almost_visible')) {
3477								$(val).addClass('zoom-reverse').removeClass('start_animation');
3478							} else {
3479								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3480							}
3481						}
3482					});
3483					requestTimeout(function(){
3484						if ( filterValue == '*' ) {
3485							container.removeClass('isotope-filtered');
3486						} else {
3487							container.addClass('isotope-filtered');
3488						}
3489						container.isotope({
3490							filter: function() {
3491								var block = $(this),
3492								filterable = (filterValue == '*') || block.hasClass(filterValue),
3493								lightboxElements = $('[data-lbox^=ilightbox]', block);
3494								if (filterable) {
3495									if (lightboxElements.length) {
3496										lightboxElements.removeClass('lb-disabled');
3497										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3498									}
3499									filterItems.push(block);
3500								} else {
3501									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3502								}
3503								container.trigger('more-items-loaded');
3504								$(window).trigger('more-items-loaded');
3505								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3506								return filterable;
3507							}
3508						});
3509						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3510
3511					}, delay);
3512
3513					/** once filtered - start **/
3514					container.isotope('once', 'arrangeComplete', function() {
3515						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3516							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3517							if (typeof getLightbox === 'object') {
3518								getLightbox.refresh();
3519							} else {
3520								UNCODE.lightbox();
3521							}
3522						}
3523						if (transitionDuration == 0) {
3524							requestTimeout(function() {
3525								boxAnimation(filterItems, 0, false, container);
3526							}, 100);
3527						}
3528						requestTimeout(function() {
3529							Waypoint.refreshAll();
3530							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3531								$(document).trigger('uncode-scrolltrigger-refresh');
3532							}
3533							container.removeClass('grid-filtering');
3534						}, 2000);
3535					});
3536					/** once filtered - end **/
3537				} else {
3538					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3539						$.each(UNCODE.lightboxArray, function(index, val) {
3540							UNCODE.lightboxArray[index].destroy();
3541						});
3542					}
3543					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3544						var parent = $(val).parent(),
3545							objTimeout = parent.data('objTimeout');
3546						if (objTimeout) {
3547							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3548							clearRequestTimeout(objTimeout);
3549						}
3550						if (transitionDuration == 0) {
3551							if ($(val).hasClass('animate_when_almost_visible')) {
3552								$(val).addClass('zoom-reverse').removeClass('start_animation');
3553							} else {
3554								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3555							}
3556						}
3557					});
3558					container.parent().addClass('grid-loading');
3559					loadIsotope($filter);
3560				}
3561			};
3562
3563			if (!$filter.hasClass('active')) {
3564				/** Scroll top with filtering */
3565				if (filterContainer.hasClass('filter-scroll')) {
3566                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3567                    calc_scroll -= UNCODE.get_scroll_offset();
3568
3569					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3570						delta = bodyTop - calc_scroll,
3571						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3572						filterTolerance = false,
3573						filter_timeout;
3574					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3575
3576					if ( !UNCODE.isFullPage ) {
3577						if (scrollSpeed == 0) {
3578							$('html, body').scrollTop(calc_scroll);
3579							UNCODE.scrolling = false;
3580							filter_items();
3581						} else {
3582
3583							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3584								filter_items();
3585								filterTolerance = true;
3586							}
3587
3588							$('html, body').animate({
3589								scrollTop: calc_scroll
3590							},{
3591								easing: 'easeInOutQuad',
3592								duration: scrollSpeed,
3593								complete: function(){
3594									UNCODE.scrolling = false;
3595									if ( !filterTolerance ) {
3596										filter_timeout = setTimeout(function(){
3597											clearTimeout(filter_timeout);
3598											filter_items();
3599										}, 200);
3600									}
3601								}
3602							});
3603						}
3604					}
3605				} else {
3606					filter_items();
3607				}
3608			}
3609			evt.preventDefault();
3610		});
3611
3612		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3613			var params = UNCODE.getURLParams(window.location);
3614			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3615
3616			UNCODE.lastURL = window.location.href;
3617
3618			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
3619				return;
3620			}
3621
3622			if (params.id === undefined) {
3623				$.each($('.isotope-system'), function(index, val) {
3624					loadIsotope($(val));
3625				});
3626			} else {
3627				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3628					loadIsotope($('#' + params.id));
3629				}
3630			}
3631		});
3632
3633		var loadIsotope = function($href, $paginating) {
3634			var is_paginating = false;
3635
3636			if (undefined !== $paginating && $paginating) {
3637				var is_paginating = $paginating;
3638			}
3639
3640			var href = ($href.is("a") ? $href.attr('href') : location),
3641				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3642				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3643				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3644				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3645				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3646				isotopeId = isotopeSystem.attr('id');
3647			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3648				UNCODE.lastURL = href;
3649				history.pushState({
3650					myIsotope: true
3651				}, document.title, href);
3652			}
3653			if (is_paginating) {
3654				isotopeWrapper.addClass('grid-filtering');
3655			}
3656			$.ajax({
3657				url: href
3658			}).done(function(data) {
3659				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3660					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3661					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3662				isotopeWrapper.addClass('isotope-reloaded');
3663				requestTimeout(function() {
3664					isotopeWrapper.removeClass('grid-loading');
3665					isotopeWrapper.removeClass('isotope-reloaded');
3666					isotopeWrapper.removeClass('grid-filtering');
3667				}, 500);
3668				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3669					var parent = $(val).parent(),
3670						objTimeout = parent.data('objTimeout');
3671					if (objTimeout) {
3672						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3673						clearRequestTimeout(objTimeout);
3674					}
3675					if ($(val).hasClass('animate_when_almost_visible')) {
3676						$(val).addClass('zoom-reverse').removeClass('start_animation');
3677					} else {
3678						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3679					}
3680				});
3681				requestTimeout(function() {
3682					if (isotopeContainer.data('isotope')) {
3683						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3684						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3685						UNCODE.adaptive();
3686						if (SiteParameters.dynamic_srcset_active === '1') {
3687							UNCODE.adaptive_srcset(isotopeContainer);
3688						}
3689						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3690							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3691							if (typeof getLightbox === 'object') {
3692								getLightbox.refresh();
3693							} else {
3694								UNCODE.lightbox();
3695							}
3696						}
3697					}
3698					isotopeContainer.trigger('more-items-loaded');
3699					$(window).trigger('more-items-loaded');
3700					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3701				}, 300);
3702				$('.pagination', isotopeFooter).remove();
3703				isotopeFooter.append($resultPagination);
3704
3705				if (isotopeResultCount.length > 0) {
3706					$('.woocommerce-result-count', isotopeResultCount).remove();
3707					isotopeResultCount.append($resultCount);
3708				}
3709			});
3710		};
3711		$filters.each(function(i, buttonGroup) {
3712			var $buttonGroup = $(buttonGroup);
3713			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3714				$buttonGroup.find('.active').removeClass('active');
3715				$(this).addClass('active');
3716
3717			});
3718
3719			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3720				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3721				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3722			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3723				e.preventDefault();
3724				$cats_filters.slideToggle(400, 'easeInOutCirc');
3725			});
3726
3727		});
3728		window.addEventListener('boxResized', function(e) {
3729			if (UNCODE.printDialogOpen !== false) {
3730				return false;
3731			}
3732			$.each($('.isotope-layout'), function(index, val) {
3733				var $layoutMode = ($(this).data('layout'));
3734				if ($layoutMode === undefined) $layoutMode = 'masonry';
3735				if ($(this).data('isotope')) {
3736					$(this).isotope({
3737						itemSelector: $itemSelector,
3738						layoutMode: $layoutMode,
3739						transitionDuration: transitionDuration[index],
3740						masonry: {
3741							columnWidth: colWidth(index)
3742						},
3743						vertical: {
3744							horizontalAlignment: 0.5,
3745						},
3746						sortBy: 'original-order',
3747						isOriginLeft: isOriginLeft
3748					});
3749					$(this).isotope('unbindResize');
3750					if (SiteParameters.dynamic_srcset_active === '1') {
3751						UNCODE.refresh_dynamic_srcset_size($(this));
3752					}
3753				}
3754				$(this).find('.mejs-video,.mejs-audio').each(function() {
3755					$(this).trigger('resize');
3756				});
3757			});
3758		}, false);
3759
3760		init_isotope();
3761	};
3762}
3763
3764UNCODE.lightbox = function() {
3765	if ( SiteParameters.lbox_enhanced ) {
3766		return true;
3767	}
3768	UNCODE.lightboxArray = {};
3769	requestTimeout(function() {
3770		var groupsArr = {};
3771		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3772			var group = this.getAttribute("data-lbox"),
3773				values = $(this).data();
3774			$(this).attr('data-lbox-init','true')
3775			groupsArr[group] = values;
3776		});
3777		for (var i in groupsArr) {
3778			var skin = groupsArr[i].skin || 'black',
3779				path = groupsArr[i].dir || 'horizontal',
3780				thumbs = !groupsArr[i].notmb || false,
3781				arrows = !groupsArr[i].noarr || false,
3782				social = groupsArr[i].social || false,
3783				deeplink = groupsArr[i].deep || false,
3784				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3785				counter = $els.length,
3786				dataAlbum = $els.attr('data-album');
3787			if (social) social = {
3788				facebook: true,
3789				twitter: true,
3790				reddit: true,
3791				digg: true
3792			};
3793			UNCODE.lightboxArray[i] = $els.iLightBox({
3794				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3795				skin: skin,
3796				path: path,
3797				linkId: deeplink,
3798				infinite: false,
3799				//fullViewPort: 'fit',
3800				smartRecognition: false,
3801				fullAlone: true,
3802				maxScale: 1,
3803				minScale: .02,
3804				//fullStretchTypes: 'flash, video',
3805				overlay: {
3806					opacity: .94
3807				},
3808				controls: {
3809					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3810					fullscreen: true,
3811					thumbnail: thumbs,
3812					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3813				},
3814				show: {
3815					speed: 200
3816				},
3817				hide: {
3818					speed: 200
3819				},
3820				social: {
3821					start: false,
3822					buttons: social
3823				},
3824				caption: {
3825					start: false
3826				},
3827				styles: {
3828					nextOpacity: 1,
3829					nextScale: 1,
3830					prevOpacity: 1,
3831					prevScale: 1
3832				},
3833				effects: {
3834					switchSpeed: 400
3835				},
3836				slideshow: {
3837					pauseTime: 5000
3838				},
3839				thumbnails: {
3840					maxWidth: 60,
3841					maxHeight: 60,
3842					activeOpacity: .2
3843				},
3844				html5video: {
3845					preload: true
3846				},
3847				callback: {
3848					onOpen: function(){
3849						$(window).trigger('uncode-custom-cursor');
3850						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3851							iNoBounce.enable();
3852						}
3853					},
3854					onHide: function(){
3855						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3856							iNoBounce.disable()
3857						}
3858					},
3859				}
3860			});
3861
3862			$(document).on('infinite-loaded', function(){
3863				UNCODE.lightboxArray[i].refresh();
3864			});
3865
3866			$(window).on('gdprOpen', function(){
3867				UNCODE.lightboxArray[i].close();
3868			});
3869		};
3870	}, 100);
3871
3872	$(document).on('click', '.lb-disabled', function(e){
3873		e.preventDefault();
3874	});
3875};
3876
3877UNCODE.lightgallery = function( $el ) {
3878	var createSelectors = function(){
3879		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
3880			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3881				$(this).addClass('lbox-trigger-item');
3882			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3883				$(this).addClass('lbox-nested-item');
3884			} else {
3885				$(this).removeClass('lbox-trigger-item');
3886				$(this).removeClass('lbox-nested-item');
3887			}
3888		});
3889	};
3890
3891	createSelectors();
3892
3893	var galleries = [],
3894		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3895			return !$(this).closest('.nested-carousel').length;
3896		}),
3897		$_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 *'), 
3898		$galleries = $_galleries.filter(function( index ) {
3899			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3900		}),
3901		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3902
3903	if ( typeof $el === 'undefined' ) {
3904		$el = $galleries.add( $nested );
3905	}
3906
3907	var $disabled = $('a.lb-disabled');
3908	$disabled.on('click', function(e){
3909		e.preventDefault();
3910	});
3911
3912	var beforeSlide = function(event) {
3913		var detail = event.detail,
3914			info = detail.info,
3915			item = detail.item,
3916			$slide = $(detail.currentSlide.selector),
3917			$video = $('video', $slide),
3918			$previous = $(detail.previousSlide.selector),
3919			$prevVideo = $('video', $previous),
3920			isAudio = false;
3921
3922		if ( typeof info.src !== 'undefined' ) {
3923			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3924		}
3925
3926		if ( ! $video.length && ( info.video || isAudio ) ) {
3927			if ( info.video ) {
3928				if ( typeof info.video === 'object' ) {
3929					var infoJson = info.video;
3930				} else {
3931					var infoJson = JSON.parse(info.video);
3932				}
3933				var src = infoJson.source[0].src,
3934					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3935					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3936					loop = $(item).attr('data-loop');
3937
3938			} else if ( isAudio ) {
3939				var src = info.src,
3940					autoplay = true,
3941					loop = false;
3942			}
3943			if ( typeof src !== 'undefined' ) {
3944				$slide.addClass('has-html5');
3945				var video = document.createElement('video');
3946				video.src = src;
3947				video.preload = 'auto';
3948				video.controls = 'controls';
3949				video.controlsList = 'nodownload';
3950				if ( autoplay ) {
3951					video.autoplay = 'autoplay';
3952				}
3953				if ( muted ) {
3954					video.muted = 'muted';
3955				}
3956				if ( loop ) {
3957					video.loop = 'loop';
3958				}
3959				$(video).appendTo($slide);
3960			}
3961		} else {
3962			var $video = $('video', $slide);
3963			if ( $video.length ) {
3964				$video[0].currentTime = 0;
3965				if ( $video[0].autoplay ) {
3966					$video[0].play();
3967				}
3968			}
3969		}
3970		if ( $prevVideo.length ) {
3971			$prevVideo[0].currentTime = 0;
3972			$prevVideo[0].pause();
3973		}
3974	};
3975
3976	var beforeOpen = function(event) {
3977		var detail = event.detail,
3978			items = detail.items,
3979			galleryItems = detail.galleryItems,
3980			outer = detail.outer.selector,
3981			i, ii;
3982		for ( i = 0; i < galleryItems.length; i++ ) {
3983			var item = galleryItems[i];
3984			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
3985				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
3986			}
3987		}
3988		for ( ii = 0; ii < items.length; ii++ ) {
3989			var item = items[ii];
3990			if ( $(item).attr('data-icon') === 'video' ) {
3991				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
3992			}
3993		}
3994
3995	};
3996
3997	//caption builder
3998	var captionBuilder = function($el){
3999		$el.each( function( index, val ) {
4000			var $gallery = $(this).attr('data-lbox-init','true'),
4001				$_a = '.lbox-trigger-item',
4002				$_nested_a = '.lbox-nested-item';
4003
4004			$gallery.find($_a).add($_nested_a).each(function(){
4005				var $a = $(this),
4006					$img = $('img', $a).first(),
4007					imgw = $img.attr('data-width'),
4008					imgh = $img.attr('data-height'),
4009					caption = $a.attr('data-caption'),
4010					title = $a.attr('data-title');
4011
4012				if ( $img.length && $img.attr('data-crop') != true ) {
4013					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
4014						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
4015					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
4016						$a.attr('data-external-thumb-image', $img[0].src);
4017					}
4018				}
4019
4020				if ( typeof title !== 'undefined' && title !== '' ) {
4021					title = '<h6>' + title + '</h6>';
4022				} else {
4023					title = '';
4024				}
4025
4026				if ( typeof caption !== 'undefined' && caption !== '' ) {
4027					caption = '<p>' + caption + '</p>';
4028					title += caption;
4029				}
4030
4031				if ( title !== '' ) {
4032					$a.attr( 'title', title );
4033				}
4034
4035				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') ) ) {
4036					$a.attr('data-lg-size', imgw + '-' + imgh);
4037				}
4038			});
4039		});
4040	};
4041	captionBuilder($el);
4042
4043	//regular galleries
4044	$el.each( function( index, val ) {
4045		var $gallery = $(this),
4046			$_a = '.lbox-trigger-item',
4047			$_nested_a = '.lbox-nested-item',
4048			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
4049			galleryID = $_first.attr('data-lbox'),
4050			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
4051			tmb = $_first.attr('data-notmb'),
4052			social = $_first.attr('data-social'),
4053			deep = $_first.attr('data-deep'),
4054			zoom = $_first.attr('data-zoom-origin'),
4055			actual = $_first.attr('data-actual-size'),
4056			download = $_first.attr('data-download'),
4057			controls = $_first.attr('data-arrows') !== 'no',
4058			fullScreen = $_first.attr('data-full'),
4059			counter = $_first.attr('data-counter'),
4060			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
4061			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4062			connect = $_first.attr('data-connect'),
4063			lgPlugins = [lgVideo],
4064			itemsLoadedTimeOut;
4065
4066		if ( typeof galleryID === 'undefined' ) {
4067			galleryID = $gallery.attr('id');
4068		}
4069
4070		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4071		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4072
4073		if ( typeof tmb == 'undefined' || !tmb ) {
4074			lgPlugins.push(lgThumbnail);
4075		}
4076		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
4077			lgPlugins.push(lgZoom);
4078		}
4079		if ( typeof deep != 'undefined' && deep != '' ) {
4080			lgPlugins.push(lgHash);
4081		}
4082		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4083			lgPlugins.push(lgFullscreen);
4084		}
4085		if ( social ) {
4086			lgPlugins.push(lgShare);
4087		}
4088
4089		if ( galleries.indexOf( galleryID ) !== -1 ) {
4090			return true;
4091		}
4092
4093		galleries.push( galleryID );
4094		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
4095			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
4096		var gallery = lightGallery( $triggerGal[0], {
4097			addClass: containerClass,
4098			plugins: lgPlugins,
4099			mode: transition,
4100			selector: $selector,
4101			galleryId: galleryID,
4102			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4103			iframeWidth: '848px',
4104			iframeMaxWidth: '90%',
4105			iframeMaxHeight: '90%',
4106			exThumbImage: 'data-external-thumb-image',
4107			loadYouTubeThumbnail: false,
4108			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ),
4109			// autoplayFirstVideo: false,
4110			pager: false,
4111			startClass: 'lg-start-opacity',
4112			zoomFromOrigin: zoom,
4113			controls: controls,
4114			download: ( typeof download != 'undefined' && download != '' ),
4115			thumbWidth: 50,
4116			thumbHeight: '50px',
4117			counter: $triggerGal.find($selector).length > 1 ? counter : false,
4118			loadYouTubePoster: false,
4119			enableDrag: $triggerGal.find($selector).length > 1,
4120			mobileSettings: {
4121				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4122			},
4123		});
4124
4125		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
4126			e.preventDefault();
4127			var index = $(this).closest('.owl-item.cloned').attr('data-index');
4128			gallery.openGallery(index-1);
4129		});
4130
4131		$gallery.on('uncode-gallery-trigger', function(){
4132			gallery.openGallery(0);
4133		});
4134
4135		$triggerGal.on('more-items-loaded', function(e, items) {
4136			clearRequestTimeout(itemsLoadedTimeOut);
4137			itemsLoadedTimeOut = requestTimeout(function(){
4138				createSelectors();
4139				captionBuilder($triggerGal);
4140				gallery.refresh();
4141			}, 100);
4142		});
4143
4144		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4145			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4146				$el = model.view.$el;
4147				if ( $el.find($triggerGal).length ) {
4148					gallery.destroy();
4149				}
4150			});
4151		}
4152
4153		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
4154		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
4155		$triggerGal[0].addEventListener('lgAfterOpen', function(){
4156			$(window).trigger('uncode-custom-cursor');
4157		});
4158
4159	});
4160
4161	if ( typeof $el !== 'undefined' ) {
4162
4163		//album galleries
4164		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
4165			var album = val,
4166				galleryID = index,
4167				$album = $(album),
4168				params = $album.attr('data-album'),
4169				tmb = $(val).attr('data-notmb'),
4170				social = $(val).attr('data-social'),
4171				deep = $(val).attr('data-deep'),
4172				actual = $(val).attr('data-actual-size'),
4173				download = $(val).attr('data-download'),
4174				controls = $(val).attr('data-arrows') !== 'no',
4175				fullScreen = $(val).attr('data-full'),
4176				counter = $(val).attr('data-counter'),
4177				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
4178				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4179				lgPlugins = [lgVideo];
4180
4181			$(val).attr('data-lbox-init','true');
4182
4183			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4184			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4185
4186			if ( typeof tmb == 'undefined' || !tmb ) {
4187				lgPlugins.push(lgThumbnail);
4188			}
4189			if ( typeof actual != 'undefined' && actual != '' ) {
4190				lgPlugins.push(lgZoom);
4191			}
4192			if ( typeof deep != 'undefined' && deep != '' ) {
4193				lgPlugins.push(lgHash);
4194			}
4195			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4196				lgPlugins.push(lgFullscreen);
4197			}
4198			if ( social ) {
4199				lgPlugins.push(lgShare);
4200			}
4201
4202			var gallery = window.lightGallery(album, {
4203				dynamic: true,
4204				plugins: lgPlugins,
4205				dynamicEl: JSON.parse(params),
4206				galleryId: galleryID,
4207				addClass: containerClass,
4208				mode: transition,
4209				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4210				iframeWidth: '848px',
4211				iframeMaxWidth: '90%',
4212				iframeMaxHeight: '90%',
4213				loadYouTubeThumbnail: false,
4214				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
4215				// autoplayFirstVideo: false,
4216				pager: false,
4217				startClass: 'lg-start-opacity',
4218				zoomFromOrigin: false,
4219				controls: controls,
4220				download: ( typeof download != 'undefined' && download != '' ),
4221				thumbWidth: 50,
4222				thumbHeight: '50px',
4223				loadYouTubePoster: false,
4224				counter: counter,
4225				exThumbImage: 'data-external-thumb-image',
4226				loadYouTubePoster: false,
4227				mobileSettings: {
4228					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4229				},
4230			});
4231
4232			$album.on('click', function(){
4233				gallery.openGallery(0);
4234			});
4235
4236			album.addEventListener('lgBeforeSlide', beforeSlide);
4237			album.addEventListener('lgBeforeOpen', beforeOpen);
4238			album.addEventListener('lgAfterOpen', function(){
4239				$(window).trigger('uncode-custom-cursor');
4240			});
4241
4242			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4243				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4244					$el = model.view.$el;
4245					if ( $el.find($album).length ) {
4246						gallery.destroy();
4247					}
4248				});
4249			}
4250
4251		});
4252
4253		//single images
4254		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
4255			var gallery = lightGallery( $('.page-wrapper')[0], {
4256				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
4257				iframeWidth: '848px',
4258				iframeMaxWidth: '90%',
4259				iframeMaxHeight: '90%',
4260				loadYouTubeThumbnail: false,
4261				// autoplayFirstVideo: false,
4262				startClass: 'lg-start-opacity',
4263				thumbWidth: 50,
4264				thumbHeight: '50px',
4265				download: false,
4266				loadYouTubePoster: false,
4267				counter: false
4268			});
4269
4270			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
4271			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
4272		});
4273	}
4274
4275	var galleryButtons = function(){
4276		var $buttons = $('.btn-gallery-trigger');
4277		$buttons.each(function(key, val){
4278			var $button = $(val),
4279				target = $button.attr('data-target'),
4280				$gallery = $('.un-media-gallery').first(),
4281				$row = $button.closest('.vc_row[data-parent]');
4282			if ( typeof target !== 'undefined' && target !== '' && $('.un-media-gallery#' + target).length  ) {
4283				$gallery = $('.un-media-gallery#' + target);
4284			} else if ( $('.un-media-gallery', $row).length ) {
4285				$gallery = $('.un-media-gallery', $row).first();
4286			}
4287			
4288			$button.on('click', 'a', function(e){
4289				e.preventDefault();
4290				$gallery.find('[data-lbox-init]').first().trigger('uncode-gallery-trigger');
4291			});
4292		});
4293	};
4294	galleryButtons();
4295};
4296
4297UNCODE.carousel = function(container) {
4298	var $owlContainers = $('.owl-carousel-container:not(.test-init)', container);
4299	$owlContainers.each(function() {
4300		var $owlContainer = $(this).addClass('test-init'),
4301			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
4302			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
4303			values = {},
4304			tempTimeStamp,
4305			newWidth = UNCODE.wwidth,
4306			$owlInsideEqual = [];
4307		$owlSelector.each(function() {
4308			var itemID = $(this).attr('id'),
4309				$elSelector = $(('#' + itemID).toString());
4310			values['id'] = itemID;
4311			values['items'] = 1;
4312			values['columns'] = 3;
4313			values['fade'] = false;
4314			values['nav'] = false;
4315			values['navmobile'] = false;
4316			values['navskin'] = 'light';
4317			values['navspeed'] = 400;
4318			values['dots'] = false;
4319			values['dotsmobile'] = false;
4320			values['loop'] = false;
4321			values['autoplay'] = false;
4322			values['timeout'] = 3000;
4323			values['autoheight'] = false;
4324			values['stagepadding'] = 0;
4325			values['margin'] = 0;
4326			values['lg'] = 1;
4327			values['md'] = 1;
4328			values['sm'] = 1;
4329			$.each($(this).data(), function(i, v) {
4330				values[i] = v;
4331			});
4332
4333			if ($(this).closest('.uncode-slider').length) {
4334				values['navskin'] = '';
4335				values['navmobile'] = false;
4336				//values['dotsmobile'] = true;
4337			} else {
4338				values['navskin'] = ' style-'+values['navskin']+' style-override';
4339			}
4340
4341			var setIndexActive = function(event, init){
4342				var init = typeof init === 'undefined' ? false : init,
4343					thiis = $(event.currentTarget);
4344				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
4345					var scrolltop = $(document).scrollTop(),
4346						size = event.page.size,
4347						i;
4348					var setIndex = requestTimeout(function() {
4349						for ( i = 0; i < size; i++ ) {
4350							var itemCont = event.item.index != null ? (event.item.index + i) : i;
4351							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
4352							if (thiis.closest('.row-slider').length) {
4353								if (currentItem == undefined) {
4354									currentItem = thiis.children()[i];
4355								}
4356								if ($(currentItem).closest('#page-header').length) {
4357									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4358										UNCODE.switchColorsMenu(scrolltop, 'dark');
4359									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4360										UNCODE.switchColorsMenu(scrolltop, 'light');
4361									}
4362								}
4363								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
4364								if (owlCustomNav.length) {
4365									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4366										owlCustomNav.addClass('style-dark').removeClass('style-light');
4367									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4368										owlCustomNav.addClass('style-light').removeClass('style-dark');
4369									}
4370								}
4371							}
4372							var itendIndex = $(currentItem).attr('data-index');
4373							if ( isNaN(itendIndex) ) {
4374								itendIndex = 1;
4375							}
4376							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
4377							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
4378							if ($.fn.counterUp) {
4379								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
4380									var $counter = $(this);
4381									$counter.addClass('started').counterUp({
4382										delay: 10,
4383										time: 1500
4384									});
4385								});
4386							}
4387						}
4388						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
4389					}, 200);
4390				}
4391				tempTimeStamp = event.timeStamp;
4392			}
4393
4394			/** Initialize */
4395			$elSelector.on('initialize.owl.carousel', function(event) {
4396				if (typeof UNCODE.owlNav !== 'undefined') {
4397					UNCODE.owlNav(itemID, event);
4398				}
4399
4400				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4401					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
4402						var shortcode = model.attributes.shortcode,
4403							$el = model.view.$el,
4404							$row_wrap = $el.closest('.row');
4405						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4406							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
4407						}
4408					});
4409					window.parent.vc.events.on('shortcodeView:updated', function(model) {
4410						var shortcode = model.attributes.shortcode;
4411						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4412							tempTimeStamp = Math.floor(Date.now() / 1000);
4413						}
4414					});
4415					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
4416						var shortcode = model.attributes.shortcode;
4417						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4418							UNCODE.owlNav(itemID, event);
4419							$elSelector.trigger('refresh.owl.carousel');
4420						}
4421					});
4422				}
4423				// if ( $elSelector.closest('.mega-menu-inner').length ) {
4424				// 	$elSelector.closest('.mega-menu-inner').css({
4425				// 		visibility: 'hidden',
4426				// 		display: 'block'
4427				// 	});
4428				// 	$elSelector.data('owl.carousel');
4429				// 	$elSelector.trigger('refresh.owl.carousel');
4430				// 	$elSelector.closest('.mega-menu-inner').css({
4431				// 		display: 'none',
4432				// 		visibility: '',
4433				// 	});
4434				// }
4435				// $elSelector.closest('[class*="menu-smart"]').on('show.smapi', function(e, p){
4436				// 	$elSelector.trigger("to.owl.carousel", 0);
4437				// });
4438			});
4439
4440			/** Initialized */
4441			$elSelector.on('initialized.owl.navigation', function(event) {
4442				$('.owl-dot', event.currentTarget).each(function(key, val){
4443					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4444				});
4445			});
4446
4447			$elSelector.on('initialized.owl.carousel', function(event) {
4448
4449				if ( $('.isotope-container', event.currentTarget).length ) {
4450					window.dispatchEvent(UNCODE.boxEvent);
4451				}
4452
4453				$('.owl-dot.active', $elSelector).on('click', function(){
4454					return false;
4455				});
4456
4457				var thiis = $(event.currentTarget),
4458					// get the time from the data method
4459					time = thiis.data("timer-id"),
4460					rowParent = thiis.closest('.row-parent');
4461
4462				if ( typeof rowParent[0] !== 'undefined' ) {
4463					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4464				}
4465
4466				if (time) {
4467					clearRequestTimeout(time);
4468				}
4469
4470				thiis.addClass('showControls');
4471				var new_time = requestTimeout(function() {
4472					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4473					if (thiis.hasClass('owl-height-viewport'))
4474						setItemsRelHeight(thiis);
4475					if (thiis.hasClass('owl-height-equal'))
4476						setItemsHeight(thiis);
4477					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4478					if (thiis.closest('.unequal, .unexpand').length) {
4479						UNCODE.setRowHeight(rowParent[0], true);
4480					}
4481					if (SiteParameters.dynamic_srcset_active === '1') {
4482						UNCODE.refresh_dynamic_srcset_size(thiis);
4483					}
4484				}, 350);
4485				// save the new time
4486				thiis.data("timer-id", new_time);
4487
4488				var scrolltop = $(document).scrollTop();
4489				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4490
4491				//if (!UNCODE.isMobile) {
4492					/** fix autoplay when visible **/
4493				$(window).on('load', function(){
4494					if (thiis.data('autoplay')) {
4495						if ( !thiis.closest('.sticky-element').length || thiis.closest('.un-submenu').length ) {
4496							thiis.trigger('stop.owl.autoplay');
4497						} else {
4498							thiis.trigger('play.owl.autoplay');
4499						}
4500					}
4501					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4502						return;
4503					}
4504					if ( ! thiis.closest('.sticky-element').length && ! thiis.closest('.un-submenu').length ) {
4505						var carouselInView = new Waypoint.Inview({
4506							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4507							element: thiis[0],
4508							exited: function() {
4509								var el = $(this.element);
4510								if (el.data('autoplay') ) {
4511									el.trigger('stop.owl.autoplay');
4512									el.data('stopped','true');
4513								}
4514							},
4515							enter: function(direction) {
4516								var el = $(this.element);
4517								requestTimeout(function() {
4518									if (el.data('autoplay')) {
4519										el.trigger('play.owl.autoplay');
4520										el.data('stopped','false');
4521									}
4522								}, 100);
4523							}
4524						});
4525					}
4526					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4527						setTimeout(function(){
4528							window.lenis.resize();
4529						}, 1000);
4530					}
4531			  	
4532				});
4533				//}
4534
4535				// $(window).on('frontend:carousel_updated', function(){
4536				// 	Waypoint.refreshAll();
4537				// });
4538
4539				if (!thiis.closest('.isotope-system').length && !thiis.closest('.megamenu-block-wrapper').length) {
4540					requestTimeout(function() {
4541						animate_thumb($('.t-inside', el), event);
4542					}, 400);
4543				} 
4544				if (thiis.closest('.isotope-system').length ) {
4545					requestTimeout(function() {
4546						thiis.closest('.isotope-container').isotope('layout');
4547					}, 400);
4548				}
4549				if (thiis.closest('.megamenu-block-wrapper').length ) {
4550					$(document).on('un-menu-show', function(e, $ul){
4551						if ( thiis.closest($ul).length ) {
4552							animate_thumb($('.t-inside', el), event);
4553						}
4554					});
4555				}
4556
4557				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4558				currentIndex = $(currentItem).attr('data-index');
4559
4560				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4561					if ($(val).closest('.uncode-slider').length) {
4562						$(val).removeClass('start_animation');
4563					}
4564				});
4565				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4566					if ($(val).closest('.uncode-slider').length) {
4567						$(val).removeClass('already-animated');
4568					}
4569				});
4570
4571				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4572					if ($(val).closest('.uncode-slider').length) {
4573						$(val).removeAttr('data-animated');
4574					}
4575				});
4576
4577				$.each($('.owl-item.cloned', thiis), function(index, val) {
4578					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4579				});
4580
4581				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4582					if ($(val).attr('data-index') != currentIndex) {
4583						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4584						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4585					}
4586					if ($(val).attr('data-index') != currentIndex) {
4587						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4588					}
4589					if ($(val).attr('data-index') == currentIndex) {
4590						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4591					}
4592				});
4593
4594				if (thiis.closest('.uncode-slider').length) {
4595					var el = thiis.closest('.row-parent')[0],
4596						section = thiis.closest('.vc_section');
4597					if ( section.length ) {
4598						el = $('> .row-parent', section)[0];
4599					}
4600					if ($(el).data('imgready')) {
4601						firstLoaded(el, event);
4602					} else {
4603						el.addEventListener("imgLoaded", function(el) {
4604							firstLoaded(el.target, event);
4605						}, false);
4606					}
4607					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4608					if (transHeight != null) {
4609						requestTimeout(function() {
4610							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4611						}, 100);
4612					}
4613				} else {
4614					var el = thiis;
4615					el.closest('.uncode-slider').addClass('slider-loaded');
4616				}
4617
4618				requestTimeout(function() {
4619					if (typeof UNCODE.bigText !== 'undefined') {
4620						UNCODE.bigText(thiis);
4621					}
4622					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4623						if (thiis.data('autoplay')) pauseOnHover(thiis);
4624					}
4625				}, 500);
4626
4627				if (thiis.closest('.unequal').length) {
4628					$owlInsideEqual.push(thiis.closest('.row-parent'));
4629				}
4630
4631				var containerClasses = '',
4632					containerStyle = '';
4633				if ( $('.owl-dots-classes', $owlContainer).length ) {
4634					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4635					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4636					$('.owl-dots-classes', $owlContainer).remove();
4637				}
4638
4639				if ( containerClasses !== '' ) {
4640					requestTimeout(function() {
4641						if ( containerClasses !== '' )
4642							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4643						if ( containerStyle !== '' )
4644							$('.owl-dots', $owlContainer).addClass(containerClasses);
4645					}, 100);
4646				}
4647
4648				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4649					$(val).closest('.row-inner').css({
4650						'margin-top': '-1px'
4651					});
4652				});
4653
4654				if ($.fn.isotope) {
4655					if ( thiis.closest('.isotope-container').length ) {
4656						if (thiis.closest('.isotope-container').data('isotope')) {
4657							requestTimeout(function(){
4658								thiis.closest('.isotope-container').isotope('layout');
4659							}, 300);
4660						}
4661						$(window).on('load', function(){
4662							if (thiis.closest('.isotope-container').data('isotope')) {
4663								thiis.closest('.isotope-container').isotope('layout');
4664							}
4665						});
4666					}
4667				}
4668
4669				if (thiis.data('autoplay')) {
4670					$(window).on('menuOpen', function(){
4671						thiis.trigger('stop.owl.autoplay');
4672						thiis.data('stopped','true');
4673					});
4674				}
4675				$(window).on('menuClose', function(){
4676					if (thiis.data('autoplay')) {
4677						thiis.trigger('play.owl.autoplay');
4678						thiis.data('stopped','false');
4679					}
4680				});
4681
4682				setIndexActive(event, true);
4683
4684				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4685						return !$(this).closest('.nested-carousel').length;
4686					}),
4687					$_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),
4688					$galleries = $_galleries.filter(function( index ) {
4689						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4690					});
4691
4692				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4693					UNCODE.lightgallery( $galleries );
4694				}
4695
4696				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4697					$(document).trigger('uncode-scrolltrigger-refresh');
4698				}
4699
4700				if (thiis.closest('.un-submenu').length && thiis.data('autoplay')) {
4701					thiis.trigger('stop.owl.autoplay');
4702					thiis.data('stopped','false');
4703					$(document).on('un-menu-show', function(){
4704						thiis.trigger('play.owl.autoplay');
4705						thiis.data('stopped','false');
4706					}).on('un-menu-hide', function(){
4707						thiis.trigger('stop.owl.autoplay');
4708						thiis.data('stopped','true');
4709					});
4710				}
4711			});
4712
4713			$elSelector.on('resized.owl.carousel', function(event) {
4714				$('.owl-dot', event.currentTarget).each(function(key, val){
4715					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4716				});
4717			});
4718
4719			$elSelector.on('resized.owl.carousel', function(event) {
4720				var thiis = $(event.currentTarget);
4721				// if ($(this).closest('.nested-carousel').length) {
4722				// 	requestTimeout(function() {
4723				// 		window.dispatchEvent(UNCODE.boxEvent);
4724				// 	}, 200);
4725				// }
4726				if ( thiis.hasClass('owl-height-equal') )
4727					setItemsHeight(thiis);
4728
4729				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4730					newWidth = UNCODE.wwidth;
4731					setItemsRelHeight($elSelector);
4732				}
4733
4734				setIndexActive(event);
4735
4736				if (SiteParameters.dynamic_srcset_active === '1') {
4737					UNCODE.refresh_dynamic_srcset_size(thiis);
4738				}
4739
4740				if ($.fn.isotope) {
4741					$(window).on('load', function(){
4742						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4743							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4744						}
4745					});
4746				}
4747
4748				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4749					setTimeout(function(){
4750						window.lenis.resize();
4751					}, 1000);
4752				}
4753				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4754					$(document).trigger('uncode-scrolltrigger-refresh');
4755				}
4756			});
4757
4758			$elSelector.on('refreshed.owl.carousel', function(event) {
4759				setIndexActive(event);
4760			});
4761
4762			/** detect resize window for fluid height layout */
4763			var setFluidResize;
4764			function manageFluidCarouseHeight() {
4765				clearRequestTimeout(setFluidResize);
4766				setFluidResize = requestTimeout(function(){
4767					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4768						newWidth = UNCODE.wwidth;
4769						setItemsRelHeight($elSelector);
4770					}
4771				}, 100);
4772			}
4773			window.addEventListener('resize', manageFluidCarouseHeight);
4774
4775			/** Change */
4776			$elSelector.on('change.owl.carousel', function(event) {
4777				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4778			});
4779
4780			/** Changed */
4781			$elSelector.on('changed.owl.carousel', function(event) {
4782				var $row = $elSelector.parents('.row')[0];
4783				if ( typeof $row !== 'undefined' ) {
4784					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4785				}
4786				setIndexActive(event);
4787			});
4788
4789			var checkDrag = function(e) {
4790				$elSelector.addClass('owl-dragging');
4791			};
4792			$elSelector.on('drag.owl.carousel', function(event) {
4793				document.addEventListener("mousemove", checkDrag);
4794			});
4795
4796			$elSelector.on('dragged.owl.carousel', function(event) {
4797				$elSelector.removeClass('owl-dragging');
4798				document.removeEventListener("mousemove", checkDrag);
4799			});
4800
4801			$elSelector.on('translate.owl.carousel', function(event) {
4802				if (UNCODE.isMobile) {
4803					$(event.currentTarget).addClass('owl-translating');
4804				}
4805			});
4806
4807			/** Translated */
4808			$elSelector.on('translated.owl.carousel', function(event) {
4809
4810				var thiis = $(event.currentTarget),
4811					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4812					currentIndex = $(currentItem).attr('data-index'),
4813					stagePadding = thiis.data('stagepadding');
4814
4815				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4816
4817				if (!UNCODE.isMobile) {
4818					UNCODE.owlPlayVideo(thiis);
4819				}
4820
4821				requestTimeout(function(){
4822					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4823					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4824					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4825						if (lastDelayElems == undefined) lastDelayElems = 0;
4826						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4827						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4828						thiis.trigger('stop.owl.autoplay');
4829						requestTimeout(function() {
4830							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4831						}, maxDelay);
4832					}
4833				}, 200);
4834
4835				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4836					if ($(val).closest('.uncode-slider').length) {
4837						$(val).removeClass('start_animation');
4838					}
4839				});
4840
4841				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4842					if ($(val).closest('.uncode-slider').length) {
4843						$(val).removeClass('already-animated');
4844					}
4845				});
4846
4847				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4848					if ($(val).closest('.uncode-slider').length) {
4849						$(val).removeAttr('data-animated');
4850					}
4851				});
4852
4853				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4854					if ($(val).attr('data-index') != currentIndex) {
4855						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4856						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4857					}
4858					if ($(val).attr('data-index') != currentIndex) {
4859						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4860					}
4861					if ($(val).attr('data-index') == currentIndex) {
4862						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4863					}
4864				});
4865
4866				if (UNCODE.isMobile) {
4867					thiis.removeClass('owl-translating');
4868				}
4869
4870				setIndexActive(event);
4871			});
4872
4873			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4874
4875			/** Init carousel */
4876			$elSelector.not('.showControls').owlCarousel({
4877				items: values['items'],
4878				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4879				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4880				nav: values['nav'],
4881				dots: values['dots'],
4882				loop: values['loop'],
4883				stagePadding: values['stagepadding'],
4884				margin: 0,
4885				video: true,
4886				autoWidth: false,
4887				autoplay: false,
4888				autoplayTimeout: values['timeout'],
4889				autoplaySpeed: values['navspeed'],
4890				autoplayHoverPause: $(this).closest('.uncode-slider').length || $(this).closest('.carousel-no-hover').length ? false : true,
4891				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4892				itemSelector: SiteParameters.uncode_carousel_itemSelector,
4893				rtl: $('body').hasClass('rtl') ? true : false,
4894				fluidSpeed: true,
4895				navSpeed: values['navspeed'],
4896				dotsSpeed: values['navspeed'] / values['items'],
4897				navElement: ['button type="button" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" aria-label="' + SiteParameters.uncode_next_label + '"'],
4898				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4899				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>'],
4900				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4901				responsiveClass: true,
4902				responsiveBaseElement: '.box-container',
4903				responsive: {
4904					0: {
4905						items: values['sm'],
4906						nav: values['navmobile'],
4907						dots: values['dotsmobile'],
4908						dotsSpeed: values['navspeed'] / values['sm'],
4909					},
4910					480: {
4911						items: values['sm'],
4912						nav: values['navmobile'],
4913						dots: values['dotsmobile'],
4914						dotsSpeed: values['navspeed'] / values['sm'],
4915					},
4916					570: {
4917						items: values['md'],
4918						nav: values['navmobile'],
4919						dots: values['dotsmobile'],
4920						dotsSpeed: values['navspeed'] / values['md'],
4921					},
4922					960: {
4923						items: values['lg'],
4924						dotsSpeed: values['navspeed'] / values['lg'],
4925					}
4926				}
4927			});
4928
4929			var transDuration = parseFloat(values['navspeed']) * 0.3;
4930			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
4931
4932			$('.owl-item .tmb', $elSelector).css({
4933				'-webkit-transition-delay': transDuration + 'ms',
4934				'-moz-transition-delay': transDuration + 'ms',
4935				'-o-transition-delay': transDuration + 'ms',
4936				'transition-delay': transDuration + 'ms',
4937				'-webkit-transition-duration': transDuration2 + 'ms',
4938				'-moz-transition-duration': transDuration2 + 'ms',
4939				'-o-transition-duration': transDuration2 + 'ms',
4940				'transition-duration': transDuration2 + 'ms',
4941			});
4942
4943			requestTimeout(function() {
4944				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4945					UNCODE.setRowHeight($owlInsideEqual[i]);
4946				};
4947			}, 300);
4948
4949			$(window).on('load', function(){
4950				var $elCarousel = $elSelector.data('owl.carousel');
4951				if ( typeof $elCarousel !== 'undefined' ) {
4952					$elCarousel.trigger('refreshed');
4953					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4954						UNCODE.setRowHeight($owlInsideEqual[i]);
4955					};
4956				}
4957			});
4958
4959			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
4960				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4961					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
4962					$('#' + carousel_id).find('.owl-item').each( function() {
4963						var $item = $(this),
4964							index = ( $item.index() + 1 );
4965						$item.attr('data-index', index);
4966					});
4967				}
4968			});
4969
4970			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4971				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
4972					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4973						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
4974						$('#' + carousel_id).find('.owl-item').each( function() {
4975							var $item = $(this),
4976								index = ( $item.index() + 1 );
4977							$item.attr('data-index', index);
4978						});
4979					}
4980				});
4981			}
4982
4983		});
4984
4985		function firstLoaded(el, event) {
4986			var el = $(el),
4987			uncode_slider = el.find('.uncode-slider');
4988			el.find('.owl-carousel').css('opacity', 1);
4989			uncode_slider.addClass('slider-loaded');
4990			if (typeof UNCODE.bigText !== 'undefined') {
4991				UNCODE.bigText(el.find('.owl-item.active'));
4992			}
4993			//if (!UNCODE.isMobile) {
4994				requestTimeout(function() {
4995					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
4996					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
4997					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
4998						if (lastDelayElems == undefined) lastDelayElems = 0;
4999						if (lastDelayThumb == undefined) lastDelayThumb = 0;
5000						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
5001						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
5002						requestTimeout(function() {
5003							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
5004						}, maxDelay);
5005					}
5006				}, 500);
5007
5008			//}
5009		}
5010
5011		function navHover(el) {
5012			var $owlCont = el,
5013				$owlPrev = $owlCont.find('.owl-prev'),
5014				$owlNext = $owlCont.find('.owl-next'),
5015				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
5016				$owlPagination = $owlCont.next(),
5017				owlPrevW = $owlPrev.outerWidth(),
5018				owlNextW = $owlNext.outerWidth(),
5019				owlDotsH = $owlDots.innerHeight(),
5020				owlTime = 400,
5021				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5022			if ( $('body').hasClass('rtl') ) {
5023				$owlPrev.css("margin-right", -owlPrevW);
5024				$owlNext.css("margin-left", -owlNextW);
5025			} else {
5026				$owlPrev.css("margin-left", -owlPrevW);
5027				$owlNext.css("margin-right", -owlNextW);
5028			}
5029			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
5030			$owlCont.mouseenter(function() {
5031				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5032				$owlPrev.add($owlNext).css({
5033					marginLeft: 0,
5034					marginRight: 0
5035				});
5036				if (!owlNested) {
5037					$owlDots.css({
5038						opacity: 1,
5039						bottom: 0
5040					});
5041				}
5042			}).mouseleave(function() {
5043				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5044				if ( $('body').hasClass('rtl') ) {
5045					$owlPrev.css("margin-right", -owlPrevW);
5046					$owlNext.css("margin-left", -owlNextW);
5047				} else {
5048					$owlPrev.css("margin-left", -owlPrevW);
5049					$owlNext.css("margin-right", -owlNextW);
5050				}
5051				if (!owlNested) {
5052					$owlDots.css({
5053						opacity: 1,
5054						bottom: -owlDotsH
5055					});
5056				}
5057			});
5058		};
5059
5060		function animate_elems($this) {
5061			var lastDelay;
5062			$.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) {
5063				var element = $(val),
5064					delayAttr = element.attr('data-delay'),
5065					$first_item = element.closest('.owl-item[data-index="1"]');
5066
5067				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
5068					return false;
5069				}
5070
5071				if (delayAttr == undefined) delayAttr = 0;
5072				requestTimeout(function() {
5073					element.addClass('start_animation');
5074				}, delayAttr);
5075				lastDelay = delayAttr;
5076			});
5077			return lastDelay;
5078		}
5079
5080		function animate_thumb(items, event) {
5081			var lastDelay,
5082				itemIndex,
5083				thiis = $(event.currentTarget),
5084				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
5085				numActives = $('.owl-item.active', thiis).length,
5086				stagePadding = thiis.data('stagepadding');
5087
5088			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
5089
5090			thiis.data('tempIndex', event.item.index);
5091				$.each(items, function(index, val) {
5092					var parent = $(val).closest('.owl-item');
5093					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5094						return;
5095					}
5096					if (!$(val).hasClass('start_animation')) {
5097						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
5098							var thumbInView = new Waypoint.Inview({
5099							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5100							  element: val,
5101							  enter: function(direction) {
5102								var element = $(this.element),
5103										delayAttr = parseInt(element.attr('data-delay')),
5104										itemIndex = element.closest('.owl-item').index() + 1,
5105										menuIndex = parseFloat(element.closest('.owl-item').attr('data-index')),
5106										diffItem = Math.abs(itemIndex - tempIndex) - 1;
5107									if ( thiis.closest('.megamenu-block-wrapper').length ) {
5108										diffItem = menuIndex;
5109									} else {
5110										if (itemIndex > tempIndex) {
5111											thiis.data('tempIndex', itemIndex);
5112										}
5113									}
5114									if (isNaN(delayAttr)) delayAttr = 100;
5115									if (stagePadding) {
5116										var objTimeout = requestTimeout(function() {
5117											element.addClass('start_animation');
5118										}, index * delayAttr);
5119										lastDelay = index * delayAttr;
5120									} else {
5121										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
5122										var objTimeout = requestTimeout(function() {
5123											element.attr('data-test', diffItem + ' ' + delayAttr).addClass('start_animation');
5124										}, diffItem * delayAttr);
5125										lastDelay = diffItem * delayAttr;
5126									}
5127									parent.data('objTimeout', objTimeout);
5128									if (!UNCODE.isUnmodalOpen) {
5129										this.destroy();
5130									}
5131								}
5132							});
5133						}
5134					}
5135				});
5136				return lastDelay;
5137			}
5138
5139		function setItemsHeight(item) {
5140			$.each($('.owl-item', item), function(index, val) {
5141				var availableThumbHeight = $('.t-inside', $(val)).height(),
5142				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
5143				difference = availableThumbHeight - innerThumbHeight;
5144				if ($('.tmb-content-under', val).length) {
5145					var visualPart = $('.t-entry-visual', val);
5146					if (visualPart.length) {
5147						difference -= $('.t-entry-visual', val).height();
5148					}
5149				}
5150				if (! $('.tmb-content-lateral', val).length)
5151					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
5152			});
5153		}
5154
5155		function setItemsRelHeight(item) {
5156			$.each($('.owl-item', item), function(index, val) {
5157				var $rowContainer = $(item).parents('.row-parent').eq(0),
5158					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
5159					$colContainer = $(item).parents('.uncell').eq(0),
5160					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
5161					winHeight = UNCODE.wheight,
5162					multiplier_h = parseInt($(item).attr('data-vp-height')),
5163					data_viewport_h,
5164					consider_menu = $(item).data('vp-menu');
5165
5166				if ( consider_menu ) {
5167					winHeight = winHeight - UNCODE.menuHeight;
5168				}
5169
5170				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
5171				$('.t-inside', val).css( 'height', data_viewport_h );
5172			});
5173		}
5174
5175		function pauseOnHover(slider) {
5176			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
5177			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
5178				mouseenter: function () {
5179					$(slider).addClass('owl-mouseenter');
5180					$(slider).trigger('stop.owl.autoplay');
5181				},
5182				mouseleave: function () {
5183					$(slider).removeClass('owl-mouseenter');
5184					$(slider).trigger('play.owl.autoplay');
5185				}
5186			});
5187		}
5188	});
5189};
5190
5191UNCODE.owlPlayVideo = function(carousel) {
5192	var player, iframe;
5193	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
5194		var content = $(val).html();
5195		if (content == '') {
5196			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
5197			$(val).append(getCloned);
5198		}
5199		if ($(this).attr('data-provider') == 'vimeo') {
5200			iframe = $(this).find('iframe');
5201			player = new Vimeo.Player(iframe[0]);
5202			player.play();
5203		} else if ($(this).attr('data-provider') == 'youtube') {
5204			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
5205		} else {
5206			var player = $(this).find('video');
5207			if (player.length) {
5208				$(this).find('video')[0].volume = 0;
5209				$(this).find('video')[0].play();
5210				$(val).css('opacity', 1);
5211			}
5212		}
5213	});
5214};
5215
5216UNCODE.owlStopVideo = function(carousel) {
5217	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
5218		var player, iframe;
5219		if ($(this).attr('data-provider') == 'vimeo') {
5220			iframe = $(this).find('iframe');
5221			player = new Vimeo.Player(iframe[0]);
5222			player.pause();
5223		} else if ($(this).attr('data-provider') == 'youtube') {
5224			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
5225		} else {
5226			var player = $(this).find('video');
5227			if (player.length) {
5228				$(this).find('video')[0].volume = 0;
5229				$(this).find('video')[0].play();
5230			}
5231		}
5232	});
5233};
5234
5235UNCODE.animations = function() {
5236
5237	var runWaypoints_TO,
5238		runWaypoints_carousel_TO,
5239		runWaypoints_delay = 0,
5240	highlightComplexFunc = function($wrap, ev){
5241
5242		var $lines = $('.heading-line-wrap', $wrap),
5243			not_animate = false;
5244
5245		if ( $wrap.data('animate') === true ) {
5246			not_animate = true;
5247		}
5248
5249		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
5250		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
5251			return;
5252		}
5253
5254		$lines.each(function(_key, _value){
5255			var $line = $(_value),
5256				$inners = $('.split-word-inner', $line),
5257				$highlights = $('.heading-text-highlight-inner', $line);
5258
5259			var highlitInnerFunc = function(ev){
5260				var delay = 0;
5261				$highlights.each(function(h_key, high){
5262					var $highlight = $(high),
5263						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
5264						$nextSplit = $split.nextUntil(),
5265						$next = $('.heading-text-highlight-inner', $nextSplit),
5266						countCh = $split.text().length;
5267
5268					$highlight.css({
5269						'-webkit-transition-duration': (30 * countCh) + 'ms',
5270						'-moz-transition-duration': (30 * countCh) + 'ms',
5271						'-o-transition-duration': (30 * countCh) + 'ms',
5272						'transition-duration': (30 * countCh) + 'ms',
5273					});
5274
5275					delay += (30 * countCh);
5276
5277					$next.css({
5278						'-webkit-transition-delay': delay + 'ms',
5279						'-moz-transition-delay': delay + 'ms',
5280						'-o-transition-delay': delay + 'ms',
5281						'transition-delay': delay + 'ms',
5282					});
5283				});
5284				$highlights.removeAttr('data-animated');
5285				if ( _key+1 === $lines.length ) {
5286					$wrap.data('animate', true);
5287				}
5288			};
5289
5290			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
5291				if ( not_animate ) {
5292					$highlights.each(function(h_key, high){
5293						var $highlight = $(high);
5294						$highlight.css({
5295							'-webkit-transition-duration': '0ms',
5296							'-moz-transition-duration': '0ms',
5297							'-o-transition-duration': '0ms',
5298							'transition-duration': '0ms',
5299						});
5300					});
5301					$highlights.removeAttr('data-animated');
5302				} else {
5303					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
5304						highlitInnerFunc();
5305					} else {
5306						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
5307					}
5308				}
5309			}
5310		});
5311	};
5312
5313	$.each($('.header-content-inner'), function(index, val) {
5314		var element = $(val),
5315			transition = '';
5316		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
5317		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
5318		if (element.hasClass('left-t-right')) transition = 'left-t-right';
5319		if (element.hasClass('right-t-left')) transition = 'right-t-left';
5320		if (element.hasClass('zoom-in')) transition = 'zoom-in';
5321		if (element.hasClass('zoom-out')) transition = 'zoom-out';
5322		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
5323		if (element.hasClass('slight-anim')) transition = 'slight-anim';
5324		if (transition != '') {
5325			$(val).removeClass(transition);
5326			var container = element,
5327				containerDelay = container.attr('data-delay'),
5328				containerSpeed = container.attr('data-speed'),
5329				items = $('.header-title > *, .post-info', container);
5330			$.each(items, function(index, val) {
5331				var element = $(val),
5332					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
5333					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
5334				if (!element.hasClass('animate_when_almost_visible')) {
5335					delayAttr = Number(delayAttr) + (400 * index);
5336					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
5337					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
5338				}
5339			});
5340			container.css('opacity', 1);
5341		}
5342	});
5343
5344	function animate_css_grids_on_load() {
5345		$('.cssgrid-system').each(function() {
5346			var grid = $(this);
5347			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
5348			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
5349		});
5350	}
5351
5352	var delayAdd = 0;
5353
5354	window.waypoint_animation = function(ev) {
5355		$.each($('.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)'), function(index, val) {
5356			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 ) && !SiteParameters.is_frontend_editor ) ) {
5357				return true;
5358			}
5359			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5360				return;
5361			}
5362			var run = true,
5363				$carousel = $(val).closest('.owl-carousel'),
5364				marquee = $(val).closest('.tmb-linear').length;
5365			if ( $carousel.length ) {
5366				run = false;
5367			}
5368			if ( $(val).closest('.megamenu-block-wrapper').length ) {
5369				run = false;
5370			}
5371			if (run) {
5372				new Waypoint({
5373					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5374					element: val,
5375					handler: function() {
5376						var element = $(this.element),
5377							index = element.index(),
5378							delayAttr = element.attr('data-delay');
5379						if (delayAttr == undefined) delayAttr = 0;
5380						// delayAttr = parseFloat(delayAttr) + delayAdd;
5381						// if ( marquee ) {
5382						// 	delayAdd += 50;
5383						// } else {
5384						// 	delayAdd = 0;
5385						// }
5386						requestTimeout(function() {
5387							element.addClass('start_animation');
5388						}, delayAttr);
5389						if (!UNCODE.isUnmodalOpen) {
5390							this.destroy();
5391						}
5392					},
5393					offset: UNCODE.isFullPage ? '100%' : '90%'
5394				});
5395			}
5396		});
5397		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
5398			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5399				return;
5400			}
5401			var run = true,
5402				$carousel = $(val).closest('.owl-carousel');
5403			if ( $carousel.length ) {
5404				run = false;
5405			}
5406			if (run) {
5407				new Waypoint({
5408					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5409					element: val,
5410					handler: function() {
5411						var $element = $(this.element),
5412							$childs = $('.animate_when_parent_almost_visible', $element);
5413						$childs.each(function(key,el){
5414							var $child = $(el),
5415								delaySpeed = $child.attr('data-speed'),
5416								delayAttr = $child.attr('data-delay'),
5417								intervalAttr = $child.attr('data-interval');
5418							if (delayAttr == undefined) {
5419								delayAttr = 50*key;
5420							}
5421							requestTimeout(function() {
5422								$child.addClass('start_animation');
5423								if ( $child.hasClass('anim-line-checker') ) {
5424									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5425										var $line = $child.closest('.heading-line-wrap');
5426									});
5427								}
5428								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5429								highlightComplexFunc($wrapText, ev);
5430								if ( $child.hasClass('anim-tot-checker') ) {
5431									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5432										if ( $child.hasClass('anim-tot-checker') ) {
5433											$wrapText.addClass('already-animated');
5434											$element.trigger('already-animated');
5435										}
5436									});
5437								}
5438							}, delayAttr );
5439						});
5440						$element.addClass('start_animation');
5441						if (!UNCODE.isUnmodalOpen) {
5442							this.destroy();
5443						}
5444					},
5445					offset: UNCODE.isFullPage ? '100%' : '90%'
5446				});
5447			}
5448		});
5449	}
5450	window.waypoint_carousel_animation = function(ev) {
5451		$.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) {
5452			if ( $(val).hasClass('el-text-split') ) {
5453				return true;
5454			}
5455			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5456				return;
5457			}
5458			var run = true,
5459				$carousel = $(val).closest('.owl-carousel'),
5460				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5461				$all_first = $('.owl-item[data-index="1"]', $carousel);
5462			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5463				run = false;
5464			}
5465			if (run) {
5466				new Waypoint({
5467					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5468					element: val,
5469					handler: function() {
5470						var element = $(this.element),
5471							index = element.index(),
5472							delayAttr = element.attr('data-delay');
5473						if (delayAttr == undefined) delayAttr = 0;
5474						requestTimeout(function() {
5475							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5476								$all_first.attr('data-already-reached', 'true');
5477							}
5478							element.addClass('start_animation');
5479						}, delayAttr);
5480						if (!UNCODE.isUnmodalOpen) {
5481							this.destroy();
5482						}
5483					},
5484					offset: UNCODE.isFullPage ? '100%' : '90%'
5485				});
5486			}
5487		});
5488		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
5489			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5490				return;
5491			}
5492			var run = true,
5493				$carousel = $(val).closest('.owl-carousel'),
5494				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5495				$all_first = $('.owl-item[data-index="1"]', $carousel);
5496			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5497				run = false;
5498			}
5499			if (run) {
5500				new Waypoint({
5501					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5502					element: val,
5503					handler: function() {
5504						var $element = $(this.element),
5505							$childs = $('.animate_when_parent_almost_visible', $element);
5506						$childs.each(function(key,el){
5507							var $child = $(el),
5508								delaySpeed = $child.attr('data-speed'),
5509								delayAttr = $child.attr('data-delay'),
5510								intervalAttr = $child.attr('data-interval');
5511							if (delayAttr == undefined) {
5512								delayAttr = 50*key;
5513							}
5514							requestTimeout(function() {
5515								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5516									$all_first.attr('data-already-reached', 'true');
5517								}
5518								$child.addClass('start_animation');
5519								if ( $child.hasClass('anim-line-checker') ) {
5520									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5521										var $line = $child.closest('.heading-line-wrap');
5522									});
5523								}
5524								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5525								highlightComplexFunc($wrapText, ev);
5526								if ( $child.hasClass('anim-tot-checker') ) {
5527									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5528										if ( $child.hasClass('anim-tot-checker') ) {
5529											$wrapText.addClass('already-animated');
5530										}
5531									});
5532								}
5533							}, delayAttr );
5534						});
5535						$element.addClass('start_animation');
5536						if (!UNCODE.isUnmodalOpen) {
5537							this.destroy();
5538						}
5539					},
5540					offset: UNCODE.isFullPage ? '100%' : '90%'
5541				});
5542			}
5543		});
5544	}
5545
5546	var runWaypoints = function(ev){
5547		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5548			runWaypoints_delay = 400;
5549		}
5550		clearRequestTimeout(runWaypoints_TO);
5551		runWaypoints_TO = requestTimeout(function() {
5552			window.waypoint_animation(ev);
5553		}, runWaypoints_delay);
5554
5555		clearRequestTimeout(runWaypoints_carousel_TO);
5556		runWaypoints_carousel_TO = requestTimeout(function() {
5557			window.waypoint_carousel_animation(ev);
5558		}, 400);
5559	};
5560	runWaypoints();
5561	animate_css_grids_on_load();
5562
5563	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5564		runWaypoints(ev);
5565	});
5566	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5567		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5568		window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints );
5569	}
5570};
5571
5572UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5573	var $allItems = elements.length - startIndex,
5574		showed = 0,
5575		index = 0,
5576		use_index = false
5577		;
5578
5579	if (filtering) {
5580		if (sequential) {
5581			use_index = true;
5582		}
5583		sequential = false;
5584	}
5585
5586	$.each(elements, function(index, val) {
5587		var $this = $(val),
5588			elInner = $('> .t-inside', val);
5589
5590		if ( ( UNCODE.isUnmodalOpen && !val.closest('#unmodal-content') ) || $(val).closest('.un-submenu').length || $(val).closest('uncode-mobile-menu-block').length ) {
5591			return;
5592		}
5593		if (val[0]) val = val[0];
5594
5595		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5596			new Waypoint({
5597				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5598				element: val,
5599				handler: function() {
5600					var element = $('> .t-inside', this.element),
5601						parent = $(this.element);
5602					var _index = use_index? index : 0;
5603
5604					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5605						delayAttr = parseInt(element.attr('data-delay'));
5606					if (isNaN(delayAttr)) delayAttr = 100;
5607					if (sequential || use_index) {
5608						delay -= showed;
5609					}
5610					var objTimeout = requestTimeout(function() {
5611						element.removeClass('zoom-reverse').addClass('start_animation');
5612						showed = index;
5613					}, delay * delayAttr);
5614					parent.data('objTimeout', objTimeout);
5615					if (!UNCODE.isUnmodalOpen) {
5616						this.destroy();
5617					}
5618				},
5619				offset: UNCODE.isFullPage ? '100%' : '90%'
5620			});
5621		}
5622
5623		index++;
5624	});
5625};
5626
5627UNCODE.tapHover = function() {
5628
5629	var isTouch = (
5630		'ontouchstart' in window ||
5631		navigator.maxTouchPoints > 0 ||
5632		navigator.msMaxTouchPoints > 0
5633	);
5634
5635	if (isTouch) {
5636		var $el = $('.tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), 
5637			elClass = "hover";
5638
5639		$(window).on('click', function() {
5640			$el.removeClass(elClass);
5641		});
5642
5643		$el.on('click', function(e) {
5644			e.stopPropagation();
5645			var link = $(this);
5646			if ( ! link.hasClass(elClass)) {
5647				e.preventDefault();
5648				link.addClass("hover");
5649				$el.not(this).removeClass(elClass);
5650				return false;
5651			}
5652		});
5653	}
5654};
5655
5656UNCODE.onePage = function(isMobile) {
5657	var current = 0,
5658		last = 0,
5659		lastScrollTop = 0,
5660		forceScroll = false,
5661		lastScrolled = 0,
5662		isSectionscroller = ($('.main-onepage').length) ? true : false,
5663		isOnePage = false,
5664		getOffset = function () {
5665			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);
5666			return calculateOffset;
5667		}
5668
5669	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5670
5671	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5672	// 	return false;
5673
5674	function init_onepage() {
5675		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5676			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5677		}
5678		last = $('.onepage-pagination li').last().find('a').data('index');
5679		$.each($('div[data-parent="true"]'), function(index, val) {
5680			$(this).attr('data-section', index);
5681			if (isMobile) return;
5682			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5683				return;
5684			}
5685			var sectionDown = new Waypoint({
5686				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5687				element: val,
5688				handler: function(direction) {
5689					if (direction == 'down') {
5690						changeMenuActive(this.element, index);
5691					}
5692				},
5693				offset: function() {
5694					return 5 + getOffset()
5695				}
5696			});
5697			var sectionUp = new Waypoint({
5698				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5699				element: val,
5700				handler: function(direction) {
5701					if (direction == 'up') {
5702						changeMenuActive(this.element, index);
5703					}
5704				},
5705				offset: function() {
5706					return -5 - getOffset()
5707				}
5708			});
5709
5710			if (isSectionscroller) {
5711				var label;
5712				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5713				else label = '';
5714				var getName = $(this).attr('data-name');
5715				if (getName == undefined) getName = index;
5716				if (label != '') {
5717					isOnePage = true;
5718					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5719					$('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>");
5720				}
5721			}
5722		});
5723
5724		if (isSectionscroller) {
5725			$.each($('ul.onepage-pagination li'), function(index, val) {
5726				var $this = $(val),
5727					$a = ('a', $this);
5728				$a.on('click', function(evt) {
5729					if ( $('.is-selected', $this).length || UNCODE.scrolling ) {
5730						return false;
5731					}
5732					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5733						evt.preventDefault();
5734					}
5735					Waypoint.refreshAll();
5736					var el = $('a', evt.currentTarget);
5737					current = lastScrolled = parseInt(el.attr('data-index'));
5738					lastScrolled += 1;
5739					scrollBody(current);
5740				});
5741			});
5742		}
5743
5744		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5745		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5746			goToSection = String(window.location.hash).replace(/^#/, "");
5747			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5748		}
5749
5750		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5751			current = lastScrolled = goToSection;
5752			$(window).on('load', function(){
5753				if ( $('.owl-carousel').length ) {
5754					requestTimeout(function(){
5755						scrollBody(goToSection);
5756					}, 400);
5757				} else {
5758					scrollBody(goToSection);
5759				}
5760			});
5761		}
5762
5763	}
5764
5765	function changeMenuActive(section, index) {
5766		current = lastScrolled = parseInt($(section).attr('data-section'));
5767		if (isOnePage) {
5768			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5769			if (newSection.length) {
5770				$('ul.onepage-pagination li a').removeClass('is-selected');
5771				newSection.addClass('is-selected');
5772			}
5773			var getName = $('[data-section="' + index + '"]').attr('data-name');
5774			if (getName != undefined && getName !== '') {
5775				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5776					var get_href = $(val).attr('href');
5777					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5778						$(val).closest('.menu-smart').find('.active').removeClass('active');
5779						$(val).parent().addClass('active');
5780					}
5781				});
5782			}
5783		}
5784	}
5785
5786	if (isOnePage) {
5787		$(window).on('scroll', function() {
5788			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5789			if (bodyTop == 0) {
5790				$('ul.onepage-pagination li a').removeClass('is-selected');
5791				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5792				var getName = $('[data-section=0]').attr('data-name');
5793				if (getName != undefined && getName !== '') {
5794					$.each($('.menu-container .menu-item > a'), function(i, val) {
5795						var get_href = $(val).attr('href');
5796						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5797							$(val).closest('ul').find('.active').removeClass('active');
5798							$(val).parent().addClass('active');
5799						}
5800					});
5801				}
5802			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5803				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5804				if (lastSection.length) {
5805					$('ul.onepage-pagination li a').removeClass('is-selected');
5806					lastSection.addClass('is-selected');
5807				}
5808			}
5809		});
5810	}
5811
5812	var scrollBody = function(index) {
5813		$('ul.onepage-pagination li a').removeClass('is-selected');
5814		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5815
5816		var getSection = $('[data-section=' + index + ']'),
5817			scrollTo;
5818
5819		if (getSection == undefined) return;
5820
5821		var body = $("html, body"),
5822			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5823			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5824			getOffset = UNCODE.get_scroll_offset(index);
5825		if ( typeof getSection.offset() === 'undefined' )
5826			return;
5827		scrollTo = getSection.offset().top;
5828
5829		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5830		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5831			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5832			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5833				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5834			}
5835
5836			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5837				if ( index === 0 ) {
5838					scrollTo = 0;
5839				} else {
5840					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5841				}
5842			} else {
5843				scrollTo -= getOffset;
5844			}
5845		}
5846
5847		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5848		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5849
5850		if (index != 0) {
5851			UNCODE.scrolling = true;
5852		}
5853
5854		if (scrollSpeed == 0) {
5855			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5856			UNCODE.scrolling = false;
5857		} else {
5858			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5859				$(this).stop();
5860			}).animate({
5861				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5862			}, scrollSpeed, 'easeInOutCubic', function() {
5863				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5864				UNCODE.scrolling = false;
5865				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5866				||
5867				$('.menu-hided').length ) {
5868					scrollTo = getSection.offset().top;
5869					getOffset = UNCODE.get_scroll_offset(index);
5870					scrollTo -= getOffset;
5871					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5872						$(this).stop();
5873					}).animate({
5874						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5875						}, scrollSpeed, 'easeInOutCubic', function() {
5876							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5877							UNCODE.scrolling = false;
5878						}
5879					);
5880				}
5881			});
5882		}
5883
5884	};
5885
5886	init_onepage();
5887};
5888
5889UNCODE.stickyElements = function() {
5890	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5891	if (!isMobile_wide ) {
5892
5893		var $pageHeader = $('#page-header'),
5894			$headerRow = $('.vc_row', $pageHeader),
5895			$headerSection = $headerRow.closest('section[data-parent]'),
5896			startSticky = false;
5897
5898		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
5899			$headerRow.removeClass('sticky-element');
5900			$pageHeader.addClass('sticky-element');
5901			startSticky = true;
5902		}
5903
5904		var calculateOffset = function(el) {
5905			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5906				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5907				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5908				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5909
5910			sideOffset += UNCODE.bodyBorder;
5911
5912			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5913			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5914				if ($('.menu-shrink').length) {
5915					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5916				} else {
5917					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5918				}
5919			}
5920
5921			return sideOffset;
5922
5923		},
5924
5925		initStickyElement = function($els) {
5926			if ( $('body').hasClass('vc-safe-mode') ) {
5927				return true;
5928			}
5929			if ( typeof $els === 'undefined' ) {
5930				$els = $('.sticky-element');
5931			}
5932			$.each($els, function(index, element) {
5933				if ($(element).closest('.tab-pane').length) {
5934					var $paneParent = $(element).closest('.tab-pane');
5935					if ( !$paneParent.hasClass('active') ) {
5936						return true;
5937					}
5938				}
5939				$(element).stick_in_parent({
5940					sticky_class: 'is_stucked',
5941					offset_top: calculateOffset(element),
5942					bottoming: true,
5943					inner_scrolling: SiteParameters.sticky_elements === 'on'
5944				});
5945			});
5946		};
5947
5948		var oldW = UNCODE.wwidth,
5949			oldH = UNCODE.wHeight;
5950
5951		requestTimeout(function() {
5952			if ($('.sticky-element').length) {
5953
5954				if ($(window).width() > UNCODE.mediaQuery) {
5955					initStickyElement();
5956
5957					if ( startSticky === true ) {
5958						$('#page-header').trigger('sticky_kit:recalc');
5959					}
5960				}
5961
5962				$(window).on('resize lateral_resize', function(event) {
5963					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
5964						$(".sticky-element").trigger("sticky_kit:detach");
5965						if ($(window).width() > UNCODE.mediaQuery) {
5966							initStickyElement();
5967						}
5968						oldW = UNCODE.wwidth;
5969						oldH = UNCODE.wHeight;
5970					}
5971				});
5972			}
5973		}, 1000);
5974
5975		if ($('.sticky-element').length) {
5976			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
5977				requestTimeout(function() {
5978					$(document.body).trigger("sticky_kit:recalc");
5979				}, 100);
5980			});
5981		}
5982
5983		var $panels = $('.panel-collapse');
5984		if ( $panels.length ) {
5985			$panels.each(function(){
5986				var $panel = $(this);
5987				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
5988					$(document.body).trigger("sticky_kit:recalc");
5989				});
5990			});
5991		}
5992
5993		$('.nav-tabs a').on('shown.bs.tab', function(e){
5994			var $tabs = $(e.target).closest('.tab-container'),
5995				$panel = $('.tab-pane.active', $tabs),
5996				$els = $(e.target).nextAll(".sticky-element");
5997
5998			$els.trigger("sticky_kit:detach");
5999			initStickyElement($els);
6000		});
6001
6002		$(window).on('vc-safe-mode-on', function(){
6003			$(".sticky-element").trigger("sticky_kit:detach");
6004		});
6005
6006		$(window).on('vc-safe-mode-off', function(){
6007			initStickyElement();
6008		});
6009	}
6010};
6011
6012UNCODE.twentytwenty = function() {
6013
6014  if (!$('.twentytwenty-container').length) return;
6015
6016// DOM.event.move
6017//
6018// 2.0.0
6019//
6020// Stephen Band
6021//
6022// Triggers 'movestart', 'move' and 'moveend' events after
6023// mousemoves following a mousedown cross a distance threshold,
6024// similar to the native 'dragstart', 'drag' and 'dragend' events.
6025// Move events are throttled to animation frames. Move event objects
6026// have the properties:
6027//
6028// pageX:
6029// pageY:     Page coordinates of pointer.
6030// startX:
6031// startY:    Page coordinates of pointer at movestart.
6032// distX:
6033// distY:     Distance the pointer has moved since movestart.
6034// deltaX:
6035// deltaY:    Distance the finger has moved since last event.
6036// velocityX:
6037// velocityY: Average velocity over last few events.
6038
6039
6040(function(fn) {
6041	if (typeof define === 'function' && define.amd) {
6042        define([], fn);
6043    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
6044        module.exports = fn;
6045	} else {
6046		fn();
6047	}
6048})(function(){
6049	var assign = Object.assign || window.jQuery && jQuery.extend;
6050
6051	// Number of pixels a pressed pointer travels before movestart
6052	// event is fired.
6053	var threshold = 8;
6054
6055	// Shim for requestAnimationFrame, falling back to timer. See:
6056	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
6057	var requestFrame = (function(){
6058		return (
6059			window.requestAnimationFrame ||
6060			window.webkitRequestAnimationFrame ||
6061			window.mozRequestAnimationFrame ||
6062			window.oRequestAnimationFrame ||
6063			window.msRequestAnimationFrame ||
6064			function(fn, element){
6065				return window.setTimeout(function(){
6066					fn();
6067				}, 25);
6068			}
6069		);
6070	})();
6071
6072	// Shim for customEvent
6073	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
6074	(function () {
6075		if ( typeof window.CustomEvent === "function" ) return false;
6076		function CustomEvent ( event, params ) {
6077			params = params || { bubbles: false, cancelable: false, detail: undefined };
6078			var evt = document.createEvent( 'CustomEvent' );
6079			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
6080			return evt;
6081		}
6082
6083		CustomEvent.prototype = window.Event.prototype;
6084		window.CustomEvent = CustomEvent;
6085	})();
6086
6087	var ignoreTags = {
6088			textarea: true,
6089			input: true,
6090			select: true,
6091			button: true
6092		};
6093
6094	var mouseevents = {
6095		move:   'mousemove',
6096		cancel: 'mouseup dragstart',
6097		end:    'mouseup'
6098	};
6099
6100	var touchevents = {
6101		move:   'touchmove',
6102		cancel: 'touchend',
6103		end:    'touchend'
6104	};
6105
6106	var rspaces = /\s+/;
6107
6108
6109	// DOM Events
6110
6111	var eventOptions = { bubbles: true, cancelable: true };
6112
6113	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
6114
6115	function createEvent(type) {
6116		return new CustomEvent(type, eventOptions);
6117	}
6118
6119	function getEvents(node) {
6120		return node[eventsSymbol] || (node[eventsSymbol] = {});
6121	}
6122
6123	function on(node, types, fn, data, selector) {
6124		types = types.split(rspaces);
6125
6126		var events = getEvents(node);
6127		var i = types.length;
6128		var handlers, type;
6129
6130		function handler(e) { fn(e, data); }
6131
6132		while (i--) {
6133			type = types[i];
6134			handlers = events[type] || (events[type] = []);
6135			handlers.push([fn, handler]);
6136			node.addEventListener(type, handler);
6137		}
6138	}
6139
6140	function off(node, types, fn, selector) {
6141		types = types.split(rspaces);
6142
6143		var events = getEvents(node);
6144		var i = types.length;
6145		var type, handlers, k;
6146
6147		if (!events) { return; }
6148
6149		while (i--) {
6150			type = types[i];
6151			handlers = events[type];
6152			if (!handlers) { continue; }
6153			k = handlers.length;
6154			while (k--) {
6155				if (handlers[k][0] === fn) {
6156					node.removeEventListener(type, handlers[k][1]);
6157					handlers.splice(k, 1);
6158				}
6159			}
6160		}
6161	}
6162
6163	function trigger(node, type, properties) {
6164		// Don't cache events. It prevents you from triggering an event of a
6165		// given type from inside the handler of another event of that type.
6166		var event = createEvent(type);
6167		if (properties) { assign(event, properties); }
6168		node.dispatchEvent(event);
6169	}
6170
6171
6172	// Constructors
6173
6174	function Timer(fn){
6175		var callback = fn,
6176		    active = false,
6177		    running = false;
6178
6179		function trigger(time) {
6180			if (active){
6181				callback();
6182				requestFrame(trigger);
6183				running = true;
6184				active = false;
6185			}
6186			else {
6187				running = false;
6188			}
6189		}
6190
6191		this.kick = function(fn) {
6192			active = true;
6193			if (!running) { trigger(); }
6194		};
6195
6196		this.end = function(fn) {
6197			var cb = callback;
6198
6199			if (!fn) { return; }
6200
6201			// If the timer is not running, simply call the end callback.
6202			if (!running) {
6203				fn();
6204			}
6205			// If the timer is running, and has been kicked lately, then
6206			// queue up the current callback and the end callback, otherwise
6207			// just the end callback.
6208			else {
6209				callback = active ?
6210					function(){ cb(); fn(); } :
6211					fn ;
6212
6213				active = true;
6214			}
6215		};
6216	}
6217
6218
6219	// Functions
6220
6221	function noop() {}
6222
6223	function preventDefault(e) {
6224		e.preventDefault();
6225	}
6226
6227	function isIgnoreTag(e) {
6228		return !!ignoreTags[e.target.tagName.toLowerCase()];
6229	}
6230
6231	function isPrimaryButton(e) {
6232		// Ignore mousedowns on any button other than the left (or primary)
6233		// mouse button, or when a modifier key is pressed.
6234		return (e.which === 1 && !e.ctrlKey && !e.altKey);
6235	}
6236
6237	function identifiedTouch(touchList, id) {
6238		var i, l;
6239
6240		if (touchList.identifiedTouch) {
6241			return touchList.identifiedTouch(id);
6242		}
6243
6244		// touchList.identifiedTouch() does not exist in
6245		// webkit yet… we must do the search ourselves...
6246
6247		i = -1;
6248		l = touchList.length;
6249
6250		while (++i < l) {
6251			if (touchList[i].identifier === id) {
6252				return touchList[i];
6253			}
6254		}
6255	}
6256
6257	function changedTouch(e, data) {
6258		var touch = identifiedTouch(e.changedTouches, data.identifier);
6259
6260		// This isn't the touch you're looking for.
6261		if (!touch) { return; }
6262
6263		// Chrome Android (at least) includes touches that have not
6264		// changed in e.changedTouches. That's a bit annoying. Check
6265		// that this touch has changed.
6266		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
6267
6268		return touch;
6269	}
6270
6271
6272	// Handlers that decide when the first movestart is triggered
6273
6274	function mousedown(e){
6275		// Ignore non-primary buttons
6276		if (!isPrimaryButton(e)) { return; }
6277
6278		// Ignore form and interactive elements
6279		if (isIgnoreTag(e)) { return; }
6280
6281		on(document, mouseevents.move, mousemove, e);
6282		on(document, mouseevents.cancel, mouseend, e);
6283	}
6284
6285	function mousemove(e, data){
6286		checkThreshold(e, data, e, removeMouse);
6287	}
6288
6289	function mouseend(e, data) {
6290		removeMouse();
6291	}
6292
6293	function removeMouse() {
6294		off(document, mouseevents.move, mousemove);
6295		off(document, mouseevents.cancel, mouseend);
6296	}
6297
6298	function touchstart(e) {
6299		// Don't get in the way of interaction with form elements
6300		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
6301
6302		var touch = e.changedTouches[0];
6303
6304		// iOS live updates the touch objects whereas Android gives us copies.
6305		// That means we can't trust the touchstart object to stay the same,
6306		// so we must copy the data. This object acts as a template for
6307		// movestart, move and moveend event objects.
6308		var data = {
6309			target:     touch.target,
6310			pageX:      touch.pageX,
6311			pageY:      touch.pageY,
6312			identifier: touch.identifier,
6313
6314			// The only way to make handlers individually unbindable is by
6315			// making them unique.
6316			touchmove:  function(e, data) { touchmove(e, data); },
6317			touchend:   function(e, data) { touchend(e, data); }
6318		};
6319
6320		on(document, touchevents.move, data.touchmove, data);
6321		on(document, touchevents.cancel, data.touchend, data);
6322	}
6323
6324	function touchmove(e, data) {
6325		var touch = changedTouch(e, data);
6326		if (!touch) { return; }
6327		checkThreshold(e, data, touch, removeTouch);
6328	}
6329
6330	function touchend(e, data) {
6331		var touch = identifiedTouch(e.changedTouches, data.identifier);
6332		if (!touch) { return; }
6333		removeTouch(data);
6334	}
6335
6336	function removeTouch(data) {
6337		off(document, touchevents.move, data.touchmove);
6338		off(document, touchevents.cancel, data.touchend);
6339	}
6340
6341	function checkThreshold(e, data, touch, fn) {
6342		var distX = touch.pageX - data.pageX;
6343		var distY = touch.pageY - data.pageY;
6344
6345		// Do nothing if the threshold has not been crossed.
6346		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
6347
6348		triggerStart(e, data, touch, distX, distY, fn);
6349	}
6350
6351	function triggerStart(e, data, touch, distX, distY, fn) {
6352		var touches = e.targetTouches;
6353		var time = e.timeStamp - data.timeStamp;
6354
6355		// Create a movestart object with some special properties that
6356		// are passed only to the movestart handlers.
6357		var template = {
6358			altKey:     e.altKey,
6359			ctrlKey:    e.ctrlKey,
6360			shiftKey:   e.shiftKey,
6361			startX:     data.pageX,
6362			startY:     data.pageY,
6363			distX:      distX,
6364			distY:      distY,
6365			deltaX:     distX,
6366			deltaY:     distY,
6367			pageX:      touch.pageX,
6368			pageY:      touch.pageY,
6369			velocityX:  distX / time,
6370			velocityY:  distY / time,
6371			identifier: data.identifier,
6372			targetTouches: touches,
6373			finger: touches ? touches.length : 1,
6374			enableMove: function() {
6375				this.moveEnabled = true;
6376				this.enableMove = noop;
6377				e.preventDefault();
6378			}
6379		};
6380
6381		// Trigger the movestart event.
6382		trigger(data.target, 'movestart', template);
6383
6384		// Unbind handlers that tracked the touch or mouse up till now.
6385		fn(data);
6386	}
6387
6388
6389	// Handlers that control what happens following a movestart
6390
6391	function activeMousemove(e, data) {
6392		var timer  = data.timer;
6393
6394		data.touch = e;
6395		data.timeStamp = e.timeStamp;
6396		timer.kick();
6397	}
6398
6399	function activeMouseend(e, data) {
6400		var target = data.target;
6401		var event  = data.event;
6402		var timer  = data.timer;
6403
6404		removeActiveMouse();
6405
6406		endEvent(target, event, timer, function() {
6407			// Unbind the click suppressor, waiting until after mouseup
6408			// has been handled.
6409			setTimeout(function(){
6410				off(target, 'click', preventDefault);
6411			}, 0);
6412		});
6413	}
6414
6415	function removeActiveMouse() {
6416		off(document, mouseevents.move, activeMousemove);
6417		off(document, mouseevents.end, activeMouseend);
6418	}
6419
6420	function activeTouchmove(e, data) {
6421		var event = data.event;
6422		var timer = data.timer;
6423		var touch = changedTouch(e, event);
6424
6425		if (!touch) { return; }
6426
6427		// Stop the interface from gesturing
6428		e.preventDefault();
6429
6430		event.targetTouches = e.targetTouches;
6431		data.touch = touch;
6432		data.timeStamp = e.timeStamp;
6433
6434		timer.kick();
6435	}
6436
6437	function activeTouchend(e, data) {
6438		var target = data.target;
6439		var event  = data.event;
6440		var timer  = data.timer;
6441		var touch  = identifiedTouch(e.changedTouches, event.identifier);
6442
6443		// This isn't the touch you're looking for.
6444		if (!touch) { return; }
6445
6446		removeActiveTouch(data);
6447		endEvent(target, event, timer);
6448	}
6449
6450	function removeActiveTouch(data) {
6451		off(document, touchevents.move, data.activeTouchmove);
6452		off(document, touchevents.end, data.activeTouchend);
6453	}
6454
6455
6456	// Logic for triggering move and moveend events
6457
6458	function updateEvent(event, touch, timeStamp) {
6459		var time = timeStamp - event.timeStamp;
6460
6461		event.distX =  touch.pageX - event.startX;
6462		event.distY =  touch.pageY - event.startY;
6463		event.deltaX = touch.pageX - event.pageX;
6464		event.deltaY = touch.pageY - event.pageY;
6465
6466		// Average the velocity of the last few events using a decay
6467		// curve to even out spurious jumps in values.
6468		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
6469		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
6470		event.pageX =  touch.pageX;
6471		event.pageY =  touch.pageY;
6472	}
6473
6474	function endEvent(target, event, timer, fn) {
6475		timer.end(function(){
6476			trigger(target, 'moveend', event);
6477			return fn && fn();
6478		});
6479	}
6480
6481
6482	// Set up the DOM
6483
6484	function movestart(e) {
6485		if (e.defaultPrevented) { return; }
6486		if (!e.moveEnabled) { return; }
6487
6488		var event = {
6489			startX:        e.startX,
6490			startY:        e.startY,
6491			pageX:         e.pageX,
6492			pageY:         e.pageY,
6493			distX:         e.distX,
6494			distY:         e.distY,
6495			deltaX:        e.deltaX,
6496			deltaY:        e.deltaY,
6497			velocityX:     e.velocityX,
6498			velocityY:     e.velocityY,
6499			identifier:    e.identifier,
6500			targetTouches: e.targetTouches,
6501			finger:        e.finger
6502		};
6503
6504		var data = {
6505			target:    e.target,
6506			event:     event,
6507			timer:     new Timer(update),
6508			touch:     undefined,
6509			timeStamp: e.timeStamp
6510		};
6511
6512		function update(time) {
6513			updateEvent(event, data.touch, data.timeStamp);
6514			trigger(data.target, 'move', event);
6515		}
6516
6517		if (e.identifier === undefined) {
6518			// We're dealing with a mouse event.
6519			// Stop clicks from propagating during a move
6520			on(e.target, 'click', preventDefault);
6521			on(document, mouseevents.move, activeMousemove, data);
6522			on(document, mouseevents.end, activeMouseend, data);
6523		}
6524		else {
6525			// In order to unbind correct handlers they have to be unique
6526			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6527			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6528
6529			// We're dealing with a touch.
6530			on(document, touchevents.move, data.activeTouchmove, data);
6531			on(document, touchevents.end, data.activeTouchend, data);
6532		}
6533	}
6534
6535	on(document, 'mousedown', mousedown);
6536	on(document, 'touchstart', touchstart);
6537	on(document, 'movestart', movestart);
6538
6539
6540	// jQuery special events
6541	//
6542	// jQuery event objects are copies of DOM event objects. They need
6543	// a little help copying the move properties across.
6544
6545	if (!window.jQuery) { return; }
6546
6547	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6548
6549	function enableMove1(e) { e.enableMove(); }
6550	function enableMove2(e) { e.enableMove(); }
6551	function enableMove3(e) { e.enableMove(); }
6552
6553	function add(handleObj) {
6554		var handler = handleObj.handler;
6555
6556		handleObj.handler = function(e) {
6557			// Copy move properties across from originalEvent
6558			var i = properties.length;
6559			var property;
6560
6561			while(i--) {
6562				property = properties[i];
6563				e[property] = e.originalEvent[property];
6564			}
6565
6566			handler.apply(this, arguments);
6567		};
6568	}
6569
6570	jQuery.event.special.movestart = {
6571		setup: function() {
6572			// Movestart must be enabled to allow other move events
6573			on(this, 'movestart', enableMove1);
6574
6575			// Do listen to DOM events
6576			return false;
6577		},
6578
6579		teardown: function() {
6580			off(this, 'movestart', enableMove1);
6581			return false;
6582		},
6583
6584		add: add
6585	};
6586
6587	jQuery.event.special.move = {
6588		setup: function() {
6589			on(this, 'movestart', enableMove2);
6590			return false;
6591		},
6592
6593		teardown: function() {
6594			off(this, 'movestart', enableMove2);
6595			return false;
6596		},
6597
6598		add: add
6599	};
6600
6601	jQuery.event.special.moveend = {
6602		setup: function() {
6603			on(this, 'movestart', enableMove3);
6604			return false;
6605		},
6606
6607		teardown: function() {
6608			off(this, 'movestart', enableMove3);
6609			return false;
6610		},
6611
6612		add: add
6613	};
6614});
6615
6616  $.fn.twentytwenty = function(options) {
6617    var options = $.extend({
6618      default_offset_pct: 0.5,
6619      orientation: 'horizontal',
6620      before_label: 'Before',
6621      after_label: 'After',
6622      no_overlay: false,
6623      move_slider_on_hover: false,
6624      move_with_handle_only: true,
6625      click_to_move: false
6626    }, options);
6627
6628    return this.each(function() {
6629
6630      var sliderPct = options.default_offset_pct;
6631      var container = $(this);
6632      var sliderOrientation = options.orientation;
6633      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6634      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6635
6636
6637      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6638      if(!options.no_overlay) {
6639        container.append("<div class='twentytwenty-overlay'></div>");
6640        var overlay = container.find(".twentytwenty-overlay");
6641        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6642        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6643      }
6644      var beforeImg = container.find("img:first");
6645      var afterImg = container.find("img:last");
6646      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6647      var slider = container.find(".twentytwenty-handle");
6648      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6649      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6650      container.addClass("twentytwenty-container");
6651      beforeImg.addClass("twentytwenty-before");
6652      afterImg.addClass("twentytwenty-after");
6653
6654      var calcOffset = function(dimensionPct) {
6655        var w = beforeImg.width();
6656        var h = beforeImg.height();
6657        return {
6658          w: w+"px",
6659          h: h+"px",
6660          cw: (dimensionPct*w)+"px",
6661          ch: (dimensionPct*h)+"px"
6662        };
6663      };
6664
6665      var adjustContainer = function(offset) {
6666      	if (sliderOrientation === 'vertical') {
6667          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6668          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6669      	}
6670      	else {
6671          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6672          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6673    	}
6674        container.css("height", offset.h);
6675      };
6676
6677      var adjustSlider = function(pct) {
6678        var offset = calcOffset(pct);
6679        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6680        adjustContainer(offset);
6681      };
6682
6683      // Return the number specified or the min/max number if it outside the range given.
6684      var minMaxNumber = function(num, min, max) {
6685        return Math.max(min, Math.min(max, num));
6686      };
6687
6688      // Calculate the slider percentage based on the position.
6689      var getSliderPercentage = function(positionX, positionY) {
6690        var sliderPercentage = (sliderOrientation === 'vertical') ?
6691          (positionY-offsetY)/imgHeight :
6692          (positionX-offsetX)/imgWidth;
6693
6694        return minMaxNumber(sliderPercentage, 0, 1);
6695      };
6696
6697
6698      $(window).on("resize.twentytwenty", function(e) {
6699        adjustSlider(sliderPct);
6700      });
6701
6702      var offsetX = 0;
6703      var offsetY = 0;
6704      var imgWidth = 0;
6705      var imgHeight = 0;
6706      var onMoveStart = function(e) {
6707        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6708          e.preventDefault();
6709        }
6710        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6711          e.preventDefault();
6712        }
6713        container.addClass("active");
6714        offsetX = container.offset().left;
6715        offsetY = container.offset().top;
6716        imgWidth = beforeImg.width();
6717        imgHeight = beforeImg.height();
6718      };
6719      var onMove = function(e) {
6720        if (container.hasClass("active")) {
6721          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6722          adjustSlider(sliderPct);
6723        }
6724      };
6725      var onMoveEnd = function() {
6726          container.removeClass("active");
6727      };
6728
6729      var moveTarget = options.move_with_handle_only ? slider : container;
6730      moveTarget.on("movestart",onMoveStart);
6731      moveTarget.on("move",onMove);
6732      moveTarget.on("moveend",onMoveEnd);
6733
6734      if (options.move_slider_on_hover) {
6735        container.on("mouseenter", onMoveStart);
6736        container.on("mousemove", onMove);
6737        container.on("mouseleave", onMoveEnd);
6738      }
6739
6740      slider.on("touchmove", function(e) {
6741        e.preventDefault();
6742      });
6743
6744      container.find("img").on("mousedown", function(event) {
6745        event.preventDefault();
6746      });
6747
6748      if (options.click_to_move) {
6749        container.on('click', function(e) {
6750          offsetX = container.offset().left;
6751          offsetY = container.offset().top;
6752          imgWidth = beforeImg.width();
6753          imgHeight = beforeImg.height();
6754
6755          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6756          adjustSlider(sliderPct);
6757        });
6758      }
6759
6760      $(window).trigger("resize.twentytwenty");
6761    });
6762  };
6763
6764
6765  $(window).on("load", function(e) {
6766  	$('.twentytwenty-container').each(function(){
6767  		var $container = $(this);
6768  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6769  			$container.twentytwenty();
6770  		}
6771  		$('img', $container).on('async-done', function(){
6772	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6773	  			$container.twentytwenty();
6774	  		}
6775	    });
6776  	});
6777  });
6778}
6779
6780UNCODE.justifiedGallery = function() {
6781
6782	var breakPointMe = function( val ) {
6783		val = parseInt( val );
6784		if ( isNaN(val) ) {
6785			return false;
6786		}
6787		if ( val >= 1500 ) {
6788			return 1;
6789		} else if ( val < 1500 && val >= 960 ) {
6790			return 2;
6791		} else if ( val < 960 && val >= 570 ) {
6792			return 3;
6793		} else if ( val < 570 ) {
6794			return 4;
6795		}
6796	}
6797
6798	var gutterByBreakpoint = function( bp, gutter ) {
6799		var ret;
6800		switch(gutter) {
6801		    case 'no-gutter':
6802		    	ret = 0;
6803		        break;
6804		    case 'px-gutter':
6805		    	ret = 1;
6806		        break;
6807		    case 'half-gutter':
6808		    	ret = 18;
6809		        break;
6810		    case 'double-gutter':
6811				switch(bp) {
6812				    case 3:
6813				    case 4:
6814				    	ret = 36;
6815				        break;
6816				    default:
6817				    	ret = 72;
6818				        break;
6819				}
6820		        break;
6821		    case 'triple-gutter':
6822				switch(bp) {
6823				    case 3:
6824				    case 4:
6825				    	ret = 36;
6826				        break;
6827				    default:
6828				    	ret = 108;
6829				        break;
6830				}
6831		        break;
6832		    case 'quad-gutter':
6833				switch(bp) {
6834				    case 2:
6835				    	ret = 108;
6836				        break;
6837				    case 3:
6838				    	ret = 72;
6839				        break;
6840				    case 4:
6841				    	ret = 36;
6842				        break;
6843				    default:
6844				    	ret = 144;
6845				        break;
6846				}
6847		        break;
6848		    default:
6849		    	ret = 36;//single-gutter
6850		}
6851		return ret;
6852	}
6853
6854	if ($('.justified-layout').length > 0) {
6855		var justifiedContainersArray = [],
6856			typeGridArray = [],
6857			layoutGridArray = [],
6858			transitionDuration = [],
6859			$filterItems = [],
6860			$filters = $('.justified-system .isotope-filters'),
6861			$itemSelector = '.tmb',
6862			$items,
6863			itemMargin,
6864			correctionFactor = 0,
6865			firstLoad = true,
6866			isOriginLeft = $('body').hasClass('rtl') ? false : true,
6867			prevW = breakPointMe(UNCODE.wwidth);
6868		$('[class*="justified-container"]').each(function() {
6869			var isoData = $(this).data();
6870			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6871			if (isoData.type == 'metro') typeGridArray.push(true);
6872			else typeGridArray.push(false);
6873			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
6874			else layoutGridArray.push('justified');
6875			justifiedContainersArray.push($(this));
6876		});
6877		var init_justifiedGallery = function() {
6878			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
6879				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
6880					justifiedId = justifiedSystem.attr('id'),
6881					$layoutMode = layoutGridArray[i],
6882					gutter = $(justifiedContainersArray[i]).data('gutter'),
6883					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
6884					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
6885					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6886					margins;
6887
6888				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6889				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6890				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6891
6892				margins = gutterByBreakpoint(prevW, gutter);
6893
6894				$(justifiedContainersArray[i]).justifiedGallery({
6895					rowHeight: rowHeight,
6896					maxRowHeight: maxRowHeight,
6897					margins: margins,
6898					cssAnimation: true,
6899					lastRow: lastRow,
6900					waitThumbnailsLoad: false
6901				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6902
6903				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6904					$(justifiedContainersArray[i]).infinitescroll({
6905							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6906							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6907							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6908							animate: false,
6909							behavior: 'local',
6910							debug: false,
6911							loading: {
6912								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6913								speed: 0,
6914								finished: undefined,
6915								msg: $('#' + justifiedId + ' .loadmore-button'),
6916							},
6917							errorCallback: function() {
6918								var justified_system = $(this).closest('.justified-system');
6919								$('.loading-button', justified_system).hide();
6920								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
6921							}
6922						},
6923						// append the new items to galleryJustified on the infinitescroll callback function.
6924						function(newElements, opts) {
6925							var $galleryJustified = $(this),
6926								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
6927								filters = new Array(),
6928								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
6929								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
6930								$numPages = $('a', $infinite_button).data('pages'),
6931								delay = 300;
6932							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6933							$infinite_button.show();
6934							$loading_button.hide();
6935							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6936							$('> li', $galleryJustified).remove();
6937							$.each($(newElements), function(index, val) {
6938								$(val).addClass('tmb-iso');
6939								if ($(val).is("li")) {
6940									filters.push($(val)[0]);
6941								}
6942								$(val).addClass('uncode-appended');
6943							});
6944							newElements = newElements.filter(function(x) {
6945								return filters.indexOf(x) < 0
6946							});
6947							$.each($(filters), function(index, val) {
6948								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
6949							});
6950							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
6951							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6952								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
6953								if (typeof getLightbox === 'object') {
6954									getLightbox.refresh();
6955								} else {
6956									UNCODE.lightbox();
6957								}
6958							}
6959							if ( typeof twttr !== 'undefined' )
6960								twttr.widgets.load(justifiedContainersArray[i]);
6961
6962							requestTimeout(function() {
6963								$galleryJustified.trigger('more-items-loaded');
6964								$(window).trigger('more-items-loaded');
6965								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6966							}, 1000);
6967						});
6968					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
6969						var $infinite_justified = $(justifiedContainersArray[i]),
6970							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
6971						$infinite_justified.infinitescroll('pause');
6972						$infinite_button.on('click', function(event) {
6973							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6974								$.each(UNCODE.lightboxArray, function(index, val) {
6975									UNCODE.lightboxArray[index].destroy();
6976								});
6977							}
6978							event.preventDefault();
6979							var $justified_system = $(event.target).closest('.justified-system'),
6980							$infinite_justified = $justified_system.find('.justified-container'),
6981							justifiedId = $justified_system.attr('id');
6982							$(event.currentTarget).html(SiteParameters.loading);
6983							$infinite_justified.infinitescroll('resume');
6984							$infinite_justified.infinitescroll('retrieve');
6985							$infinite_justified.infinitescroll('pause');
6986							$infinite_justified.trigger('more-items-loaded');
6987							$(window).trigger('more-items-loaded');
6988							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6989						});
6990					}
6991				}
6992			}
6993		},
6994		onLayout = function(justifiedObj, startIndex) {
6995			justifiedObj.css('opacity', 1);
6996			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
6997			$('.tmb', justifiedObj).addClass('justified-object-loaded');
6998
6999			requestTimeout(function() {
7000				// window.dispatchEvent(UNCODE.boxEvent);
7001				UNCODE.adaptive();
7002				if (SiteParameters.dynamic_srcset_active === '1') {
7003					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
7004				}
7005				if (typeof MediaElement === "function") {
7006					$(justifiedObj).find('audio,video').each(function() {
7007						$(this).mediaelementplayer({
7008								pauseOtherPlayers: false,
7009						});
7010					});
7011				}
7012				if ($(justifiedObj).find('.nested-carousel').length) {
7013					if (typeof UNCODE.carousel !== 'undefined') {
7014						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
7015					}
7016					requestTimeout(function() {
7017						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7018						justifiedObj.addClass('justified-gallery-finished')
7019						Waypoint.refreshAll();
7020					}, 200);
7021				} else {
7022					requestTimeout(function() {
7023						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7024						justifiedObj.addClass('justified-gallery-finished')
7025						Waypoint.refreshAll();
7026					}, 300);
7027				}
7028			}, 100);
7029
7030		},
7031		boxAnimation = function(items, startIndex, sequential, container) {
7032			var $allItems = items.length - startIndex,
7033				showed = 0,
7034				index = 0;
7035			if (container.closest('.owl-item').length == 1) return false;
7036			$.each(items, function(index, val) {
7037				var elInner = $('> .t-inside', val);
7038				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
7039					return;
7040				}
7041				if (val[0]) val = val[0];
7042				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
7043					new Waypoint({
7044						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
7045						element: val,
7046						handler: function() {
7047							var element = $('> .t-inside', this.element),
7048								parent = $(this.element),
7049								currentIndex = parent.index();
7050							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
7051								delayAttr = parseInt(element.attr('data-delay'));
7052							if (isNaN(delayAttr)) delayAttr = 100;
7053							delay -= showed;
7054							var objTimeout = requestTimeout(function() {
7055								element.removeClass('zoom-reverse').addClass('start_animation');
7056								showed = parent.index();
7057							}, delay * delayAttr);
7058							parent.data('objTimeout', objTimeout);
7059							if (!UNCODE.isUnmodalOpen) {
7060								this.destroy();
7061							}
7062						},
7063						offset: '100%'
7064					})
7065				} else {
7066					elInner.removeClass('animate_when_almost_visible');
7067					$(val).addClass('no-waypoint-animation');
7068					/*if (elInner.hasClass('force-anim')) {
7069						elInner.addClass('start_animation');
7070					} else {
7071						elInner.css('opacity', 1);
7072					}*/
7073				}
7074				index++;
7075			});
7076		};
7077		$filters.on('click', 'a[data-filter]', function(evt) {
7078			var $filter = $(this),
7079				filterContainer = $filter.closest('.isotope-filters'),
7080				filterValue = $filter.attr('data-filter'),
7081				container = $filter.closest('.justified-system').find($('.justified-layout')),
7082				lastRow = container.data('last-row'),
7083				transitionDuration = 0,
7084				delay = 300,
7085				filterItems = [];
7086
7087			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
7088
7089			var filter_items = function(){
7090				if (filterValue !== undefined) {
7091					$.each($('> .tmb > .t-inside', container), function(index, val) {
7092						var parent = $(val).parent(),
7093							objTimeout = parent.data('objTimeout');
7094						if (objTimeout) {
7095							$(val).removeClass('zoom-reverse');
7096							clearRequestTimeout(objTimeout);
7097						}
7098						if (transitionDuration == 0) {
7099							if ($(val).hasClass('animate_when_almost_visible')) {
7100								$(val).addClass('zoom-reverse').removeClass('start_animation');
7101							} else {
7102								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7103							}
7104						}
7105					});
7106
7107					requestTimeout(function() {
7108						var $block,
7109							selector,
7110							lightboxElements,
7111							$boxes;
7112
7113						if ( filterValue !== '' && filterValue !== '*' ) {
7114							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
7115							selector = '.' + filterValue;
7116							$.each($(selector, container), function(index, block) {
7117								lightboxElements = $('[data-lbox^=ilightbox]', block);
7118								if (lightboxElements.length) {
7119									lightboxElements.removeClass('lb-disabled');
7120									container.data('lbox', $(lightboxElements[0]).data('lbox'));
7121								}
7122								filterItems.push(block);
7123							});
7124							container.justifiedGallery({
7125								filter: selector,
7126								lastRow: 'nojustify'
7127							});
7128						} else {
7129							container.justifiedGallery({
7130								filter: false,
7131								lastRow: lastRow
7132							});
7133							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
7134							filterItems = $('> .tmb', container);
7135						}
7136						container.trigger('more-items-loaded');
7137						$(window).trigger('more-items-loaded');
7138						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7139
7140						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7141						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7142							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
7143							if (typeof getLightbox === 'object') {
7144								getLightbox.refresh();
7145							} else {
7146								UNCODE.lightbox();
7147							}
7148						}
7149
7150						if (transitionDuration == 0) {
7151							requestTimeout(function() {
7152								boxAnimation(filterItems, 0, false, container);
7153							}, 100);
7154						}
7155						requestTimeout(function() {
7156							Waypoint.refreshAll();
7157							container.trigger('more-items-loaded');
7158							$(window).trigger('more-items-loaded');
7159							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7160							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
7161								$(document).trigger('uncode-scrolltrigger-refresh');
7162							}
7163						}, 2000);
7164
7165					}, delay);
7166				} else {
7167					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7168						$.each(UNCODE.lightboxArray, function(index, val) {
7169							UNCODE.lightboxArray[index].destroy();
7170						});
7171					}
7172					$.each($('> .tmb > .t-inside', container), function(index, val) {
7173						var parent = $(val).parent(),
7174							objTimeout = parent.data('objTimeout');
7175						if (objTimeout) {
7176							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7177							clearRequestTimeout(objTimeout);
7178						}
7179						if (transitionDuration == 0) {
7180							if ($(val).hasClass('animate_when_almost_visible')) {
7181								$(val).addClass('zoom-reverse').removeClass('start_animation');
7182							} else {
7183								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7184							}
7185						}
7186					});
7187					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7188						UNCODE.lightbox();
7189					}
7190					container.parent().addClass('justified-loading');
7191					container.trigger('more-items-loaded');
7192					$(window).trigger('more-items-loaded');
7193					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7194				}
7195			};
7196
7197			if (!$filter.hasClass('active')) {
7198				/** Scroll top with filtering */
7199				if (filterContainer.hasClass('filter-scroll')) {
7200                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7201                    calc_scroll -= UNCODE.get_scroll_offset();
7202
7203					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7204						delta = bodyTop - calc_scroll,
7205						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7206						filterTolerance = false,
7207						filter_timeout;
7208					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7209
7210					if ( !UNCODE.isFullPage ) {
7211						if (scrollSpeed == 0) {
7212							$('html, body').scrollTop(calc_scroll);
7213							UNCODE.scrolling = false;
7214							filter_items();
7215						} else {
7216
7217							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7218								filter_items();
7219								filterTolerance = true;
7220							}
7221
7222							$('html, body').animate({
7223								scrollTop: calc_scroll
7224							},{
7225								easing: 'easeInOutQuad',
7226								duration: scrollSpeed,
7227								complete: function(){
7228									UNCODE.scrolling = false;
7229									if ( !filterTolerance ) {
7230										filter_timeout = setTimeout(function(){
7231											clearTimeout(filter_timeout);
7232											filter_items();
7233										}, 200);
7234									}
7235								}
7236							});
7237						}
7238					}
7239				} else {
7240					filter_items();
7241				}
7242			}
7243			evt.preventDefault();
7244		});
7245
7246		$filters.each(function(i, buttonGroup) {
7247			var $buttonGroup = $(buttonGroup);
7248			$buttonGroup.on('click', 'a', function() {
7249				$buttonGroup.find('.active').removeClass('active');
7250				$(this).addClass('active');
7251			});
7252
7253			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7254				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7255				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7256			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7257				e.preventDefault();
7258				$cats_filters.slideToggle(400, 'easeInOutCirc');
7259			});
7260		});
7261		window.addEventListener('boxResized', function(e) {
7262			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
7263				prevW = breakPointMe(UNCODE.wwidth);
7264				$.each($('.justified-layout'), function(index, val) {
7265					var gutter = $(this).data('gutter'),
7266						margins = gutterByBreakpoint( prevW, gutter);
7267					$(this).justifiedGallery({
7268						margins: margins
7269					});
7270					$(this).find('.mejs-video,.mejs-audio').each(function() {
7271						$(this).trigger('resize');
7272					});
7273				});
7274			}
7275		}, false);
7276
7277		init_justifiedGallery();
7278	};
7279};
7280
7281UNCODE.cssGrid = function() {
7282	if ($('.cssgrid-layout').length > 0) {
7283		var cssGridContainersArray = [];
7284		var transitionDuration = [];
7285		var $filters = $('.cssgrid-system .cssgrid-filters');
7286
7287		$('[class*="cssgrid-container"]').each(function() {
7288			cssGridContainersArray.push($(this));
7289			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
7290		});
7291
7292		var init_cssGridAjax = function() {
7293			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
7294				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
7295					cssGridId = cssGridSystem.attr('id');
7296
7297				cssGridSystem.data('transitionDuration', transitionDuration[i]);
7298
7299				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
7300					$(cssGridContainersArray[i]).infinitescroll({
7301						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
7302						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
7303						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
7304						animate: false,
7305						behavior: 'local',
7306						debug: false,
7307						loading: {
7308							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
7309							speed: 0,
7310							finished: undefined,
7311							msg: $('#' + cssGridId + ' .loadmore-button'),
7312						},
7313						errorCallback: function() {
7314							var cssgrid_system = $(this).closest('.cssgrid-system');
7315							$('.loading-button', cssgrid_system).hide();
7316							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
7317						}
7318					},
7319					// append the new items to cssGrid on the infinitescroll callback function.
7320					function(newElements, opts) {
7321						var $cssGrid = $(this),
7322							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
7323							cssGridId = cssGridSystemCont.attr('id'),
7324							filters = new Array(),
7325							$loading_button = cssGridSystemCont.find('.loading-button'),
7326							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
7327							$numPages = $('a', $infinite_button).data('pages'),
7328							$woo_results,
7329							delay = 300;
7330						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7331						$infinite_button.show();
7332						$loading_button.hide();
7333						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7334						$('> li', $cssGrid).remove();
7335						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
7336						$.each($(newElements), function (index, val) {
7337							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
7338								$woo_results = $(val);
7339								delete newElements[index];
7340							} else {
7341								$(val).addClass('tmb-grid');
7342								if ($(val).is("li")) {
7343									filters.push($(val)[0]);
7344								}
7345							}
7346							$(val).addClass('uncode-appended');
7347						});
7348						newElements = newElements.filter(function(x) {
7349							return filters.indexOf(x) < 0
7350						});
7351						$.each($(filters), function(index, val) {
7352							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
7353						});
7354						if ($woo_results && $woo_results.length > 0) {
7355							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
7356							var new_count = $woo_results.find('.woocommerce-result-count').text();
7357							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
7358							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
7359							function replaceMatch(match, p1, p2) {
7360        						return old_start + '–' + new_end;
7361							}
7362							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
7363							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
7364						}
7365
7366						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
7367						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
7368						if (filterValue !== undefined && filterValue != '*') {
7369							$(newElements).hide();
7370							var els_to_show = $();
7371							$(newElements).each(function() {
7372								var el = $(this);
7373								if (el.hasClass(filterValue)) {
7374									els_to_show = els_to_show.add(el);
7375									el.show();
7376								}
7377							});
7378							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
7379						} else {
7380							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
7381						}
7382
7383						UNCODE.adaptive();
7384						if (SiteParameters.dynamic_srcset_active === '1') {
7385							UNCODE.refresh_dynamic_srcset_size($cssGrid);
7386						}
7387						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7388							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
7389							if (typeof getLightbox === 'object') {
7390								getLightbox.refresh();
7391							} else {
7392								UNCODE.lightbox();
7393							}
7394						}
7395						if ( typeof twttr !== 'undefined' ) {
7396							twttr.widgets.load(cssGridContainersArray[i]);
7397						}
7398
7399						UNCODE.carousel($(newElements));
7400						requestTimeout(function() {
7401							$cssGrid.trigger('more-items-loaded');
7402							$(window).trigger('more-items-loaded');
7403							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7404						}, 1000);
7405
7406					});
7407					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
7408						var $cssgrid_el = $(cssGridContainersArray[i]),
7409							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
7410						$cssgrid_el.infinitescroll('pause');
7411						$infinite_button.on('click', function(event) {
7412							event.preventDefault();
7413							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
7414							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
7415							cssGridId = $cssgrid_system.attr('id');
7416							$(event.currentTarget).html(SiteParameters.loading);
7417							$cssgrid_el.infinitescroll('resume');
7418							$cssgrid_el.infinitescroll('retrieve');
7419							$cssgrid_el.infinitescroll('pause');
7420						});
7421					}
7422				}
7423			}
7424		};
7425
7426		init_cssGridAjax();
7427
7428		if ($('.cssgrid-pagination').length > 0) {
7429			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
7430				evt.preventDefault();
7431
7432				if (SiteParameters.index_pagination_disable_scroll !== '1') {
7433					var container = $(this).closest('.cssgrid-system'),
7434						pagination_disable_scroll = container.attr('data-pagination-scroll'),
7435						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7436
7437					if ( pagination_disable_scroll !== 'disabled' ) {
7438						calc_scroll -= UNCODE.get_scroll_offset();
7439
7440						var menu_container = $('.menu-sticky');
7441						var menu = menu_container.find('.menu-container');
7442
7443						if (menu_container.length > 0 && menu.length > 0) {
7444							calc_scroll = calc_scroll - menu.outerHeight();
7445						}
7446
7447						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7448							delta = bodyTop - calc_scroll,
7449							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7450						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7451
7452						if ( !UNCODE.isFullPage ) {
7453							if (scrollSpeed == 0) {
7454								$('html, body').scrollTop(calc_scroll);
7455							} else {
7456								$('html, body').animate({
7457									scrollTop: calc_scroll
7458								},{
7459									easing: 'easeInOutQuad',
7460									duration: scrollSpeed,
7461									complete: function(){
7462										UNCODE.scrolling = false;
7463									}
7464								});
7465							}
7466						}
7467					}
7468				}
7469
7470				loadCssGrid($(this), true);
7471			});
7472		}
7473
7474		$filters.on('click', 'a.grid-nav-link', function(evt) {
7475			if ($(this).hasClass('no-grid-filter')) {
7476				return;
7477			}
7478			var $filter = $(this),
7479				filterContainer = $filter.closest('.cssgrid-filters'),
7480				filterValue = $filter.attr('data-filter'),
7481				containerSystem = $filter.closest('.cssgrid-system'),
7482				container = containerSystem.find($('.cssgrid-layout')),
7483				transitionDuration = containerSystem.data('transitionDuration'),
7484				delay = 300,
7485				filterItems = [],
7486				all_thumbs = container.find('.tmb-grid');
7487
7488			var filter_items = function(){
7489				if (filterValue !== undefined) {
7490					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7491						var parent = $(val).parent(),
7492							objTimeout = parent.data('objTimeout');
7493						if (objTimeout) {
7494							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7495							clearRequestTimeout(objTimeout);
7496						}
7497						if (transitionDuration == 0) {
7498							if ($(val).hasClass('animate_when_almost_visible')) {
7499								$(val).addClass('zoom-reverse').removeClass('start_animation');
7500							} else {
7501								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7502							}
7503						}
7504					});
7505					requestTimeout(function(){
7506						if ( filterValue == '*' ) {
7507							all_thumbs.show();
7508							all_thumbs.each(function(index, val) {
7509								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7510								filterItems.push($(this));
7511							});
7512						} else {
7513							all_thumbs.each(function() {
7514								var _tmb = $(this);
7515								if (_tmb.hasClass(filterValue)) {
7516									_tmb.show();
7517									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7518									filterItems.push(_tmb);
7519								} else {
7520									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7521									_tmb.hide();
7522								}
7523							});
7524						}
7525
7526						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7527
7528						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7529						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7530						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7531						if (lightboxElements.length) {
7532							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7533							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7534								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7535								if (typeof getLightbox === 'object') {
7536									getLightbox.refresh();
7537								} else {
7538									UNCODE.lightbox();
7539								}
7540							}
7541						}
7542						container.trigger('more-items-loaded');
7543						$(window).trigger('more-items-loaded');
7544						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7545					}, delay);
7546				} else {
7547					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7548						var parent = $(val).parent(),
7549							objTimeout = parent.data('objTimeout');
7550						if (objTimeout) {
7551							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7552							clearRequestTimeout(objTimeout);
7553						}
7554						if (transitionDuration == 0) {
7555							if ($(val).hasClass('animate_when_almost_visible')) {
7556								$(val).addClass('zoom-reverse').removeClass('start_animation');
7557							} else {
7558								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7559							}
7560						}
7561					});
7562					loadCssGrid($filter);
7563				}
7564			};
7565
7566			if (!$filter.hasClass('active')) {
7567				/** Scroll top with filtering */
7568				if (filterContainer.hasClass('filter-scroll')) {
7569                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7570                    calc_scroll -= UNCODE.get_scroll_offset();
7571
7572					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7573						delta = bodyTop - calc_scroll,
7574						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7575						filterTolerance = false,
7576						filter_timeout;
7577					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7578
7579					if ( !UNCODE.isFullPage ) {
7580						if (scrollSpeed == 0) {
7581							$('html, body').scrollTop(calc_scroll);
7582							UNCODE.scrolling = false;
7583							filter_items();
7584						} else {
7585
7586							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7587								filter_items();
7588								filterTolerance = true;
7589							}
7590
7591							$('html, body').animate({
7592								scrollTop: calc_scroll
7593							},{
7594								easing: 'easeInOutQuad',
7595								duration: scrollSpeed,
7596								complete: function(){
7597									UNCODE.scrolling = false;
7598									if ( !filterTolerance ) {
7599										filter_timeout = setTimeout(function(){
7600											clearTimeout(filter_timeout);
7601											filter_items();
7602										}, 200);
7603									}
7604								}
7605							});
7606						}
7607					}
7608				} else {
7609					filter_items();
7610				}
7611			}
7612			evt.preventDefault();
7613		});
7614
7615		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7616			var params = UNCODE.getURLParams(window.location);
7617			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7618
7619			UNCODE.lastURL = window.location.href;
7620
7621			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
7622				return;
7623			}
7624
7625			if (params.id === undefined) {
7626				$.each($('.cssgrid-system'), function(index, val) {
7627					loadCssGrid($(val));
7628				});
7629			} else {
7630				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7631					loadCssGrid($('#' + params.id));
7632				}
7633			}
7634		});
7635
7636		var loadCssGrid = function($href, $paginating) {
7637			var is_paginating = false;
7638
7639			if (undefined !== $paginating && $paginating) {
7640				var is_paginating = $paginating;
7641			}
7642
7643			var href = ($href.is("a") ? $href.attr('href') : location),
7644				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7645				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7646				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7647				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7648				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7649				cssgridId = cssgridSystem.attr('id');
7650			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7651				UNCODE.lastURL = href;
7652				history.pushState({
7653					myCSSgrid: true
7654				}, document.title, href);
7655			}
7656			cssgridWrapper.addClass('cssgrid-loading');
7657			if (is_paginating) {
7658				cssgridWrapper.addClass('grid-filtering');
7659			}
7660			$.ajax({
7661				url: href
7662			}).done(function(data) {
7663				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7664					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7665					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7666				requestTimeout(function() {
7667					cssgridContainer.html($resultItems);
7668					cssgridWrapper.removeClass('cssgrid-loading');
7669					cssgridWrapper.removeClass('grid-filtering');
7670					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7671					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7672					UNCODE.adaptive();
7673					if (SiteParameters.dynamic_srcset_active === '1') {
7674						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7675					}
7676					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7677						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7678						if (typeof getLightbox === 'object') {
7679							getLightbox.refresh();
7680						} else {
7681							UNCODE.lightbox();
7682						}
7683					}
7684					cssgridContainer.trigger('more-items-loaded');
7685					$(window).trigger('more-items-loaded');
7686					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7687				}, 300);
7688
7689				$('.pagination', cssgridFooter).remove();
7690				cssgridFooter.append($resultPagination);
7691
7692				if (cssgridResultCount.length > 0) {
7693					$('.woocommerce-result-count', cssgridResultCount).remove();
7694					cssgridResultCount.append($resultCount);
7695				}
7696			});
7697		};
7698
7699		$filters.each(function(i, buttonGroup) {
7700			var $buttonGroup = $(buttonGroup);
7701			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7702				$buttonGroup.find('.active').removeClass('active');
7703				$(this).addClass('active');
7704
7705			});
7706
7707			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7708				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7709				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7710			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7711				e.preventDefault();
7712				$cats_filters.slideToggle(400, 'easeInOutCirc');
7713			});
7714
7715		});
7716	};
7717};
7718
7719UNCODE.linearGrid = function(){
7720	$('.linear-wrapper').each(function(){
7721		var $wrap = $(this),
7722			$system = $wrap.closest('.linear-system'),
7723			$dragger = $('[data-dragger]', $system),
7724			$row = $wrap.closest('.vc_row[data-parent]'),
7725			_row = $row[0],
7726			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7727			vertical = $cont.hasClass('linear-or-vertical'),
7728			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7729			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7730			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7731			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7732			isInMenu = $wrap.closest('.megamenu-block-wrapper').length,
7733			isInViewport = false,
7734			isHover = false,
7735			init = false,
7736			stableHeight = UNCODE.wheight,
7737			wCont, hCont, docH, marqueeTL;
7738
7739		if ( ! $('.tmb', $cont).length ) {
7740			return;
7741		}
7742
7743		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7744		var dataX = dataSpeed;
7745
7746		dataSpeed += 5;
7747
7748		var checkLinearGridSize = function(){
7749			if ( !$wrap.is(':visible') )  {
7750				return;
7751			}
7752			$wrap.find('.cont-appended').remove();
7753
7754			if ( vertical ) {
7755				if ( ! SiteParameters.is_frontend_editor ) {
7756					hCont = $cont.outerHeight();
7757					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7758					if ( hCont < docH ) {
7759						var res = docH - hCont * 3,
7760							times = 2 * Math.round((res/hCont+1) / 2);
7761					}
7762					for ( var i = 0; i < times; i++ ) {
7763						var $cloneCont = $cont.clone(),
7764							$cloneCont2 = $cont.clone(),
7765							trans = ( (i+2) ) * 100;
7766						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7767						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7768						$cloneCont.find('a[data-lbox]').each(function(){
7769							var dataLbox = $(this).attr('data-lbox');
7770							$(this).attr('data-lbox', dataLbox + '_' + i);
7771						});
7772						$cloneCont.find('.wp-video-shortcode').each(function(){
7773							var thisID = $(this).attr('id');
7774							$(this).attr('id', thisID + '_' + i);
7775						});
7776						$cloneCont2.find('a[data-lbox]').each(function(){
7777							var dataLbox = $(this).attr('data-lbox');
7778							$(this).attr('data-lbox', dataLbox + '_2' + i);
7779						});
7780						$cloneCont2.find('.wp-video-shortcode').each(function(){
7781							var thisID = $(this).attr('id');
7782							$(this).attr('id', thisID + '__' + i);
7783						});
7784						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7785							UNCODE.lightgallery($cloneCont);
7786							UNCODE.lightgallery($cloneCont2);
7787						}
7788					}
7789                }
7790			} else {
7791				wCont = $cont.outerWidth();
7792				if ( (wCont) < UNCODE.wwidth*2 ) {
7793					var res = UNCODE.wwidth*2 - (wCont),
7794						times = 2 * Math.round((res/wCont+1) / 2);
7795				}
7796				for ( var i = 0; i < times; i++ ) {
7797					var $cloneCont = $cont.clone(),
7798						$cloneCont2 = $cont.clone(),
7799						trans = ( (i+2) ) * 100;
7800					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7801					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7802					$cloneCont.find('a[data-lbox]').each(function(){
7803						var dataLbox = $(this).attr('data-lbox');
7804						$(this).attr('data-lbox', dataLbox + '_' + i);
7805					});
7806					$cloneCont.find('[id]').each(function(){
7807						var thisID = $(this).attr('id');
7808						$(this).attr('id', thisID + '_' + i);
7809					});
7810					$cloneCont2.find('a[data-lbox]').each(function(){
7811						var dataLbox = $(this).attr('data-lbox');
7812						$(this).attr('data-lbox', dataLbox + '_2' + i);
7813					});
7814					$cloneCont2.find('[id]').each(function(){
7815						var thisID = $(this).attr('id');
7816						$(this).attr('id', thisID + '__' + i);
7817					});
7818                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
7819                        UNCODE.lightgallery($cloneCont);
7820                        UNCODE.lightgallery($cloneCont2);
7821                    }
7822                }
7823			}
7824		};
7825		if ( clone ) {
7826			checkLinearGridSize();
7827			$(window).on('resize.linearGrid', function(){
7828				checkLinearGridSize();
7829			});
7830		}
7831
7832		var continuousLinearMarquee = function(_xStrt){
7833			if ( !$wrap.is(':visible') )  {
7834				return;
7835			}
7836			var ease = 'none';
7837			wCont = $cont.outerWidth();
7838			hCont = $cont.outerHeight();
7839
7840			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
7841				xEnd = vertical ? hCont : wCont,
7842				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7843				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
7844				speedSlow = (xEnd + xStrt) / 45,
7845				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7846
7847			marqueeTL = new TimelineMax({paused:true, reversed:true});
7848
7849			if ( (isInViewport && !isHover && !freezed) || isInMenu ) {
7850				marqueeTL.play();
7851
7852				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
7853					var $column = $wrap.closest('.wpb_column'),
7854						$col_link = $('.col-link', $column),
7855						$hover_sel = $wrap;
7856
7857					if ( $col_link.length ) {
7858						$hover_sel = $wrap.add($column);
7859					}
7860
7861					$hover_sel.on('mouseover', function(){
7862						if ( $wrap.attr('data-hover') === 'yes' ) {
7863							//speed = ( 10 - dataSpeed ) * 5;
7864							ease = 'power2.out';
7865							marqueeTL.duration( speedSlow );
7866						} else {
7867							marqueeTL.pause();
7868						}
7869						isHover = true;
7870					}).on('mouseout', function(){
7871						if ( $wrap.attr('data-hover') === 'yes' ) {
7872							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
7873							ease = 'power2.in';
7874							marqueeTL.duration( speed );
7875						} else {
7876							marqueeTL.play();
7877						}
7878						isHover = false;
7879					});
7880				}
7881
7882				$(document).on('sub-menu-slide-up', function(){
7883					if ( isInMenu ) {
7884						marqueeTL.pause();
7885					}
7886				});
7887
7888			}
7889	
7890			gsap.killTweensOf($wrap);
7891			if ( vertical ) {
7892				marqueeTL.fromTo( $wrap, {
7893					y: xStrt * direction
7894				},
7895				{
7896					duration: speed,
7897					y: xEnd * direction * -1,
7898					onComplete: function(){
7899						continuousLinearMarquee();
7900					},
7901					ease: ease,
7902					paused: freezed
7903				});
7904			} else {
7905				marqueeTL.fromTo( $wrap, {
7906					x: xStrt * direction
7907				},
7908				{
7909					duration: speed,
7910					x: xEnd * direction * -1,
7911					onComplete: function(){
7912						continuousLinearMarquee();
7913					},
7914					ease: ease,
7915					paused: freezed
7916				});
7917			}
7918		};
7919
7920		var dragLinearContinuous = function(){
7921			if ( !$wrap.is(':visible') )  {
7922				return;
7923			}
7924			var matrix, _x, _y,
7925				dragAction = false;
7926			Draggable.create($wrap[0], {
7927				type: vertical ? "y" : "x",
7928				bounds: document.getElementById("container"),
7929				inertia: false,
7930				onPress: function (e) {
7931				},
7932				onRelease: function (e) {
7933					if ( dragAction === true ) {
7934						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7935						_x = matrix[12] || matrix[4];
7936						_y = matrix[13] || matrix[5];
7937						if ( vertical ) {
7938							continuousLinearMarquee(_y * -1);
7939						} else {
7940							continuousLinearMarquee(_x * -1);
7941						}
7942						$wrap.removeClass('linear-dragging');
7943					}
7944				},
7945				onDrag: function (e) {
7946					dragAction = true;
7947					$wrap.addClass('linear-dragging');
7948				},
7949				onDragEnd: function (e) {
7950					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7951					_x = matrix[12] || matrix[4];
7952					_y = matrix[13] || matrix[5];
7953					wCont = $cont.outerWidth();
7954					hCont = $cont.outerHeight();
7955					if ( vertical ) {
7956						if ( Math.abs(_y) > hCont ) {
7957							if ( _y < 0 ) {
7958								_y = hCont + parseFloat( _y );
7959							} else {
7960								_y = parseFloat( _y ) - hCont;
7961							}
7962						}
7963						continuousLinearMarquee(_y * -1);
7964					} else {
7965						if ( Math.abs(_x) > wCont ) {
7966							if ( _x < 0 ) {
7967								_x = wCont + parseFloat( _x );
7968							} else {
7969								_x = parseFloat( _x ) - wCont;
7970							}
7971						}
7972						continuousLinearMarquee(_x * -1);
7973					}
7974					$wrap.removeClass('linear-dragging');
7975					dragAction = false;
7976				},
7977			});
7978		};
7979
7980		var runScrollLinear = function(){
7981			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7982			if ( (!$wrap.is(':visible') || freezed) )  {
7983				return;
7984			}
7985			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7986				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
7987			
7988			var linearGridScroll = function(){
7989				if ( isInViewport ) {
7990					var bound = _row.getBoundingClientRect();
7991
7992					var bound_top = bound.top,
7993						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
7994
7995					if ( vertical ) {
7996						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7997					} else {
7998						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7999					}
8000					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8001						requestAnimationFrame(linearGridScroll);
8002					}
8003				}
8004				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
8005					window.addEventListener("scroll", linearGridScroll);
8006				}
8007			};
8008
8009			$(window).on( 'load wwResize', function(e) {
8010				stableHeight = UNCODE.wheight;
8011				linearGridScroll();
8012			});
8013			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8014				requestAnimationFrame(linearGridScroll);
8015			}
8016		};
8017		
8018		var dragLinear = function(){
8019			if ( !$wrap.is(':visible') )  {
8020				return;
8021			}
8022			var matrix, _x, _y;
8023			Draggable.create($dragger[0], {
8024				type: vertical ? "y" : "x",
8025				bounds: document.getElementById("container"),
8026				inertia: false,
8027				onPress: function (e) {
8028				},
8029				onRelease: function (e) {
8030				},
8031				onDrag: function (e) {
8032					$wrap.addClass('linear-dragging');
8033				},
8034				onDragEnd: function (e) {
8035					matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8036					_x = matrix[12] || matrix[4];
8037					_y = matrix[13] || matrix[5];
8038					wCont = $cont.outerWidth();
8039					hCont = $cont.outerHeight();
8040					if ( vertical ) {
8041						if ( Math.abs(_y) > hCont ) {
8042							if ( _y < 0 ) {
8043								_y = hCont + parseFloat( _y );
8044							} else {
8045								_y = parseFloat( _y ) - hCont;
8046							}
8047							gsap.to( $dragger[0], {
8048								duration: 0,
8049								y: _y,
8050							});
8051						}
8052					} else {
8053						if ( Math.abs(_x) > wCont ) {
8054							if ( _x < 0 ) {
8055								_x = wCont + parseFloat( _x );
8056							} else {
8057								_x = parseFloat( _x ) - wCont;
8058							}
8059							gsap.to( $dragger[0], {
8060								duration: 0,
8061								x: _x,
8062							});
8063						}
8064					}
8065					$wrap.removeClass('linear-dragging');
8066				},
8067			});
8068		};
8069
8070		if ( ! $('body').hasClass('compose-mode') ) {
8071			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
8072				continuousLinearMarquee();
8073				$(window).on( 'wwResize', function(e) {
8074					continuousLinearMarquee();
8075				});	
8076				$(document).on('sub-menu-slide-down', function(){
8077					if ( isInMenu ) {
8078						continuousLinearMarquee();
8079					}
8080				});
8081				if ( $wrap.attr('data-draggable') === 'yes' ) {
8082					dragLinearContinuous();
8083				}
8084			}
8085
8086			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8087				runScrollLinear();
8088				if ( $wrap.attr('data-draggable') === 'yes' ) {
8089					dragLinear();
8090				}
8091			}
8092
8093			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8094				var observer = new IntersectionObserver(function(entries) {
8095						
8096					entries.forEach(function(entry){
8097						if ( entry.isIntersecting ) {
8098							isInViewport = true;
8099							if ( !init ) {
8100								init = true;
8101								continuousLinearMarquee();
8102							} else {
8103								if ( typeof marqueeTL !== 'undefined' ) {
8104									marqueeTL.play();
8105								}
8106							}
8107							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8108								requestAnimFrame(runScrollLinear);
8109							}
8110						} else {
8111							isInViewport = false;
8112							if ( typeof marqueeTL !== 'undefined' ) {
8113								marqueeTL.pause();
8114							}
8115						}
8116					});
8117				}, { 
8118					root: document,
8119				});
8120
8121				observer.observe(_row);
8122
8123			} else {
8124
8125				var checkVisible = function( el, off ) {
8126					if (typeof jQuery === "function" && el instanceof jQuery) {
8127						el = el[0];
8128					}
8129			
8130					off = typeof off=='undefined' ? 50 : off;
8131			
8132					var rect = el.getBoundingClientRect();
8133			
8134					return (
8135						(
8136							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8137							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8138							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8139						)
8140					);
8141				};
8142				
8143				var checkVisibility = function(){
8144
8145					if ( checkVisible($row) ) {
8146						isInViewport = true;
8147						if ( typeof marqueeTL !== 'undefined' ) {
8148							marqueeTL.play();
8149						}
8150					} else {
8151						isInViewport = false;
8152						if ( typeof marqueeTL !== 'undefined' ) {
8153							marqueeTL.pause();
8154						}
8155					}
8156				}
8157
8158				window.addEventListener("scroll", checkVisibility);
8159				checkVisibility();
8160
8161			}
8162		}
8163	});
8164};
8165UNCODE.preventDoubleTransition = function() {
8166	$('.sticky-element .animate_when_almost_visible').each(function(){
8167		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
8168			$el.addClass('do_not_reanimate');
8169		});
8170	});
8171};
8172
8173UNCODE.checkScrollForTabs = function(){
8174	var goToSection = window.location.hash.replace('#', ''),
8175		$index;
8176
8177	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
8178	goToSection = encodeURIComponent(goToSection);
8179	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
8180
8181	$index.attr('data-parent', 'parent-' + goToSection);
8182
8183	if (window.location.hash != undefined && window.location.hash != '') {
8184		requestTimeout(function() {
8185			scrollBody('parent-' + goToSection);
8186		}, 500);
8187	}
8188
8189	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
8190		var hash = (e.currentTarget).hash,
8191			index = (e.currentTarget).closest('.uncode-tabs');
8192		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
8193			$('a[href="' + hash + '"][data-tab-history]').click();
8194			scrollBody(index);
8195		}
8196	});
8197
8198	var scrollBody = function(index) {
8199
8200		var getSection = $('a[href="' + index + '"][data-tab-history]'),
8201			scrollTo,
8202			safeGap = 27;
8203
8204		if ( ! getSection.length ) {
8205			getSection = $('div[data-parent="' + index + '"]');
8206
8207			if ( getSection.attr('data-target') == 'row' ) {
8208				getSection = getSection.closest('.vc_row');
8209				safeGap = 0;
8210			}
8211		}
8212
8213		if (typeof getSection === 'undefined' || ! getSection.length ) {
8214			return;
8215		}
8216
8217		var body = $("html, body"),
8218		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
8219		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
8220		getOffset = UNCODE.get_scroll_offset();
8221		if ( typeof getSection.offset() === 'undefined' )
8222			return;
8223		scrollTo = getSection.offset().top - safeGap;
8224		scrollTo -= getOffset;
8225
8226		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
8227		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
8228
8229		if (index != 0) {
8230			UNCODE.scrolling = true;
8231		}
8232
8233		if (scrollSpeed == 0) {
8234			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
8235			UNCODE.scrolling = false;
8236		} else {
8237			body.animate({
8238				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
8239			}, scrollSpeed, 'easeInOutQuad', function() {
8240				requestTimeout(function() {
8241					UNCODE.scrolling = false;
8242					if (getOffset != UNCODE.get_scroll_offset()) {
8243						scrollBody(index);
8244					}
8245				}, 100);
8246			});
8247		}
8248
8249	};
8250};
8251
8252UNCODE.printScreen = function() {
8253	var inlineMediaStyle = null,
8254		setResize;
8255
8256    function changeMediaStyle() {
8257		clearRequestTimeout(setResize);
8258		setResize = requestTimeout(function(){
8259	        var $head = document.getElementsByTagName('head')[0],
8260	        	$newStyle = document.createElement('style'),
8261	        	winW = window.innerWidth,
8262	        	printH = window.innerHeight;
8263
8264	        $newStyle.setAttribute('type', 'text/css');
8265	        $newStyle.setAttribute('media', 'print');
8266	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
8267
8268	        if (inlineMediaStyle != null) {
8269	            $head.replaceChild($newStyle, inlineMediaStyle)
8270	        } else {
8271	            $head.appendChild($newStyle);
8272	        }
8273	        inlineMediaStyle = $newStyle;
8274	    }, 1000);
8275    }
8276
8277    changeMediaStyle();
8278    window.addEventListener('resize', changeMediaStyle);
8279};
8280
8281UNCODE.fullPage = function() {
8282	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
8283		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
8284		return false;
8285	} else {
8286		requestTimeout(function() {
8287			window.scrollTo(0, 0);
8288		}, 10);
8289	}
8290
8291	var $masthead = $('#masthead'),
8292		$logo = $('#logo-container-mobile'),
8293		$logolink = $('[data-minheight]', $logo),
8294		logoMinScale = $logolink.data('minheight'),
8295		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
8296		$container = $('.main-container .post-content'),
8297		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
8298		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
8299		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
8300		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
8301		headerWithOpacity = $('.header-scroll-opacity', $header).length,
8302		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
8303		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
8304		scrollBar = true,
8305		effect,
8306		animationEndTimeOut,
8307		fp_anim_time = 900,
8308		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
8309		is_scrolling = false,
8310		dataNames = [],
8311		is_first = true,
8312		no_history = $('body').hasClass('uncode-scroll-no-history'),
8313		theres_footer = true;
8314
8315	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
8316		$('> div', $footer).each(function(index, el){
8317			if ( $(el).outerHeight() < 2 )
8318				theres_footer = false;
8319			else
8320				theres_footer = true;
8321		});
8322	}
8323
8324	if ( !$footer.length )
8325		theres_footer = false;
8326
8327	if ( !UNCODE.isFullPageSnap ) {
8328
8329		if ( $('body').hasClass('uncode-fullpage-zoom') )
8330			effect = 'scaleDown';
8331		else if ( $('body').hasClass('uncode-fullpage-parallax') )
8332			effect = 'moveparallax';
8333		else
8334			effect = 'movecurtain';
8335	}
8336
8337	if ( $('body').hasClass('uncode-fullpage-trid') )
8338		fp_anim_time = fp_anim_time*2;
8339
8340	if ( $header.length ) {
8341		if ( headerName !== '' )
8342			$header.attr('data-name', headerName);
8343		if ( headerLabel !== '' )
8344			$header.attr('data-label', headerLabel);
8345		$container.prepend($header);
8346	}
8347	if ( theres_footer ) {
8348		$container.append($footer);
8349		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
8350		$('aside.widget ul', $footer).addClass('no-list');
8351	}
8352
8353	var $all = $rows.add($header);
8354
8355	if ( theres_footer )
8356		$all = $all.add($footer);
8357
8358	$all.each(function(index, row) {
8359		if( index === 0 )
8360			$(row).addClass('uncode-scroll-active');
8361	});
8362
8363    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
8364
8365	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
8366		$("<ul class='onepage-pagination'></ul>").prependTo("body");
8367	}
8368
8369	$all.each(function(index, val) {
8370		var getName = $(val).data('name'),
8371			label;
8372
8373		if (typeof getName == 'undefined' || getName == 'undefined')
8374			getName = SiteParameters.slide_name + '-' + index;
8375
8376		//if ( dataNames.includes(getName) ) {
8377		if ( dataNames.indexOf(getName) > 0 ) {
8378			getName += '_' + index;
8379			$(val).data('name', getName);
8380		}
8381
8382		dataNames.push(getName);
8383
8384		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
8385
8386		if (typeof $(val).attr('data-label') !== 'undefined')
8387			label = $(val).attr('data-label');
8388		else label = '';
8389
8390		if ( $(val).is($footer) )
8391			return;
8392
8393		if (label != '' ) {
8394			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
8395			$('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>");
8396		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
8397			$('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>");
8398		}
8399	});
8400
8401	var checkVisible = function( el, off ) {
8402		if (typeof jQuery === "function" && el instanceof jQuery) {
8403			el = el[0];
8404		}
8405
8406		off = typeof off=='undefined' ? 50 : off;
8407
8408		var rect = el.getBoundingClientRect();
8409
8410		return (
8411			(
8412				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8413				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8414				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8415			)
8416		);
8417	};
8418
8419	var animationEndAction = function( index, nextIndex ) {
8420		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8421			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8422			player, iframe;
8423
8424		if ( !$nextSlide.is($footer) ) {
8425			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
8426		}
8427
8428		if ( !UNCODE.isFullPageSnap ) {
8429			activateKBurns( nextIndex );
8430		}
8431
8432		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8433			if ($(this).attr('data-provider') == 'vimeo') {
8434				iframe = $(this).find('iframe');
8435				player = new Vimeo.Player(iframe[0]);
8436				player.pause();
8437			} else if ($(this).attr('data-provider') == 'youtube') {
8438				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8439			} else {
8440				if ($(this).is('video')) {
8441					$(this)[0].volume = 0;
8442					$(this)[0].pause();
8443				}
8444			}
8445		});
8446
8447		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8448			if ( $nextSlide.is($header) )
8449				$header.removeClass('header-scrolled');
8450		}
8451
8452		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
8453		$otherEl.each(function(){
8454			var $otherThis = $(this),
8455				$bgwrapperOther = $('.background-inner', $otherThis);
8456			if ( !checkVisible($otherThis) )
8457				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
8458
8459		});
8460
8461		if ( !checkVisible($currentSlide) ) {
8462			$currentSlide.removeClass('uncode-scroll-visible');
8463			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
8464			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
8465				currentScroll.scrollTo(0, 0, 0);
8466		}
8467
8468		clearRequestTimeout(animationEndTimeOut);
8469		animationEndTimeOut = requestTimeout(function(){
8470			Waypoint.refreshAll();
8471			$( document.body ).trigger('uncode_waypoints');
8472			var eventFP = new CustomEvent('fp-slide-changed');
8473			window.dispatchEvent(eventFP);
8474			is_scrolling = false;
8475
8476			if ( is_first ) {
8477				$('ul.onepage-pagination a').removeClass('is-selected');
8478				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8479				is_first = false;
8480			}
8481
8482		}, 500);
8483	};
8484
8485	var postLeaveActions = function( nextIndex ){
8486		if ( menuHidden && ! UNCODE.isMobile )
8487			return false;
8488
8489		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8490			$cols = $('.uncol', $el),
8491			anchor = $el.data('anchor');
8492
8493		if ( ! UNCODE.isFullPageSnap ) {
8494			$.each($cols, function(index, val){
8495				if ( $(val).hasClass('style-light') ){
8496					$masthead.removeClass('style-dark-override').addClass('style-light-override');
8497					return false;
8498				} else if ( $(val).hasClass('style-dark') ) {
8499					$masthead.removeClass('style-light-override').addClass('style-dark-override');
8500					return false;
8501				}
8502			});
8503		}
8504
8505		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
8506			$('.menu-item' ).removeClass('active');
8507			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8508		}
8509
8510		if ( !UNCODE.isFullPageSnap ) {
8511			activateBackWash( nextIndex );
8512		}
8513	};
8514
8515	var activateBackWash = function( nextIndex ){
8516		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8517			$bgwrapper;
8518
8519		if ( $el.length ) {
8520			if ( $el.hasClass('with-zoomout') ) {
8521				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8522			} else if ( $('.with-zoomout', $el).length ) {
8523				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
8524			} else {
8525				return false;
8526			}
8527		} else {
8528			return false;
8529		}
8530
8531		$bgwrapper.addClass('uncode-zoomout');
8532
8533	};
8534
8535	var activateKBurns = function( nextIndex ){
8536		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8537			$bgwrapper;
8538
8539		if ( $el.length ) {
8540			if ( $el.hasClass('with-kburns') ) {
8541				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8542			} else if ( $('.with-kburns', $el).length ) {
8543				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
8544			} else {
8545				return false;
8546			}
8547		} else {
8548			return false;
8549		}
8550
8551		$bgwrapper.addClass('uncode-kburns');
8552
8553	};
8554
8555	var activateParallax = function( nextIndex, direction ){
8556
8557		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8558			$cell = $('.fp-tableCell', $el),
8559			animationEnd = 'webkitAnimationEnd animationend',
8560			cellAnim;
8561
8562		switch( direction ) {
8563			case 'up':
8564				cellAnim = 'moveFromTopInner';
8565				break;
8566			default:
8567				cellAnim = 'moveFromBottomInner';
8568		}
8569
8570		$cell.css({
8571			'animation-name': cellAnim,
8572			'animation-duration': fp_anim_time + 'ms',
8573			'animation-delay': '',
8574			'animation-timing-function': fp_easing,
8575			'animation-fill-mode': 'both',
8576		}).off(animationEnd)
8577		.on(animationEnd, function(event) {
8578			if ( event.originalEvent.animationName === cellAnim ) {
8579				$cell
8580					.css({
8581						'animation-name': '',
8582						'animation-duration': '',
8583						'animation-delay': '',
8584						'animation-timing-function': '',
8585						'animation-fill-mode': '',
8586					});
8587			}
8588		});
8589	};
8590
8591	var scrollHashes = function(){
8592		var hash = window.location.hash.replace('#', '').split('/'),
8593			hashInd;
8594		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
8595			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
8596				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
8597				$.fn.fullpage.moveTo(hashInd+1);
8598			}
8599		} else if( hash[0] === '' ) {
8600			$.fn.fullpage.moveTo(1);
8601		}
8602	};
8603
8604	var hideMenu = function( index, nextIndex ){
8605		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
8606			return false;
8607
8608		var hMenu = UNCODE.menuHeight,
8609			transTime = hMenu * 2;
8610
8611		if ( index === 1 && nextIndex > 1 ) {
8612			hMenu = hMenu * -1;
8613		} else if  ( index !== 1 && nextIndex === 1 ) {
8614			hMenu = 0;
8615		} else {
8616			return false;
8617		}
8618
8619		$masthead.css({
8620			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8621			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8622			'-webkit-transition': 'transform 0.5s ease-in-out',
8623			'transition': 'transform 0.5s ease-in-out'
8624		});
8625	};
8626
8627	var shrinkMenu = function( index, nextIndex ){
8628		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
8629			return false;
8630
8631		if ( index === 1 && nextIndex > 1 ) {
8632			$logo.addClass('shrinked');
8633			$('div', $logo).each(function(index, val){
8634				$(val).css({
8635					'height': logoMinScale,
8636					'line-height': logoMinScale
8637				});
8638				if ($(val).hasClass('text-logo')) {
8639					$(val).css({
8640						'font-size': logoMinScale + 'px'
8641					});
8642				}
8643			});
8644			requestTimeout(function() {
8645				UNCODE.menuMobileHeight = $masthead.outerHeight();
8646			}, 300);
8647		} else if ( index !== 1 && nextIndex === 1 ) {
8648			$logo.removeClass('shrinked');
8649			$('div', $logo).each(function(index, val){
8650				$(val).css({
8651					'height': logoMaxScale,
8652					'line-height': logoMaxScale
8653				});
8654				if ($(val).hasClass('text-logo')) {
8655					$(val).css({
8656						'font-size': logoMaxScale + 'px'
8657					});
8658				}
8659			});
8660			requestTimeout(function() {
8661				UNCODE.menuMobileHeight = $masthead.outerHeight();
8662			}, 300);
8663		} else {
8664			return false;
8665		}
8666
8667	};
8668
8669	var anchorLink = function(){
8670
8671		$container.add('.menu-item').find('a[href*="#"]').on('click', function(e) {
8672			var $this = $(e.currentTarget),
8673				hash = e.currentTarget.href.split('#'),
8674				current = window.location.href.split('#'),
8675				ind,
8676				currentMenuOpened = UNCODE.menuOpened,
8677				go = false;
8678
8679			var hash_url = hash[0].replace(/\/?$/, '/'),
8680				current_url = current[0].replace(/\/?$/, '/');
8681
8682			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
8683				hash = '#'+hash[1];
8684				e.preventDefault();
8685				go = true;
8686			}
8687
8688			if ( go ) {
8689
8690				if ( $(hash).length ) {
8691					ind = $(hash).closest('.fp-section').index();
8692				} else {
8693					hash = hash.slice(1);
8694					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
8695				}
8696
8697				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
8698					ind = $this.closest('.fp-section').index();
8699
8700				UNCODE.menuOpened = false;
8701
8702				$.fn.fullpage.moveTo(ind+1);
8703
8704				UNCODE.menuOpened = currentMenuOpened;
8705				if (UNCODE.menuOpened) {
8706					if (UNCODE.wwidth < UNCODE.mediaQuery) {
8707						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
8708					} else {
8709						$('.mmb-container-overlay .overlay-close').trigger('click');
8710						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
8711					}
8712				}
8713
8714			}
8715
8716		});
8717
8718		$('.header-scrolldown').on('click', function(event) {
8719			event.preventDefault();
8720			var scrollDown = $(this),
8721				ind = scrollDown.closest('.fp-section').index();
8722
8723			$.fn.fullpage.moveTo(ind+2);
8724		});
8725
8726		var anchor = $('.fp-section.active').data('anchor');
8727
8728		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
8729			$('.menu-item').removeClass('active');
8730			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8731		}
8732
8733	};
8734
8735	var slideLeave = function( index, nextIndex, direction ) {
8736		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8737			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8738			animationEnd = 'webkitAnimationEnd animationend',
8739			transitionEnd = 'webkitTransitionEnd transitionend',
8740			animOut = effect != 'scaleDown' ? effect + direction : effect,
8741			animIn,
8742			isFooter = false,
8743			isFooterNext = false,
8744			footerH = $footer.outerHeight(),
8745			timeout,
8746			player, iframe,
8747			footerCoeff;
8748		switch( direction ) {
8749			case 'up':
8750				animIn = 'moveFromTop';
8751				break;
8752			default:
8753				animIn = 'moveFromBottom';
8754		}
8755
8756		if ( $('body').hasClass('uncode-fullpage-trid') ) {
8757			animOut = animIn + 'trid';
8758			animIn = animOut + 'In';
8759		} else if ( UNCODE.isFullPageSnap ) {
8760			animIn = animOut = 'none';
8761		}
8762
8763		hideMenu(index, nextIndex);
8764		shrinkMenu(index, nextIndex);
8765
8766		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8767			if ($(this).attr('data-provider') == 'vimeo') {
8768				iframe = $(this).find('iframe');
8769				player = new Vimeo.Player(iframe[0]);
8770				player.pause();
8771			} else if ($(this).attr('data-provider') == 'youtube') {
8772				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8773			} else {
8774				if ($(this).is('video')) {
8775					$(this)[0].volume = 0;
8776					$(this)[0].pause();
8777				}
8778			}
8779		});
8780
8781		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
8782			if ($(this).attr('data-provider') == 'vimeo') {
8783				iframe = $(this).find('iframe');
8784				iframe.on('load', function(){
8785					player = new Vimeo.Player(iframe);
8786					player.setVolume(0);
8787					player.play();
8788				});
8789				player = new Vimeo.Player(iframe);
8790				player.setVolume(0);
8791				player.play();
8792			} else if ($(this).attr('data-provider') == 'youtube') {
8793				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
8794			} else {
8795				if ($(this).is('video')) {
8796					$(this)[0].volume = 0;
8797					$(this)[0].play();
8798				}
8799			}
8800		});
8801
8802		if ( $currentSlide.is($footer) )
8803			isFooter = true;
8804
8805		if ( $nextSlide.is($footer) )
8806			isFooterNext = true;
8807
8808		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8809			if ( $currentSlide.is($header) )
8810				$header.addClass('header-scrolled');
8811		}
8812
8813		footerCoeff = footerH;
8814
8815		if ( UNCODE.isFullPageSnap ) {
8816			postLeaveActions( nextIndex );
8817			activateBackWash( nextIndex );
8818			activateKBurns( nextIndex );
8819			requestTimeout(function(){
8820				animationEndAction( index, nextIndex );
8821			}, fp_anim_time+150);
8822		} else {
8823			if ( isFooterNext ) {
8824
8825				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
8826				$iscrollWrapper.addClass('no-scrolloverflow');
8827
8828				$nextSlide
8829				.add($currentSlide)
8830				.addClass('uncode-scroll-front')
8831				.addClass('uncode-scroll-active')
8832				.addClass('uncode-scroll-visible');
8833				$container.css({
8834					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8835					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8836					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8837					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8838				}).off(transitionEnd)
8839				.one(transitionEnd, function(){
8840					animationEndAction( index, nextIndex );
8841				});
8842
8843			} else if ( isFooter ) {
8844
8845				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
8846				.add($currentSlide)
8847				.addClass('uncode-scroll-front')
8848				.addClass('uncode-scroll-active')
8849				.addClass('uncode-scroll-visible');
8850				$container.css({
8851					'-webkit-transform': 'translate3d(0, 0, 0)',
8852					'transform': 'translate3d(0, 0, 0)',
8853					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8854					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8855				})
8856				.one(transitionEnd, function(){
8857					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
8858						clearRequestTimeout(timeout);
8859						timeout = requestTimeout(function(){
8860							$.fn.fullpage.moveTo(nextIndex);
8861							slideLeave( index-1, nextIndex, 'up' );
8862							$container.off(transitionEnd);
8863						}, 50);
8864					}
8865					animationEndAction( index, nextIndex );
8866				});
8867
8868			} else {
8869
8870				postLeaveActions( nextIndex );
8871
8872				if ( !$('body').hasClass('uncode-fullpage-trid') )
8873					activateParallax( nextIndex, direction );
8874
8875				var $outBg = $('.background-wrapper', $currentSlide);
8876
8877				$nextSlide
8878				.addClass('uncode-scroll-front')
8879				.addClass('uncode-scroll-active')
8880				.addClass('uncode-scroll-visible')
8881				.addClass('uncode-scroll-animating-in')
8882				.css({
8883					'z-index':4,
8884					'animation-name': animIn,
8885					'animation-duration': fp_anim_time + 'ms',
8886					'animation-delay': '',
8887					'animation-timing-function': fp_easing,
8888					'animation-fill-mode': 'both',
8889					'transition': 'initial',
8890				}).off(animationEnd)
8891				.on(animationEnd, function(event) {
8892					if ( event.originalEvent.animationName === animIn ) {
8893						$(this)
8894							.addClass('uncode-scroll-already')
8895							.removeClass('uncode-scroll-front')
8896							.removeClass('uncode-scroll-animating-in')
8897							.css({
8898								'animation-name': '',
8899								'animation-duration': '',
8900								'animation-delay': '',
8901								'animation-timing-function': '',
8902								'animation-fill-mode': '',
8903								'transition': 'initial',
8904							});
8905
8906						$currentSlide
8907							.removeClass('uncode-scroll-active')
8908							.add($outBg)
8909							.css({
8910								'animation-name': '',
8911								'animation-duration': '',
8912								'animation-delay': '',
8913								'animation-timing-function': '',
8914								'animation-fill-mode': '',
8915								'transition': 'initial',
8916							});
8917
8918						animationEndAction( index, nextIndex );
8919
8920					}
8921
8922					if ( nextIndex > 1 )
8923						$('body').addClass('window-scrolled');
8924					else
8925						$('body').removeClass('window-scrolled');
8926				});
8927
8928				$currentSlide
8929					.addClass('uncode-scroll-animating-out')
8930					.removeClass('uncode-scroll-front')
8931					.css({
8932						'z-index':'1',
8933						'animation-name': animOut,
8934						'animation-duration': fp_anim_time + 'ms',
8935						'animation-delay': '',
8936						'animation-timing-function': fp_easing,
8937						'animation-fill-mode': 'both',
8938						'transition': 'initial',
8939						'will-change': 'auto'
8940					}).off(animationEnd)
8941					.on(animationEnd, function(event) {
8942						if ( event.originalEvent.animationName === animOut ) {
8943							$currentSlide.removeClass('uncode-scroll-animating-out');
8944						}
8945					});
8946
8947				if ( $('body').hasClass('uncode-fp-opacity') ) {
8948					$currentSlide.find('> div').css({
8949						'animation-name': 'opacityout',
8950						'animation-duration': fp_anim_time + 'ms',
8951						'animation-delay': '',
8952						'animation-timing-function': fp_easing,
8953						'animation-fill-mode': 'both',
8954						'transition': 'initial',
8955					}).off(animationEnd)
8956					.on(animationEnd, function(event) {
8957						if ( event.originalEvent.animationName === 'opacityout' ) {
8958							$(event.currentTarget).css({
8959								'animation-name': '',
8960								'animation-duration': '',
8961								'animation-delay': '',
8962								'animation-timing-function': '',
8963								'animation-fill-mode': '',
8964								'transition': '',
8965							});
8966						}
8967					});
8968				}
8969			}
8970		}
8971
8972		$('.scroll-top').on('click', function(e){
8973			$.fn.fullpage.moveTo(1);
8974			return false;
8975		});
8976
8977	};
8978
8979	var init_fullPage = function(mode){
8980
8981		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
8982		// 	scrollBar = false;
8983		// }
8984
8985		var checkFPeffects;
8986
8987		$container.fullpage({
8988			sectionSelector: '.uncode-scroll-lock',
8989			scrollOverflow: true,
8990			scrollOverflowOptions: {
8991				click: false,
8992				preventDefaultException: { tagName:/.*/ }
8993			},
8994			navigation: false,
8995			scrollBar: scrollBar,
8996			scrollingSpeed: fp_anim_time,
8997			verticalCentered: true,
8998			anchors: no_history ? false : dataNames,
8999			recordHistory: !no_history,
9000			afterRender: function(){
9001				$('body').removeClass('fp-waiting');
9002				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
9003					var $invisible = $(this).addClass('hidden-scroll');//,
9004				});
9005				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
9006					var $visible = $(this).addClass('uncode-scroll-visible'),
9007						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
9008					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
9009				});
9010
9011				$('ul.onepage-pagination a').on('click', function(e){
9012					e.preventDefault();
9013					var $a = $(this),
9014						toIndex = $a.data('index');
9015
9016					$.fn.fullpage.moveTo(toIndex+1);
9017				});
9018
9019				requestTimeout(function(){
9020					scrollHashes();
9021				}, 1000);
9022
9023				$(window).on('hashchange', function(e){
9024					requestTimeout(function(){
9025						scrollHashes();
9026					}, 500);
9027				});
9028
9029				anchorLink();
9030
9031				if ( $('body').hasClass('uncode-fp-opacity') ) {
9032					$all.each(function(index, row) {
9033						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
9034							classBg;
9035
9036						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
9037							classBg = testmatch[0];
9038							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
9039						}
9040					});
9041				}
9042
9043				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
9044					$(window).on('menuOpen gdprOpen', function(){
9045						$.fn.fullpage.setAutoScrolling(false);
9046					}).on('menuClose gdprClose', function(){
9047						$.fn.fullpage.setAutoScrolling(true);
9048					});
9049				}
9050
9051				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
9052					requestTimeout(function(){
9053						$.fn.fullpage.setAutoScrolling(false);
9054					}, 1000);
9055				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
9056					$.fn.fullpage.setAutoScrolling(true);
9057				});
9058
9059				if ( !UNCODE.isFullPageSnap ) {
9060					clearRequestTimeout(checkFPeffects);
9061					checkFPeffects = requestTimeout(function(){
9062						activateBackWash( 1 );
9063						activateKBurns( 1 );
9064					}, 100);
9065				}
9066
9067			},
9068			onLeave: function( index, nextIndex, direction ){
9069
9070				if ( UNCODE.menuOpened || is_scrolling )
9071					return false;
9072
9073				is_scrolling = true;
9074
9075				var event = new CustomEvent('fp-slide-leave');
9076				window.dispatchEvent(event);
9077
9078				slideLeave( index, nextIndex, direction );
9079
9080				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
9081					if ( direction === 'up' ) {
9082						$.fn.fullpage.moveTo(nextIndex-1);
9083					} else {
9084						$.fn.fullpage.moveTo(nextIndex+1);
9085					}
9086					return false;
9087				}
9088
9089				$('ul.onepage-pagination a').removeClass('is-selected');
9090				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
9091
9092			}
9093		});
9094	};
9095
9096	init_fullPage();
9097	$(window).on('load', function(){
9098		requestTimeout(function(){
9099			$.fn.fullpage.reBuild();
9100		}, 3000);
9101	});
9102
9103	var addScrollingClass,
9104		removeScrollingClass;
9105
9106	window.addEventListener("fp-slide-scroll", function(){
9107		addScrollingClass = requestTimeout( function(){
9108			$('body').addClass('fp-slide-scrolling');
9109		}, 10 );
9110
9111		clearRequestTimeout(removeScrollingClass);
9112		removeScrollingClass = requestTimeout( function(){
9113			$('body').removeClass('fp-slide-scrolling');
9114		}, 150 );
9115
9116		Waypoint.refreshAll();
9117	}, false);
9118
9119	var setFPheight = function(){
9120		var $body = document.body,
9121			$footer = document.getElementById('colophon'),
9122			$maincontainer = document.querySelector('.main-wrapper'),
9123			$boxcontainer = document.querySelector('.box-container'),
9124			$sections = document.querySelectorAll('.fp-section'),
9125			rect = $maincontainer.getBoundingClientRect(),
9126			rect2 = $boxcontainer.getBoundingClientRect(),
9127			$masthead = document.getElementById('masthead'),
9128			_hideMenu = false,
9129			menuHeight = UNCODE.menuHeight;
9130		$body.style.height = UNCODE.wheight + 'px';
9131
9132		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
9133			_hideMenu = true;
9134		}
9135		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
9136			menuHeight = 0
9137		}
9138
9139
9140		if ( theres_footer )
9141			$footer.style.top = (rect.height || rect2.height) + 'px';
9142
9143		for (var i = 0; i < $sections.length; i++) {
9144			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
9145		}
9146	};
9147
9148	setFPheight();
9149
9150	window.addEventListener('resize', setFPheight, false);
9151	window.addEventListener('orientationchange', setFPheight, false);
9152
9153};
9154
9155UNCODE.particles = function() {
9156	$(".vc-particles-background").each(function() {
9157		var $particle = $(this);
9158		var $parent = $particle.closest('[data-parent]');
9159
9160		$parent.prepend($particle);
9161		// $(window).trigger('resize');
9162	})
9163};
9164
9165
9166UNCODE.readMoreCol = function( $el ){
9167	if ( typeof $el === 'undefined' || $el === null ) {
9168		$el = $('body');
9169	}
9170	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
9171	$readMoreCols.each(function(){
9172		var $uncont = $(this),
9173			$row = $uncont.closest('.row-container'),
9174			max_h = $uncont.attr('data-ov-height'),
9175			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
9176			actual_max_h = $uncont.outerHeight(),
9177			inner_h,
9178			$read_more = $('+ .btn-more-wrap', $uncont),
9179			read_more_resize = $read_more.hasClass('trigger-resize'),
9180			marginClosedBtn = $uncont.attr('data-margin-closed'),
9181			marginClosed = 0,
9182			marginOpenBtn = $uncont.attr('data-margin-open'),
9183			marginOpen = 0,
9184			anim_t = 250,
9185			resized = false;
9186
9187		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
9188
9189		switch (marginClosedBtn) {
9190			case 'sm':
9191				marginClosed = 18
9192				break;
9193				
9194			case 'std':
9195				marginClosed = 36
9196				break;
9197				
9198			case 'lg':
9199				marginClosed = 72
9200				break;
9201				
9202			case '':
9203			default:
9204				marginClosed = 0
9205				break;
9206				
9207		}
9208
9209		switch (marginOpenBtn) {
9210			case 'sm':
9211				marginOpen = 18
9212				break;
9213				
9214			case 'std':
9215				marginOpen = 36
9216				break;
9217				
9218			case 'lg':
9219				marginOpen = 72
9220				break;
9221				
9222			case 'no':
9223				marginOpen = 0
9224				break;
9225				
9226		}
9227
9228		var checkToggleMobile = function(){
9229			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
9230				resized = true;
9231				if ( $read_more.hasClass('state-closed') ) {
9232					$uncont[0].style.height = '';
9233					$uncont[0].style.maxHeight = max_h_mobile;
9234				}
9235			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
9236				if ( $read_more.hasClass('state-closed') ) {
9237					$uncont[0].style.height = '';
9238					$uncont[0].style.maxHeight = max_h;
9239				}
9240				resized = false;
9241			}
9242		}
9243		checkToggleMobile();
9244		$(window).on('resize', function() {
9245			checkToggleMobile();
9246		});
9247
9248		$('a', $read_more).on('click', function(e){
9249			e.preventDefault();
9250
9251			var $a = $(this);
9252
9253			if ( $read_more.hasClass('state-closed') ) {
9254
9255				$read_more
9256					.removeClass('state-closed')
9257					.addClass('state-open');
9258
9259				$uncont.css({
9260					'max-height': 'none',
9261					'height': 'auto',
9262				});
9263	
9264				inner_h = parseFloat( $uncont.outerHeight() );
9265
9266				$uncont.css({
9267					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
9268				});
9269		
9270				anim_t = inner_h - actual_max_h;
9271				if ( anim_t < 250 ) {
9272					anim_t = 250;
9273				} else if ( anim_t > 1000 ) {
9274					anim_t = 1000;
9275				}
9276
9277				$uncont.css({
9278					'transition-duration' : anim_t + 'ms'
9279				}).addClass('overflow-mask-animation').animate({
9280					'height': inner_h
9281				}, anim_t, 'easeInOutCubic', function(){
9282					$uncont.css({
9283						'height' : 'auto'
9284					}).removeClass('overflow-mask');
9285					if ( read_more_resize === true ) {
9286						window.dispatchEvent(new Event('resize'));
9287						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
9288							ScrollTrigger.refresh(true);
9289						}
9290					}
9291				});
9292
9293				if ( marginOpen != '' ) {
9294					$read_more.animate({
9295						'margin-top' : marginOpen
9296					}, anim_t, 'easeInOutCubic');
9297				}
9298
9299			} else {
9300				$read_more
9301					.removeClass('state-open')
9302					.addClass('state-closed');
9303
9304				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
9305					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
9306				}, anim_t, 'easeInOutCubic', function(){
9307					if ( read_more_resize === true ) {
9308						window.dispatchEvent(new Event('resize'));
9309						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
9310							ScrollTrigger.refresh(true);
9311						}
9312					}
9313				});
9314
9315				if ( marginClosed !== '' ) {
9316					$read_more.animate({
9317						'margin-top' : marginClosed
9318					}, anim_t, 'easeInOutCubic');
9319				}
9320
9321				if ( $a.hasClass('toggle-scroll') ) {
9322                    var $masthead = $('#masthead > div:first-child'),
9323                        headH = $masthead.outerHeight(),
9324						rectTop = $row[0].getBoundingClientRect().top,
9325						checkNavBar = $a.hasClass('toggle-navbar'),
9326						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
9327                        offCont = ( $row.offset().top );
9328
9329					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
9330						checkNavBar = checkNavBarMobile;
9331					}
9332
9333					if ( checkNavBar ) {
9334						offCont = offCont - headH;
9335					}
9336			
9337					if ( rectTop < headH ) {
9338						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
9339							$(this).stop();
9340						}).animate({
9341							scrollTop: offCont
9342						}, anim_t, 'easeInOutCubic');
9343					}
9344				}
9345
9346			}
9347		});
9348	});
9349}
9350UNCODE.filters = function() {
9351	var $systems = $('.isotope-system, .cssgrid-system');
9352
9353	$systems.each(function(index, val){
9354		var $system = $(this),
9355			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
9356			$widgets = $('.widgetized-cb-wrapper', $system),
9357			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
9358			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
9359			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
9360			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
9361
9362		if ($system.hasClass('isotope-processed')) {
9363			return;
9364		}
9365
9366		$cats_trigger.on('click', function(e) {
9367			if ( ! $('html').hasClass('screen-sm') ) {
9368				// $widgets.add($sorting_dd).slideUp(400);
9369				e.preventDefault();
9370				$widgets.slideUp(400, 'easeInOutCirc');
9371			}
9372		});
9373
9374		$('.filters-toggle-trigger', $system).on('click', function(e) {
9375			e.preventDefault();
9376			var $filters = $('.isotope-filters .menu-horizontal', $system);
9377			$filters.slideToggle(400, 'easeInOutCirc');
9378			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
9379		});
9380
9381		$widget_trgr.on('click', function(e) {
9382			e.preventDefault();
9383			$widgets.slideToggle(400, 'easeInOutCirc');
9384			if (!$('html').hasClass('screen-sm')) {
9385				$cats_filters.slideUp(400, 'easeInOutCirc');
9386			}
9387			window.dispatchEvent(new CustomEvent('boxResized'));
9388		});
9389
9390		$sorting_trgr.on('click', function(e) {
9391			e.preventDefault();
9392			if (!$('html').hasClass('screen-sm')) {
9393				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
9394			}
9395		});
9396
9397		$system.addClass('isotope-processed');
9398	});
9399
9400};
9401
9402UNCODE.widgets = function() {
9403	var widget_collapses = $('.widget-collapse');
9404
9405	widget_collapses.each(function(){
9406		var widget_collapse = $(this),
9407			widget_title = widget_collapse.find('.widget-title'),
9408			widget = widget_title.closest('.widget'),
9409			content = widget.children().not('.widget-title'),
9410			setCTA;
9411
9412		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
9413			widget_title.toggleClass('open');
9414		}
9415
9416		widget_title.each(function() {
9417			var _this = $(this);
9418			var content = _this.closest('.widget').find('.widget-collapse-content');
9419
9420			$(window).on('load resize', function(){
9421				clearRequestTimeout(setCTA);
9422				setCTA = requestTimeout( function() {
9423					if ( content.is(':visible') ) {
9424						_this.addClass( 'open' );
9425					} else {
9426						_this.removeClass( 'open' );
9427					}
9428				}, 10 );
9429			})
9430
9431			_this.on( 'click', function(){
9432
9433				// Get content of :after element (+ icon) to check the visibility
9434				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
9435
9436				if (icon_content === 'none' || !icon_content) {
9437					return false;
9438				}
9439
9440				_this.toggleClass('open');
9441				var isOpen = _this.hasClass('open'),
9442					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
9443				content.animate({
9444					height: 'toggle',
9445					padding: 'toggle',
9446					opacity: 'toggle',
9447					top: isOpen ? 0 : hasBorder
9448				}, {
9449					duration: 400,
9450					easing: "easeInOutCirc",
9451				});
9452
9453				return false;
9454
9455			});
9456		});
9457	});
9458
9459	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
9460};
9461
9462UNCODE.unmodal = function() {
9463	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
9464		$('.unmodal-overlay').fadeIn();
9465		$('.unmodal-overlay').addClass('loading');
9466		$('body').addClass('uncode-unmodal-overlay-visible');
9467		$(window).trigger('unmodal-open');
9468	});
9469
9470	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
9471		$('.unmodal-overlay').fadeOut();
9472		$('.unmodal').fadeOut();
9473		$('body').removeClass('uncode-unmodal-overlay-visible');
9474		$('body').removeClass('uncode-unmodal-open');
9475		$('html').removeClass('uncode-unmodal-body-disable-scroll');
9476		$(document).trigger('unmodal-close');
9477		UNCODE.isUnmodalOpen = false;
9478	});
9479
9480	$(document).on('uncode-unmodal-show-content', function() {
9481		$('.unmodal-overlay').removeClass('loading');
9482		$('.unmodal').show();
9483		$('.unmodal').addClass('show-unmodal-with-animation');
9484		$('.unmodal-content')[0].scrollTop = 0;
9485		$('body').addClass('uncode-unmodal-open');
9486		UNCODE.isUnmodalOpen = true;
9487
9488		if ($('body').hasClass('qw-body-scroll-disabled')) {
9489			$('html').addClass('uncode-unmodal-body-disable-scroll');
9490		}
9491
9492		if ($('.unmodal').hasClass('auto-height')) {
9493			set_modal_height();
9494		}
9495	});
9496
9497	var set_modal_height = function() {
9498		var modal = $('.unmodal').css({height: 'auto'});
9499		var window_height = $(window).outerHeight();
9500		var modal_height = modal.outerHeight();
9501
9502		modal.css('height', 'auto');
9503
9504		if (modal_height > window_height) {
9505			modal.outerHeight(window_height);
9506		}
9507	}
9508
9509	if ($('.unmodal').hasClass('auto-height')) {
9510		var setCTA;
9511
9512		$(window).on('resize', function() {
9513			clearRequestTimeout(setCTA);
9514			setCTA = requestTimeout(function() {
9515				set_modal_height();
9516			}, 100);
9517		});
9518	}
9519};
9520
9521UNCODE.bgChanger = function() {
9522	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
9523		$bg_first = $('.vc_row[data-bg-remove]'),
9524		bg_remove = $bg_first.attr('data-bg-remove'),
9525		$first = $bg_changers.first(),
9526		$last = $bg_changers.last(),
9527		$bg_wrapper = $('#changer-back-color'),
9528		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
9529		setCTA, localH = UNCODE.wheight,
9530		isScrolling;
9531
9532	$bg_first.removeClass(bg_remove);
9533
9534	var bgChange = function($col, bgColor, skin, tmbskin){
9535		$bg_wrapper.attr( 'class', bgColor );
9536		var menuskin;
9537		if ( typeof skin !== 'undefined' ) {
9538			menuskin = skin.replace('style', 'menu')
9539		}
9540
9541		if ( $col.length ) {
9542			$('.uncol[data-skin-change]').each(function(){
9543				var $isoFooter = $('.isotope-footer', this);
9544				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
9545				if ( menuskin !== '' ) {
9546					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
9547				}
9548			});
9549
9550			$('.tmb[data-skin-change]').each(function(){
9551				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
9552			});
9553		}
9554	};
9555
9556	var $masthead = $('#masthead'),
9557		transDesktop,
9558		transMobile,
9559		changeSkin,
9560
9561	checkTransparencyAndChange = function( skin ){
9562		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
9563		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
9564		changeSkin = $masthead.hasClass('menu-change-skin');
9565
9566		if ( ! transDesktop && ! transMobile ) {
9567			return false;
9568		}
9569
9570		if ( ! changeSkin ) {
9571			return false;
9572		}
9573
9574		if ( skin === 'style-light' ){
9575			$masthead.removeClass('style-dark-override').addClass('style-light-override');
9576			return false;
9577		} else if ( skin === 'style-dark' ) {
9578			$masthead.removeClass('style-light-override').addClass('style-dark-override');
9579			return false;
9580		}
9581	};
9582
9583	var bg_waypoints = function(){
9584		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
9585
9586			$.each($bg_changers, function(index, row) {
9587
9588				var $row = $(row),
9589					$col = $('.uncol[data-skin-change]', $row).eq(0),
9590					skin,
9591					$tmbs,
9592					tmbskin,
9593					bgColor = $row.attr('data-bg-color');
9594
9595				if ( ! $row.is(':visible') ) {
9596					return false;
9597				}
9598
9599				if ( $col.length ) {
9600					skin = $col.attr('data-skin-change');
9601					$tmbs = $('.tmb[data-skin-change]', $row);
9602					tmbskin = skin.replace('style', 'tmb');
9603				}
9604
9605				if ( ! $row.hasClass('unscroll-horizontal') ) {
9606					$row.waypoint(function( dir ) {
9607						if ( dir === 'down' ) {
9608							bgChange($col, bgColor, skin, tmbskin);
9609							checkTransparencyAndChange(skin);
9610						} else {
9611							return;
9612						}
9613					}, {
9614						offset: '50%'
9615		  			});
9616
9617					$row.waypoint(function( dir ) {
9618						if ( dir === 'up' ) {
9619							bgChange($col, bgColor, skin, tmbskin);
9620							checkTransparencyAndChange(skin);
9621						} else {
9622							return;
9623						}
9624					}, {
9625						offset: function() {
9626							var clH = this.element.clientHeight,
9627								wH = window.innerHeight,
9628								ret = clH > 200 ? -100 : clH * -0.5;
9629							return ( wH / 2 ) - clH;
9630						}
9631					});
9632				}
9633
9634			});
9635
9636			$('body').addClass('bg-changer-init');
9637
9638		}
9639	};
9640
9641	var body = document.body,
9642	edges = false;
9643
9644	var throttle = function(fn, wait) {
9645		var time = Date.now();
9646		return function() {
9647			if ((time + wait - Date.now()) < 0) {
9648				fn();
9649				time = Date.now();
9650			}
9651		}
9652	}
9653
9654	var $wrapper = document.querySelector(".main-wrapper"),
9655		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
9656
9657	var $title = document.querySelector('#rotating');
9658	if ( $title !== null ) {
9659		$title.style.whiteSpace = 'nowrap';
9660		$title.style.transition = 'transform 200ms linear';
9661	}
9662
9663	window.addEventListener( 'scroll', throttle( function() {
9664		window.clearRequestTimeout( isScrolling );
9665
9666		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
9667
9668			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
9669				body = document.body,
9670				html = document.documentElement,
9671				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9672				$row = false,
9673				firstOff,
9674				lastOff;
9675
9676			if ( scrolled < 100 && $first.length ) {
9677				firstOff = $first.offset().top;
9678				if ( firstOff < 100 ) {
9679					var $row = $first;
9680				}
9681			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
9682				lastOff = $last.offset().top + $last.outerHeight();
9683				if ( lastOff > ( docH - 100 ) ) {
9684					var $row = $last;
9685				}
9686			}
9687
9688			if ( $row.length ) {
9689				var $col = $('.uncol[data-skin-change]', $row).eq(0),
9690					skin,
9691					$tmbs,
9692					tmbskin,
9693					bgColor = $row.attr('data-bg-color');
9694
9695				if ( $col.length ) {
9696					skin = $col.attr('data-skin-change');
9697					$tmbs = $('.tmb[data-skin-change]', $row);
9698					tmbskin = skin.replace('style', 'tmb');
9699				}
9700
9701				bgChange($col, bgColor, skin, tmbskin);
9702				checkTransparencyAndChange(skin);
9703				edges = true;
9704			}
9705
9706		}, 150);
9707
9708		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
9709			bg_waypoints();
9710			Waypoint.refreshAll();
9711			edges = false;
9712		}
9713
9714	}, 100), false);
9715
9716	$(window).on('resize', function() {
9717		clearRequestTimeout(setCTA);
9718		setCTA = requestTimeout(function() {
9719			if ( localH != UNCODE.wheight ) {
9720				localH = UNCODE.wheight;
9721				bg_waypoints();
9722				Waypoint.refreshAll();
9723			}
9724		}, 100);
9725	});
9726
9727	bg_waypoints();
9728
9729};
9730
9731UNCODE.skewIt = function() {
9732
9733	if ( $('body').hasClass('compose-mode') ) {
9734		return;
9735	}
9736
9737	var justscrolled = false;
9738
9739	var loadSkewIt = function(){
9740
9741		var $pageHeader = $('#page-header'),
9742			$page_body = $('.page-body'),
9743			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
9744
9745		if ( $header_skew.length ) {
9746			$pageHeader.addClass('uncode-skew').css({
9747				position: 'relative',
9748				zIndex: 1
9749			});
9750			$header_skew.removeClass('uncode-skew');
9751			$page_body.css({
9752				position: 'relative',
9753				zIndex: 0
9754			});
9755		}
9756
9757		var $skew = $('.uncode-skew'),
9758			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
9759			horizontal = $horizontal.length,
9760			stopSkewing,
9761			lastOffset = 0,
9762			lastDate = Date.now();
9763
9764		if ( ! $skew.length ) {
9765			return;
9766		}
9767
9768		var dropSkew = function(){
9769			if ( UNCODE.wwidth < UNCODE.mediaQuery )
9770				return;
9771
9772			$skew.each(function(){
9773				var $this = $(this),
9774					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9775
9776				if ( $drop.length ) {
9777					$this.css({
9778						'transform': 'skew(0)'
9779					});
9780					var bound = $this[0].getBoundingClientRect();
9781					$drop.css({
9782						left: bound.x * -1,
9783						top: bound.y * -1,
9784					});
9785				}
9786			});
9787		};
9788		dropSkew();
9789
9790		$(window).on('resize', dropSkew);
9791
9792		window.addEventListener( 'scroll', function() {
9793
9794			if ( justscrolled !== true ) {
9795				justscrolled = true;
9796				return;
9797			}
9798
9799			window.clearRequestTimeout( stopSkewing );
9800
9801			var now = Date.now(),
9802				delayInMs = now - lastDate,
9803				offset = window.pageYOffset || window.document.documentElement.scrollTop,
9804				newOffset = offset - lastOffset,
9805				speed = Math.pow((newOffset / delayInMs), 3) * -1,
9806				body = document.body,
9807				html = document.documentElement,
9808				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9809				wait = 50,
9810				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
9811
9812			if ((lastDate + wait - now) < 0) {
9813
9814				lastDate = now;
9815				lastOffset = offset;
9816
9817				if ( speed > 6 ) {
9818					speed = 6;
9819				} else if ( speed < -6 ) {
9820					speed = -6;
9821				}
9822
9823				if ( speed > 2 && offset < UNCODE.wheight ) {
9824					speed = 2;
9825				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
9826					speed = -2;
9827				}
9828
9829				var speedY = speed,
9830					speedX = speed * 1.25;
9831
9832				if ( horizontal ) {
9833					speedY = 0;
9834					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9835						speedX = 0;
9836						return;
9837					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
9838						speedX = 0;
9839						return;
9840					}
9841				} else {
9842					speedX = 0;
9843				}
9844
9845				if ( ! $skew.closest('.enter-st').length ) {
9846					speedX = 0;
9847				}
9848
9849				gsap.killTweensOf($skew);
9850				gsap.to( $skew, {
9851					duration: 0.2,
9852					skewY: (speedY * maxSpeed) + "deg",
9853					skewX: (speedX * maxSpeed) + "deg",
9854					ease: Power0.easeNone,
9855					transformOrigin: 'center',
9856				});
9857
9858			}
9859
9860			stopSkewing = requestTimeout(function() {
9861				gsap.killTweensOf($skew);
9862				gsap.to( $skew, {
9863					duration: 0.5,
9864					skewY: "0deg",
9865					skewX: "0deg",
9866					transformOrigin: 'center',
9867					ease: Expo.easeOut,
9868				});
9869
9870				$skew.each(function(){
9871					var $this = $(this),
9872						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9873
9874					if ( $drop.length ) {
9875						var bound = $this[0].getBoundingClientRect()
9876						$drop.css({
9877							left: bound.x * -1,
9878							top: bound.y * -1,
9879						});
9880					}
9881				});
9882
9883			}, 200);
9884
9885		}, false);
9886
9887	};
9888
9889	$(window).on('load', loadSkewIt);
9890
9891};
9892
9893UNCODE.rotateIt = function() {
9894
9895	if ( $('body').hasClass('compose-mode') ) {
9896		return;
9897	}
9898
9899	var frameRotate = false;
9900	var loadRotateIt = function(){
9901
9902		var $toRotate = $('.uncode-rotate');
9903
9904		$toRotate.each(function(){
9905			var $rotate = $(this),
9906				deg = 0,
9907				dir = true,
9908				coeff = 1,
9909				lastOffset = 0,
9910				lastDate = Date.now();
9911
9912			var checkScroll = function($rotate){
9913				// if ( ! $rotate.length ) {
9914				// 	return;
9915				// }
9916
9917				var now = Date.now(),
9918					delayInMs = now - lastDate,
9919					offset = window.pageYOffset || window.document.documentElement.scrollTop,
9920					newOffset = offset - lastOffset,
9921					speed = (newOffset / delayInMs) * 5,
9922					body = document.body,
9923					html = document.documentElement,
9924					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
9925
9926				lastDate = now;
9927				lastOffset = offset;
9928
9929				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
9930					deg = 0;
9931				}
9932
9933				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
9934					deg = parseFloat(deg) + parseFloat(speed);
9935				}
9936
9937				if ( $rotate.hasClass('uncode-rotate-hover') ) {
9938					$rotate.hover(function(){
9939						coeff = 1.75;
9940					}, function(){
9941						coeff = 1;
9942					});
9943				}
9944
9945				// if ( speed > 0 ) {
9946				// 	dir = true
9947				// } else if ( speed < 0 ) {
9948				// 	dir = false
9949				// }
9950
9951				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
9952					deg = deg+coeff;
9953					// if ( dir ) {
9954					// 	deg = deg+coeff;
9955					// } else {
9956					// 	deg = deg-coeff;
9957					// }
9958				}
9959
9960				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9961					return false;
9962				}
9963				
9964				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
9965					var undeg = deg*-1;
9966					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
9967				} else {
9968					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
9969				}
9970
9971				requestAnimationFrame(function() {
9972					if ( frameRotate === true ) {
9973						frameRotate = false;
9974						return;
9975					}
9976					checkScroll($rotate);
9977				});
9978			};
9979
9980			checkScroll($rotate);
9981
9982		});
9983
9984	};
9985
9986	$(window).on('load', loadRotateIt);
9987
9988	var checkRotate;
9989	var resizeRotate = function(){
9990		var $inlineRotates = $('.inline-rotate');
9991		$inlineRotates.each(function(){
9992			$(this).addClass('inline-rotate-standby');
9993		});
9994		clearTimeout(checkRotate);
9995		checkRotate = setTimeout(function(){
9996			$('.inline-rotate').each(function(){
9997				$(this).removeClass('inline-rotate-standby');
9998				frameRotate = true;
9999			});
10000			loadRotateIt();
10001		}, 500);
10002	};
10003
10004	$(window).off('resize.inline-rotate', resizeRotate)
10005	.on('resize.inline-rotate', resizeRotate);
10006
10007};
10008
10009var marqueeAttempts = 0,
10010	marqueeTO,
10011	marqueeCheckResize,
10012	initMarquee;
10013
10014UNCODE.textMarquee = function( $titles ) {
10015
10016	var isInitMarque = false;
10017
10018	var initTextMarquee = function( $titles ){
10019
10020		if ( typeof $titles == 'undefined' ) {
10021			$titles = $('.un-text-marquee');
10022		}
10023
10024		if ( ! $titles.length ) {
10025			return;
10026		}
10027
10028		isInitMarque = true;
10029
10030		var stableHeight = UNCODE.wheight;
10031
10032		$titles.each(function(){
10033			var $title = $(this),
10034				$span = $('> span, > i > span', $title),
10035				txt,
10036				first = true,
10037				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
10038				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
10039				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
10040				hasSticky = false,
10041				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
10042				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
10043				newW = UNCODE.wwidth,
10044				marqueeTL, inview,
10045				isInMenu = $title.closest('.megamenu-block-wrapper').length;
10046
10047			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
10048				hasSticky = true;
10049				dataTrigger = 'row';
10050			}
10051
10052			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
10053				dataNavBar = dataNavBarMobile;
10054			}
10055
10056			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
10057			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
10058			var dataX = dataSpeed;
10059
10060			dataSpeed += 5;
10061
10062			$('.marquee-clone-wrap', $title).remove();
10063
10064			txt = $span.html();
10065
10066			if ( ! $('.marquee-original-core', $span).length ) {
10067				txt = $span.html();
10068				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
10069			} else {
10070				txt = $('.marquee-original-core', $span).html();
10071			}
10072
10073			var spanW,
10074				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
10075				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
10076				speed = 10 - dataSpeed;
10077
10078			$span.prepend($prepended);
10079			$span.append($appended);
10080
10081			var continuousTextMarquee = function () {
10082				var bound = $title
10083						.css({
10084							transform: "none",
10085							opacity: 0,
10086						})
10087						.offset(),
10088					ease = "none";
10089
10090				var xStrt =
10091						first || $title.hasClass("un-marquee-infinite")
10092							? 0
10093							: UNCODE.wwidth - bound.left,
10094					xEnd = $title.hasClass("un-marquee-infinite")
10095						? spanW
10096						: spanW + bound.left,
10097					xSpeed =
10098						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
10099						dataSpeed,
10100					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
10101					speedSlow = (xEnd + xStrt) / 45,
10102					transFormVal,
10103					translX;
10104
10105				marqueeTL = new TimelineMax({ paused: true, reversed: true });
10106				marqueeTL.play();
10107
10108				var inViewElement =
10109						dataTrigger === "row" ? ( hasSticky ? $title.closest('.sticky-trigger, .sticky-element').parent()[0] : $title.closest(".vc_row")[0] ) : $title[0],
10110					wayOff =
10111						dataTrigger === "row" && dataNavBar === "yes"
10112							? UNCODE.menuHeight
10113							: 0;
10114
10115				if ( isInMenu ) {
10116					$(document).on('un-menu-show.marquee', function(e, $ul){
10117						marqueeTL.restart();
10118					});
10119					$(document).on('un-menu-hide.marquee', function(e, $ul){
10120						marqueeTL.pause();
10121					});
10122				} else {
10123					inview = new Waypoint.Inview({
10124						element: inViewElement,
10125						offset: wayOff,
10126						enter: function (direction) {
10127							marqueeTL.play();
10128						},
10129						exited: function (direction) {
10130							if (!$title.closest(".pin-spacer").length) {
10131								marqueeTL.pause();
10132							}
10133						},
10134					});
10135				}
10136
10137				if ($title.hasClass("un-marquee-hover")) {
10138					var $column = $title.closest(".wpb_column"),
10139						$col_link = $(".col-link", $column),
10140						$hover_sel = $title;
10141
10142					if ($col_link.length) {
10143						$hover_sel = $title.add($column);
10144					}
10145					$hover_sel
10146						.on("mouseover", function () {
10147							ease = "power2.out";
10148							transFormVal = $title.css("transform").split(/[()]/)[1];
10149							translX = transFormVal.split(",")[4];
10150							speedSlow = (xEnd + (xStrt - translX)) / 45;
10151							marqueeTL.duration(speedSlow);
10152						})
10153						.on("mouseout", function () {
10154							ease = "power2.in";
10155							transFormVal = $title.css("transform").split(/[()]/)[1];
10156							translX = transFormVal.split(",")[4];
10157							speedSlow =
10158								((xEnd + (xStrt - translX)) /
10159									(dataSpeed * dataSpeed * dataSpeed) /
10160									5) *
10161								dataSpeed;
10162							marqueeTL.duration(speedSlow);
10163						});
10164				}
10165		
10166				gsap.killTweensOf($title);
10167				marqueeTL.fromTo( $title, {
10168					opacity: 1,
10169					x: xStrt * direction * -1
10170				},
10171				{
10172					duration: xSpeed,
10173					x: xEnd * direction,
10174					onComplete: function(){
10175						first = false;
10176						if ( isInMenu ) {
10177							marqueeTL.restart();
10178						} else {
10179							continuousTextMarquee();
10180						}
10181					},
10182					onUpdate: function(){
10183						if ( ! $title[0].isConnected ) {
10184							marqueeTL.kill();
10185							initTextMarquee();
10186						}
10187					},
10188					ease: ease
10189				});
10190		
10191			};
10192			
10193			var runTextMarquee = function(){
10194				var time = Date.now();
10195
10196				var textMarqueeScroll = function(){
10197					var $row = $title.closest('.vc_row');
10198					if ( hasSticky ) {
10199						$row = $title.closest('.sticky-trigger, .sticky-element').parent();
10200					}					
10201					var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
10202
10203					if ( !$bound.length ) {
10204						return;
10205					}
10206
10207					var bound = $bound[0].getBoundingClientRect(),
10208						wait = 100,
10209						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
10210						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
10211
10212					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
10213						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
10214						marqueeAttempts < 2 ) {
10215
10216						clearRequestTimeout(marqueeTO);
10217
10218						marqueeTO = requestTimeout(function(){
10219							marqueeAttempts++;
10220							initTextMarquee();
10221						}, 100);
10222					}
10223
10224
10225					var bound_top = bound.top,
10226						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
10227
10228					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
10229						if ( dataTrigger === 'row-middle' ) {
10230							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5)
10231						}
10232						if ( dataNavBar === 'yes' ) {
10233							bound_top = bound_top - UNCODE.menuHeight;
10234						}
10235						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
10236					}
10237
10238					gsap.killTweensOf($title);
10239					gsap.to( $title, {
10240						duration: 0.24,
10241						x: gsap_calc,
10242					});
10243				};
10244
10245				textMarqueeScroll();
10246				$(window).on( 'load scroll', function(e) {
10247					textMarqueeScroll();
10248				});
10249
10250			};
10251
10252			var cloneSpan = function($_title, cntnt){
10253
10254				if ( $_title.hasClass('un-marquee-infinite') ) {
10255					$('> span.marquee-clone-wrap', $_title).text('');
10256				}
10257
10258				gsap.to( $_title, {
10259					duration: 0,
10260					x: 0
10261				});
10262				spanW = $span.outerWidth();
10263
10264
10265				if ( !spanW ) {
10266					return;
10267				}
10268
10269				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
10270					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
10271
10272				if ( $_title.hasClass('un-marquee-infinite') ) {
10273
10274					for ( var i = 0; i < part; i++ ) {
10275						$prepended.append(cntnt + spaceSpan);
10276						$appended.append(cntnt + spaceSpan);
10277					}
10278				}
10279
10280				if ( $('body').hasClass('compose-mode') ) {
10281					$('.uncode_fe_safe').remove();
10282					return;
10283				}
10284
10285				if ( $title.closest('.marquee-freezed').length ) {
10286					return;
10287				}
10288
10289				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
10290					continuousTextMarquee();
10291				}
10292
10293				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
10294					runTextMarquee();
10295				}
10296
10297			};
10298
10299			var marqueeResize = function(e){
10300				if ( isInMenu ) {
10301					return;
10302				}
10303				var tOut = 1000;
10304				if ( isInMenu ) {
10305						gsap.killTweensOf($title);
10306						if ( typeof inview !== 'undefined' && inview !== null ) {
10307							inview.destroy();
10308						}
10309						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
10310							marqueeTL.kill();
10311						}
10312						first = true;
10313						initTextMarquee();
10314				} else {
10315					clearRequestTimeout(marqueeCheckResize);
10316					marqueeCheckResize = requestTimeout(function(){
10317						if ( newW !== UNCODE.wwidth ) {
10318							gsap.killTweensOf($title);
10319							if ( typeof inview !== 'undefined' && inview !== null ) {
10320								inview.destroy();
10321							}
10322							if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
10323								marqueeTL.kill();
10324							}
10325							first = true;
10326							initTextMarquee();
10327							newW = UNCODE.wwidth;
10328						}
10329					}, tOut);
10330				}
10331			};
10332
10333			$(window).off('resize', marqueeResize)
10334			.on( 'resize', marqueeResize);
10335			$(window).off('uncode.re-layout', marqueeResize)
10336			.on( 'uncode.re-layout', marqueeResize);
10337
10338			cloneSpan($title, txt);
10339
10340			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10341				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
10342					var $_titles = $('.un-text-marquee',e.view.$el);
10343					clearRequestTimeout(marqueeCheckResize);
10344					marqueeCheckResize = requestTimeout(function(){
10345						initTextMarquee($_titles);
10346					}, 1000);
10347				});
10348			}
10349		});
10350
10351		$(window).on( 'load wwResize', function(e) {
10352			stableHeight = UNCODE.wheight;
10353		});
10354
10355	};
10356
10357	document.addEventListener("DOMContentLoaded", function() {
10358		if ( isInitMarque !== true ) {
10359			initTextMarquee();
10360		}
10361	});
10362
10363	$(window).on('focus load resize',function(){
10364		clearTimeout(initMarquee);
10365		initMarquee = setTimeout(function(){
10366			if ( isInitMarque !== true ) {
10367				initTextMarquee();
10368			}
10369		}, 500);
10370	});
10371	
10372	$(document).on('pumAfterOpen pumAfterClose uncode-scrolltrigger-refresh', function(args){
10373			initTextMarquee();
10374	});
10375
10376};
10377	
10378UNCODE.parallax = function() {
10379	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
10380		if ($('.parallax-el').length > 0) {
10381			var parallax_elements = new Rellax('.parallax-el');
10382			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
10383			window.addEventListener('boxResized', function(e) {
10384				parallax_elements.refresh();
10385			}, false);
10386			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
10387				requestTimeout(function() {
10388					parallax_elements.refresh();
10389				}, 100);
10390			});
10391
10392			if ( typeof UNCODE.hDoc === 'undefined' ) {
10393				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
10394					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
10395			}
10396		
10397			function paralraf(time) {
10398				requestAnimationFrame(paralraf)
10399		
10400				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
10401					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
10402				
10403				if ( UNCODE.hDoc !== newHdoc ) {
10404					UNCODE.hDoc = newHdoc;
10405					parallax_elements.refresh();
10406				}
10407			}
10408		
10409			requestAnimationFrame(paralraf)
10410		
10411		}
10412	}
10413};
10414
10415UNCODE.magicCursor = function(){
10416	var $customCursor = $('#uncode-custom-cursor'),
10417		$customPilot = $('#uncode-custom-cursor-pilot'),
10418		$tooltip = $('.title-tooltip', $customCursor),
10419		$cursorSpan = $('> span', $tooltip),
10420		currentBg = false,
10421		fromTitle = false,
10422		setTime,
10423		mouseEvent;
10424
10425		var spanW, spanH,
10426		maxW = false;
10427
10428	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
10429		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
10430			$tooltip.css({opacity: 0});
10431			delayt_time += 400;
10432		}
10433		clearRequestTimeout(setTime);
10434		setTime = requestTimeout(function() {
10435
10436			$tooltip.css({opacity: ''});
10437
10438			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
10439
10440			if ( cursorTitle !== '' ) {
10441				if ( fromTitle && dataTitle === 'boing' ) {
10442					setTimeout(function(){
10443						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
10444					}, 5);
10445				}
10446				$cursorSpan.attr('class', fontClass).html( cursorTitle );
10447			} else {
10448				if ( cursorType !== 'auto' ) {
10449					$cursorSpan.html('');
10450				}
10451			}
10452
10453			$cursorSpan.addClass('in-tooltip');
10454
10455			$customCursor.attr('data-cursor', cursorType);
10456
10457			if ( fromTitle ) {
10458				$customCursor.addClass('from-tooltip-title');
10459			} else {
10460				$customCursor.removeClass('from-tooltip-title');
10461			}
10462
10463			if ( cursorBg !== false ) {
10464				$customCursor.attr('data-bg', 'transparent');
10465			} else {
10466				$customCursor.removeAttr('data-bg');
10467			}
10468
10469			currentBg = cursorBg;
10470
10471			if ( cursorTitle !== '' ) {
10472				fromTitle = true;
10473				$customCursor.attr('data-cursor', cursorType);
10474				$customCursor.attr('data-title', 'true');
10475				$cursorSpan.css({width: ''});
10476			} else {
10477				fromTitle = false;
10478				$customCursor.removeAttr('data-title');
10479			}
10480			spanW = $cursorSpan.outerWidth();
10481			
10482			if ( spanW >= maxW && maxW !== false ) {
10483				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
10484				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
10485					width: maxW
10486				});
10487				spanW = maxW;
10488			} else {
10489				$customCursor.find('> span:first-child').removeClass('max-width');
10490			}
10491			spanH = $cursorSpan.outerHeight();
10492			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
10493				$customCursor.find('> span:first-child').add($tooltip).css({
10494					width: spanW,
10495					height: spanH
10496				});
10497			} else {
10498				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
10499			}
10500			if ( $customPilot.length ) {
10501				$customPilot.attr('data-cursor', cursorType);
10502			}
10503		}, delayt_time);
10504	}
10505
10506	function changeCursor($wrap){
10507		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10508		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
10509			$href = $wrap.find(href),
10510			cursorType,
10511			cursorTitle = '',
10512			tooltip_class = '',
10513			cursorBg = false;
10514
10515		$wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) {
10516			var $this = $(this).addClass("cursor-init"),
10517				$tmb = $this.closest('.tmb'),
10518				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
10519				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
10520				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
10521				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
10522				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
10523				$title = $('.t-entry-title', $tmb),
10524				is_frontend_editor = $this.closest('.vc_controls').length,
10525				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
10526				$parent_cursor = $this.closest('[class*="custom-cursor"]');
10527
10528			if ( is_frontend_editor ) {
10529				cursorType = 'auto';
10530			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
10531				cursorType = data_cursor;
10532			} else if ( $parent_cursor.length ) {
10533				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
10534					cursorType = 'icon-light';
10535				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
10536					cursorType = 'icon-diff';
10537				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
10538					cursorType = 'icon-accent';
10539				} else {
10540					cursorType = 'icon-dark';
10541				}
10542			} else {
10543				cursorType = 'pointer';
10544			}
10545
10546			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
10547				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
10548					cursorTitle = custom_text;
10549				} else {
10550					cursorTitle = $title.clone();
10551					$('a', cursorTitle).replaceWith(function() {
10552						return this.childNodes;
10553					});
10554					$('*', cursorTitle).replaceWith(function(){
10555						return $(this).removeAttr('class');
10556					});
10557					cursorTitle = cursorTitle.html();
10558				}
10559			} else {
10560				cursorTitle = '';
10561			}
10562
10563			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
10564				tooltip_class = data_class;
10565			} else {
10566				tooltip_class = '';
10567			}
10568
10569			if ( cursor_bg == 'true' ) {
10570				cursorBg = true;
10571			} else {
10572				cursorBg = false;
10573			}
10574
10575			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
10576		}).on("mouseleave.cursor", href, function(e) {
10577			var outTime = 150;
10578			if ( currentBg !== false && cursorBg === false ) {
10579				outTime = 0;
10580			}
10581			delayChangeCursor('auto', '', false, outTime, false, '');
10582		});
10583
10584		$(window).on('disable-hover', function(event) {
10585			document.addEventListener("mousemove", function(e) {
10586				mouseEvent = e;
10587			});
10588			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
10589		});
10590
10591		$(window).on('enable-hover', function(event) {
10592			if ( typeof mouseEvent !== 'undefined' ) {
10593				var x = mouseEvent.clientX,
10594					y = mouseEvent.clientY;
10595
10596				var elements = document.elementsFromPoint(x, y),
10597					$element = $(elements[0]);
10598
10599				$element.closest(href).trigger('mouseenter');
10600			}
10601		});
10602
10603	}
10604
10605	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10606		changeCursor();
10607	});
10608
10609	$(document).ajaxComplete(function( event, xhr, settings ) {
10610		changeCursor();
10611	});
10612
10613	$('.isotope-container').on('isotope-layout-complete', function() {
10614		var $this = $(this);
10615		changeCursor($this);
10616	});
10617
10618};
10619
10620UNCODE.magneticCursor = function(){
10621	function magneticCursor($wrap){
10622		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10623		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'));
10624
10625		$magnetics.on('mousemove', function(e){
10626			var $this = $(this),
10627				$el,
10628				bound = e.currentTarget.getBoundingClientRect(),
10629				coeff = 30,
10630				hor = (bound.width / 2) - (e.clientX - bound.left),
10631				ver = (bound.height / 2) - (e.clientY - bound.top),
10632				toX = hor / bound.width * coeff,
10633				toY = ver / bound.height * coeff,
10634				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
10635				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
10636				toScale = Math.max(scaleX, scaleY);
10637
10638			if ( $this.hasClass('magnetic') ) {
10639				$el = $('.background-inner, .header-bg', $this);
10640			} else {
10641				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10642			}
10643
10644			gsap.killTweensOf($el);
10645			gsap.to( $el, {
10646				duration: 0.75,
10647				x: toX,
10648				y: toY,
10649				scale: toScale,
10650				ease: Power1.easeOut,
10651				transformPerspective: 900,
10652				transformOrigin: 'center',
10653				force3D: true
10654			});
10655		}).on('mouseout', function(e){
10656			var $this = $(this),
10657				$el
10658			if ( $this.hasClass('magnetic') ) {
10659				$el = $('.background-inner, .header-bg', $this);
10660			} else {
10661				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10662			}
10663			gsap.killTweensOf($el);
10664			gsap.to( $el, {
10665				duration: 0.6,
10666				y: 0,
10667				x: 0,
10668				scale: 1,
10669				ease: Power1.easeOut,
10670				transformPerspective: 900,
10671				transformOrigin: 'center',
10672				force3D: true
10673			});
10674		});
10675	};
10676
10677	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10678		magneticCursor();
10679	});
10680
10681	$(document).ajaxComplete(function( event, xhr, settings ) {
10682		magneticCursor();
10683	});
10684
10685	$('.isotope-container').on('isotope-layout-complete', function() {
10686		var $this = $(this);
10687		magneticCursor($this);
10688	});
10689
10690};
10691
10692UNCODE.dropImage = function() {
10693
10694	/****************************
10695	 * Image hover *
10696	****************************/
10697	function imageHover(){
10698		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10699			return;
10700		}
10701
10702		var $postLists = $('.uncode-post-titles');
10703		$postLists.each(function(){
10704			var $list = $(this),
10705				timing = parseFloat( $list.attr('data-timing') ),
10706				default_image = $list.hasClass('uncode-post-titles-default-image'),
10707				default_title = $list.hasClass('uncode-post-titles-default-title'),
10708				$tmbs = $('.tmb', $list),
10709				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
10710				clientX,
10711				clientY,
10712				$row_parent = $list.closest('.vc_row'),
10713				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
10714				$col_parent = $list.closest('.uncell'),
10715				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
10716				stoppedScrolling = true,
10717				setCTA;
10718
10719			timing *= 0.001;
10720
10721			var drop_bgs = function(){
10722				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
10723					var $drop = $(this),
10724						srcset = $drop.attr('data-bgset'),
10725						setArr = srcset.split(","),
10726						setArrOrder = [],
10727						biggest = 0,
10728						checkBg = false,
10729						desktopBG = $drop.data('[data-background-image]'),
10730						mobileBG = $drop.data('[data-mobile-background-image]');
10731
10732					if ( $drop.hasClass('srcset-bg-async') ) {
10733
10734						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
10735							return;
10736						}
10737						
10738					}
10739
10740					if ( SiteParameters.uncode_adaptive == true ) {
10741						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
10742							$drop.css({
10743								'background-image' : 'url(' + setArr[0] + ')'
10744							});
10745						}
10746					} else {
10747						for ( var i = 0; i < setArr.length; i++ ) {
10748							var setLoop = setArr[i].trim().split(" ");
10749							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
10750								var parseSet = parseFloat(setLoop[1]);
10751								if ( biggest < parseSet ) {
10752									biggest = parseSet;
10753								}
10754								setArrOrder[parseSet] = setLoop[0];
10755								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
10756									checkBg = true;
10757									$drop.css({
10758										'background-image' : 'url(' + setLoop[0] + ')'
10759									});
10760								}
10761							}
10762						}
10763
10764						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
10765							$drop.css({
10766								'background-image' : 'url(' + setArrOrder[biggest] + ')'
10767							});
10768						}
10769					}
10770
10771				});
10772			};
10773
10774			drop_bgs();
10775
10776			var dropMovesSize = function(){
10777				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
10778					return;
10779				}
10780				$drop_moves.each(function(){
10781					var $drop_move = $(this),
10782						dataW = $drop_move.attr('data-w'),
10783						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
10784					if ( typeof dataW !== 'undefined' && dataW !== null ) {
10785						dataW = screenInfo.width / 12 * parseFloat( dataW );
10786					}
10787					$drop_moves.css({
10788						width: dataW
10789					});
10790
10791					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10792						$anim_parent.on('animationend', function(){
10793							var bound = $anim_parent[0].getBoundingClientRect();
10794							$drop_move.css({
10795								left: bound.x * -1,
10796								top: bound.y * -1,
10797							});
10798						});
10799					}
10800				});
10801
10802
10803			};
10804
10805			dropMovesSize();
10806
10807			$(window).on( 'resize', function(){
10808				clearRequestTimeout(setCTA);
10809				setCTA = requestTimeout( function() {
10810					drop_bgs();
10811					dropMovesSize();
10812				}, 100 );
10813			});
10814
10815			if ( $drop_row_parents.length ) {
10816				$row_parent.addClass( 'drop-added' );
10817			}
10818
10819			$drop_row_parents.each(function(index, val){
10820				var $drop = $(val);
10821				$row_parent.prepend($drop);
10822				manageVideos($drop, false);
10823				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10824					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10825				}
10826				if ( default_image && index == 0 ) {
10827					manageVideos($drop, true);
10828					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10829						image_ph = new Image();
10830					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10831						image_ph.onload = function() {
10832							$drop.addClass('active');
10833							if ( default_title ) {
10834								$list.addClass('drop-hover');
10835								$tmbs.first().addClass('drop-active');
10836							}
10837						};
10838						image_ph.src = bg_img;
10839					}
10840				}
10841			});
10842
10843			if ( $drop_col_parents.length ) {
10844				$col_parent.addClass( 'drop-added' );
10845			}
10846
10847			$drop_col_parents.each(function(index, val){
10848				var $drop = $(this);
10849				$col_parent.prepend($drop);
10850				manageVideos($drop, false);
10851				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10852					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10853				}
10854				if ( default_image && index == 0 ) {
10855					manageVideos($drop, true);
10856					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10857						image_ph = new Image();
10858					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10859						image_ph.onload = function() {
10860							$drop.addClass('active');
10861							if ( default_title ) {
10862								$list.addClass('drop-hover');
10863								$tmbs.first().addClass('drop-active');
10864							}
10865						};
10866						image_ph.src = bg_img;
10867					}
10868				}
10869			});
10870
10871			function manageVideos( $el, start ) {
10872				var videoElem = $('video', $el),
10873					$iframe = $('iframe', $el),
10874					iframeID = $iframe.attr('id');
10875				if ( videoElem.length ) {
10876					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
10877						if ( start ) {
10878							videoElem[0].setCurrentTime(0);
10879							videoElem[0].play();
10880						} else {
10881							videoElem[0].pause();
10882							videoElem[0].setCurrentTime(0);
10883						}
10884					} else {
10885						if ( start ) {
10886							videoElem[0].currentTime = 0;
10887							videoElem[0].play();
10888						} else {
10889							videoElem[0].pause();
10890							videoElem[0].currentTime = 0;
10891						}
10892					}
10893				}
10894
10895				$el.data('active', start);
10896
10897				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
10898					var iframeIDv = iframeID.replace('okplayer-', ''),
10899						optionsV = $(window).data('okoptions-' + iframeIDv),
10900						vimeo = $iframe[0],
10901						playerV = new Vimeo.Player(vimeo),
10902						timeV = 0;
10903
10904					if (optionsV.time != null) {
10905						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
10906						for ( var i = 0; i < timeArr.length; i++ ) {
10907							if ( timeArr[i] === 'h' ) {
10908								timeV += parseFloat(timeArr[i-1]) * 3600;
10909							} else if ( timeArr[i] === 'm' ) {
10910								timeV += parseFloat(timeArr[i-1]) * 60;
10911							} else if ( timeArr[i] === 's' ) {
10912								timeV += parseFloat(timeArr[i-1]);
10913							}
10914						}
10915					}
10916					playerV.setCurrentTime(timeV);
10917					if ( start ) {
10918						playerV.setVolume(0);
10919						playerV.play();
10920					} else {
10921						playerV.pause();
10922					}
10923				} else if ( $el.attr('data-provider') === 'youtube' ) {
10924					if ( start ) {
10925						$el.trigger('uncode-resume');
10926					} else {
10927						$el.trigger('uncode-pause');
10928					}
10929				}
10930
10931			}
10932
10933			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
10934
10935				document.addEventListener("mousemove", function(e) {
10936					$drop_moves.each(function(){
10937						var $drop_move = $(this),
10938							duration = 0.4;
10939
10940						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
10941							duration = 0.8;
10942						}
10943
10944						clientX = e.clientX;
10945						clientY = e.clientY;
10946
10947						gsap.to( $drop_move, {
10948							duration: duration,
10949							x: clientX,
10950							y: clientY,
10951							ease: Power1.easeOut,
10952						});
10953					});
10954				});
10955
10956			} else {
10957
10958				$(window).on("touchend scroll", function(e) {
10959					$list.removeClass('drop-hover');
10960					$drop_moves.removeClass('active');
10961					$tmbs.removeClass('drop-active');
10962				});
10963
10964				$drop_moves.each(function(){
10965					var $drop_move = $(this),
10966						$tmb = $drop_move.closest('.tmb'),
10967						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
10968
10969					if ( $anim_parent.hasClass('uncode-skew') ) {
10970						$anim_parent.css({
10971							'transform': 'skew(0)'
10972						});
10973					}
10974
10975					$tmb.on('touchend', function(e){
10976						e.stopPropagation();
10977
10978						$drop_moves.removeClass('active');
10979						$tmbs.removeClass('drop-active');
10980
10981						$list.addClass('drop-hover');
10982						$tmb.addClass('drop-active');
10983						$drop_move.addClass('active');
10984						manageVideos($drop_move, true);
10985						clientX = e.changedTouches[0].clientX;
10986						clientY = e.changedTouches[0].clientY;
10987
10988						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10989							var bound = $anim_parent[0].getBoundingClientRect();
10990							clientX = clientX - bound.x;
10991							clientY = clientY - bound.y;
10992						}
10993
10994						$drop_move.css({
10995							left: clientX,
10996							top: clientY
10997						});
10998					});
10999				});
11000
11001			}
11002
11003			$tmbs.each(function(e){
11004				var $tmb = $(this),
11005					// $trgr = $('a', $tmb),
11006					$trgr = $tmb,
11007					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
11008					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
11008(.t-inside), .parallax-el'),
11009					$video = $('video', $tmb),
11010					$iframe = $('iframe', $tmb),
11011					$entryTxt = $('.t-entry-text', $tmb),
11012					stopBounding;
11013
11014				$entryTxt.add($drop_move).css({
11015					'transition-duration': timing + 's'
11016				});
11017
11018				if ( $video.length ) {
11019					var vidH = $video[0].videoHeight,
11020						vidW = $video[0].videoWidth;
11021					$video.css({
11022						'height': vidH,
11023						'width': vidW
11024					});
11025				}
11026
11027				if ( $iframe.length ) {
11028					var vidH = $drop_move.attr('data-height'),
11029						vidW = $drop_move.attr('data-width');
11030					$iframe.css({
11031						'height': vidH,
11032						'width': vidW
11033					});
11034				}
11035
11036				$iframe.each(function(){
11037					var $video = $(this),
11038						vidH = $video[0].videoHeight,
11039						vidW = $video[0].videoWidth;
11040					$video.css({
11041						'height': vidH,
11042						'width': vidW
11043					});
11044				});
11045
11046				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
11047					$trgr.on('mouseenter',function(e){
11048
11049						$list.addClass('drop-hover');
11050						$tmbs.removeClass('drop-active');
11051						$tmb.addClass('drop-active');
11052						$drop_move.addClass('active');
11053						manageVideos($drop_move, true);
11054
11055						var clientX = e.clientX,
11056							clientY = e.clientY;
11057						$drop_move.css({
11058							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
11059						});
11060
11061					})
11062					.on('mouseleave', function(e){
11063						$list.removeClass('drop-hover');
11064						$drop_move.css({
11065							'transition-duration': ( timing*1.25 ) + 's'
11066						});
11067						$drop_move.removeClass('active');
11068						$tmb.removeClass('drop-active');
11069						$drop_move.on('transitionend', function(e){
11070							$drop_move.off('transitionend');
11071							$drop_move.css({
11072								'transition-duration': timing + 's'
11073							});
11074							manageVideos($drop_move,false);
11075						});
11076					});
11077
11078					document.addEventListener('visibilitychange', function(){
11079						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
11080							$drop_move.css({
11081								'transition-duration': '0s'
11082							});
11083							$drop_move.removeClass('active');
11084							manageVideos($drop_move, false);
11085						}
11086					});
11087
11088					document.addEventListener('scroll', function(){
11089						window.clearRequestTimeout( stopBounding );
11090						if ( stoppedScrolling ) {
11091							stoppedScrolling = false;
11092							if ( $drop_move.hasClass('active') ) {
11093								$list.removeClass('drop-hover');
11094								$tmbs.removeClass('drop-active');
11095								$drop_move.removeClass('active');
11096								$drop_move.on('transitionend', function(e){
11097									$drop_move.off('transitionend');
11098									$drop_move.css({
11099										'transition-duration': timing + 's'
11100									});
11101									manageVideos($drop_move,false);
11102								});
11103							}
11104						}
11105
11106						stopBounding = requestTimeout(function() {
11107							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
11108								var bound = $anim_parent[0].getBoundingClientRect();
11109								$drop_move.css({
11110									left: bound.x * -1,
11111									top: bound.y * -1,
11112								});
11113							}
11114							stoppedScrolling = true;
11115						}, 500);
11116					});
11117				}
11118
11119				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
11120					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
11121
11122				$drop.css({
11123					'transition-duration': timing + 's'
11124				});
11125
11126				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
11127					$trgr.on('mouseenter',function(e){
11128						$row_parent.add($col_parent).addClass('drop-list-loaded');
11129						$list.addClass('drop-hover');
11130
11131						if ( !$tmb.hasClass('drop-active') ) {
11132							$tmbs.removeClass('drop-active');
11133							$tmb.addClass('drop-active');
11134							if ( default_image && !$drop.hasClass('active') ) {
11135								var $prev = $('[data-drop].active', $row_parent);
11136								$prev.css({
11137									'transition-duration': (timing*1.5) + 's'
11138								});
11139								$prev.removeClass('active');
11140								$prev.on('transitionend', function(e){
11141									$prev.off('transitionend');
11142									manageVideos($prev,false);
11143								});
11144							}
11145							$drop.css({
11146								'transition-duration': timing + 's'
11147							});
11148							$drop.off('transitionend');
11149							$drop.addClass('active');
11150							manageVideos($drop, true);
11151						}
11152					})
11153					.on('mouseleave', function(e){
11154						if ( ( default_image && !default_title ) || !default_image ) {
11155							$list.removeClass('drop-hover');
11156							$tmb.removeClass('drop-active');
11157						}
11158						if ( ! default_image ) {
11159							$drop.css({
11160								'transition-duration': (timing*1.5) + 's'
11161							});
11162							$drop.removeClass('active');
11163
11164							$drop.on('transitionend', function(e){
11165								$drop.off('transitionend');
11166								manageVideos($drop,false);
11167							});
11168						}
11169					});
11170
11171					document.addEventListener('visibilitychange', function(){
11172						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
11173							$drop.css({
11174								'transition-duration': '0s'
11175							});
11176							$drop.removeClass('active');
11177							manageVideos($drop, false);
11178						}
11179					});
11180				}
11181			});
11182
11183		});
11184	};
11185
11186	$(window).on('load', function(event) {
11187		imageHover();
11188	});
11189
11190	var drop_wp_animation = function() {
11191		var $postLists = $('.uncode-post-titles');
11192		$postLists.each(function(){
11193			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
11194				new Waypoint({
11195					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11196					element: val,
11197					handler: function() {
11198						var element = $(this.element),
11199							parent = element.closest('.tmb'),
11200							currentIndex = parent.index(),
11201							delay = currentIndex,
11202							delayAttr = parseInt(element.attr('data-delay'));
11203						if (isNaN(delayAttr)) delayAttr = 100;
11204						var objTimeout = requestTimeout(function() {
11205							element.addClass('start_animation');
11206
11207							var nextTimeout = requestTimeout(function() {
11208								$('.drop-image-separator', parent).addClass('start_animation');
11209							}, 50);
11210
11211						}, delay * delayAttr);
11212						if (!UNCODE.isUnmodalOpen) {
11213							this.destroy();
11214						}
11215					},
11216					offset: UNCODE.isFullPage ? '100%' : '90%'
11217				})
11218			});
11219		});
11220	}
11221
11222	var runWaypoints_TO,
11223		runWaypoints_delay = 0;
11224
11225	var runWaypoints = function(){
11226		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
11227			runWaypoints_delay = 400;
11228		}
11229		clearRequestTimeout(runWaypoints_TO);
11230		runWaypoints_TO = requestTimeout(function() {
11231			drop_wp_animation();
11232		}, runWaypoints_delay);
11233	};
11234	runWaypoints();
11235	$( document.body ).on( 'uncode_waypoints', runWaypoints );
11236	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11237		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
11238			// imageHover();
11239			runWaypoints();
11240		});
11241	}
11242};
11243
11244UNCODE.postTable = function() {
11245
11246	var clickRow = function(){
11247		var $postLists = $('.uncode-post-table');
11248
11249		$postLists.each(function(){
11250			var $postList = $(this),
11251				$tmbClicks = $('.tmb.tmb-click-row', $postList);
11252
11253			$tmbClicks.each(function(){
11254				var $tmb = $(this),
11255					$click = $('.table-click-row', $tmb);
11256				$('*:not(.table-click-row)', $tmb).on('click', function(e){
11257					e.preventDefault();
11258					e.stopPropagation();
11259					$click[0].click();
11260					return false;
11261				});
11262			});
11263
11264		})
11265	};
11266
11267	clickRow();
11268
11269	var hoverRow = function(){
11270		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
11271
11272		$postLists.on('mouseenter', function(){
11273			$(this).addClass('post-table-hover');
11274		});
11275		$postLists.on('mouseleave', function(){
11276			$(this).removeClass('post-table-hover');
11277		});
11278	}
11279
11280	hoverRow();
11281
11282	var drop_wp_animation = function() {
11283		var $postLists = $('.uncode-post-table');
11284		$postLists.each(function(){
11285			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
11286				new Waypoint({
11287					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11288					element: val,
11289					handler: function() {
11290						var element = $(this.element),
11291							parent = element.closest('.tmb'),
11292							currentIndex = parent.index(),
11293							delay = currentIndex,
11294							delayAttr = parseInt(element.attr('data-delay'));
11295						if (isNaN(delayAttr)) delayAttr = 100;
11296						var objTimeout = requestTimeout(function() {
11297							element.addClass('start_animation');
11298						}, delay * delayAttr);
11299						if (!UNCODE.isUnmodalOpen) {
11300							this.destroy();
11301						}
11302					},
11303					offset: UNCODE.isFullPage ? '100%' : '90%'
11304				})
11305			});
11306		});
11307	}
11308
11309	var runWaypoints_TO,
11310		runWaypoints_delay = 0;
11311
11312	var runWaypoints = function(){
11313		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
11314			runWaypoints_delay = 400;
11315		}
11316		clearRequestTimeout(runWaypoints_TO);
11317		runWaypoints_TO = requestTimeout(function() {
11318			drop_wp_animation();
11319		}, runWaypoints_delay);
11320	};
11321	runWaypoints();
11322	$( document.body ).on( 'uncode_waypoints', runWaypoints );
11323	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11324		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
11325			runWaypoints();
11326			// clickRow();
11327		});
11328	}
11329};
11330
11331UNCODE.rotatingTxt = function($ctxt) {
11332
11333	if ( $('body').hasClass('compose-mode') ) {
11334		return;
11335	}
11336
11337	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
11338	var setCTA;
11339
11340	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
11341		var $heading = $(this),
11342			// debug = 0,
11343			cycle = 0,
11344			$trgt,
11345			$toMove,
11346			$highl,
11347			$col = $heading.closest('.uncont'),
11348			txt,
11349			arrTxt,
11350			textFadeIn, textFadeOut,
11351			removeWraps;
11352
11353		var defineObjs = function() {
11354			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
11355				var $rtx = $(this),
11356					fx = $rtx.attr('data-fx'),
11357					wait = $rtx.attr('data-wait'),
11358					$prev = $(this).prev().addClass('prev-rotating-start'),
11359					splitToMove = [],
11360					splitArray = [],
11361					lineArray = [],
11362					lineIndex = 0,
11363					lineStart = true,
11364					lineEnd = false,
11365					startSplit = false,
11366					$line_wrap = $rtx.closest('.heading-line-wrap'),
11367					same_line = true,
11368					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
11369					indexRtx = $splits.index($rtx);
11370
11371				fx = typeof fx === 'undefined' ? '' : fx;
11372				wait = typeof wait === 'undefined' ? '' : wait;
11373
11374				$splits.each(function(key, val){
11375					var $split = $(this),
11376						$new_line_wrap = $split.closest('.heading-line-wrap');
11377
11378					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
11379						splitArray.push( $split );
11380					}
11381
11382					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
11383						startSplit = false;
11384					}
11385
11386					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
11387						splitArray.push( $split );
11388
11389						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
11390							same_line = true;
11391						} else {
11392							same_line = false;
11393						}
11394					}
11395
11396					if ( key == indexRtx ) {
11397						if ( /\S/.test($split.text()) ) {
11398							startSplit = true;
11399							$line_wrap = $split.closest('.heading-line-wrap');
11400							splitArray.push( $split );
11401						} else {
11402							indexRtx++;
11403						}
11404					}
11405
11406					$line_wrap = $new_line_wrap;
11407				});
11408
11409				$toMove = $($.map(splitToMove, function(el){return el.get();}));
11410				$trgt = $($.map(splitArray, function(el){return el.get();}));
11411
11412				if ( same_line ) {
11413					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
11414					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
11415				}
11416
11417				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
11418					$prev.addClass('empty-span-hidden');
11419				}
11420
11421				$highl = $('.heading-text-highlight-inner', $trgt);
11422
11423				$rtx.attr('data-animated', 'true');
11424				if ( cycle == 0 ) {
11425					$( document.body ).trigger('defer-highlights');
11426					cycle++;
11427					defineObjs();
11428					return;
11429				}
11430				cycle++;
11431
11432				txt = $rtx.attr('data-text');
11433				arrTxt = txt.split("|");
11434
11435				textFadeOut($trgt);
11436
11437			});
11438		};
11439
11440		removeWraps = function(){
11441
11442			// if ( debug == 1 ) return;
11443			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
11444			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
11445
11446
11447				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
11448					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
11449
11450				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
11451
11452				$splitFlow.each(function(){
11453					$(this).append($temp_highl);
11454				});
11455
11456				var $line_wrap = $wraps[wrap_k];
11457				var $parent_wrap = $line_wrap.parentNode;
11458				if ( $parent_wrap !== null ) {
11459					while ( $line_wrap.firstChild ) {
11460						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
11461					}
11462					$parent_wrap.removeChild($line_wrap);
11463				}
11464			}
11465			// debug++;
11466			defineObjs();
11467		};
11468
11469		var loop = 0;
11470		textFadeIn = function($trgt){
11471			var word = arrTxt[loop].split(" "),
11472				worsSpan = '',
11473				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11474				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11475				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
11476
11477			for (var w = 0; w < word.length; w++) {
11478				var highl;
11479				if ( $highl.length ) {
11480					highl = $highl[0].outerHTML;
11481				} else {
11482					highl = '';
11483				}
11484
11485				if ( w > 0 ) {
11486					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
11487				}
11488				var charachters = word[w].split('');
11489				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
11490				if ( ! SiteParameters.uncode_has_ligatures ) {
11491					for (var c = 0; c < charachters.length; c++) {
11492						worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
11493					}
11494				} else {
11495					worsSpan += word[w];
11496				}
11497				worsSpan += '</span>' + highl + '</span></span>';
11498			}
11499
11500			if ( $wrap.length && $wrap_inner.length ) {
11501				var words_w = $wrap_inner.outerWidth();
11502				$wrap.css({
11503					width: words_w
11504				});
11505
11506				$highl = $('.heading-text-highlight-inner', $wrap);
11507				$highl.prependTo($wrap);
11508
11509				$wrap_inner.css({
11510					opacity: 0
11511				});
11512
11513				$wrap_inner.html(worsSpan);
11514				$('.heading-text-highlight-inner', $wrap_inner).remove();
11515				words_w = $wrap_inner.innerWidth();
11516
11517				var duration = 0.45;
11518
11519				$heading.removeClass('auto-width');
11520				if ( words_w > $col.width() ) {
11521					$heading.addClass('auto-width');
11522					words_w = 'auto';
11523					duration = 0;
11524				}
11525
11526				$wrap.css({
11527					'width': words_w,
11528					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
11529				});
11530
11531				var $word_inner = $('.split-word-inner', $wrap_inner),
11532					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
11533
11534				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11535
11536				if ( !$target_fx.length ) {
11537					return;
11538				}
11539
11540				gsap.killTweensOf($target_fx);
11541
11542				if ( fx !== 'zoom' ) {
11543					gsap.fromTo( $target_fx, {
11544						y: fx === 'opacity' ? '0%' : '-10%'
11545					},{
11546						delay: duration,
11547						duration: 0.25,
11548						y: '0%',
11549						ease: Circ.easeOut,
11550					});
11551
11552					if ( !$wrap_inner.length ) {
11553						return;
11554					}
11555
11556					gsap.fromTo( $wrap_inner, {
11557						opacity: 0,
11558					},{
11559						delay: duration,
11560						duration: 0.25,
11561						opacity: 1,
11562						ease: Circ.easeOut,
11563						onComplete: function(){
11564							$('> .heading-text-highlight-inner', $wrap).remove();
11565							$wrap_inner.html(worsSpan);
11566							removeWraps();
11567						}
11568					})
11569
11570				} else {
11571					gsap.fromTo( $target_fx, {
11572						transformOrigin: '50%',
11573						opacity: 0,
11574						scale: 0.875,
11575					},{
11576						opacity: 1,
11577						delay: duration,
11578						duration: 0.25,
11579						scale: 1,
11580						ease: Circ.easeOut,
11581						onComplete: function(){
11582							$('> .heading-text-highlight-inner', $wrap).remove();
11583							$wrap_inner.html(worsSpan);
11584							removeWraps();
11585						}
11586					});
11587				}
11588
11589			} else {
11590
11591				if ( !$wrap_inner.length ) {
11592					return;
11593				}
11594
11595				gsap.to( $wrap_inner, {
11596					duration: 0.4,
11597					opacity: 0,
11598					ease: Power1.easeOut,
11599					onComplete: function(){
11600						$wrap_inner.html(worsSpan);
11601						words_w = $wrap_inner.innerWidth();
11602
11603						gsap.to( $wrap_inner, {
11604							duration: 0.2,
11605							opacity: 1,
11606							ease: Power1.easeOut,
11607							onComplete: function(){
11608								$('> .heading-text-highlight-inner', $wrap).remove();
11609								$wrap_inner.html(worsSpan);
11610								removeWraps();
11611							}
11612						})
11613					}
11614				});
11615			}
11616
11617			if ( loop < arrTxt.length-1 ) {
11618				loop++;
11619			} else {
11620				loop = 0;
11621			}
11622
11623		};
11624
11625		textFadeOut = function($trgt){
11626			var $word_inner = $('.split-word-inner', $trgt),
11627				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11628				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11629				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
11630				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
11631
11632			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
11633
11634			var gsap_param = {
11635					delay: wait,
11636					duration: 0.25,
11637					y: fx === '' ? '10%' : '0%',
11638					opacity: 0,
11639					ease: Circ.easeOut,
11640					onStart: function(){
11641						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
11642							$highl = $('.heading-text-highlight-inner', $wrap);
11643							$highl.prependTo($wrap);
11644						}
11645					},
11646					onComplete: textFadeIn,
11647					onCompleteParams: [$trgt]
11648				};
11649
11650			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11651
11652			if ( fx === '' ) {
11653				gsap_param.y = '10%';
11654			} else if ( fx === 'zoom' ) {
11655				gsap_param.scale = '1.045';
11656			}
11657
11658			if ( !$target_fx.length ) {
11659				return;
11660			}
11661
11662			if ( $heading.data('waypoint') !== true ) {
11663				var textInView = new Waypoint.Inview({
11664					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11665					element: $heading[0],
11666					enter: function(direction) {
11667						$heading.data('waypoint',true);
11668						gsap.fromTo( $target_fx, {
11669							transformOrigin: '50%'
11670						}, gsap_param );
11671					}
11672				});
11673			} else {
11674				gsap.fromTo( $target_fx, {
11675					transformOrigin: '50%'
11676				}, gsap_param );
11677			}
11678		};
11679
11680		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11681			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
11682				var $el = model.view.$el,
11683					shortcode = model.attributes.shortcode;
11684
11685				UNCODE.rotatingTxt($el);
11686			});
11687		} else {
11688			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
11689				$heading.on('already-animated', function(){
11690					removeWraps();
11691					window.addEventListener('removeOldLines', function(){
11692						clearRequestTimeout(setCTA);
11693						setCTA = requestTimeout( removeWraps, 150 );
11694					});
11695				});
11696			} else {
11697				$(window).on('load', function(){
11698					removeWraps();
11699					window.addEventListener('removeOldLines', function(){
11700						clearRequestTimeout(setCTA);
11701						setCTA = requestTimeout( removeWraps, 150 );
11702					});
11703				});
11704			}
11705		}
11706	});
11707
11708};
11709
11710UNCODE.verticalText = function() {
11711	$(window).on('menuCanvasOpen', function(){
11712		$('.vertical-text--fixed').fadeOut(500);
11713		$('.horizontal-text--fixed').fadeOut(500);
11714	}).on('menuCanvasClose', function(){
11715		$('.vertical-text--fixed').fadeIn(500);
11716		$('.horizontal-text--fixed').fadeIn(500);
11717	});
11718
11719	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
11720	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
11721	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
11722	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
11723
11724	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
11725		window.addEventListener('scroll', function(e) {
11726			var totalPageHeight = document.body.scrollHeight;
11727			var scrollPoint = window.scrollY + window.innerHeight;
11728
11729			if (window.scrollY > 0) {
11730				showOnTopVerticalTexts.fadeOut();
11731				showOnTopHorizontalTexts.fadeOut();
11732			} else {
11733				showOnTopVerticalTexts.fadeIn();
11734				showOnTopHorizontalTexts.fadeIn();
11735			}
11736
11737			if (scrollPoint >= totalPageHeight) {
11738				hideOnBottomVerticalTexts.fadeOut();
11739				hideOnBottomHorizontalTexts.fadeOut();
11740			} else {
11741				hideOnBottomVerticalTexts.fadeIn();
11742				hideOnBottomHorizontalTexts.fadeIn();
11743			}
11744		}, false);
11745	}
11746};
11747
11748UNCODE.stickyScroll = function( $el ) {
11749	if ( typeof $el === 'undefined' || $el === null ) {
11750		$el = $('body');
11751	}
11752	var checkVisible = function( el, dir ) {
11753		if (typeof jQuery === "function" && el instanceof jQuery) {
11754			el = el[0];
11755		}
11756
11757		var off = 50;
11758		dir = typeof dir=='undefined' ? 'right' : dir;
11759		var rect = el.getBoundingClientRect();
11760
11761		return (
11762			(
11763				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11764				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11765				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
11766			) &&
11767			(
11768				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11769				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11770				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
11771				( rect.right <= window.innerWidth && rect.left >= 0 )
11772			)
11773		);
11774	};
11775
11776	var setItemsRelHeight = function(reset) {
11777		var $_el = $el;
11778		if ( $el.is('.index-scroll') ) {
11779			var $_el = $el.closest('.uncont');
11780		}
11781		// $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
11782		// 	$.each($('.tmb', item), function(index, val) {
11783		// 		if ( reset === true ) {
11784		// 			$(val).css( 'visibility', 'hidden' );
11785		// 		} else {
11786		// 			$(val).css( 'visibility', 'visible' );
11787		// 		}
11788		// 	});
11789		// });
11790		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
11791			$.each($('.tmb', item), function(index, val) {
11792				if ( reset === true ) {
11793					$(val).css( 'visibility', 'hidden' );
11794					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
11795				} else {
11796					var $rowParent = $(item).closest('.row-parent'),
11797						rowRatio = $rowParent.attr('data-height-ratio'),
11798						$rowInner = $(item).closest('.row-child'),
11799						rowRatioInner = $rowInner.attr('data-height'),
11800						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11801						$colContainer = $(item).closest('.uncell'),
11802						$uncont = $(item).closest('.uncont'),
11803						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
11804						safe_heigth = $(item).data('safe-height'),
11805						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
11806						offSet = $(item).offset().top - $uncont.offset().top,
11807						multiplier_h,
11808						data_viewport_h,
11809						body_border = $('.body-borders .top-border').outerHeight() * 2,
11810						remove_menu = $(item).data('vp-menu');
11811
11812					if ( rowRatio === 'full' || rowRatio === '' ) {
11813						rowRatio = 1;
11814					} else {
11815						rowRatio = rowRatio / 100;
11816					}
11817
11818					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
11819						rowRatio = rowRatio;
11820					} else {
11821						rowRatio = rowRatio * rowRatioInner / 100;
11822					}
11823
11824					winHeight = winHeight * rowRatio;
11825
11826					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11827						multiplier_h = parseInt($(item).attr('data-vp-height'));
11828					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
11829						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
11830					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
11831						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
11832					}
11833
11834					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
11835						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
11836						if ( remove_menu === true ) {
11837							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
11838						}
11839						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
11840					} else {
11841						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
11842					}
11843
11844				}
11845			});
11846		});
11847		$('.index-scroll', $_el).each(function(i, item){
11848			var $uncoltable = $(item).closest('.uncoltable'),
11849				$rowParent = $(item).closest('.row-parent'),
11850				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11851				body_border = $('.body-borders .top-border').outerHeight() * 2,
11852				$index_row = $('.index-row', item),
11853				safe_heigth = $index_row.data('safe-height'),
11854				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
11855			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
11856				var data_viewport_h = winHeight - ( paddingRow + body_border );
11857				$uncoltable.css({
11858					'min-height': data_viewport_h
11859				});
11860			} else {
11861				$uncoltable.css({
11862					'min-height': 'auto'
11863				});
11864			}
11865		});
11866
11867	}
11868	setItemsRelHeight();
11869
11870	var $index_scrolls = $('.index-scroll', $el);
11871
11872	$index_scrolls.each(function(key, value){
11873		var $index = $(this),
11874			$parent_row = $index.closest('.vc_row[data-parent]'),
11875			$index_row = $('.index-row', $index),
11876			dir = $index_row.attr('data-direction');
11877		dir = typeof dir === 'undefined' ? 'right' : dir;
11878
11879		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
11880
11881		if ( $('.animate_when_almost_visible', $index).length ) {
11882			$index.addClass('opacity_0').addClass('scroll-refresh-hidden');
11883		}
11884
11885	});
11886
11887	var $horScrolls = $('.unscroll-horizontal', $el);
11888
11889	if ( $horScrolls.length ) {
11890
11891		$('body').addClass('scrolling-trigger');
11892
11893		$horScrolls.each(function(key, value){
11894			var $section = $(this),
11895				$index_scroll = $('.index-scroll', $section),
11896				$index_row = $('.index-row', $index_scroll),
11897				dir = $section.attr('data-direction'),
11898				wrap = $index_row.attr('data-wrap'),
11899				$pinWrap,
11900				$pinTrigger;
11901
11902			dir = typeof dir === 'undefined' ? 'right' : dir;
11903			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
11904			$pinWrap = $('<div class="pin-wrap" />');
11905			if ( SiteParameters.is_frontend_editor ) {
11906				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
11907				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
11908			} else {
11909				if ( wrap === 'column' ) {
11910					$index_scroll.wrapInner( $pinWrap );
11911				} else {
11912					$('> .row', $section).wrap( $pinWrap );
11913				}
11914				$section.wrapInner( $pinTrigger );
11915			}
11916
11917		});
11918
11919		var $pinWraps = $('.pin-wrap', $el);
11920
11921		var horScrollSizes = function(){
11922
11923			$pinWraps.each(function(key, val){
11924				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
11925					$pinTrigger = $pinWrap.closest('.pin-trigger'),
11926					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
11927					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
11928					$boxContainer = $('.box-container'),
11929					box_m = $boxContainer.css('margin-left'),
11930					st_active = true;
11931
11932				var setHorW,
11933				horWidth = function(){
11934					$index_scroll.each(function(){
11935						var $this = $(this),
11936							$index_row = $('.index-row', $this),
11937							$rowContainer = $index_row.closest('.vc_row'),
11938							$rowInner = $index_row.closest('.wpb_row'),
11939							$rowParent = $index_row.closest('.row-parent'),
11940							$tmbs = $('.tmb', $index_row),
11941							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
11942							$uncont = $index_row.closest('.uncont'),
11943							$parent_col = $index_row.closest('.wpb_column'),
11944							col_w = $uncont.width(),
11945							data_lg = parseFloat( $index_row.attr('data-lg') ),
11946							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
11947							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
11948							tmb_w;
11949
11950						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
11951						tmb_w = ( col_w + padding_tmb ) / data_lg;
11952
11953						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
11954							tmb_w = ( col_w + padding_tmb ) / data_sm;
11955						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
11956							tmb_w = ( col_w + padding_tmb ) / data_md;
11957						}
11958
11959						if ( !isNaN(tmb_w) ) {
11960							$tmbs.css({
11961								'width': tmb_w
11962							});
11963						}
11964
11965						$tmbs.css({
11966							'visibility': 'visible'
11967						});
11968
11969					});
11970				};
11971
11972				horWidth();
11973				clearRequestTimeout(setHorW);
11974				setHorW = requestTimeout( function(){
11975					setItemsRelHeight();
11976					horWidth();
11977				}, 100 );
11978
11979				if ( SiteParameters.is_frontend_editor ) {
11980					return;
11981				}
11982
11983				var $vmenu = $('body.vmenu .vmenu-container'),
11984					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
11985					winWidth = window.innerWidth - vmenuW,
11986					$tmb = $('.tmb', $index_scroll).eq(0),
11987					paddingRight = parseFloat( $tmb.css('padding-right') ),
11988					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_
11988scroll.width() + paddingRight ) ),
11989					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
11990					scroll_anim;
11991
11992				if ( $('body').hasClass('rtl') ) {
11993					if ( dir === 'left' ) {
11994						scroll_anim = gsap.fromTo( $pinWrap, {
11995							x: stickyScrollLength
11996						},{
11997							x: 0,
11998							ease: "none"
11999						});
12000					} else {
12001						scroll_anim = gsap.fromTo( $pinWrap, {
12002							x: 0
12003						},{
12004							x: stickyScrollLength,
12005							ease: "none"
12006						});
12007					}
12008				} else {
12009					if ( dir === 'left' ) {
12010						scroll_anim = gsap.fromTo( $pinWrap, {
12011							x: -stickyScrollLength
12012						},{
12013							x: 0,
12014							ease: "none"
12015						});
12016					} else {
12017						scroll_anim = gsap.fromTo( $pinWrap, {
12018							x: 0
12019						},{
12020							x: -stickyScrollLength,
12021							ease: "none"
12022						});
12023					}
12024				}
12025
12026				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
12027					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
12028				}
12029
12030				var animationIncrease;
12031
12032				var checkForAnimations = function(){
12033					animationIncrease = 0
12034					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
12035						var _this = this;
12036						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
12037							var delayAttr = parseFloat( $(_this).attr('data-delay') );
12038							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
12039							requestTimeout(function() {
12040								$(_this).addClass('start_animation');
12041							}, delayAttr + animationIncrease);
12042							animationIncrease += 150;
12043						}
12044						$(_this).on([
12045							'webkitAnimationEnd',
12046							'mozAnimationEnd',
12047							'MSAnimationEnd',
12048							'oanimationend',
12049							'animationend'
12050						].join(' '), function(e) {
12051							$(e.currentTarget).removeClass('animate_when_almost_visible');
12052						});
12053					});
12054
12055					var batchTime = 0;
12056
12057					var resetBatch = function(){
12058						batchTime = 0;
12059					}
12060
12061					if (ScrollTrigger.isScrolling()) {
12062						resetBatch();
12063					}
12064					
12065					$('.tmb-mask-reveal', $pinTrigger).each(function(){
12066						var _this = this,
12067							$this = $(_this),
12068							$inside = $('.t-inside', $this),
12069							delay = parseFloat( $inside.attr('data-delay') ),
12070							speed = parseFloat( $inside.attr('data-speed') ),
12071							easing = $inside.attr('data-easing'),
12072							bgDelay = parseFloat( $inside.attr('data-bg-delay') );
12073
12074						delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
12075						speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
12076						easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
12077						bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
12078
12079						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) {
12080							$this.addClass('tmb-mask-init');
12081							if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) {
12082								gsap.to($('.t-entry-visual-tc', $this), speed, {
12083									clipPath: 'inset(0% 0% 0% 0%)',
12084									delay: delay + batchTime,
12085									ease: easing,
12086								});
12087								gsap.to($('.t-entry-visual-cont', $this), speed, {
12088									clipPath: 'inset(0% 0% 0% 0%)',
12089									scale: 1,
12090									delay: delay + batchTime + (speed*bgDelay),
12091									ease: easing,
12092									onComplete: resetBatch,
12093								});
12094							} else {
12095								gsap.to($('.t-entry-visual-cont', $this), speed, {
12096									clipPath: 'inset(0% 0% 0% 0%)',
12097									scale: 1,
12098									delay: delay + batchTime,
12099									ease: easing,
12100									onComplete: resetBatch,
12101								});
12102							}
12103							batchTime += 0.1;
12104						}
12105					});
12106				
12107				};
12108				checkForAnimations();
12109
12110				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
12111				var start = 0;
12112
12113				var horST = ScrollTrigger.create({
12114					id: "stickySectionScrolling" + key,
12115					scrub: true,
12116					trigger: $pinTrigger[0],
12117					pin: true,
12118					anticipatePin: 1,
12119					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
12120					end: function() { return "+="+stickyScrollLength; },
12121					animation: scroll_anim,
12122					ease: Sine.easeOut,
12123					onUpdate: checkForAnimations,
12124					invalidateOnRefresh: true,
12125					onEnter: function(){
12126						$pinTrigger.addClass('enter-st');
12127					},
12128					onEnterBack: function(){
12129						$pinTrigger.addClass('enter-st');
12130					},
12131					onLeave: function(){
12132						$pinTrigger.removeClass('enter-st');
12133					},
12134					onLeaveBack: function(){
12135						$pinTrigger.removeClass('enter-st');
12136					}
12137				});
12138
12139				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
12140				window.dispatchEvent(new CustomEvent('boxResized'));
12141
12142				var testSecondTrigger = function(){
12143					animationIncrease = 0
12144					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
12145						var _this = this;
12146						if ( checkVisible(_this) ) {
12147							var delayAttr = parseFloat( $(_this).attr('data-delay') );
12148							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
12149							requestTimeout(function() {
12150								$(_this).addClass('start_animation');
12151							}, delayAttr + animationIncrease);
12152							animationIncrease += 150;
12153						}
12154					});
12155
12156				};
12157
12158				var verST = ScrollTrigger.create({
12159					id: "verticalSectionScrolling" + key,
12160					trigger: $pinTrigger[0],
12161					start: "top center",
12162					end: function() { return "+="+UNCODE.wheight; },
12163					onUpdate: testSecondTrigger,
12164					invalidateOnRefresh: true
12165				});
12166
12167				var setCTA,
12168
12169				dis_enable_ST = function(){
12170					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
12171						horST.kill();
12172						verST.kill();
12173						$pinTrigger.addClass('disabled');
12174						st_active = false;
12175					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12176						horST.kill();
12177						verST.kill();
12178						$pinTrigger.addClass('disabled');
12179						st_active = false;
12180					}
12181				};
12182
12183				$(window).on('resize load', function() {
12184					clearRequestTimeout(setCTA);
12185					setCTA = requestTimeout(function() {
12186						dis_enable_ST();
12187						checkForAnimations();
12188					}, 500);
12189				});
12190
12191			});
12192		};
12193
12194		$(window).on( 'load', function(){
12195			horScrollSizes();
12196		});
12197		var setResize,
12198			setReLayout,
12199			doubleResize = true;
12200		$(window).on( 'load', function(){
12201			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
12202				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
12203				Array.prototype.forEach.call($row_inners, function(el) {
12204					el.style.height = '';
12205					el.style.marginBottom = '';
12206				});
12207				setItemsRelHeight();
12208				horScrollSizes();
12209				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12210					$(document).trigger('uncode-scrolltrigger-refresh');
12211				}
12212			}
12213			var carousel = document.querySelector(".owl-carousel"),
12214				grid = document.querySelector(".isotope-container"),
12215				stickyAll = document.querySelectorAll(".index-scroll");
12216
12217			if ( stickyAll.length ) {
12218				var sticky = stickyAll[(stickyAll.length-1)];
12219			}
12220
12221			if ( typeof sticky !== "undefined" ) {
12222
12223				if ( typeof carousel !== "undefined" && carousel !== null ) {
12224					var carousel_position = sticky.compareDocumentPosition(carousel);
12225				}
12226				if ( typeof grid !== "undefined" && grid !== null ) {
12227					var grid_position = sticky.compareDocumentPosition(grid);
12228				}
12229
12230				if ( carousel_position === 2 || grid_position === 2 ) {
12231					setTimeout(function(){
12232						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12233							$(document).trigger('uncode-scrolltrigger-refresh');
12234						}
12235					}, 500);
12236				}
12237
12238			}
12239			
12240		});
12241        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
12242            android = /Android/.test(navigator.userAgent) && !window.MSStream;
12243		$(window).on( 'resize orientationchange', function(e){
12244			if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
12245				return;
12246			}
12247			setItemsRelHeight(true);
12248			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
12249			Array.prototype.forEach.call($row_inners, function(el) {
12250				el.style.height = '';
12251				el.style.marginBottom = '';
12252			});
12253			clearRequestTimeout(setResize);
12254			setResize = requestTimeout( function(){
12255				setItemsRelHeight();
12256				horScrollSizes();
12257				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12258					$(document).trigger('uncode-scrolltrigger-refresh');
12259				}
12260				if ( doubleResize === true ) {
12261					window.dispatchEvent(new Event('resize'));
12262					doubleResize = false;
12263				} else {
12264					doubleResize = true;
12265				}
12266				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
12267			}, 100 );
12268		});
12269
12270		var show_pins = function(){
12271			$('.index-scroll').css({'opacity':'1'});
12272		};
12273		ScrollTrigger.addEventListener("refresh", show_pins);
12274		$(window).on( 'uncode.re-layout', function(){
12275			//$('.index-scroll').css({'opacity':'0'});
12276			$('.pin-spacer').each(function(){
12277				var space_h = $(this).outerHeight(),
12278					$row = $(this).closest('.row-container');
12279				$row.css({
12280					'height': space_h,
12281					'overflow': 'hidden'
12282				});
12283			});
12284			if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12285				ScrollTrigger.refresh(true);
12286			}
12287			clearRequestTimeout(setReLayout);
12288			setReLayout = requestTimeout( function(){
12289				$('.row-container').each(function(){
12290					$(this).css({
12291						'height': '',
12292						'overflow': ''
12293					});
12294				});
12295			}, 1000);
12296		});
12297	}
12298
12299};
12300
12301UNCODE.stickyTrigger = function( $el ) {
12302    if ( SiteParameters.is_frontend_editor ) {
12303        return false;
12304    }
12305
12306    var stickyTrigger = function(){
12307        var stickyTrick = $('.sticky-trigger').each(function(){
12308            var $sticky = $(this),
12309                $inside = $('> div', $sticky),
12310                insideH = $inside.outerHeight(),
12311                $row = $sticky.closest('.vc_row'),
12312                $uncont = $sticky.closest('.uncont'),
12313                rowBottom,
12314                uncontBottom,
12315                diffBottom;
12316
12317            ScrollTrigger.create({
12318                trigger: $sticky,
12319                start: function(){ return "top center-=" + insideH/2; },
12320                endTrigger: $row,
12321                end:  function(){
12322                    rowBottom = $row.offset().top + $row.outerHeight();
12323                    uncontBottom = $uncont.offset().top + $uncont.outerHeight();
12324                    diffBottom = rowBottom - uncontBottom;
12325                    return "bottom center+=" + ( insideH/2 + diffBottom );
12326                },
12327                anticipatePin: true,
12328                pin: true,
12329                pinSpacing: false,
12330                scrub: true,
12331                invalidateOnRefresh: true,
12332            });
12333
12334        });
12335    },
12336    setResizeSticky;
12337
12338    $(window).on( 'load', function(){
12339        stickyTrigger();
12340        var carousel = document.querySelector(".owl-carousel"),
12341            grid = document.querySelector(".isotope-container"),
12342            stickyAll = document.querySelectorAll(".sticky-trigger");
12343
12344        if ( stickyAll.length ) {
12345            var sticky = stickyAll[(stickyAll.length-1)];
12346        }
12347
12348        if ( typeof sticky !== "undefined" ) {
12349
12350            if ( typeof carousel !== "undefined" && carousel !== null ) {
12351                var carousel_position = sticky.compareDocumentPosition(carousel);
12352            }
12353            if ( typeof grid !== "undefined" && grid !== null ) {
12354                var grid_position = sticky.compareDocumentPosition(grid);
12355            }
12356
12357            if ( carousel_position === 2 || grid_position === 2 ) {
12358                setTimeout(function(){
12359                    $(document).trigger('uncode-scrolltrigger-refresh');
12360                }, 500);
12361            }
12362
12363        }
12364    });
12365
12366    var oldW = UNCODE.wwidth;
12367    $(window).on( 'resize uncode.re-layout', function(e){
12368        clearRequestTimeout(setResizeSticky);
12369        if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
12370            return;
12371        } else {
12372            oldW = UNCODE.wwidth;
12373        }
12374        setResizeSticky = requestTimeout( function(){
12375            stickyTrigger();
12376            $(document).trigger('uncode-scrolltrigger-refresh');
12377        }, 1000 );
12378    });
12379
12380    
12381};
12382
12383UNCODE.areaTextReveal = function() {
12384    if ( ! $('.text-reveal, .scroll-trigger-el').length ) {
12385        return;
12386    }
12387	if ( ! SiteParameters.is_frontend_editor ) {
12388        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
12389            android = /Android/.test(navigator.userAgent) && !window.MSStream,
12390            prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
12391            prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
12392                document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
12393            firstObs = true,
12394            isMobileUsing = false;
12395
12396        var observer = new ResizeObserver(function(){
12397            var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
12398                newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
12399                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
12400                set = false;
12401            if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
12402                set = true;
12403                prevW = newW;
12404            } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
12405                set = true;
12406                prevH = newH;
12407            }
12408            if ( set || firstObs ) {
12409                window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe'));
12410                firstObs = false;
12411            }
12412        }).observe(document.body);
12413
12414        if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
12415            window.scrollTo = function() {
12416                return;
12417            };
12418            isMobileUsing = true;
12419
12420            $('html, body').css({
12421                'overscroll-behavior': 'none'
12422            });
12423        }
12424
12425        var setTriggerObserve;
12426
12427        ScrollTrigger.observe({
12428            trigger: 'body',
12429            type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
12430            onUp: function() { ScrollTrigger.update(); },
12431        });
12432    }
12433
12434    var textReveal = function(){
12435
12436        if ( SiteParameters.is_frontend_editor ) {
12437            return;
12438        }
12439
12440        var setTxtReveal,
12441            txtTrggrStart = false;
12442
12443        function headingReveal($sel){
12444            txtTrggrStart = true;
12445            $('.text-reveal', $sel).each(function(val, key){
12446                var $txtReveal = $(this).attr('data-init-reveal', true),
12447                    $trigger = $txtReveal,
12448                    $rowParent = $txtReveal.closest('.row-container[data-parent]'),
12449                    hReveal = $txtReveal.outerHeight(),
12450                    $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'),
12451                    $sticky = $txtReveal.closest('.sticky-element'),
12452                    dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
12453                    dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
12454                    dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')),
12455                    $lines = $('.heading-line-wrap', $txtReveal),
12456                    $words = $('.split-word-inner', $txtReveal),
12457                    $chars = $('.split-char', $txtReveal),
12458                    $elToReveal = $words;
12459
12460                if ( $pin.length ) {
12461                    return;
12462                } else if ( $sticky.length ) {
12463                    hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop);
12464                    $trigger = $sticky.parent();
12465                }
12466
12467                if ( dataReveal === 'chars' ) {
12468                    $elToReveal = $chars;
12469                } else if ( dataReveal === 'lines' ) {
12470                    $elToReveal = $lines;
12471                }
12472                
12473                var tl = gsap.timeline({
12474                    scrollTrigger: {
12475                        trigger: $trigger,
12476                        start: "top +=" + (window.innerHeight/100*dataTop) + "px",
12477                        end: "+=" + hReveal + "px",
12478                        id: "txt_reveal_" + key,
12479                        scrub: true,
12480                    }
12481                });
12482                gsap.set(
12483                    $elToReveal, {
12484                        opacity: dataRevealOpacity,
12485                    }
12486                )
12487                tl.fromTo($elToReveal, {
12488                    opacity: dataRevealOpacity,
12489                    duration: 1,
12490                }, {
12491                    opacity: 1,
12492                    stagger: 0.05,
12493                    duration: 1,
12494
12495                });
12496                $(window).on('uncode.tl-refresh', function(){
12497                    if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
12498                        tl.scrollTrigger.refresh();
12499                    }
12500                });
12501
12502                $rowParent.one( 'uncodeWordLines', function(){
12503                    clearRequestTimeout(setTxtReveal);
12504                    setTxtReveal = requestTimeout( function(){
12505                        gsap.set($elToReveal, {clearProps: true});
12506                        tl.kill(true);
12507                        if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) {
12508                            ScrollTrigger.getById("txt_reveal_" + key).kill(true);
12509                        }
12510                        headingReveal($sel)
12511                    }, 100);
12512                });
12513
12514            });
12515        };
12516
12517        window.addEventListener("load", function (e) {
12518            if (!txtTrggrStart) {
12519                headingReveal($("body"));
12520                $(window).trigger("resize");
12521            }
12522        });
12523
12524        $('.row-container[data-parent]').each(function(){
12525            if (!txtTrggrStart) {
12526                var $this = $(this);
12527                $this.on('uncodeWordLines', function(){
12528                    headingReveal($this);
12529                });
12530            }
12531        });
12532
12533        $(window).on('uncode-sticky-trigger-observe', function(e){
12534            clearRequestTimeout(setTriggerObserve);
12535            setTriggerObserve = requestTimeout( function(){
12536                $(window).trigger('uncode.tl-refresh');
12537            }, 2000 );
12538        });
12539    
12540    };
12541    textReveal();
12542
12543    var areaReveal = function(){
12544        if ( SiteParameters.is_frontend_editor ) {
12545            return;
12546        }
12547
12548        $('.scroll-trigger-el').each(function(){
12549            var $scrollTrgrEl = $(this),
12550                $row = $('> .row', $scrollTrgrEl),
12551                $row_in = $('> .row-inner', $row),
12552                cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length,
12553                stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows',
12554                animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes',
12555                stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false,
12556                $animateTrgrEl = $scrollTrgrEl,
12557                noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes',
12558                noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'),
12559                els = $scrollTrgrEl.attr('data-anim-els'),
12560                sticky = $scrollTrgrEl.attr('data-anim-sticky'),
12561                noSpace = $scrollTrgrEl.attr('data-anim-no-space'),
12562                state = $scrollTrgrEl.attr('data-anim-state'),
12563                target = $scrollTrgrEl.attr('data-anim-target'),
12564                origin = $scrollTrgrEl.attr('data-anim-origin'),
12565                mask = $scrollTrgrEl.attr('data-anim-mask'),
12566                _scale = $scrollTrgrEl.attr('data-anim-scale'),
12567                stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes',
12568                opacity = $scrollTrgrEl.attr('data-anim-opacity'),
12569                radius = $scrollTrgrEl.attr('data-anim-radius'),
12570                radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'),
12571                clip_path = $scrollTrgrEl.attr('data-clip-path'),
12572                animation_x = $scrollTrgrEl.attr('data-anim-x'),
12573                animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'),
12574                animation_y = $scrollTrgrEl.attr('data-anim-y'),
12575                blur = $scrollTrgrEl.attr('data-anim-blur'),
12576                perspective = $scrollTrgrEl.attr('data-anim-perspective'),			
12577                rotate = $scrollTrgrEl.attr('data-anim-rotate'),	
12578                rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'),
12579                topBottom = $scrollTrgrEl.attr('data-anim-start'),	
12580                offTop = $scrollTrgrEl.attr('data-anim-top'),
12581                offBottom = $scrollTrgrEl.attr('data-anim-bottom'),
12582                safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0,
12583                animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'),
12584                easeOut = $scrollTrgrEl.attr('data-anim-ease'),
12585                offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'),
12586                stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards,
12587                $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(),
12588                setTxtReveal,
12589                txtTrggrStart = false,
12590                alreadyareaAnimateScrollTl = false;
12591    
12592            _scale = _scale === '' ? 0 : parseFloat( _scale );
12593            perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001;	
12594            offTop = offTop === '' ? 0 : parseFloat( offTop );
12595            offBottom = offBottom === '' ? 0 : parseFloat( offBottom );
12596            offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard );
12597
12598            function areaAnimateScrollTl($el, id, last) {
12599                alreadyareaAnimateScrollTl = true;
12600
12601                var pTop = parseFloat( $row.css('padding-top') ),
12602                    innerGap = pTop + offSetCard * id,
12603                    scale = _scale;
12604
12605                if ( isMobileUsing ) {
12606                    innerGap = 0;
12607                }
12608
12609                if ( stepScale ) {
12610                    if ( _scale < 100 ) {
12611                        scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) );
12612                    }
12613                }
12614
12615                if ( els === 'content' ) {
12616                    $animateTrgrEl = $('> .row', $scrollTrgrEl);
12617                } else if ( els === 'bg' ) {
12618                    $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl);
12619                } else {
12620                    $animateTrgrEl = $el;
12621                }
12622
12623                if ( rotate_alt === 'yes') {
12624                    rotate *= -1;
12625                    perspective *= -1;
12626                }
12627                
12628                if ( animation_x_alt === 'yes') {
12629                    animation_x *= -1;
12630                }
12631
12632                var $parentDiv = $el.closest('div[data-sticky]');
12633
12634                var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px";
12635
12636                var scrllTrggr = {
12637                    trigger: $parentDiv,
12638                    end: function(){
12639                        return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom)))
12640                    },
12641                    start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
12642                    pin: sticky === 'yes' || stickyCards ? true : false,
12643                    pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0),
12644                    scrub: true,
12645                    id: 'sticky_' + id,
12646                    anticipatePin: 1,
12647                    invalidateOnRefresh: true,
12648                    // markers: {
12649                    //     indent: 150 * id
12650                    // },
12651                    onToggle: function(){
12652                        $scrollTrgrEl.attr('data-revealed', true);
12653                    },
12654                };
12655
12656                if ( !stickyLast && state === 'end' ) {
12657                    last = false;
12658                } 
12659
12660                if ( stickyCards ) {
12661                    if ( state !== 'end' ) {
12662                        if ( animation_rows_start === 'center' ) {
12663                            scrllTrggr.start = "center center";
12664                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight);
12665                        } else if ( animation_rows_start === 'bottom' ) {
12666                            if ( stickyOpts !== 'no' ) {
12667                                scrllTrggr.start = "bottom bottom";
12668                                scrllTrggr.end = "bottom bottom";
12669                            }
12670                        } else {
12671                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2);
12672                        } 
12673                        if ( stickyOpts === 'no' ) {
12674                            scrllTrggr.endTrigger = $el;
12675                            scrllTrggr.end = "+=100%";
12676                        } else {
12677                            scrllTrggr.endTrigger = $row;
12678                        }
12679                    } else {
12680                        if ( animation_rows_start === 'center' ) {
12681                            scrllTrggr.start = "center center";
12682                        } else if ( animation_rows_start === 'bottom' ) {
12683                            scrllTrggr.start = "bottom bottom";
12684                        } 
12685                        if ( stickyOpts !== 'no' ) {
12686                            scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1));
12687                            scrllTrggr.endTrigger = $lastEl;
12688                        } else {
12689                            scrllTrggr.end = "bottom bottom";
12690                        }
12691                    }
12692                }
12693                
12694                var tl = gsap.timeline({
12695                    scrollTrigger: scrllTrggr
12696                });
12697
12698                // var mark = last ? {
12699                //         startColor:"blue",
12700                //         endColor:"orange",
12701                //     } : false;
12702
12703                if ( !stickyCards ) {
12704                    var tlConds = tl;
12705                } else {
12706                    var scrllTrggrConds = {
12707                        trigger: $parentDiv,
12708                        end: function(){
12709                            return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom)))
12710                        }, 
12711                        pin: (state === 'end' && last),
12712                        pinSpacing: false,
12713                        scrub: true,
12714                        id: 'card_' + id,
12715                        invalidateOnRefresh: true,
12716                        // markers: true,
12717                    };
12718                    if ( stickyCards ) {
12719                        if ( state !== 'end' ) {
12720                            if ( stickyOpts === '' ) {
12721                                scrllTrggrConds.end = "bottom bottom-=100%";
12722                                scrllTrggrConds.endTrigger = $row_in;
12723                            }
12724
12725                            if ( animation_rows_start === 'bottom' ) {
12726                                if ( stickyOpts !== 'no') {
12727                                    scrllTrggrConds.start = "top top+=" + window.innerHeight;
12728                                    scrllTrggrConds.end = "bottom bottom";
12729                                }
12730                            } else if ( animation_rows_start === 'center' ) {
12731                                scrllTrggrConds.start =  "center center";
12732                            } else {
12733                                scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12734                            }
12735                            
12736                        } else {
12737                            if ( stickyOpts === '' ) {
12738                                if ( animLast ) {
12739                                    scrllTrggrConds.end = "bottom bottom-=100%";
12740                                } else {
12741                                    scrllTrggrConds.end = "bottom bottom";
12742                                }
12743                                scrllTrggrConds.endTrigger = $lastEl;
12744                            }
12745
12746                            if ( animation_rows_start === 'bottom' && stickyOpts !== 'no' ) {
12747                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12748                                    scrllTrggrConds.start = "bottom bottom";
12749                                } else {
12750                                    scrllTrggrConds.start = "top top+=" + $el.outerHeight();
12751                                }
12752                            } else if ( animation_rows_start === 'center' ) {
12753                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12754                                    scrllTrggrConds.start =  "center center";
12755                                } else {
12756                                scrllTrggrConds.start =  "top+=" + ($el.outerHeight()/2) + " top+=" 
12756+ window.innerHeight/2;
12757                                }
12758                            } else {
12759                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12760                                    scrllTrggrConds.start = "top top";
12761                                } else {
12762                                    scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12763                                }
12764                            }
12765
12766                        }
12767
12768                    } else {
12769                        scrllTrggrConds.start =  start_topBottom;
12770                    }
12771
12772                    var tlConds = gsap.timeline({
12773                        scrollTrigger: scrllTrggrConds
12774                    });
12775                }
12776
12777                if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) {
12778                    if ( target === 'mask' ) {
12779                        if ( state !== 'end' ) {
12780                            if ( mask === 'auto' ) {
12781                                gsap.set(
12782                                    $animateTrgrEl, {
12783                                        clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12784                                        opacity: parseFloat(opacity)/100,
12785                                        filter: 'blur(' + blur + 'px)',
12786                                        visibility: 'visible',
12787                                    }
12788                                )
12789                                tlConds.fromTo($animateTrgrEl, {
12790                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12791                                    opacity: parseFloat(opacity)/100,
12792                                    filter: 'blur(' + blur + 'px)',
12793                                    duration: 1,
12794                                }, {
12795                                    opacity: 1,
12796                                    clipPath: 'inset(0% 0px round 0' + radiu
12796s_unit + ')',
12797                                    filter: 'blur(0px)',
12798                                    duration: 1,
12799                                    ease: easeOut,
12800                                    //delay: 0.1
12801                                });	
12802                            } else {
12803                                tlConds.fromTo($animateTrgrEl, {
12804                                    opacity: parseFloat(opacity)/100,
12805                                    clipPath: clip_path,
12806                                    filter: 'blur(' + blur + 'px)',
12807                                    duration: 1,
12808                                }, {
12809                                    opacity: 1,
12810                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12811                                    filter: 'blur(0px)',
12812                                    duration: 1,
12813                                    ease: easeOut,
12814                                    //delay: 0.1
12815                                });	
12816                            }
12817                        } else {
12818                            if ( mask === 'auto' ) {
12819                                tlConds.fromTo($animateTrgrEl, {
12820                                    opacity: 1,
12821                                    clipPath: 'inset(0% 0px round 0' + radiu
12821s_unit + ')',
12822                                    filter: 'blur(0px)',
12823                                    duration: 1,
12824                                },{
12825                                    opacity: parseFloat(opacity)/100,
12826                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12827                                    filter: 'blur(' + blur + 'px)',
12828                                    ease: easeOut,
12829                                    duration: 1,
12830                                    //delay: 0.1
12831                                });	
12832                            } else {
12833                                tlConds.fromTo($animateTrgrEl, {
12834                                    opacity: 1,
12835                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12836                                    filter: 'blur(0px)',
12837                                    duration: 1,
12838                                },{
12839                                    opacity: parseFloat(opacity)/100,
12840                                    clipPath: clip_path,
12841                                    filter: 'blur(' + blur + 'px)',
12842                                    duration: 1,
12843                                    ease: easeOut,
12844                                    //delay: 0.1
12845                                });	
12846                            }
12847                        }
12848                    } else {
12849                        if ( state !== 'end' ) {
12850                            if ( scale === 'auto' ) {
12851                                if ( radius ) {
12852                                    gsap.set(
12853                                        $animateTrgrEl, {
12854                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12855                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12856                                            x: animation_x + 'vw',
12857                                            y: animation_y + 'vh',
12858                                            filter: 'blur(' + blur + 'px)',
12859                                            rotation: rotate,
12860                                            rotationX: rotate == 0 ? perspective : 0,
12861                                            transformPerspective: '100vw',
12862                                            opacity: parseFloat(opacity)/100,
12863                                            transformOrigin: origin,
12864                                            borderRadius: radius + radius_unit,
12865                                            visibility: 'visible',
12866                                        }
12867                                    )
12868                                    tlConds.fromTo($animateTrgrEl, {
12869                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12870                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12871                                        x: animation_x + 'vw',
12872                                        y: animation_y + 'vh',
12873                                        filter: 'blur(' + blur + 'px)',
12874                                        rotation: rotate,
12875                                        rotationX: rotate == 0 ? perspective : 0,
12876                                        transformPerspective: '100vw',
12877                                        opacity: parseFloat(opacity)/100,
12878                                        borderRadius: radius + radius_unit,
12879                                        transformOrigin: origin,
12880                                        duration: 1,
12881                                    }, {
12882                                        scaleX: 1,
12883                                        scaleY: 1,
12884                                        x: 0,
12885                                        y: 0,
12886                                        filter: 'blur(0px)',
12887                                        rotation: 0,
12888                                        rotationX: 0,
12889                                        opacity: 1,
12890                                        borderRadius: 0 + radius_unit,
12891                                        transformOrigin: origin,
12892                                        duration: 1,
12893                                        ease: easeOut,
12894                                        //delay: 0.1
12895                                    });	
12896                                } else {
12897                                    gsap.set(
12898                                        $animateTrgrEl, {
12899                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12900                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12901                                            x: animation_x + 'vw',
12902                                            y: animation_y + 'vh',
12903                                            filter: 'blur(' + blur + 'px)',
12904                                            rotation: rotate,
12905                                            rotationX: rotate == 0 ? perspective : 0,
12906                                            transformPerspective: '100vw',
12907                                            opacity: parseFloat(opacity)/100,
12908                                            transformOrigin: origin,
12909                                            visibility: 'visible',
12910                                        }
12911                                    )
12912                                    tlConds.fromTo($animateTrgrEl, {
12913                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12914                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12915                                        x: animation_x + 'vw',
12916                                        y: animation_y + 'vh',
12917                                        filter: 'blur(' + blur + 'px)',
12918                                        rotation: rotate,
12919                                        rotationX: rotate == 0 ? perspective : 0,
12920                                        transformPerspective: '100vw',
12921                                        opacity: parseFloat(opacity)/100,
12922                                        transformOrigin: origin,
12923                                        duration: 1,
12924                                    }, {
12925                                        scaleX: 1,
12926                                        scaleY: 1,
12927                                        x: 0,
12928                                        y: 0,
12929                                        filter: 'blur(0px)',
12930                                        rotation: 0,
12931                                        rotationX: 0,
12932                                        opacity: 1,
12933                                        transformOrigin: origin,
12934                                        duration: 1,
12935                                        ease: easeOut,
12936                                        //delay: 0.1
12937                                    });	
12938                                }
12939                            } else {
12940                                if ( radius ) {
12941                                    gsap.set(
12942                                        $animateTrgrEl, {
12943                                            scaleX: parseFloat( scale ) / 100,
12944                                            scaleY: parseFloat( scale ) / 100,
12945                                            opacity: parseFloat(opacity)/100,
12946                                            x: animation_x + 'vw',
12947                                            y: animation_y + 'vh',
12948                                            filter: 'blur(' + blur + 'px)',
12949                                            rotation: rotate,
12950                                            rotationX: rotate == 0 ? perspective : 0,
12951                                            transformPerspective: '100vw',
12952                                            transformOrigin: origin,
12953                                            borderRadius: radius + radius_unit,
12954                                            visibility: 'visible',
12955                                        }
12956                                    )
12957                                    tlConds.fromTo($animateTrgrEl, {
12958                                        scaleX: parseFloat( scale ) / 100,
12959                                        scaleY: parseFloat( scale ) / 100,
12960                                        opacity: parseFloat(opacity)/100,
12961                                        x: animation_x + 'vw',
12962                                        y: animation_y + 'vh',
12963                                        filter: 'blur(' + blur + 'px)',
12964                                        rotation: rotate,
12965                                        rotationX: rotate == 0 ? perspective : 0,
12966                                        transformPerspective: '100vw',
12967                                        borderRadius: radius + radius_unit,
12968                                        transformOrigin: origin,
12969                                        duration: 1,
12970                                    }, {
12971                                        scaleX: 1,
12972                                        scaleY: 1,
12973                                        opacity: 1,
12974                                        x: 0,
12975                                        y: 0,
12976                                        filter: 'blur(0px)',
12977                                        rotation: 0,
12978                                        rotationX: 0,
12979                                        transformOrigin: origin,
12980                                        ease: easeOut,
12981                                        duration: 1,
12982                                        borderRadius: 0 + radius_unit,
12983                                        //delay: 0.1
12984                                    });	
12985                                } else {
12986                                    gsap.set(
12987                                        $animateTrgrEl, {
12988                                            scaleX: parseFloat( scale ) / 100,
12989                                            scaleY: parseFloat( scale ) / 100,
12990                                            opacity: parseFloat(opacity)/100,
12991                                            x: animation_x + 'vw',
12992                                            y: animation_y + 'vh',
12993                                            filter: 'blur(' + blur + 'px)',
12994                                            rotation: rotate,
12995                                            rotationX: rotate == 0 ? perspective : 0,
12996                                            transformPerspective: '100vw',
12997                                            transformOrigin: origin,
12998                                            visibility: 'visible',
12999                                        }
13000                                    )
13001                                    tlConds.fromTo($animateTrgrEl, {
13002                                        scaleX: parseFloat( scale ) / 100,
13003                                        scaleY: parseFloat( scale ) / 100,
13004                                        opacity: parseFloat(opacity)/100,
13005                                        x: animation_x + 'vw',
13006                                        y: animation_y + 'vh',
13007                                        filter: 'blur(' + blur + 'px)',
13008                                        rotation: rotate,
13009                                        rotationX: rotate == 0 ? perspective : 0,
13010                                        transformPerspective: '100vw',
13011                                        transformOrigin: origin,
13012                                        duration: 1,
13013                                    }, {
13014                                        scaleX: 1,
13015                                        scaleY: 1,
13016                                        opacity: 1,
13017                                        x: 0,
13018                                        y: 0,
13019                                        filter: 'blur(0px)',
13020                                        rotation: 0,
13021                                        rotationX: 0,
13022                                        transformOrigin: origin,
13023                                        duration: 1,
13024                                        ease: easeOut,
13025                                        //delay: 0.1
13026                                    });
13027                                }
13028                            }
13029                        } else {
13030                            if ( scale === 'auto' ) {
13031                                tlConds.fromTo($animateTrgrEl, {
13032                                    scaleX: 1,
13033                                    scaleY: 1,
13034                                    opacity: 1,
13035                                    x: 0,
13036                                    y: 0,
13037                                    filter: 'blur(0px)',
13038                                    rotation: 0,
13039                                    rotationX: 0,
13040                                    transformOrigin: origin,
13041                                    duration: 1,
13042                                }, {
13043                                    scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13044                                    scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13045                                    opacity: parseFloat(opacity)/100,
13046                                    x: animation_x + 'vw',
13047                                    y: animation_y + 'vh',
13048                                    filter: 'blur(' + blur + 'px)',
13049                                    rotation: rotate,
13050                                    rotationX: rotate == 0 ? perspective : 0,
13051                                    transformPerspective: '100vw',
13052                                    transformOrigin: origin,
13053                                    duration: 1,
13054                                    ease: easeOut,
13055                                    //delay: 0.1
13056                                })
13057                            } else {
13058                                tlConds.fromTo($animateTrgrEl, {
13059                                    scaleX: 1,
13060                                    scaleY: 1,
13061                                    opacity: 1,
13062                                    x: 0,
13063                                    y: 0,
13064                                    filter: 'blur(0px)',
13065                                    rotation: 0,
13066                                    rotationX: 0,
13067                                    transformPerspective: '100vw',
13068                                    transformOrigin: origin,
13069                                    borderRadius: 0 + radius_unit,
13070                                    duration: 1,
13071                                }, {
13072                                    scaleX: parseFloat( scale ) / 100,
13073                                    scaleY: parseFloat( scale ) / 100,
13074                                    opacity: parseFloat(opacity)/100,
13075                                    x: animation_x + 'vw',
13076                                    y: animation_y + 'vh',
13077                                    filter: 'blur(' + blur + 'px)',
13078                                    rotation: rotate,
13079                                    rotationX: rotate == 0 ? perspective : 0,
13080                                    transformPerspective: '100vw',
13081                                    transformOrigin: origin,
13082                                    borderRadius: radius + radius_unit,
13083                                    duration: 1,
13084                                    ease: easeOut,
13085                                    //delay: 0.1
13086                                })
13087                            }
13088                        }
13089                    }
13090                }
13091
13092                function headingReveal($el){
13093                    txtTrggrStart = true;
13094                    $('.text-reveal', $el).each(function(_key, _val){
13095                        var $txtReveal = $(_val),
13096                            dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
13097                            dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
13098                            $lines = $('.heading-line-wrap', $txtReveal),
13099                            $words = $('.split-word-inner', $txtReveal),
13100                            $chars = $('.split-char', $txtReveal),
13101                            _setTxtReveal,
13102                            $elToReveal = $words;
13103
13104                        if ( !(sticky === 'yes' || stickyCards) ) {
13105                            return;
13106                        }
13107            
13108                        easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut;
13109
13110                        if ( dataReveal === 'chars' ) {
13111                            $elToReveal = $chars;
13112                        } else if ( dataReveal === 'lines' ) {
13113                            $elToReveal = $lines;
13114                        }
13115
13116                        var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr;
13117                        scrllTrggrTxt.id = "txt_reveal_" + _key; 
13118                        scrllTrggrTxt.pin = false;
13119
13120                        gsap.set($elToReveal, {opacity: dataRevealOpacity});
13121                        var _tl = gsap.timeline({
13122                            scrollTrigger: scrllTrggrTxt
13123                        });
13124                        _tl.fromTo($elToReveal, {
13125                            opacity: dataRevealOpacity,
13126                        }, {
13127                            opacity: 1,
13128                            stagger: 0.05
13129                        });
13130
13131                        $scrollTrgrEl.one( 'uncodeWordLines', function(){
13132                            clearRequestTimeout(_setTxtReveal);
13133                            _setTxtReveal = requestTimeout( function(){
13134                                gsap.set($elToReveal, {clearProps: true});
13135                                _tl.kill(true);
13136                                if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) {
13137                                    ScrollTrigger.getById("txt_reveal_" + _key).kill(true);
13138                                }
13139                                headingReveal($el)
13140                            }, 100);
13141                        });
13142
13143                    });
13144                };
13145
13146                if (!txtTrggrStart) {
13147                    headingReveal($el);
13148                }
13149
13150                $scrollTrgrEl.one( 'uncodeWordLines', function(){
13151                    if (!txtTrggrStart) {
13152                        headingReveal($el);
13153                    }
13154                });
13155                
13156                var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
13157                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight );
13158                var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 
13159                    document.documentElement.clientWidth,  document.documentElement.scrollWidth,  document.documentElement.offsetWidth );
13160                    
13161                $(window).on('uncode-sticky-trigger-observe', function(e){
13162                    var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
13163                    var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );
13164                    $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false});
13165                    //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style');
13166                    if ( stickyCards ) {
13167                        $('.tmb', $scrollTrgrEl).removeAttr('style');
13168                    }
13169                    var scrollnow = document.body.scrollTop || document.documentElement.scrollTop;
13170                    clearRequestTimeout(setTxtReveal);
13171                    setTxtReveal = requestTimeout( function(){
13172                        $(document).trigger('uncode-scrolltrigger-refresh');
13173                        if ( isMobileUsing ) {
13174                            if ( typeof tl !== 'undefined' ) {
13175                                tl.scrollTrigger.refresh();
13176                            }
13177                            if ( typeof tlConds !== 'undefined' ) {
13178                                tlConds.scrollTrigger.refresh();
13179                            }
13180                            $(window).trigger('scroll');
13181                            _width = __width;
13182                        } else if ( _width !== __width && ( isMobileUsing ) ) {
13183                            window.dispatchEvent(new CustomEvent('vc-resize'));
13184                            if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
13185                                window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){
13186                                    if ( typeof tl !== 'undefined' ) {
13187                                        tl.scrollTrigger.refresh();
13188                                    }
13189                                    if ( typeof tlConds !== 'undefined' ) {
13190                                        tlConds.scrollTrigger.refresh();
13191                                    }
13192                                    window.lenis.scrollTo(scrollnow, {duration: 0.01});
13193                                }});
13194                            } else {
13195                                if ( typeof tl !== 'undefined' ) {
13196                                    tl.scrollTrigger.refresh();
13197                                }
13198                                if ( typeof tlConds !== 'undefined' ) {
13199                                    tlConds.scrollTrigger.refresh();
13200                                }
13201                                $(window).trigger('scroll');
13202                            }
13203                            _height = __height;
13204                        }
13205                    }, 500);
13206                });
13207
13208
13209                $(window).on('load ', function(e){
13210                    var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
13211                    if ( _height !== ___height ) {
13212                        $scrollTrgrEl.attr('data-toggled', true);
13213                        $(window).trigger('resize');
13214                        if ( typeof tl !== 'undefined' ) {
13215                            tl.scrollTrigger.refresh();
13216                        }
13217                        if ( typeof tlConds !== 'undefined' ) {
13218                            tlConds.scrollTrigger.refresh();
13219                        }
13220                        _height = ___height;
13221                    }
13222
13223                    
13224                    
13225                    $(document).trigger('uncode-scrolltrigger-refresh');
13226
13227                });
13228
13229            };
13230
13231            var callAreaAnimateScrollTl = function() {
13232                if ( stickyCards ) {
13233                    $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){
13234                        if ( key+1 < cardL || animLast || state !== 'end' ) {
13235                            var $this = $(val),
13236                                last = key+1===cardL;
13237                            areaAnimateScrollTl($this, key, last);
13238                        }
13239                    });
13240                } else {
13241                    areaAnimateScrollTl($scrollTrgrEl, 0, false);
13242                }    
13243            };
13244
13245            $(window).on('wwResize', function(){
13246                if ( !alreadyareaAnimateScrollTl ) {
13247                    if ( noMobile ) {
13248                        if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13249                            return;
13250                        } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13251                            return;
13252                        }
13253                    }
13254                    
13255                    callAreaAnimateScrollTl();
13256                }
13257            })
13258
13259            if ( noMobile ) {
13260                if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13261                    return;
13262                } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13263                    return;
13264                }
13265            }
13266
13267            callAreaAnimateScrollTl();
13268
13269        });
13270
13271    };
13272
13273    areaReveal();
13274
13275};
13276
13277UNCODE.thumbsReveal = function() {
13278    var recalc = false,
13279    revealThumbs = function( $el ){
13280        if ( typeof $el === 'undefined' || $el === null || !$el.length ) {
13281            $el = $('body');
13282        }
13283        $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){
13284            var $container = $(this),
13285                $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container),
13286                isContainer = false;
13287
13288            if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) {
13289                $stickys.each(function(){
13290                    var $sticky = $(this).addClass('tmb-mask-init'),
13291                        $rellax = $sticky.closest('.parallax-el'),
13292                        $inside = $('.t-inside', $sticky),
13293                        $media = $('img, video, .fluid-object', $sticky).attr('loading', ''),
13294                        val = parseFloat( $inside.attr('data-scroll-val') );
13295
13296                    if ( $rellax.length ) {
13297                        recalc = true;
13298                    }
13299
13300                    val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val;
13301                    
13302                    if ( $sticky.hasClass('tmb-mask-scroll') ) {
13303
13304                        var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both'))
13305                        ? val*0.05 : 0;
13306                        var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
13307                            ? val*4 : 0;
13308                        var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) ? parax*0.01 : 0;
13309
13310                        var tl = gsap.timeline({
13311                            scrollTrigger: {
13312                                trigger: $sticky,
13313                                scrub: true,
13314                            }
13315                        });
13316
13317                        tl.fromTo($media, {
13318                            yPercent: -(parax),
13319                            scale: 1 + zoom + extra,
13320                        }, {
13321                            yPercent: parax,
13322                            scale: 1 + extra,
13323                            ease: "none",
13324                        });
13325
13326                        if ( recalc ) {
13327                            $(window).on('uncode-thumbsreveal-refresh', function(){
13328                                if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
13329                                    tl.scrollTrigger.refresh();
13330                                }
13331                            });
13332                        }
13333                    }
13334                });
13335            }
13336
13337            if ( $container.has('.tmb-mask-reveal') ) {
13338                var $markTrigger = ".tmb-mask-reveal .t-entry-visual",
13339                staggerTime = 0.1;
13340
13341                $('.t-inside', $container).each(function(){
13342                    var checkEasing = $(this).attr('data-easing');
13343                    if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') {
13344                        gsap.registerPlugin(CustomEase);
13345                        return false;
13346                    }
13347                });
13348
13349                if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) {
13350                    $markTrigger = $container;
13351                    isContainer = true;
13352                    staggerTime = 0;
13353                }
13354
13355                ScrollTrigger.batch( $markTrigger, {
13356                    start: function( el ){
13357                        /*if ( el.trigger.offsetHeight < (window.innerHeight/2) ) {
13358                            return "bottom bottom";
13359                        } else {*/
13360                            return  "top 96%";
13361                        //}
13362                    },
13363                    onEnter: function(batch){
13364                        var $inside = $(batch).closest('.t-inside');
13365
13366                        if ( isContainer ) {
13367                            var $inside = $(batch).find('.t-inside').first();
13368                        }
13369
13370                        var delay = parseFloat( $inside.attr('data-delay') ),
13371                            speed = parseFloat( $inside.attr('data-speed') ),
13372                            easing = $inside.attr('data-easing'),
13373                            bgDelay = parseFloat( $inside.attr('data-bg-delay') );
13374
13375                        delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
13376                        speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
13377                        easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
13378                        bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
13379
13380                        if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) {
13381                            gsap.to($('.t-entry-visual-tc', batch), speed, {
13382                                clipPath: 'inset(0% 0% 0% 0%)',
13383                                stagger: staggerTime,
13384                                delay: delay,
13385                                ease: easing,
13386                            });
13387                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
13388                                clipPath: 'inset(0% 0% 0% 0%)',
13389                                stagger: staggerTime,
13390                                scale: 1,
13391                                delay: delay + (speed*bgDelay),
13392                                ease: easing,
13393                            });
13394                        } else {
13395                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
13396                                clipPath: 'inset(0% 0% 0% 0%)',
13397                                stagger: staggerTime,
13398                                scale: 1,
13399                                delay: delay,
13400                                ease: easing,
13401                            });
13402                        }
13403                                                    
13404                    }
13405                });
13406            }
13407
13408        });
13409
13410        function raf(time) {
13411            requestAnimationFrame(raf)
13412            $(window).trigger('uncode-thumbsreveal-refresh');
13413        }
13414
13415        if ( recalc ) {
13416            requestAnimationFrame(raf)
13417        }
13418
13419    };
13420    $(window).on( 'load more-items-loaded', function(){
13421        revealThumbs();
13422    });
13423
13424    $(document).on('uncode-ajax-filtered', function(){
13425        revealThumbs();
13426    });
13427
13428    if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
13429        window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
13430            var $el = model.view.$el,
13431                shortcode = model.attributes.shortcode;
13432
13433            if ( $el.is('.custom-grid-container') ) {
13434                $el = $el.parent();
13435            }
13436
13437            if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') {
13438                revealThumbs($el);
13439            }
13440        });
13441    }
13442
13443};
13444
13445UNCODE.revslider = function() {
13446	var revSlider6In = function(){
13447		$('rs-module').each(function(){
13448			var $slider = $(this);
13449
13450			$slider.on('revolution.slide.onloaded', function(e, data){
13451				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13452					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
13453						scrolltop = $(document).scrollTop();
13454					if ( style != undefined ) {
13455						UNCODE.switchColorsMenu(scrolltop, style);
13456					}
13457				}
13458			});
13459
13460			$slider.on('revolution.slide.onchange', function(e, data){
13461				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13462					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
13463						scrolltop = $(document).scrollTop();
13464					if ( style != undefined ) {
13465						UNCODE.switchColorsMenu(scrolltop, style);
13466					}
13467				}
13468			});
13469
13470		});
13471
13472	};
13473	revSlider6In();
13474	$(window).on("load", revSlider6In );
13475
13476	document.addEventListener("sr.module.ready", function(e) { 
13477		var $slider = $('#'+e.id),
13478			settings = SR7.JSON[e.id];
13479
13480		if ( typeof settings !== 'undefined' && settings !== null ) {
13481			if ( $slider.closest(".header-revslider").length ) {
13482				var style = settings.slides[1].slide.attr.data,
13483					scrolltop = $(document).scrollTop();
13484				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13485				style = style[1];
13486				if ( style[1] != undefined ) {
13487					UNCODE.switchColorsMenu(scrolltop, style);
13488				}
13489			}
13490		}
13491	});
13492
13493	document.addEventListener("sr.slide.afterChange", function(e) {
13494		var $slider = $('#'+e.id),
13495			settings = SR7.JSON[e.id];
13496
13497		if ( typeof settings !== 'undefined' && settings !== null ) {
13498			if ( $slider.closest(".header-revslider").length ) {
13499				var style = settings.slides[e.current.id].slide.attr.data,
13500					scrolltop = $(document).scrollTop();
13501				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13502				style = style[1];
13503				if ( style != undefined ) {
13504					UNCODE.switchColorsMenu(scrolltop, style);
13505				}
13506			}
13507		}
13508	});
13509
13510};
13511UNCODE.layerslider = function() {
13512	$(window).on("load", function() {
13513
13514		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
13515
13516			var slideData = slider.slides.current.data,
13517				scrolltop = $(document).scrollTop();
13518			if( slideData && slideData.skin ) {
13519
13520				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
13521
13522			}
13523		});
13524
13525	});
13526};
13527
13528UNCODE.ajax_filters = function () {
13529	var isAjaxing = false;
13530
13531/*************************
13532 *
13533 * Filters Menu and Widgets Area
13534 *
13535 ************************/
13536
13537 	var clear_clicked = false;
13538
13539 	var init_ajax_grid = function(){
13540
13541		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
13542		$grids.each(function(index, val){
13543			var $body = $('body'),
13544				$grid = $(val).addClass('init-ajax-grid'),
13545				starting_point = $grid.attr('data-toggle'),
13546				$trigger = $('.uncode-toggle-ajax-filters', $grid),
13547				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
13548				$isotope_wrapper = $('.isotope-wrapper', $grid),
13549				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
13550				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
13551				$footprint = $('.ajax-filter-footprint', $grid),
13552				sidebar_w,
13553				data_w = parseFloat( $sidebar.attr('data-max-width') ),
13554				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
13555				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
13556				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
13557				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13558				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
13559				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0).attr('data-lenis-prevent', true),
13560				sidew,
13561				$inside_row = $('> .row-parent', $vc_row),
13562				bg_row,
13563				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
13564				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
13565				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
13566				sidebar_overlay = false,
13567				sidebar_hover = false,
13568				switchMobile = false,
13569				scrollTop;
13570
13571			if ( $vc_row.attr('class') ) {
13572				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
13573			}
13574
13575			if ( bg_row != null ) {
13576				$side_header.add($side_footer).addClass(bg_row[0]);
13577			}
13578
13579			$trigger.add($apply_filters).on('click', function(e){
13580				e.preventDefault();
13581				e.stopPropagation();
13582				$grid = $('.ajax-grid-system').eq(0);
13583				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13584				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13585				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13586				sidebar_w = $sidebar_wrapper.width();
13587				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13588				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
13589					$(this).trigger('uncode-ajax-clear-filters');
13590				}
13591				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13592					$grid.toggleClass('ajax-hide-filters-blanks');
13593					$sidebar.slideToggle({
13594						duration: 400,
13595						easing: 'easeOutQuad',
13596					});
13597				} else {
13598					$grid.removeClass('ajax-hide-filters-blanks');
13599					$grid.toggleClass('ajax-hide-filters');
13600					if ( $grid.hasClass('ajax-hide-filters') ) {
13601						$body.addClass('ajax-hide-filters');
13602					} else {
13603						scrollTop = $('html, body').scrollTop();
13604						$body.removeClass('ajax-hide-filters');
13605					}
13606				}
13607				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13608					$('html, body').scrollTop(scrollTop);
13609				}
13610				return false;
13611			});
13612
13613			$close_btn.on('click', function(e){
13614				e.preventDefault();
13615				$grid = $('.ajax-grid-system').eq(0);
13616				$grid.addClass('ajax-hide-filters');
13617				if ( $grid.hasClass('ajax-hide-filters') ) {
13618					$body.addClass('ajax-hide-filters');
13619				} else {
13620					scrollTop = $('html, body').scrollTop();
13621					$body.removeClass('ajax-hide-filters');
13622				}
13623				$('html, body').scrollTop(scrollTop);
13624			});
13625
13626			$sidebar_wrapper.on('mouseover',function(){
13627				sidebar_hover = true;
13628			}).on('mouseout', function(){
13629				sidebar_hover = false;
13630			});
13631
13632			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
13633				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
13634					return;
13635				}
13636				if (undefined !== from && from === 'select_active_attributes') {
13637					return;
13638				}
13639				if ($(e.target).closest('.select2-container--open').length ) {
13640					return;
13641				}
13642				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
13643					$grid.add($body).addClass('ajax-hide-filters');
13644				}
13645			});
13646
13647			$sorting_trgr.on('click', function(e) {
13648				e.preventDefault();
13649			});
13650
13651			var inside_width = function(){
13652				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13653				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13654				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13655				$inside_row = $('> .row-parent', $vc_row);
13656				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
13657					sidew = $sidebar.width();
13658					$inside_row.css({
13659						width: sidew
13660					});
13661				} else {
13662					$inside_row.css({
13663						width: ''
13664					});
13665				}
13666			};
13667			inside_width();
13668
13669			var ajax_sidebar_position = function(e, f_editor){
13670				$grid = $('.ajax-grid-system').eq(0);
13671				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13672				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13673				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13674				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13675				$inside_row = $('> .row-parent', $vc_row);
13676				scrollTop = $('html, body').scrollTop();
13677				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
13678					$grid.add($body).addClass('ajax-hide-filters');
13679					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
13680					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
13681					sidebar_overlay = true;
13682					$body.addClass('ajax-filter-sidebar-overlay');
13683					$sidebar_wrapper.addClass(skin);
13684					var sideHeadH = $side_header.outerHeight(),
13685						sideFooterH = $side_footer.outerHeight();
13686					if ( data_w !== '' && data_w > 0 ) {
13687						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
13688							$sidebar.css({
13689								'max-width': data_w
13690							});
13691						} else {
13692							$sidebar.css({
13693								'max-width':'none'
13694							});
13695						}
13696					}
13697					$vc_row.css({
13698						'padding-top':sideHeadH,
13699						'padding-bottom':sideFooterH
13700					});
13701					var sidew = $sidebar.width();
13702					$inside_row.css({
13703						width: sidew
13704					});
13705					switchMobile = true;
13706				} else {
13707					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
13708						scrollTop = $('html, body').scrollTop();
13709						$grid.add($body).removeClass('ajax-hide-filters');
13710					}
13711					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
13712						$grid.addClass('ajax-hide-filters-blanks');
13713						$sidebar.hide();
13714					}
13715					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
13716					$('.ajax-sidebar-placeholder', $grid).remove();
13717					sidebar_overlay = false;
13718					$body.removeClass('ajax-filter-sidebar-overlay');
13719					$sidebar_wrapper.removeClass(skin);
13720					if ( data_w !== '' && data_w > 0 ) {
13721						$sidebar.css({
13722							'max-width':'none'
13723						});
13724					}
13725					$vc_row.css({
13726						'padding-top':0,
13727						'padding-bottom':0,
13728					});
13729
13730					$inside_row.css({
13731						width: ''
13732					});
13733
13734					if ( f_editor === true ) {
13735						UNCODE.ajax_filters();
13736					}
13737
13738					switchMobile = false;
13739				}
13740				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13741					$('html, body').scrollTop(scrollTop);
13742				}
13743			};
13744
13745			var sidebar_width = function(){
13746				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13747					sidebar_w = $footprint.width();
13748					$sidebar.css({ width: sidebar_w });
13749				} else {
13750					$sidebar.css({ width: '' });
13751				}
13752			};
13753			sidebar_width();
13754
13755			if ( SiteParameters.is_frontend_editor ) {
13756				ajax_sidebar_position();
13757			}
13758
13759			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
13760				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
13761					ajax_sidebar_position(e);
13762				}
13763				sidebar_width();
13764			});
13765
13766			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
13767				ajax_sidebar_position(e, true);
13768			});
13769
13770			$isotope_wrapper.on('transitionend', function(e){
13771				if ( $(e.target).hasClass('isotope-wrapper') ) {
13772					window.dispatchEvent(new CustomEvent('boxResized'));
13773				}
13774				return false;
13775			});
13776
13777			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
13778				var $grid = $('.ajax-grid-system').eq(0);
13779				$grid.addClass('ajax-hide-filters');
13780			}
13781
13782		});
13783	};
13784
13785	init_ajax_grid();
13786	$(document).on('uncode-ajax-filtered', init_ajax_grid);
13787
13788/*************************
13789 *
13790 * Hover hack
13791 *
13792 ************************/
13793 	var widget_hover_hack = function() {
13794 		$('.widget, .uncode_widget').each(function(){
13795			var $widget = $(this),
13796				class_w = $widget.attr('class'),
13797				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
13798				$footer = $widget.closest('#colophon');
13799
13800			if ( class_w.indexOf('widget_yith') > 0 ) {
13801				return true;
13802			}
13803
13804			$lis.each(function(){
13805 				var $li = $(this),
13806 					$a = $('a', $li),
13807 					$label = $a.closest('label');
13808
13809				if ( !$footer.length ) {
13810					$li.addClass('no-evts');
13811				}
13812
13813				if ( ! $('span', $a).length ) {
13814 					$li.addClass( 'li-hover' );
13815 				}
13816
13817 				$('li', $li).hover(function(e){
13818 					$(e.target).parents('li').each(function(){
13819 						$(this).addClass( 'parent-li-hover' );
13820 					});
13821					}, function (e) {
13822 					$(e.target).parents('li').each(function(key, val){
13823 						if ( key === 0) {
13824	 						$(val).removeClass( 'parent-li-hover' );
13825	 					}
13826 					});
13827 				});
13828
13829				$li.off('mouseup').on('mouseup', function (e) {
13830					if (e.which !== 3) {
13831						e.stopPropagation();
13832						var $a = $('a', this).first();
13833						$a[0].click();
13834					}
13835	 			});
13836 			});
13837 		});
13838	  }
13839
13840	var ajax_filters_button_mode = $('body').hasClass('ajax-filters-button-mode');
13841
13842	if (!ajax_filters_button_mode && SiteParameters.disable_hover_hack !== '1') {
13843		widget_hover_hack();
13844		$(document).on('uncode-ajax-filtered', widget_hover_hack);
13845	}
13846
13847/*************************
13848 *
13849 * Init Filters
13850 *
13851 ************************/
13852
13853	function init_filters() {
13854		$(document).on('click', '.term-filter-link', function(e) {
13855			var _this = $(this);
13856			var widget = _this.closest('.uncode_widget');
13857			var container = get_filters_container();
13858
13859			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13860				return true;
13861			}
13862
13863			e.preventDefault();
13864
13865			if (widget.hasClass('widget-ajax-filters--checkbox')) {
13866				_this.parent().find('input[type="checkbox"]').trigger('click');
13867			} else {
13868				if (_this.hasClass('term-filter-link--active')) {
13869					_this.removeClass('term-filter-link--active');
13870				} else {
13871					_this.addClass('term-filter-link--active');
13872
13873					if (widget.hasClass('widget-ajax-filters--single')) {
13874						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
13875					}
13876				}
13877
13878				if (!ajax_filters_button_mode) {
13879					var url = _this.attr('href');
13880
13881					reload_items(container, url, true);
13882				}
13883			}
13884		});
13885
13886		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
13887			var _this = $(this);
13888			var widget = _this.closest('.uncode_widget');
13889			var link = _this.closest('.term-filter').find('.term-filter-link');
13890			var url = link.attr('href');
13891			var container = get_filters_container();
13892
13893			if (!ajax_filters_button_mode && widget.hasClass('widget-ajax-filters--no-ajax')) {
13894				window.location = url;
13895				return;
13896			}
13897
13898			if (widget.hasClass('widget-ajax-filters--single')) {
13899				widget.find('input[type="checkbox"]').each(function() {
13900					if (_this.attr('id') !== $(this).attr('id')) {
13901						$(this).prop('checked', false);
13902						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
13903					}
13904				});
13905			}
13906
13907			if (_this.prop('checked')) {
13908				link.addClass('term-filter-link--active');
13909			} else {
13910				link.removeClass('term-filter-link--active');
13911			}
13912
13913			if (!ajax_filters_button_mode) {
13914				reload_items(container, url, true);
13915			}
13916		});
13917
13918		$(document).on('change', 'select.select--term-filters', function(e) {
13919			var _this = $(this);
13920			var selected = _this.find('option:selected');
13921			var option = $(selected);
13922			var url = option.attr('data-term-filter-url');
13923			var container = get_filters_container();
13924			var widget = _this.closest('.uncode_widget');
13925
13926			if (!ajax_filters_button_mode) {
13927				if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13928					window.location = url;
13929				} else {
13930					reload_items(container, url, true);
13931				}
13932			}
13933		});
13934
13935		$(document).on('click', '.filter-list__link', function(e) {
13936			if (SiteParameters.is_frontend_editor) {
13937				return false;
13938			}
13939
13940			e.preventDefault();
13941
13942			var _this = $(this);
13943			var container = get_filters_container();
13944			var url = _this.attr('href');
13945			reload_items(container, url, true);
13946		});
13947
13948		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
13949			var _this = $(this);
13950			var container = get_filters_container();
13951			var url = _this.attr('href');
13952			reload_items(container, url, true);
13953		});
13954
13955		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
13956
13957			var _this = $(this);
13958			var container = get_filters_container();
13959			var url = _this.attr('href');
13960
13961			if ( container.length ) {
13962				e.preventDefault();
13963				reload_items(container, url, true);
13964			}
13965		});
13966
13967		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
13968			var _this = $(this);
13969			var container = get_filters_container();
13970
13971			if (container.length > 0) {
13972				e.preventDefault();
13973
13974				var min_price = $('#min_price').val();
13975				var max_price = $('#max_price').val();
13976				var location = window.location;
13977				var url = location.href;
13978				var page_uri = location.origin + location.pathname;
13979				var is_filtered = page_uri !== url;
13980
13981				if (is_filtered) {
13982					url = remove_parameter_from_url(url, 'min_price');
13983					url = remove_parameter_from_url(url, 'max_price');
13984				}
13985
13986				var concat = page_uri === url ? '?' : '&';
13987				var params = {'min_price': min_price, 'max_price': max_price};
13988
13989				url = url + concat + $.param(params);
13990
13991				reload_items(container, url, true);
13992			}
13993		});
13994
13995		var search_timer;
13996
13997		if (!ajax_filters_button_mode) {
13998			$(document).on('keyup', '.term-filters-search-input', function (e) {
13999				var _this = $(this);
14000				var container = get_filters_container();
14001				var value = _this.val();
14002
14003				if (search_timer) {
14004					clearTimeout(search_timer);
14005				}
14006
14007				search_timer = setTimeout(function () {
14008					update_search_url(container, value);
14009				}, 500);
14010			});
14011		}
14012
14013		$(document).on('click', '.btn-ajax-filters-trigger', function (e) {
14014			var container = get_filters_container();
14015
14016			if (container.length) {
14017				e.preventDefault();
14018				var paramMap = {};
14019
14020				$('.term-filter-link--active').each(function () {
14021					collect_from_query(paramMap, this.href.split('?')[1] || '');
14022				});
14023
14024				$('.select--term-filters').each(function () {
14025					var select = $(this);
14026					var val = select.val();
14027
14028					if (!val) {
14029						return
14030					};
14031
14032					var selected_option = select.find('option:selected');
14033					var qUrl = selected_option.data('term-filter-url') || '';
14034
14035					collect_from_query(paramMap, qUrl.split('?')[1] || '');
14036				});
14037
14038				var search = $('.term-filters-search-input');
14039
14040				if (search.length > 0) {
14041					var search_value = search.val().trim();
14042					if (search_value) {
14043						paramMap[SiteParameters.ajax_filter_key_search] = {};
14044						paramMap[SiteParameters.ajax_filter_key_search][search_value] = 1;
14045					}
14046				}
14047
14048				var qsParts = [];
14049				$.each(paramMap, function (key, valSet) {
14050					var vals = Object.keys(valSet);
14051					qsParts.push(key + '=' + vals.join(','));
14052				});
14053
14054				var final_url = window.location.origin + window.location.pathname;
14055
14056				if (qsParts.length > 0) {
14057					qsParts.push('unfilter=1');
14058
14059					var qs = qsParts.join('&');
14060					final_url = '?' + qs;
14061				}
14062
14063				reload_items(container, final_url, true);
14064			}
14065		});
14066	}
14067
14068	function collect_from_query(paramMap, query) {
14069		$.each(query.split('&'), function (_, pair) {
14070			if (!pair) {
14071				return
14072			};
14073
14074			var kv  = pair.split('=');
14075			var key = kv[0];
14076			var val = kv[1] || '';
14077
14078			if (key === 'unfilter') {
14079				return;
14080			}
14081			if (!paramMap[key]) {
14082				paramMap[key] = {}
14083			};
14084
14085			paramMap[key][val] = 1;
14086		});
14087	}
14088
14089	function update_search_url(container, search_value) {
14090		var location = window.location;
14091		var url = location.href;
14092		var page_uri = location.origin + location.pathname;
14093		var is_filtered = page_uri !== url;
14094		var key_search = SiteParameters.ajax_filter_key_search;
14095		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
14096
14097		if (is_filtered) {
14098			url = remove_parameter_from_url(url, key_search);
14099			url = remove_parameter_from_url(url, key_unfilter);
14100		}
14101
14102		if (search_value) {
14103			var concat = page_uri === url ? '?' : '&';
14104			var params = {};
14105
14106			params[key_search] = search_value;
14107			params[key_unfilter] = 1;
14108			url = url + concat + $.param(params);
14109		} else {
14110			url = remove_parameter_from_url(url, key_search);
14111		}
14112
14113		reload_items(container, url, true);
14114	}
14115
14116	function remove_parameter_from_url(url, parameter) {
14117		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
14118	}
14119
14120	function get_filters_container() {
14121		var container = $('.ajax-grid-system');
14122
14123		if (container.length == 0) {
14124			container = $('.ajax-filters');
14125		}
14126
14127		if (container.length == 0) {
14128			container = $('.ajax-filters-target');
14129		}
14130
14131		return container;
14132	}
14133
14134	function update_widgets_state(widgets_states, container) {
14135		for (var i = widgets_states.length - 1; i >= 0; i--) {
14136			var state = widgets_states[i];
14137
14138			if (!state.collapse) {
14139				continue;
14140			}
14141
14142			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
14143
14144			if (state.open) {
14145				new_widget.find('.widget-title').addClass('open');
14146				if (state.css) {
14147					new_widget.find('.widget-collapse-content').attr('style', state.css);
14148				}
14149			} else {
14150				new_widget.find('.widget-title').removeClass('open');
14151				if (state.css) {
14152					new_widget.find('.widget-collapse-content').attr('style', state.css);
14153				}
14154			}
14155		}
14156	}
14157
14158	// Find filters container
14159	function find_filters_container(context) {
14160		return context.find('.widget-ajax-filters').closest('.row-parent').find('.uncol').first();
14161	}
14162
14163	// Reload items via AJAX
14164	function reload_items(container, url, push) {
14165		if (isAjaxing) {
14166			return
14167		};
14168
14169		isAjaxing = true;
14170
14171		container.addClass('grid-filtering');
14172
14173		$.ajax({
14174			url     : url,
14175			success : function(response) {
14176				if (!response) {
14177					return;
14178				}
14179
14180				$(document).trigger('uncode-ajax-pre-filtered');
14181
14182				var container_id = container.attr('id');
14183				var pagination = $('.row-navigation');
14184				var filters_container;
14185
14186				var isTargetFilterMode = container.hasClass('ajax-filters-target');
14187
14188				if (isTargetFilterMode) {
14189					filters_container = find_filters_container($(document));
14190				}
14191
14192				if (container_id) {
14193					var container_to_append = $(response).find('#' + container_id);
14194					var pagination_to_append = $(response).find('.row-navigation');
14195					var filters_to_append;
14196					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
14197
14198					if (isTargetFilterMode) {
14199						filters_to_append = find_filters_container($(response));
14200					}
14201
14202					// Remember open/closed widgets
14203					var widgets = $('.uncode_widget');
14204					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
14205					var widgets_states = [];
14206
14207					widgets.each(function() {
14208						var widget = $(this);
14209						var id = widget.attr('data-id');
14210						var state = {
14211							'id': id,
14212							'collapse': false,
14213							'open': false,
14214							'css': false,
14215						};
14216
14217						var collapse_wrapper = widget.find('.widget-collapse-content');
14218
14219						if (collapse_wrapper.length > 0) {
14220							state.collapse = true;
14221
14222							var collapse_wrapper_css = collapse_wrapper.attr('style');
14223							var title = widget.find('.widget-title');
14224
14225							state.css = collapse_wrapper_css;
14226
14227							if (title.hasClass('open')) {
14228								state.open = true;
14229							} else {
14230								state.open = false;
14231							}
14232						}
14233
14234						widgets_states.push(state);
14235					});
14236
14237					// Update widgets state when it is not in target mode
14238					if (! isTargetFilterMode && offcanvas_sidebar_wrapper.length === 0) {
14239						update_widgets_state(widgets_states, container_to_append);
14240					}
14241
14242					// Update default sidebar state
14243					if (!container.hasClass('ajax-hide-filters')) {
14244						container_to_append.removeClass('ajax-hide-filters');
14245					}
14246
14247					// Update horizontal sidebar
14248					if (!container.hasClass('ajax-hide-filters-blanks')) {
14249						container_to_append.removeClass('ajax-hide-filters-blanks');
14250					}
14251					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
14252					if (horizontal_sidebar_wrapper.length > 0) {
14253						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
14254						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
14255						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
14256						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
14257
14258						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
14259						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
14260					}
14261
14262					// Append container
14263					container.replaceWith(container_to_append);
14264
14265					// Hide first thumbnail until the new srcset is loaded
14266					if (SiteParameters.dynamic_srcset_active === '1') {
14267						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
14268					}
14269
14270					// Remove loading attribute to images
14271					container_to_append.find('img').attr('loading', '');
14272
14273					// Append pagination
14274					if (pagination.length > 0) {
14275						if (pagination_to_append.length > 0) {
14276							pagination.html(pagination_to_append.html());
14277						} else {
14278							pagination.html('');
14279						}
14280					} else {
14281						if (pagination_to_append.length > 0) {
14282							$('.post-wrapper').append(pagination_to_append);
14283						}
14284					}
14285
14286					// Append filters
14287					if (isTargetFilterMode && filters_container.length > 0) {
14288						filters_container.html(filters_to_append.html());
14289					}
14290
14291					// Update widgets state when it is in target mode
14292					if (isTargetFilterMode && filters_container.length > 0) {
14293						update_widgets_state(widgets_states, filters_container);
14294					}
14295
14296					// Update off canvas sidebar (mobile and overlay)
14297					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
14298
14299					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
14300						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
14301						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
14302						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
14303						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
14304
14305						// Update widgets state
14306						update_widgets_state(widgets_states, sidebar_to_append);
14307
14308						// Update sidebar
14309						sidebar_container.html(sidebar_to_append.html());
14310					}
14311
14312					if (push) {
14313						UNCODE.lastURL = url;
14314						window.history.pushState(
14315							{ pageTitle: document.title },
14316							'',
14317							url
14318						);
14319					}
14320
14321					if (typeof UNCODE.isotopeLayout !== 'undefined') {
14322						UNCODE.isotopeLayout();
14323					}
14324					if (typeof UNCODE.justifiedGallery !== 'undefined') {
14325						UNCODE.justifiedGallery();
14326					}
14327					if (typeof UNCODE.cssGrid !== 'undefined') {
14328						UNCODE.cssGrid();
14329					}
14330					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
14331						UNCODE.lightbox();
14332					}
14333					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
14334						UNCODE.lightgallery();
14335					}
14336					if (typeof UNCODE.carousel !== 'undefined') {
14337						UNCODE.carousel($('body'));
14338					}
14339					UNCODE.animations();
14340					if (typeof UNCODE.filters !== 'undefined') {
14341						UNCODE.filters();
14342					}
14343					if (typeof UNCODE.widgets !== 'undefined') {
14344						UNCODE.widgets();
14345					}
14346
14347					if (SiteParameters.dynamic_srcset_active === '1') {
14348						UNCODE.refresh_dynamic_srcset_size();
14349					}
14350
14351					if (typeof UNCODE.menuSmartInit !== 'undefined') {
14352						UNCODE.menuSmartInit();
14353					}
14354
14355					if (typeof UNCODE.parallax !== 'undefined') {
14356						UNCODE.parallax();
14357					}
14358
14359					maybe_scroll_to_top();
14360
14361					var woo_select2_cats = $('.dropdown_product_cat');
14362
14363					if (woo_select2_cats.length > 0) {
14364						woo_select2_cats.on( 'change', function() {
14365							if ( $(this).val() != '' ) {
14366								var this_page = '';
14367								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
14368								if ( home_url.indexOf( '?' ) > 0 ) {
14369									this_page = home_url + '&product_cat=' + $(this).val();
14370								} else {
14371									this_page = home_url + '?product_cat=' + $(this).val();
14372								}
14373								location.href = this_page;
14374							} else {
14375								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
14376							}
14377						});
14378
14379						if ( $().selectWoo ) {
14380							var wc_product_cat_select = function() {
14381								woo_select2_cats.selectWoo( {
14382									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
14383									minimumResultsForSearch: 5,
14384									width: '100%',
14385									allowClear: true,
14386									language: {
14387										noResults: function() {
14388											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
14389										}
14390									}
14391								} );
14392							};
14393							wc_product_cat_select();
14394						}
14395					}
14396
14397					$(document).trigger('uncode-ajax-filtered');
14398					$(document.body).trigger('init_price_filter');
14399					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
14400					window.document.dispatchEvent(new Event("DOMContentLoaded", {
14401						bubbles: true,
14402						cancelable: true
14403					}));
14404
14405					isAjaxing = false;
14406				}
14407			},
14408			error: function() {
14409				container.removeClass('grid-filtering');
14410
14411				isAjaxing = false;
14412
14413				if (SiteParameters.enable_debug == true) {
14414					// This console log is disabled by default
14415					// So nothing is printed in a typical installation
14416					//
14417					// It can be enabled for debugging purposes setting
14418					// the 'uncode_enable_debug_on_js_scripts' filter to true
14419					console.log('There was an error retrieving the products');
14420				}
14421			}
14422		});
14423	}
14424
14425	// Scroll to top after filtering
14426	function maybe_scroll_to_top() {
14427		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
14428
14429		if (offcanvas_sidebar_wrapper.length > 0) {
14430			return;
14431		}
14432
14433		var container = get_filters_container();
14434		var bound = container[0].getBoundingClientRect();
14435
14436		if (bound.y < 0) {
14437			$(window).scrollTop(container.offset().top);
14438		}
14439	}
14440
14441	// Back/forward browser buttons
14442	$(window).on("popstate.ajaxfilters", function(e) {
14443		var location = window.location;
14444		var url = location.href;
14445		var params = UNCODE.getURLParams(window.location);
14446		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
14447
14448		UNCODE.lastURL = url;
14449
14450		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
14451			return;
14452		}
14453
14454		var container = get_filters_container();
14455
14456		reload_items(container, url, false);
14457	});
14458
14459	// Destroy load more before to init a new one
14460	$(window).on('uncode-ajax-pre-filtered', function() {
14461		if ($.fn.infinitescroll) {
14462			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
14463		}
14464	});
14465
14466	init_filters();
14467};
14468
14469UNCODE.videoThumbs = function() {
14470	var checkResize,
14471		newW = UNCODE.wwidth;
14472	var checkForVideos = function(){
14473
14474		$(window).on('okevents.y.change', function(e, y){
14475			var $video = $(y.target.g),
14476				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14477				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14478				restart = !$video_wrap.hasClass('play-pause'),
14479				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14480				setTime;
14481			if ( newW >= UNCODE.mediaQuery ) {
14482
14483				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
14484					$video_wrap.data('hovered', true);
14485					$video_wrap.addClass('played-on');
14486					y.target.pauseVideo();
14487					$tmb.on('mouseenter', function(){
14488						if ( restart ) {
14489							y.target.seekTo(0);
14490						}
14491						y.target.playVideo();
14492					}).on('mouseleave', function(){
14493						clearTimeout(setTime);
14494						setTime = setTimeout(function(){
14495							y.target.pauseVideo();
14496						}, 300);
14497					});
14498				}
14499
14500			} else {
14501				if( $mobile_video_wrap.length ) {
14502					$video_wrap.addClass('played-on');
14503					y.target.playVideo();
14504				}
14505			}
14506
14507		});
14508
14509		$(window).on('okevents.v.loaded', function(e, playerV){
14510			var $video = $(playerV.element),
14511				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14512				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14513				restart = !$video_wrap.hasClass('play-pause'),
14514				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
14514: $video.closest('.t-entry-visual, .un-inline-image'),
14515				setTime;
14516
14517			if ( newW >= UNCODE.mediaQuery ) {
14518				
14519				if( $video_wrap.length ) {
14520
14521					var playPromise = playerV.play();
14522					if (playPromise !== undefined) {
14523						playPromise.then(function( value ) {
14524							playerV.pause();
14525						});
14526					}
14527					$video_wrap.addClass('played-on');
14528					$tmb.on('mouseenter', function(){
14529						if ( restart ) {
14530							playerV.setCurrentTime(0)
14531						}
14532						playerV.play();
14533					}).on('mouseleave', function(){
14534						clearTimeout(setTime);
14535						setTime = setTimeout(function(){
14536							playerV.pause();
14537						}, 300);
14538					});
14539				}
14540
14541			} else {
14542
14543				if( $mobile_video_wrap.length ) {
14544					var playPromise = playerV.play();
14545					if (playPromise !== undefined) {
14546						playPromise.then(function( value ) {
14547							playerV.play();
14548						});
14549					}
14550					$video_wrap.addClass('played-on');
14551				}
14552			}
14553		});
14554
14555		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
14556			var $video = $(video),
14557				$noscript = $('noscript', $video),
14558				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14559				restart = !$video_wrap.hasClass('play-pause'),
14560				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14561				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14562				setTime,
14563			manageVideo = function(){
14564				video.currentTime = 0;
14565				video.pause();
14566				if ( newW >= UNCODE.mediaQuery ) {
14567					if ( $video_wrap.length ) {
14568						$video_wrap.addClass('played-on');
14569						$tmb.on('mouseenter', function(){
14570							if ( restart ) {
14571								video.currentTime = 0;
14572							}
14573							video.play();
14574						}).on('mouseleave', function(){
14575							clearTimeout(setTime);
14576							setTime = setTimeout(function(){
14577								video.pause();
14578							}, 300);
14579						});
14580					} else {
14581						video.play();
14582					}
14583				} else {
14584					if ( $mobile_video_wrap.length ) {
14585						$mobile_video_wrap.addClass('played-on');
14586						video.play();
14587					}
14588				}
14589
14590			};
14591			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
14592				$noscript.each(function(key, val){
14593					$noscript.after(val.textContent || val.innerText || val.innerHTML);
14594					$noscript.remove();
14595				});
14596			}
14597
14598			if (typeof MediaElement === "function") {
14599				$video.has('source[src]').mediaelementplayer({
14600					pauseOtherPlayers: false,
14601				});
14602			}
14603			if (video.readyState > 0) {
14604				manageVideo();
14605			} else {
14606				window.addEventListener("pageshow", function (event) {
14607					if (event.persisted) {
14608						manageVideo();
14609					}
14610				});				
14611				$video.on("loadedmetadata", function(_event) {
14612					manageVideo();
14613				});
14614			};
14615		});
14616	
14617	};
14618	
14619	checkForVideos();
14620
14621	var checkVideoResize = function(){
14622		clearRequestTimeout(checkResize);
14623		checkResize = requestTimeout(function(){
14624			if ( newW !== UNCODE.wwidth ) {
14625				checkForVideos();
14626				newW = UNCODE.wwidth;
14627			}
14628		}, 1000);
14629	};
14630
14631	$(window).off('resize.videos', checkVideoResize)
14632	.on( 'resize.videos', checkVideoResize);
14633
14634	$(window).off('more-items-loaded.videos', checkForVideos)
14635	.on('more-items-loaded.videos', checkForVideos);
14636
14637	$(document).off('uncode-ajax-filtered.videos', checkForVideos)
14638	.on('uncode-ajax-filtered.videos', checkForVideos);
14639
14640};
14641UNCODE.inlineImgs = function() {
14642    var linkInlineImgs = function(){
14643        $('.un-inline-image').each(function(){
14644            var $img = $(this),
14645                href = $(this).attr('data-link-href'),
14646                dataImg = $img.data();
14647			if ( dataImg != '' && href != null && href !== '' ) {
14648                var class_stra_a = 'unline-image-link';
14649                if ( $(this).hasClass('un-inline-space-over') ) {
14650                    class_stra_a += ' un-inline-space-over';
14651                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
14652                    class_stra_a += ' un-inline-space-gutter';
14653                }
14654                var str_a = '<a class="' + class_stra_a + '" ';
14655                for (var key in dataImg) {
14656                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
14657                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
14658                    }
14659                }
14660                str_a += ' />';
14661                $img.wrap(str_a);
14662			}
14663        });
14664    };
14665    $(window).on('load', linkInlineImgs );
14666};
14667UNCODE.lottie = function() {
14668    if ( SiteParameters.is_frontend_editor ) {
14669        var $lottie_wraps = $('div.uncode-lottie-wrap');
14670        $lottie_wraps.each(function(){
14671            var $lottie_wrap = $(this),
14672                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
14673                $player_clone = $div_player.clone(),
14674                player_id = $div_player.attr('data-id'),
14675                $lottie_players = $('lottie-player', $lottie_wrap).remove();
14676            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
14677                if ( $('#'+player_id).length ) {
14678                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
14679                }
14680                $player_clone.attr('id', player_id);
14681                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
14682                $div_player.after($player_clone);
14683                $div_player.attr('data-init',true);
14684            }
14685        });
14686    }
14687    var $players = $('.uncode-lottie-wrap lottie-player');
14688    $players.each(function(){
14689        var player = this,
14690            this_id = $(player).attr('id'),
14691            _player = document.getElementById(this_id),
14692            trigger = $(player).attr('data-trigger'),
14693            pFrames = $(player).attr('data-frames').split(','),
14694            srcPlayer = $(player).attr('src');
14695
14696        _player.load(srcPlayer);
14697
14698        _player.addEventListener("ready", function() {
14699
14700            var $_shadow = _player.shadowRoot;
14701            $($_shadow).find('.error').remove();
14702
14703            var tFrames = _player.getLottie().totalFrames / 100,
14704                pFrame_from = Math.round(tFrames * pFrames[0]),
14705                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
14706                loop = $(player).attr('loop'),
14707                mode,
14708                actions;
14709
14710            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
14711                if ( trigger === 'scroll' ) {
14712                    mode = 'scroll';
14713                    actions = [
14714                        {
14715                            visibility:[0, 1.0],
14716                            type: "seek",
14717                            frames: [pFrame_from, pFrame_to],
14718                        }
14719                    ];
14720                } else if ( trigger === 'viewport') {
14721                    mode = 'scroll';
14722                    actions = [
14723                        {
14724                            visibility: [0.20, 1.0],
14725                            frames: [pFrame_from, pFrame_to],
14726                            type: loop ? "loop" : "play"
14727                        }
14728                    ];
14729                } else if ( trigger === 'hover') {
14730                    $(player).on('mouseenter', function(){
14731                        _player.play();
14732                    }).on('mouseleave', function(){
14733                        _player.pause();
14734                    });
14735                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
14736                        _player.seek(pFrame_from);
14737                        _player.addEventListener("frame", function(){
14738                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
14739                                _player.seek(pFrame_from);
14740                            }
14741                        });
14742                    }
14743                }
14744                LottieInteractivity.create({
14745                    player: '#' + this_id,
14746                    mode: mode,
14747                    actions: actions
14748                });
14749            } else {
14750                if ( pFrame_from > 0 && pFrame_from < 99 ) {
14751                    _player.seek(pFrame_from);
14752                    _player.addEventListener("frame", function(){
14753                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
14754                            _player.seek(pFrame_from);
14755                        }
14756                    });
14757                }
14758            }
14759        });
14760
14761        $(window).on('unlottie-destroy', function(){
14762            _player.destroy();
14763        });
14764    });
14765};
14766
14767UNCODE.animatedBgGradient = function( _el ) {
14768
14769    var ev;
14770
14771	if ( typeof _el === 'undefined' || _el === null ) {
14772        _el = document;
14773        ev = false;
14774	} else {
14775        _el = _el[0];
14776        ev = 'shortcode:update';
14777    }
14778
14779    var simplex = new SimplexNoise();
14780
14781    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
14782		this.block = blockOverlay;
14783		this.wrap = canvasWrap;
14784		this.config();
14785		this.checker();
14786		this.loopRAF();
14787        this.animLoader();
14788    };
14789
14790    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
14791
14792    AnimGradient.config = function() {
14793        this.canvas = document.createElement('canvas');
14794        this.wrap.appendChild(this.canvas);
14795        this.ctx = this.canvas.getContext('2d');
14796        this.count = 0;        
14797        this.isOrientationChanged = false;
14798        this.res = UNCODE.isMobile ? 90 : 110;
14799        this.resPercent = 100/this.res;
14800        this.resAround = this.resPercent/100;
14801        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;
14802
14803        this.canvas.classList.add('uncode-bg-animated-gradient');
14804        this.canvas.setAttribute('height', this.res);
14805        this.canvas.setAttribute('width', this.res);
14806        this.canvas.style = 'height: 100%; position: relative; width:100%;';
14807
14808        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
14809
14810        this.cx = this.canvas.width/2;
14811        this.cy = this.canvas.height/2;
14812        this.data = this.imgdata.data;
14813
14814        this.opts = {
14815            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,
14816            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,
14817            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
14818        };
14819
14820        this.lavaTime = 1;
14821        this.bg_colors = [];
14822
14823        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
14824            return;
14825        }
14826
14827        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
14828            this.singleColor = true;
14829        }
14830
14831        if( this.opts.col_1st ) {
14832
14833            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
14834
14835            this.bg_colors.push({
14836                r: rgbColor1.r,
14837                g: rgbColor1.g,
14838                b: rgbColor1.b
14839            });
14840        }
14841
14842        if( this.opts.col_2nd ) {
14843
14844            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
14845
14846            this.bg_colors.push({
14847                r: rgbColor2.r,
14848                g: rgbColor2.g,
14849                b: rgbColor2.b
14850            });
14851        }
14852
14853    };
14854
14855    AnimGradient.checker = function() {
14856        var scope = this;
14857        this.checkInViewPort();
14858      
14859        window.addEventListener('resize', function() {
14860            if(UNCODE.isMobile && !scope.isOrientationChanged) {
14861                return;
14862            }
14863            scope.ratioCalc();
14864        });
14865
14866        window.addEventListener("orientationchange", function() {
14867            scope.isOrientationChanged = true;
14868        });
14869
14870        this.ratioCalc();
14871    }; 
14872
14873    AnimGradient.ratioCalc = function() {
14874      
14875        var blockW = this.block.clientWidth,
14876            blockH = this.block.clientHeight;
14877
14878        if ( blockH == 0 || blockW == 0 )
14879            return;
14880
14881        var blockRatio = blockH/blockW;
14882
14883        if(blockRatio < 1) {
14884            this.ratioParam = {
14885                x: 1.4,
14886                y: blockRatio*1.4
14887            }
14888        } else {
14889            this.ratioParam = {
14890                x: blockRatio/3,
14891                y: 1
14892            }
14893        }
14894         
14895    };
14896
14897    AnimGradient.checkInViewPort = function() {
14898        var scope = this;
14899        if ( $(scope.block).closest('.unmenu-inner-ul').length ) {
14900            scope.isInViewport = true;
14901        } else if( 'IntersectionObserver' in window ) {
14902		    var observer = new IntersectionObserver(function(entries) {
14903  
14904                entries.forEach(function(entry){
14905                    if ( entry.isIntersecting ) {
14906                        scope.isInViewport = true;
14907                    } else {
14908                        scope.isInViewport = false;
14909                    }
14910                });
14911  
14912		    }, { 
14913			root: document,
14914		  });
14915  
14916		  observer.observe(scope.block);
14917		}
14918	};
14919	
14920    AnimGradient.hexToRGB = function(hexval) {
14921        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
14922        if (!hexecuted) {
14923            return false;
14924        }
14925        return {
14926            r: parseInt(hexecuted[1], 16),
14927            g: parseInt(hexecuted[2], 16),
14928            b: parseInt(hexecuted[3], 16)
14929        }
14930    };
14931
14932    AnimGradient.factor = function(val_1, val_2, lava) { 
14933        return val_1 * (1 - lava) + val_2 * lava;
14934    };
14935
14936    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
14937        if (this.singleColor) {
14938            return this.bg_colors[0][wave_l];
14939        }
14940        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 );
14941        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
14942    };
14943
14944    AnimGradient.lava = function(x, y, grade) {
14945        var radians = (Math.PI / 180) * grade,
14946        cos = Math.cos(radians),
14947        sin = Math.sin(radians),
14948        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
14949        return nx;
14950    };
14951    
14952    AnimGradient.loopRAF = function() {
14953
14954      var scope = this;
14955
14956        if( this.isInViewport && typeof this.ratioParam !== 'undefined' ) {
14957            for (var x = 0; x < this.res; x++) {
14958                for (var y = 0; y < this.res; y++) {
14959                    
14960                    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
14961        
14962                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
14963                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
14964                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
14965                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
14966                  
14967                }
14968            }
14969   
14970            this.count++;
14971          
14972            this.ctx.putImageData(this.imgdata, 0, 0);
14973         
14974        }
14975
14976        requestAnimationFrame(function() {
14977            scope.loopRAF();
14978        });
14979    };
14980
14981    AnimGradient.animLoader = function() {
14982        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
14983    };
14984
14985    var anim_init = function() {
14986        var bgs = _el.querySelectorAll('.block-bg-overlay');
14987      
14988        bgs.forEach(function(blockOverlay) {
14989            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
14990            if( !blockOverlay || !canvasWrap ) {
14991                return;
14992            }
14993            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
14994        });
14995    }
14996
14997    $(window).on('load', function(){
14998        anim_init();
14999    });
15000
15001    if ( ev === 'shortcode:update' ) {
15002        anim_init();
15003    }
15004
15005};
15006UNCODE.multibg = function(){
15007	var $bgsWraps = $('.uncode-multi-bgs'),
15008		$body = $('body');
15009	$bgsWraps.each(function(){
15010		var $bgWrap = $(this),
15011			transition = $bgWrap.attr('data-transition'),
15012			transitionTime = $bgWrap.attr('data-transition-time'),
15013			dataPace = $bgWrap.attr('data-transition-pace'),
15014			dataThreshold = $bgWrap.attr('data-transition-threshold'),
15015			dataTime = $bgWrap.attr('data-carousel-time'),
15016			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
15017			random = $bgWrap.attr('data-multi-random'),
15018			_bgWrap = $bgWrap[0],
15019			$multiBgs = $('.multi-background', $bgWrap),
15020			imgFirst,
15021			bgAmount = $multiBgs.length,
15022			isInViewport = false,
15023			lastScrollTop = 0,
15024			counter = 0,
15025			totMove = 0,
15026			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
15027			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
15028			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
15029			offX, offY,
15030			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
15031			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
15032			requestCarousel,
15033			is_header = $bgWrap.closest('#page-header').length,
15034			startTime = new Date();
15035
15036		transition = typeof transition === 'undefined' ? '' : transition;
15037
15038		if ( random === 'true' ) {
15039			UNCODE.shuffle($multiBgs);
15040		}
15041
15042		$multiBgs.find('.background-inner').attr('data-active','false');
15043
15044		imgFirst = $multiBgs.first().find('.background-inner').attr('data-active','true').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
15045
15046		var loadFirst = function(){
15047			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
15048				opacity: 1
15049			}, 250, 'easeInQuad').css({
15050				zIndex: 1
15051			});	
15052		}
15053
15054		var loadError = function(){
15055			console.log('Multi BG loading error');
15056		}
15057
15058		if ( imgFirst && imgFirst !== 'none' ) {
15059			UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
15060		} else {
15061			loadFirst();
15062		}
15063
15064		var loadSlides = function( $thisBg ){
15065			$thisBg.attr('data-load', 'loaded');	
15066		}
15067
15068		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
15069			var $thisBg = $(val);
15070
15071			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
15072
15073				var _imgBg = $(val).find('.background-inner').css('background-image');
15074
15075				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
15076					$thisBg.attr('data-load', 'loaded');
15077				} else {
15078					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
15079					if ( typeof _imgBg !== 'undefined' ) {
15080						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
15081					}
15082				}
15083			}
15084		});
15085					
15086		var multiCarousel = function(e) {
15087
15088			clearRequestTimeout(requestCarousel);
15089
15090			var checkTime = new Date();
15091			if ( checkTime - startTime >= carouselTime && isInViewport ) {
15092				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
15093
15094				if ( $checkEl.attr('data-load') !== 'loaded' ) {
15095					requestTimeout(function(){
15096						multiCarousel();
15097					}, 100);
15098					return;
15099				}
15100
15101				counter++;
15102
15103				$multiBgs.each(function(ind, val){
15104					if ( ind === counter%bgAmount ) {
15105						$(val).stop(true,false).animate({
15106							opacity: 1
15107						}, wait, 'easeInQuad').css({
15108							zIndex: 1
15109						}).find('.background-inner').attr('data-active','true');
15110					} else {
15111						$(val).stop(true,false).animate({
15112							opacity: 0
15113						}, wait, 'easeInQuad', function(){
15114							$(val).find('.background-inner').attr('data-active','false');
15115						}).css({
15116							zIndex: 0
15117						});
15118					}
15119				});
15120
15121			}
15122
15123			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
15124				requestCarousel = requestTimeout(multiCarousel, carouselTime);
15125			}
15126	
15127		};
15128
15129		var multiMove = function(e) {
15130			if ( $body.hasClass('navbar-hover') ) {
15131				return;
15132			}
15133			var checkTime = new Date(),
15134                bound = $bgWrap[0].getBoundingClientRect(),
15135                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
15136			if (offX) {
15137				totMove += Math.sqrt(
15138					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
15139				);
15140			}
15141			if (
15142                totMove >= pace && 
15143                checkTime - startTime >= wait &&
15144                e.clientX <= (bound.left + bound.width) &&
15145                e.clientX >= bound.left &&
15146                e.clientY <= (bound.top + bound.height) &&
15147                e.clientY >= bound.top
15148            ) {
15149				counter++;
15150				startTime = checkTime;
15151				$multiBgs.each(function(ind, val){
15152					if ( ind === counter%bgAmount ) {
15153						$(val).stop(true,false).animate({
15154							opacity: 1
15155						}, wait, 'easeInQuad').css({
15156							zIndex: 1
15157						}).find('.background-inner').attr('data-active','true');
15158					} else {
15159						$(val).stop(true,false).animate({
15160							opacity: 0
15161						}, wait, 'easeInQuad', function(){
15162							$(val).find('.background-inner').attr('data-active','false');
15163						}).css({
15164							zIndex: 0
15165						});
15166					}
15167				});
15168
15169				totMove = 0;
15170			}
15171			
15172			offX = e.clientX;
15173			offY = e.clientY;
15174			
15175		};
15176
15177		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
15178			document.addEventListener("mousemove", multiMove);
15179		}
15180
15181		window.addEventListener('resize', function() {
15182			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
15183				document.removeEventListener("mousemove", multiMove);
15184				document.addEventListener("mousemove", multiMove);
15185			}
15186		});
15187
15188		var lightLoopRAF = function() {
15189
15190			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
15191				checkTime = new Date(),
15192				bound = $bgWrap[0].getBoundingClientRect(),
15193				thresholdHeader = is_header ? 100 : threshold,
15194				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
15195			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
15196				counter++;
15197				lastScrollTop = scrollTop;
15198				startTime = checkTime;
15199
15200				$multiBgs.each(function(ind, val){
15201					if ( ind === counter%bgAmount ) {
15202						$(val).stop(true,false).animate({
15203							opacity: 1
15204						}, wait, 'easeInQuad').css({
15205							zIndex: 1
15206						}).find('.background-inner').attr('data-active','true');
15207					} else {
15208						$(val).stop(true,false).animate({
15209							opacity: 0
15210						}, wait, 'easeInQuad', function(){
15211							$(val).find('.background-inner').attr('data-active','false');
15212						}).css({
15213							zIndex: 0
15214						});
15215					}
15216				});
15217
15218			}
15219
15220			requestAnimationFrame(function() {
15221				if ( isInViewport ) {
15222					lightLoopRAF();
15223				}
15224			});
15225		};
15226
15227		var currentInd = 0;
15228
15229		var loopRAF = function() {
15230
15231			var multiBgRotate = function(slideInd){
15232				currentInd = slideInd;
15233				$multiBgs.each(function(ind, val){
15234					if ( ind === slideInd ) {
15235						$(val).stop(true,false).animate({
15236							opacity: 1
15237						}, wait, 'easeInQuad').css({
15238							zIndex: 1
15239						}).find('.background-inner').attr('data-active','true');
15240					} else {
15241						$(val).stop(true,false).animate({
15242							opacity: 0
15243						}, wait, 'easeInQuad', function(){
15244							$(val).find('.background-inner').attr('data-active','false');
15245						}).css({
15246							zIndex: 0
15247						});
15248					}
15249				});
15250			};
15251			var bound = $bgWrap[0].getBoundingClientRect(),
15252				thresholdPX = UNCODE.wheight * threshold / 100,
15253				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
15254				movePX = totMove / bgAmount,
15255				moving = UNCODE.wheight - (bound.top + thresholdPX),
15256				slideInd = 0;
15257
15258			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
15259				multiBgRotate(0);
15260			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
15261				multiBgRotate(bgAmount-1);
15262			} else {
15263				slideInd = Math.ceil(moving/movePX) - 1;
15264				if ( slideInd < 0 ) {
15265					slideInd = 0;
15266				} else if ( slideInd >= bgAmount ) {
15267					slideInd = bgAmount-1;
15268				}
15269				if ( slideInd !== currentInd ) {
15270					multiBgRotate(slideInd);
15271				}
15272			}
15273
15274			requestAnimationFrame(function() {
15275				if ( isInViewport ) {
15276					loopRAF();
15277				}
15278			});
15279		};
15280
15281		if( 'IntersectionObserver' in window ) {
15282		    var observer = new IntersectionObserver(function(entries) {
15283  
15284                entries.forEach(function(entry){
15285                    if ( entry.isIntersecting ) {
15286                        isInViewport = true;
15287						if ( transition === 'scroll' ) {
15288							if ( autoScroll ) {
15289								loopRAF();
15290							} else {
15291								lightLoopRAF();
15292							}
15293						} else {
15294							multiCarousel();
15295						}
15296                    } else {
15297                        isInViewport = false;
15298                   }
15299                });
15300  
15301		    }, { 
15302				root: document,
15303				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
15304		  	});
15305
15306			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
15307		  		observer.observe(_bgWrap);
15308			}
15309
15310			window.addEventListener('resize', function() {
15311				observer.unobserve(_bgWrap);
15312				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
15313					observer.observe(_bgWrap);
15314				}
15315			});
15316	
15317		}
15318
15319	});
15320}
15321
15322UNCODE.owlNav = function(target, ev) {
15323    target = target.replace(/#\S+/g, '');
15324    var $carousel = $('#'+target),
15325        $slider = $carousel.closest('.uncode-slider'),
15326        $checkNavs = $('.uncode-owl-nav');
15327    if ( !$checkNavs.length ) {
15328        return;
15329    }
15330
15331    if ( $slider.length ){
15332        target = $slider.attr('id');
15333    }
15334
15335    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
15336        $row;
15337
15338    if ( ! $navs.length ) {
15339        $row = $carousel.closest('.vc_row.row-container');
15340        $navs = $('.uncode-owl-nav:not([data-target])', $row);
15341    }
15342        
15343    if ( ! $navs.length ) {
15344        return;
15345    }
15346
15347    $navs.each(function(){
15348        var $nav = $(this),
15349            $outer = $nav.closest('.uncode-owl-nav-out'),
15350            $inner = $nav.find('.uncode-owl-nav-in'),
15351            $navDots = $('.uncode-nav-dots', $nav),
15352            $navCounter = $('.uncode-nav-counter', $nav),
15353            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
15354            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
15355            skinInherit = $nav.hasClass('skin-inherit'),
15356            digit = parseFloat($nav.attr('data-digit')),
15357            counterDigit = parseFloat($nav.attr('data-counter-digit')),
15358            navSpeed = parseFloat($carousel.attr('data-navspeed'));
15359        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
15360
15361        if ( $nav.hasClass('pos-abs') ){
15362            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
15363                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
15364            }
15365            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
15366        } 
15367
15368        $carousel.on('refreshed.owl.carousel', counter);
15369        $carousel.on('resized.owl.carousel', counter);
15370        $carousel.on('changed.owl.carousel', counter);
15371
15372        if ( $carousel.closest('.un-submenu').length ) {
15373            $carousel.on('initialized.owl.carousel', counter);
15374        }
15375
15376        var totalSlides = 0;
15377
15378        function counter(event) {
15379            if (!event.namespace) {
15380                return;
15381            }
15382            var slides = event.relatedTarget,
15383                current = slides._current,
15384                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
15385                item = event.item,
15386                page = event.page,
15387                countPages = Math.ceil(item.count / page.size),
15388                $currentSlide = $carousel.find('.owl-item').eq(current),
15389                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
15390                activeSlide = Math.ceil(itemIndex / page.size),
15391                $prev = $nav.find('.uncode-nav-prev'),
15392                $next = $nav.find('.uncode-nav-next'),
15393                $col = $currentSlide.find('.uncol').first();
15394
15395            if ( totalSlides != countPages ) {
15396                totalSlides = countPages;
15397                $navDots.html('');
15398                var nav_html = '';
15399                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
15400                    var padN = sl_ind+1;
15401                    if ( digit && digit > 1 ) {
15402                        padN = String(padN).padStart(digit, '0');
15403                    }
15404                    nav_html += '<button class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '" tabindex="0"><span>' + padN + '</span></button>';
15405                }
15406                $navDots.html(nav_html);
15407
15408                var totalSlidesDigit = totalSlides;
15409
15410                if ( counterDigit && counterDigit > 1 ) {
15411                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
15412                }
15413                $counterTotal.html(totalSlidesDigit);
15414            }
15415
15416            if ( loop !== true ) {
15417                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
15418                if ( itemIndex === 1 ) {
15419                    $prev.addClass('uncode-nav-disabled');
15420                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
15421                    $next.addClass('uncode-nav-disabled');
15422                    activeSlide = Math.ceil(item.count / page.size);
15423                }
15424            }
15425
15426            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
15427            var activeSlideDigit = activeSlide;
15428
15429            if ( counterDigit && counterDigit > 1 ) {
15430                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
15431            }
15432            $counterIndex.html(activeSlideDigit);
15433
15434            if ( skinInherit ) {
15435                if ( $col.hasClass('style-light') ){
15436                    $nav.removeClass('style-dark').addClass('style-light');
15437                } else if ( $col.hasClass('style-dark') ) {
15438                    $nav.removeClass('style-light').addClass('style-dark');
15439                }
15440            }
15441
15442            $inner.removeClass('uncode-owl-nav-waiting');
15443
15444            if ( $nav.hasClass('outer-width') ) {
15445                var navW = $nav.outerWidth(),
15446                    nexW = $next.outerWidth(),
15447                    prevW = $prev.outerWidth(),
15448                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
15449
15450                if ( $nav.hasClass('h-align-justify') ) {
15451                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
15452                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
15453                        $inner.css({'margin': 'auto'});
15454                    } else {
15455                        $inner.css({'margin': ''});
15456                    }
15457                } else {
15458                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
15459                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
15460                        $inner.css({'margin': 'auto'});
15461                    } else {
15462                        $inner.css({'margin': ''});
15463                    }
15464                }
15465            }
15466        }
15467
15468        $nav.on('click', '.uncode-nav-index', function(){
15469            var $bullet = $(this),
15470                slide_index = parseFloat( $bullet.attr('data-key') );
15471            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
15472        });
15473        $nav.on('click', '.uncode-nav-prev', function(){
15474            $carousel.trigger('prev.owl.carousel', [navSpeed]);
15475        });
15476        $nav.on('click', '.uncode-nav-next', function(){
15477            $carousel.trigger('next.owl.carousel', [navSpeed]);
15478        });
15479
15480        if ( $nav.hasClass('animated-arrows') ) {
15481            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
15482                $(this).addClass("hover"); 
15483            }).on('animationend', function(){
15484                $(this).removeClass("hover");  
15485            });
15486        }
15487
15488        var positionNav = function(){
15489            if ( $nav.hasClass('window-width') ) {
15490                var navOff = parseFloat( $nav.offset().left ) * -1;
15491                if ( navOff > 0 ) {
15492                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
15493                } else {
15494                    $inner.css({ transform: 'none' });
15495                }
15496            }
15497        }
15498        positionNav();
15499        $(window).on('resize', positionNav);
15500        $(document).on('un-menu-show', positionNav);
15501    });
15502
15503    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
15504};
15505
15506	UNCODE.init = function() {
15507		var wfl_check = false, wfl_request, waypoint_request;
15508		UNCODE.preventDoubleTransition();
15509		UNCODE.betterResize();
15510		UNCODE.utils();
15511		UNCODE.unBlockMenu();
15512		UNCODE.mobileMenuBlockSkins();
15513		UNCODE.magnetic();
15514		if (typeof UNCODE.accessibility !== 'undefined') {
15515			UNCODE.accessibility();
15516		}
15517		if (typeof UNCODE.rowParallax !== 'undefined') {
15518			UNCODE.rowParallax();
15519		}
15520		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
15521			UNCODE.changeSkinOnScroll();
15522		}
15523		if (typeof UNCODE.share !== 'undefined') {
15524			UNCODE.share();
15525		}
15526		if (typeof UNCODE.tooltip !== 'undefined') {
15527			UNCODE.tooltip();
15528		}
15529		if (typeof UNCODE.counters !== 'undefined') {
15530			UNCODE.counters();
15531		}
15532		if (typeof UNCODE.countdowns !== 'undefined') {
15533			UNCODE.countdowns();
15534		}
15535		if (typeof UNCODE.tabs !== 'undefined') {
15536			UNCODE.tabs();
15537		}
15538		if (typeof UNCODE.collapse !== 'undefined') {
15539			UNCODE.collapse();
15540		}
15541		if (typeof UNCODE.bigText !== 'undefined') {
15542			UNCODE.bigText();
15543		}
15544		UNCODE.menuSystem();
15545		if (typeof UNCODE.bgChanger !== 'undefined') {
15546			UNCODE.bgChanger();
15547		}
15548		if (typeof UNCODE.magicCursor !== 'undefined') {
15549			UNCODE.magicCursor();
15550		}
15551		if (typeof UNCODE.magneticCursor !== 'undefined') {
15552			UNCODE.magneticCursor();
15553		}
15554		if (typeof UNCODE.dropImage !== 'undefined') {
15555			UNCODE.dropImage();
15556		}
15557		if (typeof UNCODE.postTable !== 'undefined') {
15558			UNCODE.postTable();
15559		}
15560		if (typeof UNCODE.rotatingTxt !== 'undefined') {
15561			UNCODE.rotatingTxt();
15562		}
15563		if (typeof UNCODE.okvideo !== 'undefined') {
15564			UNCODE.okvideo();
15565			window.addEventListener( "uncode-more-items-loaded", function() {
15566				UNCODE.okvideo("uncode-more-items-loaded");
15567			});
15568		}
15569		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
15570			UNCODE.backgroundSelfVideos();
15571		}
15572		UNCODE.tapHover();
15573		if (typeof UNCODE.isotopeLayout !== 'undefined') {
15574			UNCODE.isotopeLayout();
15575		}
15576		if (typeof UNCODE.justifiedGallery !== 'undefined') {
15577			UNCODE.justifiedGallery();
15578		}
15579		if (typeof UNCODE.cssGrid !== 'undefined') {
15580			UNCODE.cssGrid();
15581		}
15582		if (typeof UNCODE.linearGrid !== 'undefined') {
15583			UNCODE.linearGrid();
15584		}
15585		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
15586			UNCODE.lightbox();
15587		}
15588		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
15589			$(window).on('load more-items-loaded',function(){
15590				UNCODE.lightgallery();
15591			});
15592		}
15593		if (typeof UNCODE.carousel !== 'undefined') {
15594			UNCODE.carousel($('body'));
15595		}
15596		if (typeof UNCODE.lettering !== 'undefined') {
15597			UNCODE.lettering();
15598		}
15599		UNCODE.animations();
15600		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
15601			UNCODE.stickyElements();
15602		}
15603		if (typeof UNCODE.twentytwenty !== 'undefined') {
15604			UNCODE.twentytwenty();
15605		}
15606		UNCODE.disableHoverScroll();
15607		UNCODE.printScreen();
15608		if (typeof UNCODE.particles !== 'undefined') {
15609			UNCODE.particles();
15610		}
15611		if (typeof UNCODE.filters !== 'undefined') {
15612			UNCODE.filters();
15613		}
15614		if (typeof UNCODE.ajax_filters !== 'undefined') {
15615			UNCODE.ajax_filters();
15616		}
15617		if (typeof UNCODE.widgets !== 'undefined') {
15618			UNCODE.widgets();
15619		}
15620		if (typeof UNCODE.unmodal !== 'undefined') {
15621			UNCODE.unmodal();
15622		}
15623		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
15624			if ( !UNCODE.isFullPage ) {
15625				UNCODE.checkScrollForTabs();
15626			}
15627		}
15628		if (typeof UNCODE.onePage !== 'undefined') {
15629			UNCODE.onePage(UNCODE.isMobile);
15630		}
15631		if (typeof UNCODE.fullPage !== 'undefined') {
15632			$(document).ready(function(){
15633				UNCODE.fullPage();
15634			});
15635		}
15636		if (typeof UNCODE.skewIt !== 'undefined') {
15637			UNCODE.skewIt();
15638		}
15639		if (typeof UNCODE.rotateIt !== 'undefined') {
15640			UNCODE.rotateIt();
15641		}
15642		if (typeof UNCODE.textMarquee !== 'undefined') {
15643			UNCODE.textMarquee();
15644		}
15645		if (typeof UNCODE.stickyScroll !== 'undefined') {
15646			UNCODE.stickyScroll();
15647		}
15648		if (typeof UNCODE.stickyTrigger !== 'undefined') {
15649			UNCODE.stickyTrigger();
15650		}
15651		if (typeof UNCODE.areaTextReveal !== 'undefined') {
15652			UNCODE.areaTextReveal();
15653		}
15654		if (typeof UNCODE.thumbsReveal !== 'undefined') {
15655			UNCODE.thumbsReveal();
15656		}
15657		if (typeof UNCODE.verticalText !== 'undefined') {
15658			UNCODE.verticalText();
15659		}
15660		if (typeof UNCODE.videoThumbs !== 'undefined') {
15661			UNCODE.videoThumbs();
15662		}
15663		if (typeof UNCODE.revslider !== 'undefined') {
15664			UNCODE.revslider();
15665		}
15666		if (typeof UNCODE.layerslider !== 'undefined') {
15667			UNCODE.layerslider();
15668		}
15669		if (typeof UNCODE.lottie !== 'undefined') {
15670			UNCODE.lottie();
15671		}
15672		if (typeof UNCODE.inlineImgs !== 'undefined') {
15673			UNCODE.inlineImgs();
15674		}
15675		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
15676			UNCODE.animatedBgGradient();
15677		}
15678		if (typeof UNCODE.readMoreCol !== 'undefined') {
15679			UNCODE.readMoreCol();
15680		}
15681		if (typeof UNCODE.multibg !== 'undefined') {
15682			UNCODE.multibg();
15683		}
15684		if (typeof UNCODE.flexEqual !== 'undefined') {
15685			UNCODE.flexEqual();
15686		}
15687		$(window).on('load',function(){
15688			clearRequestTimeout(waypoint_request);
15689			waypoint_request = requestTimeout( function(){
15690				Waypoint.refreshAll();
15691			}, 1000);
15692		});
15693		$(window).one('load',function(){
15694			if (typeof UNCODE.parallax !== 'undefined') {
15695				UNCODE.parallax();
15696			}
15697		});
15698	}
15699
15700	if ( ! SiteParameters.is_frontend_editor ) {
15701		UNCODE.init();
15702	}
15703
15704
15705})(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.