PageSourceSearch

https://novostorm.cat/wp-content/themes/uncode/library/js/app.js?ver=1911894254

js novostorm.cat collected 2026-09-24 11:01:11 UTC 528,790 bytes, 15,928 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 $tabs = $(e.currentTarget).closest('.uncode-tabs'),
1123				$non_active_panel = $('.tab-pane:not(.active)', $tabs);
1124			$.each($('.start_animation:not(.t-inside):not(.drop-image-separator)', $non_active_panel), function(index, val) {
1125				var element = $(val);
1126				element.removeClass('start_animation');
1127			});
1128
1129			var $li = $el.closest('li'),
1130				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1131			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1132			$('.tab-pane', $li).slideDown(250);
1133			var completeSlideDown = requestTimeout(function(){
1134				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1135					var pos = $el.offset(),
1136						rect = $el[0].getBoundingClientRect(),
1137						$masthead = $('#masthead > .menu-container'),
1138						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1139
1140					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1141						$('html, body').animate({
1142							scrollTop: ( pos.top ) - considerMenu
1143						},{
1144							easing: 'easeInOutQuad',
1145							duration: 250
1146						});
1147					}
1148				}
1149			}, 260);
1150		});
1151	}
1152	tabInit();
1153
1154	var tabResponsive = function(){
1155		if ( SiteParameters.is_frontend_editor ) {
1156			return true;
1157		}
1158		var $tabContainers = $('.tab-container.tabs-breakpoint');
1159		$tabContainers.each(function(){
1160			var $tabContainer = $(this),
1161				$tabContent = $('.tab-content', $tabContainer),
1162				$nav = $('.nav-tabs', $tabContainer),
1163				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1164
1165			$('> li', $nav).each(function(){
1166				var $li = $(this),
1167					dataID = $li.attr('data-tab-id');
1168
1169				if ( UNCODE.wwidth <= mQuery ) {
1170					if ( ! $('.tab-pane', $li ).length ) {
1171						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1172						$tabContainer.addClass('tabs-appended');
1173						$li.append($append_pane);
1174					}
1175
1176					if ( $li.hasClass('active') ) {
1177						$('> a', $li).triggerHandler('click.bs.tab.data-api');
1178					}
1179				} else {
1180					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1181						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1182						$tabContainer.removeClass('tabs-appended');
1183						$tabContent.prepend($append_pane.removeAttr('style'));
1184					}
1185				}
1186			});
1187		});
1188
1189	}
1190	tabResponsive();
1191
1192	$(window).on('wwResize', function(){
1193		tabHoverIntent();
1194		tabSwitcher($body);
1195	});
1196
1197	var setCTA;
1198	$(window).on( 'resize', function(){
1199		clearRequestTimeout(setCTA);
1200		setCTA = requestTimeout( tabResponsive, 100 );
1201	});
1202
1203	$('.nav-tabs').each(function(){
1204		var $nav = $(this),
1205			$lis = $('> li:not(.active)', $nav),
1206			$links = $('.tab-excerpt-link', $nav);
1207		$('.tab-excerpt', $lis).slideUp(400, function(){
1208			$(this).addClass('init');
1209		});
1210
1211		$links.each(function(){
1212			var $link = $(this),
1213				$par_a = $link.closest('a'),
1214				href = $link.attr('data-href'),
1215				target = $link.attr('data-target');
1216			$par_a.addClass('inner-link');
1217			$link.on('click', function(){
1218				var _link = document.createElement('a');
1219				_link.href = href;
1220				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1221				_link.click();
1222			});
1223		});
1224		$nav.addClass('tab-init');
1225	});
1226
1227	$('.uncode-tabs.tabs-no-lazy').each(function(){
1228		var $tabs = $(this),
1229			$panes = $('.tab-pane:not(.active)', $tabs);
1230		$panes.each(function(){
1231			var $pane = $(this),
1232				$imgs = $('img[loading="lazy"]', $pane);
1233			$imgs.removeAttr('loading');
1234			$imgs.removeAttr('decoding');
1235		});
1236	});
1237
1238};
1239UNCODE.collapse = function() {
1240	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1241		var $this = $(this),
1242			href
1243		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1244		var $target = $(target)
1245		var parent = $this.attr('data-parent')
1246		var $parent = parent && $(parent)
1247		var $title = $(this).parent()
1248		var $accordion = $(e.target).closest('.uncode-accordion')
1249		var $group = $this.closest('.group')
1250		var $panel_group = $this.closest('.panel-group')
1251		if ($parent) {
1252			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1253			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1254				$title.removeClass('active');
1255				$group.removeClass('active-group');
1256			} else {
1257				if ( $panel_group.attr('data-no-toggle') != true ) {
1258					$parent.find('.panel-title').removeClass('active')
1259					$parent.find('.group').removeClass('active-group')
1260				}
1261				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1262				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1263			}
1264		}
1265		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1266		requestTimeout(function() {
1267			var $accordion = $(e.target).closest('.uncode-accordion');
1268			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1269			  window.dispatchEvent(new CustomEvent('boxResized'));
1270			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1271				window.dispatchEvent(new Event('resize'));
1272				$(window).trigger('uncode.re-layout');
1273			} 
1274
1275			var $active_panel = $('.panel.active-group', $parent);
1276
1277			$.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) {
1278				var element = $(val),
1279					delayAttr = element.attr('data-delay');
1280				if (delayAttr == undefined) delayAttr = 0;
1281				requestTimeout(function() {
1282					element.addClass('start_animation');
1283				}, delayAttr);
1284			});
1285
1286		}, 500);
1287
1288		$group.find('.panel-title:not(.active) > a').trigger('blur');
1289
1290	});
1291
1292	$('.uncode-accordion.tabs-no-lazy').each(function(){
1293		var $accordion = $(this),
1294			$panes = $('.panel:not(.active-group)', $accordion);
1295		$panes.each(function(){
1296			var $pane = $(this),
1297				$imgs = $('img[loading="lazy"]', $pane);
1298			$imgs.removeAttr('loading');
1299			$imgs.removeAttr('decoding');
1300		});
1301	});
1302};
1303
1304UNCODE.accessibility = function() {
1305    if ( ! SiteParameters.uncode_is_accessible ) {
1306        return;
1307    }
1308
1309    //
1310
1311};
1312UNCODE.bigText = function(el) {
1313	var bigTextLaunch = function(){
1314		if (el == undefined) {
1315			el = $('body');
1316		}
1317		$.each($('.bigtext', el), function(index, val) {
1318			$(val).bigtext({
1319				minfontsize: 24
1320			});
1321			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1322				opacity: 1
1323			});
1324			requestTimeout(function() {
1325				if ($(val).find('.animate_when_almost_visible').length != 0) {
1326					$(val).css({opacity: 1});
1327				}
1328			}, 400);
1329		});
1330	};
1331
1332	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1333		bigTextLaunch();
1334	}
1335	$(window).on( 'load', bigTextLaunch );
1336};
1337
1338UNCODE.process_shortpixel_image = function(image) {
1339	var data = {
1340		action: 'shortpixel_manual_optimization',
1341		image_id: image,
1342		cleanup: true
1343	};
1344
1345	$.get(SiteParameters.ajax_url, data);
1346};
1347
1348UNCODE.animateSubInside = function( _this, remove ){
1349	if ( typeof remove !== 'undefined' && remove === true ) {
1350		$(document).trigger('sub-menu-slide-up');
1351		$('.animate_when_almost_visible, .translate_when_almost_visible', _this).each(function(){
1352			$(this).removeClass('start_animation').css({ 'animation-delay': '0s', 'transition-delay': '0s'});
1353		});
1354	} else {
1355		$.each($('.translate_when_almost_visible:not(.start_animation), .animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', _this), function(index, val) {
1356			var element = $(val),
1357				delayAttr = element.attr('data-delay');
1358			if (delayAttr == undefined) delayAttr = 0;
1359			element.css({ 'animation-delay': delayAttr + 'ms', 'transition-delay': delayAttr + 'ms'});
1360			element.addClass('start_animation');
1361		});
1362		document.dispatchEvent(new CustomEvent('sub-menu-slide-down'));
1363	}
1364};
1365
1366
1367UNCODE.menuSystem = function() {
1368
1369	function menuMobile() {
1370		var $body = $('body'),
1371			scrolltop,
1372			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile:not(.vc_element)'),
1373			$masthead = $('#masthead'),
1374			$menuBlock = $('#uncode-mobile-menu-block'),
1375			$box,
1376			$el,
1377			$el_transp,
1378			elHeight,
1379			offCanvasAnim,
1380			check,
1381			animating = false,
1382			stickyMobile = false,
1383			menuClose = new CustomEvent('menuMobileClose'),
1384			menuOpen = new CustomEvent('menuMobileOpen');
1385		UNCODE.menuOpened = false;
1386		$mobileToggleButton.on('click', function(event) {
1387			event.stopPropagation();
1388			var btn = this;
1389			if ($(btn).hasClass('overlay-close')) return;
1390			event.preventDefault();
1391			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1392			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1393				$box = $(this).closest('.box-container').find('.main-menu-container:not(.no-mobile):not(.main-wrapper *)');
1394				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand):not(.main-wrapper *), .menu-sidebar-inner:not(.main-wrapper *)');
1395				$el_transp = $('.menu-absolute.menu-transparent');
1396				if (UNCODE.isMobile) {
1397					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 ) {
1398						stickyMobile = true;
1399						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1400					} else {
1401						elHeight = 0;
1402						$.each($box.find('> div'), function(index, val) {
1403							elHeight += $(val).outerHeight();
1404						});
1405					}
1406				} else {
1407					elHeight = 0;
1408					$.each($el, function(index, val) {
1409						elHeight += $(val).outerHeight();
1410					});
1411				}
1412				var open = function() {
1413					clearTimeout(offCanvasAnim);
1414					if (!animating) {
1415						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1416						scrolltop = $(window).scrollTop();
1417						window.dispatchEvent(menuOpen);
1418						animating = true;
1419						UNCODE.menuOpened = true;
1420						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1421							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1422								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1423							}
1424							if ($('body.menu-offcanvas').length) {
1425								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1426								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1427							} else {
1428								if ( $('.menu-hide, .menu-sticky').length ) {
1429									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1430										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1431									}
1432								}
1433							}
1434						}
1435						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1436							//$("#masthead")[0].scrollIntoView();
1437							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + 
1437UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1438						}
1439						$box.addClass('open-items');
1440						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1441							$el_transp.addClass('is_mobile_open');
1442						}
1443						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1444							btn.classList.add('close');
1445							$box.animate({
1446								height: elHeight
1447							}, 600, "easeInOutCirc", function() {
1448								animating = false;
1449								if (!stickyMobile) $box.css('height', 'auto');
1450							});
1451						} else {
1452							animating = false;
1453						}
1454
1455						if ( $menuBlock.length ) {
1456							UNCODE.animateSubInside($menuBlock);
1457						}
1458					}
1459				};
1460
1461				var close = function() {
1462					clearTimeout(offCanvasAnim);
1463					if (!animating) {
1464						window.dispatchEvent(menuClose);
1465						animating = true;
1466						UNCODE.menuOpened = false;
1467						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1468							btn.classList.remove('close');
1469							btn.classList.add('closing');
1470						}
1471						$box.addClass('close');
1472						requestTimeout(function() {
1473							$box.removeClass('close');
1474							$box.removeClass('open-items');
1475							btn.classList.remove('closing');
1476							if ($el_transp.length) {
1477								$el_transp.removeClass('is_mobile_open');
1478							}
1479						}, 500);
1480						$body.removeClass('opening-overlay-menu');
1481						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1482							$box.animate({
1483								height: 0
1484							}, {
1485								duration: 600,
1486								easing: "easeInOutCirc",
1487								complete: function(elements) {
1488									$(elements).css('height', '');
1489									animating = false;
1490									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1491										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1492									}
1493									$body.removeClass('open-overlay-menu');
1494									if ( $menuBlock.length ) {
1495										UNCODE.animateSubInside($menuBlock, true);
1496									}
1497								}
1498							});
1499						} else {
1500							animating = false;
1501							offCanvasAnim = setTimeout(function(){
1502								$body.removeClass('open-overlay-menu');
1503								if ( $menuBlock.length ) {
1504									UNCODE.animateSubInside($menuBlock, true);
1505								}
1506							}, 1000);
1507						}
1508					}
1509				};
1510				check = (!UNCODE.menuOpened) ? open() : close();
1511			}
1512		});
1513
1514		$('html').on('click', function(event){
1515			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1516				$('.uncode-close-offcanvas-mobile:visible').trigger('click');
1517			}
1518		});
1519
1520		window.addEventListener('menuMobileTrigged', function(e) {
1521			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1522		});
1523		window.addEventListener('orientationchange', function(e) {
1524			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1525		});
1526		window.addEventListener("resize", function() {
1527			if ($(window).width() < UNCODE.mediaQuery) {
1528				if (UNCODE.isMobile) {
1529					var $box = $('.box-container .main-menu-container'),
1530						$el = $('.box-container .menu-horizontal-inner:not(.no-mobile), .box-container .menu-sidebar-inner:not(.no-mobile)');
1531					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1532						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1533							elHeight = 0;
1534							$.each($el, function(index, val) {
1535								elHeight += $(val).outerHeight();
1536							});
1537							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;
1538							$($box).css('height', elHeight + 'px');
1539						}
1540					}
1541				}
1542			} else {
1543				$('.menu-hide-vertical').removeAttr('style');
1544				$('.menu-container-mobile').removeAttr('style');
1545				$('.vmenu-container.menu-container').removeAttr('style');
1546
1547				if ( UNCODE.menuOpened ) {
1548					$('.open-items').removeClass('open-items');
1549					$('.is_mobile_open').removeClass('is_mobile_open');
1550					$('.open-overlay-menu').removeClass('open-overlay-menu');
1551					$('.opening-overlay-menu').removeClass('opening-overlay-menu');
1552				}
1553			}
1554		});
1555
1556		$(window).on('scroll', function(){
1557			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1558				$(window).scrollTop(scrolltop);
1559				return false;
1560			}
1561		});
1562
1563	};
1564
1565	function menuOffCanvas() {
1566		var menuClose = new CustomEvent('menuCanvasClose'),
1567			menuOpen = new CustomEvent('menuCanvasOpen');
1568		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1569			if ($(window).width() > UNCODE.mediaQuery) {
1570				if ( $('body.vmenu-offcanvas-overlay').length ) {
1571					if ($(event.currentTarget).hasClass('off-close')) {
1572						$(event.currentTarget).removeClass('off-close');
1573						requestTimeout(function() {
1574							window.dispatchEvent(menuClose);
1575						}, 500);
1576
1577					} else {
1578						$(event.currentTarget).addClass('off-close');
1579						window.dispatchEvent(menuOpen);
1580					}
1581				} else {
1582					if ($(event.currentTarget).hasClass('close')) {
1583						$(event.currentTarget).removeClass('close');
1584						$(event.currentTarget).addClass('closing');
1585						requestTimeout(function() {
1586							$(event.currentTarget).removeClass('closing');
1587							window.dispatchEvent(menuClose);
1588						}, 500);
1589
1590					} else {
1591						$(event.currentTarget).addClass('close');
1592						window.dispatchEvent(menuOpen);
1593					}
1594				}
1595			}
1596
1597			$('body').toggleClass('off-opened');
1598		});
1599
1600		$('body').on('click.menu-off-canvas-mobile', function(e){
1601			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1602				var $vMenuCont = $('#masthead .vmenu-container'),
1603					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1604
1605					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1606					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1607					vmenu_off = $vMenuCont.offset(),
1608					vmenu_l = parseFloat(vmenu_off.left),
1609					vmenu_t = parseFloat(vmenu_off.top),
1610					vmenu_r = vmenu_l + vmenu_w,
1611					vmenu_b = vmenu_t + vmenu_h,
1612
1613					close_h = parseFloat( $close_menu.outerHeight() ),
1614					close_w = parseFloat( $close_menu.outerWidth() ),
1615					close_off = $close_menu.offset(),
1616					close_l = parseFloat(close_off.left),
1617					close_t = parseFloat(close_off.top),
1618					close_r = close_l + close_w,
1619					close_b = close_t + close_h;
1620				if (
1621					!(
1622						e.clientX > vmenu_l &&
1623						e.clientX < vmenu_r
1624					)
1625					||
1626					(
1627						e.clientX > close_l &&
1628						e.clientX < close_r
1629					)
1630				) {
1631					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1632				}
1633			}
1634		});
1635	};
1636
1637	function menuOverlay() {
1638		if ( $('.overlay').length ) {
1639			$('.overlay').removeClass('hidden');
1640		}
1641		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1642			$('.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) {
1643				var transDelay = (index / 20) + 0.1;
1644				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1645					transDelay = transDelay + 0.3;
1646				$(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');
1647			});
1648		}
1649	};
1650
1651	function menuToggleAnimation() {
1652		var $block = $('body'),
1653			$menuBlocks = $('.menu.unmenu-block', $block),
1654			$allSeqs = $('[data-delay-seq]', $block);
1655
1656		$allSeqs.each(function(key, seq){
1657			$(seq).removeAttr('data-delay');
1658		});
1659
1660		$menuBlocks.each(function(key, menu){
1661
1662			var $animatesHidden = $('.translate_when_almost_visible', menu).filter(':hidden');
1663			$animatesHidden.each(function(key_, seq){
1664				$(seq).removeClass('translate_when_almost_visible').addClass('not_translate_when_almost_visible');
1665			});
1666
1667			var $animatesVisibile = $('.not_translate_when_almost_visible', menu).filter(':visible');
1668			$animatesVisibile.each(function(key_, seq){
1669				$(seq).removeClass('not_translate_when_almost_visible').addClass('translate_when_almost_visible');
1670			});
1671
1672			var $delaySequentials = $('[data-delay-seq]', menu).filter(':visible'),
1673				delay = parseFloat( $delaySequentials.first().attr('data-delay-seq') ),
1674				interval = parseFloat( $delaySequentials.first().attr('data-interval') );
1675			$delaySequentials.each(function(_key, seq){
1676				$(seq).attr('data-delay', delay + (interval*_key));
1677			});
1678		});
1679	}
1680	//menuToggleAnimation();
1681	$(document).on('unblock-toggles-init', menuToggleAnimation);
1682
1683	var $secondary_parent;
1684	function menuAppend() {
1685
1686		var $menuBlock = $('#uncode-mobile-menu-block').length;
1687		if ( $menuBlock ) {
1688			return;
1689		}
1690		var $body = $('body'),
1691			$menuCont = $('.menu-container:not(.vmenu-container)'),
1692			$vMenuCont = $('.menu-container.vmenu-container'),
1693			$cta = $('.navbar-cta'),
1694			$socials = $('.navbar-social:not(.appended-navbar)'),
1695			$ul = $('.navbar-main ul.menu-primary-inner'),
1696			$ulCta,
1697			$ulSocials,
1698			$navLast,
1699			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1700			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1701			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1702			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1703			$ulFirst = $('> ul', $firstNav),
1704			setCTA,
1705			appendCTA = function(){
1706				return true;
1707			},
1708			appendSocials = function(){
1709				return true;
1710			},
1711			appendSplit = function(){
1712				return true;
1713			};
1714
1715		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1716			$ulCta = $('> ul', $cta);
1717			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1718
1719			appendCTA = function(){
1720				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1721					$ul.after($ulCta);
1722				} else {
1723					$cta.append($ulCta);
1724				}
1725			}
1726		}
1727
1728		if ( ! $body.hasClass('cta-not-appended') ) {
1729			appendCTA();
1730		}
1731
1732		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1733		$smartSocial.each(function(){
1734			var $_smartSocial = $(this);
1735			$('> li', $_smartSocial).each(function(){
1736				var $li = $(this);
1737				if ( $li.hasClass('mobile-hidden') ) {
1738					$_smartSocial.addClass('mobile-hidden');
1739				} else {
1740					$_smartSocial.removeClass('mobile-hidden');
1741					return false;
1742				}
1743			});
1744
1745			$('> li', $_smartSocial).each(function(){
1746				var $li = $(this);
1747				if ( $li.hasClass('tablet-hidden') ) {
1748					$_smartSocial.addClass('tablet-hidden');
1749				} else {
1750					$_smartSocial.removeClass('tablet-hidden');
1751					return false;
1752				}
1753			});
1754		});
1755
1756		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1757			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1758			if ( $body.hasClass('hmenu-center-split') ) {
1759				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1760			} else {
1761				$navLast = $('.navbar-nav-last', $vMenuCont);
1762			}
1763
1764			if ( ! $navLast.length ) {
1765				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1766				if ( $body.hasClass('hmenu-center-split') ) {
1767					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1768					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1769				} else {
1770					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1771					$navLast = $('.navbar-nav-last', $vMenuCont);
1772				}
1773			}
1774
1775			appendSocials = function(){
1776				if ( !$body.hasClass('menu-overlay-center') ) {
1777				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1778				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1779				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1780				// 		$ulSocials.each(function(){
1781				// 			var $li_social = $(this);
1782				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1783				// 		});
1784				// 	}
1785				// } else {
1786					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1787						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1788						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1789							$('> ul.menu-smart-social li', $socials).remove();
1790						}
1791						$navLast.append($ulSocials);
1792					} else {
1793						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1794							$('> ul.menu-smart-social li', $navLast).remove();
1795						}
1796						$socials.append($ulSocials);
1797					}
1798				}
1799			}
1800			appendSocials();
1801		}
1802
1803		if ( $vMenuCont.length ) {
1804			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1805		} else {
1806			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1807		}
1808		if ( $accordion_secondary.length ) {
1809			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1810			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1811				if ( !$accordion_secondary_ph.length ) {
1812					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1813				}
1814				if ( $vMenuCont.length ) {
1815					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1816				} else {
1817					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1818						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1819					} else {
1820						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1821					}
1822				}
1823			} else {
1824				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1825					$accordion_secondary_ph.before($accordion_secondary);
1826				}
1827			}
1828		}
1829
1830		if ( $vMenuCont.length ) {
1831			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1832		} else {
1833			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1834		}
1835
1836		if ( $extra_icons.length ) {
1837			if ( $vMenuCont.length ) {
1838				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1839					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1840						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1841							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1842						$not_social.each(function(){
1843							if ( ! $primary_after.length ) {
1844								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1845								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1846								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1847							}
1848							var $extra_li = $(this);
1849							$primary_after.find('> ul').append($extra_li);
1850						});
1851					} else {
1852						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1853							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1854						$not_social.each(function(){
1855							var $extra_li = $(this);
1856							$extra_icons.find('> ul').append($extra_li);
1857						});
1858					}
1859				} /*else {
1860					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1861					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1862						if ( !$extra_icons_ph.length ) {
1863							$extra_icons.after('<span class="extra-icons-ph" />');
1864						}
1865						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1866							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1867						} else {
1868							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1869						}
1870					} else {
1871						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1872							$extra_icons_ph.before($extra_icons);
1873						}
1874					}
1875				}*/
1876			} else {
1877				if ( ! $body.hasClass('hmenu-center-double') ) {
1878					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1879						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1880							$primary_after = $('.nav.navbar-main-after', $menuCont);
1881
1882						if ( ! $primary_after.length && $not_social.length ) {
1883							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1884								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1885							} else {
1886								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1887							}
1888							$primary_after = $('.nav.navbar-main-after', $menuCont);
1889							$primary_after.append('<ul class="menu-smart sm menu-smart-social" role="menu" />');
1890						}
1891						var tablet_hidden = true,
1892							mobile_hidden = true;
1893						$not_social.each(function(){
1894							var $extra_li = $(this);
1895							$primary_after.find('> ul').append($extra_li);
1896							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1897								tablet_hidden = false;
1898							}
1899							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1900								mobile_hidden = false;
1901							}
1902						});
1903						if ( tablet_hidden === true && $not_social.length ) {
1904							$primary_after.addClass('tablet-hidden');
1905						}
1906						if ( mobile_hidden === true && $not_social.length ) {
1907							$primary_after.addClass('mobile-hidden');
1908						}
1909					} else {
1910						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1911
1912						if ( $primary_after.length ) {
1913							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1914							$not_social.each(function(){
1915								var $extra_li = $(this);
1916								$extra_icons.find('> ul').append($extra_li);
1917							});
1918							$primary_after.remove();
1919						}
1920					}
1921				}
1922			}
1923		}
1924
1925		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1926			appendSplit = function(){
1927				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1928					if ( $extra_icons.length ) {
1929						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1930							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1931								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1932							$not_social.each(function(){
1933								var $extra_li = $(this);
1934								$append_ul.append($extra_li);
1935							});
1936							if ( $secondNav.length ) {
1937								$secondNav.append($append_ul);
1938							} else {
1939								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1940							}
1941						}
1942					}
1943					if ( $secondNav.length ) {
1944						$secondNav.prepend($ulFirst);
1945					} else {
1946						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1947					}
1948					$firstMenu.hide();
1949				} else {
1950					$firstNav.append($ulFirst);
1951					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1952					if ( $append_ul.length ) {
1953						var $not_social = $('> li:not(.social-icon)', $append_ul);
1954						$not_social.each(function(){
1955							var $extra_li = $(this);
1956							$extra_icons.find('> ul').append($extra_li);
1957						});
1958					}
1959					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1960					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1961					$firstMenu.css({
1962						'display': 'table-cell'
1963					});
1964				}
1965			}
1966		}
1967		appendSplit();
1968
1969		$(window).on( 'wwResize', function(){
1970			clearRequestTimeout(setCTA);
1971			setCTA = requestTimeout( function() {
1972				appendCTA();
1973				appendSocials();
1974				appendSplit();
1975			}, 10 );
1976		});
1977	}
1978	//menuMobileButton();
1979	menuMobile();
1980	menuOffCanvas();
1981	menuAppend();
1982	menuOverlay();
1983
1984	var stickyDropdownSearch = function(){
1985		var $masthead = $('#masthead'),
1986			$ddSearch = $('.overlay.overlay-search', $masthead),
1987			$styles = $('#stickyDropdownSearch').remove();
1988		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1989			var $menuWrapper = $('.menu-wrapper'),
1990				$navbar = $('.menu-container-mobile', $menuWrapper),
1991				navbarH = $navbar.outerHeight(),
1992				//$topbar = $('.top-menu', $menuWrapper),
1993				//topbarH = $topbar.outerHeight(),
1994				_css;
1995
1996			_css = '<style id="stickyDropdownSearch">';
1997			_css += '@media (max-width: 959px) {';
1998			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
1999			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
2000			_css += '}';
2001			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
2002			_css += 'position: fixed;';
2003			_css += 'top: 0;';
2004			_css += '}';
2005			_css += '</style>';
2006
2007			$(_css).appendTo($('head'));
2008		}
2009	}
2010	stickyDropdownSearch();
2011
2012	var setMenuOverlay;
2013	$(window).on( 'wwResize', function(){
2014		if ( $('.overlay').length && $(window).width() > 1024 ) {
2015			$('.overlay').addClass('hidden');
2016		}
2017		clearRequestTimeout(setMenuOverlay);
2018		setMenuOverlay = requestTimeout( function(){
2019			menuOverlay();
2020			menuAppend();
2021			stickyDropdownSearch();
2022		}, 150 );
2023	});
2024	UNCODE.menuMegaBlock();
2025	UNCODE.menuSmartInit();
2026	$(window).on('wwResize', function(){
2027		UNCODE.menuSmartInit();
2028	});
2029
2030	$(window).on('menuOpen', function(){
2031		var $overlay = $('.overlay.overlay-unblock');
2032		if ( $overlay.length ) {
2033			UNCODE.animateSubInside($overlay);
2034		}
2035	});
2036
2037	$(window).on('menuClosed', function(){
2038		var $overlay = $('.overlay.overlay-unblock');
2039		if ( $overlay.length ) {
2040			UNCODE.animateSubInside($overlay, true);
2041			var $smartMenus = $overlay.find('.menu-smart');
2042			$smartMenus.each(function(key, smartMenu){
2043				$(smartMenu).smartmenus('menuHideAll');
2044			});
2045		}
2046	});
2047};
2048
2049UNCODE.menuSmartInit = function() {
2050	var $menusmart = $('[class*="menu-smart"]'),
2051		$masthead = $('#masthead'),
2052		$hMenu = $('.menu-horizontal-inner', $masthead),
2053		$focus = $('.overlay-menu-focus'),
2054		$uls_anim = $('> li> ul[role="menu"]', $menusmart),
2055		showTimeout = 50,
2056		hideTimeout = 50,
2057		showTimeoutFunc, hideTimeoutFunc, subMenuRT;
2058
2059	if ( typeof $masthead.attr('data-menu-anim') !== 'undefined' && $masthead.attr('data-menu-anim') !== '' ) {
2060		var menu_anim = $masthead.attr('data-menu-anim');
2061		if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
2062			$uls_anim.each(function(){
2063				var $ul_anim = $(this);
2064				if ( !$('> li[data-block]', $ul_anim).length ) {
2065					$ul_anim.addClass('animate_when_almost_visible');
2066					$ul_anim.addClass(menu_anim);
2067				} else {
2068					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2069					if ( dataB !== 'no-anim' && !dataB.includes('slight-anim') ) {
2070						$ul_anim.addClass('animate_when_almost_visible');
2071						$ul_anim.addClass(dataB);
2072					}
2073				}
2074			});
2075		} else {
2076			$uls_anim.each(function(){
2077				var $ul_anim = $(this);
2078				if ( !$('> li[data-block]', $ul_anim).length ) {
2079					$ul_anim.removeClass('animate_when_almost_visible');
2080					$ul_anim.removeClass(menu_anim);
2081				} else {
2082					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2083					$ul_anim.removeClass('animate_when_almost_visible');
2084					$ul_anim.removeClass(dataB);
2085				}
2086			});
2087		}
2088	}
2089
2090	$('> li.menu-item-has-children', $menusmart).hover(function(){
2091		$(this).data('hover', true);
2092	}, function(){
2093		$(this).data('hover', false);
2094	});
2095
2096	$('> li.menu-item-has-children', $menusmart).each(function(){
2097		var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
2098	});
2099
2100	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
2101		e.preventDefault();
2102	});
2103
2104	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
2105			
2106		var $notLis = $('> .nav > ul > li a', $hMenu),
2107			$menuA = $('a', $masthead).not($notLis),
2108			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
2109			showFuncCond = function() { return true };
2110
2111		if ( $('body').hasClass('focus-megamenu') ) {
2112			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.need-focus');
2113			showFuncCond = function($ul) { return $ul.hasClass('need-focus') };
2114		} else if ( $('body').hasClass('focus-links') ) {
2115			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
2116		}
2117
2118		$hoverSelector.hover(function(){
2119			clearRequestTimeout(hideTimeoutFunc);
2120			showTimeoutFunc = requestTimeout(function(){
2121				$('body').addClass('navbar-hover');
2122			}, showTimeout*2);
2123		}, function(){
2124			hideTimeoutFunc = requestTimeout(function(){
2125				if ( ! $('.overlay-search.open', $masthead).length ) {
2126					$('body').removeClass('navbar-hover');
2127				}
2128			}, hideTimeout*2);
2129		});
2130	} else {
2131		showFuncCond = function() { return false };
2132	}
2133
2134	if ($menusmart.length > 0) {
2135		var objShowTimeout;
2136		$menusmart.smartmenus({
2137			subIndicators: false,
2138			subIndicatorsPos: 'append',
2139			//subMenusMinWidth: '13em',
2140			showOnClick: SiteParameters.menuShowOnClick,
2141			subIndicatorsText: '',
2142			showTimeout: showTimeout,
2143			hideTimeout: hideTimeout,
2144			scrollStep: 8,
2145			showFunction: function($ul, complete) {
2146				$(document).trigger('un-menu-show', $ul);
2147				clearRequestTimeout(showTimeoutFunc);
2148				$ul.fadeIn(0, 'linear', function(){
2149					complete();
2150					if ( $ul.hasClass('vc_row') ) {
2151						$ul.css({
2152							'display': 'table'
2153						});
2154					}
2155					if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') ) {
2156						$('body').addClass('open-megamenu');
2157					}
2158					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
2159						$('body').addClass('navbar-hover');
2160					}
2161					var showed = 0;
2162					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(index, val){
2163						var $element = $(this),
2164							delayAttr = $element.attr('data-delay');
2165						if ( !$element.closest('.owl-carousel').length && ! $element.closest('.cssgrid-animate-sequential').length ) {
2166							if (delayAttr == undefined) delayAttr = 0;
2167							requestTimeout(function() {
2168								$element.addClass('start_animation');
2169							}, delayAttr);
2170						} else if ( $element.closest('.cssgrid-animate-sequential').length ) {
2171							var grid = $element.closest('.cssgrid-animate-sequential');
2172
2173							var delay = index,
2174								delayAttr = parseInt($element.attr('data-delay'));
2175							if (isNaN(delayAttr)) delayAttr = 100;
2176							delay -= showed;
2177							objShowTimeout = requestTimeout(function() {
2178								$element.removeClass('zoom-reverse').addClass('start_animation');
2179								showed = index;
2180							}, delay * delayAttr);
2181						}
2182					});
2183					if ( $ul.is('.animate_when_almost_visible') ) {
2184						$ul.addClass('start_animation');
2185					}
2186				}).addClass('open-animated');
2187			},
2188			hideFunction: function($ul, complete) {
2189				if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') && ! $('.overlay-search.open', $masthead).length ) {
2190					$('body').removeClass('open-megamenu');
2191				}
2192				var fixIE = $('html.ie').length;
2193				if (fixIE) {
2194					var $rowParent = $($ul).closest('.main-menu-container');
2195					$rowParent.height('auto');
2196				}
2197				$ul.fadeOut(0, 'linear', function(){
2198					complete();
2199					$ul.removeClass('open-animated');
2200					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
2201						$('body').removeClass('open-submenu');
2202					}
2203					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(){
2204						$(this).removeClass('start_animation');
2205					});
2206					if ( $ul.is('.animate_when_almost_visible') ) {
2207						$ul.removeClass('start_animation');
2208					}
2209				});
2210				$ul.find('.start_animation').each(function(index, val) {
2211					clearRequestTimeout(subMenuRT);
2212					$(val).removeClass('start_animation');
2213				});
2214				$(document).trigger('un-menu-hide', $ul);
2215				clearRequestTimeout(objShowTimeout);
2216			},
2217			collapsibleShowFunction: function($ul, complete) {
2218				$ul.slideDown(400, 'easeInOutCirc', function(){
2219					UNCODE.animateSubInside($ul);
2220					complete();
2221				});
2222			},
2223			collapsibleHideFunction: function($ul, complete) {
2224				$ul.slideUp(200, 'easeInOutCirc', function(){
2225					complete();
2226				});
2227				$(document).trigger('sub-menu-slide-up');
2228			},
2229			hideOnClick: SiteParameters.menuHideOnClick,
2230		});
2231
2232		if ( $('body').hasClass('menu-accordion-active') ) {
2233			$menusmart.each(function(key, menu){
2234				$(menu).addClass('menu-smart-init');
2235				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2236			});
2237		}
2238
2239		$menusmart.each(function(key, menu){
2240			$(menu).on('beforecollapse.smapi', function( e, $sub ){
2241				if ( $('> .trigger-window-resize', $sub).length ) {
2242					window.dispatchEvent(new Event('resize'));
2243					$(window).trigger('uncode.re-layout');
2244				} else if ( $('> .trigger-box-resize', $sub).length ) {
2245					window.dispatchEvent(new CustomEvent('boxResized'));
2246				}
2247				return false;
2248			});
2249		});
2250		
2251		$(document).on( 'uncode.smartmenu-appended', function(){
2252			requestTimeout(function(){
2253				$menusmart.smartmenus( 'refresh' );
2254			}, 1000);
2255		});
2256
2257	}
2258
2259	$('.main-menu-container').each(function(){
2260		var $main_cont = $(this),
2261			$uls = $('ul:not(.nav-tabs)', $main_cont);
2262
2263		$uls.each(function(){
2264			var $ul = $(this),
2265				mobile_hidden = true,
2266				tablet_hidden = true;
2267			$('> li:not(.hidden)', $ul).each(function(){
2268				if ( !$(this).hasClass('mobile-hidden') ) {
2269					mobile_hidden = false;
2270					return false;
2271				}
2272			});
2273			$('> li:not(.hidden)', $ul).each(function(){
2274				if ( !$(this).hasClass('tablet-hidden') ) {
2275					tablet_hidden = false;
2276					return false;
2277				}
2278			});
2279			if ( mobile_hidden ) {
2280				$ul.addClass('mobile-hidden');
2281			}
2282			if ( tablet_hidden ) {
2283				$ul.addClass('tablet-hidden');
2284			}
2285		});
2286
2287		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2288
2289		$divUlsMB.each(function(){
2290			var $divUlMB = $(this),
2291				div_mobile_hidden = true,
2292				div_tablet_hidden = true;
2293
2294			$('> ul:not(.hidden)', $divUlMB).each(function(){
2295				if ( !$(this).hasClass('mobile-hidden') ) {
2296					div_mobile_hidden = false;
2297					return false;
2298				}
2299			});
2300			$('> ul:not(.hidden)', $divUlMB).each(function(){
2301				if ( !$(this).hasClass('tablet-hidden') ) {
2302					div_tablet_hidden = false;
2303					return false;
2304				}
2305			});
2306			if ( div_mobile_hidden ) {
2307				$divUlMB.addClass('mobile-hidden');
2308			}
2309			if ( div_tablet_hidden ) {
2310				$divUlMB.addClass('tablet-hidden');
2311			}
2312		});
2313	});
2314
2315	var overlaySearchButton = function(){
2316		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2317
2318		$search_wrap.each(function(){
2319			var $form = $('form', this),
2320				$icon = $('i', $form);
2321
2322			$icon.on('click', function(){
2323				$form.submit();
2324			});
2325		});
2326	};
2327	overlaySearchButton();
2328}
2329
2330UNCODE.menuMegaBlock = function() {
2331	var $megaBlocks = $('.megamenu-block-wrapper');
2332	if ( ! $megaBlocks.length ) {
2333		return;
2334	}
2335
2336	$megaBlocks.each(function(){
2337		var $megaLi = $(this),
2338			//$parentLi = $megaLi.closest('li.menu-item').addClass('mega-menu'),
2339			dataLi = $megaLi.attr('data-block'),
2340			$megaUl = $megaLi.closest('ul').addClass('block-wrapper-parent unmenu-inner-ul'),
2341			$innerUl = $megaLi.find('ul').addClass('unmenu-inner-ul');
2342		$megaUl.addClass(dataLi);
2343		//$('.column_parent > .uncol .uncont:not(.uncont *)', $megaLi).addClass(dataLi);
2344		$('img', $megaLi).removeAttr('loading');
2345	});
2346}
2347
2348UNCODE.unBlockMenu = function(){
2349	//Menu block
2350	var $unBlockMenus = $('.menu.unmenu-block');
2351
2352	$unBlockMenus.each(function(){
2353		var $unBlockMenu = $(this),
2354			$lastOnes;
2355
2356		if ( !$unBlockMenu.hasClass('first-grid') ) {
2357			$lastOnes = $('ul', $unBlockMenu).last();
2358			$lastOnes.each(function(){
2359                var _cols = $(this).css('grid-template-columns');
2360				if ( _cols.split(' ').length > 1 && !_cols.startsWith('repeat(1,')) {
2361					$unBlockMenu.addClass('has-last-ones');
2362					$(this).addClass('last-one');
2363				} else {
2364					var $parentLi = $(this).closest('li'),
2365						$siblingLi = $parentLi.next();
2366					if ( !$siblingLi.length ) {
2367						$unBlockMenu.addClass('has-last-ones');
2368						$(this).addClass('last-one');
2369					}
2370				}
2371			});
2372		} else {
2373			var checkGrids = function(){
2374				$unBlockMenu.find('.last-ul').removeClass('last-one');
2375				var _cols = $unBlockMenu.css('grid-template-columns'),
2376                    cols = _cols.match(/^repeat\(\s*(\d+)\s*,/) ? parseInt(_cols.match[1], 10) : _cols.split(' ').length,
2377					$lis = $('> li', $unBlockMenu),
2378					totLi = $lis.length,
2379					lastRowCount = totLi - (totLi % cols || cols),
2380					$lastLis = $lis.slice(cols).addClass('last-lis'),
2381    				$lastRowLis = $lis.slice(lastRowCount);
2382				$lastRowLis.each(function(){
2383					var $lastRowLi = $(this);
2384					$lastRowLi.find('ul').last().addClass('last-one');
2385				});
2386			}
2387			$(window).on('wwResize', checkGrids);
2388			checkGrids();
2389
2390		}
2391
2392	});
2393
2394	//Accordion
2395
2396	var $tgglBlocks = $('.unmenu-collapse');
2397	$tgglBlocks.each(function(key, val){
2398		var $acc = $(val),
2399			$titles = $('.menu-item-has-children > *:first-child', $acc),
2400			run = true;
2401
2402		var checkRun = function(){
2403			if ( $acc.hasClass('unmenu-collapse-mobile') && UNCODE.wwidth >= UNCODE.mediaQuery ) {
2404				run = false;
2405			} else {
2406				run = true;
2407			}
2408
2409			if ( $titles.length ) {
2410				$titles.each(function(_key, _val){
2411					var $title = $(_val),
2412						$sub = $title.closest('li').find('> ul.un-submenu');
2413
2414					$sub.each(function(key, val){
2415						if ( run ) {
2416
2417							var total = $sub.length;
2418							var completed = 0;
2419				
2420							$(val).slideUp({
2421								duration: 1,
2422								complete: function() {
2423									$(this).addClass('toggle-init');
2424
2425									completed++;
2426
2427									if ( completed === total ) {
2428										$(document).trigger('unblock-toggles-init');
2429										$( document.body ).trigger( 'uncode_waypoints' );
2430									}
2431								}
2432							});
2433						} else {
2434							$(val).show();
2435						}
2436					});
2437				});
2438			}
2439		}
2440		checkRun();
2441
2442		$(window).on('wwResize menuClosed', checkRun);
2443
2444		if ( $titles.length ) {
2445			$titles.each(function(_key, _val){
2446				var $title = $(_val),
2447					$sub = $title.closest('li').find('> ul.un-submenu'),
2448					$menu = $sub.closest('.menu.unmenu-block'),
2449					$ulS;
2450
2451				$title.off('click').on('click', function(e){
2452					e.preventDefault();
2453					$ulS = $menu.find('ul:visible').not($sub).not($sub.parents('ul'))
2454					if ( run ) {
2455						if ( $sub.is(':visible') ) {
2456							$sub.slideUp(200, 'easeInOutCirc', function(){
2457								$.each($('.start_animation', $sub), function(index, val) {
2458									var element = $(val);
2459									element.removeClass('start_animation');
2460
2461								});
2462								$sub.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2463								$(document).trigger('sub-menu-slide-up');
2464							});
2465						} else {
2466							$ulS.slideUp({
2467								duration: 200,
2468								easing: 'easeInOutCirc',
2469								start: function(){
2470									var _this = $(this);
2471									_this.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2472									$(document).trigger('sub-menu-slide-up');
2473								}
2474							});
2475
2476							$sub.slideDown({
2477								duration: 400,
2478								easing: 'easeInOutCirc',
2479								start: function() {
2480									var _this = $(this);
2481									_this.css('height', 0);
2482									if ( _this.hasClass('is-grid') ) {
2483										_this.css('display','grid');
2484									}
2485
2486									UNCODE.animateSubInside(_this)
2487									_this.parents('li').eq(0).addClass('un-submenu-open').removeClass('un-submenu-closed');
2488								}
2489							});
2490						}
2491
2492					}
2493				});
2494			});
2495
2496			if ( $acc.closest('#masthead').length ) {
2497				$(window).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
2498					$acc.find('ul.un-submenu').slideUp(200, 'easeInOutCirc');
2499				});
2500			}
2501		}
2502
2503	});
2504	
2505};
2506
2507UNCODE.mobileMenuBlockSkins = function(){
2508	var $mobileBlock = $('#uncode-mobile-menu-block'),
2509		$parentDark = $mobileBlock.closest('.submenu-dark'),
2510		$parentLight = $mobileBlock.closest('.submenu-light');
2511
2512
2513	if ( $parentDark.length ) {
2514		var $cols = $('.uncol.style-light:not(.style-spec):not(.style-run)', $mobileBlock);
2515		$cols.each(function(key, val){
2516			var $col = $(val).removeClass('style-light').addClass('style-dark style-run');
2517		});
2518	}
2519
2520	if ( $parentLight.length ) {
2521		var $cols = $('.uncol.style-dark:not(.style-spec):not(.style-run)', $mobileBlock);
2522		$cols.each(function(key, val){
2523			var $col = $(val).removeClass('style-dark').addClass('style-light style-run');
2524		});
2525	}
2526};
2527UNCODE.okvideo = function(ev) {
2528	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2529	$.okvideo = function(options) {
2530		// if the option var was just a string, turn it into an object
2531		if (typeof options !== 'object') options = {
2532			'video': options
2533		};
2534		var base = this;
2535		// kick things off
2536		base.init = function() {
2537			base.options = $.extend({}, $.okvideo.options, options);
2538			// support older versions of okvideo
2539			if (base.options.video === null) base.options.video = base.options.source;
2540			base.setOptions();
2541			var target = base.options.target || $('body');
2542			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2543			var zIndex = base.options.controls === 3 ? -999 : "auto";
2544			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2545				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>';
2546				if (OKEvents.utils.isMobile()) {
2547					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>');
2548				} else {
2549					if (base.options.controls === 3) {
2550						target.append(mask)
2551					}
2552					if (base.options.adproof === 1) {
2553						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>');
2554					} else {
2555						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>');
2556					}
2557				}
2558				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2559				if (base.options.playlist.list === null) {
2560					if (base.options.video.provider === 'youtube') {
2561						base.loadYouTubeAPI();
2562					} else if (base.options.video.provider === 'vimeo') {
2563						base.options.volume /= 100;
2564						base.loadVimeoAPI();
2565					}
2566				} else {
2567					base.loadYouTubeAPI();
2568				}
2569			}
2570		};
2571		// clean the options
2572		base.setOptions = function() {
2573			// exchange 'true' for '1' and 'false' for 3
2574			for (var key in this.options) {
2575				if (this.options[key] === true) this.options[key] = 1;
2576				if (this.options[key] === false) this.options[key] = 3;
2577			}
2578			if (base.options.playlist.list === null) {
2579				base.options.video = base.determineProvider();
2580			}
2581			// pass options to the window
2582			$(window).data('okoptions-' + base.options.id, base.options);
2583		};
2584		// insert js into the head and exectue a callback function
2585		base.insertJS = function(src, callback, provider){
2586			var tag;
2587			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2588				delete UNCODE.insertedSripts[src];
2589				var tags = document.getElementsByTagName('script');
2590				for (var i = tags.length; i >= 0; i--){
2591					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2592						tags[i].parentNode.removeChild(tags[i]);
2593					}
2594				}
2595			} else {
2596				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2597					tag = UNCODE.insertedSripts[src];
2598					if (callback){
2599						if (tag.readyState){  //IE
2600							tag.onreadystatechange = function(){
2601								if (tag.readyState === "loaded" ||
2602									tag.readyState === "complete"){
2603									tag.onreadystatechange = null;
2604									callback();
2605								}
2606							};
2607						} else {
2608							$(tag).on('load', callback);
2609						}
2610					}
2611					return;
2612				}
2613			}
2614			tag = document.createElement('script');
2615			if (callback){
2616				if (tag.readyState){  //IE
2617					tag.onreadystatechange = function(){
2618						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2619							tag.onreadystatechange = null;
2620							callback();
2621						}
2622					};
2623				} else {
2624					tag.onload = function() {
2625						callback();
2626					};
2627				}
2628			}
2629			tag.src = src;
2630			var firstScriptTag = document.getElementsByTagName('script')[0];
2631			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2632			if ( ! UNCODE.insertedSripts ) {
2633				UNCODE.insertedSripts = [];
2634			}
2635			UNCODE.insertedSripts[src] = tag;
2636		};
2637		// load the youtube api
2638		base.loadYouTubeAPI = function(callback) {
2639			if ( ev === 'uncode-more-items-loaded' ) {
2640				onYouTubeIframeAPIReady();
2641			} else {
2642				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2643			}
2644		};
2645		base.loadYouTubePlaylist = function() {
2646			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2647		};
2648		// load the vimeo api by replacing the div with an iframe and loading js
2649		base.loadVimeoAPI = function() {
2650			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',
2651			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2652			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2653			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2654			base.insertJS('//player.vimeo.com/api/player.js', function() {
2655				vimeoPlayerReady(base.options.id);
2656			}, 'vimeo');
2657		};
2658		// is it from youtube or vimeo?
2659		base.determineProvider = function() {
2660			var a = document.createElement('a');
2661			a.href = base.options.video;
2662			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2663				var videoid = a.href.split('/')[3].toString();
2664				var query = videoid.substring(videoid.indexOf('?') + 1);
2665				if (query != '') {
2666					var vars = query.split('&');
2667					for (var i = 0; i < vars.length; i++) {
2668						var pair = vars[i].split('=');
2669						if (pair[0] == 'v') {
2670							videoid = pair[1];
2671						}
2672					}
2673				}
2674				return {
2675					"provider": "youtube",
2676					"id": videoid
2677				};
2678			} else if (/vimeo.com/.test(base.options.video)) {
2679				return {
2680					"provider": "vimeo",
2681					"id": (a.href.split('/')[3].toString()).split('#')[0],
2682				};
2683			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2684				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2685				if (id.length == 11) {
2686					return {
2687						"provider": "youtube",
2688						"id": id.toString()
2689					};
2690				} else {
2691					for (var i = 0; i < base.options.video.length; i++) {
2692						if (typeof parseInt(base.options.video[i]) !== "number") {
2693							throw 'not vimeo but thought it was for a sec';
2694						}
2695					}
2696					return {
2697						"provider": "vimeo",
2698						"id": base.options.video
2699					};
2700				}
2701			} else {
2702				throw "OKVideo: Invalid video source";
2703			}
2704		};
2705		base.init();
2706	};
2707
2708	var checkResize,
2709		newW = UNCODE.wwidth;
2710
2711	$.okvideo.options = {
2712		id: null,
2713		source: null, // Deprecate dis l8r
2714		video: null,
2715		playlist: { // eat ur heart out @brokyo
2716			list: null,
2717			index: 0,
2718			startSeconds: 0,
2719			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2720		},
2721		disableKeyControl: 1,
2722		captions: 0,
2723		loop: 1,
2724		hd: 1,
2725		volume: 0,
2726		adproof: false,
2727		unstarted: null,
2728		onFinished: null,
2729		onReady: null,
2730		onPlay: null,
2731		onPause: null,
2732		buffering: null,
2733		controls: false,
2734		autoplay: true,
2735		annotations: true,
2736		cued: null
2737	};
2738	$.fn.okvideo = function(options) {
2739		options.target = this;
2740		return this.each(function() {
2741			(new $.okvideo(options));
2742		});
2743	};
2744
2745	var checkForVideos = function(){
2746		$(".uncode-video-container.video").each(function(index, el) {
2747			var $this = $(this),
2748				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2749				url = $this.attr('data-video'),
2750				id = $this.attr('data-id'),
2751				cloned = $this.closest('.owl-item');
2752
2753			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2754				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2755					$this.okvideo({
2756						id: id,
2757						source: url.split('#')[0],
2758						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2759						autoplay: 1,
2760						controls: 0,
2761						volume: 0,
2762						adproof: 0,
2763						caller: $this,
2764						hd: 1,
2765						onReady: function(player) {
2766							var getPlayer = player.c || player.h || player,
2767							$iframe,
2768							getContainer = $(getPlayer).closest('.background-element');
2769							if (getContainer.length) {
2770								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2771							}
2772
2773							if ( $this.hasClass('drop-move') ) {
2774
2775								var $iframe = $(getPlayer),
2776									w = parseFloat($iframe.attr('width')),
2777									h = parseFloat($iframe.attr('height')),
2778									ratio = h / w,
2779									setResizeiFto,
2780								resizeiFrame = function(){
2781									var dataW = $this.attr('data-w'),
2782										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2783										newH = newW * ratio;
2784									$iframe.css({
2785										width: newW,
2786										height: newH
2787									});
2788								};
2789								resizeiFrame();
2790								$(window).on( 'load', resizeiFrame );
2791								$(window).on( 'resize', function(){
2792									clearRequestTimeout(setResizeiFto);
2793									setResizeiFto = requestTimeout( function() {
2794										resizeiFrame();
2795									}, 10 );
2796								});
2797
2798							}
2799
2800						}
2801					});
2802				}
2803			}
2804		});
2805	};
2806
2807	checkForVideos();
2808
2809	$(window).on('load', function(){
2810		$('.mejs-fullscreen-button button').on('click', function(){
2811			var $button = $(this),
2812				$stuck = $button.closest('.is_stucked');
2813
2814			if ( $stuck.length ) {
2815				$stuck = $(this).trigger("sticky_kit:detach");
2816				window.scrollTo(0, 0);
2817			}
2818		});
2819	});
2820
2821	var checkVideoResize = function(){
2822		clearRequestTimeout(checkResize);
2823		checkResize = requestTimeout(function(){
2824			if ( newW !== UNCODE.wwidth ) {
2825				newW = UNCODE.wwidth;
2826				checkForVideos();
2827			}
2828		}, 1000);
2829	};
2830
2831	$(window).off('resize', checkVideoResize)
2832	.on( 'resize', checkVideoResize);
2833
2834};
2835
2836$(document).on('uncode-ajax-filtered.videos', function(){
2837	UNCODE.okvideo("uncode-more-items-loaded");
2838});
2839UNCODE.backgroundSelfVideos = function( $ctx ) {
2840
2841	var backgroundSelfVideosInit = function( $ctx ) {
2842		if ( SiteParameters.block_mobile_videos === true ) {
2843			return false;
2844		}
2845		if (typeof MediaElement === "function") {
2846			if ( typeof $ctx === 'undefined' ) {
2847				$ctx = document;
2848			}
2849		
2850			$(".background-video-shortcode", $ctx).each(function(index, el) {
2851				if ( $(this).closest('mediaelementwrapper').length ) {
2852					return true;
2853				}
2854				var $video_el = $(this),
2855					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2856					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2857					video_id = $video_el.attr('id');
2858
2859				if ( SiteParameters.is_frontend_editor ) {
2860					video_id = video_id + '_' + index;
2861					$video_el.attr('id', video_id);
2862				}
2863
2864				var media = new MediaElement(video_id, {
2865					startVolume: 0,
2866					loop: true,
2867					success: function(mediaElement, domObject) {
2868						domObject.volume = 0;
2869						$(mediaElement).data('started', false);
2870						mediaElement.addEventListener('timeupdate', function(e) {
2871							if (!$(e.target).data('started')) {
2872								$(mediaElement).data('started', true);
2873							}
2874						});
2875						mediaElement.addEventListener('loadedmetadata', function(e) {
2876							$('body').removeClass('video-not-supported');
2877							mediaElement.play();
2878						});
2879						if (!UNCODE.isMobile) {
2880							requestTimeout(function() {
2881								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2882							}, 100);
2883						}
2884						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2885							mediaElement.play();
2886						}
2887
2888						if ( $parent_drop_move.length ) {
2889							var setResizeMEto,
2890								resizeMediaElement = function(){
2891								var dataW = $parent_drop_move.attr('data-w'),
2892									videoW = domObject.width,
2893									videoH = domObject.height,
2894									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2895									newH = newW / ( videoW / videoH );
2896
2897								$(domObject).css({
2898									'height': newH,
2899									'width': newW
2900								});
2901							};
2902							$(window).on( 'resize load', function(){
2903								clearRequestTimeout(setResizeMEto);
2904								setResizeMEto = requestTimeout( function() {
2905									resizeMediaElement();
2906								}, 10 );
2907							});
2908						}
2909
2910						mediaElement.addEventListener('play', function() {
2911							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2912							$(mediaElement).closest('#page-header').addClass('video-started');
2913							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2914						}, true);
2915
2916					},
2917					// fires when a problem is detected
2918					error: function() {}
2919				});
2920			});
2921		} else {
2922
2923			if ( typeof $ctx === 'undefined' ) {
2924				$ctx = document;
2925			}
2926		
2927			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2928			Array.from(videos).forEach(function(video_el) {
2929				video_el.addEventListener('loadedmetadata', function(e) {
2930					$('body').removeClass('video-not-supported');
2931					video_el.play();
2932				});
2933				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2934					video_el.muted = true;
2935					video_el.loop = true;
2936					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2937					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2938					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2939					$('body').removeClass('video-not-supported');
2940					video_el.play();
2941				} else {
2942					requestTimeout(function(){
2943                         backgroundSelfVideosInit( $ctx );
2944					}, 1000);
2945				}
2946			});
2947		}
2948	};
2949
2950	backgroundSelfVideosInit( $ctx );
2951
2952	$(document).on('un-menu-show', function(){
2953		setTimeout(function(){
2954			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)');
2955		}, 1);
2956	});
2957
2958
2959	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2960		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2961			var $el = model.view.$el,
2962				shortcode = model.attributes.shortcode;
2963
2964			if (typeof MediaElement === "function") {
2965				backgroundSelfVideosInit( $el );
2966			} else {
2967				backgroundSelfVideosInit( $el[0] );
2968			}
2969		});
2970	}
2971};
2972
2973UNCODE.is_scrolling = false;
2974
2975UNCODE.disableHoverScroll = function() {
2976
2977	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2978		var body = document.body,
2979		timer;
2980
2981		window.addEventListener('scroll', function() {
2982			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2983			clearRequestTimeout(timer);
2984			if ( body.classList && !body.classList.contains('disable-hover') ) {
2985				body.classList.add('disable-hover');
2986				window.dispatchEvent(new CustomEvent('disable-hover'));
2987			}
2988			UNCODE.is_scrolling = true;
2989
2990			timer = requestTimeout(function() {
2991				if ( body.classList ) {
2992					body.classList.remove('disable-hover');
2993					window.dispatchEvent(new CustomEvent('enable-hover'));
2994				}
2995				UNCODE.is_scrolling = false;
2996			}, delay);
2997		}, false);
2998	}
2999};
3000
3001UNCODE.isotopeLayout = function() {
3002	if ($('.isotope-layout').length > 0) {
3003		var isotopeContainersArray = [],
3004			typeGridArray = [],
3005			layoutGridArray = [],
3006			screenLgArray = [],
3007			screenMdArray = [],
3008			screenSmArray = [],
3009			transitionDuration = [],
3010			$filterItems = [],
3011			$filters = $('.isotope-system .isotope-filters'),
3012			$itemSelector = '.tmb-iso',
3013			$items,
3014			itemMargin,
3015			correctionFactor = 0,
3016			firstLoad = true,
3017			isOriginLeft = $('body').hasClass('rtl') ? false : true;
3018		$('[class*="isotope-container"]').each(function(index) {
3019			var _this = $(this);
3020			var isoData = _this.data(),
3021			$data_lg,
3022			$data_md,
3023			$data_sm;
3024			_this.children('.tmb').addClass('tmb-iso');
3025			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
3026			else $data_lg = '1000';
3027			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
3028			else $data_md = '600';
3029			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
3030			else $data_sm = '480';
3031			screenLgArray.push($data_lg);
3032			screenMdArray.push($data_md);
3033			screenSmArray.push($data_sm);
3034			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
3035			if (isoData.type == 'metro') typeGridArray.push(true);
3036			else typeGridArray.push(false);
3037			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
3038			else layoutGridArray.push('masonry');
3039			isotopeContainersArray.push(_this);
3040			_this.attr('data-iso-index', index);
3041		});
3042		var colWidth = function(index) {
3043				$(isotopeContainersArray[index]).width('');
3044				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
3045					widthAvailable = $(isotopeContainersArray[index]).width(),
3046					columnNum = 12,
3047					columnWidth = 0,
3048					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
3049					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
3050					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
3051					$rowContainer,
3052					paddingRow,
3053					$colContainer,
3054					paddingCol;
3055
3056				if ( consider_menu )
3057					winHeight = winHeight - UNCODE.menuHeight;
3058
3059				if ( data_vp_height === '1' ) {
3060					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
3061					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
3062					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
3063					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
3064					winHeight = winHeight - ( paddingRow + paddingCol );
3065				}
3066
3067				if (isPx) {
3068					columnWidth = Math.ceil(widthAvailable / columnNum);
3069					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
3070				} else {
3071					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
3072				}
3073				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
3074				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
3075				for (var i = 0, len = $items.length; i < len; i++) {
3076					var $item = $($items[i]),
3077						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
3078						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
3079						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
3080
3081
3082					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
3083						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
3084					}
3085
3086					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
3087						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
3088					}
3089
3090					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
3091						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3092							switch (parseInt(multiplier_w[1])) {
3093								case (5):
3094								case (4):
3095								case (3):
3096									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3097									multiplier_w[1] = 6;
3098									break;
3099								case (2):
3100								case (1):
3101									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
3102									multiplier_w[1] = 3;
3103									break;
3104								default:
3105									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3106									multiplier_w[1] = 12;
3107									break;
3108							}
3109
3110							if (multiplier_w[1] == 2.4) { // 5 columns
3111								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3112								multiplier_w[1] = 6;
3113							}
3114						}
3115					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
3116						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3117							switch (parseInt(multiplier_w[1])) {
3118								case (5):
3119								case (4):
3120								case (3):
3121								case (2):
3122								case (1):
3123									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3124									multiplier_w[1] = 6;
3125									break;
3126								default:
3127									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3128									multiplier_w[1] = 12;
3129									break;
3130							}
3131
3132							if (multiplier_w[1] == 2.4) { // 5 columns
3133								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3134								multiplier_w[1] = 6;
3135							}
3136						}
3137					} else if (widthAvailable < screenSmArray[index]) {
3138						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3139							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3140							multiplier_w[1] = 12;
3141							if (typeGridArray[index]) multiplier_h[1] = 12;
3142						}
3143					}
3144					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
3145						height;
3146
3147					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
3148						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
3149						if ( widthAvailable < screenSmArray[index] ) {
3150							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
3151						}
3152					} else {
3153						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
3154					}
3155
3156					if (width >= widthAvailable) {
3157						$item.css({
3158							width: widthAvailable
3159						});
3160						if (typeGridArray[index]) {
3161							$item.children().add($item.find('.backimg')).css({
3162								height: height
3163							});
3164						}
3165					} else {
3166						$item.css({
3167							width: width
3168						});
3169						if (typeGridArray[index]) {
3170							$item.children().add($item.find('.backimg')).css({
3171								height: height
3172							});
3173						}
3174					}
3175				}
3176				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
3177					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
3178				} else {
3179					return columnWidth;
3180				}
3181			},
3182			init_isotope = function() {
3183				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
3184					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
3185						isotopeId = isotopeSystem.attr('id'),
3186						$layoutMode = layoutGridArray[i],
3187						setIsotopeFirstRowTimeOut,
3188					setIsotopeFirstRow = function(items){
3189						var firstRow = true;
3190						$(items).each(function(index, val){
3191							var el = items[index].element,
3192								el_top = items[index].position.y,
3193								$el = $(el);
3194							if ( index > 0 && el_top > 0 && firstRow ) {
3195								firstRow = false;
3196							} else if ( index == 0 && el_top == 0 ) {
3197								firstRow = true;
3198							}
3199							if ( firstRow ) {
3200								$el.removeClass('tmb-isotope-further-row');
3201							} else {
3202								$el.addClass('tmb-isotope-further-row');
3203							}
3204						});
3205					};
3206					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
3207						//resizable: true,
3208						itemSelector: $itemSelector,
3209						layoutMode: $layoutMode,
3210						transitionDuration: transitionDuration[i],
3211						masonry: {
3212							columnWidth: colWidth(i)
3213						},
3214						vertical: {
3215							horizontalAlignment: 0.5,
3216						},
3217						sortBy: 'original-order',
3218						isOriginLeft: isOriginLeft
3219					})
3220					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
3221					.on('layoutComplete', function( event, items ){
3222						if ( typeof items[0] !== 'undefined' ) {
3223							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3224								setIsotopeFirstRow(items);
3225							}
3226						}
3227					})
3228					.on('arrangeComplete', function( event, items ){
3229						if ( typeof items[0] !== 'undefined' ) {
3230							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3231								clearRequestTimeout(setIsotopeFirstRowTimeOut);
3232								setIsotopeFirstRowTimeOut = requestTimeout(function(){
3233									setIsotopeFirstRow(items);
3234								}, 100);
3235							}
3236						}
3237					});
3238					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
3239						$(isotopeContainersArray[i]).infinitescroll({
3240								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
3241								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
3242								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
3243								animate: false,
3244								behavior: 'local',
3245								debug: false,
3246								loading: {
3247									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
3248									speed: 0,
3249									finished: undefined,
3250									msg: $('#' + isotopeId + ' .loadmore-button'),
3251								},
3252								errorCallback: function() {
3253									var isotope_system = $(this).closest('.isotope-system');
3254									$('.loading-button', isotope_system).hide();
3255									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
3256								}
3257							},
3258							// append the new items to isotope on the infinitescroll callback function.
3259							function(newElements, opts) {
3260								var $isotope = $(this),
3261									isotope_system = $isotope.closest('.isotope-system'),
3262									isotopeId = isotope_system.attr('id'),
3263									filters = new Array(),
3264									$loading_button = isotope_system.find('.loading-button'),
3265									$infinite_button = isotope_system.find('.loadmore-button'),
3266									$numPages = $('a', $infinite_button).data('pages'),
3267									$woo_results,
3268									delay = 300;
3269								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
3270								$infinite_button.show();
3271								$loading_button.hide();
3272								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
3273								$('> li', $isotope).remove();
3274								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
3275								$.each($(newElements), function (index, val) {
3276									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
3277										$woo_results = $(val);
3278										delete newElements[index];
3279									} else {
3280										$(val).addClass('tmb-iso');
3281										if ($(val).is("li")) {
3282											filters.push($(val)[0]);
3283										}
3284									}
3285									$(val).addClass('uncode-appended');
3286								});
3287								newElements = newElements.filter(function(x) {
3288									return filters.indexOf(x) < 0
3289								});
3290								$.each($(filters), function(index, val) {
3291									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
3292								});
3293								if ($woo_results && $woo_results.length > 0) {
3294									var old_count = isotope_system.find('.woocommerce-result-count').text();
3295									var new_count = $woo_results.find('.woocommerce-result-count').text();
3296									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
3297									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
3298									function replaceMatch(match, p1, p2) {
3299        								return old_start + '–' + new_end;
3300									}
3301									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
3302									isotope_system.find('.woocommerce-result-count').text(new_count_text);
3303								}
3304								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
3305								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3306									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
3307									if (typeof getLightbox === 'object') {
3308										getLightbox.refresh();
3309									} else {
3310										UNCODE.lightbox();
3311									}
3312								}
3313								if ( typeof twttr !== 'undefined' )
3314									twttr.widgets.load(isotopeContainersArray[i]);
3315
3316								requestTimeout(function() {
3317									Waypoint.refreshAll();
3318									$isotope.trigger('more-items-loaded');
3319									$(window).trigger('more-items-loaded');
3320									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3321									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3322										$(document).trigger('uncode-scrolltrigger-refresh');
3323									}
3324								}, 1000);
3325
3326							});
3327						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
3328							var $infinite_isotope = $(isotopeContainersArray[i]),
3329								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
3330							$infinite_isotope.infinitescroll('pause');
3331							$infinite_button.on('click', function(event) {
3332								event.preventDefault();
3333								var $infinite_system = $(event.target).closest('.isotope-system'),
3334								$infinite_isotope = $infinite_system.find('.isotope-container'),
3335								isotopeId = $infinite_system.attr('id');
3336								$(event.currentTarget).html(SiteParameters.loading);
3337								$infinite_isotope.infinitescroll('resume');
3338								$infinite_isotope.infinitescroll('retrieve');
3339								$infinite_isotope.infinitescroll('pause');
3340							});
3341						}
3342					}
3343				}
3344			},
3345			onLayout = function(isotopeObj, startIndex, needsReload) {
3346				var needsReload = needsReload ? true : false;
3347
3348				if (typeof UNCODE.bigText !== 'undefined') {
3349					UNCODE.bigText();
3350				}
3351				isotopeObj.css('opacity', 1);
3352				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
3353
3354				requestTimeout(function() {
3355					if (startIndex > 0) {
3356						reloadIsotope(isotopeObj);
3357						if (SiteParameters.dynamic_srcset_active === '1') {
3358							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3359							UNCODE.adaptive_srcset(isotopeObj);
3360						}
3361						// window.dispatchEvent(UNCODE.boxEvent);
3362					} else if (needsReload) {
3363						reloadIsotope(isotopeObj);
3364					}
3365
3366					UNCODE.adaptive();
3367					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
3368						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3369					}
3370					if (typeof MediaElement === "function") {
3371						$(isotopeObj).find('audio,video').each(function() {
3372							$(this).mediaelementplayer({
3373	 							pauseOtherPlayers: false,
3374							});
3375						});
3376					}
3377					if ($(isotopeObj).find('.nested-carousel').length) {
3378						if (typeof UNCODE.carousel !== 'undefined') {
3379							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
3380						}
3381						requestTimeout(function() {
3382							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3383						}, 200);
3384					} else {
3385						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3386					}
3387					isotopeObj.trigger('isotope-layout-complete');
3388
3389				}, 100);
3390
3391			},
3392			boxAnimation = function(items, startIndex, sequential, container) {
3393				var $allItems = items.length - startIndex,
3394					showed = 0,
3395					index = 0;
3396				if (container.closest('.owl-item').length == 1) return false;
3397				$.each(items, function(index, val) {
3398					var $this = $(val),
3399						elInner = $('> .t-inside', val);
3400					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3401						return;
3402					}
3403					if (val[0]) val = val[0];
3404					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
3405						new Waypoint({
3406							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3407							element: val,
3408							handler: function() {
3409								var element = $('> .t-inside', this.element),
3410									parent = $(this.element),
3411									currentIndex = parent.index();
3412								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
3413									delayAttr = parseInt(element.attr('data-delay'));
3414								if (isNaN(delayAttr)) delayAttr = 100;
3415								delay -= showed;
3416								var objTimeout = requestTimeout(function() {
3417									element.removeClass('zoom-reverse').addClass('start_animation');
3418									showed = parent.index();
3419									if ( container.data('isotope') ) {
3420										container.isotope('layout');
3421									}
3422								}, delay * delayAttr)
3423								parent.data('objTimeout', objTimeout);
3424								if (!UNCODE.isUnmodalOpen) {
3425									this.destroy();
3426								}
3427							},
3428							offset: '100%'
3429						})
3430					} else {
3431						if (elInner.hasClass('force-anim')) {
3432							elInner.addClass('start_animation');
3433						} else {
3434							elInner.css('opacity', 1);
3435						}
3436						container.isotope('layout');
3437					}
3438
3439					index++;
3440				});
3441			},
3442			reloadIsotope = function(isotopeObj) {
3443				var isoIndex = $(isotopeObj).attr('data-iso-index');
3444				var $layoutMode = ($(isotopeObj).data('layout'));
3445				if ($layoutMode === undefined) {
3446					$layoutMode = 'masonry';
3447				}
3448				if (isotopeObj.data('isotope')) {
3449					isotopeObj.isotope({
3450						itemSelector: $itemSelector,
3451						layoutMode: $layoutMode,
3452						transitionDuration: transitionDuration[isoIndex],
3453						masonry: {
3454							columnWidth: colWidth(isoIndex)
3455						},
3456						vertical: {
3457							horizontalAlignment: 0.5,
3458						},
3459						sortBy: 'original-order',
3460						isOriginLeft: isOriginLeft
3461					});
3462				}
3463			}
3464			;
3465		if ($('.isotope-pagination').length > 0) {
3466			$('.isotope-system').on('click', '.pagination a', function(evt) {
3467				evt.preventDefault();
3468
3469				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3470					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3471						container = $(this).closest('.isotope-system'),
3472						pagination_disable_scroll = container.attr('data-pagination-scroll'),
3473						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3474					calc_scroll -= UNCODE.get_scroll_offset();
3475
3476					if ( pagination_disable_scroll !== 'disabled' ) {
3477						var menu_container = $('.menu-sticky');
3478						var menu = menu_container.find('.menu-container');
3479
3480						if (menu_container.length > 0 && menu.length > 0) {
3481							calc_scroll = calc_scroll - menu.outerHeight();
3482						}
3483
3484						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3485							delta = bodyTop - calc_scroll,
3486							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3487						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3488
3489						if (!UNCODE.isFullPage) {
3490							if (scrollSpeed == 0) {
3491								$('html, body').scrollTop(calc_scroll);
3492							} else {
3493								$('html, body').animate({
3494									scrollTop: calc_scroll
3495								}, {
3496									easing: 'easeInOutQuad',
3497									duration: scrollSpeed,
3498									complete: function () {
3499										UNCODE.scrolling = false;
3500									}
3501								});
3502							}
3503						}
3504					}
3505				}
3506
3507				loadIsotope($(this), true);
3508			});
3509		}
3510		$filters.on('click', 'a.isotope-nav-link', function(evt) {
3511			if ($(this).hasClass('no-isotope-filter')) {
3512				return;
3513			}
3514			var $filter = $(this),
3515				filterContainer = $filter.closest('.isotope-filters'),
3516				filterValue = $filter.attr('data-filter'),
3517				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
3518				transitionDuration = container.data().isotope.options.transitionDuration,
3519				delay = 300,
3520				filterItems = [];
3521
3522			var filter_items = function(){
3523				if (filterValue !== undefined) {
3524					container.addClass('grid-filtering');
3525					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3526						var parent = $(val).parent(),
3527							objTimeout = parent.data('objTimeout');
3528						if (objTimeout) {
3529							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3530							clearRequestTimeout(objTimeout);
3531						}
3532						if (transitionDuration == 0) {
3533							if ($(val).hasClass('animate_when_almost_visible')) {
3534								$(val).addClass('zoom-reverse').removeClass('start_animation');
3535							} else {
3536								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3537							}
3538						}
3539					});
3540					requestTimeout(function(){
3541						if ( filterValue == '*' ) {
3542							container.removeClass('isotope-filtered');
3543						} else {
3544							container.addClass('isotope-filtered');
3545						}
3546						container.isotope({
3547							filter: function() {
3548								var block = $(this),
3549								filterable = (filterValue == '*') || block.hasClass(filterValue),
3550								lightboxElements = $('[data-lbox^=ilightbox]', block);
3551								if (filterable) {
3552									if (lightboxElements.length) {
3553										lightboxElements.removeClass('lb-disabled');
3554										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3555									}
3556									filterItems.push(block);
3557								} else {
3558									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3559								}
3560								container.trigger('more-items-loaded');
3561								$(window).trigger('more-items-loaded');
3562								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3563								return filterable;
3564							}
3565						});
3566						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3567
3568					}, delay);
3569
3570					/** once filtered - start **/
3571					container.isotope('once', 'arrangeComplete', function() {
3572						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3573							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3574							if (typeof getLightbox === 'object') {
3575								getLightbox.refresh();
3576							} else {
3577								UNCODE.lightbox();
3578							}
3579						}
3580						if (transitionDuration == 0) {
3581							requestTimeout(function() {
3582								boxAnimation(filterItems, 0, false, container);
3583							}, 100);
3584						}
3585						requestTimeout(function() {
3586							Waypoint.refreshAll();
3587							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3588								$(document).trigger('uncode-scrolltrigger-refresh');
3589							}
3590							container.removeClass('grid-filtering');
3591						}, 2000);
3592					});
3593					/** once filtered - end **/
3594				} else {
3595					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3596						$.each(UNCODE.lightboxArray, function(index, val) {
3597							UNCODE.lightboxArray[index].destroy();
3598						});
3599					}
3600					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3601						var parent = $(val).parent(),
3602							objTimeout = parent.data('objTimeout');
3603						if (objTimeout) {
3604							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3605							clearRequestTimeout(objTimeout);
3606						}
3607						if (transitionDuration == 0) {
3608							if ($(val).hasClass('animate_when_almost_visible')) {
3609								$(val).addClass('zoom-reverse').removeClass('start_animation');
3610							} else {
3611								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3612							}
3613						}
3614					});
3615					container.parent().addClass('grid-loading');
3616					loadIsotope($filter);
3617				}
3618			};
3619
3620			if (!$filter.hasClass('active')) {
3621				/** Scroll top with filtering */
3622				if (filterContainer.hasClass('filter-scroll')) {
3623                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3624                    calc_scroll -= UNCODE.get_scroll_offset();
3625
3626					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3627						delta = bodyTop - calc_scroll,
3628						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3629						filterTolerance = false,
3630						filter_timeout;
3631					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3632
3633					if ( !UNCODE.isFullPage ) {
3634						if (scrollSpeed == 0) {
3635							$('html, body').scrollTop(calc_scroll);
3636							UNCODE.scrolling = false;
3637							filter_items();
3638						} else {
3639
3640							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3641								filter_items();
3642								filterTolerance = true;
3643							}
3644
3645							$('html, body').animate({
3646								scrollTop: calc_scroll
3647							},{
3648								easing: 'easeInOutQuad',
3649								duration: scrollSpeed,
3650								complete: function(){
3651									UNCODE.scrolling = false;
3652									if ( !filterTolerance ) {
3653										filter_timeout = setTimeout(function(){
3654											clearTimeout(filter_timeout);
3655											filter_items();
3656										}, 200);
3657									}
3658								}
3659							});
3660						}
3661					}
3662				} else {
3663					filter_items();
3664				}
3665			}
3666			evt.preventDefault();
3667		});
3668
3669		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3670			var params = UNCODE.getURLParams(window.location);
3671			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3672
3673			UNCODE.lastURL = window.location.href;
3674
3675			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
3676				return;
3677			}
3678
3679			if (params.id === undefined) {
3680				$.each($('.isotope-system'), function(index, val) {
3681					loadIsotope($(val));
3682				});
3683			} else {
3684				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3685					loadIsotope($('#' + params.id));
3686				}
3687			}
3688		});
3689
3690		var loadIsotope = function($href, $paginating) {
3691			var is_paginating = false;
3692
3693			if (undefined !== $paginating && $paginating) {
3694				var is_paginating = $paginating;
3695			}
3696
3697			var href = ($href.is("a") ? $href.attr('href') : location),
3698				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3699				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3700				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3701				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3702				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3703				isotopeId = isotopeSystem.attr('id');
3704			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3705				UNCODE.lastURL = href;
3706				history.pushState({
3707					myIsotope: true
3708				}, document.title, href);
3709			}
3710			if (is_paginating) {
3711				isotopeWrapper.addClass('grid-filtering');
3712			}
3713			$.ajax({
3714				url: href
3715			}).done(function(data) {
3716				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3717					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3718					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3719				isotopeWrapper.addClass('isotope-reloaded');
3720				requestTimeout(function() {
3721					isotopeWrapper.removeClass('grid-loading');
3722					isotopeWrapper.removeClass('isotope-reloaded');
3723					isotopeWrapper.removeClass('grid-filtering');
3724				}, 500);
3725				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3726					var parent = $(val).parent(),
3727						objTimeout = parent.data('objTimeout');
3728					if (objTimeout) {
3729						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3730						clearRequestTimeout(objTimeout);
3731					}
3732					if ($(val).hasClass('animate_when_almost_visible')) {
3733						$(val).addClass('zoom-reverse').removeClass('start_animation');
3734					} else {
3735						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3736					}
3737				});
3738				requestTimeout(function() {
3739					if (isotopeContainer.data('isotope')) {
3740						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3741						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3742						UNCODE.adaptive();
3743						if (SiteParameters.dynamic_srcset_active === '1') {
3744							UNCODE.adaptive_srcset(isotopeContainer);
3745						}
3746						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3747							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3748							if (typeof getLightbox === 'object') {
3749								getLightbox.refresh();
3750							} else {
3751								UNCODE.lightbox();
3752							}
3753						}
3754					}
3755					isotopeContainer.trigger('more-items-loaded');
3756					$(window).trigger('more-items-loaded');
3757					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3758				}, 300);
3759				$('.pagination', isotopeFooter).remove();
3760				isotopeFooter.append($resultPagination);
3761
3762				if (isotopeResultCount.length > 0) {
3763					$('.woocommerce-result-count', isotopeResultCount).remove();
3764					isotopeResultCount.append($resultCount);
3765				}
3766			});
3767		};
3768		$filters.each(function(i, buttonGroup) {
3769			var $buttonGroup = $(buttonGroup);
3770			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3771				$buttonGroup.find('.active').removeClass('active');
3772				$(this).addClass('active');
3773
3774			});
3775
3776			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3777				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3778				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3779			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3780				e.preventDefault();
3781				$cats_filters.slideToggle(400, 'easeInOutCirc');
3782			});
3783
3784		});
3785		window.addEventListener('boxResized', function(e) {
3786			if (UNCODE.printDialogOpen !== false) {
3787				return false;
3788			}
3789			$.each($('.isotope-layout'), function(index, val) {
3790				var $layoutMode = ($(this).data('layout'));
3791				if ($layoutMode === undefined) $layoutMode = 'masonry';
3792				if ($(this).data('isotope')) {
3793					$(this).isotope({
3794						itemSelector: $itemSelector,
3795						layoutMode: $layoutMode,
3796						transitionDuration: transitionDuration[index],
3797						masonry: {
3798							columnWidth: colWidth(index)
3799						},
3800						vertical: {
3801							horizontalAlignment: 0.5,
3802						},
3803						sortBy: 'original-order',
3804						isOriginLeft: isOriginLeft
3805					});
3806					$(this).isotope('unbindResize');
3807					if (SiteParameters.dynamic_srcset_active === '1') {
3808						UNCODE.refresh_dynamic_srcset_size($(this));
3809					}
3810				}
3811				$(this).find('.mejs-video,.mejs-audio').each(function() {
3812					$(this).trigger('resize');
3813				});
3814			});
3815		}, false);
3816
3817		init_isotope();
3818	};
3819}
3820
3821UNCODE.lightbox = function() {
3822	if ( SiteParameters.lbox_enhanced ) {
3823		return true;
3824	}
3825	UNCODE.lightboxArray = {};
3826	requestTimeout(function() {
3827		var groupsArr = {};
3828		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3829			var group = this.getAttribute("data-lbox"),
3830				values = $(this).data();
3831			$(this).attr('data-lbox-init','true')
3832			groupsArr[group] = values;
3833		});
3834		for (var i in groupsArr) {
3835			var skin = groupsArr[i].skin || 'black',
3836				path = groupsArr[i].dir || 'horizontal',
3837				thumbs = !groupsArr[i].notmb || false,
3838				arrows = !groupsArr[i].noarr || false,
3839				social = groupsArr[i].social || false,
3840				deeplink = groupsArr[i].deep || false,
3841				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3842				counter = $els.length,
3843				dataAlbum = $els.attr('data-album');
3844			if (social) social = {
3845				facebook: true,
3846				twitter: true,
3847				reddit: true,
3848				digg: true
3849			};
3850			UNCODE.lightboxArray[i] = $els.iLightBox({
3851				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3852				skin: skin,
3853				path: path,
3854				linkId: deeplink,
3855				infinite: false,
3856				//fullViewPort: 'fit',
3857				smartRecognition: false,
3858				fullAlone: true,
3859				maxScale: 1,
3860				minScale: .02,
3861				//fullStretchTypes: 'flash, video',
3862				overlay: {
3863					opacity: .94
3864				},
3865				controls: {
3866					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3867					fullscreen: true,
3868					thumbnail: thumbs,
3869					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3870				},
3871				show: {
3872					speed: 200
3873				},
3874				hide: {
3875					speed: 200
3876				},
3877				social: {
3878					start: false,
3879					buttons: social
3880				},
3881				caption: {
3882					start: false
3883				},
3884				styles: {
3885					nextOpacity: 1,
3886					nextScale: 1,
3887					prevOpacity: 1,
3888					prevScale: 1
3889				},
3890				effects: {
3891					switchSpeed: 400
3892				},
3893				slideshow: {
3894					pauseTime: 5000
3895				},
3896				thumbnails: {
3897					maxWidth: 60,
3898					maxHeight: 60,
3899					activeOpacity: .2
3900				},
3901				html5video: {
3902					preload: true
3903				},
3904				callback: {
3905					onOpen: function(){
3906						$(window).trigger('uncode-custom-cursor');
3907						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3908							iNoBounce.enable();
3909						}
3910					},
3911					onHide: function(){
3912						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3913							iNoBounce.disable()
3914						}
3915					},
3916				}
3917			});
3918
3919			$(document).on('infinite-loaded', function(){
3920				UNCODE.lightboxArray[i].refresh();
3921			});
3922
3923			$(window).on('gdprOpen', function(){
3924				UNCODE.lightboxArray[i].close();
3925			});
3926		};
3927	}, 100);
3928
3929	$(document).on('click', '.lb-disabled', function(e){
3930		e.preventDefault();
3931	});
3932};
3933
3934UNCODE.lightgallery = function( $el ) {
3935	var createSelectors = function(){
3936		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
3937			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3938				$(this).addClass('lbox-trigger-item');
3939			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3940				$(this).addClass('lbox-nested-item');
3941			} else {
3942				$(this).removeClass('lbox-trigger-item');
3943				$(this).removeClass('lbox-nested-item');
3944			}
3945		});
3946	};
3947
3948	createSelectors();
3949
3950	var galleries = [],
3951		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3952			return !$(this).closest('.nested-carousel').length;
3953		}),
3954		$_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 *'), 
3955		$galleries = $_galleries.filter(function( index ) {
3956			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3957		}),
3958		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3959
3960	if ( typeof $el === 'undefined' ) {
3961		$el = $galleries.add( $nested );
3962	}
3963
3964	var $disabled = $('a.lb-disabled');
3965	$disabled.on('click', function(e){
3966		e.preventDefault();
3967	});
3968
3969	var beforeSlide = function(event) {
3970		var detail = event.detail,
3971			info = detail.info,
3972			item = detail.item,
3973			$slide = $(detail.currentSlide.selector),
3974			$video = $('video', $slide),
3975			$previous = $(detail.previousSlide.selector),
3976			$prevVideo = $('video', $previous),
3977			isAudio = false;
3978
3979		if ( typeof info.src !== 'undefined' ) {
3980			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3981		}
3982
3983		if ( ! $video.length && ( info.video || isAudio ) ) {
3984			if ( info.video ) {
3985				if ( typeof info.video === 'object' ) {
3986					var infoJson = info.video;
3987				} else {
3988					var infoJson = JSON.parse(info.video);
3989				}
3990				var src = infoJson.source[0].src,
3991					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3992					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3993					loop = $(item).attr('data-loop');
3994
3995			} else if ( isAudio ) {
3996				var src = info.src,
3997					autoplay = true,
3998					loop = false;
3999			}
4000			if ( typeof src !== 'undefined' ) {
4001				$slide.addClass('has-html5');
4002				var video = document.createElement('video');
4003				video.src = src;
4004				video.preload = 'auto';
4005				video.controls = 'controls';
4006				video.controlsList = 'nodownload';
4007				if ( autoplay ) {
4008					video.autoplay = 'autoplay';
4009				}
4010				if ( muted ) {
4011					video.muted = 'muted';
4012				}
4013				if ( loop ) {
4014					video.loop = 'loop';
4015				}
4016				$(video).appendTo($slide);
4017			}
4018		} else {
4019			var $video = $('video', $slide);
4020			if ( $video.length ) {
4021				$video[0].currentTime = 0;
4022				if ( $video[0].autoplay ) {
4023					$video[0].play();
4024				}
4025			}
4026		}
4027		if ( $prevVideo.length ) {
4028			$prevVideo[0].currentTime = 0;
4029			$prevVideo[0].pause();
4030		}
4031	};
4032
4033	var beforeOpen = function(event) {
4034		var detail = event.detail,
4035			items = detail.items,
4036			galleryItems = detail.galleryItems,
4037			outer = detail.outer.selector,
4038			i, ii;
4039		for ( i = 0; i < galleryItems.length; i++ ) {
4040			var item = galleryItems[i];
4041			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
4042				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
4043			}
4044		}
4045		for ( ii = 0; ii < items.length; ii++ ) {
4046			var item = items[ii];
4047			if ( $(item).attr('data-icon') === 'video' ) {
4048				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
4049			}
4050		}
4051
4052	};
4053
4054	//caption builder
4055	var captionBuilder = function($el){
4056		$el.each( function( index, val ) {
4057			var $gallery = $(this).attr('data-lbox-init','true'),
4058				$_a = '.lbox-trigger-item',
4059				$_nested_a = '.lbox-nested-item';
4060
4061			$gallery.find($_a).add($_nested_a).each(function(){
4062				var $a = $(this),
4063					$img = $('img', $a).first(),
4064					imgw = $img.attr('data-width'),
4065					imgh = $img.attr('data-height'),
4066					caption = $a.attr('data-caption'),
4067					title = $a.attr('data-title');
4068
4069				if ( $img.length && $img.attr('data-crop') != true ) {
4070					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
4071						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
4072					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
4073						$a.attr('data-external-thumb-image', $img[0].src);
4074					}
4075				}
4076
4077				if ( typeof title !== 'undefined' && title !== '' ) {
4078					title = '<h6>' + title + '</h6>';
4079				} else {
4080					title = '';
4081				}
4082
4083				if ( typeof caption !== 'undefined' && caption !== '' ) {
4084					caption = '<p>' + caption + '</p>';
4085					title += caption;
4086				}
4087
4088				if ( title !== '' ) {
4089					$a.attr( 'title', title );
4090				}
4091
4092				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') ) ) {
4093					$a.attr('data-lg-size', imgw + '-' + imgh);
4094				}
4095			});
4096		});
4097	};
4098	captionBuilder($el);
4099
4100	//regular galleries
4101	$el.each( function( index, val ) {
4102		var $gallery = $(this),
4103			$_a = '.lbox-trigger-item',
4104			$_nested_a = '.lbox-nested-item',
4105			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
4106			galleryID = $_first.attr('data-lbox'),
4107			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
4108			tmb = $_first.attr('data-notmb'),
4109			social = $_first.attr('data-social'),
4110			deep = $_first.attr('data-deep'),
4111			zoom = $_first.attr('data-zoom-origin'),
4112			actual = $_first.attr('data-actual-size'),
4113			download = $_first.attr('data-download'),
4114			controls = $_first.attr('data-arrows') !== 'no',
4115			fullScreen = $_first.attr('data-full'),
4116			counter = $_first.attr('data-counter'),
4117			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
4118			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4119			connect = $_first.attr('data-connect'),
4120			lgPlugins = [lgVideo],
4121			itemsLoadedTimeOut;
4122
4123		if ( typeof galleryID === 'undefined' ) {
4124			galleryID = $gallery.attr('id');
4125		}
4126
4127		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4128		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4129
4130		if ( typeof tmb == 'undefined' || !tmb ) {
4131			lgPlugins.push(lgThumbnail);
4132		}
4133		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
4134			lgPlugins.push(lgZoom);
4135		}
4136		if ( typeof deep != 'undefined' && deep != '' ) {
4137			lgPlugins.push(lgHash);
4138		}
4139		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4140			lgPlugins.push(lgFullscreen);
4141		}
4142		if ( social ) {
4143			lgPlugins.push(lgShare);
4144		}
4145
4146		if ( galleries.indexOf( galleryID ) !== -1 ) {
4147			return true;
4148		}
4149
4150		galleries.push( galleryID );
4151		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
4152			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
4153		var gallery = lightGallery( $triggerGal[0], {
4154			addClass: containerClass,
4155			plugins: lgPlugins,
4156			mode: transition,
4157			selector: $selector,
4158			galleryId: galleryID,
4159			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4160			iframeWidth: '848px',
4161			iframeMaxWidth: '90%',
4162			iframeMaxHeight: '90%',
4163			exThumbImage: 'data-external-thumb-image',
4164			loadYouTubeThumbnail: false,
4165			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' || $gallery.closest('[data-lb-autoplay=yes]').length ),
4166			// autoplayFirstVideo: false,
4167			pager: false,
4168			startClass: 'lg-start-opacity',
4169			zoomFromOrigin: zoom,
4170			controls: controls,
4171			download: ( typeof download != 'undefined' && download != '' ),
4172			thumbWidth: 50,
4173			thumbHeight: '50px',
4174			counter: $triggerGal.find($selector).length > 1 ? counter : false,
4175			loadYouTubePoster: false,
4176			enableDrag: $triggerGal.find($selector).length > 1,
4177			mobileSettings: {
4178				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4179			},
4180		});
4181
4182		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
4183			e.preventDefault();
4184			var index = $(this).closest('.owl-item.cloned').attr('data-index');
4185			gallery.openGallery(index-1);
4186		});
4187
4188		$gallery.on('uncode-gallery-trigger', function(){
4189			gallery.openGallery(0);
4190		});
4191
4192		$triggerGal.on('more-items-loaded', function(e, items) {
4193			clearRequestTimeout(itemsLoadedTimeOut);
4194			itemsLoadedTimeOut = requestTimeout(function(){
4195				createSelectors();
4196				captionBuilder($triggerGal);
4197				gallery.refresh();
4198			}, 100);
4199		});
4200
4201		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4202			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4203				$el = model.view.$el;
4204				if ( $el.find($triggerGal).length ) {
4205					gallery.destroy();
4206				}
4207			});
4208		}
4209
4210		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
4211		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
4212		$triggerGal[0].addEventListener('lgAfterOpen', function(){
4213			$(window).trigger('uncode-custom-cursor');
4214		});
4215
4216	});
4217
4218	if ( typeof $el !== 'undefined' ) {
4219
4220		//album galleries
4221		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
4222			var album = val,
4223				galleryID = index,
4224				$album = $(album),
4225				params = $album.attr('data-album'),
4226				tmb = $(val).attr('data-notmb'),
4227				social = $(val).attr('data-social'),
4228				deep = $(val).attr('data-deep'),
4229				actual = $(val).attr('data-actual-size'),
4230				download = $(val).attr('data-download'),
4231				controls = $(val).attr('data-arrows') !== 'no',
4232				fullScreen = $(val).attr('data-full'),
4233				counter = $(val).attr('data-counter'),
4234				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
4235				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4236				lgPlugins = [lgVideo];
4237
4238			$(val).attr('data-lbox-init','true');
4239
4240			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4241			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4242
4243			if ( typeof tmb == 'undefined' || !tmb ) {
4244				lgPlugins.push(lgThumbnail);
4245			}
4246			if ( typeof actual != 'undefined' && actual != '' ) {
4247				lgPlugins.push(lgZoom);
4248			}
4249			if ( typeof deep != 'undefined' && deep != '' ) {
4250				lgPlugins.push(lgHash);
4251			}
4252			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4253				lgPlugins.push(lgFullscreen);
4254			}
4255			if ( social ) {
4256				lgPlugins.push(lgShare);
4257			}
4258
4259			var gallery = window.lightGallery(album, {
4260				dynamic: true,
4261				plugins: lgPlugins,
4262				dynamicEl: JSON.parse(params),
4263				galleryId: galleryID,
4264				addClass: containerClass,
4265				mode: transition,
4266				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4267				iframeWidth: '848px',
4268				iframeMaxWidth: '90%',
4269				iframeMaxHeight: '90%',
4270				loadYouTubeThumbnail: false,
4271				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
4272				// autoplayFirstVideo: false,
4273				pager: false,
4274				startClass: 'lg-start-opacity',
4275				zoomFromOrigin: false,
4276				controls: controls,
4277				download: ( typeof download != 'undefined' && download != '' ),
4278				thumbWidth: 50,
4279				thumbHeight: '50px',
4280				loadYouTubePoster: false,
4281				counter: counter,
4282				exThumbImage: 'data-external-thumb-image',
4283				loadYouTubePoster: false,
4284				mobileSettings: {
4285					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4286				},
4287			});
4288
4289			$album.on('click', function(){
4290				gallery.openGallery(0);
4291			});
4292
4293			album.addEventListener('lgBeforeSlide', beforeSlide);
4294			album.addEventListener('lgBeforeOpen', beforeOpen);
4295			album.addEventListener('lgAfterOpen', function(){
4296				$(window).trigger('uncode-custom-cursor');
4297			});
4298
4299			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4300				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4301					$el = model.view.$el;
4302					if ( $el.find($album).length ) {
4303						gallery.destroy();
4304					}
4305				});
4306			}
4307
4308		});
4309
4310		//single images
4311		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
4312			var gallery = lightGallery( $('.page-wrapper')[0], {
4313				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
4314				iframeWidth: '848px',
4315				iframeMaxWidth: '90%',
4316				iframeMaxHeight: '90%',
4317				loadYouTubeThumbnail: false,
4318				// autoplayFirstVideo: false,
4319				startClass: 'lg-start-opacity',
4320				thumbWidth: 50,
4321				thumbHeight: '50px',
4322				download: false,
4323				loadYouTubePoster: false,
4324				counter: false
4325			});
4326
4327			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
4328			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
4329		});
4330	}
4331
4332	var galleryButtons = function(){
4333		var $buttons = $('.btn-gallery-trigger');
4334		$buttons.each(function(key, val){
4335			var $button = $(val),
4336				target = $button.attr('data-target'),
4337				$gallery = $('.un-media-gallery').first(),
4338				$row = $button.closest('.vc_row[data-parent]');
4339			if ( typeof target !== 'undefined' && target !== '' && $('.un-media-gallery#' + target).length  ) {
4340				$gallery = $('.un-media-gallery#' + target);
4341			} else if ( $('.un-media-gallery', $row).length ) {
4342				$gallery = $('.un-media-gallery', $row).first();
4343			}
4344			
4345			$button.on('click', 'a', function(e){
4346				e.preventDefault();
4347				$gallery.find('[data-lbox-init]').first().trigger('uncode-gallery-trigger');
4348			});
4349		});
4350	};
4351	galleryButtons();
4352};
4353
4354UNCODE.carousel = function(container) {
4355	var $owlContainers = $('.owl-carousel-container:not(.test-init)', container);
4356	$owlContainers.each(function() {
4357		var $owlContainer = $(this).addClass('test-init'),
4358			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
4359			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
4360			values = {},
4361			tempTimeStamp,
4362			newWidth = UNCODE.wwidth,
4363			$owlInsideEqual = [];
4364		$owlSelector.each(function() {
4365			var itemID = $(this).attr('id'),
4366				$elSelector = $(('#' + itemID).toString());
4367			values['id'] = itemID;
4368			values['items'] = 1;
4369			values['columns'] = 3;
4370			values['fade'] = false;
4371			values['nav'] = false;
4372			values['navmobile'] = false;
4373			values['navskin'] = 'light';
4374			values['navspeed'] = 400;
4375			values['dots'] = false;
4376			values['dotsmobile'] = false;
4377			values['loop'] = false;
4378			values['autoplay'] = false;
4379			values['timeout'] = 3000;
4380			values['autoheight'] = false;
4381			values['stagepadding'] = 0;
4382			values['margin'] = 0;
4383			values['lg'] = 1;
4384			values['md'] = 1;
4385			values['sm'] = 1;
4386			$.each($(this).data(), function(i, v) {
4387				values[i] = v;
4388			});
4389
4390			if ($(this).closest('.uncode-slider').length) {
4391				values['navskin'] = '';
4392				values['navmobile'] = false;
4393				//values['dotsmobile'] = true;
4394			} else {
4395				values['navskin'] = ' style-'+values['navskin']+' style-override';
4396			}
4397
4398			var setIndexActive = function(event, init){
4399				var init = typeof init === 'undefined' ? false : init,
4400					thiis = $(event.currentTarget);
4401				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
4402					var scrolltop = $(document).scrollTop(),
4403						size = event.page.size,
4404						i;
4405					var setIndex = requestTimeout(function() {
4406						for ( i = 0; i < size; i++ ) {
4407							var itemCont = event.item.index != null ? (event.item.index + i) : i;
4408							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
4409							if (thiis.closest('.row-slider').length) {
4410								if (currentItem == undefined) {
4411									currentItem = thiis.children()[i];
4412								}
4413								if ($(currentItem).closest('#page-header').length) {
4414									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4415										UNCODE.switchColorsMenu(scrolltop, 'dark');
4416									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4417										UNCODE.switchColorsMenu(scrolltop, 'light');
4418									}
4419								}
4420								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
4421								if (owlCustomNav.length) {
4422									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4423										owlCustomNav.addClass('style-dark').removeClass('style-light');
4424									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4425										owlCustomNav.addClass('style-light').removeClass('style-dark');
4426									}
4427								}
4428							}
4429							var itendIndex = $(currentItem).attr('data-index');
4430							if ( isNaN(itendIndex) ) {
4431								itendIndex = 1;
4432							}
4433							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
4434							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
4435							if ($.fn.counterUp) {
4436								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
4437									var $counter = $(this);
4438									$counter.addClass('started').counterUp({
4439										delay: 10,
4440										time: 1500
4441									});
4442								});
4443							}
4444						}
4445						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
4446					}, 200);
4447				}
4448				tempTimeStamp = event.timeStamp;
4449			}
4450
4451			/** Initialize */
4452			$elSelector.on('initialize.owl.carousel', function(event) {
4453				if (typeof UNCODE.owlNav !== 'undefined') {
4454					UNCODE.owlNav(itemID, event);
4455				}
4456
4457				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4458					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
4459						var shortcode = model.attributes.shortcode,
4460							$el = model.view.$el,
4461							$row_wrap = $el.closest('.row');
4462						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4463							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
4464						}
4465					});
4466					window.parent.vc.events.on('shortcodeView:updated', function(model) {
4467						var shortcode = model.attributes.shortcode;
4468						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4469							tempTimeStamp = Math.floor(Date.now() / 1000);
4470						}
4471					});
4472					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
4473						var shortcode = model.attributes.shortcode;
4474						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4475							UNCODE.owlNav(itemID, event);
4476							$elSelector.trigger('refresh.owl.carousel');
4477						}
4478					});
4479				}
4480				// if ( $elSelector.closest('.mega-menu-inner').length ) {
4481				// 	$elSelector.closest('.mega-menu-inner').css({
4482				// 		visibility: 'hidden',
4483				// 		display: 'block'
4484				// 	});
4485				// 	$elSelector.data('owl.carousel');
4486				// 	$elSelector.trigger('refresh.owl.carousel');
4487				// 	$elSelector.closest('.mega-menu-inner').css({
4488				// 		display: 'none',
4489				// 		visibility: '',
4490				// 	});
4491				// }
4492				// $elSelector.closest('[class*="menu-smart"]').on('show.smapi', function(e, p){
4493				// 	$elSelector.trigger("to.owl.carousel", 0);
4494				// });
4495			});
4496
4497			/** Initialized */
4498			$elSelector.on('initialized.owl.navigation', function(event) {
4499				$('.owl-dot', event.currentTarget).each(function(key, val){
4500					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4501				});
4502			});
4503
4504			$elSelector.on('initialized.owl.carousel', function(event) {
4505
4506				if ( $('.isotope-container', event.currentTarget).length ) {
4507					window.dispatchEvent(UNCODE.boxEvent);
4508				}
4509
4510				$('.owl-dot.active', $elSelector).on('click', function(){
4511					return false;
4512				});
4513
4514				var thiis = $(event.currentTarget),
4515					// get the time from the data method
4516					time = thiis.data("timer-id"),
4517					rowParent = thiis.closest('.row-parent');
4518
4519				if ( typeof rowParent[0] !== 'undefined' ) {
4520					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4521				}
4522
4523				if (time) {
4524					clearRequestTimeout(time);
4525				}
4526
4527				thiis.addClass('showControls');
4528				var new_time = requestTimeout(function() {
4529					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4530					if (thiis.hasClass('owl-height-viewport'))
4531						setItemsRelHeight(thiis);
4532					if (thiis.hasClass('owl-height-equal'))
4533						setItemsHeight(thiis);
4534					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4535					if (thiis.closest('.unequal, .unexpand').length) {
4536						UNCODE.setRowHeight(rowParent[0], true);
4537					}
4538					if (SiteParameters.dynamic_srcset_active === '1') {
4539						UNCODE.refresh_dynamic_srcset_size(thiis);
4540					}
4541				}, 350);
4542				// save the new time
4543				thiis.data("timer-id", new_time);
4544
4545				var scrolltop = $(document).scrollTop();
4546				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4547
4548				//if (!UNCODE.isMobile) {
4549					/** fix autoplay when visible **/
4550				$(window).on('load', function(){
4551					if (thiis.data('autoplay')) {
4552						if ( !thiis.closest('.sticky-element').length || thiis.closest('.un-submenu').length || thiis.closest('.overlay').length ) {
4553							thiis.trigger('stop.owl.autoplay');
4554						} else {
4555							thiis.trigger('play.owl.autoplay');
4556						}
4557					}
4558					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4559						return;
4560					}
4561					if ( ! thiis.closest('.sticky-element').length && ! thiis.closest('.un-submenu').length && ! thiis.closest('.overlay').length ) {
4562						var carouselInView = new Waypoint.Inview({
4563							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4564							element: thiis[0],
4565							exited: function() {
4566								var el = $(this.element);
4567								if (el.data('autoplay') ) {
4568									el.trigger('stop.owl.autoplay');
4569									el.data('stopped','true');
4570								}
4571							},
4572							enter: function(direction) {
4573								var el = $(this.element);
4574								requestTimeout(function() {
4575									if (el.data('autoplay')) {
4576										el.trigger('play.owl.autoplay');
4577										el.data('stopped','false');
4578									}
4579								}, 100);
4580							}
4581						});
4582					}
4583					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4584						setTimeout(function(){
4585							window.lenis.resize();
4586						}, 1000);
4587					}
4588			  	
4589				});
4590				//}
4591
4592				// $(window).on('frontend:carousel_updated', function(){
4593				// 	Waypoint.refreshAll();
4594				// });
4595
4596				if (!thiis.closest('.isotope-system').length && !thiis.closest('.megamenu-block-wrapper').length && !thiis.closest('.overlay').length) {
4597					requestTimeout(function() {
4598						animate_thumb($('.t-inside', el), event);
4599					}, 400);
4600				} 
4601				if (thiis.closest('.isotope-system').length ) {
4602					requestTimeout(function() {
4603						thiis.closest('.isotope-container').isotope('layout');
4604					}, 400);
4605				}
4606				if (thiis.closest('.megamenu-block-wrapper').length ) {
4607					$(document).on('un-menu-show', function(e, $ul){
4608						if ( thiis.closest($ul).length ) {
4609							animate_thumb($('.t-inside', el), event);
4610						}
4611					});
4612				}
4613				if (thiis.closest('.overlay').length ) {
4614					$(window).on('menuOpen', function(e, $ul){
4615						animate_thumb($('.t-inside', el), event);
4616					});
4617				}
4618
4619				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4620				currentIndex = $(currentItem).attr('data-index');
4621
4622				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4623					if ($(val).closest('.uncode-slider').length) {
4624						$(val).removeClass('start_animation');
4625					}
4626				});
4627				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4628					if ($(val).closest('.uncode-slider').length) {
4629						$(val).removeClass('already-animated');
4630					}
4631				});
4632
4633				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4634					if ($(val).closest('.uncode-slider').length) {
4635						$(val).removeAttr('data-animated');
4636					}
4637				});
4638
4639				$.each($('.owl-item.cloned', thiis), function(index, val) {
4640					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4641				});
4642
4643				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4644					if ($(val).attr('data-index') != currentIndex) {
4645						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4646						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4647					}
4648					if ($(val).attr('data-index') != currentIndex) {
4649						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4650					}
4651					if ($(val).attr('data-index') == currentIndex) {
4652						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4653					}
4654				});
4655
4656				if (thiis.closest('.uncode-slider').length) {
4657					var el = thiis.closest('.row-parent')[0],
4658						section = thiis.closest('.vc_section');
4659					if ( section.length ) {
4660						el = $('> .row-parent', section)[0];
4661					}
4662					if ($(el).data('imgready')) {
4663						firstLoaded(el, event);
4664					} else {
4665						el.addEventListener("imgLoaded", function(el) {
4666							firstLoaded(el.target, event);
4667						}, false);
4668					}
4669					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4670					if (transHeight != null) {
4671						requestTimeout(function() {
4672							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4673						}, 100);
4674					}
4675				} else {
4676					var el = thiis;
4677					el.closest('.uncode-slider').addClass('slider-loaded');
4678				}
4679
4680				requestTimeout(function() {
4681					if (typeof UNCODE.bigText !== 'undefined') {
4682						UNCODE.bigText(thiis);
4683					}
4684					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4685						if (thiis.data('autoplay')) pauseOnHover(thiis);
4686					}
4687				}, 500);
4688
4689				if (thiis.closest('.unequal').length) {
4690					$owlInsideEqual.push(thiis.closest('.row-parent'));
4691				}
4692
4693				var containerClasses = '',
4694					containerStyle = '';
4695				if ( $('.owl-dots-classes', $owlContainer).length ) {
4696					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4697					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4698					$('.owl-dots-classes', $owlContainer).remove();
4699				}
4700
4701				if ( containerClasses !== '' ) {
4702					requestTimeout(function() {
4703						if ( containerClasses !== '' )
4704							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4705						if ( containerStyle !== '' )
4706							$('.owl-dots', $owlContainer).addClass(containerClasses);
4707					}, 100);
4708				}
4709
4710				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4711					$(val).closest('.row-inner').css({
4712						'margin-top': '-1px'
4713					});
4714				});
4715
4716				if ($.fn.isotope) {
4717					if ( thiis.closest('.isotope-container').length ) {
4718						if (thiis.closest('.isotope-container').data('isotope')) {
4719							requestTimeout(function(){
4720								thiis.closest('.isotope-container').isotope('layout');
4721							}, 300);
4722						}
4723						$(window).on('load', function(){
4724							if (thiis.closest('.isotope-container').data('isotope')) {
4725								thiis.closest('.isotope-container').isotope('layout');
4726							}
4727						});
4728					}
4729				}
4730
4731				if (thiis.data('autoplay')) {
4732					$(window).on('menuOpen', function(){
4733						if ( thiis.closest('.overlay').length ) {
4734							thiis.trigger('play.owl.autoplay');
4735							thiis.data('stopped','false');
4736						} else {
4737							thiis.trigger('stop.owl.autoplay');
4738							thiis.data('stopped','true');
4739						}
4740					});
4741					$(window).on('menuClose', function(){
4742						if ( thiis.closest('.overlay').length ) {
4743							thiis.trigger('stop.owl.autoplay');
4744							thiis.data('stopped','true');
4745						} else {
4746							thiis.trigger('play.owl.autoplay');
4747							thiis.data('stopped','false');
4748						}
4749					});
4750				}
4751
4752				setIndexActive(event, true);
4753
4754				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4755						return !$(this).closest('.nested-carousel').length;
4756					}),
4757					$_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),
4758					$galleries = $_galleries.filter(function( index ) {
4759						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4760					});
4761
4762				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4763					UNCODE.lightgallery( $galleries );
4764				}
4765
4766				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4767					$(document).trigger('uncode-scrolltrigger-refresh');
4768				}
4769
4770				if (thiis.closest('.overlay').length && thiis.data('autoplay')) {
4771					thiis.trigger('stop.owl.autoplay');
4772					thiis.data('stopped','true');
4773				}
4774
4775				if (thiis.closest('.un-submenu').length && thiis.data('autoplay')) {
4776					thiis.trigger('stop.owl.autoplay');
4777					thiis.data('stopped','false');
4778					$(document).on('un-menu-show', function(){
4779						thiis.trigger('play.owl.autoplay');
4780						thiis.data('stopped','false');
4781					}).on('un-menu-hide', function(){
4782						thiis.trigger('stop.owl.autoplay');
4783						thiis.data('stopped','true');
4784					});
4785				}
4786			});
4787
4788			$elSelector.on('resized.owl.carousel', function(event) {
4789				$('.owl-dot', event.currentTarget).each(function(key, val){
4790					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4791				});
4792			});
4793
4794			$elSelector.on('resized.owl.carousel', function(event) {
4795				var thiis = $(event.currentTarget);
4796				// if ($(this).closest('.nested-carousel').length) {
4797				// 	requestTimeout(function() {
4798				// 		window.dispatchEvent(UNCODE.boxEvent);
4799				// 	}, 200);
4800				// }
4801				if ( thiis.hasClass('owl-height-equal') )
4802					setItemsHeight(thiis);
4803
4804				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4805					newWidth = UNCODE.wwidth;
4806					setItemsRelHeight($elSelector);
4807				}
4808
4809				setIndexActive(event);
4810
4811				if (SiteParameters.dynamic_srcset_active === '1') {
4812					UNCODE.refresh_dynamic_srcset_size(thiis);
4813				}
4814
4815				if ($.fn.isotope) {
4816					$(window).on('load', function(){
4817						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4818							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4819						}
4820					});
4821				}
4822
4823				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4824					setTimeout(function(){
4825						window.lenis.resize();
4826					}, 1000);
4827				}
4828				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4829					$(document).trigger('uncode-scrolltrigger-refresh');
4830				}
4831			});
4832
4833			$elSelector.on('refreshed.owl.carousel', function(event) {
4834				setIndexActive(event);
4835			});
4836
4837			/** detect resize window for fluid height layout */
4838			var setFluidResize;
4839			function manageFluidCarouseHeight() {
4840				clearRequestTimeout(setFluidResize);
4841				setFluidResize = requestTimeout(function(){
4842					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4843						newWidth = UNCODE.wwidth;
4844						setItemsRelHeight($elSelector);
4845					}
4846				}, 100);
4847			}
4848			window.addEventListener('resize', manageFluidCarouseHeight);
4849
4850			/** Change */
4851			$elSelector.on('change.owl.carousel', function(event) {
4852				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4853			});
4854
4855			/** Changed */
4856			$elSelector.on('changed.owl.carousel', function(event) {
4857				var $row = $elSelector.parents('.row')[0];
4858				if ( typeof $row !== 'undefined' ) {
4859					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4860				}
4861				setIndexActive(event);
4862			});
4863
4864			var checkDrag = function(e) {
4865				$elSelector.addClass('owl-dragging');
4866			};
4867			$elSelector.on('drag.owl.carousel', function(event) {
4868				document.addEventListener("mousemove", checkDrag);
4869			});
4870
4871			$elSelector.on('dragged.owl.carousel', function(event) {
4872				$elSelector.removeClass('owl-dragging');
4873				document.removeEventListener("mousemove", checkDrag);
4874			});
4875
4876			$elSelector.on('translate.owl.carousel', function(event) {
4877				if (UNCODE.isMobile) {
4878					$(event.currentTarget).addClass('owl-translating');
4879				}
4880			});
4881
4882			/** Translated */
4883			$elSelector.on('translated.owl.carousel', function(event) {
4884
4885				var thiis = $(event.currentTarget),
4886					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4887					currentIndex = $(currentItem).attr('data-index'),
4888					stagePadding = thiis.data('stagepadding');
4889
4890				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4891
4892				if (!UNCODE.isMobile) {
4893					UNCODE.owlPlayVideo(thiis);
4894				}
4895
4896				requestTimeout(function(){
4897					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4898					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4899					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4900						if (lastDelayElems == undefined) lastDelayElems = 0;
4901						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4902						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4903						thiis.trigger('stop.owl.autoplay');
4904						requestTimeout(function() {
4905							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4906						}, maxDelay);
4907					}
4908				}, 200);
4909
4910				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4911					if ($(val).closest('.uncode-slider').length) {
4912						$(val).removeClass('start_animation');
4913					}
4914				});
4915
4916				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4917					if ($(val).closest('.uncode-slider').length) {
4918						$(val).removeClass('already-animated');
4919					}
4920				});
4921
4922				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4923					if ($(val).closest('.uncode-slider').length) {
4924						$(val).removeAttr('data-animated');
4925					}
4926				});
4927
4928				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4929					if ($(val).attr('data-index') != currentIndex) {
4930						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4931						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4932					}
4933					if ($(val).attr('data-index') != currentIndex) {
4934						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4935					}
4936					if ($(val).attr('data-index') == currentIndex) {
4937						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4938					}
4939				});
4940
4941				if (UNCODE.isMobile) {
4942					thiis.removeClass('owl-translating');
4943				}
4944
4945				setIndexActive(event);
4946			});
4947
4948			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4949
4950			/** Init carousel */
4951			$elSelector.not('.showControls').owlCarousel({
4952				items: values['items'],
4953				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4954				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4955				nav: values['nav'],
4956				dots: values['dots'],
4957				loop: values['loop'],
4958				stagePadding: values['stagepadding'],
4959				margin: 0,
4960				video: true,
4961				autoWidth: false,
4962				autoplay: false,
4963				autoplayTimeout: values['timeout'],
4964				autoplaySpeed: values['navspeed'],
4965				autoplayHoverPause: $(this).closest('.uncode-slider').length || $(this).closest('.carousel-no-hover').length ? false : true,
4966				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4967				itemSelector: SiteParameters.uncode_carousel_itemSelector,
4968				rtl: $('body').hasClass('rtl') ? true : false,
4969				fluidSpeed: true,
4970				navSpeed: values['navspeed'],
4971				dotsSpeed: values['navspeed'] / values['items'],
4972				navElement: ['button type="button" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" aria-label="' + SiteParameters.uncode_next_label + '"'],
4973				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4974				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>'],
4975				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4976				responsiveClass: true,
4977				responsiveBaseElement: '.box-container',
4978				responsive: {
4979					0: {
4980						items: values['sm'],
4981						nav: values['navmobile'],
4982						dots: values['dotsmobile'],
4983						dotsSpeed: values['navspeed'] / values['sm'],
4984					},
4985					480: {
4986						items: values['sm'],
4987						nav: values['navmobile'],
4988						dots: values['dotsmobile'],
4989						dotsSpeed: values['navspeed'] / values['sm'],
4990					},
4991					570: {
4992						items: values['md'],
4993						nav: values['navmobile'],
4994						dots: values['dotsmobile'],
4995						dotsSpeed: values['navspeed'] / values['md'],
4996					},
4997					960: {
4998						items: values['lg'],
4999						dotsSpeed: values['navspeed'] / values['lg'],
5000					}
5001				}
5002			});
5003
5004			var transDuration = parseFloat(values['navspeed']) * 0.3;
5005			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
5006
5007			$('.owl-item .tmb', $elSelector).css({
5008				'-webkit-transition-delay': transDuration + 'ms',
5009				'-moz-transition-delay': transDuration + 'ms',
5010				'-o-transition-delay': transDuration + 'ms',
5011				'transition-delay': transDuration + 'ms',
5012				'-webkit-transition-duration': transDuration2 + 'ms',
5013				'-moz-transition-duration': transDuration2 + 'ms',
5014				'-o-transition-duration': transDuration2 + 'ms',
5015				'transition-duration': transDuration2 + 'ms',
5016			});
5017
5018			requestTimeout(function() {
5019				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5020					UNCODE.setRowHeight($owlInsideEqual[i]);
5021				};
5022			}, 300);
5023
5024			$(window).on('load', function(){
5025				var $elCarousel = $elSelector.data('owl.carousel');
5026				if ( typeof $elCarousel !== 'undefined' ) {
5027					$elCarousel.trigger('refreshed');
5028					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5029						UNCODE.setRowHeight($owlInsideEqual[i]);
5030					};
5031				}
5032			});
5033
5034			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
5035				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5036					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
5037					$('#' + carousel_id).find('.owl-item').each( function() {
5038						var $item = $(this),
5039							index = ( $item.index() + 1 );
5040						$item.attr('data-index', index);
5041					});
5042				}
5043			});
5044
5045			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5046				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
5047					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5048						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
5049						$('#' + carousel_id).find('.owl-item').each( function() {
5050							var $item = $(this),
5051								index = ( $item.index() + 1 );
5052							$item.attr('data-index', index);
5053						});
5054					}
5055				});
5056			}
5057
5058		});
5059
5060		function firstLoaded(el, event) {
5061			var el = $(el),
5062			uncode_slider = el.find('.uncode-slider');
5063			el.find('.owl-carousel').css('opacity', 1);
5064			uncode_slider.addClass('slider-loaded');
5065			if (typeof UNCODE.bigText !== 'undefined') {
5066				UNCODE.bigText(el.find('.owl-item.active'));
5067			}
5068			//if (!UNCODE.isMobile) {
5069				requestTimeout(function() {
5070					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
5071					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
5072					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
5073						if (lastDelayElems == undefined) lastDelayElems = 0;
5074						if (lastDelayThumb == undefined) lastDelayThumb = 0;
5075						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
5076						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
5077						requestTimeout(function() {
5078							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
5079						}, maxDelay);
5080					}
5081				}, 500);
5082
5083			//}
5084		}
5085
5086		function navHover(el) {
5087			var $owlCont = el,
5088				$owlPrev = $owlCont.find('.owl-prev'),
5089				$owlNext = $owlCont.find('.owl-next'),
5090				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
5091				$owlPagination = $owlCont.next(),
5092				owlPrevW = $owlPrev.outerWidth(),
5093				owlNextW = $owlNext.outerWidth(),
5094				owlDotsH = $owlDots.innerHeight(),
5095				owlTime = 400,
5096				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5097			if ( $('body').hasClass('rtl') ) {
5098				$owlPrev.css("margin-right", -owlPrevW);
5099				$owlNext.css("margin-left", -owlNextW);
5100			} else {
5101				$owlPrev.css("margin-left", -owlPrevW);
5102				$owlNext.css("margin-right", -owlNextW);
5103			}
5104			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
5105			$owlCont.mouseenter(function() {
5106				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5107				$owlPrev.add($owlNext).css({
5108					marginLeft: 0,
5109					marginRight: 0
5110				});
5111				if (!owlNested) {
5112					$owlDots.css({
5113						opacity: 1,
5114						bottom: 0
5115					});
5116				}
5117			}).mouseleave(function() {
5118				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5119				if ( $('body').hasClass('rtl') ) {
5120					$owlPrev.css("margin-right", -owlPrevW);
5121					$owlNext.css("margin-left", -owlNextW);
5122				} else {
5123					$owlPrev.css("margin-left", -owlPrevW);
5124					$owlNext.css("margin-right", -owlNextW);
5125				}
5126				if (!owlNested) {
5127					$owlDots.css({
5128						opacity: 1,
5129						bottom: -owlDotsH
5130					});
5131				}
5132			});
5133		};
5134
5135		function animate_elems($this) {
5136			var lastDelay;
5137			$.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) {
5138				var element = $(val),
5139					delayAttr = element.attr('data-delay'),
5140					$first_item = element.closest('.owl-item[data-index="1"]');
5141
5142				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
5143					return false;
5144				}
5145
5146				if (delayAttr == undefined) delayAttr = 0;
5147				requestTimeout(function() {
5148					element.addClass('start_animation');
5149				}, delayAttr);
5150				lastDelay = delayAttr;
5151			});
5152			return lastDelay;
5153		}
5154
5155		function animate_thumb(items, event) {
5156			var lastDelay,
5157				itemIndex,
5158				thiis = $(event.currentTarget),
5159				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
5160				numActives = $('.owl-item.active', thiis).length,
5161				stagePadding = thiis.data('stagepadding');
5162
5163			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
5164
5165			thiis.data('tempIndex', event.item.index);
5166				$.each(items, function(index, val) {
5167					var parent = $(val).closest('.owl-item');
5168					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5169						return;
5170					}
5171					if (!$(val).hasClass('start_animation')) {
5172						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
5173							var thumbInView = new Waypoint.Inview({
5174							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5175							  element: val,
5176							  enter: function(direction) {
5177								var element = $(this.element),
5178										delayAttr = parseInt(element.attr('data-delay')),
5179										itemIndex = element.closest('.owl-item').index() + 1,
5180										menuIndex = parseFloat(element.closest('.owl-item').attr('data-index')),
5181										diffItem = Math.abs(itemIndex - tempIndex) - 1;
5182									if ( thiis.closest('.megamenu-block-wrapper').length ) {
5183										diffItem = menuIndex;
5184									} else {
5185										if (itemIndex > tempIndex) {
5186											thiis.data('tempIndex', itemIndex);
5187										}
5188									}
5189									if (isNaN(delayAttr)) delayAttr = 100;
5190									if (stagePadding) {
5191										var objTimeout = requestTimeout(function() {
5192											if ( !element.closest('.overlay:not(.open)').length ) {
5193												element.addClass('start_animation');
5194											}
5195										}, index * delayAttr);
5196										lastDelay = index * delayAttr;
5197									} else {
5198										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
5199										var objTimeout = requestTimeout(function() {
5200											element.attr('data-test', diffItem + ' ' + delayAttr).addClass('start_animation');
5201										}, diffItem * delayAttr);
5202										lastDelay = diffItem * delayAttr;
5203									}
5204									parent.data('objTimeout', objTimeout);
5205									if (!UNCODE.isUnmodalOpen) {
5206										this.destroy();
5207									}
5208								}
5209							});
5210						}
5211					}
5212				});
5213				return lastDelay;
5214			}
5215
5216		function setItemsHeight(item) {
5217			$.each($('.owl-item', item), function(index, val) {
5218				var availableThumbHeight = $('.t-inside', $(val)).height(),
5219				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
5220				difference = availableThumbHeight - innerThumbHeight;
5221				if ($('.tmb-content-under', val).length) {
5222					var visualPart = $('.t-entry-visual', val);
5223					if (visualPart.length) {
5224						difference -= $('.t-entry-visual', val).height();
5225					}
5226				}
5227				if (! $('.tmb-content-lateral', val).length)
5228					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
5229			});
5230		}
5231
5232		function setItemsRelHeight(item) {
5233			$.each($('.owl-item', item), function(index, val) {
5234				var $rowContainer = $(item).parents('.row-parent').eq(0),
5235					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
5236					$colContainer = $(item).parents('.uncell').eq(0),
5237					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
5238					winHeight = UNCODE.wheight,
5239					multiplier_h = parseInt($(item).attr('data-vp-height')),
5240					data_viewport_h,
5241					consider_menu = $(item).data('vp-menu');
5242
5243				if ( consider_menu ) {
5244					winHeight = winHeight - UNCODE.menuHeight;
5245				}
5246
5247				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
5248				$('.t-inside', val).css( 'height', data_viewport_h );
5249			});
5250		}
5251
5252		function pauseOnHover(slider) {
5253			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
5254			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
5255				mouseenter: function () {
5256					$(slider).addClass('owl-mouseenter');
5257					$(slider).trigger('stop.owl.autoplay');
5258				},
5259				mouseleave: function () {
5260					$(slider).removeClass('owl-mouseenter');
5261					$(slider).trigger('play.owl.autoplay');
5262				}
5263			});
5264		}
5265	});
5266};
5267
5268UNCODE.owlPlayVideo = function(carousel) {
5269	var player, iframe;
5270	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
5271		var content = $(val).html();
5272		if (content == '') {
5273			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
5274			$(val).append(getCloned);
5275		}
5276		if ($(this).attr('data-provider') == 'vimeo') {
5277			iframe = $(this).find('iframe');
5278			player = new Vimeo.Player(iframe[0]);
5279			player.play();
5280		} else if ($(this).attr('data-provider') == 'youtube') {
5281			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
5282		} else {
5283			var player = $(this).find('video');
5284			if (player.length) {
5285				$(this).find('video')[0].volume = 0;
5286				$(this).find('video')[0].play();
5287				$(val).css('opacity', 1);
5288			}
5289		}
5290	});
5291};
5292
5293UNCODE.owlStopVideo = function(carousel) {
5294	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
5295		var player, iframe;
5296		if ($(this).attr('data-provider') == 'vimeo') {
5297			iframe = $(this).find('iframe');
5298			player = new Vimeo.Player(iframe[0]);
5299			player.pause();
5300		} else if ($(this).attr('data-provider') == 'youtube') {
5301			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
5302		} else {
5303			var player = $(this).find('video');
5304			if (player.length) {
5305				$(this).find('video')[0].volume = 0;
5306				$(this).find('video')[0].play();
5307			}
5308		}
5309	});
5310};
5311
5312UNCODE.animations = function() {
5313
5314	var runWaypoints_TO,
5315		runWaypoints_carousel_TO,
5316		runWaypoints_delay = 0,
5317	highlightComplexFunc = function($wrap, ev){
5318
5319		var $lines = $('.heading-line-wrap', $wrap),
5320			not_animate = false;
5321
5322		if ( $wrap.data('animate') === true ) {
5323			not_animate = true;
5324		}
5325
5326		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
5327		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
5328			return;
5329		}
5330
5331		$lines.each(function(_key, _value){
5332			var $line = $(_value),
5333				$inners = $('.split-word-inner', $line),
5334				$highlights = $('.heading-text-highlight-inner', $line);
5335
5336			var highlitInnerFunc = function(ev){
5337				var delay = 0;
5338				$highlights.each(function(h_key, high){
5339					var $highlight = $(high),
5340						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
5341						$nextSplit = $split.nextUntil(),
5342						$next = $('.heading-text-highlight-inner', $nextSplit),
5343						countCh = $split.text().length;
5344
5345					$highlight.css({
5346						'-webkit-transition-duration': (30 * countCh) + 'ms',
5347						'-moz-transition-duration': (30 * countCh) + 'ms',
5348						'-o-transition-duration': (30 * countCh) + 'ms',
5349						'transition-duration': (30 * countCh) + 'ms',
5350					});
5351
5352					delay += (30 * countCh);
5353
5354					$next.css({
5355						'-webkit-transition-delay': delay + 'ms',
5356						'-moz-transition-delay': delay + 'ms',
5357						'-o-transition-delay': delay + 'ms',
5358						'transition-delay': delay + 'ms',
5359					});
5360				});
5361				$highlights.removeAttr('data-animated');
5362				if ( _key+1 === $lines.length ) {
5363					$wrap.data('animate', true);
5364				}
5365			};
5366
5367			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
5368				if ( not_animate ) {
5369					$highlights.each(function(h_key, high){
5370						var $highlight = $(high);
5371						$highlight.css({
5372							'-webkit-transition-duration': '0ms',
5373							'-moz-transition-duration': '0ms',
5374							'-o-transition-duration': '0ms',
5375							'transition-duration': '0ms',
5376						});
5377					});
5378					$highlights.removeAttr('data-animated');
5379				} else {
5380					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
5381						highlitInnerFunc();
5382					} else {
5383						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
5384					}
5385				}
5386			}
5387		});
5388	};
5389
5390	$.each($('.header-content-inner'), function(index, val) {
5391		var element = $(val),
5392			transition = '';
5393		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
5394		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
5395		if (element.hasClass('left-t-right')) transition = 'left-t-right';
5396		if (element.hasClass('right-t-left')) transition = 'right-t-left';
5397		if (element.hasClass('zoom-in')) transition = 'zoom-in';
5398		if (element.hasClass('zoom-out')) transition = 'zoom-out';
5399		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
5400		if (element.hasClass('slight-anim')) transition = 'slight-anim';
5401		if (transition != '') {
5402			$(val).removeClass(transition);
5403			var container = element,
5404				containerDelay = container.attr('data-delay'),
5405				containerSpeed = container.attr('data-speed'),
5406				items = $('.header-title > *, .post-info', container);
5407			$.each(items, function(index, val) {
5408				var element = $(val),
5409					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
5410					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
5411				if (!element.hasClass('animate_when_almost_visible') && !element.hasClass('translate_when_almost_visible')) {
5412					delayAttr = Number(delayAttr) + (400 * index);
5413					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
5414					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
5415				}
5416			});
5417			container.css('opacity', 1);
5418		}
5419	});
5420
5421	function animate_css_grids_on_load() {
5422		$('.cssgrid-system').each(function() {
5423			var grid = $(this);
5424			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
5425			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
5426		});
5427	}
5428
5429	var delayAdd = 0;
5430
5431	window.waypoint_animation = function(ev) {
5432		$.each($('.translate_when_almost_visible:not(.start_animation), .animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-linear .animate_when_almost_visible:not(.start_animation), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)').filter(function(){
5433				var $el = $(this);
5434				if (!$el.is('[data-delay-seq]')) return true;
5435				return $el.is('[data-delay]');
5436			}), function(index, val) {
5437			if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length || $(val).closest('.tab-pane:not(.active)').length || $(val).closest('.panel:not(.active-group)').length || $(val).closest('.un-submenu').length || $(val).closest('#uncode-mobile-menu-block').length || $(val).closest('.has-unblock').length ) && !SiteParameters.is_frontend_editor ) ) {
5438				return true;
5439			}
5440			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5441				return;
5442			}
5443			var run = true,
5444				$carousel = $(val).closest('.owl-carousel'),
5445				marquee = $(val).closest('.tmb-linear').length;
5446			if ( $carousel.length ) {
5447				run = false;
5448			}
5449			if ( $(val).closest('.megamenu-block-wrapper').length ) {
5450				run = false;
5451			}
5452			if (run) {
5453				new Waypoint({
5454					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5455					element: val,
5456					handler: function() {
5457						var element = $(this.element),
5458							index = element.index(),
5459							delayAttr = element.attr('data-delay');
5460						if (delayAttr == undefined) delayAttr = 0;
5461						// delayAttr = parseFloat(delayAttr) + delayAdd;
5462						// if ( marquee ) {
5463						// 	delayAdd += 50;
5464						// } else {
5465						// 	delayAdd = 0;
5466						// }
5467						requestTimeout(function() {
5468							element.addClass('start_animation');
5469						}, delayAttr);
5470						if (!UNCODE.isUnmodalOpen) {
5471							this.destroy();
5472						}
5473					},
5474					offset: UNCODE.isFullPage ? '100%' : '90%'
5475				});
5476			}
5477		});
5478		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
5479			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5480				return;
5481			}
5482			var run = true,
5483				$carousel = $(val).closest('.owl-carousel');
5484			if ( $carousel.length ) {
5485				run = false;
5486			}
5487			if (run) {
5488				new Waypoint({
5489					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5490					element: val,
5491					handler: function() {
5492						var $element = $(this.element),
5493							$childs = $('.animate_when_parent_almost_visible', $element);
5494						$childs.each(function(key,el){
5495							var $child = $(el),
5496								delaySpeed = $child.attr('data-speed'),
5497								delayAttr = $child.attr('data-delay'),
5498								intervalAttr = $child.attr('data-interval');
5499							if (delayAttr == undefined) {
5500								delayAttr = 50*key;
5501							}
5502							requestTimeout(function() {
5503								$child.addClass('start_animation');
5504								if ( $child.hasClass('anim-line-checker') ) {
5505									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5506										var $line = $child.closest('.heading-line-wrap');
5507									});
5508								}
5509								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5510								highlightComplexFunc($wrapText, ev);
5511								if ( $child.hasClass('anim-tot-checker') ) {
5512									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5513										if ( $child.hasClass('anim-tot-checker') ) {
5514											$wrapText.addClass('already-animated');
5515											$element.trigger('already-animated');
5516										}
5517									});
5518								}
5519							}, delayAttr );
5520						});
5521						$element.addClass('start_animation');
5522						if (!UNCODE.isUnmodalOpen) {
5523							this.destroy();
5524						}
5525					},
5526					offset: UNCODE.isFullPage ? '100%' : '90%'
5527				});
5528			}
5529		});
5530	}
5531	window.waypoint_carousel_animation = function(ev) {
5532		$.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) {
5533			if ( $(val).hasClass('el-text-split') ) {
5534				return true;
5535			}
5536			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5537				return;
5538			}
5539			var run = true,
5540				$carousel = $(val).closest('.owl-carousel'),
5541				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5542				$all_first = $('.owl-item[data-index="1"]', $carousel);
5543			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5544				run = false;
5545			}
5546			if (run) {
5547				new Waypoint({
5548					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5549					element: val,
5550					handler: function() {
5551						var element = $(this.element),
5552							index = element.index(),
5553							delayAttr = element.attr('data-delay');
5554						if (delayAttr == undefined) delayAttr = 0;
5555						requestTimeout(function() {
5556							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5557								$all_first.attr('data-already-reached', 'true');
5558							}
5559							element.addClass('start_animation');
5560						}, delayAttr);
5561						if (!UNCODE.isUnmodalOpen) {
5562							this.destroy();
5563						}
5564					},
5565					offset: UNCODE.isFullPage ? '100%' : '90%'
5566				});
5567			}
5568		});
5569		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
5570			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5571				return;
5572			}
5573			var run = true,
5574				$carousel = $(val).closest('.owl-carousel'),
5575				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5576				$all_first = $('.owl-item[data-index="1"]', $carousel);
5577			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5578				run = false;
5579			}
5580			if (run) {
5581				new Waypoint({
5582					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5583					element: val,
5584					handler: function() {
5585						var $element = $(this.element),
5586							$childs = $('.animate_when_parent_almost_visible', $element);
5587						$childs.each(function(key,el){
5588							var $child = $(el),
5589								delaySpeed = $child.attr('data-speed'),
5590								delayAttr = $child.attr('data-delay'),
5591								intervalAttr = $child.attr('data-interval');
5592							if (delayAttr == undefined) {
5593								delayAttr = 50*key;
5594							}
5595							requestTimeout(function() {
5596								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5597									$all_first.attr('data-already-reached', 'true');
5598								}
5599								$child.addClass('start_animation');
5600								if ( $child.hasClass('anim-line-checker') ) {
5601									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5602										var $line = $child.closest('.heading-line-wrap');
5603									});
5604								}
5605								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5606								highlightComplexFunc($wrapText, ev);
5607								if ( $child.hasClass('anim-tot-checker') ) {
5608									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5609										if ( $child.hasClass('anim-tot-checker') ) {
5610											$wrapText.addClass('already-animated');
5611										}
5612									});
5613								}
5614							}, delayAttr );
5615						});
5616						$element.addClass('start_animation');
5617						if (!UNCODE.isUnmodalOpen) {
5618							this.destroy();
5619						}
5620					},
5621					offset: UNCODE.isFullPage ? '100%' : '90%'
5622				});
5623			}
5624		});
5625	}
5626
5627	var runWaypoints = function(ev){
5628		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5629			runWaypoints_delay = 400;
5630		}
5631		clearRequestTimeout(runWaypoints_TO);
5632		runWaypoints_TO = requestTimeout(function() {
5633			window.waypoint_animation(ev);
5634		}, runWaypoints_delay);
5635
5636		clearRequestTimeout(runWaypoints_carousel_TO);
5637		runWaypoints_carousel_TO = requestTimeout(function() {
5638			window.waypoint_carousel_animation(ev);
5639		}, 400);
5640	};
5641	runWaypoints();
5642	animate_css_grids_on_load();
5643
5644	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5645		runWaypoints(ev);
5646	});
5647	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5648		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5649		window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints );
5650	}
5651};
5652
5653UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5654	var $allItems = elements.length - startIndex,
5655		showed = 0,
5656		index = 0,
5657		use_index = false
5658		;
5659
5660	if (filtering) {
5661		if (sequential) {
5662			use_index = true;
5663		}
5664		sequential = false;
5665	}
5666
5667	$.each(elements, function(index, val) {
5668		var $this = $(val),
5669			elInner = $('> .t-inside', val);
5670
5671		if ( ( UNCODE.isUnmodalOpen && !val.closest('#unmodal-content') ) || $(val).closest('.un-submenu').length || $(val).closest('uncode-mobile-menu-block').length ) {
5672			return;
5673		}
5674		if (val[0]) val = val[0];
5675
5676		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5677			new Waypoint({
5678				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5679				element: val,
5680				handler: function() {
5681					var element = $('> .t-inside', this.element),
5682						parent = $(this.element);
5683					var _index = use_index? index : 0;
5684
5685					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5686						delayAttr = parseInt(element.attr('data-delay'));
5687					if (isNaN(delayAttr)) delayAttr = 100;
5688					if (sequential || use_index) {
5689						delay -= showed;
5690					}
5691					var objTimeout = requestTimeout(function() {
5692						element.removeClass('zoom-reverse').addClass('start_animation');
5693						showed = index;
5694					}, delay * delayAttr);
5695					parent.data('objTimeout', objTimeout);
5696					if (!UNCODE.isUnmodalOpen) {
5697						this.destroy();
5698					}
5699				},
5700				offset: UNCODE.isFullPage ? '100%' : '90%'
5701			});
5702		}
5703
5704		index++;
5705	});
5706};
5707
5708UNCODE.tapHover = function() {
5709
5710	var isTouch = (
5711		'ontouchstart' in window ||
5712		navigator.maxTouchPoints > 0 ||
5713		navigator.msMaxTouchPoints > 0
5714	);
5715
5716	if (isTouch) {
5717		var $el = $('.tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), 
5718			elClass = "hover";
5719
5720		$(window).on('click', function() {
5721			$el.removeClass(elClass);
5722		});
5723
5724		$el.on('click', function(e) {
5725			e.stopPropagation();
5726			var link = $(this);
5727			if ( ! link.hasClass(elClass)) {
5728				e.preventDefault();
5729				link.addClass("hover");
5730				$el.not(this).removeClass(elClass);
5731				return false;
5732			}
5733		});
5734	}
5735};
5736
5737UNCODE.onePage = function(isMobile) {
5738	var current = 0,
5739		last = 0,
5740		lastScrollTop = 0,
5741		forceScroll = false,
5742		lastScrolled = 0,
5743		isSectionscroller = ($('.main-onepage').length) ? true : false,
5744		isOnePage = false,
5745		getOffset = function () {
5746			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);
5747			return calculateOffset;
5748		}
5749
5750	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5751
5752	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5753	// 	return false;
5754
5755	function init_onepage() {
5756		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5757			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5758		}
5759		last = $('.onepage-pagination li').last().find('a').data('index');
5760		$.each($('div[data-parent="true"]'), function(index, val) {
5761			$(this).attr('data-section', index);
5762			if (isMobile) return;
5763			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5764				return;
5765			}
5766			var sectionDown = new Waypoint({
5767				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5768				element: val,
5769				handler: function(direction) {
5770					if (direction == 'down') {
5771						changeMenuActive(this.element, index);
5772					}
5773				},
5774				offset: function() {
5775					return 5 + getOffset()
5776				}
5777			});
5778			var sectionUp = new Waypoint({
5779				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5780				element: val,
5781				handler: function(direction) {
5782					if (direction == 'up') {
5783						changeMenuActive(this.element, index);
5784					}
5785				},
5786				offset: function() {
5787					return -5 - getOffset()
5788				}
5789			});
5790
5791			if (isSectionscroller) {
5792				var label;
5793				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5794				else label = '';
5795				var getName = $(this).attr('data-name');
5796				if (getName == undefined) getName = index;
5797				if (label != '') {
5798					isOnePage = true;
5799					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5800					$('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>");
5801				}
5802			}
5803		});
5804
5805		if (isSectionscroller) {
5806			$.each($('ul.onepage-pagination li'), function(index, val) {
5807				var $this = $(val),
5808					$a = ('a', $this);
5809				$a.on('click', function(evt) {
5810					if ( $('.is-selected', $this).length || UNCODE.scrolling ) {
5811						return false;
5812					}
5813					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5814						evt.preventDefault();
5815					}
5816					Waypoint.refreshAll();
5817					var el = $('a', evt.currentTarget);
5818					current = lastScrolled = parseInt(el.attr('data-index'));
5819					lastScrolled += 1;
5820					scrollBody(current);
5821				});
5822			});
5823		}
5824
5825		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5826		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5827			goToSection = String(window.location.hash).replace(/^#/, "");
5828			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5829		}
5830
5831		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5832			current = lastScrolled = goToSection;
5833			$(window).on('load', function(){
5834				if ( $('.owl-carousel').length ) {
5835					requestTimeout(function(){
5836						scrollBody(goToSection);
5837					}, 400);
5838				} else {
5839					scrollBody(goToSection);
5840				}
5841			});
5842		}
5843
5844	}
5845
5846	function changeMenuActive(section, index) {
5847		current = lastScrolled = parseInt($(section).attr('data-section'));
5848		if (isOnePage) {
5849			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5850			if (newSection.length) {
5851				$('ul.onepage-pagination li a').removeClass('is-selected');
5852				newSection.addClass('is-selected');
5853			}
5854			var getName = $('[data-section="' + index + '"]').attr('data-name');
5855			if (getName != undefined && getName !== '') {
5856				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5857					var get_href = $(val).attr('href');
5858					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5859						$(val).closest('.menu-smart').find('.active').removeClass('active');
5860						$(val).parent().addClass('active');
5861					}
5862				});
5863			}
5864		}
5865	}
5866
5867	if (isOnePage) {
5868		$(window).on('scroll', function() {
5869			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5870			if (bodyTop == 0) {
5871				$('ul.onepage-pagination li a').removeClass('is-selected');
5872				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5873				var getName = $('[data-section=0]').attr('data-name');
5874				if (getName != undefined && getName !== '') {
5875					$.each($('.menu-container .menu-item > a'), function(i, val) {
5876						var get_href = $(val).attr('href');
5877						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5878							$(val).closest('ul').find('.active').removeClass('active');
5879							$(val).parent().addClass('active');
5880						}
5881					});
5882				}
5883			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5884				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5885				if (lastSection.length) {
5886					$('ul.onepage-pagination li a').removeClass('is-selected');
5887					lastSection.addClass('is-selected');
5888				}
5889			}
5890		});
5891	}
5892
5893	var scrollBody = function(index) {
5894		$('ul.onepage-pagination li a').removeClass('is-selected');
5895		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5896
5897		var getSection = $('[data-section=' + index + ']'),
5898			scrollTo;
5899
5900		if (getSection == undefined) return;
5901
5902		var body = $("html, body"),
5903			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5904			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5905			getOffset = UNCODE.get_scroll_offset(index);
5906		if ( typeof getSection.offset() === 'undefined' )
5907			return;
5908		scrollTo = getSection.offset().top;
5909
5910		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5911		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5912			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5913			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5914				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5915			}
5916
5917			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5918				if ( index === 0 ) {
5919					scrollTo = 0;
5920				} else {
5921					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5922				}
5923			} else {
5924				scrollTo -= getOffset;
5925			}
5926		}
5927
5928		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5929		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5930
5931		if (index != 0) {
5932			UNCODE.scrolling = true;
5933		}
5934
5935		if (scrollSpeed == 0) {
5936			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5937			UNCODE.scrolling = false;
5938		} else {
5939			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5940				$(this).stop();
5941			}).animate({
5942				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5943			}, scrollSpeed, 'easeInOutCubic', function() {
5944				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5945				UNCODE.scrolling = false;
5946				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5947				||
5948				$('.menu-hided').length ) {
5949					scrollTo = getSection.offset().top;
5950					getOffset = UNCODE.get_scroll_offset(index);
5951					scrollTo -= getOffset;
5952					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5953						$(this).stop();
5954					}).animate({
5955						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5956						}, scrollSpeed, 'easeInOutCubic', function() {
5957							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5958							UNCODE.scrolling = false;
5959						}
5960					);
5961				}
5962			});
5963		}
5964
5965	};
5966
5967	init_onepage();
5968};
5969
5970UNCODE.stickyElements = function() {
5971	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5972	if (!isMobile_wide ) {
5973
5974		var $pageHeader = $('#page-header'),
5975			$headerRow = $('.vc_row', $pageHeader),
5976			$headerSection = $headerRow.closest('section[data-parent]'),
5977			startSticky = false;
5978
5979		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
5980			$headerRow.removeClass('sticky-element');
5981			$pageHeader.addClass('sticky-element');
5982			startSticky = true;
5983		}
5984
5985		var calculateOffset = function(el) {
5986			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5987				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5988				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5989				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5990
5991			sideOffset += UNCODE.bodyBorder;
5992
5993			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5994			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5995				if ($('.menu-shrink').length) {
5996					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5997				} else {
5998					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5999				}
6000			}
6001
6002			return sideOffset;
6003
6004		},
6005
6006		initStickyElement = function($els) {
6007			if ( $('body').hasClass('vc-safe-mode') ) {
6008				return true;
6009			}
6010			if ( typeof $els === 'undefined' ) {
6011				$els = $('.sticky-element');
6012			}
6013			$.each($els, function(index, element) {
6014				if ($(element).closest('.tab-pane').length) {
6015					var $paneParent = $(element).closest('.tab-pane');
6016					if ( !$paneParent.hasClass('active') ) {
6017						return true;
6018					}
6019				}
6020				$(element).stick_in_parent({
6021					sticky_class: 'is_stucked',
6022					offset_top: calculateOffset(element),
6023					bottoming: true,
6024					inner_scrolling: SiteParameters.sticky_elements === 'on'
6025				});
6026			});
6027		};
6028
6029		var oldW = UNCODE.wwidth,
6030			oldH = UNCODE.wHeight;
6031
6032		requestTimeout(function() {
6033			if ($('.sticky-element').length) {
6034
6035				if ($(window).width() > UNCODE.mediaQuery) {
6036					initStickyElement();
6037
6038					if ( startSticky === true ) {
6039						$('#page-header').trigger('sticky_kit:recalc');
6040					}
6041				}
6042
6043				$(window).on('resize lateral_resize', function(event) {
6044					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
6045						$(".sticky-element").trigger("sticky_kit:detach");
6046						if ($(window).width() > UNCODE.mediaQuery) {
6047							initStickyElement();
6048						}
6049						oldW = UNCODE.wwidth;
6050						oldH = UNCODE.wHeight;
6051					}
6052				});
6053			}
6054		}, 1000);
6055
6056		if ($('.sticky-element').length) {
6057			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
6058				requestTimeout(function() {
6059					$(document.body).trigger("sticky_kit:recalc");
6060				}, 100);
6061			});
6062		}
6063
6064		var $panels = $('.panel-collapse');
6065		if ( $panels.length ) {
6066			$panels.each(function(){
6067				var $panel = $(this);
6068				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
6069					$(document.body).trigger("sticky_kit:recalc");
6070				});
6071			});
6072		}
6073
6074		$('.nav-tabs a').on('shown.bs.tab', function(e){
6075			var $tabs = $(e.target).closest('.tab-container'),
6076				$panel = $('.tab-pane.active', $tabs),
6077				$els = $(e.target).nextAll(".sticky-element");
6078
6079			$els.trigger("sticky_kit:detach");
6080			initStickyElement($els);
6081		});
6082
6083		$(window).on('vc-safe-mode-on', function(){
6084			$(".sticky-element").trigger("sticky_kit:detach");
6085		});
6086
6087		$(window).on('vc-safe-mode-off', function(){
6088			initStickyElement();
6089		});
6090	}
6091};
6092
6093UNCODE.twentytwenty = function() {
6094
6095  if (!$('.twentytwenty-container').length) return;
6096
6097// DOM.event.move
6098//
6099// 2.0.0
6100//
6101// Stephen Band
6102//
6103// Triggers 'movestart', 'move' and 'moveend' events after
6104// mousemoves following a mousedown cross a distance threshold,
6105// similar to the native 'dragstart', 'drag' and 'dragend' events.
6106// Move events are throttled to animation frames. Move event objects
6107// have the properties:
6108//
6109// pageX:
6110// pageY:     Page coordinates of pointer.
6111// startX:
6112// startY:    Page coordinates of pointer at movestart.
6113// distX:
6114// distY:     Distance the pointer has moved since movestart.
6115// deltaX:
6116// deltaY:    Distance the finger has moved since last event.
6117// velocityX:
6118// velocityY: Average velocity over last few events.
6119
6120
6121(function(fn) {
6122	if (typeof define === 'function' && define.amd) {
6123        define([], fn);
6124    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
6125        module.exports = fn;
6126	} else {
6127		fn();
6128	}
6129})(function(){
6130	var assign = Object.assign || window.jQuery && jQuery.extend;
6131
6132	// Number of pixels a pressed pointer travels before movestart
6133	// event is fired.
6134	var threshold = 8;
6135
6136	// Shim for requestAnimationFrame, falling back to timer. See:
6137	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
6138	var requestFrame = (function(){
6139		return (
6140			window.requestAnimationFrame ||
6141			window.webkitRequestAnimationFrame ||
6142			window.mozRequestAnimationFrame ||
6143			window.oRequestAnimationFrame ||
6144			window.msRequestAnimationFrame ||
6145			function(fn, element){
6146				return window.setTimeout(function(){
6147					fn();
6148				}, 25);
6149			}
6150		);
6151	})();
6152
6153	// Shim for customEvent
6154	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
6155	(function () {
6156		if ( typeof window.CustomEvent === "function" ) return false;
6157		function CustomEvent ( event, params ) {
6158			params = params || { bubbles: false, cancelable: false, detail: undefined };
6159			var evt = document.createEvent( 'CustomEvent' );
6160			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
6161			return evt;
6162		}
6163
6164		CustomEvent.prototype = window.Event.prototype;
6165		window.CustomEvent = CustomEvent;
6166	})();
6167
6168	var ignoreTags = {
6169			textarea: true,
6170			input: true,
6171			select: true,
6172			button: true
6173		};
6174
6175	var mouseevents = {
6176		move:   'mousemove',
6177		cancel: 'mouseup dragstart',
6178		end:    'mouseup'
6179	};
6180
6181	var touchevents = {
6182		move:   'touchmove',
6183		cancel: 'touchend',
6184		end:    'touchend'
6185	};
6186
6187	var rspaces = /\s+/;
6188
6189
6190	// DOM Events
6191
6192	var eventOptions = { bubbles: true, cancelable: true };
6193
6194	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
6195
6196	function createEvent(type) {
6197		return new CustomEvent(type, eventOptions);
6198	}
6199
6200	function getEvents(node) {
6201		return node[eventsSymbol] || (node[eventsSymbol] = {});
6202	}
6203
6204	function on(node, types, fn, data, selector) {
6205		types = types.split(rspaces);
6206
6207		var events = getEvents(node);
6208		var i = types.length;
6209		var handlers, type;
6210
6211		function handler(e) { fn(e, data); }
6212
6213		while (i--) {
6214			type = types[i];
6215			handlers = events[type] || (events[type] = []);
6216			handlers.push([fn, handler]);
6217			node.addEventListener(type, handler);
6218		}
6219	}
6220
6221	function off(node, types, fn, selector) {
6222		types = types.split(rspaces);
6223
6224		var events = getEvents(node);
6225		var i = types.length;
6226		var type, handlers, k;
6227
6228		if (!events) { return; }
6229
6230		while (i--) {
6231			type = types[i];
6232			handlers = events[type];
6233			if (!handlers) { continue; }
6234			k = handlers.length;
6235			while (k--) {
6236				if (handlers[k][0] === fn) {
6237					node.removeEventListener(type, handlers[k][1]);
6238					handlers.splice(k, 1);
6239				}
6240			}
6241		}
6242	}
6243
6244	function trigger(node, type, properties) {
6245		// Don't cache events. It prevents you from triggering an event of a
6246		// given type from inside the handler of another event of that type.
6247		var event = createEvent(type);
6248		if (properties) { assign(event, properties); }
6249		node.dispatchEvent(event);
6250	}
6251
6252
6253	// Constructors
6254
6255	function Timer(fn){
6256		var callback = fn,
6257		    active = false,
6258		    running = false;
6259
6260		function trigger(time) {
6261			if (active){
6262				callback();
6263				requestFrame(trigger);
6264				running = true;
6265				active = false;
6266			}
6267			else {
6268				running = false;
6269			}
6270		}
6271
6272		this.kick = function(fn) {
6273			active = true;
6274			if (!running) { trigger(); }
6275		};
6276
6277		this.end = function(fn) {
6278			var cb = callback;
6279
6280			if (!fn) { return; }
6281
6282			// If the timer is not running, simply call the end callback.
6283			if (!running) {
6284				fn();
6285			}
6286			// If the timer is running, and has been kicked lately, then
6287			// queue up the current callback and the end callback, otherwise
6288			// just the end callback.
6289			else {
6290				callback = active ?
6291					function(){ cb(); fn(); } :
6292					fn ;
6293
6294				active = true;
6295			}
6296		};
6297	}
6298
6299
6300	// Functions
6301
6302	function noop() {}
6303
6304	function preventDefault(e) {
6305		e.preventDefault();
6306	}
6307
6308	function isIgnoreTag(e) {
6309		return !!ignoreTags[e.target.tagName.toLowerCase()];
6310	}
6311
6312	function isPrimaryButton(e) {
6313		// Ignore mousedowns on any button other than the left (or primary)
6314		// mouse button, or when a modifier key is pressed.
6315		return (e.which === 1 && !e.ctrlKey && !e.altKey);
6316	}
6317
6318	function identifiedTouch(touchList, id) {
6319		var i, l;
6320
6321		if (touchList.identifiedTouch) {
6322			return touchList.identifiedTouch(id);
6323		}
6324
6325		// touchList.identifiedTouch() does not exist in
6326		// webkit yet… we must do the search ourselves...
6327
6328		i = -1;
6329		l = touchList.length;
6330
6331		while (++i < l) {
6332			if (touchList[i].identifier === id) {
6333				return touchList[i];
6334			}
6335		}
6336	}
6337
6338	function changedTouch(e, data) {
6339		var touch = identifiedTouch(e.changedTouches, data.identifier);
6340
6341		// This isn't the touch you're looking for.
6342		if (!touch) { return; }
6343
6344		// Chrome Android (at least) includes touches that have not
6345		// changed in e.changedTouches. That's a bit annoying. Check
6346		// that this touch has changed.
6347		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
6348
6349		return touch;
6350	}
6351
6352
6353	// Handlers that decide when the first movestart is triggered
6354
6355	function mousedown(e){
6356		// Ignore non-primary buttons
6357		if (!isPrimaryButton(e)) { return; }
6358
6359		// Ignore form and interactive elements
6360		if (isIgnoreTag(e)) { return; }
6361
6362		on(document, mouseevents.move, mousemove, e);
6363		on(document, mouseevents.cancel, mouseend, e);
6364	}
6365
6366	function mousemove(e, data){
6367		checkThreshold(e, data, e, removeMouse);
6368	}
6369
6370	function mouseend(e, data) {
6371		removeMouse();
6372	}
6373
6374	function removeMouse() {
6375		off(document, mouseevents.move, mousemove);
6376		off(document, mouseevents.cancel, mouseend);
6377	}
6378
6379	function touchstart(e) {
6380		// Don't get in the way of interaction with form elements
6381		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
6382
6383		var touch = e.changedTouches[0];
6384
6385		// iOS live updates the touch objects whereas Android gives us copies.
6386		// That means we can't trust the touchstart object to stay the same,
6387		// so we must copy the data. This object acts as a template for
6388		// movestart, move and moveend event objects.
6389		var data = {
6390			target:     touch.target,
6391			pageX:      touch.pageX,
6392			pageY:      touch.pageY,
6393			identifier: touch.identifier,
6394
6395			// The only way to make handlers individually unbindable is by
6396			// making them unique.
6397			touchmove:  function(e, data) { touchmove(e, data); },
6398			touchend:   function(e, data) { touchend(e, data); }
6399		};
6400
6401		on(document, touchevents.move, data.touchmove, data);
6402		on(document, touchevents.cancel, data.touchend, data);
6403	}
6404
6405	function touchmove(e, data) {
6406		var touch = changedTouch(e, data);
6407		if (!touch) { return; }
6408		checkThreshold(e, data, touch, removeTouch);
6409	}
6410
6411	function touchend(e, data) {
6412		var touch = identifiedTouch(e.changedTouches, data.identifier);
6413		if (!touch) { return; }
6414		removeTouch(data);
6415	}
6416
6417	function removeTouch(data) {
6418		off(document, touchevents.move, data.touchmove);
6419		off(document, touchevents.cancel, data.touchend);
6420	}
6421
6422	function checkThreshold(e, data, touch, fn) {
6423		var distX = touch.pageX - data.pageX;
6424		var distY = touch.pageY - data.pageY;
6425
6426		// Do nothing if the threshold has not been crossed.
6427		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
6428
6429		triggerStart(e, data, touch, distX, distY, fn);
6430	}
6431
6432	function triggerStart(e, data, touch, distX, distY, fn) {
6433		var touches = e.targetTouches;
6434		var time = e.timeStamp - data.timeStamp;
6435
6436		// Create a movestart object with some special properties that
6437		// are passed only to the movestart handlers.
6438		var template = {
6439			altKey:     e.altKey,
6440			ctrlKey:    e.ctrlKey,
6441			shiftKey:   e.shiftKey,
6442			startX:     data.pageX,
6443			startY:     data.pageY,
6444			distX:      distX,
6445			distY:      distY,
6446			deltaX:     distX,
6447			deltaY:     distY,
6448			pageX:      touch.pageX,
6449			pageY:      touch.pageY,
6450			velocityX:  distX / time,
6451			velocityY:  distY / time,
6452			identifier: data.identifier,
6453			targetTouches: touches,
6454			finger: touches ? touches.length : 1,
6455			enableMove: function() {
6456				this.moveEnabled = true;
6457				this.enableMove = noop;
6458				e.preventDefault();
6459			}
6460		};
6461
6462		// Trigger the movestart event.
6463		trigger(data.target, 'movestart', template);
6464
6465		// Unbind handlers that tracked the touch or mouse up till now.
6466		fn(data);
6467	}
6468
6469
6470	// Handlers that control what happens following a movestart
6471
6472	function activeMousemove(e, data) {
6473		var timer  = data.timer;
6474
6475		data.touch = e;
6476		data.timeStamp = e.timeStamp;
6477		timer.kick();
6478	}
6479
6480	function activeMouseend(e, data) {
6481		var target = data.target;
6482		var event  = data.event;
6483		var timer  = data.timer;
6484
6485		removeActiveMouse();
6486
6487		endEvent(target, event, timer, function() {
6488			// Unbind the click suppressor, waiting until after mouseup
6489			// has been handled.
6490			setTimeout(function(){
6491				off(target, 'click', preventDefault);
6492			}, 0);
6493		});
6494	}
6495
6496	function removeActiveMouse() {
6497		off(document, mouseevents.move, activeMousemove);
6498		off(document, mouseevents.end, activeMouseend);
6499	}
6500
6501	function activeTouchmove(e, data) {
6502		var event = data.event;
6503		var timer = data.timer;
6504		var touch = changedTouch(e, event);
6505
6506		if (!touch) { return; }
6507
6508		// Stop the interface from gesturing
6509		e.preventDefault();
6510
6511		event.targetTouches = e.targetTouches;
6512		data.touch = touch;
6513		data.timeStamp = e.timeStamp;
6514
6515		timer.kick();
6516	}
6517
6518	function activeTouchend(e, data) {
6519		var target = data.target;
6520		var event  = data.event;
6521		var timer  = data.timer;
6522		var touch  = identifiedTouch(e.changedTouches, event.identifier);
6523
6524		// This isn't the touch you're looking for.
6525		if (!touch) { return; }
6526
6527		removeActiveTouch(data);
6528		endEvent(target, event, timer);
6529	}
6530
6531	function removeActiveTouch(data) {
6532		off(document, touchevents.move, data.activeTouchmove);
6533		off(document, touchevents.end, data.activeTouchend);
6534	}
6535
6536
6537	// Logic for triggering move and moveend events
6538
6539	function updateEvent(event, touch, timeStamp) {
6540		var time = timeStamp - event.timeStamp;
6541
6542		event.distX =  touch.pageX - event.startX;
6543		event.distY =  touch.pageY - event.startY;
6544		event.deltaX = touch.pageX - event.pageX;
6545		event.deltaY = touch.pageY - event.pageY;
6546
6547		// Average the velocity of the last few events using a decay
6548		// curve to even out spurious jumps in values.
6549		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
6550		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
6551		event.pageX =  touch.pageX;
6552		event.pageY =  touch.pageY;
6553	}
6554
6555	function endEvent(target, event, timer, fn) {
6556		timer.end(function(){
6557			trigger(target, 'moveend', event);
6558			return fn && fn();
6559		});
6560	}
6561
6562
6563	// Set up the DOM
6564
6565	function movestart(e) {
6566		if (e.defaultPrevented) { return; }
6567		if (!e.moveEnabled) { return; }
6568
6569		var event = {
6570			startX:        e.startX,
6571			startY:        e.startY,
6572			pageX:         e.pageX,
6573			pageY:         e.pageY,
6574			distX:         e.distX,
6575			distY:         e.distY,
6576			deltaX:        e.deltaX,
6577			deltaY:        e.deltaY,
6578			velocityX:     e.velocityX,
6579			velocityY:     e.velocityY,
6580			identifier:    e.identifier,
6581			targetTouches: e.targetTouches,
6582			finger:        e.finger
6583		};
6584
6585		var data = {
6586			target:    e.target,
6587			event:     event,
6588			timer:     new Timer(update),
6589			touch:     undefined,
6590			timeStamp: e.timeStamp
6591		};
6592
6593		function update(time) {
6594			updateEvent(event, data.touch, data.timeStamp);
6595			trigger(data.target, 'move', event);
6596		}
6597
6598		if (e.identifier === undefined) {
6599			// We're dealing with a mouse event.
6600			// Stop clicks from propagating during a move
6601			on(e.target, 'click', preventDefault);
6602			on(document, mouseevents.move, activeMousemove, data);
6603			on(document, mouseevents.end, activeMouseend, data);
6604		}
6605		else {
6606			// In order to unbind correct handlers they have to be unique
6607			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6608			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6609
6610			// We're dealing with a touch.
6611			on(document, touchevents.move, data.activeTouchmove, data);
6612			on(document, touchevents.end, data.activeTouchend, data);
6613		}
6614	}
6615
6616	on(document, 'mousedown', mousedown);
6617	on(document, 'touchstart', touchstart);
6618	on(document, 'movestart', movestart);
6619
6620
6621	// jQuery special events
6622	//
6623	// jQuery event objects are copies of DOM event objects. They need
6624	// a little help copying the move properties across.
6625
6626	if (!window.jQuery) { return; }
6627
6628	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6629
6630	function enableMove1(e) { e.enableMove(); }
6631	function enableMove2(e) { e.enableMove(); }
6632	function enableMove3(e) { e.enableMove(); }
6633
6634	function add(handleObj) {
6635		var handler = handleObj.handler;
6636
6637		handleObj.handler = function(e) {
6638			// Copy move properties across from originalEvent
6639			var i = properties.length;
6640			var property;
6641
6642			while(i--) {
6643				property = properties[i];
6644				e[property] = e.originalEvent[property];
6645			}
6646
6647			handler.apply(this, arguments);
6648		};
6649	}
6650
6651	jQuery.event.special.movestart = {
6652		setup: function() {
6653			// Movestart must be enabled to allow other move events
6654			on(this, 'movestart', enableMove1);
6655
6656			// Do listen to DOM events
6657			return false;
6658		},
6659
6660		teardown: function() {
6661			off(this, 'movestart', enableMove1);
6662			return false;
6663		},
6664
6665		add: add
6666	};
6667
6668	jQuery.event.special.move = {
6669		setup: function() {
6670			on(this, 'movestart', enableMove2);
6671			return false;
6672		},
6673
6674		teardown: function() {
6675			off(this, 'movestart', enableMove2);
6676			return false;
6677		},
6678
6679		add: add
6680	};
6681
6682	jQuery.event.special.moveend = {
6683		setup: function() {
6684			on(this, 'movestart', enableMove3);
6685			return false;
6686		},
6687
6688		teardown: function() {
6689			off(this, 'movestart', enableMove3);
6690			return false;
6691		},
6692
6693		add: add
6694	};
6695});
6696
6697  $.fn.twentytwenty = function(options) {
6698    var options = $.extend({
6699      default_offset_pct: 0.5,
6700      orientation: 'horizontal',
6701      before_label: 'Before',
6702      after_label: 'After',
6703      no_overlay: false,
6704      move_slider_on_hover: false,
6705      move_with_handle_only: true,
6706      click_to_move: false
6707    }, options);
6708
6709    return this.each(function() {
6710
6711      var sliderPct = options.default_offset_pct;
6712      var container = $(this);
6713      var sliderOrientation = options.orientation;
6714      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6715      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6716
6717
6718      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6719      if(!options.no_overlay) {
6720        container.append("<div class='twentytwenty-overlay'></div>");
6721        var overlay = container.find(".twentytwenty-overlay");
6722        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6723        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6724      }
6725      var beforeImg = container.find("img:first");
6726      var afterImg = container.find("img:last");
6727      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6728      var slider = container.find(".twentytwenty-handle");
6729      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6730      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6731      container.addClass("twentytwenty-container");
6732      beforeImg.addClass("twentytwenty-before");
6733      afterImg.addClass("twentytwenty-after");
6734
6735      var calcOffset = function(dimensionPct) {
6736        var w = beforeImg.width();
6737        var h = beforeImg.height();
6738        return {
6739          w: w+"px",
6740          h: h+"px",
6741          cw: (dimensionPct*w)+"px",
6742          ch: (dimensionPct*h)+"px"
6743        };
6744      };
6745
6746      var adjustContainer = function(offset) {
6747      	if (sliderOrientation === 'vertical') {
6748          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6749          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6750      	}
6751      	else {
6752          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6753          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6754    	}
6755        container.css("height", offset.h);
6756      };
6757
6758      var adjustSlider = function(pct) {
6759        var offset = calcOffset(pct);
6760        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6761        adjustContainer(offset);
6762      };
6763
6764      // Return the number specified or the min/max number if it outside the range given.
6765      var minMaxNumber = function(num, min, max) {
6766        return Math.max(min, Math.min(max, num));
6767      };
6768
6769      // Calculate the slider percentage based on the position.
6770      var getSliderPercentage = function(positionX, positionY) {
6771        var sliderPercentage = (sliderOrientation === 'vertical') ?
6772          (positionY-offsetY)/imgHeight :
6773          (positionX-offsetX)/imgWidth;
6774
6775        return minMaxNumber(sliderPercentage, 0, 1);
6776      };
6777
6778
6779      $(window).on("resize.twentytwenty", function(e) {
6780        adjustSlider(sliderPct);
6781      });
6782
6783      var offsetX = 0;
6784      var offsetY = 0;
6785      var imgWidth = 0;
6786      var imgHeight = 0;
6787      var onMoveStart = function(e) {
6788        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6789          e.preventDefault();
6790        }
6791        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6792          e.preventDefault();
6793        }
6794        container.addClass("active");
6795        offsetX = container.offset().left;
6796        offsetY = container.offset().top;
6797        imgWidth = beforeImg.width();
6798        imgHeight = beforeImg.height();
6799      };
6800      var onMove = function(e) {
6801        if (container.hasClass("active")) {
6802          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6803          adjustSlider(sliderPct);
6804        }
6805      };
6806      var onMoveEnd = function() {
6807          container.removeClass("active");
6808      };
6809
6810      var moveTarget = options.move_with_handle_only ? slider : container;
6811      moveTarget.on("movestart",onMoveStart);
6812      moveTarget.on("move",onMove);
6813      moveTarget.on("moveend",onMoveEnd);
6814
6815      if (options.move_slider_on_hover) {
6816        container.on("mouseenter", onMoveStart);
6817        container.on("mousemove", onMove);
6818        container.on("mouseleave", onMoveEnd);
6819      }
6820
6821      slider.on("touchmove", function(e) {
6822        e.preventDefault();
6823      });
6824
6825      container.find("img").on("mousedown", function(event) {
6826        event.preventDefault();
6827      });
6828
6829      if (options.click_to_move) {
6830        container.on('click', function(e) {
6831          offsetX = container.offset().left;
6832          offsetY = container.offset().top;
6833          imgWidth = beforeImg.width();
6834          imgHeight = beforeImg.height();
6835
6836          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6837          adjustSlider(sliderPct);
6838        });
6839      }
6840
6841      $(window).trigger("resize.twentytwenty");
6842    });
6843  };
6844
6845
6846  $(window).on("load", function(e) {
6847  	$('.twentytwenty-container').each(function(){
6848  		var $container = $(this);
6849  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6850  			$container.twentytwenty();
6851  		}
6852  		$('img', $container).on('async-done', function(){
6853	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6854	  			$container.twentytwenty();
6855	  		}
6856	    });
6857  	});
6858  });
6859}
6860
6861UNCODE.justifiedGallery = function() {
6862
6863	var breakPointMe = function( val ) {
6864		val = parseInt( val );
6865		if ( isNaN(val) ) {
6866			return false;
6867		}
6868		if ( val >= 1500 ) {
6869			return 1;
6870		} else if ( val < 1500 && val >= 960 ) {
6871			return 2;
6872		} else if ( val < 960 && val >= 570 ) {
6873			return 3;
6874		} else if ( val < 570 ) {
6875			return 4;
6876		}
6877	}
6878
6879	var gutterByBreakpoint = function( bp, gutter ) {
6880		var ret;
6881		switch(gutter) {
6882		    case 'no-gutter':
6883		    	ret = 0;
6884		        break;
6885		    case 'px-gutter':
6886		    	ret = 1;
6887		        break;
6888		    case 'half-gutter':
6889		    	ret = 18;
6890		        break;
6891		    case 'double-gutter':
6892				switch(bp) {
6893				    case 3:
6894				    case 4:
6895				    	ret = 36;
6896				        break;
6897				    default:
6898				    	ret = 72;
6899				        break;
6900				}
6901		        break;
6902		    case 'triple-gutter':
6903				switch(bp) {
6904				    case 3:
6905				    case 4:
6906				    	ret = 36;
6907				        break;
6908				    default:
6909				    	ret = 108;
6910				        break;
6911				}
6912		        break;
6913		    case 'quad-gutter':
6914				switch(bp) {
6915				    case 2:
6916				    	ret = 108;
6917				        break;
6918				    case 3:
6919				    	ret = 72;
6920				        break;
6921				    case 4:
6922				    	ret = 36;
6923				        break;
6924				    default:
6925				    	ret = 144;
6926				        break;
6927				}
6928		        break;
6929		    default:
6930		    	ret = 36;//single-gutter
6931		}
6932		return ret;
6933	}
6934
6935	if ($('.justified-layout').length > 0) {
6936		var justifiedContainersArray = [],
6937			typeGridArray = [],
6938			layoutGridArray = [],
6939			transitionDuration = [],
6940			$filterItems = [],
6941			$filters = $('.justified-system .isotope-filters'),
6942			$itemSelector = '.tmb',
6943			$items,
6944			itemMargin,
6945			correctionFactor = 0,
6946			firstLoad = true,
6947			isOriginLeft = $('body').hasClass('rtl') ? false : true,
6948			prevW = breakPointMe(UNCODE.wwidth);
6949		$('[class*="justified-container"]').each(function() {
6950			var isoData = $(this).data();
6951			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6952			if (isoData.type == 'metro') typeGridArray.push(true);
6953			else typeGridArray.push(false);
6954			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
6955			else layoutGridArray.push('justified');
6956			justifiedContainersArray.push($(this));
6957		});
6958		var init_justifiedGallery = function() {
6959			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
6960				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
6961					justifiedId = justifiedSystem.attr('id'),
6962					$layoutMode = layoutGridArray[i],
6963					gutter = $(justifiedContainersArray[i]).data('gutter'),
6964					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
6965					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
6966					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6967					margins;
6968
6969				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6970				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6971				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6972
6973				margins = gutterByBreakpoint(prevW, gutter);
6974
6975				$(justifiedContainersArray[i]).justifiedGallery({
6976					rowHeight: rowHeight,
6977					maxRowHeight: maxRowHeight,
6978					margins: margins,
6979					cssAnimation: true,
6980					lastRow: lastRow,
6981					waitThumbnailsLoad: false
6982				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6983
6984				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6985					$(justifiedContainersArray[i]).infinitescroll({
6986							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6987							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6988							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6989							animate: false,
6990							behavior: 'local',
6991							debug: false,
6992							loading: {
6993								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6994								speed: 0,
6995								finished: undefined,
6996								msg: $('#' + justifiedId + ' .loadmore-button'),
6997							},
6998							errorCallback: function() {
6999								var justified_system = $(this).closest('.justified-system');
7000								$('.loading-button', justified_system).hide();
7001								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
7002							}
7003						},
7004						// append the new items to galleryJustified on the infinitescroll callback function.
7005						function(newElements, opts) {
7006							var $galleryJustified = $(this),
7007								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
7008								filters = new Array(),
7009								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
7010								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
7011								$numPages = $('a', $infinite_button).data('pages'),
7012								delay = 300;
7013							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7014							$infinite_button.show();
7015							$loading_button.hide();
7016							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7017							$('> li', $galleryJustified).remove();
7018							$.each($(newElements), function(index, val) {
7019								$(val).addClass('tmb-iso');
7020								if ($(val).is("li")) {
7021									filters.push($(val)[0]);
7022								}
7023								$(val).addClass('uncode-appended');
7024							});
7025							newElements = newElements.filter(function(x) {
7026								return filters.indexOf(x) < 0
7027							});
7028							$.each($(filters), function(index, val) {
7029								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
7030							});
7031							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
7032							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7033								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
7034								if (typeof getLightbox === 'object') {
7035									getLightbox.refresh();
7036								} else {
7037									UNCODE.lightbox();
7038								}
7039							}
7040							if ( typeof twttr !== 'undefined' )
7041								twttr.widgets.load(justifiedContainersArray[i]);
7042
7043							requestTimeout(function() {
7044								$galleryJustified.trigger('more-items-loaded');
7045								$(window).trigger('more-items-loaded');
7046								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7047							}, 1000);
7048						});
7049					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
7050						var $infinite_justified = $(justifiedContainersArray[i]),
7051							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
7052						$infinite_justified.infinitescroll('pause');
7053						$infinite_button.on('click', function(event) {
7054							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7055								$.each(UNCODE.lightboxArray, function(index, val) {
7056									UNCODE.lightboxArray[index].destroy();
7057								});
7058							}
7059							event.preventDefault();
7060							var $justified_system = $(event.target).closest('.justified-system'),
7061							$infinite_justified = $justified_system.find('.justified-container'),
7062							justifiedId = $justified_system.attr('id');
7063							$(event.currentTarget).html(SiteParameters.loading);
7064							$infinite_justified.infinitescroll('resume');
7065							$infinite_justified.infinitescroll('retrieve');
7066							$infinite_justified.infinitescroll('pause');
7067							$infinite_justified.trigger('more-items-loaded');
7068							$(window).trigger('more-items-loaded');
7069							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7070						});
7071					}
7072				}
7073			}
7074		},
7075		onLayout = function(justifiedObj, startIndex) {
7076			justifiedObj.css('opacity', 1);
7077			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
7078			$('.tmb', justifiedObj).addClass('justified-object-loaded');
7079
7080			requestTimeout(function() {
7081				// window.dispatchEvent(UNCODE.boxEvent);
7082				UNCODE.adaptive();
7083				if (SiteParameters.dynamic_srcset_active === '1') {
7084					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
7085				}
7086				if (typeof MediaElement === "function") {
7087					$(justifiedObj).find('audio,video').each(function() {
7088						$(this).mediaelementplayer({
7089								pauseOtherPlayers: false,
7090						});
7091					});
7092				}
7093				if ($(justifiedObj).find('.nested-carousel').length) {
7094					if (typeof UNCODE.carousel !== 'undefined') {
7095						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
7096					}
7097					requestTimeout(function() {
7098						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7099						justifiedObj.addClass('justified-gallery-finished')
7100						Waypoint.refreshAll();
7101					}, 200);
7102				} else {
7103					requestTimeout(function() {
7104						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7105						justifiedObj.addClass('justified-gallery-finished')
7106						Waypoint.refreshAll();
7107					}, 300);
7108				}
7109			}, 100);
7110
7111		},
7112		boxAnimation = function(items, startIndex, sequential, container) {
7113			var $allItems = items.length - startIndex,
7114				showed = 0,
7115				index = 0;
7116			if (container.closest('.owl-item').length == 1) return false;
7117			$.each(items, function(index, val) {
7118				var elInner = $('> .t-inside', val);
7119				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
7120					return;
7121				}
7122				if (val[0]) val = val[0];
7123				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
7124					new Waypoint({
7125						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
7126						element: val,
7127						handler: function() {
7128							var element = $('> .t-inside', this.element),
7129								parent = $(this.element),
7130								currentIndex = parent.index();
7131							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
7132								delayAttr = parseInt(element.attr('data-delay'));
7133							if (isNaN(delayAttr)) delayAttr = 100;
7134							delay -= showed;
7135							var objTimeout = requestTimeout(function() {
7136								element.removeClass('zoom-reverse').addClass('start_animation');
7137								showed = parent.index();
7138							}, delay * delayAttr);
7139							parent.data('objTimeout', objTimeout);
7140							if (!UNCODE.isUnmodalOpen) {
7141								this.destroy();
7142							}
7143						},
7144						offset: '100%'
7145					})
7146				} else {
7147					elInner.removeClass('animate_when_almost_visible');
7148					$(val).addClass('no-waypoint-animation');
7149					/*if (elInner.hasClass('force-anim')) {
7150						elInner.addClass('start_animation');
7151					} else {
7152						elInner.css('opacity', 1);
7153					}*/
7154				}
7155				index++;
7156			});
7157		};
7158		$filters.on('click', 'a[data-filter]', function(evt) {
7159			var $filter = $(this),
7160				filterContainer = $filter.closest('.isotope-filters'),
7161				filterValue = $filter.attr('data-filter'),
7162				container = $filter.closest('.justified-system').find($('.justified-layout')),
7163				lastRow = container.data('last-row'),
7164				transitionDuration = 0,
7165				delay = 300,
7166				filterItems = [];
7167
7168			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
7169
7170			var filter_items = function(){
7171				if (filterValue !== undefined) {
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');
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
7188					requestTimeout(function() {
7189						var $block,
7190							selector,
7191							lightboxElements,
7192							$boxes;
7193
7194						if ( filterValue !== '' && filterValue !== '*' ) {
7195							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
7196							selector = '.' + filterValue;
7197							$.each($(selector, container), function(index, block) {
7198								lightboxElements = $('[data-lbox^=ilightbox]', block);
7199								if (lightboxElements.length) {
7200									lightboxElements.removeClass('lb-disabled');
7201									container.data('lbox', $(lightboxElements[0]).data('lbox'));
7202								}
7203								filterItems.push(block);
7204							});
7205							container.justifiedGallery({
7206								filter: selector,
7207								lastRow: 'nojustify'
7208							});
7209						} else {
7210							container.justifiedGallery({
7211								filter: false,
7212								lastRow: lastRow
7213							});
7214							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
7215							filterItems = $('> .tmb', container);
7216						}
7217						container.trigger('more-items-loaded');
7218						$(window).trigger('more-items-loaded');
7219						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7220
7221						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7222						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7223							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
7224							if (typeof getLightbox === 'object') {
7225								getLightbox.refresh();
7226							} else {
7227								UNCODE.lightbox();
7228							}
7229						}
7230
7231						if (transitionDuration == 0) {
7232							requestTimeout(function() {
7233								boxAnimation(filterItems, 0, false, container);
7234							}, 100);
7235						}
7236						requestTimeout(function() {
7237							Waypoint.refreshAll();
7238							container.trigger('more-items-loaded');
7239							$(window).trigger('more-items-loaded');
7240							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7241							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
7242								$(document).trigger('uncode-scrolltrigger-refresh');
7243							}
7244						}, 2000);
7245
7246					}, delay);
7247				} else {
7248					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7249						$.each(UNCODE.lightboxArray, function(index, val) {
7250							UNCODE.lightboxArray[index].destroy();
7251						});
7252					}
7253					$.each($('> .tmb > .t-inside', container), function(index, val) {
7254						var parent = $(val).parent(),
7255							objTimeout = parent.data('objTimeout');
7256						if (objTimeout) {
7257							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7258							clearRequestTimeout(objTimeout);
7259						}
7260						if (transitionDuration == 0) {
7261							if ($(val).hasClass('animate_when_almost_visible')) {
7262								$(val).addClass('zoom-reverse').removeClass('start_animation');
7263							} else {
7264								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7265							}
7266						}
7267					});
7268					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7269						UNCODE.lightbox();
7270					}
7271					container.parent().addClass('justified-loading');
7272					container.trigger('more-items-loaded');
7273					$(window).trigger('more-items-loaded');
7274					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7275				}
7276			};
7277
7278			if (!$filter.hasClass('active')) {
7279				/** Scroll top with filtering */
7280				if (filterContainer.hasClass('filter-scroll')) {
7281                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7282                    calc_scroll -= UNCODE.get_scroll_offset();
7283
7284					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7285						delta = bodyTop - calc_scroll,
7286						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7287						filterTolerance = false,
7288						filter_timeout;
7289					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7290
7291					if ( !UNCODE.isFullPage ) {
7292						if (scrollSpeed == 0) {
7293							$('html, body').scrollTop(calc_scroll);
7294							UNCODE.scrolling = false;
7295							filter_items();
7296						} else {
7297
7298							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7299								filter_items();
7300								filterTolerance = true;
7301							}
7302
7303							$('html, body').animate({
7304								scrollTop: calc_scroll
7305							},{
7306								easing: 'easeInOutQuad',
7307								duration: scrollSpeed,
7308								complete: function(){
7309									UNCODE.scrolling = false;
7310									if ( !filterTolerance ) {
7311										filter_timeout = setTimeout(function(){
7312											clearTimeout(filter_timeout);
7313											filter_items();
7314										}, 200);
7315									}
7316								}
7317							});
7318						}
7319					}
7320				} else {
7321					filter_items();
7322				}
7323			}
7324			evt.preventDefault();
7325		});
7326
7327		$filters.each(function(i, buttonGroup) {
7328			var $buttonGroup = $(buttonGroup);
7329			$buttonGroup.on('click', 'a', function() {
7330				$buttonGroup.find('.active').removeClass('active');
7331				$(this).addClass('active');
7332			});
7333
7334			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7335				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7336				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7337			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7338				e.preventDefault();
7339				$cats_filters.slideToggle(400, 'easeInOutCirc');
7340			});
7341		});
7342		window.addEventListener('boxResized', function(e) {
7343			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
7344				prevW = breakPointMe(UNCODE.wwidth);
7345				$.each($('.justified-layout'), function(index, val) {
7346					var gutter = $(this).data('gutter'),
7347						margins = gutterByBreakpoint( prevW, gutter);
7348					$(this).justifiedGallery({
7349						margins: margins
7350					});
7351					$(this).find('.mejs-video,.mejs-audio').each(function() {
7352						$(this).trigger('resize');
7353					});
7354				});
7355			}
7356		}, false);
7357
7358		init_justifiedGallery();
7359	};
7360};
7361
7362UNCODE.cssGrid = function() {
7363	if ($('.cssgrid-layout').length > 0) {
7364		var cssGridContainersArray = [];
7365		var transitionDuration = [];
7366		var $filters = $('.cssgrid-system .cssgrid-filters');
7367
7368		$('[class*="cssgrid-container"]').each(function() {
7369			cssGridContainersArray.push($(this));
7370			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
7371		});
7372
7373		var init_cssGridAjax = function() {
7374			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
7375				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
7376					cssGridId = cssGridSystem.attr('id');
7377
7378				cssGridSystem.data('transitionDuration', transitionDuration[i]);
7379
7380				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
7381					$(cssGridContainersArray[i]).infinitescroll({
7382						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
7383						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
7384						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
7385						animate: false,
7386						behavior: 'local',
7387						debug: false,
7388						loading: {
7389							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
7390							speed: 0,
7391							finished: undefined,
7392							msg: $('#' + cssGridId + ' .loadmore-button'),
7393						},
7394						errorCallback: function() {
7395							var cssgrid_system = $(this).closest('.cssgrid-system');
7396							$('.loading-button', cssgrid_system).hide();
7397							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
7398						}
7399					},
7400					// append the new items to cssGrid on the infinitescroll callback function.
7401					function(newElements, opts) {
7402						var $cssGrid = $(this),
7403							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
7404							cssGridId = cssGridSystemCont.attr('id'),
7405							filters = new Array(),
7406							$loading_button = cssGridSystemCont.find('.loading-button'),
7407							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
7408							$numPages = $('a', $infinite_button).data('pages'),
7409							$woo_results,
7410							delay = 300;
7411						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7412						$infinite_button.show();
7413						$loading_button.hide();
7414						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7415						$('> li', $cssGrid).remove();
7416						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
7417						$.each($(newElements), function (index, val) {
7418							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
7419								$woo_results = $(val);
7420								delete newElements[index];
7421							} else {
7422								$(val).addClass('tmb-grid');
7423								if ($(val).is("li")) {
7424									filters.push($(val)[0]);
7425								}
7426							}
7427							$(val).addClass('uncode-appended');
7428						});
7429						newElements = newElements.filter(function(x) {
7430							return filters.indexOf(x) < 0
7431						});
7432						$.each($(filters), function(index, val) {
7433							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
7434						});
7435						if ($woo_results && $woo_results.length > 0) {
7436							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
7437							var new_count = $woo_results.find('.woocommerce-result-count').text();
7438							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
7439							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
7440							function replaceMatch(match, p1, p2) {
7441        						return old_start + '–' + new_end;
7442							}
7443							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
7444							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
7445						}
7446
7447						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
7448						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
7449						if (filterValue !== undefined && filterValue != '*') {
7450							$(newElements).hide();
7451							var els_to_show = $();
7452							$(newElements).each(function() {
7453								var el = $(this);
7454								if (el.hasClass(filterValue)) {
7455									els_to_show = els_to_show.add(el);
7456									el.show();
7457								}
7458							});
7459							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
7460						} else {
7461							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
7462						}
7463
7464						UNCODE.adaptive();
7465						if (SiteParameters.dynamic_srcset_active === '1') {
7466							UNCODE.refresh_dynamic_srcset_size($cssGrid);
7467						}
7468						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7469							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
7470							if (typeof getLightbox === 'object') {
7471								getLightbox.refresh();
7472							} else {
7473								UNCODE.lightbox();
7474							}
7475						}
7476						if ( typeof twttr !== 'undefined' ) {
7477							twttr.widgets.load(cssGridContainersArray[i]);
7478						}
7479
7480						UNCODE.carousel($(newElements));
7481						requestTimeout(function() {
7482							$cssGrid.trigger('more-items-loaded');
7483							$(window).trigger('more-items-loaded');
7484							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7485						}, 1000);
7486
7487					});
7488					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
7489						var $cssgrid_el = $(cssGridContainersArray[i]),
7490							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
7491						$cssgrid_el.infinitescroll('pause');
7492						$infinite_button.on('click', function(event) {
7493							event.preventDefault();
7494							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
7495							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
7496							cssGridId = $cssgrid_system.attr('id');
7497							$(event.currentTarget).html(SiteParameters.loading);
7498							$cssgrid_el.infinitescroll('resume');
7499							$cssgrid_el.infinitescroll('retrieve');
7500							$cssgrid_el.infinitescroll('pause');
7501						});
7502					}
7503				}
7504			}
7505		};
7506
7507		init_cssGridAjax();
7508
7509		if ($('.cssgrid-pagination').length > 0) {
7510			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
7511				evt.preventDefault();
7512
7513				if (SiteParameters.index_pagination_disable_scroll !== '1') {
7514					var container = $(this).closest('.cssgrid-system'),
7515						pagination_disable_scroll = container.attr('data-pagination-scroll'),
7516						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7517
7518					if ( pagination_disable_scroll !== 'disabled' ) {
7519						calc_scroll -= UNCODE.get_scroll_offset();
7520
7521						var menu_container = $('.menu-sticky');
7522						var menu = menu_container.find('.menu-container');
7523
7524						if (menu_container.length > 0 && menu.length > 0) {
7525							calc_scroll = calc_scroll - menu.outerHeight();
7526						}
7527
7528						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7529							delta = bodyTop - calc_scroll,
7530							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7531						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7532
7533						if ( !UNCODE.isFullPage ) {
7534							if (scrollSpeed == 0) {
7535								$('html, body').scrollTop(calc_scroll);
7536							} else {
7537								$('html, body').animate({
7538									scrollTop: calc_scroll
7539								},{
7540									easing: 'easeInOutQuad',
7541									duration: scrollSpeed,
7542									complete: function(){
7543										UNCODE.scrolling = false;
7544									}
7545								});
7546							}
7547						}
7548					}
7549				}
7550
7551				loadCssGrid($(this), true);
7552			});
7553		}
7554
7555		$filters.on('click', 'a.grid-nav-link', function(evt) {
7556			if ($(this).hasClass('no-grid-filter')) {
7557				return;
7558			}
7559			var $filter = $(this),
7560				filterContainer = $filter.closest('.cssgrid-filters'),
7561				filterValue = $filter.attr('data-filter'),
7562				containerSystem = $filter.closest('.cssgrid-system'),
7563				container = containerSystem.find($('.cssgrid-layout')),
7564				transitionDuration = containerSystem.data('transitionDuration'),
7565				delay = 300,
7566				filterItems = [],
7567				all_thumbs = container.find('.tmb-grid');
7568
7569			var filter_items = function(){
7570				if (filterValue !== undefined) {
7571					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7572						var parent = $(val).parent(),
7573							objTimeout = parent.data('objTimeout');
7574						if (objTimeout) {
7575							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7576							clearRequestTimeout(objTimeout);
7577						}
7578						if (transitionDuration == 0) {
7579							if ($(val).hasClass('animate_when_almost_visible')) {
7580								$(val).addClass('zoom-reverse').removeClass('start_animation');
7581							} else {
7582								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7583							}
7584						}
7585					});
7586					requestTimeout(function(){
7587						if ( filterValue == '*' ) {
7588							all_thumbs.show();
7589							all_thumbs.each(function(index, val) {
7590								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7591								filterItems.push($(this));
7592							});
7593						} else {
7594							all_thumbs.each(function() {
7595								var _tmb = $(this);
7596								if (_tmb.hasClass(filterValue)) {
7597									_tmb.show();
7598									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7599									filterItems.push(_tmb);
7600								} else {
7601									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7602									_tmb.hide();
7603								}
7604							});
7605						}
7606
7607						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7608
7609						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7610						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7611						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7612						if (lightboxElements.length) {
7613							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7614							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7615								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7616								if (typeof getLightbox === 'object') {
7617									getLightbox.refresh();
7618								} else {
7619									UNCODE.lightbox();
7620								}
7621							}
7622						}
7623						container.trigger('more-items-loaded');
7624						$(window).trigger('more-items-loaded');
7625						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7626					}, delay);
7627				} else {
7628					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7629						var parent = $(val).parent(),
7630							objTimeout = parent.data('objTimeout');
7631						if (objTimeout) {
7632							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7633							clearRequestTimeout(objTimeout);
7634						}
7635						if (transitionDuration == 0) {
7636							if ($(val).hasClass('animate_when_almost_visible')) {
7637								$(val).addClass('zoom-reverse').removeClass('start_animation');
7638							} else {
7639								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7640							}
7641						}
7642					});
7643					loadCssGrid($filter);
7644				}
7645			};
7646
7647			if (!$filter.hasClass('active')) {
7648				/** Scroll top with filtering */
7649				if (filterContainer.hasClass('filter-scroll')) {
7650                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7651                    calc_scroll -= UNCODE.get_scroll_offset();
7652
7653					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7654						delta = bodyTop - calc_scroll,
7655						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7656						filterTolerance = false,
7657						filter_timeout;
7658					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7659
7660					if ( !UNCODE.isFullPage ) {
7661						if (scrollSpeed == 0) {
7662							$('html, body').scrollTop(calc_scroll);
7663							UNCODE.scrolling = false;
7664							filter_items();
7665						} else {
7666
7667							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7668								filter_items();
7669								filterTolerance = true;
7670							}
7671
7672							$('html, body').animate({
7673								scrollTop: calc_scroll
7674							},{
7675								easing: 'easeInOutQuad',
7676								duration: scrollSpeed,
7677								complete: function(){
7678									UNCODE.scrolling = false;
7679									if ( !filterTolerance ) {
7680										filter_timeout = setTimeout(function(){
7681											clearTimeout(filter_timeout);
7682											filter_items();
7683										}, 200);
7684									}
7685								}
7686							});
7687						}
7688					}
7689				} else {
7690					filter_items();
7691				}
7692			}
7693			evt.preventDefault();
7694		});
7695
7696		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7697			var params = UNCODE.getURLParams(window.location);
7698			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7699
7700			UNCODE.lastURL = window.location.href;
7701
7702			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
7703				return;
7704			}
7705
7706			if (params.id === undefined) {
7707				$.each($('.cssgrid-system'), function(index, val) {
7708					loadCssGrid($(val));
7709				});
7710			} else {
7711				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7712					loadCssGrid($('#' + params.id));
7713				}
7714			}
7715		});
7716
7717		var loadCssGrid = function($href, $paginating) {
7718			var is_paginating = false;
7719
7720			if (undefined !== $paginating && $paginating) {
7721				var is_paginating = $paginating;
7722			}
7723
7724			var href = ($href.is("a") ? $href.attr('href') : location),
7725				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7726				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7727				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7728				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7729				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7730				cssgridId = cssgridSystem.attr('id');
7731			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7732				UNCODE.lastURL = href;
7733				history.pushState({
7734					myCSSgrid: true
7735				}, document.title, href);
7736			}
7737			cssgridWrapper.addClass('cssgrid-loading');
7738			if (is_paginating) {
7739				cssgridWrapper.addClass('grid-filtering');
7740			}
7741			$.ajax({
7742				url: href
7743			}).done(function(data) {
7744				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7745					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7746					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7747				requestTimeout(function() {
7748					cssgridContainer.html($resultItems);
7749					cssgridWrapper.removeClass('cssgrid-loading');
7750					cssgridWrapper.removeClass('grid-filtering');
7751					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7752					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7753					UNCODE.adaptive();
7754					if (SiteParameters.dynamic_srcset_active === '1') {
7755						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7756					}
7757					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7758						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7759						if (typeof getLightbox === 'object') {
7760							getLightbox.refresh();
7761						} else {
7762							UNCODE.lightbox();
7763						}
7764					}
7765					cssgridContainer.trigger('more-items-loaded');
7766					$(window).trigger('more-items-loaded');
7767					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7768				}, 300);
7769
7770				$('.pagination', cssgridFooter).remove();
7771				cssgridFooter.append($resultPagination);
7772
7773				if (cssgridResultCount.length > 0) {
7774					$('.woocommerce-result-count', cssgridResultCount).remove();
7775					cssgridResultCount.append($resultCount);
7776				}
7777			});
7778		};
7779
7780		$filters.each(function(i, buttonGroup) {
7781			var $buttonGroup = $(buttonGroup);
7782			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7783				$buttonGroup.find('.active').removeClass('active');
7784				$(this).addClass('active');
7785
7786			});
7787
7788			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7789				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7790				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7791			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7792				e.preventDefault();
7793				$cats_filters.slideToggle(400, 'easeInOutCirc');
7794			});
7795
7796		});
7797	};
7798};
7799
7800UNCODE.linearGrid = function(){
7801	$('.linear-wrapper').each(function(){
7802		var $wrap = $(this),
7803			$system = $wrap.closest('.linear-system'),
7804			$dragger = $('[data-dragger]', $system),
7805			$row = $wrap.closest('.vc_row[data-parent]'),
7806			_row = $row[0],
7807			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7808			vertical = $cont.hasClass('linear-or-vertical'),
7809			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7810			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7811			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7812			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7813			isInMenu = $wrap.closest('.megamenu-block-wrapper').length,
7814			isInViewport = false,
7815			isHover = false,
7816			init = false,
7817			stableHeight = UNCODE.wheight,
7818			wCont, hCont, docH, marqueeTL;
7819
7820		if ( ! $('.tmb', $cont).length ) {
7821			return;
7822		}
7823
7824		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7825		var dataX = dataSpeed;
7826
7827		dataSpeed += 5;
7828
7829		var checkLinearGridSize = function(){
7830			if ( !$wrap.is(':visible') )  {
7831				return;
7832			}
7833			$wrap.find('.cont-appended').remove();
7834
7835			if ( vertical ) {
7836				if ( ! SiteParameters.is_frontend_editor ) {
7837					hCont = $cont.outerHeight();
7838					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7839					if ( hCont < docH ) {
7840						var res = docH - hCont * 3,
7841							times = 2 * Math.round((res/hCont+1) / 2);
7842					}
7843					for ( var i = 0; i < times; i++ ) {
7844						var $cloneCont = $cont.clone(),
7845							$cloneCont2 = $cont.clone(),
7846							trans = ( (i+2) ) * 100;
7847						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7848						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7849						$cloneCont.find('a[data-lbox]').each(function(){
7850							var dataLbox = $(this).attr('data-lbox');
7851							$(this).attr('data-lbox', dataLbox + '_' + i);
7852						});
7853						$cloneCont.find('.wp-video-shortcode').each(function(){
7854							var thisID = $(this).attr('id');
7855							$(this).attr('id', thisID + '_' + i);
7856						});
7857						$cloneCont2.find('a[data-lbox]').each(function(){
7858							var dataLbox = $(this).attr('data-lbox');
7859							$(this).attr('data-lbox', dataLbox + '_2' + i);
7860						});
7861						$cloneCont2.find('.wp-video-shortcode').each(function(){
7862							var thisID = $(this).attr('id');
7863							$(this).attr('id', thisID + '__' + i);
7864						});
7865						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7866							UNCODE.lightgallery($cloneCont);
7867							UNCODE.lightgallery($cloneCont2);
7868						}
7869					}
7870                }
7871			} else {
7872				wCont = $cont.outerWidth();
7873				if ( (wCont) < UNCODE.wwidth*2 ) {
7874					var res = UNCODE.wwidth*2 - (wCont),
7875						times = 2 * Math.round((res/wCont+1) / 2);
7876				}
7877				for ( var i = 0; i < times; i++ ) {
7878					var $cloneCont = $cont.clone(),
7879						$cloneCont2 = $cont.clone(),
7880						trans = ( (i+2) ) * 100;
7881					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7882					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7883					$cloneCont.find('a[data-lbox]').each(function(){
7884						var dataLbox = $(this).attr('data-lbox');
7885						$(this).attr('data-lbox', dataLbox + '_' + i);
7886					});
7887					$cloneCont.find('[id]').each(function(){
7888						var thisID = $(this).attr('id');
7889						$(this).attr('id', thisID + '_' + i);
7890					});
7891					$cloneCont2.find('a[data-lbox]').each(function(){
7892						var dataLbox = $(this).attr('data-lbox');
7893						$(this).attr('data-lbox', dataLbox + '_2' + i);
7894					});
7895					$cloneCont2.find('[id]').each(function(){
7896						var thisID = $(this).attr('id');
7897						$(this).attr('id', thisID + '__' + i);
7898					});
7899                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
7900                        UNCODE.lightgallery($cloneCont);
7901                        UNCODE.lightgallery($cloneCont2);
7902                    }
7903                }
7904			}
7905		};
7906		if ( clone ) {
7907			checkLinearGridSize();
7908			$(window).on('resize.linearGrid', function(){
7909				checkLinearGridSize();
7910			});
7911		}
7912
7913		var continuousLinearMarquee = function(_xStrt){
7914			if ( !$wrap.is(':visible') )  {
7915				return;
7916			}
7917			var ease = 'none';
7918			wCont = $cont.outerWidth();
7919			hCont = $cont.outerHeight();
7920
7921			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
7922				xEnd = vertical ? hCont : wCont,
7923				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7924				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
7925				speedSlow = (xEnd + xStrt) / 45,
7926				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7927
7928			marqueeTL = new TimelineMax({paused:true, reversed:true});
7929
7930			if ( (isInViewport && !isHover && !freezed) || isInMenu ) {
7931				marqueeTL.play();
7932
7933				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
7934					var $column = $wrap.closest('.wpb_column'),
7935						$col_link = $('.col-link', $column),
7936						$hover_sel = $wrap;
7937
7938					if ( $col_link.length ) {
7939						$hover_sel = $wrap.add($column);
7940					}
7941
7942					$hover_sel.on('mouseover', function(){
7943						if ( $wrap.attr('data-hover') === 'yes' ) {
7944							//speed = ( 10 - dataSpeed ) * 5;
7945							ease = 'power2.out';
7946							marqueeTL.duration( speedSlow );
7947						} else {
7948							marqueeTL.pause();
7949						}
7950						isHover = true;
7951					}).on('mouseout', function(){
7952						if ( $wrap.attr('data-hover') === 'yes' ) {
7953							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
7954							ease = 'power2.in';
7955							marqueeTL.duration( speed );
7956						} else {
7957							marqueeTL.play();
7958						}
7959						isHover = false;
7960					});
7961				}
7962
7963				$(document).on('sub-menu-slide-up', function(){
7964					if ( isInMenu ) {
7965						marqueeTL.pause();
7966					}
7967				});
7968
7969			}
7970	
7971			gsap.killTweensOf($wrap);
7972			if ( vertical ) {
7973				marqueeTL.fromTo( $wrap, {
7974					y: xStrt * direction
7975				},
7976				{
7977					duration: speed,
7978					y: xEnd * direction * -1,
7979					onComplete: function(){
7980						continuousLinearMarquee();
7981					},
7982					ease: ease,
7983					paused: freezed
7984				});
7985			} else {
7986				marqueeTL.fromTo( $wrap, {
7987					x: xStrt * direction
7988				},
7989				{
7990					duration: speed,
7991					x: xEnd * direction * -1,
7992					onComplete: function(){
7993						continuousLinearMarquee();
7994					},
7995					ease: ease,
7996					paused: freezed
7997				});
7998			}
7999		};
8000
8001		var dragLinearContinuous = function(){
8002			if ( !$wrap.is(':visible') )  {
8003				return;
8004			}
8005			var matrix, _x, _y,
8006				dragAction = false;
8007			Draggable.create($wrap[0], {
8008				type: vertical ? "y" : "x",
8009				bounds: document.getElementById("container"),
8010				inertia: false,
8011				onPress: function (e) {
8012				},
8013				onRelease: function (e) {
8014					if ( dragAction === true ) {
8015						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8016						_x = matrix[12] || matrix[4];
8017						_y = matrix[13] || matrix[5];
8018						if ( vertical ) {
8019							continuousLinearMarquee(_y * -1);
8020						} else {
8021							continuousLinearMarquee(_x * -1);
8022						}
8023						$wrap.removeClass('linear-dragging');
8024					}
8025				},
8026				onDrag: function (e) {
8027					dragAction = true;
8028					$wrap.addClass('linear-dragging');
8029				},
8030				onDragEnd: function (e) {
8031					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8032					_x = matrix[12] || matrix[4];
8033					_y = matrix[13] || matrix[5];
8034					wCont = $cont.outerWidth();
8035					hCont = $cont.outerHeight();
8036					if ( vertical ) {
8037						if ( Math.abs(_y) > hCont ) {
8038							if ( _y < 0 ) {
8039								_y = hCont + parseFloat( _y );
8040							} else {
8041								_y = parseFloat( _y ) - hCont;
8042							}
8043						}
8044						continuousLinearMarquee(_y * -1);
8045					} else {
8046						if ( Math.abs(_x) > wCont ) {
8047							if ( _x < 0 ) {
8048								_x = wCont + parseFloat( _x );
8049							} else {
8050								_x = parseFloat( _x ) - wCont;
8051							}
8052						}
8053						continuousLinearMarquee(_x * -1);
8054					}
8055					$wrap.removeClass('linear-dragging');
8056					dragAction = false;
8057				},
8058			});
8059		};
8060
8061		var runScrollLinear = function(){
8062			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
8063			if ( (!$wrap.is(':visible') || freezed) )  {
8064				return;
8065			}
8066			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
8067				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
8068			
8069			var linearGridScroll = function(){
8070				if ( isInViewport ) {
8071					var bound = _row.getBoundingClientRect();
8072
8073					var bound_top = bound.top,
8074						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
8075
8076					if ( vertical ) {
8077						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8078					} else {
8079						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8080					}
8081					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8082						requestAnimationFrame(linearGridScroll);
8083					}
8084				}
8085				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
8086					window.addEventListener("scroll", linearGridScroll);
8087				}
8088			};
8089
8090			$(window).on( 'load wwResize', function(e) {
8091				stableHeight = UNCODE.wheight;
8092				linearGridScroll();
8093			});
8094			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8095				requestAnimationFrame(linearGridScroll);
8096			}
8097		};
8098		
8099		var dragLinear = function(){
8100			if ( !$wrap.is(':visible') )  {
8101				return;
8102			}
8103			var matrix, _x, _y;
8104			Draggable.create($dragger[0], {
8105				type: vertical ? "y" : "x",
8106				bounds: document.getElementById("container"),
8107				inertia: false,
8108				onPress: function (e) {
8109				},
8110				onRelease: function (e) {
8111				},
8112				onDrag: function (e) {
8113					$wrap.addClass('linear-dragging');
8114				},
8115				onDragEnd: function (e) {
8116					matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8117					_x = matrix[12] || matrix[4];
8118					_y = matrix[13] || matrix[5];
8119					wCont = $cont.outerWidth();
8120					hCont = $cont.outerHeight();
8121					if ( vertical ) {
8122						if ( Math.abs(_y) > hCont ) {
8123							if ( _y < 0 ) {
8124								_y = hCont + parseFloat( _y );
8125							} else {
8126								_y = parseFloat( _y ) - hCont;
8127							}
8128							gsap.to( $dragger[0], {
8129								duration: 0,
8130								y: _y,
8131							});
8132						}
8133					} else {
8134						if ( Math.abs(_x) > wCont ) {
8135							if ( _x < 0 ) {
8136								_x = wCont + parseFloat( _x );
8137							} else {
8138								_x = parseFloat( _x ) - wCont;
8139							}
8140							gsap.to( $dragger[0], {
8141								duration: 0,
8142								x: _x,
8143							});
8144						}
8145					}
8146					$wrap.removeClass('linear-dragging');
8147				},
8148			});
8149		};
8150
8151		if ( ! $('body').hasClass('compose-mode') ) {
8152			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
8153				continuousLinearMarquee();
8154				$(window).on( 'wwResize', function(e) {
8155					continuousLinearMarquee();
8156				});	
8157				$(document).on('sub-menu-slide-down', function(){
8158					if ( isInMenu ) {
8159						continuousLinearMarquee();
8160					}
8161				});
8162				if ( $wrap.attr('data-draggable') === 'yes' ) {
8163					dragLinearContinuous();
8164				}
8165			}
8166
8167			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8168				runScrollLinear();
8169				if ( $wrap.attr('data-draggable') === 'yes' ) {
8170					dragLinear();
8171				}
8172			}
8173
8174			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8175				var observer = new IntersectionObserver(function(entries) {
8176						
8177					entries.forEach(function(entry){
8178						if ( entry.isIntersecting ) {
8179							isInViewport = true;
8180							if ( !init ) {
8181								init = true;
8182								continuousLinearMarquee();
8183							} else {
8184								if ( typeof marqueeTL !== 'undefined' ) {
8185									marqueeTL.play();
8186								}
8187							}
8188							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8189								requestAnimFrame(runScrollLinear);
8190							}
8191						} else {
8192							isInViewport = false;
8193							if ( typeof marqueeTL !== 'undefined' ) {
8194								marqueeTL.pause();
8195							}
8196						}
8197					});
8198				}, { 
8199					root: document,
8200				});
8201
8202				observer.observe(_row);
8203
8204			} else {
8205
8206				var checkVisible = function( el, off ) {
8207					if (typeof jQuery === "function" && el instanceof jQuery) {
8208						el = el[0];
8209					}
8210			
8211					off = typeof off=='undefined' ? 50 : off;
8212			
8213					var rect = el.getBoundingClientRect();
8214			
8215					return (
8216						(
8217							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8218							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8219							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8220						)
8221					);
8222				};
8223				
8224				var checkVisibility = function(){
8225
8226					if ( checkVisible($row) ) {
8227						isInViewport = true;
8228						if ( typeof marqueeTL !== 'undefined' ) {
8229							marqueeTL.play();
8230						}
8231					} else {
8232						isInViewport = false;
8233						if ( typeof marqueeTL !== 'undefined' ) {
8234							marqueeTL.pause();
8235						}
8236					}
8237				}
8238
8239				window.addEventListener("scroll", checkVisibility);
8240				checkVisibility();
8241
8242			}
8243		}
8244	});
8245};
8246UNCODE.preventDoubleTransition = function() {
8247	$('.sticky-element .animate_when_almost_visible').each(function(){
8248		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
8249			$el.addClass('do_not_reanimate');
8250		});
8251	});
8252};
8253
8254UNCODE.checkScrollForTabs = function(){
8255	var goToSection = window.location.hash.replace('#', ''),
8256		$index;
8257
8258	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
8259	goToSection = encodeURIComponent(goToSection);
8260	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
8261
8262	$index.attr('data-parent', 'parent-' + goToSection);
8263
8264	if (window.location.hash != undefined && window.location.hash != '') {
8265		requestTimeout(function() {
8266			scrollBody('parent-' + goToSection);
8267		}, 500);
8268	}
8269
8270	$('.page-body a[href^="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
8271		var hash = (e.currentTarget).hash;
8272		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
8273			$('a[href="' + hash + '"][data-tab-history]').click();
8274			scrollBody(hash);
8275		}
8276	});
8277
8278	var scrollBody = function(index) {
8279
8280		var getSection = $('a[href="' + index + '"][data-tab-history]'),
8281			scrollTo,
8282			safeGap = 27;
8283
8284		if ( ! getSection.length ) {
8285			getSection = $('div[data-parent="' + index + '"]');
8286
8287			if ( getSection.attr('data-target') == 'row' ) {
8288				getSection = getSection.closest('.vc_row');
8289				safeGap = 0;
8290			}
8291		}
8292
8293		if (typeof getSection === 'undefined' || ! getSection.length ) {
8294			return;
8295		}
8296
8297		var body = $("html, body"),
8298		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
8299		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
8300		getOffset = UNCODE.get_scroll_offset();
8301		if ( typeof getSection.offset() === 'undefined' )
8302			return;
8303		scrollTo = getSection.offset().top - safeGap;
8304		scrollTo -= getOffset;
8305
8306		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
8307		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
8308
8309		if (index != 0) {
8310			UNCODE.scrolling = true;
8311		}
8312
8313		if (scrollSpeed == 0) {
8314			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
8315			UNCODE.scrolling = false;
8316		} else {
8317			body.animate({
8318				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
8319			}, scrollSpeed, 'easeInOutQuad', function() {
8320				requestTimeout(function() {
8321					UNCODE.scrolling = false;
8322					if (getOffset != UNCODE.get_scroll_offset()) {
8323						scrollBody(index);
8324					}
8325				}, 100);
8326			});
8327		}
8328
8329	};
8330};
8331
8332UNCODE.printScreen = function() {
8333	var inlineMediaStyle = null,
8334		setResize;
8335
8336    function changeMediaStyle() {
8337		clearRequestTimeout(setResize);
8338		setResize = requestTimeout(function(){
8339	        var $head = document.getElementsByTagName('head')[0],
8340	        	$newStyle = document.createElement('style'),
8341	        	winW = window.innerWidth,
8342	        	printH = window.innerHeight;
8343
8344	        $newStyle.setAttribute('type', 'text/css');
8345	        $newStyle.setAttribute('media', 'print');
8346	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
8347
8348	        if (inlineMediaStyle != null) {
8349	            $head.replaceChild($newStyle, inlineMediaStyle)
8350	        } else {
8351	            $head.appendChild($newStyle);
8352	        }
8353	        inlineMediaStyle = $newStyle;
8354	    }, 1000);
8355    }
8356
8357    changeMediaStyle();
8358    window.addEventListener('resize', changeMediaStyle);
8359};
8360
8361UNCODE.fullPage = function() {
8362	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
8363		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
8364		return false;
8365	} else {
8366		requestTimeout(function() {
8367			window.scrollTo(0, 0);
8368		}, 10);
8369	}
8370
8371	var $masthead = $('#masthead'),
8372		$logo = $('#logo-container-mobile'),
8373		$logolink = $('[data-minheight]', $logo),
8374		logoMinScale = $logolink.data('minheight'),
8375		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
8376		$container = $('.main-container .post-content'),
8377		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
8378		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
8379		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
8380		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
8381		headerWithOpacity = $('.header-scroll-opacity', $header).length,
8382		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
8383		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
8384		scrollBar = true,
8385		effect,
8386		animationEndTimeOut,
8387		fp_anim_time = 900,
8388		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
8389		is_scrolling = false,
8390		dataNames = [],
8391		is_first = true,
8392		no_history = $('body').hasClass('uncode-scroll-no-history'),
8393		theres_footer = true;
8394
8395	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
8396		$('> div', $footer).each(function(index, el){
8397			if ( $(el).outerHeight() < 2 )
8398				theres_footer = false;
8399			else
8400				theres_footer = true;
8401		});
8402	}
8403
8404	if ( !$footer.length )
8405		theres_footer = false;
8406
8407	if ( !UNCODE.isFullPageSnap ) {
8408
8409		if ( $('body').hasClass('uncode-fullpage-zoom') )
8410			effect = 'scaleDown';
8411		else if ( $('body').hasClass('uncode-fullpage-parallax') )
8412			effect = 'moveparallax';
8413		else
8414			effect = 'movecurtain';
8415	}
8416
8417	if ( $('body').hasClass('uncode-fullpage-trid') )
8418		fp_anim_time = fp_anim_time*2;
8419
8420	if ( $header.length ) {
8421		if ( headerName !== '' )
8422			$header.attr('data-name', headerName);
8423		if ( headerLabel !== '' )
8424			$header.attr('data-label', headerLabel);
8425		$container.prepend($header);
8426	}
8427	if ( theres_footer ) {
8428		$container.append($footer);
8429		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
8430		$('aside.widget ul', $footer).addClass('no-list');
8431	}
8432
8433	var $all = $rows.add($header);
8434
8435	if ( theres_footer )
8436		$all = $all.add($footer);
8437
8438	$all.each(function(index, row) {
8439		if( index === 0 )
8440			$(row).addClass('uncode-scroll-active');
8441	});
8442
8443    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
8444
8445	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
8446		$("<ul class='onepage-pagination'></ul>").prependTo("body");
8447	}
8448
8449	$all.each(function(index, val) {
8450		var getName = $(val).data('name'),
8451			label;
8452
8453		if (typeof getName == 'undefined' || getName == 'undefined')
8454			getName = SiteParameters.slide_name + '-' + index;
8455
8456		//if ( dataNames.includes(getName) ) {
8457		if ( dataNames.indexOf(getName) > 0 ) {
8458			getName += '_' + index;
8459			$(val).data('name', getName);
8460		}
8461
8462		dataNames.push(getName);
8463
8464		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
8465
8466		if (typeof $(val).attr('data-label') !== 'undefined')
8467			label = $(val).attr('data-label');
8468		else label = '';
8469
8470		if ( $(val).is($footer) )
8471			return;
8472
8473		if (label != '' ) {
8474			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
8475			$('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>");
8476		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
8477			$('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>");
8478		}
8479	});
8480
8481	var checkVisible = function( el, off ) {
8482		if (typeof jQuery === "function" && el instanceof jQuery) {
8483			el = el[0];
8484		}
8485
8486		off = typeof off=='undefined' ? 50 : off;
8487
8488		var rect = el.getBoundingClientRect();
8489
8490		return (
8491			(
8492				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8493				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8494				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8495			)
8496		);
8497	};
8498
8499	var animationEndAction = function( index, nextIndex ) {
8500		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8501			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8502			player, iframe;
8503
8504		if ( !$nextSlide.is($footer) ) {
8505			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
8506		}
8507
8508		if ( !UNCODE.isFullPageSnap ) {
8509			activateKBurns( nextIndex );
8510		}
8511
8512		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8513			if ($(this).attr('data-provider') == 'vimeo') {
8514				iframe = $(this).find('iframe');
8515				player = new Vimeo.Player(iframe[0]);
8516				player.pause();
8517			} else if ($(this).attr('data-provider') == 'youtube') {
8518				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8519			} else {
8520				if ($(this).is('video')) {
8521					$(this)[0].volume = 0;
8522					$(this)[0].pause();
8523				}
8524			}
8525		});
8526
8527		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8528			if ( $nextSlide.is($header) )
8529				$header.removeClass('header-scrolled');
8530		}
8531
8532		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
8533		$otherEl.each(function(){
8534			var $otherThis = $(this),
8535				$bgwrapperOther = $('.background-inner', $otherThis);
8536			if ( !checkVisible($otherThis) )
8537				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
8538
8539		});
8540
8541		if ( !checkVisible($currentSlide) ) {
8542			$currentSlide.removeClass('uncode-scroll-visible');
8543			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
8544			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
8545				currentScroll.scrollTo(0, 0, 0);
8546		}
8547
8548		clearRequestTimeout(animationEndTimeOut);
8549		animationEndTimeOut = requestTimeout(function(){
8550			Waypoint.refreshAll();
8551			$( document.body ).trigger('uncode_waypoints');
8552			var eventFP = new CustomEvent('fp-slide-changed');
8553			window.dispatchEvent(eventFP);
8554			is_scrolling = false;
8555
8556			if ( is_first ) {
8557				$('ul.onepage-pagination a').removeClass('is-selected');
8558				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8559				is_first = false;
8560			}
8561
8562		}, 500);
8563	};
8564
8565	var postLeaveActions = function( nextIndex ){
8566		if ( menuHidden && ! UNCODE.isMobile )
8567			return false;
8568
8569		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8570			$cols = $('.uncol', $el),
8571			anchor = $el.data('anchor');
8572
8573		if ( ! UNCODE.isFullPageSnap ) {
8574			$.each($cols, function(index, val){
8575				if ( $(val).hasClass('style-light') ){
8576					$masthead.removeClass('style-dark-override').addClass('style-light-override');
8577					return false;
8578				} else if ( $(val).hasClass('style-dark') ) {
8579					$masthead.removeClass('style-light-override').addClass('style-dark-override');
8580					return false;
8581				}
8582			});
8583		}
8584
8585		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
8586			$('.menu-item' ).removeClass('active');
8587			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8588		}
8589
8590		if ( !UNCODE.isFullPageSnap ) {
8591			activateBackWash( nextIndex );
8592		}
8593	};
8594
8595	var activateBackWash = function( nextIndex ){
8596		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8597			$bgwrapper;
8598
8599		if ( $el.length ) {
8600			if ( $el.hasClass('with-zoomout') ) {
8601				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8602			} else if ( $('.with-zoomout', $el).length ) {
8603				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
8604			} else {
8605				return false;
8606			}
8607		} else {
8608			return false;
8609		}
8610
8611		$bgwrapper.addClass('uncode-zoomout');
8612
8613	};
8614
8615	var activateKBurns = function( nextIndex ){
8616		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8617			$bgwrapper;
8618
8619		if ( $el.length ) {
8620			if ( $el.hasClass('with-kburns') ) {
8621				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8622			} else if ( $('.with-kburns', $el).length ) {
8623				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
8624			} else {
8625				return false;
8626			}
8627		} else {
8628			return false;
8629		}
8630
8631		$bgwrapper.addClass('uncode-kburns');
8632
8633	};
8634
8635	var activateParallax = function( nextIndex, direction ){
8636
8637		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8638			$cell = $('.fp-tableCell', $el),
8639			animationEnd = 'webkitAnimationEnd animationend',
8640			cellAnim;
8641
8642		switch( direction ) {
8643			case 'up':
8644				cellAnim = 'moveFromTopInner';
8645				break;
8646			default:
8647				cellAnim = 'moveFromBottomInner';
8648		}
8649
8650		$cell.css({
8651			'animation-name': cellAnim,
8652			'animation-duration': fp_anim_time + 'ms',
8653			'animation-delay': '',
8654			'animation-timing-function': fp_easing,
8655			'animation-fill-mode': 'both',
8656		}).off(animationEnd)
8657		.on(animationEnd, function(event) {
8658			if ( event.originalEvent.animationName === cellAnim ) {
8659				$cell
8660					.css({
8661						'animation-name': '',
8662						'animation-duration': '',
8663						'animation-delay': '',
8664						'animation-timing-function': '',
8665						'animation-fill-mode': '',
8666					});
8667			}
8668		});
8669	};
8670
8671	var scrollHashes = function(){
8672		var hash = window.location.hash.replace('#', '').split('/'),
8673			hashInd;
8674		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
8675			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
8676				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
8677				$.fn.fullpage.moveTo(hashInd+1);
8678			}
8679		} else if( hash[0] === '' ) {
8680			$.fn.fullpage.moveTo(1);
8681		}
8682	};
8683
8684	var hideMenu = function( index, nextIndex ){
8685		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
8686			return false;
8687
8688		var hMenu = UNCODE.menuHeight,
8689			transTime = hMenu * 2;
8690
8691		if ( index === 1 && nextIndex > 1 ) {
8692			hMenu = hMenu * -1;
8693		} else if  ( index !== 1 && nextIndex === 1 ) {
8694			hMenu = 0;
8695		} else {
8696			return false;
8697		}
8698
8699		$masthead.css({
8700			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8701			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8702			'-webkit-transition': 'transform 0.5s ease-in-out',
8703			'transition': 'transform 0.5s ease-in-out'
8704		});
8705	};
8706
8707	var shrinkMenu = function( index, nextIndex ){
8708		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
8709			return false;
8710
8711		if ( index === 1 && nextIndex > 1 ) {
8712			$logo.addClass('shrinked');
8713			$('div', $logo).each(function(index, val){
8714				$(val).css({
8715					'height': logoMinScale,
8716					'line-height': logoMinScale
8717				});
8718				if ($(val).hasClass('text-logo')) {
8719					$(val).css({
8720						'font-size': logoMinScale + 'px'
8721					});
8722				}
8723			});
8724			requestTimeout(function() {
8725				UNCODE.menuMobileHeight = $masthead.outerHeight();
8726			}, 300);
8727		} else if ( index !== 1 && nextIndex === 1 ) {
8728			$logo.removeClass('shrinked');
8729			$('div', $logo).each(function(index, val){
8730				$(val).css({
8731					'height': logoMaxScale,
8732					'line-height': logoMaxScale
8733				});
8734				if ($(val).hasClass('text-logo')) {
8735					$(val).css({
8736						'font-size': logoMaxScale + 'px'
8737					});
8738				}
8739			});
8740			requestTimeout(function() {
8741				UNCODE.menuMobileHeight = $masthead.outerHeight();
8742			}, 300);
8743		} else {
8744			return false;
8745		}
8746
8747	};
8748
8749	var anchorLink = function(){
8750
8751		$container.add('.menu-item').find('a[href*="#"]').on('click', function(e) {
8752			var $this = $(e.currentTarget),
8753				hash = e.currentTarget.href.split('#'),
8754				current = window.location.href.split('#'),
8755				ind,
8756				currentMenuOpened = UNCODE.menuOpened,
8757				go = false;
8758
8759			var hash_url = hash[0].replace(/\/?$/, '/'),
8760				current_url = current[0].replace(/\/?$/, '/');
8761
8762			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
8763				hash = '#'+hash[1];
8764				e.preventDefault();
8765				go = true;
8766			}
8767
8768			if ( go ) {
8769
8770				if ( $(hash).length ) {
8771					ind = $(hash).closest('.fp-section').index();
8772				} else {
8773					hash = hash.slice(1);
8774					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
8775				}
8776
8777				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
8778					ind = $this.closest('.fp-section').index();
8779
8780				UNCODE.menuOpened = false;
8781
8782				$.fn.fullpage.moveTo(ind+1);
8783
8784				UNCODE.menuOpened = currentMenuOpened;
8785				if (UNCODE.menuOpened) {
8786					if (UNCODE.wwidth < UNCODE.mediaQuery) {
8787						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
8788					} else {
8789						$('.mmb-container-overlay .overlay-close').trigger('click');
8790						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
8791					}
8792				}
8793
8794			}
8795
8796		});
8797
8798		$('.header-scrolldown').on('click', function(event) {
8799			event.preventDefault();
8800			var scrollDown = $(this),
8801				ind = scrollDown.closest('.fp-section').index();
8802
8803			$.fn.fullpage.moveTo(ind+2);
8804		});
8805
8806		var anchor = $('.fp-section.active').data('anchor');
8807
8808		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
8809			$('.menu-item').removeClass('active');
8810			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8811		}
8812
8813	};
8814
8815	var slideLeave = function( index, nextIndex, direction ) {
8816		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8817			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8818			animationEnd = 'webkitAnimationEnd animationend',
8819			transitionEnd = 'webkitTransitionEnd transitionend',
8820			animOut = effect != 'scaleDown' ? effect + direction : effect,
8821			animIn,
8822			isFooter = false,
8823			isFooterNext = false,
8824			footerH = $footer.outerHeight(),
8825			timeout,
8826			player, iframe,
8827			footerCoeff;
8828		switch( direction ) {
8829			case 'up':
8830				animIn = 'moveFromTop';
8831				break;
8832			default:
8833				animIn = 'moveFromBottom';
8834		}
8835
8836		if ( $('body').hasClass('uncode-fullpage-trid') ) {
8837			animOut = animIn + 'trid';
8838			animIn = animOut + 'In';
8839		} else if ( UNCODE.isFullPageSnap ) {
8840			animIn = animOut = 'none';
8841		}
8842
8843		hideMenu(index, nextIndex);
8844		shrinkMenu(index, nextIndex);
8845
8846		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8847			if ($(this).attr('data-provider') == 'vimeo') {
8848				iframe = $(this).find('iframe');
8849				player = new Vimeo.Player(iframe[0]);
8850				player.pause();
8851			} else if ($(this).attr('data-provider') == 'youtube') {
8852				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8853			} else {
8854				if ($(this).is('video')) {
8855					$(this)[0].volume = 0;
8856					$(this)[0].pause();
8857				}
8858			}
8859		});
8860
8861		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
8862			if ($(this).attr('data-provider') == 'vimeo') {
8863				iframe = $(this).find('iframe');
8864				iframe.on('load', function(){
8865					player = new Vimeo.Player(iframe);
8866					player.setVolume(0);
8867					player.play();
8868				});
8869				player = new Vimeo.Player(iframe);
8870				player.setVolume(0);
8871				player.play();
8872			} else if ($(this).attr('data-provider') == 'youtube') {
8873				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
8874			} else {
8875				if ($(this).is('video')) {
8876					$(this)[0].volume = 0;
8877					$(this)[0].play();
8878				}
8879			}
8880		});
8881
8882		if ( $currentSlide.is($footer) )
8883			isFooter = true;
8884
8885		if ( $nextSlide.is($footer) )
8886			isFooterNext = true;
8887
8888		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8889			if ( $currentSlide.is($header) )
8890				$header.addClass('header-scrolled');
8891		}
8892
8893		footerCoeff = footerH;
8894
8895		if ( UNCODE.isFullPageSnap ) {
8896			postLeaveActions( nextIndex );
8897			activateBackWash( nextIndex );
8898			activateKBurns( nextIndex );
8899			requestTimeout(function(){
8900				animationEndAction( index, nextIndex );
8901			}, fp_anim_time+150);
8902		} else {
8903			if ( isFooterNext ) {
8904
8905				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
8906				$iscrollWrapper.addClass('no-scrolloverflow');
8907
8908				$nextSlide
8909				.add($currentSlide)
8910				.addClass('uncode-scroll-front')
8911				.addClass('uncode-scroll-active')
8912				.addClass('uncode-scroll-visible');
8913				$container.css({
8914					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8915					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8916					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8917					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8918				}).off(transitionEnd)
8919				.one(transitionEnd, function(){
8920					animationEndAction( index, nextIndex );
8921				});
8922
8923			} else if ( isFooter ) {
8924
8925				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
8926				.add($currentSlide)
8927				.addClass('uncode-scroll-front')
8928				.addClass('uncode-scroll-active')
8929				.addClass('uncode-scroll-visible');
8930				$container.css({
8931					'-webkit-transform': 'translate3d(0, 0, 0)',
8932					'transform': 'translate3d(0, 0, 0)',
8933					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8934					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8935				})
8936				.one(transitionEnd, function(){
8937					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
8938						clearRequestTimeout(timeout);
8939						timeout = requestTimeout(function(){
8940							$.fn.fullpage.moveTo(nextIndex);
8941							slideLeave( index-1, nextIndex, 'up' );
8942							$container.off(transitionEnd);
8943						}, 50);
8944					}
8945					animationEndAction( index, nextIndex );
8946				});
8947
8948			} else {
8949
8950				postLeaveActions( nextIndex );
8951
8952				if ( !$('body').hasClass('uncode-fullpage-trid') )
8953					activateParallax( nextIndex, direction );
8954
8955				var $outBg = $('.background-wrapper', $currentSlide);
8956
8957				$nextSlide
8958				.addClass('uncode-scroll-front')
8959				.addClass('uncode-scroll-active')
8960				.addClass('uncode-scroll-visible')
8961				.addClass('uncode-scroll-animating-in')
8962				.css({
8963					'z-index':4,
8964					'animation-name': animIn,
8965					'animation-duration': fp_anim_time + 'ms',
8966					'animation-delay': '',
8967					'animation-timing-function': fp_easing,
8968					'animation-fill-mode': 'both',
8969					'transition': 'initial',
8970				}).off(animationEnd)
8971				.on(animationEnd, function(event) {
8972					if ( event.originalEvent.animationName === animIn ) {
8973						$(this)
8974							.addClass('uncode-scroll-already')
8975							.removeClass('uncode-scroll-front')
8976							.removeClass('uncode-scroll-animating-in')
8977							.css({
8978								'animation-name': '',
8979								'animation-duration': '',
8980								'animation-delay': '',
8981								'animation-timing-function': '',
8982								'animation-fill-mode': '',
8983								'transition': 'initial',
8984							});
8985
8986						$currentSlide
8987							.removeClass('uncode-scroll-active')
8988							.add($outBg)
8989							.css({
8990								'animation-name': '',
8991								'animation-duration': '',
8992								'animation-delay': '',
8993								'animation-timing-function': '',
8994								'animation-fill-mode': '',
8995								'transition': 'initial',
8996							});
8997
8998						animationEndAction( index, nextIndex );
8999
9000					}
9001
9002					if ( nextIndex > 1 )
9003						$('body').addClass('window-scrolled');
9004					else
9005						$('body').removeClass('window-scrolled');
9006				});
9007
9008				$currentSlide
9009					.addClass('uncode-scroll-animating-out')
9010					.removeClass('uncode-scroll-front')
9011					.css({
9012						'z-index':'1',
9013						'animation-name': animOut,
9014						'animation-duration': fp_anim_time + 'ms',
9015						'animation-delay': '',
9016						'animation-timing-function': fp_easing,
9017						'animation-fill-mode': 'both',
9018						'transition': 'initial',
9019						'will-change': 'auto'
9020					}).off(animationEnd)
9021					.on(animationEnd, function(event) {
9022						if ( event.originalEvent.animationName === animOut ) {
9023							$currentSlide.removeClass('uncode-scroll-animating-out');
9024						}
9025					});
9026
9027				if ( $('body').hasClass('uncode-fp-opacity') ) {
9028					$currentSlide.find('> div').css({
9029						'animation-name': 'opacityout',
9030						'animation-duration': fp_anim_time + 'ms',
9031						'animation-delay': '',
9032						'animation-timing-function': fp_easing,
9033						'animation-fill-mode': 'both',
9034						'transition': 'initial',
9035					}).off(animationEnd)
9036					.on(animationEnd, function(event) {
9037						if ( event.originalEvent.animationName === 'opacityout' ) {
9038							$(event.currentTarget).css({
9039								'animation-name': '',
9040								'animation-duration': '',
9041								'animation-delay': '',
9042								'animation-timing-function': '',
9043								'animation-fill-mode': '',
9044								'transition': '',
9045							});
9046						}
9047					});
9048				}
9049			}
9050		}
9051
9052		$('.scroll-top').on('click', function(e){
9053			$.fn.fullpage.moveTo(1);
9054			return false;
9055		});
9056
9057	};
9058
9059	var init_fullPage = function(mode){
9060
9061		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
9062		// 	scrollBar = false;
9063		// }
9064
9065		var checkFPeffects;
9066
9067		$container.fullpage({
9068			sectionSelector: '.uncode-scroll-lock',
9069			scrollOverflow: true,
9070			scrollOverflowOptions: {
9071				click: false,
9072				preventDefaultException: { tagName:/.*/ }
9073			},
9074			normalScrollElements: ".masthead-vertical",
9075			navigation: false,
9076			scrollBar: scrollBar,
9077			scrollingSpeed: fp_anim_time,
9078			verticalCentered: true,
9079			anchors: no_history ? false : dataNames,
9080			recordHistory: !no_history,
9081			afterRender: function(){
9082				$('body').removeClass('fp-waiting');
9083				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
9084					var $invisible = $(this).addClass('hidden-scroll');//,
9085				});
9086				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
9087					var $visible = $(this).addClass('uncode-scroll-visible'),
9088						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
9089					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
9090				});
9091
9092				$('ul.onepage-pagination a').on('click', function(e){
9093					e.preventDefault();
9094					var $a = $(this),
9095						toIndex = $a.data('index');
9096
9097					$.fn.fullpage.moveTo(toIndex+1);
9098				});
9099
9100				requestTimeout(function(){
9101					scrollHashes();
9102				}, 1000);
9103
9104				$(window).on('hashchange', function(e){
9105					requestTimeout(function(){
9106						scrollHashes();
9107					}, 500);
9108				});
9109
9110				anchorLink();
9111
9112				if ( $('body').hasClass('uncode-fp-opacity') ) {
9113					$all.each(function(index, row) {
9114						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
9115							classBg;
9116
9117						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
9118							classBg = testmatch[0];
9119							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
9120						}
9121					});
9122				}
9123
9124				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
9125					$(window).on('menuOpen gdprOpen', function(){
9126						$.fn.fullpage.setAutoScrolling(false);
9127					}).on('menuClose gdprClose', function(){
9128						$.fn.fullpage.setAutoScrolling(true);
9129					});
9130				}
9131
9132				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
9133					requestTimeout(function(){
9134						$.fn.fullpage.setAutoScrolling(false);
9135					}, 1000);
9136				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
9137					$.fn.fullpage.setAutoScrolling(true);
9138				});
9139
9140				if ( !UNCODE.isFullPageSnap ) {
9141					clearRequestTimeout(checkFPeffects);
9142					checkFPeffects = requestTimeout(function(){
9143						activateBackWash( 1 );
9144						activateKBurns( 1 );
9145					}, 100);
9146				}
9147
9148			},
9149			onLeave: function( index, nextIndex, direction ){
9150
9151				if ( UNCODE.menuOpened || is_scrolling )
9152					return false;
9153
9154				is_scrolling = true;
9155
9156				var event = new CustomEvent('fp-slide-leave');
9157				window.dispatchEvent(event);
9158
9159				slideLeave( index, nextIndex, direction );
9160
9161				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
9162					if ( direction === 'up' ) {
9163						$.fn.fullpage.moveTo(nextIndex-1);
9164					} else {
9165						$.fn.fullpage.moveTo(nextIndex+1);
9166					}
9167					return false;
9168				}
9169
9170				$('ul.onepage-pagination a').removeClass('is-selected');
9171				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
9172
9173			}
9174		});
9175	};
9176
9177	init_fullPage();
9178	$(window).on('load', function(){
9179		requestTimeout(function(){
9180			$.fn.fullpage.reBuild();
9181		}, 3000);
9182	});
9183
9184	var addScrollingClass,
9185		removeScrollingClass;
9186
9187	window.addEventListener("fp-slide-scroll", function(){
9188		addScrollingClass = requestTimeout( function(){
9189			$('body').addClass('fp-slide-scrolling');
9190		}, 10 );
9191
9192		clearRequestTimeout(removeScrollingClass);
9193		removeScrollingClass = requestTimeout( function(){
9194			$('body').removeClass('fp-slide-scrolling');
9195		}, 150 );
9196
9197		Waypoint.refreshAll();
9198	}, false);
9199
9200	var setFPheight = function(){
9201		var $body = document.body,
9202			$footer = document.getElementById('colophon'),
9203			$maincontainer = document.querySelector('.main-wrapper'),
9204			$boxcontainer = document.querySelector('.box-container'),
9205			$sections = document.querySelectorAll('.fp-section'),
9206			rect = $maincontainer.getBoundingClientRect(),
9207			rect2 = $boxcontainer.getBoundingClientRect(),
9208			$masthead = document.getElementById('masthead'),
9209			_hideMenu = false,
9210			menuHeight = UNCODE.menuHeight;
9211		$body.style.height = UNCODE.wheight + 'px';
9212
9213		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
9214			_hideMenu = true;
9215		}
9216		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
9217			menuHeight = 0
9218		}
9219
9220
9221		if ( theres_footer )
9222			$footer.style.top = (rect.height || rect2.height) + 'px';
9223
9224		for (var i = 0; i < $sections.length; i++) {
9225			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
9226		}
9227	};
9228
9229	setFPheight();
9230
9231	window.addEventListener('resize', setFPheight, false);
9232	window.addEventListener('orientationchange', setFPheight, false);
9233
9234};
9235
9236UNCODE.particles = function() {
9237	$(".vc-particles-background").each(function() {
9238		var $particle = $(this);
9239		var $parent = $particle.closest('[data-parent]');
9240
9241		$parent.prepend($particle);
9242		// $(window).trigger('resize');
9243	})
9244};
9245
9246
9247UNCODE.readMoreCol = function( $el ){
9248	if ( typeof $el === 'undefined' || $el === null ) {
9249		$el = $('body');
9250	}
9251	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
9252	$readMoreCols.each(function(){
9253		var $uncont = $(this),
9254			$row = $uncont.closest('.row-container'),
9255			max_h = $uncont.attr('data-ov-height'),
9256			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
9257			actual_max_h = $uncont.outerHeight(),
9258			inner_h,
9259			$read_more = $('+ .btn-more-wrap', $uncont),
9260			read_more_resize = $read_more.hasClass('trigger-resize'),
9261			marginClosedBtn = $uncont.attr('data-margin-closed'),
9262			marginClosed = 0,
9263			marginOpenBtn = $uncont.attr('data-margin-open'),
9264			marginOpen = 0,
9265			anim_t = 250,
9266			resized = false;
9267
9268		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
9269
9270		switch (marginClosedBtn) {
9271			case 'sm':
9272				marginClosed = 18
9273				break;
9274				
9275			case 'std':
9276				marginClosed = 36
9277				break;
9278				
9279			case 'lg':
9280				marginClosed = 72
9281				break;
9282				
9283			case '':
9284			default:
9285				marginClosed = 0
9286				break;
9287				
9288		}
9289
9290		switch (marginOpenBtn) {
9291			case 'sm':
9292				marginOpen = 18
9293				break;
9294				
9295			case 'std':
9296				marginOpen = 36
9297				break;
9298				
9299			case 'lg':
9300				marginOpen = 72
9301				break;
9302				
9303			case 'no':
9304				marginOpen = 0
9305				break;
9306				
9307		}
9308
9309		var checkToggleMobile = function(){
9310			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
9311				resized = true;
9312				if ( $read_more.hasClass('state-closed') ) {
9313					$uncont[0].style.height = '';
9314					$uncont[0].style.maxHeight = max_h_mobile;
9315				}
9316			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
9317				if ( $read_more.hasClass('state-closed') ) {
9318					$uncont[0].style.height = '';
9319					$uncont[0].style.maxHeight = max_h;
9320				}
9321				resized = false;
9322			}
9323		}
9324		checkToggleMobile();
9325		$(window).on('resize', function() {
9326			checkToggleMobile();
9327		});
9328
9329		$('a', $read_more).on('click', function(e){
9330			e.preventDefault();
9331
9332			var $a = $(this);
9333
9334			if ( $read_more.hasClass('state-closed') ) {
9335
9336				$read_more
9337					.removeClass('state-closed')
9338					.addClass('state-open');
9339
9340				$uncont.css({
9341					'max-height': 'none',
9342					'height': 'auto',
9343				});
9344	
9345				inner_h = parseFloat( $uncont.outerHeight() );
9346
9347				$uncont.css({
9348					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
9349				});
9350		
9351				anim_t = inner_h - actual_max_h;
9352				if ( anim_t < 250 ) {
9353					anim_t = 250;
9354				} else if ( anim_t > 1000 ) {
9355					anim_t = 1000;
9356				}
9357
9358				$uncont.css({
9359					'transition-duration' : anim_t + 'ms'
9360				}).addClass('overflow-mask-animation').animate({
9361					'height': inner_h
9362				}, anim_t, 'easeInOutCubic', function(){
9363					$uncont.css({
9364						'height' : 'auto'
9365					}).removeClass('overflow-mask');
9366					if ( read_more_resize === true ) {
9367						window.dispatchEvent(new Event('resize'));
9368						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
9369							ScrollTrigger.refresh(true);
9370						}
9371					}
9372				});
9373
9374				if ( marginOpen != '' ) {
9375					$read_more.animate({
9376						'margin-top' : marginOpen
9377					}, anim_t, 'easeInOutCubic');
9378				}
9379
9380			} else {
9381				$read_more
9382					.removeClass('state-open')
9383					.addClass('state-closed');
9384
9385				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
9386					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
9387				}, anim_t, 'easeInOutCubic', function(){
9388					if ( read_more_resize === true ) {
9389						window.dispatchEvent(new Event('resize'));
9390						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
9391							ScrollTrigger.refresh(true);
9392						}
9393					}
9394				});
9395
9396				if ( marginClosed !== '' ) {
9397					$read_more.animate({
9398						'margin-top' : marginClosed
9399					}, anim_t, 'easeInOutCubic');
9400				}
9401
9402				if ( $a.hasClass('toggle-scroll') ) {
9403                    var $masthead = $('#masthead > div:first-child'),
9404                        headH = $masthead.outerHeight(),
9405						rectTop = $row[0].getBoundingClientRect().top,
9406						checkNavBar = $a.hasClass('toggle-navbar'),
9407						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
9408                        offCont = ( $row.offset().top );
9409
9410					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
9411						checkNavBar = checkNavBarMobile;
9412					}
9413
9414					if ( checkNavBar ) {
9415						offCont = offCont - headH;
9416					}
9417			
9418					if ( rectTop < headH ) {
9419						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
9420							$(this).stop();
9421						}).animate({
9422							scrollTop: offCont
9423						}, anim_t, 'easeInOutCubic');
9424					}
9425				}
9426
9427			}
9428		});
9429	});
9430}
9431UNCODE.filters = function() {
9432	var $systems = $('.isotope-system, .cssgrid-system');
9433
9434	$systems.each(function(index, val){
9435		var $system = $(this),
9436			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
9437			$widgets = $('.widgetized-cb-wrapper', $system),
9438			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
9439			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
9440			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
9441			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
9442
9443		if ($system.hasClass('isotope-processed')) {
9444			return;
9445		}
9446
9447		$cats_trigger.on('click', function(e) {
9448			if ( ! $('html').hasClass('screen-sm') ) {
9449				// $widgets.add($sorting_dd).slideUp(400);
9450				e.preventDefault();
9451				$widgets.slideUp(400, 'easeInOutCirc');
9452			}
9453		});
9454
9455		$('.filters-toggle-trigger', $system).on('click', function(e) {
9456			e.preventDefault();
9457			var $filters = $('.isotope-filters .menu-horizontal', $system);
9458			$filters.slideToggle(400, 'easeInOutCirc');
9459			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
9460		});
9461
9462		$widget_trgr.on('click', function(e) {
9463			e.preventDefault();
9464			$widgets.slideToggle(400, 'easeInOutCirc');
9465			if (!$('html').hasClass('screen-sm')) {
9466				$cats_filters.slideUp(400, 'easeInOutCirc');
9467			}
9468			window.dispatchEvent(new CustomEvent('boxResized'));
9469		});
9470
9471		$sorting_trgr.on('click', function(e) {
9472			e.preventDefault();
9473			if (!$('html').hasClass('screen-sm')) {
9474				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
9475			}
9476		});
9477
9478		$system.addClass('isotope-processed');
9479	});
9480
9481};
9482
9483UNCODE.widgets = function() {
9484	var widget_collapses = $('.widget-collapse');
9485
9486	widget_collapses.each(function(){
9487		var widget_collapse = $(this),
9488			widget_title = widget_collapse.find('.widget-title'),
9489			widget = widget_title.closest('.widget'),
9490			content = widget.children().not('.widget-title'),
9491			setCTA;
9492
9493		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
9494			widget_title.toggleClass('open');
9495		}
9496
9497		widget_title.each(function() {
9498			var _this = $(this);
9499			var content = _this.closest('.widget').find('.widget-collapse-content');
9500
9501			$(window).on('load resize', function(){
9502				clearRequestTimeout(setCTA);
9503				setCTA = requestTimeout( function() {
9504					if ( content.is(':visible') ) {
9505						_this.addClass( 'open' );
9506					} else {
9507						_this.removeClass( 'open' );
9508					}
9509				}, 10 );
9510			})
9511
9512			_this.on( 'click', function(){
9513
9514				// Get content of :after element (+ icon) to check the visibility
9515				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
9516
9517				if (icon_content === 'none' || !icon_content) {
9518					return false;
9519				}
9520
9521				_this.toggleClass('open');
9522				var isOpen = _this.hasClass('open'),
9523					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
9524				content.animate({
9525					height: 'toggle',
9526					padding: 'toggle',
9527					opacity: 'toggle',
9528					top: isOpen ? 0 : hasBorder
9529				}, {
9530					duration: 400,
9531					easing: "easeInOutCirc",
9532				});
9533
9534				return false;
9535
9536			});
9537		});
9538	});
9539
9540	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
9541};
9542
9543UNCODE.unmodal = function() {
9544	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
9545		$('.unmodal-overlay').fadeIn();
9546		$('.unmodal-overlay').addClass('loading');
9547		$('body').addClass('uncode-unmodal-overlay-visible');
9548		$(window).trigger('unmodal-open');
9549	});
9550
9551	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
9552		$('.unmodal-overlay').fadeOut();
9553		$('.unmodal').fadeOut();
9554		$('body').removeClass('uncode-unmodal-overlay-visible');
9555		$('body').removeClass('uncode-unmodal-open');
9556		$('html').removeClass('uncode-unmodal-body-disable-scroll');
9557		$(document).trigger('unmodal-close');
9558		UNCODE.isUnmodalOpen = false;
9559	});
9560
9561	$(document).on('uncode-unmodal-show-content', function() {
9562		$('.unmodal-overlay').removeClass('loading');
9563		$('.unmodal').show();
9564		$('.unmodal').addClass('show-unmodal-with-animation');
9565		$('.unmodal-content')[0].scrollTop = 0;
9566		$('body').addClass('uncode-unmodal-open');
9567		UNCODE.isUnmodalOpen = true;
9568
9569		if ($('body').hasClass('qw-body-scroll-disabled')) {
9570			$('html').addClass('uncode-unmodal-body-disable-scroll');
9571		}
9572
9573		if ($('.unmodal').hasClass('auto-height')) {
9574			set_modal_height();
9575		}
9576	});
9577
9578	var set_modal_height = function() {
9579		var modal = $('.unmodal').css({height: 'auto'});
9580		var window_height = $(window).outerHeight();
9581		var modal_height = modal.outerHeight();
9582
9583		modal.css('height', 'auto');
9584
9585		if (modal_height > window_height) {
9586			modal.outerHeight(window_height);
9587		}
9588	}
9589
9590	if ($('.unmodal').hasClass('auto-height')) {
9591		var setCTA;
9592
9593		$(window).on('resize', function() {
9594			clearRequestTimeout(setCTA);
9595			setCTA = requestTimeout(function() {
9596				set_modal_height();
9597			}, 100);
9598		});
9599	}
9600};
9601
9602UNCODE.bgChanger = function() {
9603	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
9604		$bg_first = $('.vc_row[data-bg-remove]'),
9605		bg_remove = $bg_first.attr('data-bg-remove'),
9606		$first = $bg_changers.first(),
9607		$last = $bg_changers.last(),
9608		$bg_wrapper = $('#changer-back-color'),
9609		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
9610		setCTA, localH = UNCODE.wheight,
9611		isScrolling;
9612
9613	$bg_first.removeClass(bg_remove);
9614
9615	var bgChange = function($col, bgColor, skin, tmbskin){
9616		$bg_wrapper.attr( 'class', bgColor );
9617		var menuskin;
9618		if ( typeof skin !== 'undefined' ) {
9619			menuskin = skin.replace('style', 'menu')
9620		}
9621
9622		if ( $col.length ) {
9623			$('.uncol[data-skin-change]').each(function(){
9624				var $isoFooter = $('.isotope-footer', this);
9625				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
9626				if ( menuskin !== '' ) {
9627					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
9628				}
9629			});
9630
9631			$('.tmb[data-skin-change]').each(function(){
9632				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
9633			});
9634		}
9635	};
9636
9637	var $masthead = $('#masthead'),
9638		transDesktop,
9639		transMobile,
9640		changeSkin,
9641
9642	checkTransparencyAndChange = function( skin ){
9643		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
9644		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
9645		changeSkin = $masthead.hasClass('menu-change-skin');
9646
9647		if ( ! transDesktop && ! transMobile ) {
9648			return false;
9649		}
9650
9651		if ( ! changeSkin ) {
9652			return false;
9653		}
9654
9655		if ( skin === 'style-light' ){
9656			$masthead.removeClass('style-dark-override').addClass('style-light-override');
9657			return false;
9658		} else if ( skin === 'style-dark' ) {
9659			$masthead.removeClass('style-light-override').addClass('style-dark-override');
9660			return false;
9661		}
9662	};
9663
9664	var bg_waypoints = function(){
9665		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
9666
9667			$.each($bg_changers, function(index, row) {
9668
9669				var $row = $(row),
9670					$col = $('.uncol[data-skin-change]', $row).eq(0),
9671					skin,
9672					$tmbs,
9673					tmbskin,
9674					bgColor = $row.attr('data-bg-color');
9675
9676				if ( ! $row.is(':visible') ) {
9677					return false;
9678				}
9679
9680				if ( $col.length ) {
9681					skin = $col.attr('data-skin-change');
9682					$tmbs = $('.tmb[data-skin-change]', $row);
9683					tmbskin = skin.replace('style', 'tmb');
9684				}
9685
9686				if ( ! $row.hasClass('unscroll-horizontal') ) {
9687					$row.waypoint(function( dir ) {
9688						if ( dir === 'down' ) {
9689							bgChange($col, bgColor, skin, tmbskin);
9690							checkTransparencyAndChange(skin);
9691						} else {
9692							return;
9693						}
9694					}, {
9695						offset: '50%'
9696		  			});
9697
9698					$row.waypoint(function( dir ) {
9699						if ( dir === 'up' ) {
9700							bgChange($col, bgColor, skin, tmbskin);
9701							checkTransparencyAndChange(skin);
9702						} else {
9703							return;
9704						}
9705					}, {
9706						offset: function() {
9707							var clH = this.element.clientHeight,
9708								wH = window.innerHeight,
9709								ret = clH > 200 ? -100 : clH * -0.5;
9710							return ( wH / 2 ) - clH;
9711						}
9712					});
9713				}
9714
9715			});
9716
9717			$('body').addClass('bg-changer-init');
9718
9719		}
9720	};
9721
9722	var body = document.body,
9723	edges = false;
9724
9725	var throttle = function(fn, wait) {
9726		var time = Date.now();
9727		return function() {
9728			if ((time + wait - Date.now()) < 0) {
9729				fn();
9730				time = Date.now();
9731			}
9732		}
9733	}
9734
9735	var $wrapper = document.querySelector(".main-wrapper"),
9736		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
9737
9738	var $title = document.querySelector('#rotating');
9739	if ( $title !== null ) {
9740		$title.style.whiteSpace = 'nowrap';
9741		$title.style.transition = 'transform 200ms linear';
9742	}
9743
9744	window.addEventListener( 'scroll', throttle( function() {
9745		window.clearRequestTimeout( isScrolling );
9746
9747		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
9748
9749			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
9750				body = document.body,
9751				html = document.documentElement,
9752				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9753				$row = false,
9754				firstOff,
9755				lastOff;
9756
9757			if ( scrolled < 100 && $first.length ) {
9758				firstOff = $first.offset().top;
9759				if ( firstOff < 100 ) {
9760					var $row = $first;
9761				}
9762			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
9763				lastOff = $last.offset().top + $last.outerHeight();
9764				if ( lastOff > ( docH - 100 ) ) {
9765					var $row = $last;
9766				}
9767			}
9768
9769			if ( $row.length ) {
9770				var $col = $('.uncol[data-skin-change]', $row).eq(0),
9771					skin,
9772					$tmbs,
9773					tmbskin,
9774					bgColor = $row.attr('data-bg-color');
9775
9776				if ( $col.length ) {
9777					skin = $col.attr('data-skin-change');
9778					$tmbs = $('.tmb[data-skin-change]', $row);
9779					tmbskin = skin.replace('style', 'tmb');
9780				}
9781
9782				bgChange($col, bgColor, skin, tmbskin);
9783				checkTransparencyAndChange(skin);
9784				edges = true;
9785			}
9786
9787		}, 150);
9788
9789		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
9790			bg_waypoints();
9791			Waypoint.refreshAll();
9792			edges = false;
9793		}
9794
9795	}, 100), false);
9796
9797	$(window).on('resize', function() {
9798		clearRequestTimeout(setCTA);
9799		setCTA = requestTimeout(function() {
9800			if ( localH != UNCODE.wheight ) {
9801				localH = UNCODE.wheight;
9802				bg_waypoints();
9803				Waypoint.refreshAll();
9804			}
9805		}, 100);
9806	});
9807
9808	bg_waypoints();
9809
9810};
9811
9812UNCODE.skewIt = function() {
9813
9814	if ( $('body').hasClass('compose-mode') ) {
9815		return;
9816	}
9817
9818	var justscrolled = false;
9819
9820	var loadSkewIt = function(){
9821
9822		var $pageHeader = $('#page-header'),
9823			$page_body = $('.page-body'),
9824			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
9825
9826		if ( $header_skew.length ) {
9827			$pageHeader.addClass('uncode-skew').css({
9828				position: 'relative',
9829				zIndex: 1
9830			});
9831			$header_skew.removeClass('uncode-skew');
9832			$page_body.css({
9833				position: 'relative',
9834				zIndex: 0
9835			});
9836		}
9837
9838		var $skew = $('.uncode-skew'),
9839			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
9840			horizontal = $horizontal.length,
9841			stopSkewing,
9842			lastOffset = 0,
9843			lastDate = Date.now();
9844
9845		if ( ! $skew.length ) {
9846			return;
9847		}
9848
9849		var dropSkew = function(){
9850			if ( UNCODE.wwidth < UNCODE.mediaQuery )
9851				return;
9852
9853			$skew.each(function(){
9854				var $this = $(this),
9855					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9856
9857				if ( $drop.length ) {
9858					$this.css({
9859						'transform': 'skew(0)'
9860					});
9861					var bound = $this[0].getBoundingClientRect();
9862					$drop.css({
9863						left: bound.x * -1,
9864						top: bound.y * -1,
9865					});
9866				}
9867			});
9868		};
9869		dropSkew();
9870
9871		$(window).on('resize', dropSkew);
9872
9873		window.addEventListener( 'scroll', function() {
9874
9875			if ( justscrolled !== true ) {
9876				justscrolled = true;
9877				return;
9878			}
9879
9880			window.clearRequestTimeout( stopSkewing );
9881
9882			var now = Date.now(),
9883				delayInMs = now - lastDate,
9884				offset = window.pageYOffset || window.document.documentElement.scrollTop,
9885				newOffset = offset - lastOffset,
9886				speed = Math.pow((newOffset / delayInMs), 3) * -1,
9887				body = document.body,
9888				html = document.documentElement,
9889				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9890				wait = 50,
9891				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
9892
9893			if ((lastDate + wait - now) < 0) {
9894
9895				lastDate = now;
9896				lastOffset = offset;
9897
9898				if ( speed > 6 ) {
9899					speed = 6;
9900				} else if ( speed < -6 ) {
9901					speed = -6;
9902				}
9903
9904				if ( speed > 2 && offset < UNCODE.wheight ) {
9905					speed = 2;
9906				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
9907					speed = -2;
9908				}
9909
9910				var speedY = speed,
9911					speedX = speed * 1.25;
9912
9913				if ( horizontal ) {
9914					speedY = 0;
9915					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9916						speedX = 0;
9917						return;
9918					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
9919						speedX = 0;
9920						return;
9921					}
9922				} else {
9923					speedX = 0;
9924				}
9925
9926				if ( ! $skew.closest('.enter-st').length ) {
9927					speedX = 0;
9928				}
9929
9930				gsap.killTweensOf($skew);
9931				gsap.to( $skew, {
9932					duration: 0.2,
9933					skewY: (speedY * maxSpeed) + "deg",
9934					skewX: (speedX * maxSpeed) + "deg",
9935					ease: Power0.easeNone,
9936					transformOrigin: 'center',
9937				});
9938
9939			}
9940
9941			stopSkewing = requestTimeout(function() {
9942				gsap.killTweensOf($skew);
9943				gsap.to( $skew, {
9944					duration: 0.5,
9945					skewY: "0deg",
9946					skewX: "0deg",
9947					transformOrigin: 'center',
9948					ease: Expo.easeOut,
9949				});
9950
9951				$skew.each(function(){
9952					var $this = $(this),
9953						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9954
9955					if ( $drop.length ) {
9956						var bound = $this[0].getBoundingClientRect()
9957						$drop.css({
9958							left: bound.x * -1,
9959							top: bound.y * -1,
9960						});
9961					}
9962				});
9963
9964			}, 200);
9965
9966		}, false);
9967
9968	};
9969
9970	$(window).on('load', loadSkewIt);
9971
9972};
9973
9974UNCODE.rotateIt = function() {
9975
9976	if ( $('body').hasClass('compose-mode') ) {
9977		return;
9978	}
9979
9980	var frameRotate = false;
9981	var loadRotateIt = function(){
9982
9983		var $toRotate = $('.uncode-rotate');
9984
9985		$toRotate.each(function(){
9986			var $rotate = $(this),
9987				deg = 0,
9988				dir = true,
9989				coeff = 1,
9990				lastOffset = 0,
9991				lastDate = Date.now();
9992
9993			var checkScroll = function($rotate){
9994				// if ( ! $rotate.length ) {
9995				// 	return;
9996				// }
9997
9998				var now = Date.now(),
9999					delayInMs = now - lastDate,
10000					offset = window.pageYOffset || window.document.documentElement.scrollTop,
10001					newOffset = offset - lastOffset,
10002					speed = (newOffset / delayInMs) * 5,
10003					body = document.body,
10004					html = document.documentElement,
10005					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
10006
10007				lastDate = now;
10008				lastOffset = offset;
10009
10010				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
10011					deg = 0;
10012				}
10013
10014				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
10015					deg = parseFloat(deg) + parseFloat(speed);
10016				}
10017
10018				if ( $rotate.hasClass('uncode-rotate-hover') ) {
10019					$rotate.hover(function(){
10020						coeff = 1.75;
10021					}, function(){
10022						coeff = 1;
10023					});
10024				}
10025
10026				// if ( speed > 0 ) {
10027				// 	dir = true
10028				// } else if ( speed < 0 ) {
10029				// 	dir = false
10030				// }
10031
10032				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
10033					deg = deg+coeff;
10034					// if ( dir ) {
10035					// 	deg = deg+coeff;
10036					// } else {
10037					// 	deg = deg-coeff;
10038					// }
10039				}
10040
10041				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
10042					return false;
10043				}
10044				
10045				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
10046					var undeg = deg*-1;
10047					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
10048				} else {
10049					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
10050				}
10051
10052				requestAnimationFrame(function() {
10053					if ( frameRotate === true ) {
10054						frameRotate = false;
10055						return;
10056					}
10057					checkScroll($rotate);
10058				});
10059			};
10060
10061			checkScroll($rotate);
10062
10063		});
10064
10065	};
10066
10067	$(window).on('load', loadRotateIt);
10068
10069	var checkRotate;
10070	var resizeRotate = function(){
10071		var $inlineRotates = $('.inline-rotate');
10072		$inlineRotates.each(function(){
10073			$(this).addClass('inline-rotate-standby');
10074		});
10075		clearTimeout(checkRotate);
10076		checkRotate = setTimeout(function(){
10077			$('.inline-rotate').each(function(){
10078				$(this).removeClass('inline-rotate-standby');
10079				frameRotate = true;
10080			});
10081			loadRotateIt();
10082		}, 500);
10083	};
10084
10085	$(window).off('resize.inline-rotate', resizeRotate)
10086	.on('resize.inline-rotate', resizeRotate);
10087
10088};
10089
10090var marqueeAttempts = 0,
10091	marqueeTO,
10092	marqueeCheckResize,
10093	initMarquee;
10094
10095UNCODE.textMarquee = function( $titles ) {
10096
10097	var isInitMarque = false;
10098
10099	var initTextMarquee = function( $titles ){
10100
10101		if ( typeof $titles == 'undefined' ) {
10102			$titles = $('.un-text-marquee');
10103		}
10104
10105		if ( ! $titles.length ) {
10106			return;
10107		}
10108
10109		isInitMarque = true;
10110
10111		var stableHeight = UNCODE.wheight;
10112
10113		$titles.each(function(){
10114			var $title = $(this),
10115				$span = $('> span, > i > span', $title),
10116				txt,
10117				first = true,
10118				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
10119				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
10120				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
10121				hasSticky = false,
10122				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
10123				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
10124				newW = UNCODE.wwidth,
10125				marqueeTL, inview,
10126				isInMenu = $title.closest('.megamenu-block-wrapper').length;
10127
10128			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
10129				hasSticky = true;
10130				dataTrigger = 'row';
10131			}
10132
10133			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
10134				dataNavBar = dataNavBarMobile;
10135			}
10136
10137			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
10138			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
10139			var dataX = dataSpeed;
10140
10141			dataSpeed += 5;
10142
10143			$('.marquee-clone-wrap', $title).remove();
10144
10145			txt = $span.html();
10146
10147			if ( ! $('.marquee-original-core', $span).length ) {
10148				txt = $span.html();
10149				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
10150			} else {
10151				txt = $('.marquee-original-core', $span).html();
10152			}
10153
10154			var spanW,
10155				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
10156				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
10157				speed = 10 - dataSpeed;
10158
10159			$span.prepend($prepended);
10160			$span.append($appended);
10161
10162			var continuousTextMarquee = function () {
10163				var bound = $title
10164						.css({
10165							transform: "none",
10166							opacity: 0,
10167						})
10168						.offset(),
10169					ease = "none";
10170
10171				var xStrt =
10172						first || $title.hasClass("un-marquee-infinite")
10173							? 0
10174							: UNCODE.wwidth - bound.left,
10175					xEnd = $title.hasClass("un-marquee-infinite")
10176						? spanW
10177						: spanW + bound.left,
10178					xSpeed =
10179						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
10180						dataSpeed,
10181					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
10182					speedSlow = (xEnd + xStrt) / 45,
10183					transFormVal,
10184					translX;
10185
10186				marqueeTL = new TimelineMax({ paused: true, reversed: true });
10187				marqueeTL.play();
10188
10189				var inViewElement =
10190						dataTrigger === "row" ? ( hasSticky ? $title.closest('.sticky-trigger, .sticky-element').parent()[0] : $title.closest(".vc_row")[0] ) : $title[0],
10191					wayOff =
10192						dataTrigger === "row" && dataNavBar === "yes"
10193							? UNCODE.menuHeight
10194							: 0;
10195
10196				if ( isInMenu ) {
10197					$(document).on('un-menu-show.marquee', function(e, $ul){
10198						marqueeTL.restart();
10199					});
10200					$(document).on('un-menu-hide.marquee', function(e, $ul){
10201						marqueeTL.pause();
10202					});
10203				} else {
10204					inview = new Waypoint.Inview({
10205						element: inViewElement,
10206						offset: wayOff,
10207						enter: function (direction) {
10208							marqueeTL.play();
10209						},
10210						exited: function (direction) {
10211							if (!$title.closest(".pin-spacer").length) {
10212								marqueeTL.pause();
10213							}
10214						},
10215					});
10216				}
10217
10218				if ($title.hasClass("un-marquee-hover")) {
10219					var $column = $title.closest(".wpb_column"),
10220						$col_link = $(".col-link", $column),
10221						$hover_sel = $title;
10222
10223					if ($col_link.length) {
10224						$hover_sel = $title.add($column);
10225					}
10226					$hover_sel
10227						.on("mouseover", function () {
10228							ease = "power2.out";
10229							transFormVal = $title.css("transform").split(/[()]/)[1];
10230							translX = transFormVal.split(",")[4];
10231							speedSlow = (xEnd + (xStrt - translX)) / 45;
10232							marqueeTL.duration(speedSlow);
10233						})
10234						.on("mouseout", function () {
10235							ease = "power2.in";
10236							transFormVal = $title.css("transform").split(/[()]/)[1];
10237							translX = transFormVal.split(",")[4];
10238							speedSlow =
10239								((xEnd + (xStrt - translX)) /
10240									(dataSpeed * dataSpeed * dataSpeed) /
10241									5) *
10242								dataSpeed;
10243							marqueeTL.duration(speedSlow);
10244						});
10245				}
10246		
10247				gsap.killTweensOf($title);
10248				marqueeTL.fromTo( $title, {
10249					opacity: 1,
10250					x: xStrt * direction * -1
10251				},
10252				{
10253					duration: xSpeed,
10254					x: xEnd * direction,
10255					onComplete: function(){
10256						first = false;
10257						if ( isInMenu ) {
10258							marqueeTL.restart();
10259						} else {
10260							continuousTextMarquee();
10261						}
10262					},
10263					onUpdate: function(){
10264						if ( ! $title[0].isConnected ) {
10265							marqueeTL.kill();
10266							initTextMarquee();
10267						}
10268					},
10269					ease: ease
10270				});
10271		
10272			};
10273			
10274			var runTextMarquee = function(){
10275				var time = Date.now();
10276
10277				var textMarqueeScroll = function(){
10278					var $row = $title.closest('.vc_row');
10279					if ( hasSticky ) {
10280						$row = $title.closest('.sticky-trigger, .sticky-element').parent();
10281					}					
10282					var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
10283
10284					if ( !$bound.length ) {
10285						return;
10286					}
10287
10288					var bound = $bound[0].getBoundingClientRect(),
10289						wait = 100,
10290						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
10291						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
10292
10293					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
10294						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
10295						marqueeAttempts < 2 ) {
10296
10297						clearRequestTimeout(marqueeTO);
10298
10299						marqueeTO = requestTimeout(function(){
10300							marqueeAttempts++;
10301							runTextMarquee();
10302						}, 100);
10303					}
10304
10305
10306					var bound_top = bound.top,
10307						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
10308
10309					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
10310						if ( dataTrigger === 'row-middle' ) {
10311							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5)
10312						}
10313						if ( dataNavBar === 'yes' ) {
10314							bound_top = bound_top - UNCODE.menuHeight;
10315						}
10316						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
10317					}
10318
10319					gsap.killTweensOf($title);
10320					gsap.to( $title, {
10321						duration: 0.24,
10322						x: gsap_calc,
10323					});
10324				};
10325
10326				textMarqueeScroll();
10327				$(window).on( 'load scroll', function(e) {
10328					textMarqueeScroll();
10329				});
10330
10331			};
10332
10333			var cloneSpan = function($_title, cntnt){
10334
10335				if ( $_title.hasClass('un-marquee-infinite') ) {
10336					$('> span.marquee-clone-wrap', $_title).text('');
10337				}
10338
10339				gsap.to( $_title, {
10340					duration: 0,
10341					x: 0
10342				});
10343				spanW = $span.outerWidth();
10344
10345
10346				if ( !spanW ) {
10347					return;
10348				}
10349
10350				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
10351					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
10352
10353				if ( $_title.hasClass('un-marquee-infinite') ) {
10354
10355					for ( var i = 0; i < part; i++ ) {
10356						$prepended.append(cntnt + spaceSpan);
10357						$appended.append(cntnt + spaceSpan);
10358					}
10359				}
10360
10361				if ( $('body').hasClass('compose-mode') ) {
10362					$('.uncode_fe_safe').remove();
10363					return;
10364				}
10365
10366				if ( $title.closest('.marquee-freezed').length ) {
10367					return;
10368				}
10369
10370				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
10371					continuousTextMarquee();
10372				}
10373
10374				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
10375					runTextMarquee();
10376				}
10377
10378			};
10379
10380			var marqueeResize = function(e){
10381				if ( isInMenu ) {
10382					return;
10383				}
10384				var tOut = 1000;
10385				if ( isInMenu ) {
10386						gsap.killTweensOf($title);
10387						if ( typeof inview !== 'undefined' && inview !== null ) {
10388							inview.destroy();
10389						}
10390						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
10391							marqueeTL.kill();
10392						}
10393						first = true;
10394						initTextMarquee();
10395				} else {
10396					clearRequestTimeout(marqueeCheckResize);
10397					marqueeCheckResize = requestTimeout(function(){
10398						if ( newW !== UNCODE.wwidth ) {
10399							gsap.killTweensOf($title);
10400							if ( typeof inview !== 'undefined' && inview !== null ) {
10401								inview.destroy();
10402							}
10403							if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
10404								marqueeTL.kill();
10405							}
10406							first = true;
10407							initTextMarquee();
10408							newW = UNCODE.wwidth;
10409						}
10410					}, tOut);
10411				}
10412			};
10413
10414			$(window).off('resize', marqueeResize)
10415			.on( 'resize', marqueeResize);
10416			$(window).off('uncode.re-layout', marqueeResize)
10417			.on( 'uncode.re-layout', marqueeResize);
10418
10419			cloneSpan($title, txt);
10420
10421			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10422				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
10423					var $_titles = $('.un-text-marquee',e.view.$el);
10424					clearRequestTimeout(marqueeCheckResize);
10425					marqueeCheckResize = requestTimeout(function(){
10426						initTextMarquee($_titles);
10427					}, 1000);
10428				});
10429			}
10430		});
10431
10432		$(window).on( 'load wwResize', function(e) {
10433			stableHeight = UNCODE.wheight;
10434		});
10435
10436	};
10437
10438	document.addEventListener("DOMContentLoaded", function() {
10439		if ( isInitMarque !== true ) {
10440			initTextMarquee();
10441		}
10442	});
10443
10444	$(window).on('focus load resize',function(){
10445		clearTimeout(initMarquee);
10446		initMarquee = setTimeout(function(){
10447			if ( isInitMarque !== true ) {
10448				initTextMarquee();
10449			}
10450		}, 500);
10451	});
10452	
10453	$(document).on('pumAfterOpen pumAfterClose uncode-scrolltrigger-refresh', function(args){
10454		initTextMarquee();
10455	});
10456
10457};
10458	
10459UNCODE.parallax = function() {
10460	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
10461		if ($('.parallax-el').length > 0) {
10462			var parallax_elements = new Rellax('.parallax-el');
10463			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
10464			window.addEventListener('boxResized', function(e) {
10465				parallax_elements.refresh();
10466			}, false);
10467			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
10468				requestTimeout(function() {
10469					parallax_elements.refresh();
10470				}, 100);
10471			});
10472
10473			if ( typeof UNCODE.hDoc === 'undefined' ) {
10474				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
10475					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
10476			}
10477		
10478			function paralraf(time) {
10479				requestAnimationFrame(paralraf)
10480		
10481				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
10482					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
10483				
10484				if ( UNCODE.hDoc !== newHdoc ) {
10485					UNCODE.hDoc = newHdoc;
10486					parallax_elements.refresh();
10487				}
10488			}
10489		
10490			requestAnimationFrame(paralraf)
10491		
10492		}
10493	}
10494};
10495
10496UNCODE.magicCursor = function(){
10497	var $customCursor = $('#uncode-custom-cursor'),
10498		$customPilot = $('#uncode-custom-cursor-pilot'),
10499		$tooltip = $('.title-tooltip', $customCursor),
10500		$cursorSpan = $('> span', $tooltip),
10501		currentBg = false,
10502		fromTitle = false,
10503		setTime,
10504		mouseEvent;
10505
10506		var spanW, spanH,
10507		maxW = false;
10508
10509	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
10510		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
10511			$tooltip.css({opacity: 0});
10512			delayt_time += 400;
10513		}
10514		clearRequestTimeout(setTime);
10515		setTime = requestTimeout(function() {
10516
10517			$tooltip.css({opacity: ''});
10518
10519			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
10520
10521			if ( cursorTitle !== '' ) {
10522				if ( fromTitle && dataTitle === 'boing' ) {
10523					setTimeout(function(){
10524						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
10525					}, 5);
10526				}
10527				$cursorSpan.attr('class', fontClass).html( cursorTitle );
10528			} else {
10529				if ( cursorType !== 'auto' ) {
10530					$cursorSpan.html('');
10531				}
10532			}
10533
10534			$cursorSpan.addClass('in-tooltip');
10535
10536			$customCursor.attr('data-cursor', cursorType);
10537
10538			if ( fromTitle ) {
10539				$customCursor.addClass('from-tooltip-title');
10540			} else {
10541				$customCursor.removeClass('from-tooltip-title');
10542			}
10543
10544			if ( cursorBg !== false ) {
10545				$customCursor.attr('data-bg', 'transparent');
10546			} else {
10547				$customCursor.removeAttr('data-bg');
10548			}
10549
10550			currentBg = cursorBg;
10551
10552			if ( cursorTitle !== '' ) {
10553				fromTitle = true;
10554				$customCursor.attr('data-cursor', cursorType);
10555				$customCursor.attr('data-title', 'true');
10556				$cursorSpan.css({width: ''});
10557			} else {
10558				fromTitle = false;
10559				$customCursor.removeAttr('data-title');
10560			}
10561			spanW = $cursorSpan.outerWidth();
10562			
10563			if ( spanW >= maxW && maxW !== false ) {
10564				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
10565				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
10566					width: maxW
10567				});
10568				spanW = maxW;
10569			} else {
10570				$customCursor.find('> span:first-child').removeClass('max-width');
10571			}
10572			spanH = $cursorSpan.outerHeight();
10573			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
10574				$customCursor.find('> span:first-child').add($tooltip).css({
10575					width: spanW,
10576					height: spanH
10577				});
10578			} else {
10579				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
10580			}
10581			if ( $customPilot.length ) {
10582				$customPilot.attr('data-cursor', cursorType);
10583			}
10584		}, delayt_time);
10585	}
10586
10587	function changeCursor($wrap){
10588		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10589		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
10590			$href = $wrap.find(href),
10591			cursorType,
10592			cursorTitle = '',
10593			tooltip_class = '',
10594			cursorBg = false;
10595
10596		$wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) {
10597			var $this = $(this).addClass("cursor-init"),
10598				$tmb = $this.closest('.tmb'),
10599				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
10600				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
10601				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
10602				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
10603				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
10604				$title = $('.t-entry-title', $tmb),
10605				is_frontend_editor = $this.closest('.vc_controls').length,
10606				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
10607				$parent_cursor = $this.closest('[class*="custom-cursor"]');
10608
10609			if ( is_frontend_editor ) {
10610				cursorType = 'auto';
10611			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
10612				cursorType = data_cursor;
10613			} else if ( $parent_cursor.length ) {
10614				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
10615					cursorType = 'icon-light';
10616				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
10617					cursorType = 'icon-diff';
10618				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
10619					cursorType = 'icon-accent';
10620				} else {
10621					cursorType = 'icon-dark';
10622				}
10623			} else {
10624				cursorType = 'pointer';
10625			}
10626
10627			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
10628				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
10629					cursorTitle = custom_text;
10630				} else {
10631					cursorTitle = $title.clone();
10632					$('a', cursorTitle).replaceWith(function() {
10633						return this.childNodes;
10634					});
10635					$('*', cursorTitle).replaceWith(function(){
10636						return $(this).removeAttr('class');
10637					});
10638					cursorTitle = cursorTitle.html();
10639				}
10640			} else {
10641				cursorTitle = '';
10642			}
10643
10644			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
10645				tooltip_class = data_class;
10646			} else {
10647				tooltip_class = '';
10648			}
10649
10650			if ( cursor_bg == 'true' ) {
10651				cursorBg = true;
10652			} else {
10653				cursorBg = false;
10654			}
10655
10656			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
10657		}).on("mouseleave.cursor", href, function(e) {
10658			var outTime = 150;
10659			if ( currentBg !== false && cursorBg === false ) {
10660				outTime = 0;
10661			}
10662			delayChangeCursor('auto', '', false, outTime, false, '');
10663		});
10664
10665		$(window).on('disable-hover', function(event) {
10666			document.addEventListener("mousemove", function(e) {
10667				mouseEvent = e;
10668			});
10669			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
10670		});
10671
10672		$(window).on('enable-hover', function(event) {
10673			if ( typeof mouseEvent !== 'undefined' ) {
10674				var x = mouseEvent.clientX,
10675					y = mouseEvent.clientY;
10676
10677				var elements = document.elementsFromPoint(x, y),
10678					$element = $(elements[0]);
10679
10680				$element.closest(href).trigger('mouseenter');
10681			}
10682		});
10683
10684	}
10685
10686	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10687		changeCursor();
10688	});
10689
10690	$(document).ajaxComplete(function( event, xhr, settings ) {
10691		changeCursor();
10692	});
10693
10694	$('.isotope-container').on('isotope-layout-complete', function() {
10695		var $this = $(this);
10696		changeCursor($this);
10697	});
10698
10699};
10700
10701UNCODE.magneticCursor = function(){
10702	function magneticCursor($wrap){
10703		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10704		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'));
10705
10706		$magnetics.on('mousemove', function(e){
10707			var $this = $(this),
10708				$el,
10709				bound = e.currentTarget.getBoundingClientRect(),
10710				coeff = 30,
10711				hor = (bound.width / 2) - (e.clientX - bound.left),
10712				ver = (bound.height / 2) - (e.clientY - bound.top),
10713				toX = hor / bound.width * coeff,
10714				toY = ver / bound.height * coeff,
10715				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
10716				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
10717				toScale = Math.max(scaleX, scaleY);
10718
10719			if ( $this.hasClass('magnetic') ) {
10720				$el = $('.background-inner, .header-bg', $this);
10721			} else {
10722				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10723			}
10724
10725			gsap.killTweensOf($el);
10726			gsap.to( $el, {
10727				duration: 0.75,
10728				x: toX,
10729				y: toY,
10730				scale: toScale,
10731				ease: Power1.easeOut,
10732				transformPerspective: 900,
10733				transformOrigin: 'center',
10734				force3D: true
10735			});
10736		}).on('mouseout', function(e){
10737			var $this = $(this),
10738				$el
10739			if ( $this.hasClass('magnetic') ) {
10740				$el = $('.background-inner, .header-bg', $this);
10741			} else {
10742				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10743			}
10744			gsap.killTweensOf($el);
10745			gsap.to( $el, {
10746				duration: 0.6,
10747				y: 0,
10748				x: 0,
10749				scale: 1,
10750				ease: Power1.easeOut,
10751				transformPerspective: 900,
10752				transformOrigin: 'center',
10753				force3D: true
10754			});
10755		});
10756	};
10757
10758	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10759		magneticCursor();
10760	});
10761
10762	$(document).ajaxComplete(function( event, xhr, settings ) {
10763		magneticCursor();
10764	});
10765
10766	$('.isotope-container').on('isotope-layout-complete', function() {
10767		var $this = $(this);
10768		magneticCursor($this);
10769	});
10770
10771};
10772
10773UNCODE.dropImage = function() {
10774
10775	/****************************
10776	 * Image hover *
10777	****************************/
10778	function imageHover(){
10779		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10780			return;
10781		}
10782
10783		var $postLists = $('.uncode-post-titles');
10784		$postLists.each(function(){
10785			var $list = $(this),
10786				timing = parseFloat( $list.attr('data-timing') ),
10787				default_image = $list.hasClass('uncode-post-titles-default-image'),
10788				default_title = $list.hasClass('uncode-post-titles-default-title'),
10789				$tmbs = $('.tmb', $list),
10790				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
10791				clientX,
10792				clientY,
10793				$row_parent = $list.closest('.vc_row'),
10794				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
10795				$col_parent = $list.closest('.uncell'),
10796				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
10797				stoppedScrolling = true,
10798				setCTA;
10799
10800			timing *= 0.001;
10801
10802			var drop_bgs = function(){
10803				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
10804					var $drop = $(this),
10805						srcset = $drop.attr('data-bgset'),
10806						setArr = srcset.split(","),
10807						setArrOrder = [],
10808						biggest = 0,
10809						checkBg = false,
10810						desktopBG = $drop.data('[data-background-image]'),
10811						mobileBG = $drop.data('[data-mobile-background-image]');
10812
10813					if ( $drop.hasClass('srcset-bg-async') ) {
10814
10815						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
10816							return;
10817						}
10818						
10819					}
10820
10821					if ( SiteParameters.uncode_adaptive == true ) {
10822						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
10823							$drop.css({
10824								'background-image' : 'url(' + setArr[0] + ')'
10825							});
10826						}
10827					} else {
10828						for ( var i = 0; i < setArr.length; i++ ) {
10829							var setLoop = setArr[i].trim().split(" ");
10830							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
10831								var parseSet = parseFloat(setLoop[1]);
10832								if ( biggest < parseSet ) {
10833									biggest = parseSet;
10834								}
10835								setArrOrder[parseSet] = setLoop[0];
10836								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
10837									checkBg = true;
10838									$drop.css({
10839										'background-image' : 'url(' + setLoop[0] + ')'
10840									});
10841								}
10842							}
10843						}
10844
10845						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
10846							$drop.css({
10847								'background-image' : 'url(' + setArrOrder[biggest] + ')'
10848							});
10849						}
10850					}
10851
10852				});
10853			};
10854
10855			drop_bgs();
10856
10857			var dropMovesSize = function(){
10858				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
10859					return;
10860				}
10861				$drop_moves.each(function(){
10862					var $drop_move = $(this),
10863						dataW = $drop_move.attr('data-w'),
10864						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
10865					if ( typeof dataW !== 'undefined' && dataW !== null ) {
10866						dataW = screenInfo.width / 12 * parseFloat( dataW );
10867					}
10868					$drop_moves.css({
10869						width: dataW
10870					});
10871
10872					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10873						$anim_parent.on('animationend', function(){
10874							var bound = $anim_parent[0].getBoundingClientRect();
10875							$drop_move.css({
10876								left: bound.x * -1,
10877								top: bound.y * -1,
10878							});
10879						});
10880					}
10881				});
10882
10883
10884			};
10885
10886			dropMovesSize();
10887
10888			$(window).on( 'resize', function(){
10889				clearRequestTimeout(setCTA);
10890				setCTA = requestTimeout( function() {
10891					drop_bgs();
10892					dropMovesSize();
10893				}, 100 );
10894			});
10895
10896			if ( $drop_row_parents.length ) {
10897				$row_parent.addClass( 'drop-added' );
10898			}
10899
10900			$drop_row_parents.each(function(index, val){
10901				var $drop = $(val);
10902				$row_parent.prepend($drop);
10903				manageVideos($drop, false);
10904				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10905					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10906				}
10907				if ( default_image && index == 0 ) {
10908					manageVideos($drop, true);
10909					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10910						image_ph = new Image();
10911					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10912						image_ph.onload = function() {
10913							$drop.addClass('active');
10914							if ( default_title ) {
10915								$list.addClass('drop-hover');
10916								$tmbs.first().addClass('drop-active');
10917							}
10918						};
10919						image_ph.src = bg_img;
10920					}
10921				}
10922			});
10923
10924			if ( $drop_col_parents.length ) {
10925				$col_parent.addClass( 'drop-added' );
10926			}
10927
10928			$drop_col_parents.each(function(index, val){
10929				var $drop = $(this);
10930				$col_parent.prepend($drop);
10931				manageVideos($drop, false);
10932				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10933					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10934				}
10935				if ( default_image && index == 0 ) {
10936					manageVideos($drop, true);
10937					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10938						image_ph = new Image();
10939					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10940						image_ph.onload = function() {
10941							$drop.addClass('active');
10942							if ( default_title ) {
10943								$list.addClass('drop-hover');
10944								$tmbs.first().addClass('drop-active');
10945							}
10946						};
10947						image_ph.src = bg_img;
10948					}
10949				}
10950			});
10951
10952			function manageVideos( $el, start ) {
10953				var videoElem = $('video', $el),
10954					$iframe = $('iframe', $el),
10955					iframeID = $iframe.attr('id');
10956				if ( videoElem.length ) {
10957					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
10958						if ( start ) {
10959							videoElem[0].setCurrentTime(0);
10960							videoElem[0].play();
10961						} else {
10962							videoElem[0].pause();
10963							videoElem[0].setCurrentTime(0);
10964						}
10965					} else {
10966						if ( start ) {
10967							videoElem[0].currentTime = 0;
10968							videoElem[0].play();
10969						} else {
10970							videoElem[0].pause();
10971							videoElem[0].currentTime = 0;
10972						}
10973					}
10974				}
10975
10976				$el.data('active', start);
10977
10978				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
10979					var iframeIDv = iframeID.replace('okplayer-', ''),
10980						optionsV = $(window).data('okoptions-' + iframeIDv),
10981						vimeo = $iframe[0],
10982						playerV = new Vimeo.Player(vimeo),
10983						timeV = 0;
10984
10985					if (optionsV.time != null) {
10986						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
10987						for ( var i = 0; i < timeArr.length; i++ ) {
10988							if ( timeArr[i] === 'h' ) {
10989								timeV += parseFloat(timeArr[i-1]) * 3600;
10990							} else if ( timeArr[i] === 'm' ) {
10991								timeV += parseFloat(timeArr[i-1]) * 60;
10992							} else if ( timeArr[i] === 's' ) {
10993								timeV += parseFloat(timeArr[i-1]);
10994							}
10995						}
10996					}
10997					playerV.setCurrentTime(timeV);
10998					if ( start ) {
10999						playerV.setVolume(0);
11000						playerV.play();
11001					} else {
11002						playerV.pause();
11003					}
11004				} else if ( $el.attr('data-provider') === 'youtube' ) {
11005					if ( start ) {
11006						$el.trigger('uncode-resume');
11007					} else {
11008						$el.trigger('uncode-pause');
11009					}
11010				}
11011
11012			}
11013
11014			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11015
11016				document.addEventListener("mousemove", function(e) {
11017					$drop_moves.each(function(){
11018						var $drop_move = $(this),
11019							duration = 0.4;
11020
11021						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
11022							duration = 0.8;
11023						}
11024
11025						clientX = e.clientX;
11026						clientY = e.clientY;
11027
11028						gsap.to( $drop_move, {
11029							duration: duration,
11030							x: clientX,
11031							y: clientY,
11032							ease: Power1.easeOut,
11033						});
11034					});
11035				});
11036
11037			} else {
11038
11039				$(window).on("touchend scroll", function(e) {
11040					$list.removeClass('drop-hover');
11041					$drop_moves.removeClass('active');
11042					$tmbs.removeClass('drop-active');
11043				});
11044
11045				$drop_moves.each(function(){
11046					var $drop_move = $(this),
11047						$tmb = $drop_move.closest('.tmb'),
11048						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
11049
11050					if ( $anim_parent.hasClass('uncode-skew') ) {
11051						$anim_parent.css({
11052							'transform': 'skew(0)'
11053						});
11054					}
11055
11056					$tmb.on('touchend', function(e){
11057						e.stopPropagation();
11058
11059						$drop_moves.removeClass('active');
11060						$tmbs.removeClass('drop-active');
11061
11062						$list.addClass('drop-hover');
11063						$tmb.addClass('drop-active');
11064						$drop_move.addClass('active');
11065						manageVideos($drop_move, true);
11066						clientX = e.changedTouches[0].clientX;
11067						clientY = e.changedTouches[0].clientY;
11068
11069						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
11070							var bound = $anim_parent[0].getBoundingClientRect();
11071							clientX = clientX - bound.x;
11072							clientY = clientY - bound.y;
11073						}
11074
11075						$drop_move.css({
11076							left: clientX,
11077							top: clientY
11078						});
11079					});
11080				});
11081
11082			}
11083
11084			$tmbs.each(function(e){
11085				var $tmb = $(this),
11086					// $trgr = $('a', $tmb),
11087					$trgr = $tmb,
11088					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
11089					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
11089(.t-inside), .parallax-el'),
11090					$video = $('video', $tmb),
11091					$iframe = $('iframe', $tmb),
11092					$entryTxt = $('.t-entry-text', $tmb),
11093					stopBounding;
11094
11095				$entryTxt.add($drop_move).css({
11096					'transition-duration': timing + 's'
11097				});
11098
11099				if ( $video.length ) {
11100					var vidH = $video[0].videoHeight,
11101						vidW = $video[0].videoWidth;
11102					$video.css({
11103						'height': vidH,
11104						'width': vidW
11105					});
11106				}
11107
11108				if ( $iframe.length ) {
11109					var vidH = $drop_move.attr('data-height'),
11110						vidW = $drop_move.attr('data-width');
11111					$iframe.css({
11112						'height': vidH,
11113						'width': vidW
11114					});
11115				}
11116
11117				$iframe.each(function(){
11118					var $video = $(this),
11119						vidH = $video[0].videoHeight,
11120						vidW = $video[0].videoWidth;
11121					$video.css({
11122						'height': vidH,
11123						'width': vidW
11124					});
11125				});
11126
11127				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
11128					$trgr.on('mouseenter',function(e){
11129
11130						$list.addClass('drop-hover');
11131						$tmbs.removeClass('drop-active');
11132						$tmb.addClass('drop-active');
11133						$drop_move.addClass('active');
11134						manageVideos($drop_move, true);
11135
11136						var clientX = e.clientX,
11137							clientY = e.clientY;
11138						$drop_move.css({
11139							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
11140						});
11141
11142					})
11143					.on('mouseleave', function(e){
11144						$list.removeClass('drop-hover');
11145						$drop_move.css({
11146							'transition-duration': ( timing*1.25 ) + 's'
11147						});
11148						$drop_move.removeClass('active');
11149						$tmb.removeClass('drop-active');
11150						$drop_move.on('transitionend', function(e){
11151							$drop_move.off('transitionend');
11152							$drop_move.css({
11153								'transition-duration': timing + 's'
11154							});
11155							manageVideos($drop_move,false);
11156						});
11157					});
11158
11159					document.addEventListener('visibilitychange', function(){
11160						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
11161							$drop_move.css({
11162								'transition-duration': '0s'
11163							});
11164							$drop_move.removeClass('active');
11165							manageVideos($drop_move, false);
11166						}
11167					});
11168
11169					document.addEventListener('scroll', function(){
11170						window.clearRequestTimeout( stopBounding );
11171						if ( stoppedScrolling ) {
11172							stoppedScrolling = false;
11173							if ( $drop_move.hasClass('active') ) {
11174								$list.removeClass('drop-hover');
11175								$tmbs.removeClass('drop-active');
11176								$drop_move.removeClass('active');
11177								$drop_move.on('transitionend', function(e){
11178									$drop_move.off('transitionend');
11179									$drop_move.css({
11180										'transition-duration': timing + 's'
11181									});
11182									manageVideos($drop_move,false);
11183								});
11184							}
11185						}
11186
11187						stopBounding = requestTimeout(function() {
11188							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
11189								var bound = $anim_parent[0].getBoundingClientRect();
11190								$drop_move.css({
11191									left: bound.x * -1,
11192									top: bound.y * -1,
11193								});
11194							}
11195							stoppedScrolling = true;
11196						}, 500);
11197					});
11198				}
11199
11200				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
11201					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
11202
11203				$drop.css({
11204					'transition-duration': timing + 's'
11205				});
11206
11207				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
11208					$trgr.on('mouseenter',function(e){
11209						$row_parent.add($col_parent).addClass('drop-list-loaded');
11210						$list.addClass('drop-hover');
11211
11212						if ( !$tmb.hasClass('drop-active') ) {
11213							$tmbs.removeClass('drop-active');
11214							$tmb.addClass('drop-active');
11215							if ( default_image && !$drop.hasClass('active') ) {
11216								var $prev = $('[data-drop].active', $row_parent);
11217								$prev.css({
11218									'transition-duration': (timing*1.5) + 's'
11219								});
11220								$prev.removeClass('active');
11221								$prev.on('transitionend', function(e){
11222									$prev.off('transitionend');
11223									manageVideos($prev,false);
11224								});
11225							}
11226							$drop.css({
11227								'transition-duration': timing + 's'
11228							});
11229							$drop.off('transitionend');
11230							$drop.addClass('active');
11231							manageVideos($drop, true);
11232						}
11233					})
11234					.on('mouseleave', function(e){
11235						if ( ( default_image && !default_title ) || !default_image ) {
11236							$list.removeClass('drop-hover');
11237							$tmb.removeClass('drop-active');
11238						}
11239						if ( ! default_image ) {
11240							$drop.css({
11241								'transition-duration': (timing*1.5) + 's'
11242							});
11243							$drop.removeClass('active');
11244
11245							$drop.on('transitionend', function(e){
11246								$drop.off('transitionend');
11247								manageVideos($drop,false);
11248							});
11249						}
11250					});
11251
11252					document.addEventListener('visibilitychange', function(){
11253						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
11254							$drop.css({
11255								'transition-duration': '0s'
11256							});
11257							$drop.removeClass('active');
11258							manageVideos($drop, false);
11259						}
11260					});
11261				}
11262			});
11263
11264		});
11265	};
11266
11267	$(window).on('load', function(event) {
11268		imageHover();
11269	});
11270
11271	var drop_wp_animation = function() {
11272		var $postLists = $('.uncode-post-titles');
11273		$postLists.each(function(){
11274			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
11275				new Waypoint({
11276					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11277					element: val,
11278					handler: function() {
11279						var element = $(this.element),
11280							parent = element.closest('.tmb'),
11281							currentIndex = parent.index(),
11282							delay = currentIndex,
11283							delayAttr = parseInt(element.attr('data-delay'));
11284						if (isNaN(delayAttr)) delayAttr = 100;
11285						var objTimeout = requestTimeout(function() {
11286							element.addClass('start_animation');
11287
11288							var nextTimeout = requestTimeout(function() {
11289								$('.drop-image-separator', parent).addClass('start_animation');
11290							}, 50);
11291
11292						}, delay * delayAttr);
11293						if (!UNCODE.isUnmodalOpen) {
11294							this.destroy();
11295						}
11296					},
11297					offset: UNCODE.isFullPage ? '100%' : '90%'
11298				})
11299			});
11300		});
11301	}
11302
11303	var runWaypoints_TO,
11304		runWaypoints_delay = 0;
11305
11306	var runWaypoints = function(){
11307		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
11308			runWaypoints_delay = 400;
11309		}
11310		clearRequestTimeout(runWaypoints_TO);
11311		runWaypoints_TO = requestTimeout(function() {
11312			drop_wp_animation();
11313		}, runWaypoints_delay);
11314	};
11315	runWaypoints();
11316	$( document.body ).on( 'uncode_waypoints', runWaypoints );
11317	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11318		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
11319			// imageHover();
11320			runWaypoints();
11321		});
11322	}
11323};
11324
11325UNCODE.postTable = function() {
11326
11327	var clickRow = function(){
11328		var $postLists = $('.uncode-post-table');
11329
11330		$postLists.each(function(){
11331			var $postList = $(this),
11332				$tmbClicks = $('.tmb.tmb-click-row', $postList);
11333
11334			$tmbClicks.each(function(){
11335				var $tmb = $(this),
11336					$click = $('.table-click-row', $tmb);
11337				$('*:not(.table-click-row)', $tmb).on('click', function(e){
11338					e.preventDefault();
11339					e.stopPropagation();
11340					$click[0].click();
11341					return false;
11342				});
11343			});
11344
11345		})
11346	};
11347
11348	clickRow();
11349
11350	var hoverRow = function(){
11351		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
11352
11353		$postLists.on('mouseenter', function(){
11354			$(this).addClass('post-table-hover');
11355		});
11356		$postLists.on('mouseleave', function(){
11357			$(this).removeClass('post-table-hover');
11358		});
11359	}
11360
11361	hoverRow();
11362
11363	var drop_wp_animation = function() {
11364		var $postLists = $('.uncode-post-table');
11365		$postLists.each(function(){
11366			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
11367				new Waypoint({
11368					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11369					element: val,
11370					handler: function() {
11371						var element = $(this.element),
11372							parent = element.closest('.tmb'),
11373							currentIndex = parent.index(),
11374							delay = currentIndex,
11375							delayAttr = parseInt(element.attr('data-delay'));
11376						if (isNaN(delayAttr)) delayAttr = 100;
11377						var objTimeout = requestTimeout(function() {
11378							element.addClass('start_animation');
11379						}, delay * delayAttr);
11380						if (!UNCODE.isUnmodalOpen) {
11381							this.destroy();
11382						}
11383					},
11384					offset: UNCODE.isFullPage ? '100%' : '90%'
11385				})
11386			});
11387		});
11388	}
11389
11390	var runWaypoints_TO,
11391		runWaypoints_delay = 0;
11392
11393	var runWaypoints = function(){
11394		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
11395			runWaypoints_delay = 400;
11396		}
11397		clearRequestTimeout(runWaypoints_TO);
11398		runWaypoints_TO = requestTimeout(function() {
11399			drop_wp_animation();
11400		}, runWaypoints_delay);
11401	};
11402	runWaypoints();
11403	$( document.body ).on( 'uncode_waypoints', runWaypoints );
11404	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11405		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
11406			runWaypoints();
11407			// clickRow();
11408		});
11409	}
11410};
11411
11412UNCODE.rotatingTxt = function($ctxt) {
11413
11414	if ( $('body').hasClass('compose-mode') ) {
11415		return;
11416	}
11417
11418	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
11419	var setCTA;
11420
11421	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
11422		var $heading = $(this),
11423			// debug = 0,
11424			cycle = 0,
11425			$trgt,
11426			$toMove,
11427			$highl,
11428			$col = $heading.closest('.uncont'),
11429			txt,
11430			arrTxt,
11431			textFadeIn, textFadeOut,
11432			removeWraps;
11433
11434		var defineObjs = function() {
11435			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
11436				var $rtx = $(this),
11437					fx = $rtx.attr('data-fx'),
11438					wait = $rtx.attr('data-wait'),
11439					$prev = $(this).prev().addClass('prev-rotating-start'),
11440					splitToMove = [],
11441					splitArray = [],
11442					lineArray = [],
11443					lineIndex = 0,
11444					lineStart = true,
11445					lineEnd = false,
11446					startSplit = false,
11447					$line_wrap = $rtx.closest('.heading-line-wrap'),
11448					same_line = true,
11449					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
11450					indexRtx = $splits.index($rtx);
11451
11452				fx = typeof fx === 'undefined' ? '' : fx;
11453				wait = typeof wait === 'undefined' ? '' : wait;
11454
11455				$splits.each(function(key, val){
11456					var $split = $(this),
11457						$new_line_wrap = $split.closest('.heading-line-wrap');
11458
11459					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
11460						splitArray.push( $split );
11461					}
11462
11463					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
11464						startSplit = false;
11465					}
11466
11467					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
11468						splitArray.push( $split );
11469
11470						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
11471							same_line = true;
11472						} else {
11473							same_line = false;
11474						}
11475					}
11476
11477					if ( key == indexRtx ) {
11478						if ( /\S/.test($split.text()) ) {
11479							startSplit = true;
11480							$line_wrap = $split.closest('.heading-line-wrap');
11481							splitArray.push( $split );
11482						} else {
11483							indexRtx++;
11484						}
11485					}
11486
11487					$line_wrap = $new_line_wrap;
11488				});
11489
11490				$toMove = $($.map(splitToMove, function(el){return el.get();}));
11491				$trgt = $($.map(splitArray, function(el){return el.get();}));
11492
11493				if ( same_line ) {
11494					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
11495					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
11496				}
11497
11498				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
11499					$prev.addClass('empty-span-hidden');
11500				}
11501
11502				$highl = $('.heading-text-highlight-inner', $trgt);
11503
11504				$rtx.attr('data-animated', 'true');
11505				if ( cycle == 0 ) {
11506					$( document.body ).trigger('defer-highlights');
11507					cycle++;
11508					defineObjs();
11509					return;
11510				}
11511				cycle++;
11512
11513				txt = $rtx.attr('data-text');
11514				arrTxt = txt.split("|");
11515
11516				textFadeOut($trgt);
11517
11518			});
11519		};
11520
11521		removeWraps = function(){
11522
11523			// if ( debug == 1 ) return;
11524			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
11525			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
11526
11527
11528				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
11529					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
11530
11531				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
11532
11533				$splitFlow.each(function(){
11534					$(this).append($temp_highl);
11535				});
11536
11537				var $line_wrap = $wraps[wrap_k];
11538				var $parent_wrap = $line_wrap.parentNode;
11539				if ( $parent_wrap !== null ) {
11540					while ( $line_wrap.firstChild ) {
11541						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
11542					}
11543					$parent_wrap.removeChild($line_wrap);
11544				}
11545			}
11546			// debug++;
11547			defineObjs();
11548		};
11549
11550		var loop = 0;
11551		textFadeIn = function($trgt){
11552			var word = arrTxt[loop].split(" "),
11553				worsSpan = '',
11554				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11555				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11556				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
11557
11558			for (var w = 0; w < word.length; w++) {
11559				var highl;
11560				if ( $highl.length ) {
11561					highl = $highl[0].outerHTML;
11562				} else {
11563					highl = '';
11564				}
11565
11566				if ( w > 0 ) {
11567					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
11568				}
11569				var charachters = word[w].split('');
11570				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
11571				if ( ! SiteParameters.uncode_has_ligatures ) {
11572					for (var c = 0; c < charachters.length; c++) {
11573						worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
11574					}
11575				} else {
11576					worsSpan += word[w];
11577				}
11578				worsSpan += '</span>' + highl + '</span></span>';
11579			}
11580
11581			if ( $wrap.length && $wrap_inner.length ) {
11582				var words_w = $wrap_inner.outerWidth();
11583				$wrap.css({
11584					width: words_w
11585				});
11586
11587				$highl = $('.heading-text-highlight-inner', $wrap);
11588				$highl.prependTo($wrap);
11589
11590				$wrap_inner.css({
11591					opacity: 0
11592				});
11593
11594				$wrap_inner.html(worsSpan);
11595				$('.heading-text-highlight-inner', $wrap_inner).remove();
11596				words_w = $wrap_inner.innerWidth();
11597
11598				var duration = 0.45;
11599
11600				$heading.removeClass('auto-width');
11601				if ( words_w > $col.width() ) {
11602					$heading.addClass('auto-width');
11603					words_w = 'auto';
11604					duration = 0;
11605				}
11606
11607				$wrap.css({
11608					'width': words_w,
11609					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
11610				});
11611
11612				var $word_inner = $('.split-word-inner', $wrap_inner),
11613					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
11614
11615				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11616
11617				if ( !$target_fx.length ) {
11618					return;
11619				}
11620
11621				gsap.killTweensOf($target_fx);
11622
11623				if ( fx !== 'zoom' ) {
11624					gsap.fromTo( $target_fx, {
11625						y: fx === 'opacity' ? '0%' : '-10%'
11626					},{
11627						delay: duration,
11628						duration: 0.25,
11629						y: '0%',
11630						ease: Circ.easeOut,
11631					});
11632
11633					if ( !$wrap_inner.length ) {
11634						return;
11635					}
11636
11637					gsap.fromTo( $wrap_inner, {
11638						opacity: 0,
11639					},{
11640						delay: duration,
11641						duration: 0.25,
11642						opacity: 1,
11643						ease: Circ.easeOut,
11644						onComplete: function(){
11645							$('> .heading-text-highlight-inner', $wrap).remove();
11646							$wrap_inner.html(worsSpan);
11647							removeWraps();
11648						}
11649					})
11650
11651				} else {
11652					gsap.fromTo( $target_fx, {
11653						transformOrigin: '50%',
11654						opacity: 0,
11655						scale: 0.875,
11656					},{
11657						opacity: 1,
11658						delay: duration,
11659						duration: 0.25,
11660						scale: 1,
11661						ease: Circ.easeOut,
11662						onComplete: function(){
11663							$('> .heading-text-highlight-inner', $wrap).remove();
11664							$wrap_inner.html(worsSpan);
11665							removeWraps();
11666						}
11667					});
11668				}
11669
11670			} else {
11671
11672				if ( !$wrap_inner.length ) {
11673					return;
11674				}
11675
11676				gsap.to( $wrap_inner, {
11677					duration: 0.4,
11678					opacity: 0,
11679					ease: Power1.easeOut,
11680					onComplete: function(){
11681						$wrap_inner.html(worsSpan);
11682						words_w = $wrap_inner.innerWidth();
11683
11684						gsap.to( $wrap_inner, {
11685							duration: 0.2,
11686							opacity: 1,
11687							ease: Power1.easeOut,
11688							onComplete: function(){
11689								$('> .heading-text-highlight-inner', $wrap).remove();
11690								$wrap_inner.html(worsSpan);
11691								removeWraps();
11692							}
11693						})
11694					}
11695				});
11696			}
11697
11698			if ( loop < arrTxt.length-1 ) {
11699				loop++;
11700			} else {
11701				loop = 0;
11702			}
11703
11704		};
11705
11706		textFadeOut = function($trgt){
11707			var $word_inner = $('.split-word-inner', $trgt),
11708				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11709				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11710				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
11711				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
11712
11713			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
11714
11715			var gsap_param = {
11716					delay: wait,
11717					duration: 0.25,
11718					y: fx === '' ? '10%' : '0%',
11719					opacity: 0,
11720					ease: Circ.easeOut,
11721					onStart: function(){
11722						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
11723							$highl = $('.heading-text-highlight-inner', $wrap);
11724							$highl.prependTo($wrap);
11725						}
11726					},
11727					onComplete: textFadeIn,
11728					onCompleteParams: [$trgt]
11729				};
11730
11731			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11732
11733			if ( fx === '' ) {
11734				gsap_param.y = '10%';
11735			} else if ( fx === 'zoom' ) {
11736				gsap_param.scale = '1.045';
11737			}
11738
11739			if ( !$target_fx.length ) {
11740				return;
11741			}
11742
11743			if ( $heading.data('waypoint') !== true ) {
11744				var textInView = new Waypoint.Inview({
11745					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11746					element: $heading[0],
11747					enter: function(direction) {
11748						$heading.data('waypoint',true);
11749						gsap.fromTo( $target_fx, {
11750							transformOrigin: '50%'
11751						}, gsap_param );
11752					}
11753				});
11754			} else {
11755				gsap.fromTo( $target_fx, {
11756					transformOrigin: '50%'
11757				}, gsap_param );
11758			}
11759		};
11760
11761		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11762			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
11763				var $el = model.view.$el,
11764					shortcode = model.attributes.shortcode;
11765
11766				UNCODE.rotatingTxt($el);
11767			});
11768		} else {
11769			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
11770				$heading.on('already-animated', function(){
11771					removeWraps();
11772					window.addEventListener('removeOldLines', function(){
11773						clearRequestTimeout(setCTA);
11774						setCTA = requestTimeout( removeWraps, 150 );
11775					});
11776				});
11777			} else {
11778				$(window).on('load', function(){
11779					removeWraps();
11780					window.addEventListener('removeOldLines', function(){
11781						clearRequestTimeout(setCTA);
11782						setCTA = requestTimeout( removeWraps, 150 );
11783					});
11784				});
11785			}
11786		}
11787	});
11788
11789};
11790
11791UNCODE.verticalText = function() {
11792	$(window).on('menuCanvasOpen', function(){
11793		$('.vertical-text--fixed').fadeOut(500);
11794		$('.horizontal-text--fixed').fadeOut(500);
11795	}).on('menuCanvasClose', function(){
11796		$('.vertical-text--fixed').fadeIn(500);
11797		$('.horizontal-text--fixed').fadeIn(500);
11798	});
11799
11800	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
11801	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
11802	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
11803	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
11804
11805	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
11806		window.addEventListener('scroll', function(e) {
11807			var totalPageHeight = document.body.scrollHeight;
11808			var scrollPoint = window.scrollY + window.innerHeight;
11809
11810			if (window.scrollY > 0) {
11811				showOnTopVerticalTexts.fadeOut();
11812				showOnTopHorizontalTexts.fadeOut();
11813			} else {
11814				showOnTopVerticalTexts.fadeIn();
11815				showOnTopHorizontalTexts.fadeIn();
11816			}
11817
11818			if (scrollPoint >= totalPageHeight) {
11819				hideOnBottomVerticalTexts.fadeOut();
11820				hideOnBottomHorizontalTexts.fadeOut();
11821			} else {
11822				hideOnBottomVerticalTexts.fadeIn();
11823				hideOnBottomHorizontalTexts.fadeIn();
11824			}
11825		}, false);
11826	}
11827};
11828
11829UNCODE.stickyScroll = function( $el ) {
11830	if ( typeof $el === 'undefined' || $el === null ) {
11831		$el = $('body');
11832	}
11833	var checkVisible = function( el, dir ) {
11834		if (typeof jQuery === "function" && el instanceof jQuery) {
11835			el = el[0];
11836		}
11837
11838		var off = 50;
11839		dir = typeof dir=='undefined' ? 'right' : dir;
11840		var rect = el.getBoundingClientRect();
11841
11842		return (
11843			(
11844				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11845				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11846				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
11847			) &&
11848			(
11849				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11850				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11851				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
11852				( rect.right <= window.innerWidth && rect.left >= 0 )
11853			)
11854		);
11855	};
11856
11857	var setItemsRelHeight = function(reset) {
11858		var $_el = $el;
11859		if ( $el.is('.index-scroll') ) {
11860			var $_el = $el.closest('.uncont');
11861		}
11862		// $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
11863		// 	$.each($('.tmb', item), function(index, val) {
11864		// 		if ( reset === true ) {
11865		// 			$(val).css( 'visibility', 'hidden' );
11866		// 		} else {
11867		// 			$(val).css( 'visibility', 'visible' );
11868		// 		}
11869		// 	});
11870		// });
11871		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
11872			$.each($('.tmb', item), function(index, val) {
11873				if ( reset === true ) {
11874					$(val).css( 'visibility', 'hidden' );
11875					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
11876				} else {
11877					var $rowParent = $(item).closest('.row-parent'),
11878						rowRatio = $rowParent.attr('data-height-ratio'),
11879						$rowInner = $(item).closest('.row-child'),
11880						rowRatioInner = $rowInner.attr('data-height'),
11881						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11882						$colContainer = $(item).closest('.uncell'),
11883						$uncont = $(item).closest('.uncont'),
11884						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
11885						safe_heigth = $(item).data('safe-height'),
11886						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
11887						offSet = $(item).offset().top - $uncont.offset().top,
11888						multiplier_h,
11889						data_viewport_h,
11890						body_border = $('.body-borders .top-border').outerHeight() * 2,
11891						remove_menu = $(item).data('vp-menu');
11892
11893					if ( rowRatio === 'full' || rowRatio === '' ) {
11894						rowRatio = 1;
11895					} else {
11896						rowRatio = rowRatio / 100;
11897					}
11898
11899					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
11900						rowRatio = rowRatio;
11901					} else {
11902						rowRatio = rowRatio * rowRatioInner / 100;
11903					}
11904
11905					winHeight = winHeight * rowRatio;
11906
11907					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11908						multiplier_h = parseInt($(item).attr('data-vp-height'));
11909					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
11910						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
11911					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
11912						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
11913					}
11914
11915					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
11916						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
11917						if ( remove_menu === true ) {
11918							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
11919						}
11920						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
11921					} else {
11922						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
11923					}
11924
11925				}
11926			});
11927		});
11928		$('.index-scroll', $_el).each(function(i, item){
11929			var $uncoltable = $(item).closest('.uncoltable'),
11930				$rowParent = $(item).closest('.row-parent'),
11931				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11932				body_border = $('.body-borders .top-border').outerHeight() * 2,
11933				$index_row = $('.index-row', item),
11934				safe_heigth = $index_row.data('safe-height'),
11935				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
11936			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
11937				var data_viewport_h = winHeight - ( paddingRow + body_border );
11938				$uncoltable.css({
11939					'min-height': data_viewport_h
11940				});
11941			} else {
11942				$uncoltable.css({
11943					'min-height': 'auto'
11944				});
11945			}
11946		});
11947
11948	}
11949	setItemsRelHeight();
11950
11951	var $index_scrolls = $('.index-scroll', $el);
11952
11953	$index_scrolls.each(function(key, value){
11954		var $index = $(this),
11955			$parent_row = $index.closest('.vc_row[data-parent]'),
11956			$index_row = $('.index-row', $index),
11957			dir = $index_row.attr('data-direction');
11958		dir = typeof dir === 'undefined' ? 'right' : dir;
11959
11960		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
11961
11962		if ( $('.animate_when_almost_visible', $index).length ) {
11963			$index.addClass('opacity_0').addClass('scroll-refresh-hidden');
11964		}
11965
11966	});
11967
11968	var $horScrolls = $('.unscroll-horizontal', $el);
11969
11970	if ( $horScrolls.length ) {
11971
11972		$('body').addClass('scrolling-trigger');
11973
11974		$horScrolls.each(function(key, value){
11975			var $section = $(this),
11976				$index_scroll = $('.index-scroll', $section),
11977				$index_row = $('.index-row', $index_scroll),
11978				dir = $section.attr('data-direction'),
11979				wrap = $index_row.attr('data-wrap'),
11980				$pinWrap,
11981				$pinTrigger;
11982
11983			dir = typeof dir === 'undefined' ? 'right' : dir;
11984			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
11985			$pinWrap = $('<div class="pin-wrap" />');
11986			if ( SiteParameters.is_frontend_editor ) {
11987				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
11988				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
11989			} else {
11990				if ( wrap === 'column' ) {
11991					$index_scroll.wrapInner( $pinWrap );
11992				} else {
11993					$('> .row', $section).wrap( $pinWrap );
11994				}
11995				$section.wrapInner( $pinTrigger );
11996			}
11997
11998		});
11999
12000		var $pinWraps = $('.pin-wrap', $el);
12001
12002		var horScrollSizes = function(){
12003
12004			$pinWraps.each(function(key, val){
12005				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
12006					$pinTrigger = $pinWrap.closest('.pin-trigger'),
12007					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
12008					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
12009					$boxContainer = $('.box-container'),
12010					box_m = $boxContainer.css('margin-left'),
12011					st_active = true;
12012
12013				var setHorW,
12014				horWidth = function(){
12015					$index_scroll.each(function(){
12016						var $this = $(this),
12017							$index_row = $('.index-row', $this),
12018							$rowContainer = $index_row.closest('.vc_row'),
12019							$rowInner = $index_row.closest('.wpb_row'),
12020							$rowParent = $index_row.closest('.row-parent'),
12021							$tmbs = $('.tmb', $index_row),
12022							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
12023							$uncont = $index_row.closest('.uncont'),
12024							$parent_col = $index_row.closest('.wpb_column'),
12025							col_w = $uncont.width(),
12026							data_lg = parseFloat( $index_row.attr('data-lg') ),
12027							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
12028							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
12029							tmb_w;
12030
12031						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
12032						tmb_w = ( col_w + padding_tmb ) / data_lg;
12033
12034						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
12035							tmb_w = ( col_w + padding_tmb ) / data_sm;
12036						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
12037							tmb_w = ( col_w + padding_tmb ) / data_md;
12038						}
12039
12040						if ( !isNaN(tmb_w) ) {
12041							$tmbs.css({
12042								'width': tmb_w
12043							});
12044						}
12045
12046						$tmbs.css({
12047							'visibility': 'visible'
12048						});
12049
12050					});
12051				};
12052
12053				horWidth();
12054				clearRequestTimeout(setHorW);
12055				setHorW = requestTimeout( function(){
12056					setItemsRelHeight();
12057					horWidth();
12058				}, 100 );
12059
12060				if ( SiteParameters.is_frontend_editor ) {
12061					return;
12062				}
12063
12064				var $vmenu = $('body.vmenu .vmenu-container'),
12065					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
12066					winWidth = window.innerWidth - vmenuW,
12067					$tmb = $('.tmb', $index_scroll).eq(0),
12068					paddingRight = parseFloat( $tmb.css('padding-right') ),
12069					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_
12069scroll.width() + paddingRight ) ),
12070					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
12071					scroll_anim;
12072
12073				if ( $('body').hasClass('rtl') ) {
12074					if ( dir === 'left' ) {
12075						scroll_anim = gsap.fromTo( $pinWrap, {
12076							x: stickyScrollLength
12077						},{
12078							x: 0,
12079							ease: "none"
12080						});
12081					} else {
12082						scroll_anim = gsap.fromTo( $pinWrap, {
12083							x: 0
12084						},{
12085							x: stickyScrollLength,
12086							ease: "none"
12087						});
12088					}
12089				} else {
12090					if ( dir === 'left' ) {
12091						scroll_anim = gsap.fromTo( $pinWrap, {
12092							x: -stickyScrollLength
12093						},{
12094							x: 0,
12095							ease: "none"
12096						});
12097					} else {
12098						scroll_anim = gsap.fromTo( $pinWrap, {
12099							x: 0
12100						},{
12101							x: -stickyScrollLength,
12102							ease: "none"
12103						});
12104					}
12105				}
12106
12107				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
12108					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
12109				}
12110
12111				var animationIncrease;
12112
12113				var checkForAnimations = function(){
12114					animationIncrease = 0
12115					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
12116						var _this = this;
12117						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
12118							var delayAttr = parseFloat( $(_this).attr('data-delay') );
12119							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
12120							requestTimeout(function() {
12121								$(_this).addClass('start_animation');
12122							}, delayAttr + animationIncrease);
12123							animationIncrease += 150;
12124						}
12125						$(_this).on([
12126							'webkitAnimationEnd',
12127							'mozAnimationEnd',
12128							'MSAnimationEnd',
12129							'oanimationend',
12130							'animationend'
12131						].join(' '), function(e) {
12132							$(e.currentTarget).removeClass('animate_when_almost_visible');
12133						});
12134					});
12135
12136					var batchTime = 0;
12137
12138					var resetBatch = function(){
12139						batchTime = 0;
12140					}
12141
12142					if (ScrollTrigger.isScrolling()) {
12143						resetBatch();
12144					}
12145					
12146					$('.tmb-mask-reveal', $pinTrigger).each(function(){
12147						var _this = this,
12148							$this = $(_this),
12149							$inside = $('.t-inside', $this),
12150							delay = parseFloat( $inside.attr('data-delay') ),
12151							speed = parseFloat( $inside.attr('data-speed') ),
12152							easing = $inside.attr('data-easing'),
12153							bgDelay = parseFloat( $inside.attr('data-bg-delay') );
12154
12155						delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
12156						speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
12157						easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
12158						bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
12159
12160						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) {
12161							$this.addClass('tmb-mask-init');
12162							if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) {
12163								gsap.to($('.t-entry-visual-tc', $this), speed, {
12164									clipPath: 'inset(0% 0% 0% 0%)',
12165									delay: delay + batchTime,
12166									ease: easing,
12167								});
12168								gsap.to($('.t-entry-visual-cont', $this), speed, {
12169									clipPath: 'inset(0% 0% 0% 0%)',
12170									scale: 1,
12171									delay: delay + batchTime + (speed*bgDelay),
12172									ease: easing,
12173									onComplete: resetBatch,
12174								});
12175							} else {
12176								gsap.to($('.t-entry-visual-cont', $this), speed, {
12177									clipPath: 'inset(0% 0% 0% 0%)',
12178									scale: 1,
12179									delay: delay + batchTime,
12180									ease: easing,
12181									onComplete: resetBatch,
12182								});
12183							}
12184							batchTime += 0.1;
12185						}
12186					});
12187				
12188				};
12189				checkForAnimations();
12190
12191				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
12192				var start = 0;
12193
12194				var horST = ScrollTrigger.create({
12195					id: "stickySectionScrolling" + key,
12196					scrub: true,
12197					trigger: $pinTrigger[0],
12198					pin: true,
12199					anticipatePin: 1,
12200					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
12201					end: function() { return "+="+stickyScrollLength; },
12202					animation: scroll_anim,
12203					ease: Sine.easeOut,
12204					onUpdate: checkForAnimations,
12205					invalidateOnRefresh: true,
12206					onEnter: function(){
12207						$pinTrigger.addClass('enter-st');
12208					},
12209					onEnterBack: function(){
12210						$pinTrigger.addClass('enter-st');
12211					},
12212					onLeave: function(){
12213						$pinTrigger.removeClass('enter-st');
12214					},
12215					onLeaveBack: function(){
12216						$pinTrigger.removeClass('enter-st');
12217					}
12218				});
12219
12220				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
12221				window.dispatchEvent(new CustomEvent('boxResized'));
12222
12223				var testSecondTrigger = function(){
12224					animationIncrease = 0
12225					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
12226						var _this = this;
12227						if ( checkVisible(_this) ) {
12228							var delayAttr = parseFloat( $(_this).attr('data-delay') );
12229							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
12230							requestTimeout(function() {
12231								$(_this).addClass('start_animation');
12232							}, delayAttr + animationIncrease);
12233							animationIncrease += 150;
12234						}
12235					});
12236
12237				};
12238
12239				var verST = ScrollTrigger.create({
12240					id: "verticalSectionScrolling" + key,
12241					trigger: $pinTrigger[0],
12242					start: "top center",
12243					end: function() { return "+="+UNCODE.wheight; },
12244					onUpdate: testSecondTrigger,
12245					invalidateOnRefresh: true
12246				});
12247
12248				var setCTA,
12249
12250				dis_enable_ST = function(){
12251					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
12252						horST.kill();
12253						verST.kill();
12254						$pinTrigger.addClass('disabled');
12255						st_active = false;
12256					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12257						horST.kill();
12258						verST.kill();
12259						$pinTrigger.addClass('disabled');
12260						st_active = false;
12261					}
12262				};
12263
12264				$(window).on('resize load', function() {
12265					clearRequestTimeout(setCTA);
12266					setCTA = requestTimeout(function() {
12267						dis_enable_ST();
12268						checkForAnimations();
12269					}, 500);
12270				});
12271
12272			});
12273		};
12274
12275		$(window).on( 'load', function(){
12276			horScrollSizes();
12277		});
12278		var setResize,
12279			setReLayout,
12280			doubleResize = true;
12281		$(window).on( 'load', function(){
12282			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
12283				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
12284				Array.prototype.forEach.call($row_inners, function(el) {
12285					el.style.height = '';
12286					el.style.marginBottom = '';
12287				});
12288				setItemsRelHeight();
12289				horScrollSizes();
12290				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12291					$(document).trigger('uncode-scrolltrigger-refresh');
12292				}
12293			}
12294			var carousel = document.querySelector(".owl-carousel"),
12295				grid = document.querySelector(".isotope-container"),
12296				stickyAll = document.querySelectorAll(".index-scroll");
12297
12298			if ( stickyAll.length ) {
12299				var sticky = stickyAll[(stickyAll.length-1)];
12300			}
12301
12302			if ( typeof sticky !== "undefined" ) {
12303
12304				if ( typeof carousel !== "undefined" && carousel !== null ) {
12305					var carousel_position = sticky.compareDocumentPosition(carousel);
12306				}
12307				if ( typeof grid !== "undefined" && grid !== null ) {
12308					var grid_position = sticky.compareDocumentPosition(grid);
12309				}
12310
12311				if ( carousel_position === 2 || grid_position === 2 ) {
12312					setTimeout(function(){
12313						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12314							$(document).trigger('uncode-scrolltrigger-refresh');
12315						}
12316					}, 500);
12317				}
12318
12319			}
12320			
12321		});
12322        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
12323            android = /Android/.test(navigator.userAgent) && !window.MSStream;
12324		$(window).on( 'resize orientationchange', function(e){
12325			if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
12326				return;
12327			}
12328			setItemsRelHeight(true);
12329			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
12330			Array.prototype.forEach.call($row_inners, function(el) {
12331				el.style.height = '';
12332				el.style.marginBottom = '';
12333			});
12334			clearRequestTimeout(setResize);
12335			setResize = requestTimeout( function(){
12336				setItemsRelHeight();
12337				horScrollSizes();
12338				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12339					$(document).trigger('uncode-scrolltrigger-refresh');
12340				}
12341				if ( doubleResize === true ) {
12342					window.dispatchEvent(new Event('resize'));
12343					doubleResize = false;
12344				} else {
12345					doubleResize = true;
12346				}
12347				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
12348			}, 100 );
12349		});
12350
12351		var show_pins = function(){
12352			$('.index-scroll').css({'opacity':'1'});
12353		};
12354		ScrollTrigger.addEventListener("refresh", show_pins);
12355		$(window).on( 'uncode.re-layout', function(){
12356			//$('.index-scroll').css({'opacity':'0'});
12357			$('.pin-spacer').each(function(){
12358				var space_h = $(this).outerHeight(),
12359					$row = $(this).closest('.row-container');
12360				$row.css({
12361					'height': space_h,
12362					'overflow': 'hidden'
12363				});
12364			});
12365			if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12366				ScrollTrigger.refresh(true);
12367			}
12368			clearRequestTimeout(setReLayout);
12369			setReLayout = requestTimeout( function(){
12370				$('.row-container').each(function(){
12371					$(this).css({
12372						'height': '',
12373						'overflow': ''
12374					});
12375				});
12376			}, 1000);
12377		});
12378	}
12379
12380};
12381
12382UNCODE.stickyTrigger = function($el) {
12383	if (SiteParameters.is_frontend_editor) {
12384		return false;
12385	}
12386
12387	var resizeTimer;
12388	var oldW = UNCODE.wwidth;
12389	var stickyObservers = [];
12390	var stickyInstances = [];
12391	var isRefreshing = false;
12392	var pendingRefresh = false;
12393	var lastStickyMetrics = {
12394		rowH: 0,
12395		uncontH: 0
12396	};
12397
12398	function clearStickyInstances() {
12399		stickyInstances.forEach(function(st) {
12400			if (st && st.kill) {
12401				st.kill();
12402			}
12403		});
12404		stickyInstances = [];
12405	}
12406
12407	function clearStickyObservers() {
12408		stickyObservers.forEach(function(observer) {
12409			try {
12410				observer.disconnect();
12411			} catch (e) {}
12412		});
12413		stickyObservers = [];
12414	}
12415
12416	function getStickyMetrics() {
12417		var $firstSticky = $('.sticky-trigger').first();
12418		if (!$firstSticky.length) {
12419			return {
12420				rowH: 0,
12421				uncontH: 0
12422			};
12423		}
12424
12425		var $row = $firstSticky.closest('.vc_row');
12426		var $uncont = $firstSticky.closest('.uncont');
12427
12428		return {
12429			rowH: $row.length ? Math.round($row.outerHeight()) : 0,
12430			uncontH: $uncont.length ? Math.round($uncont.outerHeight()) : 0
12431		};
12432	}
12433
12434	function metricsChanged(nextMetrics) {
12435		return (
12436			Math.abs(nextMetrics.rowH - lastStickyMetrics.rowH) > 1 ||
12437			Math.abs(nextMetrics.uncontH - lastStickyMetrics.uncontH) > 1
12438		);
12439	}
12440
12441	function buildSticky() {
12442		clearStickyInstances();
12443		clearStickyObservers();
12444
12445		$('.sticky-trigger').each(function() {
12446			var $sticky = $(this);
12447			var $inside = $sticky.children('div').first();
12448			var $row = $sticky.closest('.vc_row');
12449			var $uncont = $sticky.closest('.uncont');
12450
12451			if (!$inside.length || !$row.length || !$uncont.length) {
12452				return;
12453			}
12454
12455			var st = ScrollTrigger.create({
12456				trigger: $sticky[0],
12457				start: function() {
12458					var insideH = $inside.outerHeight() || 0;
12459					return 'top center-=' + (insideH / 2);
12460				},
12461				endTrigger: $row[0],
12462				end: function() {
12463					var insideH = $inside.outerHeight() || 0;
12464					var rowBottom = $row.offset().top + $row.outerHeight();
12465					var uncontBottom = $uncont.offset().top + $uncont.outerHeight();
12466					var diffBottom = rowBottom - uncontBottom;
12467
12468					return 'bottom center+=' + (insideH / 2 + diffBottom);
12469				},
12470				anticipatePin: true,
12471				pin: true,
12472				pinSpacing: false,
12473				scrub: true,
12474				invalidateOnRefresh: true
12475			});
12476
12477			stickyInstances.push(st);
12478
12479			if (typeof ResizeObserver !== 'undefined') {
12480				var ro = new ResizeObserver(function() {
12481					if (isRefreshing) {
12482						pendingRefresh = true;
12483						return;
12484					}
12485
12486					var nextMetrics = getStickyMetrics();
12487
12488					if (!metricsChanged(nextMetrics)) {
12489						return;
12490					}
12491
12492					refreshSticky(true);
12493				});
12494
12495				try {
12496					// NON osservare $inside: tende a creare loop continui
12497					ro.observe($row[0]);
12498					ro.observe($uncont[0]);
12499					stickyObservers.push(ro);
12500				} catch (e) {}
12501			}
12502		});
12503
12504		lastStickyMetrics = getStickyMetrics();
12505	}
12506
12507	function refreshSticky(fromObserver) {
12508		clearRequestTimeout(resizeTimer);
12509
12510		resizeTimer = requestTimeout(function() {
12511			if (isRefreshing) {
12512				pendingRefresh = true;
12513				return;
12514			}
12515
12516			isRefreshing = true;
12517			pendingRefresh = false;
12518
12519			var beforeMetrics = getStickyMetrics();
12520
12521			buildSticky();
12522
12523			requestTimeout(function() {
12524				isRefreshing = false;
12525
12526				var afterMetrics = getStickyMetrics();
12527				var reallyChanged = metricsChanged(afterMetrics);
12528
12529				lastStickyMetrics = afterMetrics;
12530
12531				if (!fromObserver) {
12532					$(document).trigger('uncode-scrolltrigger-refresh');
12533				} else if (reallyChanged) {
12534					$(document).trigger('uncode-marquee-sticky-refresh');
12535				}
12536
12537				if (pendingRefresh) {
12538					pendingRefresh = false;
12539					refreshSticky(true);
12540				}
12541			}, 120);
12542		}, fromObserver ? 160 : 100);
12543	}
12544
12545	function maybeDelayedRefresh() {
12546		var carousel = document.querySelector('.owl-carousel');
12547		var grid = document.querySelector('.isotope-container');
12548		var stickyAll = document.querySelectorAll('.sticky-trigger');
12549		var sticky = stickyAll.length ? stickyAll[stickyAll.length - 1] : null;
12550		var carousel_position;
12551		var grid_position;
12552
12553		if (!sticky) {
12554			return;
12555		}
12556
12557		if (carousel) {
12558			carousel_position = sticky.compareDocumentPosition(carousel);
12559		}
12560		if (grid) {
12561			grid_position = sticky.compareDocumentPosition(grid);
12562		}
12563
12564		if (carousel_position === 2 || grid_position === 2) {
12565			setTimeout(function() {
12566				refreshSticky(false);
12567			}, 500);
12568		}
12569	}
12570
12571	$(window).on('load', function() {
12572		buildSticky();
12573		maybeDelayedRefresh();
12574	});
12575
12576	$(window).on('resize uncode.re-layout', function(e) {
12577		if (e.type === 'resize' && oldW === UNCODE.wwidth) {
12578			return;
12579		}
12580
12581		oldW = UNCODE.wwidth;
12582		refreshSticky(false);
12583	});
12584
12585	$(document).on('uncode-sticky-refresh uncode-toggle-change', function() {
12586		refreshSticky(false);
12587	});
12588};
12589UNCODE.areaTextReveal = function() {
12590    if ( ! $('.text-reveal, .scroll-trigger-el').length ) {
12591        return;
12592    }
12593	if ( ! SiteParameters.is_frontend_editor ) {
12594        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
12595            android = /Android/.test(navigator.userAgent) && !window.MSStream,
12596            prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
12597            prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
12598                document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
12599            firstObs = true,
12600            isMobileUsing = false;
12601
12602        var observer = new ResizeObserver(function(){
12603            var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
12604                newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
12605                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
12606                set = false;
12607            if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
12608                set = true;
12609                prevW = newW;
12610            } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
12611                set = true;
12612                prevH = newH;
12613            }
12614            if ( set || firstObs ) {
12615                window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe'));
12616                firstObs = false;
12617            }
12618        }).observe(document.body);
12619
12620        if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
12621            window.scrollTo = function() {
12622                return;
12623            };
12624            isMobileUsing = true;
12625
12626            $('html, body').css({
12627                'overscroll-behavior': 'none'
12628            });
12629        }
12630
12631        var setTriggerObserve;
12632
12633        ScrollTrigger.observe({
12634            trigger: 'body',
12635            type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
12636            onUp: function() { ScrollTrigger.update(); },
12637        });
12638    }
12639
12640    var textReveal = function(){
12641
12642        if ( SiteParameters.is_frontend_editor ) {
12643            return;
12644        }
12645
12646        var setTxtReveal,
12647            txtTrggrStart = false;
12648
12649        function headingReveal($sel){
12650            txtTrggrStart = true;
12651            $('.text-reveal', $sel).each(function(val, key){
12652                var $txtReveal = $(this).attr('data-init-reveal', true),
12653                    $trigger = $txtReveal,
12654                    $rowParent = $txtReveal.closest('.row-container[data-parent]'),
12655                    hReveal = $txtReveal.outerHeight(),
12656                    $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'),
12657                    $sticky = $txtReveal.closest('.sticky-element'),
12658                    dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
12659                    dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
12660                    dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')),
12661                    $lines = $('.heading-line-wrap', $txtReveal),
12662                    $words = $('.split-word-inner', $txtReveal),
12663                    $chars = $('.split-char', $txtReveal),
12664                    $elToReveal = $words;
12665
12666                if ( $pin.length ) {
12667                    return;
12668                } else if ( $sticky.length ) {
12669                    hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop);
12670                    $trigger = $sticky.parent();
12671                }
12672
12673                if ( dataReveal === 'chars' ) {
12674                    $elToReveal = $chars;
12675                } else if ( dataReveal === 'lines' ) {
12676                    $elToReveal = $lines;
12677                }
12678                
12679                var tl = gsap.timeline({
12680                    scrollTrigger: {
12681                        trigger: $trigger,
12682                        start: "top +=" + (window.innerHeight/100*dataTop) + "px",
12683                        end: "+=" + hReveal + "px",
12684                        id: "txt_reveal_" + key,
12685                        scrub: true,
12686                    }
12687                });
12688                gsap.set(
12689                    $elToReveal, {
12690                        opacity: dataRevealOpacity,
12691                    }
12692                )
12693                tl.fromTo($elToReveal, {
12694                    opacity: dataRevealOpacity,
12695                    duration: 1,
12696                }, {
12697                    opacity: 1,
12698                    stagger: 0.05,
12699                    duration: 1,
12700
12701                });
12702                $(window).on('uncode.tl-refresh', function(){
12703                    if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
12704                        tl.scrollTrigger.refresh();
12705                    }
12706                });
12707
12708                $rowParent.one( 'uncodeWordLines', function(){
12709                    clearRequestTimeout(setTxtReveal);
12710                    setTxtReveal = requestTimeout( function(){
12711                        gsap.set($elToReveal, {clearProps: true});
12712                        tl.kill(true);
12713                        if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) {
12714                            ScrollTrigger.getById("txt_reveal_" + key).kill(true);
12715                        }
12716                        headingReveal($sel)
12717                    }, 100);
12718                });
12719
12720            });
12721        };
12722
12723        window.addEventListener("load", function (e) {
12724            if (!txtTrggrStart) {
12725                headingReveal($("body"));
12726                $(window).trigger("resize");
12727            }
12728        });
12729
12730        $('.row-container[data-parent]').each(function(){
12731            if (!txtTrggrStart) {
12732                var $this = $(this);
12733                $this.on('uncodeWordLines', function(){
12734                    headingReveal($this);
12735                });
12736            }
12737        });
12738
12739        $(window).on('uncode-sticky-trigger-observe', function(e){
12740            clearRequestTimeout(setTriggerObserve);
12741            setTriggerObserve = requestTimeout( function(){
12742                $(window).trigger('uncode.tl-refresh');
12743            }, 2000 );
12744        });
12745    
12746    };
12747    textReveal();
12748
12749    var areaReveal = function(){
12750        if ( SiteParameters.is_frontend_editor ) {
12751            return;
12752        }
12753
12754        $('.scroll-trigger-el').each(function(){
12755            var $scrollTrgrEl = $(this),
12756                $row = $('> .row', $scrollTrgrEl),
12757                $row_in = $('> .row-inner', $row),
12758                cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length,
12759                stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows',
12760                animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes',
12761                stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false,
12762                $animateTrgrEl = $scrollTrgrEl,
12763                noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes',
12764                noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'),
12765                els = $scrollTrgrEl.attr('data-anim-els'),
12766                sticky = $scrollTrgrEl.attr('data-anim-sticky'),
12767                noSpace = $scrollTrgrEl.attr('data-anim-no-space'),
12768                state = $scrollTrgrEl.attr('data-anim-state'),
12769                target = $scrollTrgrEl.attr('data-anim-target'),
12770                origin = $scrollTrgrEl.attr('data-anim-origin'),
12771                mask = $scrollTrgrEl.attr('data-anim-mask'),
12772                _scale = $scrollTrgrEl.attr('data-anim-scale'),
12773                stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes',
12774                opacity = $scrollTrgrEl.attr('data-anim-opacity'),
12775                radius = $scrollTrgrEl.attr('data-anim-radius'),
12776                radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'),
12777                clip_path = $scrollTrgrEl.attr('data-clip-path'),
12778                animation_x = $scrollTrgrEl.attr('data-anim-x'),
12779                animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'),
12780                animation_y = $scrollTrgrEl.attr('data-anim-y'),
12781                blur = $scrollTrgrEl.attr('data-anim-blur'),
12782                perspective = $scrollTrgrEl.attr('data-anim-perspective'),			
12783                rotate = $scrollTrgrEl.attr('data-anim-rotate'),	
12784                rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'),
12785                topBottom = $scrollTrgrEl.attr('data-anim-start'),	
12786                offTop = $scrollTrgrEl.attr('data-anim-top'),
12787                offBottom = $scrollTrgrEl.attr('data-anim-bottom'),
12788                safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0,
12789                animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'),
12790                mobile_rows_start = $scrollTrgrEl.attr('data-mobile-start-point'),
12791                mobile_start_add = $scrollTrgrEl.attr('data-mobile-start-point-add'),
12792                easeOut = $scrollTrgrEl.attr('data-anim-ease'),
12793                offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'),
12794                stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards,
12795                $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(),
12796                setTxtReveal,
12797                txtTrggrStart = false,
12798                alreadyareaAnimateScrollTl = false;
12799    
12800            _scale = _scale === '' ? 0 : parseFloat( _scale );
12801            perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001;	
12802            offTop = offTop === '' ? 0 : parseFloat( offTop );
12803            offBottom = offBottom === '' ? 0 : parseFloat( offBottom );
12804            offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard );
12805
12806            function areaAnimateScrollTl($el, id, last) {
12807                alreadyareaAnimateScrollTl = true;
12808
12809                var pTop = parseFloat( $row.css('padding-top') ),
12810                    innerGap = pTop + offSetCard * id,
12811                    scale = _scale,
12812                    rows_start = animation_rows_start;
12813                    
12814                if ( isMobileUsing && typeof mobile_rows_start !== 'undefined' ) {
12815                    rows_start = mobile_rows_start;
12816                    innerGap = 0 + parseFloat(mobile_start_add);
12817                }
12818
12819                if ( stepScale ) {
12820                    if ( _scale < 100 ) {
12821                        scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) );
12822                    }
12823                }
12824
12825                if ( els === 'content' ) {
12826                    $animateTrgrEl = $('> .row', $scrollTrgrEl);
12827                } else if ( els === 'bg' ) {
12828                    $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl);
12829                } else {
12830                    $animateTrgrEl = $el;
12831                }
12832
12833                if ( rotate_alt === 'yes') {
12834                    rotate *= -1;
12835                    perspective *= -1;
12836                }
12837                
12838                if ( animation_x_alt === 'yes') {
12839                    animation_x *= -1;
12840                }
12841
12842                var $parentDiv = $el.closest('div[data-sticky]');
12843
12844                var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px";
12845
12846                var scrllTrggr = {
12847                    trigger: $parentDiv,
12848                    end: function(){
12849                        return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom)))
12850                    },
12851                    start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
12852                    pin: sticky === 'yes' || stickyCards ? true : false,
12853                    pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0),
12854                    scrub: true,
12855                    id: 'sticky_' + id,
12856                    anticipatePin: 1,
12857                    invalidateOnRefresh: true,
12858                    // markers: {
12859                    //     indent: 150 * id
12860                    // },
12861                    onToggle: function(){
12862                        $scrollTrgrEl.attr('data-revealed', true);
12863                    },
12864                };
12865
12866
12867                if ( !stickyLast && state === 'end' ) {
12868                    last = false;
12869                } 
12870
12871                if ( stickyCards ) {
12872                    if ( state !== 'end' ) {
12873                        if ( rows_start === 'center' ) {
12874                            scrllTrggr.start = "center center";
12875                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight);
12876                        } else if ( rows_start === 'bottom' ) {
12877                            if ( stickyOpts !== 'no' ) {
12878                                scrllTrggr.start = "bottom bottom-=" + (innerGap-1)
12879                                scrllTrggr.end = "bottom bottom";
12880                            }
12881                        } else {
12882                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2);
12883                        } 
12884                        if ( stickyOpts === 'no' ) {
12885                            scrllTrggr.endTrigger = $el;
12886                            scrllTrggr.end = "+=100%";
12887                        } else {
12888                            scrllTrggr.endTrigger = $row;
12889                        }
12890                    } else {
12891                        if ( rows_start === 'center' ) {
12892                            scrllTrggr.start = "center center";
12893                        } else if ( rows_start === 'bottom' ) {
12894                            scrllTrggr.start = "bottom bottom";
12895                        } 
12896                        if ( stickyOpts !== 'no' ) {
12897                            scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1));
12898                            scrllTrggr.endTrigger = $lastEl;
12899                        } else {
12900                            scrllTrggr.end = "bottom bottom";
12901                        }
12902                    }
12903                }
12904                
12905                var tl = gsap.timeline({
12906                    scrollTrigger: scrllTrggr
12907                });
12908
12909                // var mark = last ? {
12910                //         startColor:"blue",
12911                //         endColor:"orange",
12912                //     } : false;
12913
12914                if ( !stickyCards ) {
12915                    var tlConds = tl;
12916                } else {
12917                    var scrllTrggrConds = {
12918                        trigger: $parentDiv,
12919                        end: function(){
12920                            return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom)))
12921                        }, 
12922                        pin: (state === 'end' && last),
12923                        pinSpacing: false,
12924                        scrub: true,
12925                        id: 'card_' + id,
12926                        invalidateOnRefresh: true,
12927                        // markers: true,
12928                    };
12929
12930                    if ( stickyCards ) {
12931                        if ( state !== 'end' ) {
12932                            if ( stickyOpts === '' ) {
12933                                scrllTrggrConds.end = "bottom bottom-=100%";
12934                                scrllTrggrConds.endTrigger = $row_in;
12935                            }
12936
12937                            if ( rows_start === 'bottom' ) {
12938                                if ( stickyOpts !== 'no') {
12939                                    scrllTrggrConds.start = "top top+=" + window.innerHeight;
12940                                    scrllTrggrConds.end = "bottom bottom";
12941                                }
12942                            } else if ( rows_start === 'center' ) {
12943                                scrllTrggrConds.start =  "center center";
12944                            } else {
12945                                scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12946                            }
12947                            
12948                        } else {
12949                            if ( stickyOpts === '' ) {
12950                                if ( animLast ) {
12951                                    scrllTrggrConds.end = "bottom bottom-=100%";
12952                                } else {
12953                                    scrllTrggrConds.end = "bottom bottom";
12954                                }
12955                                scrllTrggrConds.endTrigger = $lastEl;
12956                            }
12957
12958                            if ( rows_start === 'bottom' && stickyOpts !== 'no' ) {
12959                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12960                                    scrllTrggrConds.start = "bottom bottom";
12961                                } else {
12962                                    scrllTrggrConds.start = "top top+=" + $el.outerHeight();
12963                                }
12964                            } else if ( rows_start === 'center' ) {
12965                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12966                                    scrllTrggrConds.start =  "center center";
12967                                } else {
12968                                scrllTrggrConds.start =  "top+=" + ($el.outerHeight()/2) + " top+=" 
12968+ window.innerHeight/2;
12969                                }
12970                            } else {
12971                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12972                                    scrllTrggrConds.start = "top top";
12973                                } else {
12974                                    scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12975                                }
12976                            }
12977
12978                        }
12979
12980                    } else {
12981                        scrllTrggrConds.start =  start_topBottom;
12982                    }
12983
12984                    var tlConds = gsap.timeline({
12985                        scrollTrigger: scrllTrggrConds
12986                    });
12987                }
12988
12989                if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) {
12990                    if ( target === 'mask' ) {
12991                        if ( state !== 'end' ) {
12992                            if ( mask === 'auto' ) {
12993                                gsap.set(
12994                                    $animateTrgrEl, {
12995                                        clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12996                                        opacity: parseFloat(opacity)/100,
12997                                        filter: 'blur(' + blur + 'px)',
12998                                        visibility: 'visible',
12999                                    }
13000                                )
13001                                tlConds.fromTo($animateTrgrEl, {
13002                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
13003                                    opacity: parseFloat(opacity)/100,
13004                                    filter: 'blur(' + blur + 'px)',
13005                                    duration: 1,
13006                                }, {
13007                                    opacity: 1,
13008                                    clipPath: 'inset(0% 0px round 0' + radiu
13008s_unit + ')',
13009                                    filter: 'blur(0px)',
13010                                    duration: 1,
13011                                    ease: easeOut,
13012                                    //delay: 0.1
13013                                });	
13014                            } else {
13015                                tlConds.fromTo($animateTrgrEl, {
13016                                    opacity: parseFloat(opacity)/100,
13017                                    clipPath: clip_path,
13018                                    filter: 'blur(' + blur + 'px)',
13019                                    duration: 1,
13020                                }, {
13021                                    opacity: 1,
13022                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
13023                                    filter: 'blur(0px)',
13024                                    duration: 1,
13025                                    ease: easeOut,
13026                                    //delay: 0.1
13027                                });	
13028                            }
13029                        } else {
13030                            if ( mask === 'auto' ) {
13031                                tlConds.fromTo($animateTrgrEl, {
13032                                    opacity: 1,
13033                                    clipPath: 'inset(0% 0px round 0' + radiu
13033s_unit + ')',
13034                                    filter: 'blur(0px)',
13035                                    duration: 1,
13036                                },{
13037                                    opacity: parseFloat(opacity)/100,
13038                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
13039                                    filter: 'blur(' + blur + 'px)',
13040                                    ease: easeOut,
13041                                    duration: 1,
13042                                    //delay: 0.1
13043                                });	
13044                            } else {
13045                                tlConds.fromTo($animateTrgrEl, {
13046                                    opacity: 1,
13047                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
13048                                    filter: 'blur(0px)',
13049                                    duration: 1,
13050                                },{
13051                                    opacity: parseFloat(opacity)/100,
13052                                    clipPath: clip_path,
13053                                    filter: 'blur(' + blur + 'px)',
13054                                    duration: 1,
13055                                    ease: easeOut,
13056                                    //delay: 0.1
13057                                });	
13058                            }
13059                        }
13060                    } else {
13061                        if ( state !== 'end' ) {
13062                            if ( scale === 'auto' ) {
13063                                if ( radius ) {
13064                                    gsap.set(
13065                                        $animateTrgrEl, {
13066                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13067                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13068                                            x: animation_x + 'vw',
13069                                            y: animation_y + 'vh',
13070                                            filter: 'blur(' + blur + 'px)',
13071                                            rotation: rotate,
13072                                            rotationX: rotate == 0 ? perspective : 0,
13073                                            transformPerspective: '100vw',
13074                                            opacity: parseFloat(opacity)/100,
13075                                            transformOrigin: origin,
13076                                            borderRadius: radius + radius_unit,
13077                                            visibility: 'visible',
13078                                        }
13079                                    )
13080                                    tlConds.fromTo($animateTrgrEl, {
13081                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13082                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13083                                        x: animation_x + 'vw',
13084                                        y: animation_y + 'vh',
13085                                        filter: 'blur(' + blur + 'px)',
13086                                        rotation: rotate,
13087                                        rotationX: rotate == 0 ? perspective : 0,
13088                                        transformPerspective: '100vw',
13089                                        opacity: parseFloat(opacity)/100,
13090                                        borderRadius: radius + radius_unit,
13091                                        transformOrigin: origin,
13092                                        duration: 1,
13093                                    }, {
13094                                        scaleX: 1,
13095                                        scaleY: 1,
13096                                        x: 0,
13097                                        y: 0,
13098                                        filter: 'blur(0px)',
13099                                        rotation: 0,
13100                                        rotationX: 0,
13101                                        opacity: 1,
13102                                        borderRadius: 0 + radius_unit,
13103                                        transformOrigin: origin,
13104                                        duration: 1,
13105                                        ease: easeOut,
13106                                        //delay: 0.1
13107                                    });	
13108                                } else {
13109                                    gsap.set(
13110                                        $animateTrgrEl, {
13111                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13112                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13113                                            x: animation_x + 'vw',
13114                                            y: animation_y + 'vh',
13115                                            filter: 'blur(' + blur + 'px)',
13116                                            rotation: rotate,
13117                                            rotationX: rotate == 0 ? perspective : 0,
13118                                            transformPerspective: '100vw',
13119                                            opacity: parseFloat(opacity)/100,
13120                                            transformOrigin: origin,
13121                                            visibility: 'visible',
13122                                        }
13123                                    )
13124                                    tlConds.fromTo($animateTrgrEl, {
13125                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13126                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13127                                        x: animation_x + 'vw',
13128                                        y: animation_y + 'vh',
13129                                        filter: 'blur(' + blur + 'px)',
13130                                        rotation: rotate,
13131                                        rotationX: rotate == 0 ? perspective : 0,
13132                                        transformPerspective: '100vw',
13133                                        opacity: parseFloat(opacity)/100,
13134                                        transformOrigin: origin,
13135                                        duration: 1,
13136                                    }, {
13137                                        scaleX: 1,
13138                                        scaleY: 1,
13139                                        x: 0,
13140                                        y: 0,
13141                                        filter: 'blur(0px)',
13142                                        rotation: 0,
13143                                        rotationX: 0,
13144                                        opacity: 1,
13145                                        transformOrigin: origin,
13146                                        duration: 1,
13147                                        ease: easeOut,
13148                                        //delay: 0.1
13149                                    });	
13150                                }
13151                            } else {
13152                                if ( radius ) {
13153                                    gsap.set(
13154                                        $animateTrgrEl, {
13155                                            scaleX: parseFloat( scale ) / 100,
13156                                            scaleY: parseFloat( scale ) / 100,
13157                                            opacity: parseFloat(opacity)/100,
13158                                            x: animation_x + 'vw',
13159                                            y: animation_y + 'vh',
13160                                            filter: 'blur(' + blur + 'px)',
13161                                            rotation: rotate,
13162                                            rotationX: rotate == 0 ? perspective : 0,
13163                                            transformPerspective: '100vw',
13164                                            transformOrigin: origin,
13165                                            borderRadius: radius + radius_unit,
13166                                            visibility: 'visible',
13167                                        }
13168                                    )
13169                                    tlConds.fromTo($animateTrgrEl, {
13170                                        scaleX: parseFloat( scale ) / 100,
13171                                        scaleY: parseFloat( scale ) / 100,
13172                                        opacity: parseFloat(opacity)/100,
13173                                        x: animation_x + 'vw',
13174                                        y: animation_y + 'vh',
13175                                        filter: 'blur(' + blur + 'px)',
13176                                        rotation: rotate,
13177                                        rotationX: rotate == 0 ? perspective : 0,
13178                                        transformPerspective: '100vw',
13179                                        borderRadius: radius + radius_unit,
13180                                        transformOrigin: origin,
13181                                        duration: 1,
13182                                    }, {
13183                                        scaleX: 1,
13184                                        scaleY: 1,
13185                                        opacity: 1,
13186                                        x: 0,
13187                                        y: 0,
13188                                        filter: 'blur(0px)',
13189                                        rotation: 0,
13190                                        rotationX: 0,
13191                                        transformOrigin: origin,
13192                                        ease: easeOut,
13193                                        duration: 1,
13194                                        borderRadius: 0 + radius_unit,
13195                                        //delay: 0.1
13196                                    });	
13197                                } else {
13198                                    gsap.set(
13199                                        $animateTrgrEl, {
13200                                            scaleX: parseFloat( scale ) / 100,
13201                                            scaleY: parseFloat( scale ) / 100,
13202                                            opacity: parseFloat(opacity)/100,
13203                                            x: animation_x + 'vw',
13204                                            y: animation_y + 'vh',
13205                                            filter: 'blur(' + blur + 'px)',
13206                                            rotation: rotate,
13207                                            rotationX: rotate == 0 ? perspective : 0,
13208                                            transformPerspective: '100vw',
13209                                            transformOrigin: origin,
13210                                            visibility: 'visible',
13211                                        }
13212                                    )
13213                                    tlConds.fromTo($animateTrgrEl, {
13214                                        scaleX: parseFloat( scale ) / 100,
13215                                        scaleY: parseFloat( scale ) / 100,
13216                                        opacity: parseFloat(opacity)/100,
13217                                        x: animation_x + 'vw',
13218                                        y: animation_y + 'vh',
13219                                        filter: 'blur(' + blur + 'px)',
13220                                        rotation: rotate,
13221                                        rotationX: rotate == 0 ? perspective : 0,
13222                                        transformPerspective: '100vw',
13223                                        transformOrigin: origin,
13224                                        duration: 1,
13225                                    }, {
13226                                        scaleX: 1,
13227                                        scaleY: 1,
13228                                        opacity: 1,
13229                                        x: 0,
13230                                        y: 0,
13231                                        filter: 'blur(0px)',
13232                                        rotation: 0,
13233                                        rotationX: 0,
13234                                        transformOrigin: origin,
13235                                        duration: 1,
13236                                        ease: easeOut,
13237                                        //delay: 0.1
13238                                    });
13239                                }
13240                            }
13241                        } else {
13242                            if ( scale === 'auto' ) {
13243                                tlConds.fromTo($animateTrgrEl, {
13244                                    scaleX: 1,
13245                                    scaleY: 1,
13246                                    opacity: 1,
13247                                    x: 0,
13248                                    y: 0,
13249                                    filter: 'blur(0px)',
13250                                    rotation: 0,
13251                                    rotationX: 0,
13252                                    transformOrigin: origin,
13253                                    duration: 1,
13254                                }, {
13255                                    scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13256                                    scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13257                                    opacity: parseFloat(opacity)/100,
13258                                    x: animation_x + 'vw',
13259                                    y: animation_y + 'vh',
13260                                    filter: 'blur(' + blur + 'px)',
13261                                    rotation: rotate,
13262                                    rotationX: rotate == 0 ? perspective : 0,
13263                                    transformPerspective: '100vw',
13264                                    transformOrigin: origin,
13265                                    duration: 1,
13266                                    ease: easeOut,
13267                                    //delay: 0.1
13268                                })
13269                            } else {
13270                                tlConds.fromTo($animateTrgrEl, {
13271                                    scaleX: 1,
13272                                    scaleY: 1,
13273                                    opacity: 1,
13274                                    x: 0,
13275                                    y: 0,
13276                                    filter: 'blur(0px)',
13277                                    rotation: 0,
13278                                    rotationX: 0,
13279                                    transformPerspective: '100vw',
13280                                    transformOrigin: origin,
13281                                    borderRadius: 0 + radius_unit,
13282                                    duration: 1,
13283                                }, {
13284                                    scaleX: parseFloat( scale ) / 100,
13285                                    scaleY: parseFloat( scale ) / 100,
13286                                    opacity: parseFloat(opacity)/100,
13287                                    x: animation_x + 'vw',
13288                                    y: animation_y + 'vh',
13289                                    filter: 'blur(' + blur + 'px)',
13290                                    rotation: rotate,
13291                                    rotationX: rotate == 0 ? perspective : 0,
13292                                    transformPerspective: '100vw',
13293                                    transformOrigin: origin,
13294                                    borderRadius: radius + radius_unit,
13295                                    duration: 1,
13296                                    ease: easeOut,
13297                                    //delay: 0.1
13298                                })
13299                            }
13300                        }
13301                    }
13302                }
13303
13304                function headingReveal($el){
13305                    txtTrggrStart = true;
13306                    $('.text-reveal', $el).each(function(_key, _val){
13307                        var $txtReveal = $(_val),
13308                            dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
13309                            dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
13310                            $lines = $('.heading-line-wrap', $txtReveal),
13311                            $words = $('.split-word-inner', $txtReveal),
13312                            $chars = $('.split-char', $txtReveal),
13313                            _setTxtReveal,
13314                            $elToReveal = $words;
13315
13316                        if ( !(sticky === 'yes' || stickyCards) ) {
13317                            return;
13318                        }
13319            
13320                        easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut;
13321
13322                        if ( dataReveal === 'chars' ) {
13323                            $elToReveal = $chars;
13324                        } else if ( dataReveal === 'lines' ) {
13325                            $elToReveal = $lines;
13326                        }
13327
13328                        var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr;
13329                        scrllTrggrTxt.id = "txt_reveal_" + _key; 
13330                        scrllTrggrTxt.pin = false;
13331
13332                        gsap.set($elToReveal, {opacity: dataRevealOpacity});
13333                        var _tl = gsap.timeline({
13334                            scrollTrigger: scrllTrggrTxt
13335                        });
13336                        _tl.fromTo($elToReveal, {
13337                            opacity: dataRevealOpacity,
13338                        }, {
13339                            opacity: 1,
13340                            stagger: 0.05
13341                        });
13342
13343                        $scrollTrgrEl.one( 'uncodeWordLines', function(){
13344                            clearRequestTimeout(_setTxtReveal);
13345                            _setTxtReveal = requestTimeout( function(){
13346                                gsap.set($elToReveal, {clearProps: true});
13347                                _tl.kill(true);
13348                                if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) {
13349                                    ScrollTrigger.getById("txt_reveal_" + _key).kill(true);
13350                                }
13351                                headingReveal($el)
13352                            }, 100);
13353                        });
13354
13355                    });
13356                };
13357
13358                if (!txtTrggrStart) {
13359                    headingReveal($el);
13360                }
13361
13362                $scrollTrgrEl.one( 'uncodeWordLines', function(){
13363                    if (!txtTrggrStart) {
13364                        headingReveal($el);
13365                    }
13366                });
13367                
13368                var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
13369                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight );
13370                var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 
13371                    document.documentElement.clientWidth,  document.documentElement.scrollWidth,  document.documentElement.offsetWidth );
13372                    
13373                $(window).on('uncode-sticky-trigger-observe', function(e){
13374                    var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
13375                    var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );
13376                    $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false});
13377                    //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style');
13378                    if ( stickyCards ) {
13379                        $('.tmb', $scrollTrgrEl).removeAttr('style');
13380                    }
13381                    var scrollnow = document.body.scrollTop || document.documentElement.scrollTop;
13382                    clearRequestTimeout(setTxtReveal);
13383                    setTxtReveal = requestTimeout( function(){
13384                        $(document).trigger('uncode-scrolltrigger-refresh');
13385                        if ( isMobileUsing ) {
13386                            if ( typeof tl !== 'undefined' ) {
13387                                tl.scrollTrigger.refresh();
13388                            }
13389                            if ( typeof tlConds !== 'undefined' ) {
13390                                tlConds.scrollTrigger.refresh();
13391                            }
13392                            $(window).trigger('scroll');
13393                            _width = __width;
13394                        } else if ( _width !== __width && ( isMobileUsing ) ) {
13395                            window.dispatchEvent(new CustomEvent('vc-resize'));
13396                            if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
13397                                window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){
13398                                    if ( typeof tl !== 'undefined' ) {
13399                                        tl.scrollTrigger.refresh();
13400                                    }
13401                                    if ( typeof tlConds !== 'undefined' ) {
13402                                        tlConds.scrollTrigger.refresh();
13403                                    }
13404                                    window.lenis.scrollTo(scrollnow, {duration: 0.01});
13405                                }});
13406                            } else {
13407                                if ( typeof tl !== 'undefined' ) {
13408                                    tl.scrollTrigger.refresh();
13409                                }
13410                                if ( typeof tlConds !== 'undefined' ) {
13411                                    tlConds.scrollTrigger.refresh();
13412                                }
13413                                $(window).trigger('scroll');
13414                            }
13415                            _height = __height;
13416                        }
13417                    }, 500);
13418                });
13419
13420
13421                $(window).on('load ', function(e){
13422                    var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
13423                    if ( _height !== ___height ) {
13424                        $scrollTrgrEl.attr('data-toggled', true);
13425                        $(window).trigger('resize');
13426                        if ( typeof tl !== 'undefined' ) {
13427                            tl.scrollTrigger.refresh();
13428                        }
13429                        if ( typeof tlConds !== 'undefined' ) {
13430                            tlConds.scrollTrigger.refresh();
13431                        }
13432                        _height = ___height;
13433                    }
13434
13435                    
13436                    
13437                    $(document).trigger('uncode-scrolltrigger-refresh');
13438
13439                });
13440
13441            };
13442
13443            var callAreaAnimateScrollTl = function() {
13444                if ( stickyCards ) {
13445                    $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){
13446                        if ( key+1 < cardL || animLast || state !== 'end' ) {
13447                            var $this = $(val),
13448                                last = key+1===cardL;
13449                            areaAnimateScrollTl($this, key, last);
13450                        }
13451                    });
13452                } else {
13453                    areaAnimateScrollTl($scrollTrgrEl, 0, false);
13454                }    
13455            };
13456
13457            $(window).on('wwResize', function(){
13458                if ( !alreadyareaAnimateScrollTl ) {
13459                    if ( noMobile ) {
13460                        if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13461                            return;
13462                        } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13463                            return;
13464                        }
13465                    }
13466                    
13467                    callAreaAnimateScrollTl();
13468                }
13469            })
13470
13471            if ( noMobile ) {
13472                if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13473                    return;
13474                } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13475                    return;
13476                }
13477            }
13478
13479            callAreaAnimateScrollTl();
13480
13481        });
13482
13483    };
13484
13485    areaReveal();
13486
13487};
13488UNCODE.thumbsReveal = function() {
13489    var recalc = false,
13490    revealThumbs = function( $el ){
13491        if ( typeof $el === 'undefined' || $el === null || !$el.length ) {
13492            $el = $('body');
13493        }
13494        $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){
13495            var $container = $(this),
13496                $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container),
13497                isContainer = false;
13498
13499            if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) {
13500                $stickys.each(function(){
13501                    var $sticky = $(this).addClass('tmb-mask-init'),
13502                        $rellax = $sticky.closest('.parallax-el'),
13503                        $inside = $('.t-inside', $sticky),
13504                        $media = $('img, video, .fluid-object', $sticky).attr('loading', ''),
13505                        val = parseFloat( $inside.attr('data-scroll-val') );
13506
13507                    if ( $rellax.length ) {
13508                        recalc = true;
13509                    }
13510
13511                    val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val;
13512                    
13513                    if ( $sticky.hasClass('tmb-mask-scroll') ) {
13514
13515                        var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both'))
13516                        ? val*0.05 : 0;
13517                        var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
13518                            ? val*4 : 0;
13519                        var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) ? parax*0.01 : 0;
13520
13521                        var tl = gsap.timeline({
13522                            scrollTrigger: {
13523                                trigger: $sticky,
13524                                scrub: true,
13525                            }
13526                        });
13527
13528                        tl.fromTo($media, {
13529                            yPercent: -(parax),
13530                            scale: 1 + zoom + extra,
13531                        }, {
13532                            yPercent: parax,
13533                            scale: 1 + extra,
13534                            ease: "none",
13535                        });
13536
13537                        if ( recalc ) {
13538                            $(window).on('uncode-thumbsreveal-refresh', function(){
13539                                if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
13540                                    tl.scrollTrigger.refresh();
13541                                }
13542                            });
13543                        }
13544                    }
13545                });
13546            }
13547
13548            if ( $container.has('.tmb-mask-reveal') ) {
13549                var $markTrigger = ".tmb-mask-reveal .t-entry-visual",
13550                staggerTime = 0.1;
13551
13552                $('.t-inside', $container).each(function(){
13553                    var checkEasing = $(this).attr('data-easing');
13554                    if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') {
13555                        gsap.registerPlugin(CustomEase);
13556                        return false;
13557                    }
13558                });
13559
13560                if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) {
13561                    $markTrigger = $container;
13562                    isContainer = true;
13563                    staggerTime = 0;
13564                }
13565
13566                ScrollTrigger.batch( $markTrigger, {
13567                    start: function( el ){
13568                        /*if ( el.trigger.offsetHeight < (window.innerHeight/2) ) {
13569                            return "bottom bottom";
13570                        } else {*/
13571                            return  "top 96%";
13572                        //}
13573                    },
13574                    onEnter: function(batch){
13575                        var $inside = $(batch).closest('.t-inside');
13576
13577                        if ( isContainer ) {
13578                            var $inside = $(batch).find('.t-inside').first();
13579                        }
13580
13581                        var delay = parseFloat( $inside.attr('data-delay') ),
13582                            speed = parseFloat( $inside.attr('data-speed') ),
13583                            easing = $inside.attr('data-easing'),
13584                            bgDelay = parseFloat( $inside.attr('data-bg-delay') );
13585
13586                        delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
13587                        speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
13588                        easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
13589                        bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
13590
13591                        if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) {
13592                            gsap.to($('.t-entry-visual-tc', batch), speed, {
13593                                clipPath: 'inset(0% 0% 0% 0%)',
13594                                stagger: staggerTime,
13595                                delay: delay,
13596                                ease: easing,
13597                            });
13598                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
13599                                clipPath: 'inset(0% 0% 0% 0%)',
13600                                stagger: staggerTime,
13601                                scale: 1,
13602                                delay: delay + (speed*bgDelay),
13603                                ease: easing,
13604                            });
13605                        } else {
13606                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
13607                                clipPath: 'inset(0% 0% 0% 0%)',
13608                                stagger: staggerTime,
13609                                scale: 1,
13610                                delay: delay,
13611                                ease: easing,
13612                            });
13613                        }
13614                                                    
13615                    }
13616                });
13617            }
13618
13619        });
13620
13621        function raf(time) {
13622            requestAnimationFrame(raf)
13623            $(window).trigger('uncode-thumbsreveal-refresh');
13624        }
13625
13626        if ( recalc ) {
13627            requestAnimationFrame(raf)
13628        }
13629
13630    };
13631    $(window).on( 'load more-items-loaded', function(){
13632        revealThumbs();
13633    });
13634
13635    $(document).on('uncode-ajax-filtered', function(){
13636        revealThumbs();
13637    });
13638
13639    if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
13640        window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
13641            var $el = model.view.$el,
13642                shortcode = model.attributes.shortcode;
13643
13644            if ( $el.is('.custom-grid-container') ) {
13645                $el = $el.parent();
13646            }
13647
13648            if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') {
13649                revealThumbs($el);
13650            }
13651        });
13652    }
13653
13654};
13655
13656UNCODE.revslider = function() {
13657	var revSlider6In = function(){
13658		$('rs-module').each(function(){
13659			var $slider = $(this);
13660
13661			$slider.on('revolution.slide.onloaded', function(e, data){
13662				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13663					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
13664						scrolltop = $(document).scrollTop();
13665					if ( style != undefined ) {
13666						UNCODE.switchColorsMenu(scrolltop, style);
13667					}
13668				}
13669			});
13670
13671			$slider.on('revolution.slide.onchange', function(e, data){
13672				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13673					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
13674						scrolltop = $(document).scrollTop();
13675					if ( style != undefined ) {
13676						UNCODE.switchColorsMenu(scrolltop, style);
13677					}
13678				}
13679			});
13680
13681		});
13682
13683	};
13684	revSlider6In();
13685	$(window).on("load", revSlider6In );
13686
13687	document.addEventListener("sr.module.ready", function(e) { 
13688		var $slider = $('#'+e.id),
13689			settings = SR7.JSON[e.id];
13690
13691		if ( typeof settings !== 'undefined' && settings !== null ) {
13692			if ( $slider.closest(".header-revslider").length ) {
13693				var style = settings.slides[1].slide.attr.data,
13694					scrolltop = $(document).scrollTop();
13695				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13696				style = style[1];
13697				if ( style[1] != undefined ) {
13698					UNCODE.switchColorsMenu(scrolltop, style);
13699				}
13700			}
13701		}
13702	});
13703
13704	document.addEventListener("sr.slide.afterChange", function(e) {
13705		var $slider = $('#'+e.id),
13706			settings = SR7.JSON[e.id];
13707
13708		if ( typeof settings !== 'undefined' && settings !== null ) {
13709			if ( $slider.closest(".header-revslider").length ) {
13710				var style = settings.slides[e.current.id].slide.attr.data,
13711					scrolltop = $(document).scrollTop();
13712				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13713				style = style[1];
13714				if ( style != undefined ) {
13715					UNCODE.switchColorsMenu(scrolltop, style);
13716				}
13717			}
13718		}
13719	});
13720
13721};
13722UNCODE.layerslider = function() {
13723	$(window).on("load", function() {
13724
13725		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
13726
13727			var slideData = slider.slides.current.data,
13728				scrolltop = $(document).scrollTop();
13729			if( slideData && slideData.skin ) {
13730
13731				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
13732
13733			}
13734		});
13735
13736	});
13737};
13738
13739UNCODE.ajax_filters = function () {
13740	var isAjaxing = false;
13741
13742/*************************
13743 *
13744 * Filters Menu and Widgets Area
13745 *
13746 ************************/
13747
13748 	var clear_clicked = false;
13749
13750 	var init_ajax_grid = function(){
13751
13752		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
13753		$grids.each(function(index, val){
13754			var $body = $('body'),
13755				$grid = $(val).addClass('init-ajax-grid'),
13756				starting_point = $grid.attr('data-toggle'),
13757				$trigger = $('.uncode-toggle-ajax-filters', $grid),
13758				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
13759				$isotope_wrapper = $('.isotope-wrapper', $grid),
13760				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
13761				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
13762				$footprint = $('.ajax-filter-footprint', $grid),
13763				sidebar_w,
13764				data_w = parseFloat( $sidebar.attr('data-max-width') ),
13765				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
13766				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
13767				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
13768				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13769				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
13770				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
13771				sidew,
13772				$inside_row = $('> .row-parent', $vc_row),
13773				bg_row,
13774				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
13775				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
13776				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
13777				sidebar_overlay = false,
13778				sidebar_hover = false,
13779				switchMobile = false,
13780				scrollTop;
13781
13782			if ( $vc_row.attr('class') ) {
13783				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
13784			}
13785
13786			if ( bg_row != null ) {
13787				$side_header.add($side_footer).addClass(bg_row[0]);
13788			}
13789
13790			$trigger.add($apply_filters).on('click', function(e){
13791				e.preventDefault();
13792				e.stopPropagation();
13793				$grid = $('.ajax-grid-system').eq(0);
13794				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13795				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13796				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13797				sidebar_w = $sidebar_wrapper.width();
13798				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13799				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
13800					$(this).trigger('uncode-ajax-clear-filters');
13801				}
13802				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13803					$grid.toggleClass('ajax-hide-filters-blanks');
13804					$sidebar.slideToggle({
13805						duration: 400,
13806						easing: 'easeOutQuad',
13807					});
13808				} else {
13809					$grid.removeClass('ajax-hide-filters-blanks');
13810					$grid.toggleClass('ajax-hide-filters');
13811					if ( $grid.hasClass('ajax-hide-filters') ) {
13812						$body.addClass('ajax-hide-filters');
13813					} else {
13814						scrollTop = $('html, body').scrollTop();
13815						$body.removeClass('ajax-hide-filters');
13816					}
13817				}
13818				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13819					$('html, body').scrollTop(scrollTop);
13820				}
13821				return false;
13822			});
13823
13824			$close_btn.on('click', function(e){
13825				e.preventDefault();
13826				$grid = $('.ajax-grid-system').eq(0);
13827				$grid.addClass('ajax-hide-filters');
13828				if ( $grid.hasClass('ajax-hide-filters') ) {
13829					$body.addClass('ajax-hide-filters');
13830				} else {
13831					scrollTop = $('html, body').scrollTop();
13832					$body.removeClass('ajax-hide-filters');
13833				}
13834				$('html, body').scrollTop(scrollTop);
13835			});
13836
13837			$sidebar_wrapper.on('mouseover',function(){
13838				sidebar_hover = true;
13839			}).on('mouseout', function(){
13840				sidebar_hover = false;
13841			});
13842
13843			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
13844				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
13845					return;
13846				}
13847				if (undefined !== from && from === 'select_active_attributes') {
13848					return;
13849				}
13850				if ($(e.target).closest('.select2-container--open').length ) {
13851					return;
13852				}
13853				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
13854					$grid.add($body).addClass('ajax-hide-filters');
13855				}
13856			});
13857
13858			$sorting_trgr.on('click', function(e) {
13859				e.preventDefault();
13860			});
13861
13862			var inside_width = function(){
13863				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13864				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13865				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13866				$inside_row = $('> .row-parent', $vc_row);
13867				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
13868					sidew = $sidebar.width();
13869					$inside_row.css({
13870						width: sidew
13871					});
13872				} else {
13873					$inside_row.css({
13874						width: ''
13875					});
13876				}
13877			};
13878			inside_width();
13879
13880			var ajax_sidebar_position = function(e, f_editor){
13881				$grid = $('.ajax-grid-system').eq(0);
13882				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13883				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13884				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13885				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13886				$inside_row = $('> .row-parent', $vc_row);
13887				scrollTop = $('html, body').scrollTop();
13888				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery) || overlay_desktop ) ) {
13889					if ( switchMobile !== true ) {
13890						$grid.add($body).addClass('ajax-hide-filters');
13891						$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
13892						$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
13893						sidebar_overlay = true;
13894						$body.addClass('ajax-filter-sidebar-overlay');
13895						$sidebar_wrapper.addClass(skin);
13896						var sideHeadH = $side_header.outerHeight(),
13897							sideFooterH = $side_footer.outerHeight();
13898						if ( data_w !== '' && data_w > 0 ) {
13899							if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
13900								$sidebar.css({
13901									'max-width': data_w
13902								});
13903							} else {
13904								$sidebar.css({
13905									'max-width':'none'
13906								});
13907							}
13908						}
13909						$vc_row.css({
13910							'padding-top':sideHeadH,
13911							'padding-bottom':sideFooterH
13912						}).attr('data-lenis-prevent', true);
13913						var sidew = $sidebar.width();
13914						$inside_row.css({
13915							width: sidew
13916						});
13917						switchMobile = true;
13918					}
13919				} else {
13920					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
13921						scrollTop = $('html, body').scrollTop();
13922						$grid.add($body).removeClass('ajax-hide-filters');
13923					}
13924					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
13925						$grid.addClass('ajax-hide-filters-blanks');
13926						$sidebar.hide();
13927					}
13928					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
13929					$('.ajax-sidebar-placeholder', $grid).remove();
13930					sidebar_overlay = false;
13931					$body.removeClass('ajax-filter-sidebar-overlay');
13932					$sidebar_wrapper.removeClass(skin);
13933					if ( data_w !== '' && data_w > 0 ) {
13934						$sidebar.css({
13935							'max-width':'none'
13936						});
13937					}
13938					$vc_row.css({
13939						'padding-top':0,
13940						'padding-bottom':0,
13941					}).removeAttr('data-lenis-prevent');
13942
13943					$inside_row.css({
13944						width: ''
13945					});
13946
13947					if ( f_editor === true ) {
13948						UNCODE.ajax_filters();
13949					}
13950
13951					switchMobile = false;
13952				}
13953				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13954					$('html, body').scrollTop(scrollTop);
13955				}
13956			};
13957
13958			var sidebar_width = function(){
13959				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13960					sidebar_w = $footprint.width();
13961					$sidebar.css({ width: sidebar_w });
13962				} else {
13963					$sidebar.css({ width: '' });
13964				}
13965			};
13966			sidebar_width();
13967
13968			if ( SiteParameters.is_frontend_editor ) {
13969				ajax_sidebar_position();
13970			}
13971
13972			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
13973				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
13974					ajax_sidebar_position(e);
13975				}
13976				sidebar_width();
13977			});
13978
13979			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
13980				ajax_sidebar_position(e, true);
13981			});
13982
13983			$isotope_wrapper.on('transitionend', function(e){
13984				if ( $(e.target).hasClass('isotope-wrapper') ) {
13985					window.dispatchEvent(new CustomEvent('boxResized'));
13986				}
13987				return false;
13988			});
13989
13990			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
13991				var $grid = $('.ajax-grid-system').eq(0);
13992				$grid.addClass('ajax-hide-filters');
13993			}
13994
13995		});
13996	};
13997
13998	init_ajax_grid();
13999	$(document).on('uncode-ajax-filtered', init_ajax_grid);
14000
14001/*************************
14002 *
14003 * Hover hack
14004 *
14005 ************************/
14006 	var widget_hover_hack = function() {
14007 		$('.widget, .uncode_widget').each(function(){
14008			var $widget = $(this),
14009				class_w = $widget.attr('class'),
14010				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
14011				$footer = $widget.closest('#colophon');
14012
14013			if ( class_w.indexOf('widget_yith') > 0 ) {
14014				return true;
14015			}
14016
14017			$lis.each(function(){
14018 				var $li = $(this),
14019 					$a = $('a', $li),
14020 					$label = $a.closest('label');
14021
14022				if ( !$footer.length ) {
14023					$li.addClass('no-evts');
14024				}
14025
14026				if ( ! $('span', $a).length ) {
14027 					$li.addClass( 'li-hover' );
14028 				}
14029
14030 				$('li', $li).hover(function(e){
14031 					$(e.target).parents('li').each(function(){
14032 						$(this).addClass( 'parent-li-hover' );
14033 					});
14034					}, function (e) {
14035 					$(e.target).parents('li').each(function(key, val){
14036 						if ( key === 0) {
14037	 						$(val).removeClass( 'parent-li-hover' );
14038	 					}
14039 					});
14040 				});
14041
14042				$li.off('mouseup').on('mouseup', function (e) {
14043					if (e.which !== 3) {
14044						e.stopPropagation();
14045						var $a = $('a', this).first();
14046						$a[0].click();
14047					}
14048	 			});
14049 			});
14050 		});
14051	  }
14052
14053	var ajax_filters_button_mode = $('body').hasClass('ajax-filters-button-mode');
14054
14055	if (!ajax_filters_button_mode && SiteParameters.disable_hover_hack !== '1') {
14056		widget_hover_hack();
14057		$(document).on('uncode-ajax-filtered', widget_hover_hack);
14058	}
14059
14060/*************************
14061 *
14062 * Init Filters
14063 *
14064 ************************/
14065
14066	function init_filters() {
14067		$(document).on('click', '.term-filter-link', function(e) {
14068			var _this = $(this);
14069			var widget = _this.closest('.uncode_widget');
14070			var container = get_filters_container();
14071
14072			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
14073				return true;
14074			}
14075
14076			e.preventDefault();
14077
14078			if (widget.hasClass('widget-ajax-filters--checkbox')) {
14079				_this.parent().find('input[type="checkbox"]').trigger('click');
14080			} else {
14081				if (_this.hasClass('term-filter-link--active')) {
14082					_this.removeClass('term-filter-link--active');
14083				} else {
14084					_this.addClass('term-filter-link--active');
14085
14086					if (widget.hasClass('widget-ajax-filters--single')) {
14087						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
14088					}
14089				}
14090
14091				if (!ajax_filters_button_mode) {
14092					var url = _this.attr('href');
14093
14094					reload_items(container, url, true);
14095				}
14096			}
14097		});
14098
14099		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
14100			var _this = $(this);
14101			var widget = _this.closest('.uncode_widget');
14102			var link = _this.closest('.term-filter').find('.term-filter-link');
14103			var url = link.attr('href');
14104			var container = get_filters_container();
14105
14106			if (!ajax_filters_button_mode && widget.hasClass('widget-ajax-filters--no-ajax')) {
14107				window.location = url;
14108				return;
14109			}
14110
14111			if (widget.hasClass('widget-ajax-filters--single')) {
14112				widget.find('input[type="checkbox"]').each(function() {
14113					if (_this.attr('id') !== $(this).attr('id')) {
14114						$(this).prop('checked', false);
14115						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
14116					}
14117				});
14118			}
14119
14120			if (_this.prop('checked')) {
14121				link.addClass('term-filter-link--active');
14122			} else {
14123				link.removeClass('term-filter-link--active');
14124			}
14125
14126			if (!ajax_filters_button_mode) {
14127				reload_items(container, url, true);
14128			}
14129		});
14130
14131		$(document).on('change', 'select.select--term-filters', function(e) {
14132			var _this = $(this);
14133			var selected = _this.find('option:selected');
14134			var option = $(selected);
14135			var url = option.attr('data-term-filter-url');
14136			var container = get_filters_container();
14137			var widget = _this.closest('.uncode_widget');
14138
14139			if (!ajax_filters_button_mode) {
14140				if (widget.hasClass('widget-ajax-filters--no-ajax')) {
14141					window.location = url;
14142				} else {
14143					reload_items(container, url, true);
14144				}
14145			}
14146		});
14147
14148		$(document).on('click', '.filter-list__link', function(e) {
14149			if (SiteParameters.is_frontend_editor) {
14150				return false;
14151			}
14152
14153			e.preventDefault();
14154
14155			var _this = $(this);
14156			var container = get_filters_container();
14157			var url = _this.attr('href');
14158			reload_items(container, url, true);
14159		});
14160
14161		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
14162			var _this = $(this);
14163			var container = get_filters_container();
14164			var url = _this.attr('href');
14165			reload_items(container, url, true);
14166		});
14167
14168		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
14169
14170			var _this = $(this);
14171			var container = get_filters_container();
14172			var url = _this.attr('href');
14173
14174			if ( container.length ) {
14175				e.preventDefault();
14176				reload_items(container, url, true);
14177			}
14178		});
14179
14180		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
14181			var _this = $(this);
14182			var container = get_filters_container();
14183
14184			if (container.length > 0) {
14185				e.preventDefault();
14186
14187				var min_price = $('#min_price').val();
14188				var max_price = $('#max_price').val();
14189				var location = window.location;
14190				var url = location.href;
14191				var page_uri = location.origin + location.pathname;
14192				var is_filtered = page_uri !== url;
14193
14194				if (is_filtered) {
14195					url = remove_parameter_from_url(url, 'min_price');
14196					url = remove_parameter_from_url(url, 'max_price');
14197				}
14198
14199				var concat = page_uri === url ? '?' : '&';
14200				var params = {'min_price': min_price, 'max_price': max_price};
14201
14202				url = url + concat + $.param(params);
14203
14204				reload_items(container, url, true);
14205			}
14206		});
14207
14208		if (!ajax_filters_button_mode && !window._uncode_search_bound) {
14209			window._uncode_search_bound = true;
14210			var search_timeout = parseInt(SiteParameters.ajax_filter_search_timeout, 10);
14211
14212			$(document).on('input', '.term-filters-search-input', function () {
14213				var _this = $(this);
14214				var container = get_filters_container();
14215				var value = _this.val();
14216
14217				if (window._uncode_search_timer) {
14218					clearTimeout(window._uncode_search_timer);
14219				}
14220
14221				window._uncode_search_timer = setTimeout(function () {
14222					update_search_url(container, value);
14223				}, search_timeout);
14224			});
14225		}
14226
14227		$(document).on('click', '.btn-ajax-filters-trigger', function (e) {
14228			var container = get_filters_container();
14229
14230			if (container.length) {
14231				e.preventDefault();
14232				var paramMap = {};
14233
14234				$('.term-filter-link--active').each(function () {
14235					collect_from_query(paramMap, this.href.split('?')[1] || '');
14236				});
14237
14238				$('.select--term-filters').each(function () {
14239					var select = $(this);
14240					var val = select.val();
14241
14242					if (!val) {
14243						return
14244					};
14245
14246					var selected_option = select.find('option:selected');
14247					var qUrl = selected_option.data('term-filter-url') || '';
14248
14249					collect_from_query(paramMap, qUrl.split('?')[1] || '');
14250				});
14251
14252				var search = $('.term-filters-search-input');
14253
14254				if (search.length > 0) {
14255					var search_value = search.val().trim();
14256					if (search_value) {
14257						paramMap[SiteParameters.ajax_filter_key_search] = {};
14258						paramMap[SiteParameters.ajax_filter_key_search][search_value] = 1;
14259					}
14260				}
14261
14262				var qsParts = [];
14263				$.each(paramMap, function (key, valSet) {
14264					var vals = Object.keys(valSet);
14265					qsParts.push(key + '=' + vals.join(','));
14266				});
14267
14268				var final_url = window.location.origin + window.location.pathname;
14269
14270				if (qsParts.length > 0) {
14271					qsParts.push('unfilter=1');
14272
14273					var qs = qsParts.join('&');
14274					final_url = '?' + qs;
14275				}
14276
14277				reload_items(container, final_url, true);
14278			}
14279		});
14280	}
14281
14282	function collect_from_query(paramMap, query) {
14283		$.each(query.split('&'), function (_, pair) {
14284			if (!pair) {
14285				return
14286			};
14287
14288			var kv  = pair.split('=');
14289			var key = kv[0];
14290			var val = kv[1] || '';
14291
14292			if (key === 'unfilter') {
14293				return;
14294			}
14295			if (!paramMap[key]) {
14296				paramMap[key] = {}
14297			};
14298
14299			paramMap[key][val] = 1;
14300		});
14301	}
14302
14303	function update_search_url(container, search_value) {
14304		var location = window.location;
14305		var url = location.href;
14306		var page_uri = location.origin + location.pathname;
14307		var is_filtered = page_uri !== url;
14308		var key_search = SiteParameters.ajax_filter_key_search;
14309		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
14310
14311		if (is_filtered) {
14312			url = remove_parameter_from_url(url, key_search);
14313			url = remove_parameter_from_url(url, key_unfilter);
14314		}
14315
14316		if (search_value) {
14317			var concat = page_uri === url ? '?' : '&';
14318			var params = {};
14319
14320			params[key_search] = search_value;
14321			params[key_unfilter] = 1;
14322			url = url + concat + $.param(params);
14323		} else {
14324			url = remove_parameter_from_url(url, key_search);
14325		}
14326
14327		reload_items(container, url, true);
14328	}
14329
14330	function remove_parameter_from_url(url, parameter) {
14331		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
14332	}
14333
14334	function get_filters_container() {
14335		var container = $('.ajax-grid-system');
14336
14337		if (container.length == 0) {
14338			container = $('.ajax-filters-target');
14339		}
14340
14341		return container;
14342	}
14343
14344	function update_widgets_state(widgets_states, container) {
14345		for (var i = widgets_states.length - 1; i >= 0; i--) {
14346			var state = widgets_states[i];
14347
14348			if (!state.collapse) {
14349				continue;
14350			}
14351
14352			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
14353
14354			if (state.open) {
14355				new_widget.find('.widget-title').addClass('open');
14356				if (state.css) {
14357					new_widget.find('.widget-collapse-content').attr('style', state.css);
14358				}
14359			} else {
14360				new_widget.find('.widget-title').removeClass('open');
14361				if (state.css) {
14362					new_widget.find('.widget-collapse-content').attr('style', state.css);
14363				}
14364			}
14365		}
14366	}
14367
14368	// Find filters container
14369	function find_filters_container(context) {
14370		const widget = context.find('.widget-ajax-filters').first();
14371		if (!widget.length) return $();
14372
14373		const sidebar = widget.closest('.ajax-filters-sidebar');
14374		if (sidebar.length) {
14375			return sidebar.find('.uncol').last();
14376		}
14377
14378		const col = widget.closest('.uncol');
14379		if (col.length) {
14380			return col;
14381		}
14382
14383		return $();
14384	}
14385
14386	// Reload items via AJAX
14387	function reload_items(container, url, push) {
14388		if (isAjaxing) {
14389			return
14390		};
14391
14392		isAjaxing = true;
14393
14394		container.addClass('grid-filtering');
14395
14396		$.ajax({
14397			url     : url,
14398			success : function(response) {
14399				if (!response) {
14400					return;
14401				}
14402
14403				$(document).trigger('uncode-ajax-pre-filtered');
14404
14405				var container_id = container.attr('id');
14406				var pagination = $('.row-navigation');
14407				var filters_container;
14408
14409				var isTargetFilterMode = container.hasClass('ajax-filters-target');
14410
14411				if (isTargetFilterMode) {
14412					filters_container = find_filters_container($(document));
14413				}
14414
14415				if (container_id) {
14416					var container_to_append = $(response).find('#' + container_id);
14417					var pagination_to_append = $(response).find('.row-navigation');
14418					var filters_to_append;
14419					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
14420
14421					if (isTargetFilterMode) {
14422						filters_to_append = find_filters_container($(response));
14423					}
14424
14425					// Remember open/closed widgets
14426					var widgets = $('.uncode_widget');
14427					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
14428					var widgets_states = [];
14429
14430					widgets.each(function() {
14431						var widget = $(this);
14432						var id = widget.attr('data-id');
14433						var state = {
14434							'id': id,
14435							'collapse': false,
14436							'open': false,
14437							'css': false,
14438						};
14439
14440						var collapse_wrapper = widget.find('.widget-collapse-content');
14441
14442						if (collapse_wrapper.length > 0) {
14443							state.collapse = true;
14444
14445							var collapse_wrapper_css = collapse_wrapper.attr('style');
14446							var title = widget.find('.widget-title');
14447
14448							state.css = collapse_wrapper_css;
14449
14450							if (title.hasClass('open')) {
14451								state.open = true;
14452							} else {
14453								state.open = false;
14454							}
14455						}
14456
14457						widgets_states.push(state);
14458					});
14459
14460					// Update widgets state when it is not in target mode
14461					if (! isTargetFilterMode && offcanvas_sidebar_wrapper.length === 0) {
14462						update_widgets_state(widgets_states, container_to_append);
14463					}
14464
14465					// Update default sidebar state
14466					if (!container.hasClass('ajax-hide-filters')) {
14467						container_to_append.removeClass('ajax-hide-filters');
14468					}
14469
14470					// Update horizontal sidebar
14471					if (!container.hasClass('ajax-hide-filters-blanks')) {
14472						container_to_append.removeClass('ajax-hide-filters-blanks');
14473					}
14474					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
14475					if (horizontal_sidebar_wrapper.length > 0) {
14476						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
14477						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
14478						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
14479						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
14480
14481						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
14482						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
14483					}
14484
14485					// Append container
14486					container.replaceWith(container_to_append);
14487
14488					// Hide first thumbnail until the new srcset is loaded
14489					if (SiteParameters.dynamic_srcset_active === '1') {
14490						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
14491					}
14492
14493					// Remove loading attribute to images
14494					container_to_append.find('img').attr('loading', '');
14495
14496					// Append pagination
14497					if (pagination.length > 0) {
14498						if (pagination_to_append.length > 0) {
14499							pagination.html(pagination_to_append.html());
14500						} else {
14501							pagination.html('');
14502						}
14503					} else {
14504						if (pagination_to_append.length > 0) {
14505							$('.post-wrapper').append(pagination_to_append);
14506						}
14507					}
14508
14509					// Append filters
14510					if (isTargetFilterMode && filters_container.length > 0) {
14511						filters_container.html(filters_to_append.html());
14512					}
14513
14514					// Update widgets state when it is in target mode
14515					if (isTargetFilterMode && filters_container.length > 0) {
14516						update_widgets_state(widgets_states, filters_container);
14517					}
14518
14519					// Update off canvas sidebar (mobile and overlay)
14520					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
14521
14522					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
14523						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
14524						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
14525						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
14526						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
14527
14528						// Update widgets state
14529						update_widgets_state(widgets_states, sidebar_to_append);
14530
14531						// Update sidebar
14532						sidebar_container.html(sidebar_to_append.html());
14533					}
14534
14535					if (push) {
14536						UNCODE.lastURL = url;
14537						window.history.pushState(
14538							{ pageTitle: document.title },
14539							'',
14540							url
14541						);
14542					}
14543
14544					if (typeof UNCODE.isotopeLayout !== 'undefined') {
14545						UNCODE.isotopeLayout();
14546					}
14547					if (typeof UNCODE.justifiedGallery !== 'undefined') {
14548						UNCODE.justifiedGallery();
14549					}
14550					if (typeof UNCODE.cssGrid !== 'undefined') {
14551						UNCODE.cssGrid();
14552					}
14553					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
14554						UNCODE.lightbox();
14555					}
14556					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
14557						UNCODE.lightgallery();
14558					}
14559					if (typeof UNCODE.carousel !== 'undefined') {
14560						UNCODE.carousel($('body'));
14561					}
14562					UNCODE.animations();
14563					if (typeof UNCODE.filters !== 'undefined') {
14564						UNCODE.filters();
14565					}
14566					if (typeof UNCODE.widgets !== 'undefined' && !(isTargetFilterMode && filters_container.length > 0)) {
14567						UNCODE.widgets();
14568					}
14569
14570					if (SiteParameters.dynamic_srcset_active === '1') {
14571						UNCODE.refresh_dynamic_srcset_size();
14572					}
14573
14574					if (typeof UNCODE.menuSmartInit !== 'undefined') {
14575						UNCODE.menuSmartInit();
14576					}
14577
14578					if (typeof UNCODE.parallax !== 'undefined') {
14579						UNCODE.parallax();
14580					}
14581
14582					maybe_scroll_to_top();
14583
14584					var woo_select2_cats = $('.dropdown_product_cat');
14585
14586					if (woo_select2_cats.length > 0) {
14587						woo_select2_cats.on( 'change', function() {
14588							if ( $(this).val() != '' ) {
14589								var this_page = '';
14590								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
14591								if ( home_url.indexOf( '?' ) > 0 ) {
14592									this_page = home_url + '&product_cat=' + $(this).val();
14593								} else {
14594									this_page = home_url + '?product_cat=' + $(this).val();
14595								}
14596								location.href = this_page;
14597							} else {
14598								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
14599							}
14600						});
14601
14602						if ( $().selectWoo ) {
14603							var wc_product_cat_select = function() {
14604								woo_select2_cats.selectWoo( {
14605									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
14606									minimumResultsForSearch: 5,
14607									width: '100%',
14608									allowClear: true,
14609									language: {
14610										noResults: function() {
14611											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
14612										}
14613									}
14614								} );
14615							};
14616							wc_product_cat_select();
14617						}
14618					}
14619
14620					$(document).trigger('uncode-ajax-filtered');
14621					$(document.body).trigger('init_price_filter');
14622					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
14623					window.document.dispatchEvent(new Event("DOMContentLoaded", {
14624						bubbles: true,
14625						cancelable: true
14626					}));
14627
14628					isAjaxing = false;
14629				}
14630			},
14631			error: function() {
14632				container.removeClass('grid-filtering');
14633
14634				isAjaxing = false;
14635
14636				if (SiteParameters.enable_debug == true) {
14637					// This console log is disabled by default
14638					// So nothing is printed in a typical installation
14639					//
14640					// It can be enabled for debugging purposes setting
14641					// the 'uncode_enable_debug_on_js_scripts' filter to true
14642					console.log('There was an error retrieving the products');
14643				}
14644			}
14645		});
14646	}
14647
14648	// Scroll to top after filtering
14649	function maybe_scroll_to_top() {
14650		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
14651
14652		if (offcanvas_sidebar_wrapper.length > 0) {
14653			return;
14654		}
14655
14656		var container = get_filters_container();
14657		var bound = container[0].getBoundingClientRect();
14658
14659		if (bound.y < 0) {
14660			$(window).scrollTop(container.offset().top);
14661		}
14662	}
14663
14664	// Back/forward browser buttons
14665	$(window).on("popstate.ajaxfilters", function(e) {
14666		var location = window.location;
14667		var url = location.href;
14668		var params = UNCODE.getURLParams(window.location);
14669		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
14670
14671		UNCODE.lastURL = url;
14672
14673		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
14674			return;
14675		}
14676
14677		var container = get_filters_container();
14678
14679		reload_items(container, url, false);
14680	});
14681
14682	// Destroy load more before to init a new one
14683	$(window).on('uncode-ajax-pre-filtered', function() {
14684		if ($.fn.infinitescroll) {
14685			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
14686		}
14687	});
14688
14689	init_filters();
14690};
14691
14692UNCODE.videoThumbs = function() {
14693	var checkResize,
14694		newW = UNCODE.wwidth;
14695	var checkForVideos = function(){
14696
14697		$(window).on('okevents.y.change', function(e, y){
14698			var $video = $(y.target.g),
14699				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14700				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14701				restart = !$video_wrap.hasClass('play-pause'),
14702				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14703				setTime;
14704			if ( newW >= UNCODE.mediaQuery ) {
14705
14706				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
14707					$video_wrap.data('hovered', true);
14708					$video_wrap.addClass('played-on');
14709					y.target.pauseVideo();
14710					$tmb.on('mouseenter', function(){
14711						if ( restart ) {
14712							y.target.seekTo(0);
14713						}
14714						y.target.playVideo();
14715					}).on('mouseleave', function(){
14716						clearTimeout(setTime);
14717						setTime = setTimeout(function(){
14718							y.target.pauseVideo();
14719						}, 300);
14720					});
14721				}
14722
14723			} else {
14724				if( $mobile_video_wrap.length ) {
14725					$video_wrap.addClass('played-on');
14726					y.target.playVideo();
14727				}
14728			}
14729
14730		});
14731
14732		$(window).on('okevents.v.loaded', function(e, playerV){
14733			var $video = $(playerV.element),
14734				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14735				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14736				restart = !$video_wrap.hasClass('play-pause'),
14737				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
14737: $video.closest('.t-entry-visual, .un-inline-image'),
14738				setTime;
14739
14740			if ( newW >= UNCODE.mediaQuery ) {
14741				
14742				if( $video_wrap.length ) {
14743
14744					var playPromise = playerV.play();
14745					if (playPromise !== undefined) {
14746						playPromise.then(function( value ) {
14747							playerV.pause();
14748						});
14749					}
14750					$video_wrap.addClass('played-on');
14751					$tmb.on('mouseenter', function(){
14752						if ( restart ) {
14753							playerV.setCurrentTime(0)
14754						}
14755						playerV.play();
14756					}).on('mouseleave', function(){
14757						clearTimeout(setTime);
14758						setTime = setTimeout(function(){
14759							playerV.pause();
14760						}, 300);
14761					});
14762				}
14763
14764			} else {
14765
14766				if( $mobile_video_wrap.length ) {
14767					var playPromise = playerV.play();
14768					if (playPromise !== undefined) {
14769						playPromise.then(function( value ) {
14770							playerV.play();
14771						});
14772					}
14773					$video_wrap.addClass('played-on');
14774				}
14775			}
14776		});
14777
14778		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
14779			var $video = $(video),
14780				$noscript = $('noscript', $video),
14781				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14782				restart = !$video_wrap.hasClass('play-pause'),
14783				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14784				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14785				setTime,
14786			manageVideo = function(){
14787				video.currentTime = 0;
14788				video.pause();
14789				if ( newW >= UNCODE.mediaQuery ) {
14790					if ( $video_wrap.length ) {
14791						$video_wrap.addClass('played-on');
14792						$tmb.on('mouseenter', function(){
14793							if ( restart ) {
14794								video.currentTime = 0;
14795							}
14796							video.play();
14797						}).on('mouseleave', function(){
14798							clearTimeout(setTime);
14799							setTime = setTimeout(function(){
14800								video.pause();
14801							}, 300);
14802						});
14803					} else {
14804						video.play();
14805					}
14806				} else {
14807					if ( $mobile_video_wrap.length ) {
14808						$mobile_video_wrap.addClass('played-on');
14809						video.play();
14810					}
14811				}
14812
14813			};
14814			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
14815				$noscript.each(function(key, val){
14816					$noscript.after(val.textContent || val.innerText || val.innerHTML);
14817					$noscript.remove();
14818				});
14819			}
14820
14821			if (typeof MediaElement === "function") {
14822				$video.has('source[src]').mediaelementplayer({
14823					pauseOtherPlayers: false,
14824				});
14825			}
14826			if (video.readyState > 0) {
14827				manageVideo();
14828			} else {
14829				window.addEventListener("pageshow", function (event) {
14830					if (event.persisted) {
14831						manageVideo();
14832					}
14833				});				
14834				$video.on("loadedmetadata", function(_event) {
14835					manageVideo();
14836				});
14837			};
14838		});
14839	
14840	};
14841	
14842	checkForVideos();
14843
14844	var checkVideoResize = function(){
14845		clearRequestTimeout(checkResize);
14846		checkResize = requestTimeout(function(){
14847			if ( newW !== UNCODE.wwidth ) {
14848				checkForVideos();
14849				newW = UNCODE.wwidth;
14850			}
14851		}, 1000);
14852	};
14853
14854	$(window).off('resize.videos', checkVideoResize)
14855	.on( 'resize.videos', checkVideoResize);
14856
14857	$(window).off('more-items-loaded.videos', checkForVideos)
14858	.on('more-items-loaded.videos', checkForVideos);
14859
14860	$(document).off('uncode-ajax-filtered.videos', checkForVideos)
14861	.on('uncode-ajax-filtered.videos', checkForVideos);
14862
14863};
14864UNCODE.inlineImgs = function() {
14865    var linkInlineImgs = function(){
14866        $('.un-inline-image').each(function(){
14867            var $img = $(this),
14868                href = $(this).attr('data-link-href'),
14869                dataImg = $img.data();
14870			if ( dataImg != '' && href != null && href !== '' ) {
14871                var class_stra_a = 'unline-image-link';
14872                if ( $(this).hasClass('un-inline-space-over') ) {
14873                    class_stra_a += ' un-inline-space-over';
14874                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
14875                    class_stra_a += ' un-inline-space-gutter';
14876                }
14877                var str_a = '<a class="' + class_stra_a + '" ';
14878                for (var key in dataImg) {
14879                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
14880                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
14881                    }
14882                }
14883                str_a += ' />';
14884                $img.wrap(str_a);
14885			}
14886        });
14887    };
14888    $(window).on('load', linkInlineImgs );
14889};
14890UNCODE.lottie = function() {
14891    if ( SiteParameters.is_frontend_editor ) {
14892        var $lottie_wraps = $('div.uncode-lottie-wrap');
14893        $lottie_wraps.each(function(){
14894            var $lottie_wrap = $(this),
14895                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
14896                $player_clone = $div_player.clone(),
14897                player_id = $div_player.attr('data-id'),
14898                $lottie_players = $('lottie-player', $lottie_wrap).remove();
14899            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
14900                if ( $('#'+player_id).length ) {
14901                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
14902                }
14903                $player_clone.attr('id', player_id);
14904                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
14905                $div_player.after($player_clone);
14906                $div_player.attr('data-init',true);
14907            }
14908        });
14909    }
14910    var $players = $('.uncode-lottie-wrap lottie-player');
14911    $players.each(function(){
14912        var player = this,
14913            this_id = $(player).attr('id'),
14914            _player = document.getElementById(this_id),
14915            trigger = $(player).attr('data-trigger'),
14916            pFrames = $(player).attr('data-frames').split(','),
14917            srcPlayer = $(player).attr('src');
14918
14919        _player.load(srcPlayer);
14920
14921        _player.addEventListener("ready", function() {
14922
14923            var $_shadow = _player.shadowRoot;
14924            $($_shadow).find('.error').remove();
14925
14926            var tFrames = _player.getLottie().totalFrames / 100,
14927                pFrame_from = Math.round(tFrames * pFrames[0]),
14928                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
14929                loop = $(player).attr('loop'),
14930                mode,
14931                actions;
14932
14933            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
14934                if ( trigger === 'scroll' ) {
14935                    mode = 'scroll';
14936                    actions = [
14937                        {
14938                            visibility:[0, 1.0],
14939                            type: "seek",
14940                            frames: [pFrame_from, pFrame_to],
14941                        }
14942                    ];
14943                } else if ( trigger === 'viewport') {
14944                    mode = 'scroll';
14945                    actions = [
14946                        {
14947                            visibility: [0.20, 1.0],
14948                            frames: [pFrame_from, pFrame_to],
14949                            type: loop ? "loop" : "play"
14950                        }
14951                    ];
14952                } else if ( trigger === 'hover') {
14953                    $(player).on('mouseenter', function(){
14954                        _player.play();
14955                    }).on('mouseleave', function(){
14956                        _player.pause();
14957                    });
14958                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
14959                        _player.seek(pFrame_from);
14960                        _player.addEventListener("frame", function(){
14961                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
14962                                _player.seek(pFrame_from);
14963                            }
14964                        });
14965                    }
14966                }
14967                LottieInteractivity.create({
14968                    player: '#' + this_id,
14969                    mode: mode,
14970                    actions: actions
14971                });
14972            } else {
14973                if ( pFrame_from > 0 && pFrame_from < 99 ) {
14974                    _player.seek(pFrame_from);
14975                    _player.addEventListener("frame", function(){
14976                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
14977                            _player.seek(pFrame_from);
14978                        }
14979                    });
14980                }
14981            }
14982        });
14983
14984        $(window).on('unlottie-destroy', function(){
14985            _player.destroy();
14986        });
14987    });
14988};
14989
14990UNCODE.animatedBgGradient = function( _el ) {
14991
14992    var ev;
14993
14994	if ( typeof _el === 'undefined' || _el === null ) {
14995        _el = document;
14996        ev = false;
14997	} else {
14998        _el = _el[0];
14999        ev = 'shortcode:update';
15000    }
15001
15002    var simplex = new SimplexNoise();
15003
15004    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
15005		this.block = blockOverlay;
15006		this.wrap = canvasWrap;
15007		this.config();
15008		this.checker();
15009		this.loopRAF();
15010        this.animLoader();
15011    };
15012
15013    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
15014
15015    AnimGradient.config = function() {
15016        this.canvas = document.createElement('canvas');
15017        this.wrap.appendChild(this.canvas);
15018        this.ctx = this.canvas.getContext('2d');
15019        this.count = 0;        
15020        this.isOrientationChanged = false;
15021        this.res = UNCODE.isMobile ? 90 : 110;
15022        this.resPercent = 100/this.res;
15023        this.resAround = this.resPercent/100;
15024        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;
15025
15026        this.canvas.classList.add('uncode-bg-animated-gradient');
15027        this.canvas.setAttribute('height', this.res);
15028        this.canvas.setAttribute('width', this.res);
15029        this.canvas.style = 'height: 100%; position: relative; width:100%;';
15030
15031        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
15032
15033        this.cx = this.canvas.width/2;
15034        this.cy = this.canvas.height/2;
15035        this.data = this.imgdata.data;
15036
15037        this.opts = {
15038            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,
15039            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,
15040            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
15041        };
15042
15043        this.lavaTime = 1;
15044        this.bg_colors = [];
15045
15046        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
15047            return;
15048        }
15049
15050        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
15051            this.singleColor = true;
15052        }
15053
15054        if( this.opts.col_1st ) {
15055
15056            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
15057
15058            this.bg_colors.push({
15059                r: rgbColor1.r,
15060                g: rgbColor1.g,
15061                b: rgbColor1.b
15062            });
15063        }
15064
15065        if( this.opts.col_2nd ) {
15066
15067            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
15068
15069            this.bg_colors.push({
15070                r: rgbColor2.r,
15071                g: rgbColor2.g,
15072                b: rgbColor2.b
15073            });
15074        }
15075
15076    };
15077
15078    AnimGradient.checker = function() {
15079        var scope = this;
15080        this.checkInViewPort();
15081      
15082        window.addEventListener('resize', function() {
15083            if(UNCODE.isMobile && !scope.isOrientationChanged) {
15084                return;
15085            }
15086            scope.ratioCalc();
15087        });
15088
15089        window.addEventListener("orientationchange", function() {
15090            scope.isOrientationChanged = true;
15091        });
15092
15093        this.ratioCalc();
15094    }; 
15095
15096    AnimGradient.ratioCalc = function() {
15097      
15098        var blockW = this.block.clientWidth,
15099            blockH = this.block.clientHeight;
15100
15101        if ( blockH == 0 || blockW == 0 )
15102            return;
15103
15104        var blockRatio = blockH/blockW;
15105
15106        if(blockRatio < 1) {
15107            this.ratioParam = {
15108                x: 1.4,
15109                y: blockRatio*1.4
15110            }
15111        } else {
15112            this.ratioParam = {
15113                x: blockRatio/3,
15114                y: 1
15115            }
15116        }
15117         
15118    };
15119
15120    AnimGradient.checkInViewPort = function() {
15121        var scope = this;
15122        if ( $(scope.block).closest('.unmenu-inner-ul').length ) {
15123            scope.isInViewport = true;
15124        } else if( 'IntersectionObserver' in window ) {
15125		    var observer = new IntersectionObserver(function(entries) {
15126  
15127                entries.forEach(function(entry){
15128                    if ( entry.isIntersecting ) {
15129                        scope.isInViewport = true;
15130                    } else {
15131                        scope.isInViewport = false;
15132                    }
15133                });
15134  
15135		    }, { 
15136			root: document,
15137		  });
15138  
15139		  observer.observe(scope.block);
15140		}
15141	};
15142	
15143    AnimGradient.hexToRGB = function(hexval) {
15144        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
15145        if (!hexecuted) {
15146            return false;
15147        }
15148        return {
15149            r: parseInt(hexecuted[1], 16),
15150            g: parseInt(hexecuted[2], 16),
15151            b: parseInt(hexecuted[3], 16)
15152        }
15153    };
15154
15155    AnimGradient.factor = function(val_1, val_2, lava) { 
15156        return val_1 * (1 - lava) + val_2 * lava;
15157    };
15158
15159    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
15160        if (this.singleColor) {
15161            return this.bg_colors[0][wave_l];
15162        }
15163        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 );
15164        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
15165    };
15166
15167    AnimGradient.lava = function(x, y, grade) {
15168        var radians = (Math.PI / 180) * grade,
15169        cos = Math.cos(radians),
15170        sin = Math.sin(radians),
15171        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
15172        return nx;
15173    };
15174    
15175    AnimGradient.loopRAF = function() {
15176
15177      var scope = this;
15178
15179        if( this.isInViewport && typeof this.ratioParam !== 'undefined' ) {
15180            for (var x = 0; x < this.res; x++) {
15181                for (var y = 0; y < this.res; y++) {
15182                    
15183                    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
15184        
15185                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
15186                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
15187                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
15188                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
15189                  
15190                }
15191            }
15192   
15193            this.count++;
15194          
15195            this.ctx.putImageData(this.imgdata, 0, 0);
15196         
15197        }
15198
15199        requestAnimationFrame(function() {
15200            scope.loopRAF();
15201        });
15202    };
15203
15204    AnimGradient.animLoader = function() {
15205        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
15206    };
15207
15208    var anim_init = function() {
15209        var bgs = _el.querySelectorAll('.block-bg-overlay');
15210      
15211        bgs.forEach(function(blockOverlay) {
15212            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
15213            if( !blockOverlay || !canvasWrap ) {
15214                return;
15215            }
15216            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
15217        });
15218    }
15219
15220    $(window).on('load', function(){
15221        anim_init();
15222    });
15223
15224    if ( ev === 'shortcode:update' ) {
15225        anim_init();
15226    }
15227
15228};
15229UNCODE.multibg = function(){
15230	var $bgsWraps = $('.uncode-multi-bgs'),
15231		$body = $('body');
15232	$bgsWraps.each(function(){
15233		var $bgWrap = $(this),
15234			transition = $bgWrap.attr('data-transition'),
15235			transitionTime = $bgWrap.attr('data-transition-time'),
15236			dataPace = $bgWrap.attr('data-transition-pace'),
15237			dataThreshold = $bgWrap.attr('data-transition-threshold'),
15238			dataTime = $bgWrap.attr('data-carousel-time'),
15239			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
15240			random = $bgWrap.attr('data-multi-random'),
15241			_bgWrap = $bgWrap[0],
15242			$multiBgs = $('.multi-background', $bgWrap),
15243			imgFirst,
15244			bgAmount = $multiBgs.length,
15245			isInViewport = false,
15246			lastScrollTop = 0,
15247			counter = 0,
15248			totMove = 0,
15249			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
15250			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
15251			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
15252			offX, offY,
15253			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
15254			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
15255			requestCarousel,
15256			is_header = $bgWrap.closest('#page-header').length,
15257			startTime = new Date();
15258
15259		transition = typeof transition === 'undefined' ? '' : transition;
15260
15261		if ( random === 'true' ) {
15262			UNCODE.shuffle($multiBgs);
15263		}
15264
15265		$multiBgs.find('.background-inner').attr('data-active','false');
15266
15267		imgFirst = $multiBgs.first().find('.background-inner').attr('data-active','true').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
15268
15269		var loadFirst = function(){
15270			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
15271				opacity: 1
15272			}, 250, 'easeInQuad').css({
15273				zIndex: 1
15274			});	
15275		}
15276
15277		var loadError = function(){
15278			console.log('Multi BG loading error');
15279		}
15280
15281		if ( imgFirst && imgFirst !== 'none' ) {
15282			UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
15283		} else {
15284			loadFirst();
15285		}
15286
15287		var loadSlides = function( $thisBg ){
15288			$thisBg.attr('data-load', 'loaded');	
15289		}
15290
15291		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
15292			var $thisBg = $(val);
15293
15294			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
15295
15296				var _imgBg = $(val).find('.background-inner').css('background-image');
15297
15298				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
15299					$thisBg.attr('data-load', 'loaded');
15300				} else {
15301					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
15302					if ( typeof _imgBg !== 'undefined' ) {
15303						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
15304					}
15305				}
15306			}
15307		});
15308					
15309		var multiCarousel = function(e) {
15310
15311			clearRequestTimeout(requestCarousel);
15312
15313			var checkTime = new Date();
15314			if ( checkTime - startTime >= carouselTime && isInViewport ) {
15315				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
15316
15317				if ( $checkEl.attr('data-load') !== 'loaded' ) {
15318					requestTimeout(function(){
15319						multiCarousel();
15320					}, 100);
15321					return;
15322				}
15323
15324				counter++;
15325
15326				$multiBgs.each(function(ind, val){
15327					if ( ind === counter%bgAmount ) {
15328						$(val).stop(true,false).animate({
15329							opacity: 1
15330						}, wait, 'easeInQuad').css({
15331							zIndex: 1
15332						}).find('.background-inner').attr('data-active','true');
15333					} else {
15334						$(val).stop(true,false).animate({
15335							opacity: 0
15336						}, wait, 'easeInQuad', function(){
15337							$(val).find('.background-inner').attr('data-active','false');
15338						}).css({
15339							zIndex: 0
15340						});
15341					}
15342				});
15343
15344			}
15345
15346			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
15347				requestCarousel = requestTimeout(multiCarousel, carouselTime);
15348			}
15349	
15350		};
15351
15352		var multiMove = function(e) {
15353			if ( $body.hasClass('navbar-hover') ) {
15354				return;
15355			}
15356			var checkTime = new Date(),
15357                bound = $bgWrap[0].getBoundingClientRect(),
15358                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
15359			if (offX) {
15360				totMove += Math.sqrt(
15361					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
15362				);
15363			}
15364			if (
15365                totMove >= pace && 
15366                checkTime - startTime >= wait &&
15367                e.clientX <= (bound.left + bound.width) &&
15368                e.clientX >= bound.left &&
15369                e.clientY <= (bound.top + bound.height) &&
15370                e.clientY >= bound.top
15371            ) {
15372				counter++;
15373				startTime = checkTime;
15374				$multiBgs.each(function(ind, val){
15375					if ( ind === counter%bgAmount ) {
15376						$(val).stop(true,false).animate({
15377							opacity: 1
15378						}, wait, 'easeInQuad').css({
15379							zIndex: 1
15380						}).find('.background-inner').attr('data-active','true');
15381					} else {
15382						$(val).stop(true,false).animate({
15383							opacity: 0
15384						}, wait, 'easeInQuad', function(){
15385							$(val).find('.background-inner').attr('data-active','false');
15386						}).css({
15387							zIndex: 0
15388						});
15389					}
15390				});
15391
15392				totMove = 0;
15393			}
15394			
15395			offX = e.clientX;
15396			offY = e.clientY;
15397			
15398		};
15399
15400		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
15401			document.addEventListener("mousemove", multiMove);
15402		}
15403
15404		window.addEventListener('resize', function() {
15405			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
15406				document.removeEventListener("mousemove", multiMove);
15407				document.addEventListener("mousemove", multiMove);
15408			}
15409		});
15410
15411		var lightLoopRAF = function() {
15412
15413			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
15414				checkTime = new Date(),
15415				bound = $bgWrap[0].getBoundingClientRect(),
15416				thresholdHeader = is_header ? 100 : threshold,
15417				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
15418			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
15419				counter++;
15420				lastScrollTop = scrollTop;
15421				startTime = checkTime;
15422
15423				$multiBgs.each(function(ind, val){
15424					if ( ind === counter%bgAmount ) {
15425						$(val).stop(true,false).animate({
15426							opacity: 1
15427						}, wait, 'easeInQuad').css({
15428							zIndex: 1
15429						}).find('.background-inner').attr('data-active','true');
15430					} else {
15431						$(val).stop(true,false).animate({
15432							opacity: 0
15433						}, wait, 'easeInQuad', function(){
15434							$(val).find('.background-inner').attr('data-active','false');
15435						}).css({
15436							zIndex: 0
15437						});
15438					}
15439				});
15440
15441			}
15442
15443			requestAnimationFrame(function() {
15444				if ( isInViewport ) {
15445					lightLoopRAF();
15446				}
15447			});
15448		};
15449
15450		var currentInd = 0;
15451
15452		var loopRAF = function() {
15453
15454			var multiBgRotate = function(slideInd){
15455				currentInd = slideInd;
15456				$multiBgs.each(function(ind, val){
15457					if ( ind === slideInd ) {
15458						$(val).stop(true,false).animate({
15459							opacity: 1
15460						}, wait, 'easeInQuad').css({
15461							zIndex: 1
15462						}).find('.background-inner').attr('data-active','true');
15463					} else {
15464						$(val).stop(true,false).animate({
15465							opacity: 0
15466						}, wait, 'easeInQuad', function(){
15467							$(val).find('.background-inner').attr('data-active','false');
15468						}).css({
15469							zIndex: 0
15470						});
15471					}
15472				});
15473			};
15474			var bound = $bgWrap[0].getBoundingClientRect(),
15475				thresholdPX = UNCODE.wheight * threshold / 100,
15476				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
15477				movePX = totMove / bgAmount,
15478				moving = UNCODE.wheight - (bound.top + thresholdPX),
15479				slideInd = 0;
15480
15481			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
15482				multiBgRotate(0);
15483			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
15484				multiBgRotate(bgAmount-1);
15485			} else {
15486				slideInd = Math.ceil(moving/movePX) - 1;
15487				if ( slideInd < 0 ) {
15488					slideInd = 0;
15489				} else if ( slideInd >= bgAmount ) {
15490					slideInd = bgAmount-1;
15491				}
15492				if ( slideInd !== currentInd ) {
15493					multiBgRotate(slideInd);
15494				}
15495			}
15496
15497			requestAnimationFrame(function() {
15498				if ( isInViewport ) {
15499					loopRAF();
15500				}
15501			});
15502		};
15503
15504		if( 'IntersectionObserver' in window ) {
15505		    var observer = new IntersectionObserver(function(entries) {
15506  
15507                entries.forEach(function(entry){
15508                    if ( entry.isIntersecting ) {
15509                        isInViewport = true;
15510						if ( transition === 'scroll' ) {
15511							if ( autoScroll ) {
15512								loopRAF();
15513							} else {
15514								lightLoopRAF();
15515							}
15516						} else {
15517							multiCarousel();
15518						}
15519                    } else {
15520                        isInViewport = false;
15521                   }
15522                });
15523  
15524		    }, { 
15525				root: document,
15526				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
15527		  	});
15528
15529			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
15530		  		observer.observe(_bgWrap);
15531			}
15532
15533			window.addEventListener('resize', function() {
15534				observer.unobserve(_bgWrap);
15535				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
15536					observer.observe(_bgWrap);
15537				}
15538			});
15539	
15540		}
15541
15542	});
15543}
15544
15545UNCODE.owlNav = function(target, ev) {
15546    target = target.replace(/#\S+/g, '');
15547    var $carousel = $('#'+target),
15548        $slider = $carousel.closest('.uncode-slider'),
15549        $checkNavs = $('.uncode-owl-nav');
15550    if ( !$checkNavs.length ) {
15551        return;
15552    }
15553
15554    if ( $slider.length ){
15555        target = $slider.attr('id');
15556    }
15557
15558    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
15559        $row;
15560
15561    if ( ! $navs.length ) {
15562        $row = $carousel.closest('.vc_row.row-container');
15563        $navs = $('.uncode-owl-nav:not([data-target])', $row);
15564    }
15565        
15566    if ( ! $navs.length ) {
15567        return;
15568    }
15569
15570    $navs.each(function(){
15571        var $nav = $(this),
15572            $outer = $nav.closest('.uncode-owl-nav-out'),
15573            $inner = $nav.find('.uncode-owl-nav-in'),
15574            $navDots = $('.uncode-nav-dots', $nav),
15575            $navCounter = $('.uncode-nav-counter', $nav),
15576            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
15577            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
15578            skinInherit = $nav.hasClass('skin-inherit'),
15579            digit = parseFloat($nav.attr('data-digit')),
15580            counterDigit = parseFloat($nav.attr('data-counter-digit')),
15581            navSpeed = parseFloat($carousel.attr('data-navspeed'));
15582        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
15583
15584        if ( $nav.hasClass('pos-abs') ){
15585            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
15586                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
15587            }
15588            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
15589        } 
15590
15591        $carousel.on('refreshed.owl.carousel', counter);
15592        $carousel.on('resized.owl.carousel', counter);
15593        $carousel.on('changed.owl.carousel', counter);
15594
15595        if ( $carousel.closest('.un-submenu').length ) {
15596            $carousel.on('initialized.owl.carousel', counter);
15597        }
15598
15599        var totalSlides = 0;
15600
15601        function counter(event) {
15602            if (!event.namespace) {
15603                return;
15604            }
15605            var slides = event.relatedTarget,
15606                current = slides._current,
15607                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
15608                item = event.item,
15609                page = event.page,
15610                countPages = Math.ceil(item.count / page.size),
15611                $currentSlide = $carousel.find('.owl-item').eq(current),
15612                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
15613                activeSlide = Math.ceil(itemIndex / page.size),
15614                $prev = $nav.find('.uncode-nav-prev'),
15615                $next = $nav.find('.uncode-nav-next'),
15616                $col = $currentSlide.find('.uncol').first();
15617
15618            if ( totalSlides != countPages ) {
15619                totalSlides = countPages;
15620                $navDots.html('');
15621                var nav_html = '';
15622                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
15623                    var padN = sl_ind+1;
15624                    if ( digit && digit > 1 ) {
15625                        padN = String(padN).padStart(digit, '0');
15626                    }
15627                    nav_html += '<button class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '" tabindex="0"><span>' + padN + '</span></button>';
15628                }
15629                $navDots.html(nav_html);
15630
15631                var totalSlidesDigit = totalSlides;
15632
15633                if ( counterDigit && counterDigit > 1 ) {
15634                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
15635                }
15636                $counterTotal.html(totalSlidesDigit);
15637            }
15638
15639            if ( loop !== true ) {
15640                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
15641                if ( itemIndex === 1 ) {
15642                    $prev.addClass('uncode-nav-disabled');
15643                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
15644                    $next.addClass('uncode-nav-disabled');
15645                    activeSlide = Math.ceil(item.count / page.size);
15646                }
15647            }
15648
15649            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
15650            var activeSlideDigit = activeSlide;
15651
15652            if ( counterDigit && counterDigit > 1 ) {
15653                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
15654            }
15655            $counterIndex.html(activeSlideDigit);
15656
15657            if ( skinInherit ) {
15658                if ( $col.hasClass('style-light') ){
15659                    $nav.removeClass('style-dark').addClass('style-light');
15660                } else if ( $col.hasClass('style-dark') ) {
15661                    $nav.removeClass('style-light').addClass('style-dark');
15662                }
15663            }
15664
15665            $inner.removeClass('uncode-owl-nav-waiting');
15666
15667            if ( $nav.hasClass('outer-width') ) {
15668                var navW = $nav.outerWidth(),
15669                    nexW = $next.outerWidth(),
15670                    prevW = $prev.outerWidth(),
15671                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
15672
15673                if ( $nav.hasClass('h-align-justify') ) {
15674                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
15675                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
15676                        $inner.css({'margin': 'auto'});
15677                    } else {
15678                        $inner.css({'margin': ''});
15679                    }
15680                } else {
15681                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
15682                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
15683                        $inner.css({'margin': 'auto'});
15684                    } else {
15685                        $inner.css({'margin': ''});
15686                    }
15687                }
15688            }
15689        }
15690
15691        $nav.on('click', '.uncode-nav-index', function(){
15692            var $bullet = $(this),
15693                slide_index = parseFloat( $bullet.attr('data-key') );
15694            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
15695        });
15696        $nav.on('click', '.uncode-nav-prev', function(){
15697            $carousel.trigger('prev.owl.carousel', [navSpeed]);
15698        });
15699        $nav.on('click', '.uncode-nav-next', function(){
15700            $carousel.trigger('next.owl.carousel', [navSpeed]);
15701        });
15702
15703        if ( $nav.hasClass('animated-arrows') ) {
15704            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
15705                $(this).addClass("hover"); 
15706            }).on('animationend', function(){
15707                $(this).removeClass("hover");  
15708            });
15709        }
15710
15711        var positionNav = function(){
15712            if ( $nav.hasClass('window-width') ) {
15713                var navOff = parseFloat( $nav.offset().left ) * -1;
15714                if ( navOff > 0 ) {
15715                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
15716                } else {
15717                    $inner.css({ transform: 'none' });
15718                }
15719            }
15720        }
15721        positionNav();
15722        $(window).on('resize', positionNav);
15723        $(document).on('un-menu-show', positionNav);
15724    });
15725
15726    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
15727};
15728
15729	UNCODE.init = function() {
15730		var wfl_check = false, wfl_request, waypoint_request;
15731		UNCODE.preventDoubleTransition();
15732		UNCODE.betterResize();
15733		UNCODE.utils();
15734		UNCODE.unBlockMenu();
15735		UNCODE.mobileMenuBlockSkins();
15736		UNCODE.magnetic();
15737		if (typeof UNCODE.accessibility !== 'undefined') {
15738			UNCODE.accessibility();
15739		}
15740		if (typeof UNCODE.rowParallax !== 'undefined') {
15741			UNCODE.rowParallax();
15742		}
15743		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
15744			UNCODE.changeSkinOnScroll();
15745		}
15746		if (typeof UNCODE.share !== 'undefined') {
15747			UNCODE.share();
15748		}
15749		if (typeof UNCODE.tooltip !== 'undefined') {
15750			UNCODE.tooltip();
15751		}
15752		if (typeof UNCODE.counters !== 'undefined') {
15753			UNCODE.counters();
15754		}
15755		if (typeof UNCODE.countdowns !== 'undefined') {
15756			UNCODE.countdowns();
15757		}
15758		if (typeof UNCODE.tabs !== 'undefined') {
15759			UNCODE.tabs();
15760		}
15761		if (typeof UNCODE.collapse !== 'undefined') {
15762			UNCODE.collapse();
15763		}
15764		if (typeof UNCODE.bigText !== 'undefined') {
15765			UNCODE.bigText();
15766		}
15767		UNCODE.menuSystem();
15768		if (typeof UNCODE.bgChanger !== 'undefined') {
15769			UNCODE.bgChanger();
15770		}
15771		if (typeof UNCODE.magicCursor !== 'undefined') {
15772			UNCODE.magicCursor();
15773		}
15774		if (typeof UNCODE.magneticCursor !== 'undefined') {
15775			UNCODE.magneticCursor();
15776		}
15777		if (typeof UNCODE.dropImage !== 'undefined') {
15778			UNCODE.dropImage();
15779		}
15780		if (typeof UNCODE.postTable !== 'undefined') {
15781			UNCODE.postTable();
15782		}
15783		if (typeof UNCODE.rotatingTxt !== 'undefined') {
15784			UNCODE.rotatingTxt();
15785		}
15786		if (typeof UNCODE.okvideo !== 'undefined') {
15787			UNCODE.okvideo();
15788			window.addEventListener( "uncode-more-items-loaded", function() {
15789				UNCODE.okvideo("uncode-more-items-loaded");
15790			});
15791		}
15792		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
15793			UNCODE.backgroundSelfVideos();
15794		}
15795		UNCODE.tapHover();
15796		if (typeof UNCODE.isotopeLayout !== 'undefined') {
15797			UNCODE.isotopeLayout();
15798		}
15799		if (typeof UNCODE.justifiedGallery !== 'undefined') {
15800			UNCODE.justifiedGallery();
15801		}
15802		if (typeof UNCODE.cssGrid !== 'undefined') {
15803			UNCODE.cssGrid();
15804		}
15805		if (typeof UNCODE.linearGrid !== 'undefined') {
15806			UNCODE.linearGrid();
15807		}
15808		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
15809			UNCODE.lightbox();
15810		}
15811		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
15812			$(window).on('load more-items-loaded',function(){
15813				UNCODE.lightgallery();
15814			});
15815		}
15816		if (typeof UNCODE.carousel !== 'undefined') {
15817			UNCODE.carousel($('body'));
15818		}
15819		if (typeof UNCODE.lettering !== 'undefined') {
15820			UNCODE.lettering();
15821		}
15822		UNCODE.animations();
15823		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
15824			UNCODE.stickyElements();
15825		}
15826		if (typeof UNCODE.twentytwenty !== 'undefined') {
15827			UNCODE.twentytwenty();
15828		}
15829		UNCODE.disableHoverScroll();
15830		UNCODE.printScreen();
15831		if (typeof UNCODE.particles !== 'undefined') {
15832			UNCODE.particles();
15833		}
15834		if (typeof UNCODE.filters !== 'undefined') {
15835			UNCODE.filters();
15836		}
15837		if (typeof UNCODE.ajax_filters !== 'undefined') {
15838			UNCODE.ajax_filters();
15839		}
15840		if (typeof UNCODE.widgets !== 'undefined') {
15841			UNCODE.widgets();
15842		}
15843		if (typeof UNCODE.unmodal !== 'undefined') {
15844			UNCODE.unmodal();
15845		}
15846		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
15847			if ( !UNCODE.isFullPage ) {
15848				UNCODE.checkScrollForTabs();
15849			}
15850		}
15851		if (typeof UNCODE.onePage !== 'undefined') {
15852			UNCODE.onePage(UNCODE.isMobile);
15853		}
15854		if (typeof UNCODE.fullPage !== 'undefined') {
15855			$(document).ready(function(){
15856				UNCODE.fullPage();
15857			});
15858		}
15859		if (typeof UNCODE.skewIt !== 'undefined') {
15860			UNCODE.skewIt();
15861		}
15862		if (typeof UNCODE.rotateIt !== 'undefined') {
15863			UNCODE.rotateIt();
15864		}
15865		if (typeof UNCODE.textMarquee !== 'undefined') {
15866			UNCODE.textMarquee();
15867		}
15868		if (typeof UNCODE.stickyScroll !== 'undefined') {
15869			UNCODE.stickyScroll();
15870		}
15871		if (typeof UNCODE.stickyTrigger !== 'undefined') {
15872			UNCODE.stickyTrigger();
15873		}
15874		if (typeof UNCODE.areaTextReveal !== 'undefined') {
15875			UNCODE.areaTextReveal();
15876		}
15877		if (typeof UNCODE.thumbsReveal !== 'undefined') {
15878			UNCODE.thumbsReveal();
15879		}
15880		if (typeof UNCODE.verticalText !== 'undefined') {
15881			UNCODE.verticalText();
15882		}
15883		if (typeof UNCODE.videoThumbs !== 'undefined') {
15884			UNCODE.videoThumbs();
15885		}
15886		if (typeof UNCODE.revslider !== 'undefined') {
15887			UNCODE.revslider();
15888		}
15889		if (typeof UNCODE.layerslider !== 'undefined') {
15890			UNCODE.layerslider();
15891		}
15892		if (typeof UNCODE.lottie !== 'undefined') {
15893			UNCODE.lottie();
15894		}
15895		if (typeof UNCODE.inlineImgs !== 'undefined') {
15896			UNCODE.inlineImgs();
15897		}
15898		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
15899			UNCODE.animatedBgGradient();
15900		}
15901		if (typeof UNCODE.readMoreCol !== 'undefined') {
15902			UNCODE.readMoreCol();
15903		}
15904		if (typeof UNCODE.multibg !== 'undefined') {
15905			UNCODE.multibg();
15906		}
15907		if (typeof UNCODE.flexEqual !== 'undefined') {
15908			UNCODE.flexEqual();
15909		}
15910		$(window).on('load',function(){
15911			clearRequestTimeout(waypoint_request);
15912			waypoint_request = requestTimeout( function(){
15913				Waypoint.refreshAll();
15914			}, 1000);
15915		});
15916		$(window).one('load',function(){
15917			if (typeof UNCODE.parallax !== 'undefined') {
15918				UNCODE.parallax();
15919			}
15920		});
15921	}
15922
15923	if ( ! SiteParameters.is_frontend_editor ) {
15924		UNCODE.init();
15925	}
15926
15927
15928})(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.