PageSourceSearch

https://insightaccessibilities.com/wp-content/themes/uncode/library/js/app.js?ver=1736307878

js insightaccessibilities.com collected 2026-09-24 13:59:45 UTC 507,984 bytes, 15,264 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 ) ) {
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 ) {
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'), function(index, val) {
323						var get_href = $(val).attr('href');
324						if (get_href != undefined) {
325							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
326							else $(val).parent().removeClass('active');
327						}
328					});
329					if (scrollSection.length) {
330						if ( $('body').hasClass('uncode-scroll-no-history') ) {
331							e.preventDefault();
332						}
333
334						if (UNCODE.menuOpened) {
335							if (UNCODE.wwidth < UNCODE.mediaQuery) {
336								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
337							} else {
338								$('.mmb-container-overlay .overlay-close').trigger('click');
339								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
340							}
341						}
342
343						var calc_scroll = scrollSection.offset().top,
344							getOffset = UNCODE.get_scroll_offset(e),
345							$logo = $('.logo-container:visible'),
346							logoH,
347							$menu = $('#masthead .menu-container'),
348							menuH;
349
350						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
351
352						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
353							delta = bodyTop - calc_scroll,
354							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
355						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
356
357						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
358							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
359								logoH = $logo.outerHeight(),
360								menuH = $menu.outerHeight();
361								if ( calc_scroll < ( logoH + menuH ) ) {
362									calc_scroll = 0;
363								}
364							}
365						}
366
367						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
368							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
369						}
370
371						if (scrollSpeed == 0) {
372							$('html, body').scrollTop(calc_scroll);
373							UNCODE.scrolling = false;
374						} else {
375	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
376								$(this).stop();
377							}).animate({
378								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
379							}, scrollSpeed, 'easeInOutCubic', function() {
380								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
381								UNCODE.scrolling = false;
382								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
383								||
384								$('.menu-hided').length ) {
385									calc_scroll = scrollSection.offset().top;
386									getOffset = UNCODE.get_scroll_offset(e);
387									calc_scroll -= getOffset;
388									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
389										$(this).stop();
390									}).animate({
391										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
392										}, scrollSpeed, 'easeInOutCubic', function() {
393											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
394											UNCODE.scrolling = false;
395										}
396									);
397								}
398							});
399						}
400					}
401				}
402			}
403		});
404		$('.header-scrolldown').on('click', function(event) {
405
406			event.preventDefault();
407
408			var pageHeader = $(event.target).closest('#page-header'),
409				pageHeaderTop = pageHeader.offset().top,
410				pageHeaderHeight = pageHeader.outerHeight(),
411				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
412			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
413
414			var calc_scroll = pageHeaderTop + pageHeaderHeight,
415			getOffset = UNCODE.get_scroll_offset(event);
416			calc_scroll -= getOffset;
417
418			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
419				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
420
421				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
422					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
423				}
424			}
425
426			if (scrollSpeed == 0) {
427				$('html, body').scrollTop(calc_scroll);
428				UNCODE.scrolling = false;
429			} else {
430					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
431						$(this).stop();
432					}).animate({
433						scrollTop: calc_scroll
434					}, scrollSpeed, 'easeInOutCubic', function() {
435						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
436						UNCODE.scrolling = false;
437						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
438							calc_scroll = pageHeaderTop + pageHeaderHeight;
439							getOffset = UNCODE.get_scroll_offset(event);
440							calc_scroll -= getOffset;
441								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
442									$(this).stop();
443								}).animate({
444									scrollTop: calc_scroll
445								}, scrollSpeed, 'easeInOutCubic', function() {
446									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
447									UNCODE.scrolling = false;
448								}
449							);
450						}
451					}
452				);
453			}
454		});
455	}
456
457	// Colomun hover effect
458	// =================
459	$(document).on('mouseenter', '.col-link', function(e) {
460		var uncol = $(e.target).prev('.uncol'),
461		el = uncol.find('.column-background');
462		if (el) {
463			$('.btn-container .btn', uncol).addClass('active');
464			var elOverlay = $(el[0]).find('.block-bg-overlay');
465			if (elOverlay.length) {
466				var getOpacity = $(elOverlay).css('opacity');
467				if (getOpacity != 1) {
468					getOpacity = Math.round(getOpacity * 100) / 100;
469					var newOpacity = getOpacity + .1;
470					$(elOverlay).data('data-opacity', getOpacity);
471					$(elOverlay).css('opacity', newOpacity);
472				}
473			}
474		}
475	}).on('mouseleave', '.col-link', function(e) {
476		var uncol = $(e.target).prev('.uncol'),
477		el = uncol.find('.column-background');
478		$('.btn-container .btn', uncol).removeClass('active');
479		if (el) {
480			var elOverlay = $(el[0]).find('.block-bg-overlay');
481			if (elOverlay.length) {
482				var getOpacity = $(elOverlay).data('data-opacity');
483				$(elOverlay).css('opacity', getOpacity);
484			}
485		}
486	});
487
488	// Admin bar
489	// ============
490	var fixAdminBar = function() {
491		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
492			var getAdminBar = $('#wpadminbar');
493			if (getAdminBar.length) {
494				if (getAdminBar.css('position') !== 'hidden') {
495					var getAdminBarHeight = getAdminBar.height();
496					if (getAdminBar.css('position') === 'fixed') {
497						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
498						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
499					} else {
500						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
501						$('.body-borders .top-border').css({'margin-top':'0px'});
502					}
503				}
504			}
505		}
506	};
507	window.addEventListener('load', fixAdminBar);
508	window.addEventListener('resize', fixAdminBar);
509	// Print
510	// ===========
511	var beforePrint = function() {
512		window.dispatchEvent(new CustomEvent('resize'));
513		window.dispatchEvent(UNCODE.boxEvent);
514	};
515
516	if (window.matchMedia) {
517		var mediaQueryList = window.matchMedia('print');
518		mediaQueryList.addListener(function(mql) {
519			if (mql.matches) {
520				beforePrint();
521			}
522		});
523	}
524
525	window.onbeforeprint = beforePrint;
526
527	// Safari srcset
528	var safariSrcSet = function(){
529		if ( !SiteParameters.is_frontend_editor ) {
530			$('html.safari img[sizes]').each(function(){
531				var $img = $(this),
532					sizeImg = parseInt($img.attr('sizes'));
533				if ( typeof(sizeImg) === 'number' ) {
534					$img.attr('sizes', (sizeImg) + 'px');
535				}
536			});
537		}
538	};
539	window.addEventListener('load', safariSrcSet);
540}
541
542UNCODE.lettering = function() {
543
544	var setCTA;
545	var highlightStill = function(){
546
547		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
548
549		$.each($heading_texts, function(key, el) {
550			var $heading = $(el);
551
552			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
553				return;
554			}
555
556			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
557				return;
558			}
559
560			var waypoint = new Waypoint({
561				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
562				element: el,
563				handler: function() {
564					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
565						anims_l = $anims.length;
566					$anims.each(function(_key_, _el_){
567						var $anim = $(_el_);
568
569						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
570							$anim.addClass('heading-text-highlight-animated');
571
572							if ( $heading.data('animate') === true ) {
573								$anim.css({
574									'-webkit-transition-duration': '0ms',
575									'-moz-transition-duration': '0ms',
576									'-o-transition-duration': '0ms',
577									'transition-duration': '0ms',
578								});
579							} else {
580								$anim.css({
581									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
582									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
583									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
584									'transition-delay': ((_key_ + 2) * 200) + 'ms',
585								});
586							}
587						}
588
589					});
590					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
591						$heading.data('animate', true);
592					});
593					$anims.removeAttr('data-animated');
594				},
595				offset: '100%'
596			});
597
598		});
599
600		Waypoint.refreshAll();
601		$( document.body ).trigger('uncode_waypoints');
602		if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
603			$(document).trigger('uncode-scrolltrigger-refresh');
604		}
605
606	}
607
608	requestTimeout(function(){
609		highlightStill();
610		$(window).on( 'wwResize', function(){
611			clearRequestTimeout(setCTA);
612			setCTA = requestTimeout( highlightStill, 100 );
613		});
614	}, 400);
615
616};
617
618UNCODE.isUnmodalOpen = false;
619
620var manageVideoSize = function(){
621
622	var setVideoFit;
623	$('.wp-block-embed').each(function(){
624
625		var $this = $(this);
626
627		if ( $('iframe', $this).length ) {
628
629			var $iframe = $('> iframe, > a > iframe', $this),
630				w = parseFloat($iframe.attr('width')),
631				h = parseFloat($iframe.attr('height')),
632				url = $iframe.attr('src'),
633				ratio, frW;
634
635			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
636
637				ratio = h / w;
638				var setResizeiFto,
639					resizeiFrame = function(){
640					frW = $iframe.width();
641					$iframe.css({
642						height: frW * ratio
643					});
644				};
645				resizeiFrame();
646				$(window).on( 'wwResize load', function(){
647					clearRequestTimeout(setResizeiFto);
648					setResizeiFto = requestTimeout( function() {
649						resizeiFrame();
650					}, 10 );
651				});
652
653			}
654
655		}
656
657	});
658
659};
660
661manageVideoSize();
662
663UNCODE.vivus = function(icon, time, delay, file) {
664	if (typeof Vivus !== 'undefined') {
665		var icon_options = {
666			type: 'delayed',
667			pathTimingFunction: Vivus.EASE_OUT,
668			animTimingFunction: Vivus.LINEAR,
669			duration: time,
670		}
671
672		if (delay) {
673			icon_options.delayStart = delay;
674		}
675
676		if (file) {
677			icon_options.file = file;
678		}
679
680		new Vivus(icon, icon_options);
681	}
682};
683
684UNCODE.lastURL = '';
685
686UNCODE.getURLParams = function(current_location, is_string) {
687	var params = {};
688	if (is_string) {
689		var url = current_location.split('?')[1];
690	} else {
691		var url = current_location.search;
692		url = url.substring(1);
693	}
694	if (url) {
695		var parts = url.split('&');
696		for (var i = 0; i < parts.length; i++) {
697			var nv = parts[i].split('=');
698			if (!nv[0]) {
699				continue;
700			}
701			params[nv[0]] = nv[1] || true;
702		}
703	}
704	return params;
705}
706
707UNCODE.hasEqualURLParams = function(obj1, obj2) {
708	for (var i in obj1) {
709		if (obj1.hasOwnProperty(i)) {
710			if (!obj2.hasOwnProperty(i)) {
711				return false;
712			}
713			if (obj1[i] != obj2[i]) {
714				return false;
715			}
716		}
717	}
718	for (var i in obj2) {
719		if (obj2.hasOwnProperty(i)) {
720			if (!obj1.hasOwnProperty(i)) {
721				return false;
722			}
723			if (obj1[i] != obj2[i]) {
724				return false;
725			}
726		}
727	}
728    return true;
729}
730
731UNCODE.magnetic = function(){
732	
733	$(document).on('mousemove', '.un-magnetic-zone', function(e){
734
735		var $zone = $(this),
736			zoneOff = $zone.offset(),
737			$mgntcEl = $('.un-magnetic-el', this),
738			elBound = this.getBoundingClientRect(),
739			maxSize = Math.max($zone.outerWidth(), $zone.outerHeight());
740
741		var Xvalue = e.pageX - (zoneOff.left + maxSize / 2),
742	  		Yvalue = e.pageY - (zoneOff.top + maxSize / 2);
743	  
744		$mgntcEl.each(function(key, val){
745			var magneticValue = $(val).attr('data-mgntc') || 0.5;
746		
747			val.animate({
748				transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)',
749			},{
750				duration: 500,
751				fill: 'forwards',
752			})
753	  	});
754	})
755	
756	$(document).on('mouseleave', '.un-magnetic-zone', function(e){
757		var $mgntcEl = $('.un-magnetic-el', this);
758
759		$mgntcEl.each(function(key, val){
760			val.animate({
761		  		transform: 'translate(0)',
762			},{
763		  		duration: 500,
764		  		fill: 'forwards',
765			})
766	  	});
767	})
768};
769
770UNCODE.rowParallax = function(){
771
772	if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) {
773		return;
774	}
775
776	var $rows = $('.parallax-move'),
777		stableHeight = UNCODE.wheight;
778	$rows.each(function(){
779		var $row = $(this),
780			_row = $row[0],
781			dataMove = $row.attr('data-parallax-move'),
782			dataSafe = $row.attr('data-parallax-safe'),
783            rowInViewport = false,
784			trans;
785
786		if ( $row.find('.parallax-move').length ) {
787			return;
788		}
789
790		dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe;
791		dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove;           
792        dataMove = dataMove / 10;
793
794        if ( 'IntersectionObserver' in window ) {
795			var observer = new IntersectionObserver(function(entries) {
796	
797				entries.forEach(function(entry){
798					if ( entry.isIntersecting ) {
799						rowInViewport = true;
800					} else {
801						rowInViewport = false;
802					}
803				});
804	
805			}, { 
806				root: document,
807			});
808	
809			observer.observe(_row);
810		} else {
811            rowInViewport = true;
812		}
813
814		var loopRAF = function() {
815			if( rowInViewport ) {
816				var bound = _row.getBoundingClientRect(),
817					bound_top = bound.top,
818					bound_height = bound.height,
819					move = true,
820					scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
821					docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
822						document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ),
823					fromBottom = docH - (scrolled + bound_top + bound_height);
824
825                if ( bound_height > stableHeight && dataSafe === 'yes' ) {
826                    $row.find('>div').css({
827                        'transform':'none'
828                    });
829                    move = false;
830				}
831
832				if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) {
833					$row.find('>div').css({
834						'transform':'none'
835					});
836					move = false;
837				}
838
839				if ( move ) {
840
841					if ( fromBottom < stableHeight ) {
842						//maybe Footer
843						trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove);
844                    } else if ( scrolled + bound_top < stableHeight ) {
845						//maybe Header
846						trans = scrolled*(dataMove);
847					} else {
848						trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove);
849					}
850
851                    $row.find('>div').css({
852                        'transform':'translateY(' + (trans) + 'px) translateZ(0)',
853                    });
854                }
855			}
856	
857			requestAnimationFrame(loopRAF);
858		};
859		
860		requestAnimationFrame(loopRAF);
861
862	});
863
864	$(window).on( 'load resize', function(e) {
865		if ( ! UNCODE.isMobile ) {
866			stableHeight = UNCODE.wheight;
867		}
868	});
869
870	$(window).on( 'load wwResize', function(e) {
871		if ( UNCODE.isMobile ) {
872			stableHeight = UNCODE.wheight;
873		}
874	});
875
876}
877
878UNCODE.changeSkinOnScroll = function(){
879	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
880		return;
881	}
882	var $masthead = $('#masthead'),
883		transDesktop,
884		transMobile,
885		changeSkin,
886
887	checkTransparencyAndChange = function( $col ){
888		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
889		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
890		changeSkin = $masthead.hasClass('menu-change-skin');
891
892		if ( ! transDesktop && ! transMobile ) {
893			return false;
894		}
895
896		if ( ! changeSkin ) {
897			return false;
898		}
899
900		if ( $col.hasClass('style-light') ){
901			$masthead.removeClass('style-dark-override').addClass('style-light-override');
902			return false;
903		} else if ( $col.hasClass('style-dark') ) {
904			$masthead.removeClass('style-light-override').addClass('style-dark-override');
905			return false;
906		}
907	};
908
909	var prev_row = 'normal',
910		odd = true,
911		$rows = $('.vc_row[data-parent]:visible');
912	$.each($rows, function(index, row){
913		var $row = $(row),
914			$col = $('.uncol', $row).first(),
915			$slider = $('.uncode-slider', $row);
916
917		var wayDown = new Waypoint({
918			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
919			element: row,
920			handler: function(direction) {
921				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
922					if ( $slider.length ) {
923						$col = $('.owl-item.index-active .uncol', $slider).first();
924					}
925					checkTransparencyAndChange($col);
926				}
927				if ( odd === false ) {
928					if ( row.hasAttribute('data-bg-changer') ) {
929						prev_row = 'bg-changer';
930					} else {
931						prev_row = 'normal';
932					}
933					odd = true;
934				} else {
935					odd = false;
936				}
937			},
938			offset: function() {
939				return UNCODE.menuHeight / 2
940			}
941		});
942		var wayUp = new Waypoint({
943			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
944			element: row,
945			handler: function(direction) {
946				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
947					if ( $slider.length ) {
948						$col = $('.owl-item.index-active .uncol', $slider).first();
949					}
950					checkTransparencyAndChange($col);
951				}
952				if ( odd === false ) {
953					if ( row.hasAttribute('data-bg-changer') ) {
954						prev_row = 'bg-changer';
955					} else {
956						prev_row = 'normal';
957					}
958					odd = true;
959				} else {
960					odd = false;
961				}
962			},
963			offset: function() {
964				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
965			}
966		});
967	});
968
969};
970
971UNCODE.share = function() {
972	if (typeof Share !== 'undefined') {
973		var share_button_element = $('.share-button');
974		var share_button_url = share_button_element.data('url');
975
976		var share_button_config = {
977			ui: {
978				flyout: "top center",
979				button_font: false,
980				button_text: '',
981				icon_font: false
982			}
983		};
984
985		if (share_button_url) {
986			share_button_config.url = share_button_url.replace("&", "%26");
987		}
988
989		var share_button_top = new Share('.share-button', share_button_config);
990
991		$('li[data-network]', share_button_element).each(function(){
992			var label = SiteParameters.uncode_share_label,
993				network = $(this).attr('data-network');
994			label = label.replace("%", network);
995			$(this).attr('aria-label', label);
996		});
997	}
998};
999
1000UNCODE.tooltip = function() {
1001	if (typeof jQuery.fn.tooltip !== 'undefined') {
1002		$('.btn-tooltip').tooltip();
1003	}
1004};
1005
1006UNCODE.counters = function() {
1007	var $counters = $('.uncode-counter:not(.counter-init)');
1008	$counters.each(function(){
1009		var $counter = $(this).addClass('counter-init');
1010		if ( SiteParameters.is_frontend_editor ) {
1011			$counter.addClass('started');
1012		}
1013		if ( $counter.closest( '.owl-carousel' ).length ) {
1014			return;
1015		}
1016		$counter.addClass('started').counterUp({
1017			delay: 10,
1018			time: 1500
1019		});
1020	});
1021};
1022
1023UNCODE.countdowns = function() {
1024	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
1025	$countdowns.each(function() {
1026		var $this = $(this).addClass('counter-init'),
1027			finalDate = $(this).data('uncode-countdown');
1028		$this.countdown(finalDate, function(event) {
1029			$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>'));
1030		});
1031	});
1032};
1033
1034UNCODE.tabs = function() {
1035
1036	var tabSwitcher = function($el){
1037		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1037ical):not(.tab-switch)', $el).each(function(key, value){
1038			var $navs = $(value),
1039				$active = $('li.active', $navs),
1040				$active_a = $('> a', $active),
1041				$active_span = $('> span', $active_a),
1042				vertical = $navs.closest('.vertical-tab-menu').length;
1043			
1044			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
1045				$navs.append('<span class="switcher-cursor" aria-hidden="true" tabindex="-1" />');
1046			}
1047
1048			var $cursor = $('.switcher-cursor', $navs),
1049				active_w = $('a', $active).outerWidth(),
1050				span_w = $active_span.outerWidth(),
1051				active_pos = $active.position(),
1052				active_a_pos = $active_a.position(),
1053				span_pos = $active_span.position(),
1054				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
1055				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
1056
1057			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
1058
1059			if ( ! vertical ) {
1060				$cursor.css({
1061					left: cursor_left,
1062					width: cursor_w
1063				});
1064			}
1065
1066			$navs.addClass('switch-init');
1067		});
1068	};
1069
1070	var $body = $('body');
1071	tabSwitcher($body);
1072
1073	var tabHoverIntent = function(){
1074		var setHover;
1075		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
1076			.on('mouseover', function(e){
1077				var $this = $(e.target);
1078				setHover = requestTimeout(function() {
1079					$this.trigger('hover-int');
1080				}, 50);
1081			})
1082			.on('mouseout', function(){
1083				clearRequestTimeout(setHover);
1084			});
1085	};
1086	tabHoverIntent();
1087
1088	var tabInit = function(){
1089		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
1090			e.preventDefault()
1091			var $el = $(this);
1092			$el.tab('show');
1093			var $container = $el.closest('.uncode-tabs');
1094			tabSwitcher($container);
1095			requestTimeout(function() {
1096				window.dispatchEvent(UNCODE.boxEvent);
1097				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
1098
1099				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
1100					window.dispatchEvent(new CustomEvent('boxResized'));
1101				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
1102					window.dispatchEvent(new Event('resize'));
1103					$(window).trigger('uncode.re-layout');
1104				} 
1105
1106				var $active_panel = $('.tab-pane.active', $tabs);
1107
1108				$.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) {
1109					var element = $(val),
1110						delayAttr = element.attr('data-delay');
1111					if (delayAttr == undefined) delayAttr = 0;
1112					requestTimeout(function() {
1113						element.addClass('start_animation');
1114					}, delayAttr);
1115				});
1116
1117			}, 300);
1118
1119			var $li = $el.closest('li'),
1120				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1121			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1122			$('.tab-pane', $li).slideDown(250);
1123			var completeSlideDown = requestTimeout(function(){
1124				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1125					var pos = $el.offset(),
1126						rect = $el[0].getBoundingClientRect(),
1127						$masthead = $('#masthead > .menu-container'),
1128						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1129
1130					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1131						$('html, body').animate({
1132							scrollTop: ( pos.top ) - considerMenu
1133						},{
1134							easing: 'easeInOutQuad',
1135							duration: 250
1136						});
1137					}
1138				}
1139			}, 260);
1140		});
1141	}
1142	tabInit();
1143
1144	var tabResponsive = function(){
1145		if ( SiteParameters.is_frontend_editor ) {
1146			return true;
1147		}
1148		var $tabContainers = $('.tab-container.tabs-breakpoint');
1149		$tabContainers.each(function(){
1150			var $tabContainer = $(this),
1151				$tabContent = $('.tab-content', $tabContainer),
1152				$nav = $('.nav-tabs', $tabContainer),
1153				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1154
1155			$('> li', $nav).each(function(){
1156				var $li = $(this),
1157					dataID = $li.attr('data-tab-id');
1158
1159				if ( UNCODE.wwidth <= mQuery ) {
1160					if ( ! $('.tab-pane', $li ).length ) {
1161						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1162						$tabContainer.addClass('tabs-appended');
1163						$li.append($append_pane);
1164					}
1165
1166					if ( $li.hasClass('active') ) {
1167						$('> a', $li).click();
1168					}
1169				} else {
1170					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1171						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1172						$tabContainer.removeClass('tabs-appended');
1173						$tabContent.prepend($append_pane.removeAttr('style'));
1174					}
1175				}
1176			});
1177		});
1178
1179	}
1180	tabResponsive();
1181
1182	$(window).on('wwResize', function(){
1183		tabHoverIntent();
1184		tabSwitcher($body);
1185	});
1186
1187	var setCTA;
1188	$(window).on( 'resize', function(){
1189		clearRequestTimeout(setCTA);
1190		setCTA = requestTimeout( tabResponsive, 100 );
1191	});
1192
1193	$('.nav-tabs').each(function(){
1194		var $nav = $(this),
1195			$lis = $('> li:not(.active)', $nav),
1196			$links = $('.tab-excerpt-link', $nav);
1197		$('.tab-excerpt', $lis).slideUp(400, function(){
1198			$(this).addClass('init');
1199		});
1200
1201		$links.each(function(){
1202			var $link = $(this),
1203				$par_a = $link.closest('a'),
1204				href = $link.attr('data-href'),
1205				target = $link.attr('data-target');
1206			$par_a.addClass('inner-link');
1207			$link.on('click', function(){
1208				var _link = document.createElement('a');
1209				_link.href = href;
1210				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1211				_link.click();
1212			});
1213		});
1214		$nav.addClass('tab-init');
1215	});
1216
1217	$('.uncode-tabs.tabs-no-lazy').each(function(){
1218		var $tabs = $(this),
1219			$panes = $('.tab-pane:not(.active)', $tabs);
1220		$panes.each(function(){
1221			var $pane = $(this),
1222				$imgs = $('img[loading="lazy"]', $pane);
1223			$imgs.removeAttr('loading');
1224			$imgs.removeAttr('decoding');
1225		});
1226	});
1227
1228};
1229UNCODE.collapse = function() {
1230	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1231		var $this = $(this),
1232			href
1233		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1234		var $target = $(target)
1235		var parent = $this.attr('data-parent')
1236		var $parent = parent && $(parent)
1237		var $title = $(this).parent()
1238		var $accordion = $(e.target).closest('.uncode-accordion')
1239		var $group = $this.closest('.group')
1240		var $panel_group = $this.closest('.panel-group')
1241		if ($parent) {
1242			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1243			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1244				$title.removeClass('active');
1245				$group.removeClass('active-group');
1246			} else {
1247				if ( $panel_group.attr('data-no-toggle') != true ) {
1248					$parent.find('.panel-title').removeClass('active')
1249					$parent.find('.group').removeClass('active-group')
1250				}
1251				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1252				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1253			}
1254		}
1255		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1256		requestTimeout(function() {
1257			var $accordion = $(e.target).closest('.uncode-accordion');
1258			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1259			  window.dispatchEvent(new CustomEvent('boxResized'));
1260			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1261				window.dispatchEvent(new Event('resize'));
1262				$(window).trigger('uncode.re-layout');
1263			} 
1264
1265			var $active_panel = $('.panel.active-group', $parent);
1266
1267			$.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) {
1268				var element = $(val),
1269					delayAttr = element.attr('data-delay');
1270				if (delayAttr == undefined) delayAttr = 0;
1271				requestTimeout(function() {
1272					element.addClass('start_animation');
1273				}, delayAttr);
1274			});
1275
1276		}, 500);
1277
1278		$group.find('.panel-title:not(.active) > a').trigger('blur');
1279
1280	});
1281
1282	$('.uncode-accordion.tabs-no-lazy').each(function(){
1283		var $accordion = $(this),
1284			$panes = $('.panel:not(.active-group)', $accordion);
1285		$panes.each(function(){
1286			var $pane = $(this),
1287				$imgs = $('img[loading="lazy"]', $pane);
1288			$imgs.removeAttr('loading');
1289			$imgs.removeAttr('decoding');
1290		});
1291	});
1292};
1293
1294UNCODE.accessibility = function() {
1295    if ( ! SiteParameters.uncode_is_accessible ) {
1296        return;
1297    }
1298
1299    //
1300
1301};
1302UNCODE.bigText = function(el) {
1303	var bigTextLaunch = function(){
1304		if (el == undefined) {
1305			el = $('body');
1306		}
1307		$.each($('.bigtext', el), function(index, val) {
1308			$(val).bigtext({
1309				minfontsize: 24
1310			});
1311			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1312				opacity: 1
1313			});
1314			requestTimeout(function() {
1315				if ($(val).find('.animate_when_almost_visible').length != 0) {
1316					$(val).css({opacity: 1});
1317				}
1318			}, 400);
1319		});
1320	};
1321
1322	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1323		bigTextLaunch();
1324	}
1325	$(window).on( 'load', bigTextLaunch );
1326};
1327
1328UNCODE.process_shortpixel_image = function(image) {
1329	var data = {
1330		action: 'shortpixel_manual_optimization',
1331		image_id: image,
1332		cleanup: true
1333	};
1334
1335	$.get(SiteParameters.ajax_url, data);
1336};
1337
1338UNCODE.menuSystem = function() {
1339
1340	function menuMobile() {
1341		var $body = $('body'),
1342			scrolltop,
1343			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'),
1344			$masthead = $('#masthead'),
1345			$box,
1346			$el,
1347			$el_transp,
1348			elHeight,
1349			offCanvasAnim,
1350			check,
1351			animating = false,
1352			stickyMobile = false,
1353			menuClose = new CustomEvent('menuMobileClose'),
1354			menuOpen = new CustomEvent('menuMobileOpen');
1355		UNCODE.menuOpened = false;
1356		$mobileToggleButton.on('click', function(event) {
1357			event.stopPropagation();
1358			var btn = this;
1359			if ($(btn).hasClass('overlay-close')) return;
1360			event.preventDefault();
1361			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1362			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1363				$box = $(this).closest('.box-container').find('.main-menu-container');
1364				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
1365				$el_transp = $('.menu-absolute.menu-transparent');
1366				if (UNCODE.isMobile) {
1367					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 ) {
1368						stickyMobile = true;
1369						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1370					} else {
1371						elHeight = 0;
1372						$.each($box.find('> div'), function(index, val) {
1373							elHeight += $(val).outerHeight();
1374						});
1375					}
1376				} else {
1377					elHeight = 0;
1378					$.each($el, function(index, val) {
1379						elHeight += $(val).outerHeight();
1380					});
1381				}
1382				var open = function() {
1383					clearTimeout(offCanvasAnim);
1384					if (!animating) {
1385						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1386						scrolltop = $(window).scrollTop();
1387						window.dispatchEvent(menuOpen);
1388						animating = true;
1389						UNCODE.menuOpened = true;
1390						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1391							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1392								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1393							}
1394							if ($('body.menu-offcanvas').length) {
1395								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1396								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1397							} else {
1398								if ( $('.menu-hide, .menu-sticky').length ) {
1399									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1400										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1401									}
1402								}
1403							}
1404						}
1405						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1406							//$("#masthead")[0].scrollIntoView();
1407							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1408						}
1409						$box.addClass('open-items');
1410						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1411							$el_transp.addClass('is_mobile_open');
1412						}
1413						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1414							btn.classList.add('close');
1415							$box.animate({
1416								height: elHeight
1417							}, 600, "easeInOutCirc", function() {
1418								animating = false;
1419								if (!stickyMobile) $box.css('height', 'auto');
1420							});
1421						} else {
1422							animating = false;
1423						}
1424					}
1425				};
1426
1427				var close = function() {
1428					clearTimeout(offCanvasAnim);
1429					if (!animating) {
1430						window.dispatchEvent(menuClose);
1431						animating = true;
1432						UNCODE.menuOpened = false;
1433						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1434							btn.classList.remove('close');
1435							btn.classList.add('closing');
1436						}
1437						$box.addClass('close');
1438						requestTimeout(function() {
1439							$box.removeClass('close');
1440							$box.removeClass('open-items');
1441							btn.classList.remove('closing');
1442							if ($el_transp.length) {
1443								$el_transp.removeClass('is_mobile_open');
1444							}
1445						}, 500);
1446						$body.removeClass('opening-overlay-menu');
1447						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1448							$box.animate({
1449								height: 0
1450							}, {
1451								duration: 600,
1452								easing: "easeInOutCirc",
1453								complete: function(elements) {
1454									$(elements).css('height', '');
1455									animating = false;
1456									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1457										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1458									}
1459									$body.removeClass('open-overlay-menu');
1460								}
1461							});
1462						} else {
1463							animating = false;
1464							offCanvasAnim = setTimeout(function(){
1465								$body.removeClass('open-overlay-menu');
1466							}, 1000);
1467						}
1468					}
1469				};
1470				check = (!UNCODE.menuOpened) ? open() : close();
1471			}
1472		});
1473
1474		$('html').on('click', function(event){
1475			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1476				$('.uncode-close-offcanvas-mobile').trigger('click');
1477			}
1478		});
1479
1480		window.addEventListener('menuMobileTrigged', function(e) {
1481			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1482		});
1483		window.addEventListener('orientationchange', function(e) {
1484			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1485		});
1486		window.addEventListener("resize", function() {
1487			if ($(window).width() < UNCODE.mediaQuery) {
1488				if (UNCODE.isMobile) {
1489					var $box = $('.box-container .main-menu-container'),
1490						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
1491					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1492						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1493							elHeight = 0;
1494							$.each($el, function(index, val) {
1495								elHeight += $(val).outerHeight();
1496							});
1497							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;
1498							$($box).css('height', elHeight + 'px');
1499						}
1500					}
1501				}
1502			} else {
1503				$('.menu-hide-vertical').removeAttr('style');
1504				$('.menu-container-mobile').removeAttr('style');
1505				$('.vmenu-container.menu-container').removeAttr('style');
1506			}
1507		});
1508
1509		$(window).on('scroll', function(){
1510			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1511				$(window).scrollTop(scrolltop);
1512				return false;
1513			}
1514		});
1515
1516	};
1517
1518	function menuOffCanvas() {
1519		var menuClose = new CustomEvent('menuCanvasClose'),
1520			menuOpen = new CustomEvent('menuCanvasOpen');
1521		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1522			if ($(window).width() > UNCODE.mediaQuery) {
1523				if ( $('body.vmenu-offcanvas-overlay').length ) {
1524					if ($(event.currentTarget).hasClass('off-close')) {
1525						$(event.currentTarget).removeClass('off-close');
1526						requestTimeout(function() {
1527							window.dispatchEvent(menuClose);
1528						}, 500);
1529
1530					} else {
1531						$(event.currentTarget).addClass('off-close');
1532						window.dispatchEvent(menuOpen);
1533					}
1534				} else {
1535					if ($(event.currentTarget).hasClass('close')) {
1536						$(event.currentTarget).removeClass('close');
1537						$(event.currentTarget).addClass('closing');
1538						requestTimeout(function() {
1539							$(event.currentTarget).removeClass('closing');
1540							window.dispatchEvent(menuClose);
1541						}, 500);
1542
1543					} else {
1544						$(event.currentTarget).addClass('close');
1545						window.dispatchEvent(menuOpen);
1546					}
1547				}
1548			}
1549
1550			$('body').toggleClass('off-opened');
1551		});
1552
1553		$('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){
1554			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1555				var $vMenuCont = $('#masthead .vmenu-container'),
1556					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1557
1558					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1559					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1560					vmenu_off = $vMenuCont.offset(),
1561					vmenu_l = parseFloat(vmenu_off.left),
1562					vmenu_t = parseFloat(vmenu_off.top),
1563					vmenu_r = vmenu_l + vmenu_w,
1564					vmenu_b = vmenu_t + vmenu_h,
1565
1566					close_h = parseFloat( $close_menu.outerHeight() ),
1567					close_w = parseFloat( $close_menu.outerWidth() ),
1568					close_off = $close_menu.offset(),
1569					close_l = parseFloat(close_off.left),
1570					close_t = parseFloat(close_off.top),
1571					close_r = close_l + close_w,
1572					close_b = close_t + close_h;
1573				if (
1574					!(
1575						e.clientX > vmenu_l &&
1576						e.clientX < vmenu_r &&
1577						e.clientY > vmenu_t &&
1578						e.clientY < vmenu_b
1579					)
1580					||
1581					(
1582						e.clientX > close_l &&
1583						e.clientX < close_r &&
1584						e.clientY > close_t &&
1585						e.clientY < close_b
1586					)
1587				) {
1588					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1589				}
1590			}
1591		});
1592	};
1593
1594	function menuOverlay() {
1595		if ( $('.overlay').length ) {
1596			$('.overlay').removeClass('hidden');
1597		}
1598		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1599			$('.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) {
1600				var transDelay = (index / 20) + 0.1;
1601				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1602					transDelay = transDelay + 0.3;
1603				$(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');
1604			});
1605		}
1606
1607	};
1608	var $secondary_parent;
1609	function menuAppend() {
1610		var $body = $('body'),
1611			$menuCont = $('.menu-container:not(.vmenu-container)'),
1612			$vMenuCont = $('.menu-container.vmenu-container'),
1613			$cta = $('.navbar-cta'),
1614			$socials = $('.navbar-social:not(.appended-navbar)'),
1615			$ul = $('.navbar-main ul.menu-primary-inner'),
1616			$ulCta,
1617			$ulSocials,
1618			$navLast,
1619			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1620			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1621			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1622			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1623			$ulFirst = $('> ul', $firstNav),
1624			$ulSecond = $('> ul', $secondNav),
1625			setCTA,
1626			appendCTA = function(){
1627				return true;
1628			},
1629			appendSocials = function(){
1630				return true;
1631			},
1632			appendSplit = function(){
1633				return true;
1634			};
1635
1636		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1637			$ulCta = $('> ul', $cta);
1638			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1639
1640			appendCTA = function(){
1641				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1642					$ul.after($ulCta);
1643				} else {
1644					$cta.append($ulCta);
1645				}
1646			}
1647		}
1648
1649		if ( ! $body.hasClass('cta-not-appended') ) {
1650			appendCTA();
1651		}
1652
1653		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1654		$smartSocial.each(function(){
1655			var $_smartSocial = $(this);
1656			$('> li', $_smartSocial).each(function(){
1657				var $li = $(this);
1658				if ( $li.hasClass('mobile-hidden') ) {
1659					$_smartSocial.addClass('mobile-hidden');
1660				} else {
1661					$_smartSocial.removeClass('mobile-hidden');
1662					return false;
1663				}
1664			});
1665
1666			$('> li', $_smartSocial).each(function(){
1667				var $li = $(this);
1668				if ( $li.hasClass('tablet-hidden') ) {
1669					$_smartSocial.addClass('tablet-hidden');
1670				} else {
1671					$_smartSocial.removeClass('tablet-hidden');
1672					return false;
1673				}
1674			});
1675		});
1676
1677		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1678			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1679			if ( $body.hasClass('hmenu-center-split') ) {
1680				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1681			} else {
1682				$navLast = $('.navbar-nav-last', $vMenuCont);
1683			}
1684
1685			if ( ! $navLast.length ) {
1686				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1687				if ( $body.hasClass('hmenu-center-split') ) {
1688					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1689					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1690				} else {
1691					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1692					$navLast = $('.navbar-nav-last', $vMenuCont);
1693				}
1694			}
1695
1696			appendSocials = function(){
1697				if ( !$body.hasClass('menu-overlay-center') ) {
1698				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1699				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1700				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1701				// 		$ulSocials.each(function(){
1702				// 			var $li_social = $(this);
1703				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1704				// 		});
1705				// 	}
1706				// } else {
1707					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1708						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1709						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1710							$('> ul.menu-smart-social li', $socials).remove();
1711						}
1712						$navLast.append($ulSocials);
1713					} else {
1714						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1715							$('> ul.menu-smart-social li', $navLast).remove();
1716						}
1717						$socials.append($ulSocials);
1718					}
1719				}
1720			}
1721			appendSocials();
1722		}
1723
1724		if ( $vMenuCont.length ) {
1725			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1726		} else {
1727			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1728		}
1729		if ( $accordion_secondary.length ) {
1730			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1731			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1732				if ( !$accordion_secondary_ph.length ) {
1733					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1734				}
1735				if ( $vMenuCont.length ) {
1736					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1737				} else {
1738					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1739						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1740					} else {
1741						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1742					}
1743				}
1744			} else {
1745				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1746					$accordion_secondary_ph.before($accordion_secondary);
1747				}
1748			}
1749		}
1750
1751		if ( $vMenuCont.length ) {
1752			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1753		} else {
1754			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1755		}
1756
1757		if ( $extra_icons.length ) {
1758			if ( $vMenuCont.length ) {
1759				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1760					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1761						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1762							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1763						$not_social.each(function(){
1764							if ( ! $primary_after.length ) {
1765								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1766								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1767								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1768							}
1769							var $extra_li = $(this);
1770							$primary_after.find('> ul').append($extra_li);
1771						});
1772					} else {
1773						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1774							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1775						$not_social.each(function(){
1776							var $extra_li = $(this);
1777							$extra_icons.find('> ul').append($extra_li);
1778						});
1779					}
1780				} /*else {
1781					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1782					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1783						if ( !$extra_icons_ph.length ) {
1784							$extra_icons.after('<span class="extra-icons-ph" />');
1785						}
1786						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1787							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1788						} else {
1789							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1790						}
1791					} else {
1792						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1793							$extra_icons_ph.before($extra_icons);
1794						}
1795					}
1796				}*/
1797			} else {
1798				if ( ! $body.hasClass('hmenu-center-double') ) {
1799					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1800						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1801							$primary_after = $('.nav.navbar-main-after', $menuCont);
1802
1803						if ( ! $primary_after.length && $not_social.length ) {
1804							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1805								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1806							} else {
1807								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1808							}
1809							$primary_after = $('.nav.navbar-main-after', $menuCont);
1810							$primary_after.append('<ul class="menu-smart sm menu-smart-social" role="menu" />');
1811						}
1812						var tablet_hidden = true,
1813							mobile_hidden = true;
1814						$not_social.each(function(){
1815							var $extra_li = $(this);
1816							$primary_after.find('> ul').append($extra_li);
1817							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1818								tablet_hidden = false;
1819							}
1820							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1821								mobile_hidden = false;
1822							}
1823						});
1824						if ( tablet_hidden === true && $not_social.length ) {
1825							$primary_after.addClass('tablet-hidden');
1826						}
1827						if ( mobile_hidden === true && $not_social.length ) {
1828							$primary_after.addClass('mobile-hidden');
1829						}
1830					} else {
1831						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1832
1833						if ( $primary_after.length ) {
1834							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1835							$not_social.each(function(){
1836								var $extra_li = $(this);
1837								$extra_icons.find('> ul').append($extra_li);
1838							});
1839							$primary_after.remove();
1840						}
1841					}
1842				}
1843			}
1844		}
1845
1846		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1847			appendSplit = function(){
1848				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1849					if ( $extra_icons.length ) {
1850						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1851							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1852								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1853							$not_social.each(function(){
1854								var $extra_li = $(this);
1855								$append_ul.append($extra_li);
1856							});
1857							if ( $secondNav.length ) {
1858								$secondNav.append($append_ul);
1859							} else {
1860								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1861							}
1862						}
1863					}
1864					if ( $secondNav.length ) {
1865						$secondNav.prepend($ulFirst);
1866					} else {
1867						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1868					}
1869					$firstMenu.hide();
1870				} else {
1871					$firstNav.append($ulFirst);
1872					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1873					if ( $append_ul.length ) {
1874						var $not_social = $('> li:not(.social-icon)', $append_ul);
1875						$not_social.each(function(){
1876							var $extra_li = $(this);
1877							$extra_icons.find('> ul').append($extra_li);
1878						});
1879					}
1880					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1881					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1882					$firstMenu.css({
1883						'display': 'table-cell'
1884					});
1885				}
1886			}
1887		}
1888		appendSplit();
1889
1890		$(window).on( 'wwresize', function(){
1891			clearRequestTimeout(setCTA);
1892			setCTA = requestTimeout( function() {
1893				appendCTA();
1894				appendSocials();
1895				appendSplit();
1896			}, 10 );
1897		});
1898	}
1899	//menuMobileButton();
1900	menuMobile();
1901	menuOffCanvas();
1902	menuAppend();
1903	menuOverlay();
1904
1905	var stickyDropdownSearch = function(){
1906		var $masthead = $('#masthead'),
1907			$ddSearch = $('.overlay.overlay-search', $masthead),
1908			$styles = $('#stickyDropdownSearch').remove();
1909		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1910			var $menuWrapper = $('.menu-wrapper'),
1911				$navbar = $('.menu-container-mobile', $menuWrapper),
1912				navbarH = $navbar.outerHeight(),
1913				//$topbar = $('.top-menu', $menuWrapper),
1914				//topbarH = $topbar.outerHeight(),
1915				_css;
1916
1917			_css = '<style id="stickyDropdownSearch">';
1918			_css += '@media (max-width: 959px) {';
1919			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
1920			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
1921			_css += '}';
1922			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
1923			_css += 'position: fixed;';
1924			_css += 'top: 0;';
1925			_css += '}';
1926			_css += '</style>';
1927
1928			$(_css).appendTo($('head'));
1929		}
1930	}
1931	stickyDropdownSearch();
1932
1933	var setMenuOverlay;
1934	$(window).on( 'wwResize', function(){
1935		if ( $('.overlay').length && $(window).width() > 1024 ) {
1936			$('.overlay').addClass('hidden');
1937		}
1938		clearRequestTimeout(setMenuOverlay);
1939		setMenuOverlay = requestTimeout( function(){
1940			menuOverlay();
1941			menuAppend();
1942			stickyDropdownSearch();
1943		}, 150 );
1944	});
1945	UNCODE.menuSmartInit();
1946};
1947
1948UNCODE.menuSmartInit = function() {
1949	var $menusmart = $('[class*="menu-smart"]'),
1950		$masthead = $('#masthead'),
1951		$hMenu = $('.menu-horizontal-inner', $masthead),
1952		$focus = $('.overlay-menu-focus'),
1953		showTimeout = 50,
1954		hideTimeout = 50,
1955		showTimeoutFunc, hideTimeoutFunc;
1956
1957	$('> li.menu-item-has-children', $menusmart).hover(function(){
1958		$(this).data('hover', true);
1959	}, function(){
1960		$(this).data('hover', false);
1961	});
1962
1963	$('> li.menu-item-has-children', $menusmart).each(function(){
1964		var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
1965	});
1966
1967	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
1968		e.preventDefault();
1969	});
1970
1971	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
1972		var $notLis = $('> .nav > ul > li a', $hMenu),
1973			$menuA = $('a', $masthead).not($notLis),
1974			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
1975			showFuncCond = function() { return true };
1976
1977		if ( $('body').hasClass('focus-megamenu') ) {
1978			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner');
1979			showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') };
1980		} else if ( $('body').hasClass('focus-links') ) {
1981			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
1982		}
1983
1984		$hoverSelector.hover(function(){
1985			clearRequestTimeout(hideTimeoutFunc);
1986			showTimeoutFunc = requestTimeout(function(){
1987				$('body').addClass('navbar-hover');
1988			}, showTimeout*2);
1989		}, function(){
1990			hideTimeoutFunc = requestTimeout(function(){
1991				if ( ! $('.overlay-search.open', $masthead).length ) {
1992					$('body').removeClass('navbar-hover');
1993				}
1994			}, hideTimeout*2);
1995		});
1996	} else {
1997		showFuncCond = function() { return false };
1998	}
1999
2000	if ($menusmart.length > 0) {
2001		$menusmart.smartmenus({
2002			subIndicators: false,
2003			subIndicatorsPos: 'append',
2004			//subMenusMinWidth: '13em',
2005			subIndicatorsText: '',
2006			showTimeout: showTimeout,
2007			hideTimeout: hideTimeout,
2008			scrollStep: 8,
2009			showFunction: function($ul, complete) {
2010				clearRequestTimeout(showTimeoutFunc);
2011				$ul.fadeIn(0, 'linear', function(){
2012					complete();
2013					if ( $ul.hasClass('vc_row') ) {
2014						$ul.css({
2015							'display': 'table'
2016						});
2017					}
2018					if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) {
2019						$('body').addClass('open-megamenu');
2020					}
2021					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
2022						$('body').addClass('navbar-hover');
2023					}
2024				}).addClass('open-animated');
2025			},
2026			hideFunction: function($ul, complete) {
2027				if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) {
2028					$('body').removeClass('open-megamenu');
2029				}
2030				var fixIE = $('html.ie').length;
2031				if (fixIE) {
2032					var $rowParent = $($ul).closest('.main-menu-container');
2033					$rowParent.height('auto');
2034				}
2035				$ul.fadeOut(0, 'linear', function(){
2036					complete();
2037					$ul.removeClass('open-animated');
2038					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
2039						$('body').removeClass('open-submenu');
2040					}
2041				});
2042			},
2043			collapsibleShowFunction: function($ul, complete) {
2044				$ul.slideDown(400, 'easeInOutCirc', complete);
2045			},
2046			collapsibleHideFunction: function($ul, complete) {
2047				$ul.slideUp(200, 'easeInOutCirc', complete);
2048			},
2049			hideOnClick: SiteParameters.menuHideOnClick,
2050		});
2051
2052		if ( $('body').hasClass('menu-accordion-active') ) {
2053			$menusmart.each(function(key, menu){
2054				$(menu).addClass('menu-smart-init');
2055				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2056			});
2057		}
2058		
2059		$(document).on( 'uncode.smartmenu-appended', function(){
2060			requestTimeout(function(){
2061				$menusmart.smartmenus( 'refresh' );
2062			}, 1000);
2063		});
2064	}
2065
2066	$('.main-menu-container').each(function(){
2067		var $main_cont = $(this),
2068			$uls = $('ul', $main_cont);
2069
2070		$uls.each(function(){
2071			var $ul = $(this),
2072				mobile_hidden = true,
2073				tablet_hidden = true;
2074			$('> li:not(.hidden)', $ul).each(function(){
2075				if ( !$(this).hasClass('mobile-hidden') ) {
2076					mobile_hidden = false;
2077					return false;
2078				}
2079			});
2080			$('> li:not(.hidden)', $ul).each(function(){
2081				if ( !$(this).hasClass('tablet-hidden') ) {
2082					tablet_hidden = false;
2083					return false;
2084				}
2085			});
2086			if ( mobile_hidden ) {
2087				$ul.addClass('mobile-hidden');
2088			}
2089			if ( tablet_hidden ) {
2090				$ul.addClass('tablet-hidden');
2091			}
2092		});
2093
2094		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2095
2096		$divUlsMB.each(function(){
2097			var $divUlMB = $(this),
2098				div_mobile_hidden = true,
2099				div_tablet_hidden = true;
2100
2101			$('> ul:not(.hidden)', $divUlMB).each(function(){
2102				if ( !$(this).hasClass('mobile-hidden') ) {
2103					div_mobile_hidden = false;
2104					return false;
2105				}
2106			});
2107			$('> ul:not(.hidden)', $divUlMB).each(function(){
2108				if ( !$(this).hasClass('tablet-hidden') ) {
2109					div_tablet_hidden = false;
2110					return false;
2111				}
2112			});
2113			if ( div_mobile_hidden ) {
2114				$divUlMB.addClass('mobile-hidden');
2115			}
2116			if ( div_tablet_hidden ) {
2117				$divUlMB.addClass('tablet-hidden');
2118			}
2119		});
2120	});
2121
2122	var overlaySearchButton = function(){
2123		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2124
2125		$search_wrap.each(function(){
2126			var $form = $('form', this),
2127				$icon = $('i', $form);
2128
2129			$icon.on('click', function(){
2130				$form.submit();
2131			});
2132		});
2133	};
2134	overlaySearchButton();
2135}
2136
2137UNCODE.okvideo = function(ev) {
2138	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2139	$.okvideo = function(options) {
2140		// if the option var was just a string, turn it into an object
2141		if (typeof options !== 'object') options = {
2142			'video': options
2143		};
2144		var base = this;
2145		// kick things off
2146		base.init = function() {
2147			base.options = $.extend({}, $.okvideo.options, options);
2148			// support older versions of okvideo
2149			if (base.options.video === null) base.options.video = base.options.source;
2150			base.setOptions();
2151			var target = base.options.target || $('body');
2152			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2153			var zIndex = base.options.controls === 3 ? -999 : "auto";
2154			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2155				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>';
2156				if (OKEvents.utils.isMobile()) {
2157					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>');
2158				} else {
2159					if (base.options.controls === 3) {
2160						target.append(mask)
2161					}
2162					if (base.options.adproof === 1) {
2163						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>');
2164					} else {
2165						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>');
2166					}
2167				}
2168				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2169				if (base.options.playlist.list === null) {
2170					if (base.options.video.provider === 'youtube') {
2171						base.loadYouTubeAPI();
2172					} else if (base.options.video.provider === 'vimeo') {
2173						base.options.volume /= 100;
2174						base.loadVimeoAPI();
2175					}
2176				} else {
2177					base.loadYouTubeAPI();
2178				}
2179			}
2180		};
2181		// clean the options
2182		base.setOptions = function() {
2183			// exchange 'true' for '1' and 'false' for 3
2184			for (var key in this.options) {
2185				if (this.options[key] === true) this.options[key] = 1;
2186				if (this.options[key] === false) this.options[key] = 3;
2187			}
2188			if (base.options.playlist.list === null) {
2189				base.options.video = base.determineProvider();
2190			}
2191			// pass options to the window
2192			$(window).data('okoptions-' + base.options.id, base.options);
2193		};
2194		// insert js into the head and exectue a callback function
2195		base.insertJS = function(src, callback, provider){
2196			var tag;
2197			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2198				delete UNCODE.insertedSripts[src];
2199				var tags = document.getElementsByTagName('script');
2200				for (var i = tags.length; i >= 0; i--){
2201					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2202						tags[i].parentNode.removeChild(tags[i]);
2203					}
2204				}
2205			} else {
2206				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2207					tag = UNCODE.insertedSripts[src];
2208					if (callback){
2209						if (tag.readyState){  //IE
2210							tag.onreadystatechange = function(){
2211								if (tag.readyState === "loaded" ||
2212									tag.readyState === "complete"){
2213									tag.onreadystatechange = null;
2214									callback();
2215								}
2216							};
2217						} else {
2218							$(tag).on('load', callback);
2219						}
2220					}
2221					return;
2222				}
2223			}
2224			tag = document.createElement('script');
2225			if (callback){
2226				if (tag.readyState){  //IE
2227					tag.onreadystatechange = function(){
2228						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2229							tag.onreadystatechange = null;
2230							callback();
2231						}
2232					};
2233				} else {
2234					tag.onload = function() {
2235						callback();
2236					};
2237				}
2238			}
2239			tag.src = src;
2240			var firstScriptTag = document.getElementsByTagName('script')[0];
2241			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2242			if ( ! UNCODE.insertedSripts ) {
2243				UNCODE.insertedSripts = [];
2244			}
2245			UNCODE.insertedSripts[src] = tag;
2246		};
2247		// load the youtube api
2248		base.loadYouTubeAPI = function(callback) {
2249			if ( ev === 'uncode-more-items-loaded' ) {
2250				onYouTubeIframeAPIReady();
2251			} else {
2252				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2253			}
2254		};
2255		base.loadYouTubePlaylist = function() {
2256			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2257		};
2258		// load the vimeo api by replacing the div with an iframe and loading js
2259		base.loadVimeoAPI = function() {
2260			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',
2261			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2262			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2263			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2264			base.insertJS('//player.vimeo.com/api/player.js', function() {
2265				vimeoPlayerReady(base.options.id);
2266			}, 'vimeo');
2267		};
2268		// is it from youtube or vimeo?
2269		base.determineProvider = function() {
2270			var a = document.createElement('a');
2271			a.href = base.options.video;
2272			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2273				var videoid = a.href.split('/')[3].toString();
2274				var query = videoid.substring(videoid.indexOf('?') + 1);
2275				if (query != '') {
2276					var vars = query.split('&');
2277					for (var i = 0; i < vars.length; i++) {
2278						var pair = vars[i].split('=');
2279						if (pair[0] == 'v') {
2280							videoid = pair[1];
2281						}
2282					}
2283				}
2284				return {
2285					"provider": "youtube",
2286					"id": videoid
2287				};
2288			} else if (/vimeo.com/.test(base.options.video)) {
2289				return {
2290					"provider": "vimeo",
2291					"id": (a.href.split('/')[3].toString()).split('#')[0],
2292				};
2293			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2294				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2295				if (id.length == 11) {
2296					return {
2297						"provider": "youtube",
2298						"id": id.toString()
2299					};
2300				} else {
2301					for (var i = 0; i < base.options.video.length; i++) {
2302						if (typeof parseInt(base.options.video[i]) !== "number") {
2303							throw 'not vimeo but thought it was for a sec';
2304						}
2305					}
2306					return {
2307						"provider": "vimeo",
2308						"id": base.options.video
2309					};
2310				}
2311			} else {
2312				throw "OKVideo: Invalid video source";
2313			}
2314		};
2315		base.init();
2316	};
2317
2318	var checkResize,
2319		newW = UNCODE.wwidth;
2320
2321	$.okvideo.options = {
2322		id: null,
2323		source: null, // Deprecate dis l8r
2324		video: null,
2325		playlist: { // eat ur heart out @brokyo
2326			list: null,
2327			index: 0,
2328			startSeconds: 0,
2329			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2330		},
2331		disableKeyControl: 1,
2332		captions: 0,
2333		loop: 1,
2334		hd: 1,
2335		volume: 0,
2336		adproof: false,
2337		unstarted: null,
2338		onFinished: null,
2339		onReady: null,
2340		onPlay: null,
2341		onPause: null,
2342		buffering: null,
2343		controls: false,
2344		autoplay: true,
2345		annotations: true,
2346		cued: null
2347	};
2348	$.fn.okvideo = function(options) {
2349		options.target = this;
2350		return this.each(function() {
2351			(new $.okvideo(options));
2352		});
2353	};
2354
2355	var checkForVideos = function(){
2356		$(".uncode-video-container.video").each(function(index, el) {
2357			var $this = $(this),
2358				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2359				url = $this.attr('data-video'),
2360				id = $this.attr('data-id'),
2361				cloned = $this.closest('.owl-item');
2362
2363			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2364				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2365					$this.okvideo({
2366						id: id,
2367						source: url.split('#')[0],
2368						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2369						autoplay: 1,
2370						controls: 0,
2371						volume: 0,
2372						adproof: 0,
2373						caller: $this,
2374						hd: 1,
2375						onReady: function(player) {
2376							var getPlayer = player.c || player.h || player,
2377							$iframe,
2378							getContainer = $(getPlayer).closest('.background-element');
2379							if (getContainer.length) {
2380								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2381							}
2382
2383							if ( $this.hasClass('drop-move') ) {
2384
2385								var $iframe = $(getPlayer),
2386									w = parseFloat($iframe.attr('width')),
2387									h = parseFloat($iframe.attr('height')),
2388									ratio = h / w,
2389									setResizeiFto,
2390								resizeiFrame = function(){
2391									var dataW = $this.attr('data-w'),
2392										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2393										newH = newW * ratio;
2394									$iframe.css({
2395										width: newW,
2396										height: newH
2397									});
2398								};
2399								resizeiFrame();
2400								$(window).on( 'load', resizeiFrame );
2401								$(window).on( 'resize', function(){
2402									clearRequestTimeout(setResizeiFto);
2403									setResizeiFto = requestTimeout( function() {
2404										resizeiFrame();
2405									}, 10 );
2406								});
2407
2408							}
2409
2410						}
2411					});
2412				}
2413			}
2414		});
2415	};
2416
2417	checkForVideos();
2418
2419	$(window).on('load', function(){
2420		$('.mejs-fullscreen-button button').on('click', function(){
2421			var $button = $(this),
2422				$stuck = $button.closest('.is_stucked');
2423
2424			if ( $stuck.length ) {
2425				$stuck = $(this).trigger("sticky_kit:detach");
2426				window.scrollTo(0, 0);
2427			}
2428		});
2429	});
2430
2431	var checkVideoResize = function(){
2432		clearRequestTimeout(checkResize);
2433		checkResize = requestTimeout(function(){
2434			if ( newW !== UNCODE.wwidth ) {
2435				newW = UNCODE.wwidth;
2436				checkForVideos();
2437			}
2438		}, 1000);
2439	};
2440
2441	$(window).off('resize', checkVideoResize)
2442	.on( 'resize', checkVideoResize);
2443
2444};
2445
2446$(document).on('uncode-ajax-filtered.videos', function(){
2447	UNCODE.okvideo("uncode-more-items-loaded");
2448});
2449UNCODE.backgroundSelfVideos = function( $ctx ) {
2450
2451	var backgroundSelfVideosInit = function( $ctx ) {
2452		if ( SiteParameters.block_mobile_videos === true ) {
2453			return false;
2454		}
2455		if (typeof MediaElement === "function") {
2456			if ( typeof $ctx === 'undefined' ) {
2457				$ctx = document;
2458			}
2459		
2460			$(".background-video-shortcode", $ctx).each(function(index, el) {
2461				if ( $(this).closest('mediaelementwrapper').length ) {
2462					return true;
2463				}
2464				var $video_el = $(this),
2465					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2466					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2467					video_id = $video_el.attr('id');
2468
2469				if ( SiteParameters.is_frontend_editor ) {
2470					video_id = video_id + '_' + index;
2471					$video_el.attr('id', video_id);
2472				}
2473
2474				var media = new MediaElement(video_id, {
2475					startVolume: 0,
2476					loop: true,
2477					success: function(mediaElement, domObject) {
2478						domObject.volume = 0;
2479						$(mediaElement).data('started', false);
2480						mediaElement.addEventListener('timeupdate', function(e) {
2481							if (!$(e.target).data('started')) {
2482								$(mediaElement).data('started', true);
2483							}
2484						});
2485						mediaElement.addEventListener('loadedmetadata', function(e) {
2486							$('body').removeClass('video-not-supported');
2487							mediaElement.play();
2488						});
2489						if (!UNCODE.isMobile) {
2490							requestTimeout(function() {
2491								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2492							}, 100);
2493						}
2494						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2495							mediaElement.play();
2496						}
2497
2498						if ( $parent_drop_move.length ) {
2499							var setResizeMEto,
2500								resizeMediaElement = function(){
2501								var dataW = $parent_drop_move.attr('data-w'),
2502									videoW = domObject.width,
2503									videoH = domObject.height,
2504									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2505									newH = newW / ( videoW / videoH );
2506
2507								$(domObject).css({
2508									'height': newH,
2509									'width': newW
2510								});
2511							};
2512							$(window).on( 'resize load', function(){
2513								clearRequestTimeout(setResizeMEto);
2514								setResizeMEto = requestTimeout( function() {
2515									resizeMediaElement();
2516								}, 10 );
2517							});
2518						}
2519
2520						mediaElement.addEventListener('play', function() {
2521							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2522							$(mediaElement).closest('#page-header').addClass('video-started');
2523							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2524						}, true);
2525
2526					},
2527					// fires when a problem is detected
2528					error: function() {}
2529				});
2530			});
2531		} else {
2532
2533			if ( typeof $ctx === 'undefined' ) {
2534				$ctx = document;
2535			}
2536		
2537			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2538			Array.from(videos).forEach(function(video_el) {
2539				video_el.addEventListener('loadedmetadata', function(e) {
2540					$('body').removeClass('video-not-supported');
2541					video_el.play();
2542				});
2543				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2544					video_el.muted = true;
2545					video_el.loop = true;
2546					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2547					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2548					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2549					$('body').removeClass('video-not-supported');
2550					video_el.play();
2551				} else {
2552					requestTimeout(function(){
2553                         backgroundSelfVideosInit( $ctx );
2554					}, 1000);
2555				}
2556			});
2557		}
2558	};
2559
2560	backgroundSelfVideosInit( $ctx );
2561
2562	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2563		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2564			var $el = model.view.$el,
2565				shortcode = model.attributes.shortcode;
2566
2567			if (typeof MediaElement === "function") {
2568				backgroundSelfVideosInit( $el );
2569			} else {
2570				backgroundSelfVideosInit( $el[0] );
2571			}
2572		});
2573	}
2574};
2575
2576UNCODE.is_scrolling = false;
2577
2578UNCODE.disableHoverScroll = function() {
2579
2580	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2581		var body = document.body,
2582		timer;
2583
2584		window.addEventListener('scroll', function() {
2585			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2586			clearRequestTimeout(timer);
2587			if ( body.classList && !body.classList.contains('disable-hover') ) {
2588				body.classList.add('disable-hover');
2589				window.dispatchEvent(new CustomEvent('disable-hover'));
2590			}
2591			UNCODE.is_scrolling = true;
2592
2593			timer = requestTimeout(function() {
2594				if ( body.classList ) {
2595					body.classList.remove('disable-hover');
2596					window.dispatchEvent(new CustomEvent('enable-hover'));
2597				}
2598				UNCODE.is_scrolling = false;
2599			}, delay);
2600		}, false);
2601	}
2602};
2603
2604UNCODE.isotopeLayout = function() {
2605	if ($('.isotope-layout').length > 0) {
2606		var isotopeContainersArray = [],
2607			typeGridArray = [],
2608			layoutGridArray = [],
2609			screenLgArray = [],
2610			screenMdArray = [],
2611			screenSmArray = [],
2612			transitionDuration = [],
2613			$filterItems = [],
2614			$filters = $('.isotope-system .isotope-filters'),
2615			$itemSelector = '.tmb-iso',
2616			$items,
2617			itemMargin,
2618			correctionFactor = 0,
2619			firstLoad = true,
2620			isOriginLeft = $('body').hasClass('rtl') ? false : true;
2621		$('[class*="isotope-container"]').each(function(index) {
2622			var _this = $(this);
2623			var isoData = _this.data(),
2624			$data_lg,
2625			$data_md,
2626			$data_sm;
2627			_this.children('.tmb').addClass('tmb-iso');
2628			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
2629			else $data_lg = '1000';
2630			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
2631			else $data_md = '600';
2632			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
2633			else $data_sm = '480';
2634			screenLgArray.push($data_lg);
2635			screenMdArray.push($data_md);
2636			screenSmArray.push($data_sm);
2637			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
2638			if (isoData.type == 'metro') typeGridArray.push(true);
2639			else typeGridArray.push(false);
2640			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
2641			else layoutGridArray.push('masonry');
2642			isotopeContainersArray.push(_this);
2643			_this.attr('data-iso-index', index);
2644		});
2645		var colWidth = function(index) {
2646				$(isotopeContainersArray[index]).width('');
2647				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
2648					widthAvailable = $(isotopeContainersArray[index]).width(),
2649					columnNum = 12,
2650					columnWidth = 0,
2651					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
2652					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
2653					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
2654					$rowContainer,
2655					paddingRow,
2656					$colContainer,
2657					paddingCol;
2658
2659				if ( consider_menu )
2660					winHeight = winHeight - UNCODE.menuHeight;
2661
2662				if ( data_vp_height === '1' ) {
2663					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
2664					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
2665					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
2666					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
2667					winHeight = winHeight - ( paddingRow + paddingCol );
2668				}
2669
2670				if (isPx) {
2671					columnWidth = Math.ceil(widthAvailable / columnNum);
2672					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
2673				} else {
2674					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
2675				}
2676				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
2677				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
2678				for (var i = 0, len = $items.length; i < len; i++) {
2679					var $item = $($items[i]),
2680						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
2681						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
2682						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
2683
2684
2685					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
2686						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
2687					}
2688
2689					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
2690						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
2691					}
2692
2693					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
2694						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2695							switch (parseInt(multiplier_w[1])) {
2696								case (5):
2697								case (4):
2698								case (3):
2699									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2700									multiplier_w[1] = 6;
2701									break;
2702								case (2):
2703								case (1):
2704									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
2705									multiplier_w[1] = 3;
2706									break;
2707								default:
2708									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2709									multiplier_w[1] = 12;
2710									break;
2711							}
2712
2713							if (multiplier_w[1] == 2.4) { // 5 columns
2714								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2715								multiplier_w[1] = 6;
2716							}
2717						}
2718					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
2719						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2720							switch (parseInt(multiplier_w[1])) {
2721								case (5):
2722								case (4):
2723								case (3):
2724								case (2):
2725								case (1):
2726									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2727									multiplier_w[1] = 6;
2728									break;
2729								default:
2730									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2731									multiplier_w[1] = 12;
2732									break;
2733							}
2734
2735							if (multiplier_w[1] == 2.4) { // 5 columns
2736								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2737								multiplier_w[1] = 6;
2738							}
2739						}
2740					} else if (widthAvailable < screenSmArray[index]) {
2741						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2742							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2743							multiplier_w[1] = 12;
2744							if (typeGridArray[index]) multiplier_h[1] = 12;
2745						}
2746					}
2747					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
2748						height;
2749
2750					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
2751						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
2752						if ( widthAvailable < screenSmArray[index] ) {
2753							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
2754						}
2755					} else {
2756						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
2757					}
2758
2759					if (width >= widthAvailable) {
2760						$item.css({
2761							width: widthAvailable
2762						});
2763						if (typeGridArray[index]) {
2764							$item.children().add($item.find('.backimg')).css({
2765								height: height
2766							});
2767						}
2768					} else {
2769						$item.css({
2770							width: width
2771						});
2772						if (typeGridArray[index]) {
2773							$item.children().add($item.find('.backimg')).css({
2774								height: height
2775							});
2776						}
2777					}
2778				}
2779				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
2780					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
2781				} else {
2782					return columnWidth;
2783				}
2784			},
2785			init_isotope = function() {
2786				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
2787					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
2788						isotopeId = isotopeSystem.attr('id'),
2789						$layoutMode = layoutGridArray[i],
2790						setIsotopeFirstRowTimeOut,
2791					setIsotopeFirstRow = function(items){
2792						var firstRow = true;
2793						$(items).each(function(index, val){
2794							var el = items[index].element,
2795								el_top = items[index].position.y,
2796								$el = $(el);
2797							if ( index > 0 && el_top > 0 && firstRow ) {
2798								firstRow = false;
2799							} else if ( index == 0 && el_top == 0 ) {
2800								firstRow = true;
2801							}
2802							if ( firstRow ) {
2803								$el.removeClass('tmb-isotope-further-row');
2804							} else {
2805								$el.addClass('tmb-isotope-further-row');
2806							}
2807						});
2808					};
2809					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
2810						//resizable: true,
2811						itemSelector: $itemSelector,
2812						layoutMode: $layoutMode,
2813						transitionDuration: transitionDuration[i],
2814						masonry: {
2815							columnWidth: colWidth(i)
2816						},
2817						vertical: {
2818							horizontalAlignment: 0.5,
2819						},
2820						sortBy: 'original-order',
2821						isOriginLeft: isOriginLeft
2822					})
2823					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
2824					.on('layoutComplete', function( event, items ){
2825						if ( typeof items[0] !== 'undefined' ) {
2826							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2827								setIsotopeFirstRow(items);
2828							}
2829						}
2830					})
2831					.on('arrangeComplete', function( event, items ){
2832						if ( typeof items[0] !== 'undefined' ) {
2833							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2834								clearRequestTimeout(setIsotopeFirstRowTimeOut);
2835								setIsotopeFirstRowTimeOut = requestTimeout(function(){
2836									setIsotopeFirstRow(items);
2837								}, 100);
2838							}
2839						}
2840					});
2841					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
2842						$(isotopeContainersArray[i]).infinitescroll({
2843								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
2844								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
2845								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
2846								animate: false,
2847								behavior: 'local',
2848								debug: false,
2849								loading: {
2850									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
2851									speed: 0,
2852									finished: undefined,
2853									msg: $('#' + isotopeId + ' .loadmore-button'),
2854								},
2855								errorCallback: function() {
2856									var isotope_system = $(this).closest('.isotope-system');
2857									$('.loading-button', isotope_system).hide();
2858									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
2859								}
2860							},
2861							// append the new items to isotope on the infinitescroll callback function.
2862							function(newElements, opts) {
2863								var $isotope = $(this),
2864									isotope_system = $isotope.closest('.isotope-system'),
2865									isotopeId = isotope_system.attr('id'),
2866									filters = new Array(),
2867									$loading_button = isotope_system.find('.loading-button'),
2868									$infinite_button = isotope_system.find('.loadmore-button'),
2869									$numPages = $('a', $infinite_button).data('pages'),
2870									$woo_results,
2871									delay = 300;
2872								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
2873								$infinite_button.show();
2874								$loading_button.hide();
2875								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
2876								$('> li', $isotope).remove();
2877								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
2878								$.each($(newElements), function (index, val) {
2879									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
2880										$woo_results = $(val);
2881										delete newElements[index];
2882									} else {
2883										$(val).addClass('tmb-iso');
2884										if ($(val).is("li")) {
2885											filters.push($(val)[0]);
2886										}
2887									}
2888									$(val).addClass('uncode-appended');
2889								});
2890								newElements = newElements.filter(function(x) {
2891									return filters.indexOf(x) < 0
2892								});
2893								$.each($(filters), function(index, val) {
2894									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
2895								});
2896								if ($woo_results && $woo_results.length > 0) {
2897									var old_count = isotope_system.find('.woocommerce-result-count').text();
2898									var new_count = $woo_results.find('.woocommerce-result-count').text();
2899									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
2900									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
2901									function replaceMatch(match, p1, p2) {
2902        								return old_start + '–' + new_end;
2903									}
2904									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
2905									isotope_system.find('.woocommerce-result-count').text(new_count_text);
2906								}
2907								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
2908								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2909									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
2910									if (typeof getLightbox === 'object') {
2911										getLightbox.refresh();
2912									} else {
2913										UNCODE.lightbox();
2914									}
2915								}
2916								if ( typeof twttr !== 'undefined' )
2917									twttr.widgets.load(isotopeContainersArray[i]);
2918
2919								requestTimeout(function() {
2920									Waypoint.refreshAll();
2921									$isotope.trigger('more-items-loaded');
2922									$(window).trigger('more-items-loaded');
2923									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
2924									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
2925										$(document).trigger('uncode-scrolltrigger-refresh');
2926									}
2927								}, 1000);
2928
2929							});
2930						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
2931							var $infinite_isotope = $(isotopeContainersArray[i]),
2932								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
2933							$infinite_isotope.infinitescroll('pause');
2934							$infinite_button.on('click', function(event) {
2935								event.preventDefault();
2936								var $infinite_system = $(event.target).closest('.isotope-system'),
2937								$infinite_isotope = $infinite_system.find('.isotope-container'),
2938								isotopeId = $infinite_system.attr('id');
2939								$(event.currentTarget).html(SiteParameters.loading);
2940								$infinite_isotope.infinitescroll('resume');
2941								$infinite_isotope.infinitescroll('retrieve');
2942								$infinite_isotope.infinitescroll('pause');
2943							});
2944						}
2945					}
2946				}
2947			},
2948			onLayout = function(isotopeObj, startIndex, needsReload) {
2949				var needsReload = needsReload ? true : false;
2950
2951				if (typeof UNCODE.bigText !== 'undefined') {
2952					UNCODE.bigText();
2953				}
2954				isotopeObj.css('opacity', 1);
2955				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
2956
2957				requestTimeout(function() {
2958					if (startIndex > 0) {
2959						reloadIsotope(isotopeObj);
2960						if (SiteParameters.dynamic_srcset_active === '1') {
2961							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2962							UNCODE.adaptive_srcset(isotopeObj);
2963						}
2964						// window.dispatchEvent(UNCODE.boxEvent);
2965					} else if (needsReload) {
2966						reloadIsotope(isotopeObj);
2967					}
2968
2969					UNCODE.adaptive();
2970					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
2971						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2972					}
2973					if (typeof MediaElement === "function") {
2974						$(isotopeObj).find('audio,video').each(function() {
2975							$(this).mediaelementplayer({
2976	 							pauseOtherPlayers: false,
2977							});
2978						});
2979					}
2980					if ($(isotopeObj).find('.nested-carousel').length) {
2981						if (typeof UNCODE.carousel !== 'undefined') {
2982							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
2983						}
2984						requestTimeout(function() {
2985							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2986						}, 200);
2987					} else {
2988						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2989					}
2990					isotopeObj.trigger('isotope-layout-complete');
2991
2992				}, 100);
2993
2994			},
2995			boxAnimation = function(items, startIndex, sequential, container) {
2996				var $allItems = items.length - startIndex,
2997					showed = 0,
2998					index = 0;
2999				if (container.closest('.owl-item').length == 1) return false;
3000				$.each(items, function(index, val) {
3001					var $this = $(val),
3002						elInner = $('> .t-inside', val);
3003					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3004						return;
3005					}
3006					if (val[0]) val = val[0];
3007					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
3008						new Waypoint({
3009							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3010							element: val,
3011							handler: function() {
3012								var element = $('> .t-inside', this.element),
3013									parent = $(this.element),
3014									currentIndex = parent.index();
3015								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
3016									delayAttr = parseInt(element.attr('data-delay'));
3017								if (isNaN(delayAttr)) delayAttr = 100;
3018								delay -= showed;
3019								var objTimeout = requestTimeout(function() {
3020									element.removeClass('zoom-reverse').addClass('start_animation');
3021									showed = parent.index();
3022									if ( container.data('isotope') ) {
3023										container.isotope('layout');
3024									}
3025								}, delay * delayAttr)
3026								parent.data('objTimeout', objTimeout);
3027								if (!UNCODE.isUnmodalOpen) {
3028									this.destroy();
3029								}
3030							},
3031							offset: '100%'
3032						})
3033					} else {
3034						if (elInner.hasClass('force-anim')) {
3035							elInner.addClass('start_animation');
3036						} else {
3037							elInner.css('opacity', 1);
3038						}
3039						container.isotope('layout');
3040					}
3041
3042					index++;
3043				});
3044			},
3045			reloadIsotope = function(isotopeObj) {
3046				var isoIndex = $(isotopeObj).attr('data-iso-index');
3047				var $layoutMode = ($(isotopeObj).data('layout'));
3048				if ($layoutMode === undefined) {
3049					$layoutMode = 'masonry';
3050				}
3051				if (isotopeObj.data('isotope')) {
3052					isotopeObj.isotope({
3053						itemSelector: $itemSelector,
3054						layoutMode: $layoutMode,
3055						transitionDuration: transitionDuration[isoIndex],
3056						masonry: {
3057							columnWidth: colWidth(isoIndex)
3058						},
3059						vertical: {
3060							horizontalAlignment: 0.5,
3061						},
3062						sortBy: 'original-order',
3063						isOriginLeft: isOriginLeft
3064					});
3065				}
3066			}
3067			;
3068		if ($('.isotope-pagination').length > 0) {
3069			$('.isotope-system').on('click', '.pagination a', function(evt) {
3070				evt.preventDefault();
3071
3072				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3073					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3074						container = $(this).closest('.isotope-system'),
3075						pagination_disable_scroll = container.attr('data-pagination-scroll'),
3076						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3077					calc_scroll -= UNCODE.get_scroll_offset();
3078
3079					if ( pagination_disable_scroll === 'disabled' ) {
3080						return;
3081					}
3082
3083					var menu_container = $('.menu-sticky');
3084					var menu = menu_container.find('.menu-container');
3085
3086					if (menu_container.length > 0 && menu.length > 0) {
3087						calc_scroll = calc_scroll - menu.outerHeight();
3088					}
3089
3090					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3091						delta = bodyTop - calc_scroll,
3092						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3093					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3094
3095					if (!UNCODE.isFullPage) {
3096						if (scrollSpeed == 0) {
3097							$('html, body').scrollTop(calc_scroll);
3098						} else {
3099							$('html, body').animate({
3100								scrollTop: calc_scroll
3101							}, {
3102								easing: 'easeInOutQuad',
3103								duration: scrollSpeed,
3104								complete: function () {
3105									UNCODE.scrolling = false;
3106								}
3107							});
3108						}
3109					}
3110				}
3111
3112				loadIsotope($(this), true);
3113			});
3114		}
3115		$filters.on('click', 'a.isotope-nav-link', function(evt) {
3116			if ($(this).hasClass('no-isotope-filter')) {
3117				return;
3118			}
3119			var $filter = $(this),
3120				filterContainer = $filter.closest('.isotope-filters'),
3121				filterValue = $filter.attr('data-filter'),
3122				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
3123				transitionDuration = container.data().isotope.options.transitionDuration,
3124				delay = 300,
3125				filterItems = [];
3126
3127			var filter_items = function(){
3128				if (filterValue !== undefined) {
3129					container.addClass('grid-filtering');
3130					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3131						var parent = $(val).parent(),
3132							objTimeout = parent.data('objTimeout');
3133						if (objTimeout) {
3134							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3135							clearRequestTimeout(objTimeout);
3136						}
3137						if (transitionDuration == 0) {
3138							if ($(val).hasClass('animate_when_almost_visible')) {
3139								$(val).addClass('zoom-reverse').removeClass('start_animation');
3140							} else {
3141								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3142							}
3143						}
3144					});
3145					requestTimeout(function(){
3146						if ( filterValue == '*' ) {
3147							container.removeClass('isotope-filtered');
3148						} else {
3149							container.addClass('isotope-filtered');
3150						}
3151						container.isotope({
3152							filter: function() {
3153								var block = $(this),
3154								filterable = (filterValue == '*') || block.hasClass(filterValue),
3155								lightboxElements = $('[data-lbox^=ilightbox]', block);
3156								if (filterable) {
3157									if (lightboxElements.length) {
3158										lightboxElements.removeClass('lb-disabled');
3159										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3160									}
3161									filterItems.push(block);
3162								} else {
3163									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3164								}
3165								container.trigger('more-items-loaded');
3166								$(window).trigger('more-items-loaded');
3167								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3168								return filterable;
3169							}
3170						});
3171						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3172
3173					}, delay);
3174
3175					/** once filtered - start **/
3176					container.isotope('once', 'arrangeComplete', function() {
3177						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3178							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3179							if (typeof getLightbox === 'object') {
3180								getLightbox.refresh();
3181							} else {
3182								UNCODE.lightbox();
3183							}
3184						}
3185						if (transitionDuration == 0) {
3186							requestTimeout(function() {
3187								boxAnimation(filterItems, 0, false, container);
3188							}, 100);
3189						}
3190						requestTimeout(function() {
3191							Waypoint.refreshAll();
3192							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3193								$(document).trigger('uncode-scrolltrigger-refresh');
3194							}
3195							container.removeClass('grid-filtering');
3196						}, 2000);
3197					});
3198					/** once filtered - end **/
3199				} else {
3200					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3201						$.each(UNCODE.lightboxArray, function(index, val) {
3202							UNCODE.lightboxArray[index].destroy();
3203						});
3204					}
3205					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3206						var parent = $(val).parent(),
3207							objTimeout = parent.data('objTimeout');
3208						if (objTimeout) {
3209							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3210							clearRequestTimeout(objTimeout);
3211						}
3212						if (transitionDuration == 0) {
3213							if ($(val).hasClass('animate_when_almost_visible')) {
3214								$(val).addClass('zoom-reverse').removeClass('start_animation');
3215							} else {
3216								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3217							}
3218						}
3219					});
3220					container.parent().addClass('grid-loading');
3221					loadIsotope($filter);
3222				}
3223			};
3224
3225			if (!$filter.hasClass('active')) {
3226				/** Scroll top with filtering */
3227				if (filterContainer.hasClass('filter-scroll')) {
3228                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3229                    calc_scroll -= UNCODE.get_scroll_offset();
3230
3231					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3232						delta = bodyTop - calc_scroll,
3233						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3234						filterTolerance = false,
3235						filter_timeout;
3236					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3237
3238					if ( !UNCODE.isFullPage ) {
3239						if (scrollSpeed == 0) {
3240							$('html, body').scrollTop(calc_scroll);
3241							UNCODE.scrolling = false;
3242							filter_items();
3243						} else {
3244
3245							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3246								filter_items();
3247								filterTolerance = true;
3248							}
3249
3250							$('html, body').animate({
3251								scrollTop: calc_scroll
3252							},{
3253								easing: 'easeInOutQuad',
3254								duration: scrollSpeed,
3255								complete: function(){
3256									UNCODE.scrolling = false;
3257									if ( !filterTolerance ) {
3258										filter_timeout = setTimeout(function(){
3259											clearTimeout(filter_timeout);
3260											filter_items();
3261										}, 200);
3262									}
3263								}
3264							});
3265						}
3266					}
3267				} else {
3268					filter_items();
3269				}
3270			}
3271			evt.preventDefault();
3272		});
3273
3274		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3275			var params = UNCODE.getURLParams(window.location);
3276			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3277
3278			UNCODE.lastURL = window.location.href;
3279
3280			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
3281				return;
3282			}
3283
3284			if (params.id === undefined) {
3285				$.each($('.isotope-system'), function(index, val) {
3286					loadIsotope($(val));
3287				});
3288			} else {
3289				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3290					loadIsotope($('#' + params.id));
3291				}
3292			}
3293		});
3294
3295		var loadIsotope = function($href, $paginating) {
3296			var is_paginating = false;
3297
3298			if (undefined !== $paginating && $paginating) {
3299				var is_paginating = $paginating;
3300			}
3301
3302			var href = ($href.is("a") ? $href.attr('href') : location),
3303				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3304				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3305				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3306				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3307				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3308				isotopeId = isotopeSystem.attr('id');
3309			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3310				UNCODE.lastURL = href;
3311				history.pushState({
3312					myIsotope: true
3313				}, document.title, href);
3314			}
3315			if (is_paginating) {
3316				isotopeWrapper.addClass('grid-filtering');
3317			}
3318			$.ajax({
3319				url: href
3320			}).done(function(data) {
3321				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3322					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3323					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3324				isotopeWrapper.addClass('isotope-reloaded');
3325				requestTimeout(function() {
3326					isotopeWrapper.removeClass('grid-loading');
3327					isotopeWrapper.removeClass('isotope-reloaded');
3328					isotopeWrapper.removeClass('grid-filtering');
3329				}, 500);
3330				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3331					var parent = $(val).parent(),
3332						objTimeout = parent.data('objTimeout');
3333					if (objTimeout) {
3334						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3335						clearRequestTimeout(objTimeout);
3336					}
3337					if ($(val).hasClass('animate_when_almost_visible')) {
3338						$(val).addClass('zoom-reverse').removeClass('start_animation');
3339					} else {
3340						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3341					}
3342				});
3343				requestTimeout(function() {
3344					if (isotopeContainer.data('isotope')) {
3345						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3346						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3347						UNCODE.adaptive();
3348						if (SiteParameters.dynamic_srcset_active === '1') {
3349							UNCODE.adaptive_srcset(isotopeContainer);
3350						}
3351						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3352							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3353							if (typeof getLightbox === 'object') {
3354								getLightbox.refresh();
3355							} else {
3356								UNCODE.lightbox();
3357							}
3358						}
3359					}
3360					isotopeContainer.trigger('more-items-loaded');
3361					$(window).trigger('more-items-loaded');
3362					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3363				}, 300);
3364				$('.pagination', isotopeFooter).remove();
3365				isotopeFooter.append($resultPagination);
3366
3367				if (isotopeResultCount.length > 0) {
3368					$('.woocommerce-result-count', isotopeResultCount).remove();
3369					isotopeResultCount.append($resultCount);
3370				}
3371			});
3372		};
3373		$filters.each(function(i, buttonGroup) {
3374			var $buttonGroup = $(buttonGroup);
3375			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3376				$buttonGroup.find('.active').removeClass('active');
3377				$(this).addClass('active');
3378
3379			});
3380
3381			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3382				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3383				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3384			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3385				e.preventDefault();
3386				$cats_filters.slideToggle(400, 'easeInOutCirc');
3387			});
3388
3389		});
3390		window.addEventListener('boxResized', function(e) {
3391			if (UNCODE.printDialogOpen !== false) {
3392				return false;
3393			}
3394			$.each($('.isotope-layout'), function(index, val) {
3395				var $layoutMode = ($(this).data('layout'));
3396				if ($layoutMode === undefined) $layoutMode = 'masonry';
3397				if ($(this).data('isotope')) {
3398					$(this).isotope({
3399						itemSelector: $itemSelector,
3400						layoutMode: $layoutMode,
3401						transitionDuration: transitionDuration[index],
3402						masonry: {
3403							columnWidth: colWidth(index)
3404						},
3405						vertical: {
3406							horizontalAlignment: 0.5,
3407						},
3408						sortBy: 'original-order',
3409						isOriginLeft: isOriginLeft
3410					});
3411					$(this).isotope('unbindResize');
3412					if (SiteParameters.dynamic_srcset_active === '1') {
3413						UNCODE.refresh_dynamic_srcset_size($(this));
3414					}
3415				}
3416				$(this).find('.mejs-video,.mejs-audio').each(function() {
3417					$(this).trigger('resize');
3418				});
3419			});
3420		}, false);
3421
3422		init_isotope();
3423	};
3424}
3425
3426UNCODE.lightbox = function() {
3427	if ( SiteParameters.lbox_enhanced ) {
3428		return true;
3429	}
3430	UNCODE.lightboxArray = {};
3431	requestTimeout(function() {
3432		var groupsArr = {};
3433		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3434			var group = this.getAttribute("data-lbox"),
3435				values = $(this).data();
3436			$(this).attr('data-lbox-init','true')
3437			groupsArr[group] = values;
3438		});
3439		for (var i in groupsArr) {
3440			var skin = groupsArr[i].skin || 'black',
3441				path = groupsArr[i].dir || 'horizontal',
3442				thumbs = !groupsArr[i].notmb || false,
3443				arrows = !groupsArr[i].noarr || false,
3444				social = groupsArr[i].social || false,
3445				deeplink = groupsArr[i].deep || false,
3446				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3447				counter = $els.length,
3448				dataAlbum = $els.attr('data-album');
3449			if (social) social = {
3450				facebook: true,
3451				twitter: true,
3452				reddit: true,
3453				digg: true
3454			};
3455			UNCODE.lightboxArray[i] = $els.iLightBox({
3456				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3457				skin: skin,
3458				path: path,
3459				linkId: deeplink,
3460				infinite: false,
3461				//fullViewPort: 'fit',
3462				smartRecognition: false,
3463				fullAlone: true,
3464				maxScale: 1,
3465				minScale: .02,
3466				//fullStretchTypes: 'flash, video',
3467				overlay: {
3468					opacity: .94
3469				},
3470				controls: {
3471					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3472					fullscreen: true,
3473					thumbnail: thumbs,
3474					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3475				},
3476				show: {
3477					speed: 200
3478				},
3479				hide: {
3480					speed: 200
3481				},
3482				social: {
3483					start: false,
3484					buttons: social
3485				},
3486				caption: {
3487					start: false
3488				},
3489				styles: {
3490					nextOpacity: 1,
3491					nextScale: 1,
3492					prevOpacity: 1,
3493					prevScale: 1
3494				},
3495				effects: {
3496					switchSpeed: 400
3497				},
3498				slideshow: {
3499					pauseTime: 5000
3500				},
3501				thumbnails: {
3502					maxWidth: 60,
3503					maxHeight: 60,
3504					activeOpacity: .2
3505				},
3506				html5video: {
3507					preload: true
3508				},
3509				callback: {
3510					onOpen: function(){
3511						$(window).trigger('uncode-custom-cursor');
3512						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3513							iNoBounce.enable();
3514						}
3515					},
3516					onHide: function(){
3517						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3518							iNoBounce.disable()
3519						}
3520					},
3521				}
3522			});
3523
3524			$(document).on('infinite-loaded', function(){
3525				UNCODE.lightboxArray[i].refresh();
3526			});
3527
3528			$(window).on('gdprOpen', function(){
3529				UNCODE.lightboxArray[i].close();
3530			});
3531		};
3532	}, 100);
3533
3534	$(document).on('click', '.lb-disabled', function(e){
3535		e.preventDefault();
3536	});
3537};
3538
3539UNCODE.lightgallery = function( $el ) {
3540	var createSelectors = function(){
3541		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
3542			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3543				$(this).addClass('lbox-trigger-item');
3544			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3545				$(this).addClass('lbox-nested-item');
3546			} else {
3547				$(this).removeClass('lbox-trigger-item');
3548				$(this).removeClass('lbox-nested-item');
3549			}
3550		});
3551	};
3552
3553	createSelectors();
3554
3555	var galleries = [],
3556		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3557			return !$(this).closest('.nested-carousel').length;
3558		}),
3559		$_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 *'), 
3560		$galleries = $_galleries.filter(function( index ) {
3561			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3562		}),
3563		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3564
3565	if ( typeof $el === 'undefined' ) {
3566		$el = $galleries.add( $nested );
3567	}
3568
3569	var $disabled = $('a.lb-disabled');
3570	$disabled.on('click', function(e){
3571		e.preventDefault();
3572	});
3573
3574	var beforeSlide = function(event) {
3575		var detail = event.detail,
3576			info = detail.info,
3577			item = detail.item,
3578			$slide = $(detail.currentSlide.selector),
3579			$video = $('video', $slide),
3580			$previous = $(detail.previousSlide.selector),
3581			$prevVideo = $('video', $previous),
3582			isAudio = false;
3583
3584		if ( typeof info.src !== 'undefined' ) {
3585			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3586		}
3587
3588		if ( ! $video.length && ( info.video || isAudio ) ) {
3589			if ( info.video ) {
3590				if ( typeof info.video === 'object' ) {
3591					var infoJson = info.video;
3592				} else {
3593					var infoJson = JSON.parse(info.video);
3594				}
3595				var src = infoJson.source[0].src,
3596					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3597					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3598					loop = $(item).attr('data-loop');
3599
3600			} else if ( isAudio ) {
3601				var src = info.src,
3602					autoplay = true,
3603					loop = false;
3604			}
3605			if ( typeof src !== 'undefined' ) {
3606				$slide.addClass('has-html5');
3607				var video = document.createElement('video');
3608				video.src = src;
3609				video.preload = 'auto';
3610				video.controls = 'controls';
3611				video.controlsList = 'nodownload';
3612				if ( autoplay ) {
3613					video.autoplay = 'autoplay';
3614				}
3615				if ( muted ) {
3616					video.muted = 'muted';
3617				}
3618				if ( loop ) {
3619					video.loop = 'loop';
3620				}
3621				$(video).appendTo($slide);
3622			}
3623		} else {
3624			var $video = $('video', $slide);
3625			if ( $video.length ) {
3626				$video[0].currentTime = 0;
3627				if ( $video[0].autoplay ) {
3628					$video[0].play();
3629				}
3630			}
3631		}
3632		if ( $prevVideo.length ) {
3633			$prevVideo[0].currentTime = 0;
3634			$prevVideo[0].pause();
3635		}
3636	};
3637
3638	var beforeOpen = function(event) {
3639		var detail = event.detail,
3640			items = detail.items,
3641			galleryItems = detail.galleryItems,
3642			outer = detail.outer.selector,
3643			i, ii;
3644		for ( i = 0; i < galleryItems.length; i++ ) {
3645			var item = galleryItems[i];
3646			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
3647				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
3648			}
3649		}
3650		for ( ii = 0; ii < items.length; ii++ ) {
3651			var item = items[ii];
3652			if ( $(item).attr('data-icon') === 'video' ) {
3653				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
3654			}
3655		}
3656
3657	};
3658
3659	//caption builder
3660	var captionBuilder = function($el){
3661		$el.each( function( index, val ) {
3662			var $gallery = $(this).attr('data-lbox-init','true'),
3663				$_a = '.lbox-trigger-item',
3664				$_nested_a = '.lbox-nested-item';
3665
3666			$gallery.find($_a).add($_nested_a).each(function(){
3667				var $a = $(this),
3668					$img = $('img', $a).first(),
3669					imgw = $img.attr('data-width'),
3670					imgh = $img.attr('data-height'),
3671					caption = $a.attr('data-caption'),
3672					title = $a.attr('data-title');
3673
3674				if ( $img.length && $img.attr('data-crop') != true ) {
3675					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
3676						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
3677					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
3678						$a.attr('data-external-thumb-image', $img[0].src);
3679					}
3680				}
3681
3682				if ( typeof title !== 'undefined' && title !== '' ) {
3683					title = '<h6>' + title + '</h6>';
3684				} else {
3685					title = '';
3686				}
3687
3688				if ( typeof caption !== 'undefined' && caption !== '' ) {
3689					caption = '<p>' + caption + '</p>';
3690					title += caption;
3691				}
3692
3693				if ( title !== '' ) {
3694					$a.attr( 'title', title );
3695				}
3696
3697				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') ) ) {
3698					$a.attr('data-lg-size', imgw + '-' + imgh);
3699				}
3700			});
3701		});
3702	};
3703	captionBuilder($el);
3704
3705	//regular galleries
3706	$el.each( function( index, val ) {
3707		var $gallery = $(this),
3708			$_a = '.lbox-trigger-item',
3709			$_nested_a = '.lbox-nested-item',
3710			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
3711			galleryID = $_first.attr('data-lbox'),
3712			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
3713			tmb = $_first.attr('data-notmb'),
3714			social = $_first.attr('data-social'),
3715			deep = $_first.attr('data-deep'),
3716			zoom = $_first.attr('data-zoom-origin'),
3717			actual = $_first.attr('data-actual-size'),
3718			download = $_first.attr('data-download'),
3719			controls = $_first.attr('data-arrows') !== 'no',
3720			fullScreen = $_first.attr('data-full'),
3721			counter = $_first.attr('data-counter'),
3722			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
3723			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3724			connect = $_first.attr('data-connect'),
3725			lgPlugins = [lgVideo],
3726			itemsLoadedTimeOut;
3727
3728		if ( typeof galleryID === 'undefined' ) {
3729			galleryID = $gallery.attr('id');
3730		}
3731
3732		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3733		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3734
3735		if ( typeof tmb == 'undefined' || !tmb ) {
3736			lgPlugins.push(lgThumbnail);
3737		}
3738		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
3739			lgPlugins.push(lgZoom);
3740		}
3741		if ( typeof deep != 'undefined' && deep != '' ) {
3742			lgPlugins.push(lgHash);
3743		}
3744		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3745			lgPlugins.push(lgFullscreen);
3746		}
3747		if ( social ) {
3748			lgPlugins.push(lgShare);
3749		}
3750
3751		if ( galleries.indexOf( galleryID ) !== -1 ) {
3752			return true;
3753		}
3754
3755		galleries.push( galleryID );
3756		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
3757			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
3758		var gallery = lightGallery( $triggerGal[0], {
3759			addClass: containerClass,
3760			plugins: lgPlugins,
3761			mode: transition,
3762			selector: $selector,
3763			galleryId: galleryID,
3764			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3765			iframeWidth: '848px',
3766			iframeMaxWidth: '90%',
3767			iframeMaxHeight: '90%',
3768			exThumbImage: 'data-external-thumb-image',
3769			loadYouTubeThumbnail: false,
3770			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ),
3771			// autoplayFirstVideo: false,
3772			pager: false,
3773			startClass: 'lg-start-opacity',
3774			zoomFromOrigin: zoom,
3775			controls: controls,
3776			download: ( typeof download != 'undefined' && download != '' ),
3777			thumbWidth: 50,
3778			thumbHeight: '50px',
3779			counter: $triggerGal.find($selector).length > 1 ? counter : false,
3780			loadYouTubePoster: false,
3781			enableDrag: $triggerGal.find($selector).length > 1,
3782			mobileSettings: {
3783				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3784			},
3785		});
3786
3787		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
3788			e.preventDefault();
3789			var index = $(this).closest('.owl-item.cloned').attr('data-index');
3790			gallery.openGallery(index-1);
3791		});
3792
3793		$gallery.on('uncode-gallery-trigger', function(){
3794			gallery.openGallery(0);
3795		});
3796
3797		$triggerGal.on('more-items-loaded', function(e, items) {
3798			clearRequestTimeout(itemsLoadedTimeOut);
3799			itemsLoadedTimeOut = requestTimeout(function(){
3800				createSelectors();
3801				captionBuilder($triggerGal);
3802				gallery.refresh();
3803			}, 100);
3804		});
3805
3806		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3807			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3808				$el = model.view.$el;
3809				if ( $el.find($triggerGal).length ) {
3810					gallery.destroy();
3811				}
3812			});
3813		}
3814
3815		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
3816		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
3817		$triggerGal[0].addEventListener('lgAfterOpen', function(){
3818			$(window).trigger('uncode-custom-cursor');
3819		});
3820
3821	});
3822
3823	if ( typeof $el !== 'undefined' ) {
3824
3825		//album galleries
3826		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
3827			var album = val,
3828				galleryID = index,
3829				$album = $(album),
3830				params = $album.attr('data-album'),
3831				tmb = $(val).attr('data-notmb'),
3832				social = $(val).attr('data-social'),
3833				deep = $(val).attr('data-deep'),
3834				actual = $(val).attr('data-actual-size'),
3835				download = $(val).attr('data-download'),
3836				controls = $(val).attr('data-arrows') !== 'no',
3837				fullScreen = $(val).attr('data-full'),
3838				counter = $(val).attr('data-counter'),
3839				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
3840				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3841				lgPlugins = [lgVideo];
3842
3843			$(val).attr('data-lbox-init','true');
3844
3845			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3846			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3847
3848			if ( typeof tmb == 'undefined' || !tmb ) {
3849				lgPlugins.push(lgThumbnail);
3850			}
3851			if ( typeof actual != 'undefined' && actual != '' ) {
3852				lgPlugins.push(lgZoom);
3853			}
3854			if ( typeof deep != 'undefined' && deep != '' ) {
3855				lgPlugins.push(lgHash);
3856			}
3857			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3858				lgPlugins.push(lgFullscreen);
3859			}
3860			if ( social ) {
3861				lgPlugins.push(lgShare);
3862			}
3863
3864			var gallery = window.lightGallery(album, {
3865				dynamic: true,
3866				plugins: lgPlugins,
3867				dynamicEl: JSON.parse(params),
3868				galleryId: galleryID,
3869				addClass: containerClass,
3870				mode: transition,
3871				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3872				iframeWidth: '848px',
3873				iframeMaxWidth: '90%',
3874				iframeMaxHeight: '90%',
3875				loadYouTubeThumbnail: false,
3876				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
3877				// autoplayFirstVideo: false,
3878				pager: false,
3879				startClass: 'lg-start-opacity',
3880				zoomFromOrigin: false,
3881				controls: controls,
3882				download: ( typeof download != 'undefined' && download != '' ),
3883				thumbWidth: 50,
3884				thumbHeight: '50px',
3885				loadYouTubePoster: false,
3886				counter: counter,
3887				exThumbImage: 'data-external-thumb-image',
3888				loadYouTubePoster: false,
3889				mobileSettings: {
3890					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3891				},
3892			});
3893
3894			$album.on('click', function(){
3895				gallery.openGallery(0);
3896			});
3897
3898			album.addEventListener('lgBeforeSlide', beforeSlide);
3899			album.addEventListener('lgBeforeOpen', beforeOpen);
3900			album.addEventListener('lgAfterOpen', function(){
3901				$(window).trigger('uncode-custom-cursor');
3902			});
3903
3904			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3905				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3906					$el = model.view.$el;
3907					if ( $el.find($album).length ) {
3908						gallery.destroy();
3909					}
3910				});
3911			}
3912
3913		});
3914
3915		//single images
3916		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
3917			var gallery = lightGallery( $('.page-wrapper')[0], {
3918				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
3919				iframeWidth: '848px',
3920				iframeMaxWidth: '90%',
3921				iframeMaxHeight: '90%',
3922				loadYouTubeThumbnail: false,
3923				// autoplayFirstVideo: false,
3924				startClass: 'lg-start-opacity',
3925				thumbWidth: 50,
3926				thumbHeight: '50px',
3927				download: false,
3928				loadYouTubePoster: false,
3929				counter: false
3930			});
3931
3932			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
3933			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
3934		});
3935	}
3936
3937	var galleryButtons = function(){
3938		var $buttons = $('.btn-gallery-trigger');
3939		$buttons.each(function(key, val){
3940			var $button = $(val),
3941				target = $button.attr('data-target'),
3942				$gallery = $('.un-media-gallery').first(),
3943				$row = $button.closest('.vc_row[data-parent]');
3944			if ( typeof target !== 'undefined' && target !== '' && $('.un-media-gallery#' + target).length  ) {
3945				$gallery = $('.un-media-gallery#' + target);
3946			} else if ( $('.un-media-gallery', $row).length ) {
3947				$gallery = $('.un-media-gallery', $row).first();
3948			}
3949			
3950			$button.on('click', 'a', function(e){
3951				e.preventDefault();
3952				$gallery.find('[data-lbox-init]').first().trigger('uncode-gallery-trigger');
3953			});
3954		});
3955	};
3956	galleryButtons();
3957};
3958
3959UNCODE.carousel = function(container) {
3960	var $owlContainers = $('.owl-carousel-container', container);
3961	$owlContainers.each(function() {
3962		var $owlContainer = $(this),
3963			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
3964			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
3965			values = {},
3966			tempTimeStamp,
3967			newWidth = UNCODE.wwidth,
3968			$owlInsideEqual = [];
3969		$owlSelector.each(function() {
3970			var itemID = $(this).attr('id'),
3971				$elSelector = $(('#' + itemID).toString());
3972			values['id'] = itemID;
3973			values['items'] = 1;
3974			values['columns'] = 3;
3975			values['fade'] = false;
3976			values['nav'] = false;
3977			values['navmobile'] = false;
3978			values['navskin'] = 'light';
3979			values['navspeed'] = 400;
3980			values['dots'] = false;
3981			values['dotsmobile'] = false;
3982			values['loop'] = false;
3983			values['autoplay'] = false;
3984			values['timeout'] = 3000;
3985			values['autoheight'] = false;
3986			values['stagepadding'] = 0;
3987			values['margin'] = 0;
3988			values['lg'] = 1;
3989			values['md'] = 1;
3990			values['sm'] = 1;
3991			$.each($(this).data(), function(i, v) {
3992				values[i] = v;
3993			});
3994
3995			if ($(this).closest('.uncode-slider').length) {
3996				values['navskin'] = '';
3997				values['navmobile'] = false;
3998				//values['dotsmobile'] = true;
3999			} else {
4000				values['navskin'] = ' style-'+values['navskin']+' style-override';
4001			}
4002
4003			var setIndexActive = function(event, init){
4004				var init = typeof init === 'undefined' ? false : init,
4005					thiis = $(event.currentTarget);
4006				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
4007					var scrolltop = $(document).scrollTop(),
4008						size = event.page.size,
4009						i;
4010					var setIndex = requestTimeout(function() {
4011						for ( i = 0; i < size; i++ ) {
4012							var itemCont = event.item.index != null ? (event.item.index + i) : i;
4013							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
4014							if (thiis.closest('.row-slider').length) {
4015								if (currentItem == undefined) {
4016									currentItem = thiis.children()[i];
4017								}
4018								if ($(currentItem).closest('#page-header').length) {
4019									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4020										UNCODE.switchColorsMenu(scrolltop, 'dark');
4021									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4022										UNCODE.switchColorsMenu(scrolltop, 'light');
4023									}
4024								}
4025								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
4026								if (owlCustomNav.length) {
4027									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4028										owlCustomNav.addClass('style-dark').removeClass('style-light');
4029									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4030										owlCustomNav.addClass('style-light').removeClass('style-dark');
4031									}
4032								}
4033							}
4034							var itendIndex = $(currentItem).attr('data-index');
4035							if ( isNaN(itendIndex) ) {
4036								itendIndex = 1;
4037							}
4038							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
4039							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
4040							if ($.fn.counterUp) {
4041								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
4042									var $counter = $(this);
4043									$counter.addClass('started').counterUp({
4044										delay: 10,
4045										time: 1500
4046									});
4047								});
4048							}
4049						}
4050						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
4051					}, 200);
4052				}
4053				tempTimeStamp = event.timeStamp;
4054			}
4055
4056			/** Initialize */
4057			$elSelector.on('initialize.owl.carousel', function(event) {
4058				if (typeof UNCODE.owlNav !== 'undefined') {
4059					UNCODE.owlNav(itemID, event);
4060				}
4061
4062				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4063					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
4064						var shortcode = model.attributes.shortcode,
4065							$el = model.view.$el,
4066							$row_wrap = $el.closest('.row');
4067						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4068							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
4069						}
4070					});
4071					window.parent.vc.events.on('shortcodeView:updated', function(model) {
4072						var shortcode = model.attributes.shortcode;
4073						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4074							tempTimeStamp = Math.floor(Date.now() / 1000);
4075						}
4076					});
4077					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
4078						var shortcode = model.attributes.shortcode;
4079						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4080							UNCODE.owlNav(itemID, event);
4081							$elSelector.trigger('refresh.owl.carousel');
4082						}
4083					});
4084				}
4085			});
4086
4087			/** Initialized */
4088			$elSelector.on('initialized.owl.navigation', function(event) {
4089				$('.owl-dot', event.currentTarget).each(function(key, val){
4090					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4091				});
4092			});
4093
4094			$elSelector.on('initialized.owl.carousel', function(event) {
4095
4096				if ( $('.isotope-container', event.currentTarget).length ) {
4097					window.dispatchEvent(UNCODE.boxEvent);
4098				}
4099
4100				$('.owl-dot.active', $elSelector).on('click', function(){
4101					return false;
4102				});
4103
4104				var thiis = $(event.currentTarget),
4105					// get the time from the data method
4106					time = thiis.data("timer-id"),
4107					rowParent = thiis.closest('.row-parent');
4108
4109				if ( typeof rowParent[0] !== 'undefined' ) {
4110					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4111				}
4112
4113				if (time) {
4114					clearRequestTimeout(time);
4115				}
4116
4117				thiis.addClass('showControls');
4118				var new_time = requestTimeout(function() {
4119					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4120					if (thiis.hasClass('owl-height-viewport'))
4121						setItemsRelHeight(thiis);
4122					if (thiis.hasClass('owl-height-equal'))
4123						setItemsHeight(thiis);
4124					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4125					if (thiis.closest('.unequal, .unexpand').length) {
4126						UNCODE.setRowHeight(rowParent[0], true);
4127					}
4128					if (SiteParameters.dynamic_srcset_active === '1') {
4129						UNCODE.refresh_dynamic_srcset_size(thiis);
4130					}
4131				}, 350);
4132				// save the new time
4133				thiis.data("timer-id", new_time);
4134
4135				var scrolltop = $(document).scrollTop();
4136				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4137
4138				//if (!UNCODE.isMobile) {
4139					/** fix autoplay when visible **/
4140				$(window).on('load', function(){
4141					if (thiis.data('autoplay')) {
4142						if ( !thiis.closest('.sticky-element').length ) {
4143							thiis.trigger('stop.autoplay.owl');
4144						} else {
4145							thiis.trigger('play.owl.autoplay');
4146						}
4147					}
4148					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4149						return;
4150					}
4151					if ( ! thiis.closest('.sticky-element').length ) {
4152						var carouselInView = new Waypoint.Inview({
4153							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4154							element: thiis[0],
4155							exited: function() {
4156								var el = $(this.element);
4157								if (el.data('autoplay') ) {
4158									el.trigger('stop.owl.autoplay');
4159									el.data('stopped','true');
4160								}
4161							},
4162							enter: function(direction) {
4163								var el = $(this.element);
4164								requestTimeout(function() {
4165									if (el.data('autoplay')) {
4166										el.trigger('play.owl.autoplay');
4167										el.data('stopped','false');
4168									}
4169								}, 100);
4170							}
4171						});
4172					}
4173					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4174						setTimeout(function(){
4175							window.lenis.resize();
4176						}, 1000);
4177					}
4178			  	
4179				});
4180				//}
4181
4182				// $(window).on('frontend:carousel_updated', function(){
4183				// 	Waypoint.refreshAll();
4184				// });
4185
4186				if (!thiis.closest('.isotope-system').length) {
4187					requestTimeout(function() {
4188						animate_thumb($('.t-inside', el), event);
4189					}, 400);
4190				} else {
4191					requestTimeout(function() {
4192						thiis.closest('.isotope-container').isotope('layout');
4193					}, 400);
4194				}
4195
4196				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4197				currentIndex = $(currentItem).attr('data-index');
4198
4199				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4200					if ($(val).closest('.uncode-slider').length) {
4201						$(val).removeClass('start_animation');
4202					}
4203				});
4204				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4205					if ($(val).closest('.uncode-slider').length) {
4206						$(val).removeClass('already-animated');
4207					}
4208				});
4209
4210				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4211					if ($(val).closest('.uncode-slider').length) {
4212						$(val).removeAttr('data-animated');
4213					}
4214				});
4215
4216				$.each($('.owl-item.cloned', thiis), function(index, val) {
4217					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4218				});
4219
4220				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4221					if ($(val).attr('data-index') != currentIndex) {
4222						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4223						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4224					}
4225					if ($(val).attr('data-index') != currentIndex) {
4226						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4227					}
4228					if ($(val).attr('data-index') == currentIndex) {
4229						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4230					}
4231				});
4232
4233				if (thiis.closest('.uncode-slider').length) {
4234					var el = thiis.closest('.row-parent')[0],
4235						section = thiis.closest('.vc_section');
4236					if ( section.length ) {
4237						el = $('> .row-parent', section)[0];
4238					}
4239					if ($(el).data('imgready')) {
4240						firstLoaded(el, event);
4241					} else {
4242						el.addEventListener("imgLoaded", function(el) {
4243							firstLoaded(el.target, event);
4244						}, false);
4245					}
4246					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4247					if (transHeight != null) {
4248						requestTimeout(function() {
4249							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4250						}, 100);
4251					}
4252				} else {
4253					var el = thiis;
4254					el.closest('.uncode-slider').addClass('slider-loaded');
4255				}
4256
4257				requestTimeout(function() {
4258					if (typeof UNCODE.bigText !== 'undefined') {
4259						UNCODE.bigText(thiis);
4260					}
4261					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4262						if (thiis.data('autoplay')) pauseOnHover(thiis);
4263					}
4264				}, 500);
4265
4266				if (thiis.closest('.unequal').length) {
4267					$owlInsideEqual.push(thiis.closest('.row-parent'));
4268				}
4269
4270				var containerClasses = '',
4271					containerStyle = '';
4272				if ( $('.owl-dots-classes', $owlContainer).length ) {
4273					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4274					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4275					$('.owl-dots-classes', $owlContainer).remove();
4276				}
4277
4278				if ( containerClasses !== '' ) {
4279					requestTimeout(function() {
4280						if ( containerClasses !== '' )
4281							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4282						if ( containerStyle !== '' )
4283							$('.owl-dots', $owlContainer).addClass(containerClasses);
4284					}, 100);
4285				}
4286
4287				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4288					$(val).closest('.row-inner').css({
4289						'margin-top': '-1px'
4290					});
4291				});
4292
4293				if ($.fn.isotope) {
4294					if ( thiis.closest('.isotope-container').length ) {
4295						if (thiis.closest('.isotope-container').data('isotope')) {
4296							requestTimeout(function(){
4297								thiis.closest('.isotope-container').isotope('layout');
4298							}, 300);
4299						}
4300						$(window).on('load', function(){
4301							if (thiis.closest('.isotope-container').data('isotope')) {
4302								thiis.closest('.isotope-container').isotope('layout');
4303							}
4304						});
4305					}
4306				}
4307
4308				if (thiis.data('autoplay')) {
4309					$(window).on('menuOpen', function(){
4310						thiis.trigger('stop.owl.autoplay');
4311						thiis.data('stopped','true');
4312					}).on('menuClose', function(){
4313
4314					});
4315				}
4316				$(window).on('menuClose', function(){
4317					if (thiis.data('autoplay')) {
4318						thiis.trigger('play.owl.autoplay');
4319						thiis.data('stopped','false');
4320					}
4321				});
4322
4323				setIndexActive(event, true);
4324
4325				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4326						return !$(this).closest('.nested-carousel').length;
4327					}),
4328					$_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),
4329					$galleries = $_galleries.filter(function( index ) {
4330						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4331					});
4332
4333				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4334					UNCODE.lightgallery( $galleries );
4335				}
4336
4337				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4338					$(document).trigger('uncode-scrolltrigger-refresh');
4339				}
4340			});
4341
4342			$elSelector.on('resized.owl.carousel', function(event) {
4343				$('.owl-dot', event.currentTarget).each(function(key, val){
4344					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4345				});
4346			});
4347
4348			$elSelector.on('resized.owl.carousel', function(event) {
4349				var thiis = $(event.currentTarget);
4350				// if ($(this).closest('.nested-carousel').length) {
4351				// 	requestTimeout(function() {
4352				// 		window.dispatchEvent(UNCODE.boxEvent);
4353				// 	}, 200);
4354				// }
4355				if ( thiis.hasClass('owl-height-equal') )
4356					setItemsHeight(thiis);
4357
4358				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4359					newWidth = UNCODE.wwidth;
4360					setItemsRelHeight($elSelector);
4361				}
4362
4363				setIndexActive(event);
4364
4365				if (SiteParameters.dynamic_srcset_active === '1') {
4366					UNCODE.refresh_dynamic_srcset_size(thiis);
4367				}
4368
4369				if ($.fn.isotope) {
4370					$(window).on('load', function(){
4371						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4372							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4373						}
4374					});
4375				}
4376
4377				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4378					setTimeout(function(){
4379						window.lenis.resize();
4380					}, 1000);
4381				}
4382				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4383					$(document).trigger('uncode-scrolltrigger-refresh');
4384				}
4385			});
4386
4387			$elSelector.on('refreshed.owl.carousel', function(event) {
4388				setIndexActive(event);
4389			});
4390
4391			/** detect resize window for fluid height layout */
4392			var setFluidResize;
4393			function manageFluidCarouseHeight() {
4394				clearRequestTimeout(setFluidResize);
4395				setFluidResize = requestTimeout(function(){
4396					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4397						newWidth = UNCODE.wwidth;
4398						setItemsRelHeight($elSelector);
4399					}
4400				}, 100);
4401			}
4402			window.addEventListener('resize', manageFluidCarouseHeight);
4403
4404			/** Change */
4405			$elSelector.on('change.owl.carousel', function(event) {
4406				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4407			});
4408
4409			/** Changed */
4410			$elSelector.on('changed.owl.carousel', function(event) {
4411				var $row = $elSelector.parents('.row')[0];
4412				if ( typeof $row !== 'undefined' ) {
4413					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4414				}
4415				setIndexActive(event);
4416			});
4417
4418			var checkDrag = function(e) {
4419				$elSelector.addClass('owl-dragging');
4420			};
4421			$elSelector.on('drag.owl.carousel', function(event) {
4422				document.addEventListener("mousemove", checkDrag);
4423			});
4424
4425			$elSelector.on('dragged.owl.carousel', function(event) {
4426				$elSelector.removeClass('owl-dragging');
4427				document.removeEventListener("mousemove", checkDrag);
4428			});
4429
4430			$elSelector.on('translate.owl.carousel', function(event) {
4431				if (UNCODE.isMobile) {
4432					$(event.currentTarget).addClass('owl-translating');
4433				}
4434			});
4435
4436			/** Translated */
4437			$elSelector.on('translated.owl.carousel', function(event) {
4438
4439				var thiis = $(event.currentTarget),
4440					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4441					currentIndex = $(currentItem).attr('data-index'),
4442					stagePadding = thiis.data('stagepadding');
4443
4444				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4445
4446				if (!UNCODE.isMobile) {
4447					UNCODE.owlPlayVideo(thiis);
4448				}
4449
4450				requestTimeout(function(){
4451					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4452					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4453					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4454						if (lastDelayElems == undefined) lastDelayElems = 0;
4455						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4456						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4457						thiis.trigger('stop.owl.autoplay');
4458						requestTimeout(function() {
4459							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4460						}, maxDelay);
4461					}
4462				}, 200);
4463
4464				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4465					if ($(val).closest('.uncode-slider').length) {
4466						$(val).removeClass('start_animation');
4467					}
4468				});
4469
4470				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4471					if ($(val).closest('.uncode-slider').length) {
4472						$(val).removeClass('already-animated');
4473					}
4474				});
4475
4476				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4477					if ($(val).closest('.uncode-slider').length) {
4478						$(val).removeAttr('data-animated');
4479					}
4480				});
4481
4482				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4483					if ($(val).attr('data-index') != currentIndex) {
4484						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4485						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4486					}
4487					if ($(val).attr('data-index') != currentIndex) {
4488						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4489					}
4490					if ($(val).attr('data-index') == currentIndex) {
4491						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4492					}
4493				});
4494
4495				if (UNCODE.isMobile) {
4496					thiis.removeClass('owl-translating');
4497				}
4498
4499				setIndexActive(event);
4500			});
4501
4502			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4503
4504			/** Init carousel */
4505			$elSelector.not('.showControls').owlCarousel({
4506				items: values['items'],
4507				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4508				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4509				nav: values['nav'],
4510				dots: values['dots'],
4511				loop: values['loop'],
4512				stagePadding: values['stagepadding'],
4513				margin: 0,
4514				video: true,
4515				autoWidth: false,
4516				autoplay: false,
4517				autoplayTimeout: values['timeout'],
4518				autoplaySpeed: values['navspeed'],
4519				autoplayHoverPause: $(this).closest('.uncode-slider').length || $(this).closest('.carousel-no-hover').length ? false : true,
4520				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4521				itemSelector: SiteParameters.uncode_carousel_itemSelector,
4522				rtl: $('body').hasClass('rtl') ? true : false,
4523				fluidSpeed: true,
4524				navSpeed: values['navspeed'],
4525				dotsSpeed: values['navspeed'] / values['items'],
4526				navElement: ['button type="button" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" aria-label="' + SiteParameters.uncode_next_label + '"'],
4527				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4528				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>'],
4529				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4530				responsiveClass: true,
4531				responsiveBaseElement: '.box-container',
4532				responsive: {
4533					0: {
4534						items: values['sm'],
4535						nav: values['navmobile'],
4536						dots: values['dotsmobile'],
4537						dotsSpeed: values['navspeed'] / values['sm'],
4538					},
4539					480: {
4540						items: values['sm'],
4541						nav: values['navmobile'],
4542						dots: values['dotsmobile'],
4543						dotsSpeed: values['navspeed'] / values['sm'],
4544					},
4545					570: {
4546						items: values['md'],
4547						nav: values['navmobile'],
4548						dots: values['dotsmobile'],
4549						dotsSpeed: values['navspeed'] / values['md'],
4550					},
4551					960: {
4552						items: values['lg'],
4553						dotsSpeed: values['navspeed'] / values['lg'],
4554					}
4555				}
4556			});
4557
4558			var transDuration = parseFloat(values['navspeed']) * 0.3;
4559			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
4560
4561			$('.owl-item .tmb', $elSelector).css({
4562				'-webkit-transition-delay': transDuration + 'ms',
4563				'-moz-transition-delay': transDuration + 'ms',
4564				'-o-transition-delay': transDuration + 'ms',
4565				'transition-delay': transDuration + 'ms',
4566				'-webkit-transition-duration': transDuration2 + 'ms',
4567				'-moz-transition-duration': transDuration2 + 'ms',
4568				'-o-transition-duration': transDuration2 + 'ms',
4569				'transition-duration': transDuration2 + 'ms',
4570			});
4571
4572			requestTimeout(function() {
4573				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4574					UNCODE.setRowHeight($owlInsideEqual[i]);
4575				};
4576			}, 300);
4577
4578			$(window).on('load', function(){
4579				var $elCarousel = $elSelector.data('owl.carousel');
4580				if ( typeof $elCarousel !== 'undefined' ) {
4581					$elCarousel.trigger('refreshed');
4582					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4583						UNCODE.setRowHeight($owlInsideEqual[i]);
4584					};
4585				}
4586			});
4587
4588			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
4589				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4590					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
4591					$('#' + carousel_id).find('.owl-item').each( function() {
4592						var $item = $(this),
4593							index = ( $item.index() + 1 );
4594						$item.attr('data-index', index);
4595					});
4596				}
4597			});
4598
4599			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4600				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
4601					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4602						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
4603						$('#' + carousel_id).find('.owl-item').each( function() {
4604							var $item = $(this),
4605								index = ( $item.index() + 1 );
4606							$item.attr('data-index', index);
4607						});
4608					}
4609				});
4610			}
4611
4612		});
4613
4614		function firstLoaded(el, event) {
4615			var el = $(el),
4616			uncode_slider = el.find('.uncode-slider');
4617			el.find('.owl-carousel').css('opacity', 1);
4618			uncode_slider.addClass('slider-loaded');
4619			if (typeof UNCODE.bigText !== 'undefined') {
4620				UNCODE.bigText(el.find('.owl-item.active'));
4621			}
4622			//if (!UNCODE.isMobile) {
4623				requestTimeout(function() {
4624					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
4625					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
4626					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
4627						if (lastDelayElems == undefined) lastDelayElems = 0;
4628						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4629						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4630						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
4631						requestTimeout(function() {
4632							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
4633						}, maxDelay);
4634					}
4635				}, 500);
4636
4637			//}
4638		}
4639
4640		function navHover(el) {
4641			var $owlCont = el,
4642				$owlPrev = $owlCont.find('.owl-prev'),
4643				$owlNext = $owlCont.find('.owl-next'),
4644				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
4645				$owlPagination = $owlCont.next(),
4646				owlPrevW = $owlPrev.outerWidth(),
4647				owlNextW = $owlNext.outerWidth(),
4648				owlDotsH = $owlDots.innerHeight(),
4649				owlTime = 400,
4650				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4651			if ( $('body').hasClass('rtl') ) {
4652				$owlPrev.css("margin-right", -owlPrevW);
4653				$owlNext.css("margin-left", -owlNextW);
4654			} else {
4655				$owlPrev.css("margin-left", -owlPrevW);
4656				$owlNext.css("margin-right", -owlNextW);
4657			}
4658			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
4659			$owlCont.mouseenter(function() {
4660				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4661				$owlPrev.add($owlNext).css({
4662					marginLeft: 0,
4663					marginRight: 0
4664				});
4665				if (!owlNested) {
4666					$owlDots.css({
4667						opacity: 1,
4668						bottom: 0
4669					});
4670				}
4671			}).mouseleave(function() {
4672				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4673				if ( $('body').hasClass('rtl') ) {
4674					$owlPrev.css("margin-right", -owlPrevW);
4675					$owlNext.css("margin-left", -owlNextW);
4676				} else {
4677					$owlPrev.css("margin-left", -owlPrevW);
4678					$owlNext.css("margin-right", -owlNextW);
4679				}
4680				if (!owlNested) {
4681					$owlDots.css({
4682						opacity: 1,
4683						bottom: -owlDotsH
4684					});
4685				}
4686			});
4687		};
4688
4689		function animate_elems($this) {
4690			var lastDelay;
4691			$.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) {
4692				var element = $(val),
4693					delayAttr = element.attr('data-delay'),
4694					$first_item = element.closest('.owl-item[data-index="1"]');
4695
4696				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
4697					return false;
4698				}
4699
4700				if (delayAttr == undefined) delayAttr = 0;
4701				requestTimeout(function() {
4702					element.addClass('start_animation');
4703				}, delayAttr);
4704				lastDelay = delayAttr;
4705			});
4706			return lastDelay;
4707		}
4708
4709		function animate_thumb(items, event) {
4710			var lastDelay,
4711				itemIndex,
4712				thiis = $(event.currentTarget),
4713				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
4714				numActives = $('.owl-item.active', thiis).length,
4715				stagePadding = thiis.data('stagepadding');
4716
4717			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4718
4719			thiis.data('tempIndex', event.item.index);
4720				$.each(items, function(index, val) {
4721					var parent = $(val).closest('.owl-item');
4722					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4723						return;
4724					}
4725					if (!$(val).hasClass('start_animation')) {
4726						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
4727							var thumbInView = new Waypoint.Inview({
4728							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4729							  element: val,
4730							  enter: function(direction) {
4731								var element = $(this.element),
4732										delayAttr = parseInt(element.attr('data-delay')),
4733										itemIndex = element.closest('.owl-item').index() + 1,
4734										diffItem = Math.abs(itemIndex - tempIndex) - 1;
4735									if (itemIndex > tempIndex) {
4736										thiis.data('tempIndex', itemIndex);
4737									}
4738									if (isNaN(delayAttr)) delayAttr = 100;
4739									if (stagePadding) {
4740										var objTimeout = requestTimeout(function() {
4741											element.addClass('start_animation');
4742										}, index * delayAttr);
4743										lastDelay = index * delayAttr;
4744									} else {
4745										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
4746										var objTimeout = requestTimeout(function() {
4747											element.addClass('start_animation');
4748										}, diffItem * delayAttr);
4749										lastDelay = diffItem * delayAttr;
4750									}
4751									parent.data('objTimeout', objTimeout);
4752									if (!UNCODE.isUnmodalOpen) {
4753										this.destroy();
4754									}
4755								}
4756							});
4757						}
4758					}
4759				});
4760				return lastDelay;
4761			}
4762
4763		function setItemsHeight(item) {
4764			$.each($('.owl-item', item), function(index, val) {
4765				var availableThumbHeight = $('.t-inside', $(val)).height(),
4766				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
4767				difference = availableThumbHeight - innerThumbHeight;
4768				if ($('.tmb-content-under', val).length) {
4769					var visualPart = $('.t-entry-visual', val);
4770					if (visualPart.length) {
4771						difference -= $('.t-entry-visual', val).height();
4772					}
4773				}
4774				if (! $('.tmb-content-lateral', val).length)
4775					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
4776			});
4777		}
4778
4779		function setItemsRelHeight(item) {
4780			$.each($('.owl-item', item), function(index, val) {
4781				var $rowContainer = $(item).parents('.row-parent').eq(0),
4782					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
4783					$colContainer = $(item).parents('.uncell').eq(0),
4784					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
4785					winHeight = UNCODE.wheight,
4786					multiplier_h = parseInt($(item).attr('data-vp-height')),
4787					data_viewport_h,
4788					consider_menu = $(item).data('vp-menu');
4789
4790				if ( consider_menu ) {
4791					winHeight = winHeight - UNCODE.menuHeight;
4792				}
4793
4794				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
4795				$('.t-inside', val).css( 'height', data_viewport_h );
4796			});
4797		}
4798
4799		function pauseOnHover(slider) {
4800			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
4801			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
4802				mouseenter: function () {
4803					$(slider).addClass('owl-mouseenter');
4804					$(slider).trigger('stop.owl.autoplay');
4805				},
4806				mouseleave: function () {
4807					$(slider).removeClass('owl-mouseenter');
4808					$(slider).trigger('play.owl.autoplay');
4809				}
4810			});
4811		}
4812	});
4813};
4814
4815UNCODE.owlPlayVideo = function(carousel) {
4816	var player, iframe;
4817	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
4818		var content = $(val).html();
4819		if (content == '') {
4820			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
4821			$(val).append(getCloned);
4822		}
4823		if ($(this).attr('data-provider') == 'vimeo') {
4824			iframe = $(this).find('iframe');
4825			player = new Vimeo.Player(iframe[0]);
4826			player.play();
4827		} else if ($(this).attr('data-provider') == 'youtube') {
4828			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
4829		} else {
4830			var player = $(this).find('video');
4831			if (player.length) {
4832				$(this).find('video')[0].volume = 0;
4833				$(this).find('video')[0].play();
4834				$(val).css('opacity', 1);
4835			}
4836		}
4837	});
4838};
4839
4840UNCODE.owlStopVideo = function(carousel) {
4841	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
4842		var player, iframe;
4843		if ($(this).attr('data-provider') == 'vimeo') {
4844			iframe = $(this).find('iframe');
4845			player = new Vimeo.Player(iframe[0]);
4846			player.pause();
4847		} else if ($(this).attr('data-provider') == 'youtube') {
4848			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
4849		} else {
4850			var player = $(this).find('video');
4851			if (player.length) {
4852				$(this).find('video')[0].volume = 0;
4853				$(this).find('video')[0].play();
4854			}
4855		}
4856	});
4857};
4858
4859UNCODE.animations = function() {
4860
4861	var runWaypoints_TO,
4862		runWaypoints_carousel_TO,
4863		runWaypoints_delay = 0,
4864	highlightComplexFunc = function($wrap, ev){
4865
4866		var $lines = $('.heading-line-wrap', $wrap),
4867			not_animate = false;
4868
4869		if ( $wrap.data('animate') === true ) {
4870			not_animate = true;
4871		}
4872
4873		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
4874		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
4875			return;
4876		}
4877
4878		$lines.each(function(_key, _value){
4879			var $line = $(_value),
4880				$inners = $('.split-word-inner', $line),
4881				$highlights = $('.heading-text-highlight-inner', $line);
4882
4883			var highlitInnerFunc = function(ev){
4884				var delay = 0;
4885				$highlights.each(function(h_key, high){
4886					var $highlight = $(high),
4887						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
4888						$nextSplit = $split.nextUntil(),
4889						$next = $('.heading-text-highlight-inner', $nextSplit),
4890						countCh = $split.text().length;
4891
4892					$highlight.css({
4893						'-webkit-transition-duration': (30 * countCh) + 'ms',
4894						'-moz-transition-duration': (30 * countCh) + 'ms',
4895						'-o-transition-duration': (30 * countCh) + 'ms',
4896						'transition-duration': (30 * countCh) + 'ms',
4897					});
4898
4899					delay += (30 * countCh);
4900
4901					$next.css({
4902						'-webkit-transition-delay': delay + 'ms',
4903						'-moz-transition-delay': delay + 'ms',
4904						'-o-transition-delay': delay + 'ms',
4905						'transition-delay': delay + 'ms',
4906					});
4907				});
4908				$highlights.removeAttr('data-animated');
4909				if ( _key+1 === $lines.length ) {
4910					$wrap.data('animate', true);
4911				}
4912			};
4913
4914			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
4915				if ( not_animate ) {
4916					$highlights.each(function(h_key, high){
4917						var $highlight = $(high);
4918						$highlight.css({
4919							'-webkit-transition-duration': '0ms',
4920							'-moz-transition-duration': '0ms',
4921							'-o-transition-duration': '0ms',
4922							'transition-duration': '0ms',
4923						});
4924					});
4925					$highlights.removeAttr('data-animated');
4926				} else {
4927					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
4928						highlitInnerFunc();
4929					} else {
4930						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
4931					}
4932				}
4933			}
4934		});
4935	};
4936
4937	$.each($('.header-content-inner'), function(index, val) {
4938		var element = $(val),
4939			transition = '';
4940		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
4941		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
4942		if (element.hasClass('left-t-right')) transition = 'left-t-right';
4943		if (element.hasClass('right-t-left')) transition = 'right-t-left';
4944		if (element.hasClass('zoom-in')) transition = 'zoom-in';
4945		if (element.hasClass('zoom-out')) transition = 'zoom-out';
4946		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
4947		if (transition != '') {
4948			$(val).removeClass(transition);
4949			var container = element,
4950				containerDelay = container.attr('data-delay'),
4951				containerSpeed = container.attr('data-speed'),
4952				items = $('.header-title > *, .post-info', container);
4953			$.each(items, function(index, val) {
4954				var element = $(val),
4955					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
4956					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
4957				if (!element.hasClass('animate_when_almost_visible')) {
4958					delayAttr = Number(delayAttr) + (400 * index);
4959					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
4960					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
4961				}
4962			});
4963			container.css('opacity', 1);
4964		}
4965	});
4966
4967	function animate_css_grids_on_load() {
4968		$('.cssgrid-system').each(function() {
4969			var grid = $(this);
4970			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
4971			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
4972		});
4973	}
4974
4975	var delayAdd = 0;
4976
4977	window.waypoint_animation = function(ev) {
4978		$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-linear .animate_when_almost_visible:not(.start_animation), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
4979			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 ) && !SiteParameters.is_frontend_editor ) ) {
4980				return true;
4981			}
4982			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4983				return;
4984			}
4985			var run = true,
4986				$carousel = $(val).closest('.owl-carousel'),
4987				marquee = $(val).closest('.tmb-linear').length;
4988			if ( $carousel.length ) {
4989				run = false;
4990			}
4991			if (run) {
4992				new Waypoint({
4993					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4994					element: val,
4995					handler: function() {
4996						var element = $(this.element),
4997							index = element.index(),
4998							delayAttr = element.attr('data-delay');
4999						if (delayAttr == undefined) delayAttr = 0;
5000						// delayAttr = parseFloat(delayAttr) + delayAdd;
5001						// if ( marquee ) {
5002						// 	delayAdd += 50;
5003						// } else {
5004						// 	delayAdd = 0;
5005						// }
5006						requestTimeout(function() {
5007							element.addClass('start_animation');
5008						}, delayAttr);
5009						if (!UNCODE.isUnmodalOpen) {
5010							this.destroy();
5011						}
5012					},
5013					offset: UNCODE.isFullPage ? '100%' : '90%'
5014				});
5015			}
5016		});
5017		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
5018			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5019				return;
5020			}
5021			var run = true,
5022				$carousel = $(val).closest('.owl-carousel');
5023			if ( $carousel.length ) {
5024				run = false;
5025			}
5026			if (run) {
5027				new Waypoint({
5028					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5029					element: val,
5030					handler: function() {
5031						var $element = $(this.element),
5032							$childs = $('.animate_when_parent_almost_visible', $element);
5033						$childs.each(function(key,el){
5034							var $child = $(el),
5035								delaySpeed = $child.attr('data-speed'),
5036								delayAttr = $child.attr('data-delay'),
5037								intervalAttr = $child.attr('data-interval');
5038							if (delayAttr == undefined) {
5039								delayAttr = 50*key;
5040							}
5041							requestTimeout(function() {
5042								$child.addClass('start_animation');
5043								if ( $child.hasClass('anim-line-checker') ) {
5044									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5045										var $line = $child.closest('.heading-line-wrap');
5046									});
5047								}
5048								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5049								highlightComplexFunc($wrapText, ev);
5050								if ( $child.hasClass('anim-tot-checker') ) {
5051									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5052										if ( $child.hasClass('anim-tot-checker') ) {
5053											$wrapText.addClass('already-animated');
5054											$element.trigger('already-animated');
5055										}
5056									});
5057								}
5058							}, delayAttr );
5059						});
5060						$element.addClass('start_animation');
5061						if (!UNCODE.isUnmodalOpen) {
5062							this.destroy();
5063						}
5064					},
5065					offset: UNCODE.isFullPage ? '100%' : '90%'
5066				});
5067			}
5068		});
5069	}
5070	window.waypoint_carousel_animation = function(ev) {
5071		$.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) {
5072			if ( $(val).hasClass('el-text-split') ) {
5073				return true;
5074			}
5075			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5076				return;
5077			}
5078			var run = true,
5079				$carousel = $(val).closest('.owl-carousel'),
5080				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5081				$all_first = $('.owl-item[data-index="1"]', $carousel);
5082			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5083				run = false;
5084			}
5085			if (run) {
5086				new Waypoint({
5087					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5088					element: val,
5089					handler: function() {
5090						var element = $(this.element),
5091							index = element.index(),
5092							delayAttr = element.attr('data-delay');
5093						if (delayAttr == undefined) delayAttr = 0;
5094						requestTimeout(function() {
5095							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5096								$all_first.attr('data-already-reached', 'true');
5097							}
5098							element.addClass('start_animation');
5099						}, delayAttr);
5100						if (!UNCODE.isUnmodalOpen) {
5101							this.destroy();
5102						}
5103					},
5104					offset: UNCODE.isFullPage ? '100%' : '90%'
5105				});
5106			}
5107		});
5108		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
5109			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5110				return;
5111			}
5112			var run = true,
5113				$carousel = $(val).closest('.owl-carousel'),
5114				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5115				$all_first = $('.owl-item[data-index="1"]', $carousel);
5116			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5117				run = false;
5118			}
5119			if (run) {
5120				new Waypoint({
5121					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5122					element: val,
5123					handler: function() {
5124						var $element = $(this.element),
5125							$childs = $('.animate_when_parent_almost_visible', $element);
5126						$childs.each(function(key,el){
5127							var $child = $(el),
5128								delaySpeed = $child.attr('data-speed'),
5129								delayAttr = $child.attr('data-delay'),
5130								intervalAttr = $child.attr('data-interval');
5131							if (delayAttr == undefined) {
5132								delayAttr = 50*key;
5133							}
5134							requestTimeout(function() {
5135								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5136									$all_first.attr('data-already-reached', 'true');
5137								}
5138								$child.addClass('start_animation');
5139								if ( $child.hasClass('anim-line-checker') ) {
5140									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5141										var $line = $child.closest('.heading-line-wrap');
5142									});
5143								}
5144								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5145								highlightComplexFunc($wrapText, ev);
5146								if ( $child.hasClass('anim-tot-checker') ) {
5147									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5148										if ( $child.hasClass('anim-tot-checker') ) {
5149											$wrapText.addClass('already-animated');
5150										}
5151									});
5152								}
5153							}, delayAttr );
5154						});
5155						$element.addClass('start_animation');
5156						if (!UNCODE.isUnmodalOpen) {
5157							this.destroy();
5158						}
5159					},
5160					offset: UNCODE.isFullPage ? '100%' : '90%'
5161				});
5162			}
5163		});
5164	}
5165
5166	var runWaypoints = function(ev){
5167		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5168			runWaypoints_delay = 400;
5169		}
5170		clearRequestTimeout(runWaypoints_TO);
5171		runWaypoints_TO = requestTimeout(function() {
5172			window.waypoint_animation(ev);
5173		}, runWaypoints_delay);
5174
5175		clearRequestTimeout(runWaypoints_carousel_TO);
5176		runWaypoints_carousel_TO = requestTimeout(function() {
5177			window.waypoint_carousel_animation(ev);
5178		}, 400);
5179	};
5180	runWaypoints();
5181	animate_css_grids_on_load();
5182
5183	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5184		runWaypoints(ev);
5185	});
5186	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5187		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5188		window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints );
5189	}
5190};
5191
5192UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5193	var $allItems = elements.length - startIndex,
5194		showed = 0,
5195		index = 0,
5196		use_index = false
5197		;
5198
5199	if (filtering) {
5200		if (sequential) {
5201			use_index = true;
5202		}
5203		sequential = false;
5204	}
5205
5206	$.each(elements, function(index, val) {
5207		var $this = $(val),
5208			elInner = $('> .t-inside', val);
5209
5210		if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5211			return;
5212		}
5213		if (val[0]) val = val[0];
5214
5215		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5216			new Waypoint({
5217				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5218				element: val,
5219				handler: function() {
5220					var element = $('> .t-inside', this.element),
5221						parent = $(this.element);
5222					var _index = use_index? index : 0;
5223
5224					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5225						delayAttr = parseInt(element.attr('data-delay'));
5226					if (isNaN(delayAttr)) delayAttr = 100;
5227					if (sequential || use_index) {
5228						delay -= showed;
5229					}
5230					var objTimeout = requestTimeout(function() {
5231						element.removeClass('zoom-reverse').addClass('start_animation');
5232						showed = index;
5233					}, delay * delayAttr);
5234					parent.data('objTimeout', objTimeout);
5235					if (!UNCODE.isUnmodalOpen) {
5236						this.destroy();
5237					}
5238				},
5239				offset: UNCODE.isFullPage ? '100%' : '90%'
5240			});
5241		}
5242
5243		index++;
5244	});
5245};
5246
5247UNCODE.tapHover = function() {
5248
5249	var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-v
5249isual-cont > a, .drop-hover-link'), //.length //html.touch a.btn
5250		elClass = "hover";
5251
5252	$(window).on('click', function() {
5253		$el.removeClass(elClass);
5254	});
5255
5256	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
5257		e.stopPropagation();
5258		var link = $(this);
5259		if ( ! link.hasClass(elClass)) {
5260			e.preventDefault();
5261			link.addClass("hover");
5262			$el.not(this).removeClass(elClass);
5263			return false;
5264		}
5265	});
5266};
5267
5268UNCODE.onePage = function(isMobile) {
5269	var current = 0,
5270		last = 0,
5271		lastScrollTop = 0,
5272		forceScroll = false,
5273		lastScrolled = 0,
5274		isSectionscroller = ($('.main-onepage').length) ? true : false,
5275		isOnePage = false,
5276		getOffset = function () {
5277			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);
5278			return calculateOffset;
5279		}
5280
5281	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5282
5283	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5284	// 	return false;
5285
5286	function init_onepage() {
5287		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5288			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5289		}
5290		last = $('.onepage-pagination li').last().find('a').data('index');
5291		$.each($('div[data-parent="true"]'), function(index, val) {
5292			$(this).attr('data-section', index);
5293			if (isMobile) return;
5294			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5295				return;
5296			}
5297			var sectionDown = new Waypoint({
5298				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5299				element: val,
5300				handler: function(direction) {
5301					if (direction == 'down') {
5302						changeMenuActive(this.element, index);
5303					}
5304				},
5305				offset: function() {
5306					return 5 + getOffset()
5307				}
5308			});
5309			var sectionUp = new Waypoint({
5310				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5311				element: val,
5312				handler: function(direction) {
5313					if (direction == 'up') {
5314						changeMenuActive(this.element, index);
5315					}
5316				},
5317				offset: function() {
5318					return -5 - getOffset()
5319				}
5320			});
5321
5322			if (isSectionscroller) {
5323				var label;
5324				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5325				else label = '';
5326				var getName = $(this).attr('data-name');
5327				if (getName == undefined) getName = index;
5328				if (label != '') {
5329					isOnePage = true;
5330					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5331					$('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>");
5332				}
5333			}
5334		});
5335
5336		if (isSectionscroller) {
5337			$.each($('ul.onepage-pagination li'), function(index, val) {
5338				var $this = $(val),
5339					$a = ('a', $this);
5340				$a.on('click', function(evt) {
5341					if ( $('.is-selected', $this).length || UNCODE.scrolling ) {
5342						return false;
5343					}
5344					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5345						evt.preventDefault();
5346					}
5347					Waypoint.refreshAll();
5348					var el = $('a', evt.currentTarget);
5349					current = lastScrolled = parseInt(el.attr('data-index'));
5350					lastScrolled += 1;
5351					scrollBody(current);
5352				});
5353			});
5354		}
5355
5356		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5357		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5358			goToSection = String(window.location.hash).replace(/^#/, "");
5359			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5360		}
5361
5362		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5363			current = lastScrolled = goToSection;
5364			$(window).on('load', function(){
5365				if ( $('.owl-carousel').length ) {
5366					requestTimeout(function(){
5367						scrollBody(goToSection);
5368					}, 400);
5369				} else {
5370					scrollBody(goToSection);
5371				}
5372			});
5373		}
5374
5375	}
5376
5377	function changeMenuActive(section, index) {
5378		current = lastScrolled = parseInt($(section).attr('data-section'));
5379		if (isOnePage) {
5380			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5381			if (newSection.length) {
5382				$('ul.onepage-pagination li a').removeClass('is-selected');
5383				newSection.addClass('is-selected');
5384			}
5385			var getName = $('[data-section="' + index + '"]').attr('data-name');
5386			if (getName != undefined && getName !== '') {
5387				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5388					var get_href = $(val).attr('href');
5389					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5390						$(val).closest('.menu-smart').find('.active').removeClass('active');
5391						$(val).parent().addClass('active');
5392					}
5393				});
5394			}
5395		}
5396	}
5397
5398	if (isOnePage) {
5399		$(window).on('scroll', function() {
5400			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5401			if (bodyTop == 0) {
5402				$('ul.onepage-pagination li a').removeClass('is-selected');
5403				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5404				var getName = $('[data-section=0]').attr('data-name');
5405				if (getName != undefined && getName !== '') {
5406					$.each($('.menu-container .menu-item > a'), function(i, val) {
5407						var get_href = $(val).attr('href');
5408						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5409							$(val).closest('ul').find('.active').removeClass('active');
5410							$(val).parent().addClass('active');
5411						}
5412					});
5413				}
5414			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5415				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5416				if (lastSection.length) {
5417					$('ul.onepage-pagination li a').removeClass('is-selected');
5418					lastSection.addClass('is-selected');
5419				}
5420			}
5421		});
5422	}
5423
5424	var scrollBody = function(index) {
5425		$('ul.onepage-pagination li a').removeClass('is-selected');
5426		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5427
5428		var getSection = $('[data-section=' + index + ']'),
5429			scrollTo;
5430
5431		if (getSection == undefined) return;
5432
5433		var body = $("html, body"),
5434			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5435			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5436			getOffset = UNCODE.get_scroll_offset(index);
5437		if ( typeof getSection.offset() === 'undefined' )
5438			return;
5439		scrollTo = getSection.offset().top;
5440
5441		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5442		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5443			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5444			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5445				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5446			}
5447
5448			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5449				if ( index === 0 ) {
5450					scrollTo = 0;
5451				} else {
5452					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5453				}
5454			} else {
5455				scrollTo -= getOffset;
5456			}
5457		}
5458
5459		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5460		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5461
5462		if (index != 0) {
5463			UNCODE.scrolling = true;
5464		}
5465
5466		if (scrollSpeed == 0) {
5467			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5468			UNCODE.scrolling = false;
5469		} else {
5470			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5471				$(this).stop();
5472			}).animate({
5473				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5474			}, scrollSpeed, 'easeInOutCubic', function() {
5475				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5476				UNCODE.scrolling = false;
5477				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5478				||
5479				$('.menu-hided').length ) {
5480					scrollTo = getSection.offset().top;
5481					getOffset = UNCODE.get_scroll_offset(index);
5482					scrollTo -= getOffset;
5483					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5484						$(this).stop();
5485					}).animate({
5486						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5487						}, scrollSpeed, 'easeInOutCubic', function() {
5488							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5489							UNCODE.scrolling = false;
5490						}
5491					);
5492				}
5493			});
5494		}
5495
5496	};
5497
5498	init_onepage();
5499};
5500
5501UNCODE.stickyElements = function() {
5502	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5503	if (!isMobile_wide ) {
5504
5505		var $pageHeader = $('#page-header'),
5506			$headerRow = $('.vc_row', $pageHeader),
5507			$headerSection = $headerRow.closest('section[data-parent]'),
5508			startSticky = false;
5509
5510		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
5511			$headerRow.removeClass('sticky-element');
5512			$pageHeader.addClass('sticky-element');
5513			startSticky = true;
5514		}
5515
5516		var calculateOffset = function(el) {
5517			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5518				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5519				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5520				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5521
5522			sideOffset += UNCODE.bodyBorder;
5523
5524			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5525			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5526				if ($('.menu-shrink').length) {
5527					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5528				} else {
5529					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5530				}
5531			}
5532
5533			return sideOffset;
5534
5535		},
5536
5537		initStickyElement = function($els) {
5538			if ( $('body').hasClass('vc-safe-mode') ) {
5539				return true;
5540			}
5541			if ( typeof $els === 'undefined' ) {
5542				$els = $('.sticky-element');
5543			}
5544			$.each($els, function(index, element) {
5545				if ($(element).closest('.tab-pane').length) {
5546					var $paneParent = $(element).closest('.tab-pane');
5547					if ( !$paneParent.hasClass('active') ) {
5548						return true;
5549					}
5550				}
5551				$(element).stick_in_parent({
5552					sticky_class: 'is_stucked',
5553					offset_top: calculateOffset(element),
5554					bottoming: true,
5555					inner_scrolling: SiteParameters.sticky_elements === 'on'
5556				});
5557			});
5558		};
5559
5560		var oldW = UNCODE.wwidth,
5561			oldH = UNCODE.wHeight;
5562
5563		requestTimeout(function() {
5564			if ($('.sticky-element').length) {
5565
5566				if ($(window).width() > UNCODE.mediaQuery) {
5567					initStickyElement();
5568
5569					if ( startSticky === true ) {
5570						$('#page-header').trigger('sticky_kit:recalc');
5571					}
5572				}
5573
5574				$(window).on('resize lateral_resize', function(event) {
5575					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
5576						$(".sticky-element").trigger("sticky_kit:detach");
5577						if ($(window).width() > UNCODE.mediaQuery) {
5578							initStickyElement();
5579						}
5580						oldW = UNCODE.wwidth;
5581						oldH = UNCODE.wHeight;
5582					}
5583				});
5584			}
5585		}, 1000);
5586
5587		if ($('.sticky-element').length) {
5588			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
5589				requestTimeout(function() {
5590					$(document.body).trigger("sticky_kit:recalc");
5591				}, 100);
5592			});
5593		}
5594
5595		var $panels = $('.panel-collapse');
5596		if ( $panels.length ) {
5597			$panels.each(function(){
5598				var $panel = $(this);
5599				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
5600					$(document.body).trigger("sticky_kit:recalc");
5601				});
5602			});
5603		}
5604
5605		$('.nav-tabs a').on('shown.bs.tab', function(e){
5606			var $tabs = $(e.target).closest('.tab-container'),
5607				$panel = $('.tab-pane.active', $tabs),
5608				$els = $(e.target).nextAll(".sticky-element");
5609
5610			$els.trigger("sticky_kit:detach");
5611			initStickyElement($els);
5612		});
5613
5614		$(window).on('vc-safe-mode-on', function(){
5615			$(".sticky-element").trigger("sticky_kit:detach");
5616		});
5617
5618		$(window).on('vc-safe-mode-off', function(){
5619			initStickyElement();
5620		});
5621	}
5622};
5623
5624UNCODE.twentytwenty = function() {
5625
5626  if (!$('.twentytwenty-container').length) return;
5627
5628// DOM.event.move
5629//
5630// 2.0.0
5631//
5632// Stephen Band
5633//
5634// Triggers 'movestart', 'move' and 'moveend' events after
5635// mousemoves following a mousedown cross a distance threshold,
5636// similar to the native 'dragstart', 'drag' and 'dragend' events.
5637// Move events are throttled to animation frames. Move event objects
5638// have the properties:
5639//
5640// pageX:
5641// pageY:     Page coordinates of pointer.
5642// startX:
5643// startY:    Page coordinates of pointer at movestart.
5644// distX:
5645// distY:     Distance the pointer has moved since movestart.
5646// deltaX:
5647// deltaY:    Distance the finger has moved since last event.
5648// velocityX:
5649// velocityY: Average velocity over last few events.
5650
5651
5652(function(fn) {
5653	if (typeof define === 'function' && define.amd) {
5654        define([], fn);
5655    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
5656        module.exports = fn;
5657	} else {
5658		fn();
5659	}
5660})(function(){
5661	var assign = Object.assign || window.jQuery && jQuery.extend;
5662
5663	// Number of pixels a pressed pointer travels before movestart
5664	// event is fired.
5665	var threshold = 8;
5666
5667	// Shim for requestAnimationFrame, falling back to timer. See:
5668	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
5669	var requestFrame = (function(){
5670		return (
5671			window.requestAnimationFrame ||
5672			window.webkitRequestAnimationFrame ||
5673			window.mozRequestAnimationFrame ||
5674			window.oRequestAnimationFrame ||
5675			window.msRequestAnimationFrame ||
5676			function(fn, element){
5677				return window.setTimeout(function(){
5678					fn();
5679				}, 25);
5680			}
5681		);
5682	})();
5683
5684	// Shim for customEvent
5685	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
5686	(function () {
5687		if ( typeof window.CustomEvent === "function" ) return false;
5688		function CustomEvent ( event, params ) {
5689			params = params || { bubbles: false, cancelable: false, detail: undefined };
5690			var evt = document.createEvent( 'CustomEvent' );
5691			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
5692			return evt;
5693		}
5694
5695		CustomEvent.prototype = window.Event.prototype;
5696		window.CustomEvent = CustomEvent;
5697	})();
5698
5699	var ignoreTags = {
5700			textarea: true,
5701			input: true,
5702			select: true,
5703			button: true
5704		};
5705
5706	var mouseevents = {
5707		move:   'mousemove',
5708		cancel: 'mouseup dragstart',
5709		end:    'mouseup'
5710	};
5711
5712	var touchevents = {
5713		move:   'touchmove',
5714		cancel: 'touchend',
5715		end:    'touchend'
5716	};
5717
5718	var rspaces = /\s+/;
5719
5720
5721	// DOM Events
5722
5723	var eventOptions = { bubbles: true, cancelable: true };
5724
5725	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
5726
5727	function createEvent(type) {
5728		return new CustomEvent(type, eventOptions);
5729	}
5730
5731	function getEvents(node) {
5732		return node[eventsSymbol] || (node[eventsSymbol] = {});
5733	}
5734
5735	function on(node, types, fn, data, selector) {
5736		types = types.split(rspaces);
5737
5738		var events = getEvents(node);
5739		var i = types.length;
5740		var handlers, type;
5741
5742		function handler(e) { fn(e, data); }
5743
5744		while (i--) {
5745			type = types[i];
5746			handlers = events[type] || (events[type] = []);
5747			handlers.push([fn, handler]);
5748			node.addEventListener(type, handler);
5749		}
5750	}
5751
5752	function off(node, types, fn, selector) {
5753		types = types.split(rspaces);
5754
5755		var events = getEvents(node);
5756		var i = types.length;
5757		var type, handlers, k;
5758
5759		if (!events) { return; }
5760
5761		while (i--) {
5762			type = types[i];
5763			handlers = events[type];
5764			if (!handlers) { continue; }
5765			k = handlers.length;
5766			while (k--) {
5767				if (handlers[k][0] === fn) {
5768					node.removeEventListener(type, handlers[k][1]);
5769					handlers.splice(k, 1);
5770				}
5771			}
5772		}
5773	}
5774
5775	function trigger(node, type, properties) {
5776		// Don't cache events. It prevents you from triggering an event of a
5777		// given type from inside the handler of another event of that type.
5778		var event = createEvent(type);
5779		if (properties) { assign(event, properties); }
5780		node.dispatchEvent(event);
5781	}
5782
5783
5784	// Constructors
5785
5786	function Timer(fn){
5787		var callback = fn,
5788		    active = false,
5789		    running = false;
5790
5791		function trigger(time) {
5792			if (active){
5793				callback();
5794				requestFrame(trigger);
5795				running = true;
5796				active = false;
5797			}
5798			else {
5799				running = false;
5800			}
5801		}
5802
5803		this.kick = function(fn) {
5804			active = true;
5805			if (!running) { trigger(); }
5806		};
5807
5808		this.end = function(fn) {
5809			var cb = callback;
5810
5811			if (!fn) { return; }
5812
5813			// If the timer is not running, simply call the end callback.
5814			if (!running) {
5815				fn();
5816			}
5817			// If the timer is running, and has been kicked lately, then
5818			// queue up the current callback and the end callback, otherwise
5819			// just the end callback.
5820			else {
5821				callback = active ?
5822					function(){ cb(); fn(); } :
5823					fn ;
5824
5825				active = true;
5826			}
5827		};
5828	}
5829
5830
5831	// Functions
5832
5833	function noop() {}
5834
5835	function preventDefault(e) {
5836		e.preventDefault();
5837	}
5838
5839	function isIgnoreTag(e) {
5840		return !!ignoreTags[e.target.tagName.toLowerCase()];
5841	}
5842
5843	function isPrimaryButton(e) {
5844		// Ignore mousedowns on any button other than the left (or primary)
5845		// mouse button, or when a modifier key is pressed.
5846		return (e.which === 1 && !e.ctrlKey && !e.altKey);
5847	}
5848
5849	function identifiedTouch(touchList, id) {
5850		var i, l;
5851
5852		if (touchList.identifiedTouch) {
5853			return touchList.identifiedTouch(id);
5854		}
5855
5856		// touchList.identifiedTouch() does not exist in
5857		// webkit yet… we must do the search ourselves...
5858
5859		i = -1;
5860		l = touchList.length;
5861
5862		while (++i < l) {
5863			if (touchList[i].identifier === id) {
5864				return touchList[i];
5865			}
5866		}
5867	}
5868
5869	function changedTouch(e, data) {
5870		var touch = identifiedTouch(e.changedTouches, data.identifier);
5871
5872		// This isn't the touch you're looking for.
5873		if (!touch) { return; }
5874
5875		// Chrome Android (at least) includes touches that have not
5876		// changed in e.changedTouches. That's a bit annoying. Check
5877		// that this touch has changed.
5878		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
5879
5880		return touch;
5881	}
5882
5883
5884	// Handlers that decide when the first movestart is triggered
5885
5886	function mousedown(e){
5887		// Ignore non-primary buttons
5888		if (!isPrimaryButton(e)) { return; }
5889
5890		// Ignore form and interactive elements
5891		if (isIgnoreTag(e)) { return; }
5892
5893		on(document, mouseevents.move, mousemove, e);
5894		on(document, mouseevents.cancel, mouseend, e);
5895	}
5896
5897	function mousemove(e, data){
5898		checkThreshold(e, data, e, removeMouse);
5899	}
5900
5901	function mouseend(e, data) {
5902		removeMouse();
5903	}
5904
5905	function removeMouse() {
5906		off(document, mouseevents.move, mousemove);
5907		off(document, mouseevents.cancel, mouseend);
5908	}
5909
5910	function touchstart(e) {
5911		// Don't get in the way of interaction with form elements
5912		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
5913
5914		var touch = e.changedTouches[0];
5915
5916		// iOS live updates the touch objects whereas Android gives us copies.
5917		// That means we can't trust the touchstart object to stay the same,
5918		// so we must copy the data. This object acts as a template for
5919		// movestart, move and moveend event objects.
5920		var data = {
5921			target:     touch.target,
5922			pageX:      touch.pageX,
5923			pageY:      touch.pageY,
5924			identifier: touch.identifier,
5925
5926			// The only way to make handlers individually unbindable is by
5927			// making them unique.
5928			touchmove:  function(e, data) { touchmove(e, data); },
5929			touchend:   function(e, data) { touchend(e, data); }
5930		};
5931
5932		on(document, touchevents.move, data.touchmove, data);
5933		on(document, touchevents.cancel, data.touchend, data);
5934	}
5935
5936	function touchmove(e, data) {
5937		var touch = changedTouch(e, data);
5938		if (!touch) { return; }
5939		checkThreshold(e, data, touch, removeTouch);
5940	}
5941
5942	function touchend(e, data) {
5943		var touch = identifiedTouch(e.changedTouches, data.identifier);
5944		if (!touch) { return; }
5945		removeTouch(data);
5946	}
5947
5948	function removeTouch(data) {
5949		off(document, touchevents.move, data.touchmove);
5950		off(document, touchevents.cancel, data.touchend);
5951	}
5952
5953	function checkThreshold(e, data, touch, fn) {
5954		var distX = touch.pageX - data.pageX;
5955		var distY = touch.pageY - data.pageY;
5956
5957		// Do nothing if the threshold has not been crossed.
5958		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
5959
5960		triggerStart(e, data, touch, distX, distY, fn);
5961	}
5962
5963	function triggerStart(e, data, touch, distX, distY, fn) {
5964		var touches = e.targetTouches;
5965		var time = e.timeStamp - data.timeStamp;
5966
5967		// Create a movestart object with some special properties that
5968		// are passed only to the movestart handlers.
5969		var template = {
5970			altKey:     e.altKey,
5971			ctrlKey:    e.ctrlKey,
5972			shiftKey:   e.shiftKey,
5973			startX:     data.pageX,
5974			startY:     data.pageY,
5975			distX:      distX,
5976			distY:      distY,
5977			deltaX:     distX,
5978			deltaY:     distY,
5979			pageX:      touch.pageX,
5980			pageY:      touch.pageY,
5981			velocityX:  distX / time,
5982			velocityY:  distY / time,
5983			identifier: data.identifier,
5984			targetTouches: touches,
5985			finger: touches ? touches.length : 1,
5986			enableMove: function() {
5987				this.moveEnabled = true;
5988				this.enableMove = noop;
5989				e.preventDefault();
5990			}
5991		};
5992
5993		// Trigger the movestart event.
5994		trigger(data.target, 'movestart', template);
5995
5996		// Unbind handlers that tracked the touch or mouse up till now.
5997		fn(data);
5998	}
5999
6000
6001	// Handlers that control what happens following a movestart
6002
6003	function activeMousemove(e, data) {
6004		var timer  = data.timer;
6005
6006		data.touch = e;
6007		data.timeStamp = e.timeStamp;
6008		timer.kick();
6009	}
6010
6011	function activeMouseend(e, data) {
6012		var target = data.target;
6013		var event  = data.event;
6014		var timer  = data.timer;
6015
6016		removeActiveMouse();
6017
6018		endEvent(target, event, timer, function() {
6019			// Unbind the click suppressor, waiting until after mouseup
6020			// has been handled.
6021			setTimeout(function(){
6022				off(target, 'click', preventDefault);
6023			}, 0);
6024		});
6025	}
6026
6027	function removeActiveMouse() {
6028		off(document, mouseevents.move, activeMousemove);
6029		off(document, mouseevents.end, activeMouseend);
6030	}
6031
6032	function activeTouchmove(e, data) {
6033		var event = data.event;
6034		var timer = data.timer;
6035		var touch = changedTouch(e, event);
6036
6037		if (!touch) { return; }
6038
6039		// Stop the interface from gesturing
6040		e.preventDefault();
6041
6042		event.targetTouches = e.targetTouches;
6043		data.touch = touch;
6044		data.timeStamp = e.timeStamp;
6045
6046		timer.kick();
6047	}
6048
6049	function activeTouchend(e, data) {
6050		var target = data.target;
6051		var event  = data.event;
6052		var timer  = data.timer;
6053		var touch  = identifiedTouch(e.changedTouches, event.identifier);
6054
6055		// This isn't the touch you're looking for.
6056		if (!touch) { return; }
6057
6058		removeActiveTouch(data);
6059		endEvent(target, event, timer);
6060	}
6061
6062	function removeActiveTouch(data) {
6063		off(document, touchevents.move, data.activeTouchmove);
6064		off(document, touchevents.end, data.activeTouchend);
6065	}
6066
6067
6068	// Logic for triggering move and moveend events
6069
6070	function updateEvent(event, touch, timeStamp) {
6071		var time = timeStamp - event.timeStamp;
6072
6073		event.distX =  touch.pageX - event.startX;
6074		event.distY =  touch.pageY - event.startY;
6075		event.deltaX = touch.pageX - event.pageX;
6076		event.deltaY = touch.pageY - event.pageY;
6077
6078		// Average the velocity of the last few events using a decay
6079		// curve to even out spurious jumps in values.
6080		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
6081		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
6082		event.pageX =  touch.pageX;
6083		event.pageY =  touch.pageY;
6084	}
6085
6086	function endEvent(target, event, timer, fn) {
6087		timer.end(function(){
6088			trigger(target, 'moveend', event);
6089			return fn && fn();
6090		});
6091	}
6092
6093
6094	// Set up the DOM
6095
6096	function movestart(e) {
6097		if (e.defaultPrevented) { return; }
6098		if (!e.moveEnabled) { return; }
6099
6100		var event = {
6101			startX:        e.startX,
6102			startY:        e.startY,
6103			pageX:         e.pageX,
6104			pageY:         e.pageY,
6105			distX:         e.distX,
6106			distY:         e.distY,
6107			deltaX:        e.deltaX,
6108			deltaY:        e.deltaY,
6109			velocityX:     e.velocityX,
6110			velocityY:     e.velocityY,
6111			identifier:    e.identifier,
6112			targetTouches: e.targetTouches,
6113			finger:        e.finger
6114		};
6115
6116		var data = {
6117			target:    e.target,
6118			event:     event,
6119			timer:     new Timer(update),
6120			touch:     undefined,
6121			timeStamp: e.timeStamp
6122		};
6123
6124		function update(time) {
6125			updateEvent(event, data.touch, data.timeStamp);
6126			trigger(data.target, 'move', event);
6127		}
6128
6129		if (e.identifier === undefined) {
6130			// We're dealing with a mouse event.
6131			// Stop clicks from propagating during a move
6132			on(e.target, 'click', preventDefault);
6133			on(document, mouseevents.move, activeMousemove, data);
6134			on(document, mouseevents.end, activeMouseend, data);
6135		}
6136		else {
6137			// In order to unbind correct handlers they have to be unique
6138			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6139			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6140
6141			// We're dealing with a touch.
6142			on(document, touchevents.move, data.activeTouchmove, data);
6143			on(document, touchevents.end, data.activeTouchend, data);
6144		}
6145	}
6146
6147	on(document, 'mousedown', mousedown);
6148	on(document, 'touchstart', touchstart);
6149	on(document, 'movestart', movestart);
6150
6151
6152	// jQuery special events
6153	//
6154	// jQuery event objects are copies of DOM event objects. They need
6155	// a little help copying the move properties across.
6156
6157	if (!window.jQuery) { return; }
6158
6159	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6160
6161	function enableMove1(e) { e.enableMove(); }
6162	function enableMove2(e) { e.enableMove(); }
6163	function enableMove3(e) { e.enableMove(); }
6164
6165	function add(handleObj) {
6166		var handler = handleObj.handler;
6167
6168		handleObj.handler = function(e) {
6169			// Copy move properties across from originalEvent
6170			var i = properties.length;
6171			var property;
6172
6173			while(i--) {
6174				property = properties[i];
6175				e[property] = e.originalEvent[property];
6176			}
6177
6178			handler.apply(this, arguments);
6179		};
6180	}
6181
6182	jQuery.event.special.movestart = {
6183		setup: function() {
6184			// Movestart must be enabled to allow other move events
6185			on(this, 'movestart', enableMove1);
6186
6187			// Do listen to DOM events
6188			return false;
6189		},
6190
6191		teardown: function() {
6192			off(this, 'movestart', enableMove1);
6193			return false;
6194		},
6195
6196		add: add
6197	};
6198
6199	jQuery.event.special.move = {
6200		setup: function() {
6201			on(this, 'movestart', enableMove2);
6202			return false;
6203		},
6204
6205		teardown: function() {
6206			off(this, 'movestart', enableMove2);
6207			return false;
6208		},
6209
6210		add: add
6211	};
6212
6213	jQuery.event.special.moveend = {
6214		setup: function() {
6215			on(this, 'movestart', enableMove3);
6216			return false;
6217		},
6218
6219		teardown: function() {
6220			off(this, 'movestart', enableMove3);
6221			return false;
6222		},
6223
6224		add: add
6225	};
6226});
6227
6228  $.fn.twentytwenty = function(options) {
6229    var options = $.extend({
6230      default_offset_pct: 0.5,
6231      orientation: 'horizontal',
6232      before_label: 'Before',
6233      after_label: 'After',
6234      no_overlay: false,
6235      move_slider_on_hover: false,
6236      move_with_handle_only: true,
6237      click_to_move: false
6238    }, options);
6239
6240    return this.each(function() {
6241
6242      var sliderPct = options.default_offset_pct;
6243      var container = $(this);
6244      var sliderOrientation = options.orientation;
6245      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6246      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6247
6248
6249      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6250      if(!options.no_overlay) {
6251        container.append("<div class='twentytwenty-overlay'></div>");
6252        var overlay = container.find(".twentytwenty-overlay");
6253        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6254        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6255      }
6256      var beforeImg = container.find("img:first");
6257      var afterImg = container.find("img:last");
6258      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6259      var slider = container.find(".twentytwenty-handle");
6260      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6261      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6262      container.addClass("twentytwenty-container");
6263      beforeImg.addClass("twentytwenty-before");
6264      afterImg.addClass("twentytwenty-after");
6265
6266      var calcOffset = function(dimensionPct) {
6267        var w = beforeImg.width();
6268        var h = beforeImg.height();
6269        return {
6270          w: w+"px",
6271          h: h+"px",
6272          cw: (dimensionPct*w)+"px",
6273          ch: (dimensionPct*h)+"px"
6274        };
6275      };
6276
6277      var adjustContainer = function(offset) {
6278      	if (sliderOrientation === 'vertical') {
6279          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6280          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6281      	}
6282      	else {
6283          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6284          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6285    	}
6286        container.css("height", offset.h);
6287      };
6288
6289      var adjustSlider = function(pct) {
6290        var offset = calcOffset(pct);
6291        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6292        adjustContainer(offset);
6293      };
6294
6295      // Return the number specified or the min/max number if it outside the range given.
6296      var minMaxNumber = function(num, min, max) {
6297        return Math.max(min, Math.min(max, num));
6298      };
6299
6300      // Calculate the slider percentage based on the position.
6301      var getSliderPercentage = function(positionX, positionY) {
6302        var sliderPercentage = (sliderOrientation === 'vertical') ?
6303          (positionY-offsetY)/imgHeight :
6304          (positionX-offsetX)/imgWidth;
6305
6306        return minMaxNumber(sliderPercentage, 0, 1);
6307      };
6308
6309
6310      $(window).on("resize.twentytwenty", function(e) {
6311        adjustSlider(sliderPct);
6312      });
6313
6314      var offsetX = 0;
6315      var offsetY = 0;
6316      var imgWidth = 0;
6317      var imgHeight = 0;
6318      var onMoveStart = function(e) {
6319        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6320          e.preventDefault();
6321        }
6322        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6323          e.preventDefault();
6324        }
6325        container.addClass("active");
6326        offsetX = container.offset().left;
6327        offsetY = container.offset().top;
6328        imgWidth = beforeImg.width();
6329        imgHeight = beforeImg.height();
6330      };
6331      var onMove = function(e) {
6332        if (container.hasClass("active")) {
6333          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6334          adjustSlider(sliderPct);
6335        }
6336      };
6337      var onMoveEnd = function() {
6338          container.removeClass("active");
6339      };
6340
6341      var moveTarget = options.move_with_handle_only ? slider : container;
6342      moveTarget.on("movestart",onMoveStart);
6343      moveTarget.on("move",onMove);
6344      moveTarget.on("moveend",onMoveEnd);
6345
6346      if (options.move_slider_on_hover) {
6347        container.on("mouseenter", onMoveStart);
6348        container.on("mousemove", onMove);
6349        container.on("mouseleave", onMoveEnd);
6350      }
6351
6352      slider.on("touchmove", function(e) {
6353        e.preventDefault();
6354      });
6355
6356      container.find("img").on("mousedown", function(event) {
6357        event.preventDefault();
6358      });
6359
6360      if (options.click_to_move) {
6361        container.on('click', function(e) {
6362          offsetX = container.offset().left;
6363          offsetY = container.offset().top;
6364          imgWidth = beforeImg.width();
6365          imgHeight = beforeImg.height();
6366
6367          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6368          adjustSlider(sliderPct);
6369        });
6370      }
6371
6372      $(window).trigger("resize.twentytwenty");
6373    });
6374  };
6375
6376
6377  $(window).on("load", function(e) {
6378  	$('.twentytwenty-container').each(function(){
6379  		var $container = $(this);
6380  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6381  			$container.twentytwenty();
6382  		}
6383  		$('img', $container).on('async-done', function(){
6384	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6385	  			$container.twentytwenty();
6386	  		}
6387	    });
6388  	});
6389  });
6390}
6391
6392UNCODE.justifiedGallery = function() {
6393
6394	var breakPointMe = function( val ) {
6395		val = parseInt( val );
6396		if ( isNaN(val) ) {
6397			return false;
6398		}
6399		if ( val >= 1500 ) {
6400			return 1;
6401		} else if ( val < 1500 && val >= 960 ) {
6402			return 2;
6403		} else if ( val < 960 && val >= 570 ) {
6404			return 3;
6405		} else if ( val < 570 ) {
6406			return 4;
6407		}
6408	}
6409
6410	var gutterByBreakpoint = function( bp, gutter ) {
6411		var ret;
6412		switch(gutter) {
6413		    case 'no-gutter':
6414		    	ret = 0;
6415		        break;
6416		    case 'px-gutter':
6417		    	ret = 1;
6418		        break;
6419		    case 'half-gutter':
6420		    	ret = 18;
6421		        break;
6422		    case 'double-gutter':
6423				switch(bp) {
6424				    case 3:
6425				    case 4:
6426				    	ret = 36;
6427				        break;
6428				    default:
6429				    	ret = 72;
6430				        break;
6431				}
6432		        break;
6433		    case 'triple-gutter':
6434				switch(bp) {
6435				    case 3:
6436				    case 4:
6437				    	ret = 36;
6438				        break;
6439				    default:
6440				    	ret = 108;
6441				        break;
6442				}
6443		        break;
6444		    case 'quad-gutter':
6445				switch(bp) {
6446				    case 2:
6447				    	ret = 108;
6448				        break;
6449				    case 3:
6450				    	ret = 72;
6451				        break;
6452				    case 4:
6453				    	ret = 36;
6454				        break;
6455				    default:
6456				    	ret = 144;
6457				        break;
6458				}
6459		        break;
6460		    default:
6461		    	ret = 36;//single-gutter
6462		}
6463		return ret;
6464	}
6465
6466	if ($('.justified-layout').length > 0) {
6467		var justifiedContainersArray = [],
6468			typeGridArray = [],
6469			layoutGridArray = [],
6470			transitionDuration = [],
6471			$filterItems = [],
6472			$filters = $('.justified-system .isotope-filters'),
6473			$itemSelector = '.tmb',
6474			$items,
6475			itemMargin,
6476			correctionFactor = 0,
6477			firstLoad = true,
6478			isOriginLeft = $('body').hasClass('rtl') ? false : true,
6479			prevW = breakPointMe(UNCODE.wwidth);
6480		$('[class*="justified-container"]').each(function() {
6481			var isoData = $(this).data();
6482			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6483			if (isoData.type == 'metro') typeGridArray.push(true);
6484			else typeGridArray.push(false);
6485			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
6486			else layoutGridArray.push('justified');
6487			justifiedContainersArray.push($(this));
6488		});
6489		var init_justifiedGallery = function() {
6490			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
6491				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
6492					justifiedId = justifiedSystem.attr('id'),
6493					$layoutMode = layoutGridArray[i],
6494					gutter = $(justifiedContainersArray[i]).data('gutter'),
6495					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
6496					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
6497					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6498					margins;
6499
6500				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6501				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6502				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6503
6504				margins = gutterByBreakpoint(prevW, gutter);
6505
6506				$(justifiedContainersArray[i]).justifiedGallery({
6507					rowHeight: rowHeight,
6508					maxRowHeight: maxRowHeight,
6509					margins: margins,
6510					cssAnimation: true,
6511					lastRow: lastRow,
6512					waitThumbnailsLoad: false
6513				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6514
6515				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6516					$(justifiedContainersArray[i]).infinitescroll({
6517							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6518							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6519							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6520							animate: false,
6521							behavior: 'local',
6522							debug: false,
6523							loading: {
6524								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6525								speed: 0,
6526								finished: undefined,
6527								msg: $('#' + justifiedId + ' .loadmore-button'),
6528							},
6529							errorCallback: function() {
6530								var justified_system = $(this).closest('.justified-system');
6531								$('.loading-button', justified_system).hide();
6532								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
6533							}
6534						},
6535						// append the new items to galleryJustified on the infinitescroll callback function.
6536						function(newElements, opts) {
6537							var $galleryJustified = $(this),
6538								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
6539								filters = new Array(),
6540								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
6541								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
6542								$numPages = $('a', $infinite_button).data('pages'),
6543								delay = 300;
6544							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6545							$infinite_button.show();
6546							$loading_button.hide();
6547							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6548							$('> li', $galleryJustified).remove();
6549							$.each($(newElements), function(index, val) {
6550								$(val).addClass('tmb-iso');
6551								if ($(val).is("li")) {
6552									filters.push($(val)[0]);
6553								}
6554								$(val).addClass('uncode-appended');
6555							});
6556							newElements = newElements.filter(function(x) {
6557								return filters.indexOf(x) < 0
6558							});
6559							$.each($(filters), function(index, val) {
6560								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
6561							});
6562							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
6563							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6564								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
6565								if (typeof getLightbox === 'object') {
6566									getLightbox.refresh();
6567								} else {
6568									UNCODE.lightbox();
6569								}
6570							}
6571							if ( typeof twttr !== 'undefined' )
6572								twttr.widgets.load(justifiedContainersArray[i]);
6573
6574							requestTimeout(function() {
6575								$galleryJustified.trigger('more-items-loaded');
6576								$(window).trigger('more-items-loaded');
6577								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6578							}, 1000);
6579						});
6580					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
6581						var $infinite_justified = $(justifiedContainersArray[i]),
6582							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
6583						$infinite_justified.infinitescroll('pause');
6584						$infinite_button.on('click', function(event) {
6585							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6586								$.each(UNCODE.lightboxArray, function(index, val) {
6587									UNCODE.lightboxArray[index].destroy();
6588								});
6589							}
6590							event.preventDefault();
6591							var $justified_system = $(event.target).closest('.justified-system'),
6592							$infinite_justified = $justified_system.find('.justified-container'),
6593							justifiedId = $justified_system.attr('id');
6594							$(event.currentTarget).html(SiteParameters.loading);
6595							$infinite_justified.infinitescroll('resume');
6596							$infinite_justified.infinitescroll('retrieve');
6597							$infinite_justified.infinitescroll('pause');
6598							$infinite_justified.trigger('more-items-loaded');
6599							$(window).trigger('more-items-loaded');
6600							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6601						});
6602					}
6603				}
6604			}
6605		},
6606		onLayout = function(justifiedObj, startIndex) {
6607			justifiedObj.css('opacity', 1);
6608			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
6609			$('.tmb', justifiedObj).addClass('justified-object-loaded');
6610
6611			requestTimeout(function() {
6612				// window.dispatchEvent(UNCODE.boxEvent);
6613				UNCODE.adaptive();
6614				if (SiteParameters.dynamic_srcset_active === '1') {
6615					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
6616				}
6617				if (typeof MediaElement === "function") {
6618					$(justifiedObj).find('audio,video').each(function() {
6619						$(this).mediaelementplayer({
6620								pauseOtherPlayers: false,
6621						});
6622					});
6623				}
6624				if ($(justifiedObj).find('.nested-carousel').length) {
6625					if (typeof UNCODE.carousel !== 'undefined') {
6626						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
6627					}
6628					requestTimeout(function() {
6629						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6630						justifiedObj.addClass('justified-gallery-finished')
6631						Waypoint.refreshAll();
6632					}, 200);
6633				} else {
6634					requestTimeout(function() {
6635						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6636						justifiedObj.addClass('justified-gallery-finished')
6637						Waypoint.refreshAll();
6638					}, 300);
6639				}
6640			}, 100);
6641
6642		},
6643		boxAnimation = function(items, startIndex, sequential, container) {
6644			var $allItems = items.length - startIndex,
6645				showed = 0,
6646				index = 0;
6647			if (container.closest('.owl-item').length == 1) return false;
6648			$.each(items, function(index, val) {
6649				var elInner = $('> .t-inside', val);
6650				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
6651					return;
6652				}
6653				if (val[0]) val = val[0];
6654				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
6655					new Waypoint({
6656						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
6657						element: val,
6658						handler: function() {
6659							var element = $('> .t-inside', this.element),
6660								parent = $(this.element),
6661								currentIndex = parent.index();
6662							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
6663								delayAttr = parseInt(element.attr('data-delay'));
6664							if (isNaN(delayAttr)) delayAttr = 100;
6665							delay -= showed;
6666							var objTimeout = requestTimeout(function() {
6667								element.removeClass('zoom-reverse').addClass('start_animation');
6668								showed = parent.index();
6669							}, delay * delayAttr);
6670							parent.data('objTimeout', objTimeout);
6671							if (!UNCODE.isUnmodalOpen) {
6672								this.destroy();
6673							}
6674						},
6675						offset: '100%'
6676					})
6677				} else {
6678					elInner.removeClass('animate_when_almost_visible');
6679					$(val).addClass('no-waypoint-animation');
6680					/*if (elInner.hasClass('force-anim')) {
6681						elInner.addClass('start_animation');
6682					} else {
6683						elInner.css('opacity', 1);
6684					}*/
6685				}
6686				index++;
6687			});
6688		};
6689		$filters.on('click', 'a[data-filter]', function(evt) {
6690			var $filter = $(this),
6691				filterContainer = $filter.closest('.isotope-filters'),
6692				filterValue = $filter.attr('data-filter'),
6693				container = $filter.closest('.justified-system').find($('.justified-layout')),
6694				lastRow = container.data('last-row'),
6695				transitionDuration = 0,
6696				delay = 300,
6697				filterItems = [];
6698
6699			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6700
6701			var filter_items = function(){
6702				if (filterValue !== undefined) {
6703					$.each($('> .tmb > .t-inside', container), function(index, val) {
6704						var parent = $(val).parent(),
6705							objTimeout = parent.data('objTimeout');
6706						if (objTimeout) {
6707							$(val).removeClass('zoom-reverse');
6708							clearRequestTimeout(objTimeout);
6709						}
6710						if (transitionDuration == 0) {
6711							if ($(val).hasClass('animate_when_almost_visible')) {
6712								$(val).addClass('zoom-reverse').removeClass('start_animation');
6713							} else {
6714								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6715							}
6716						}
6717					});
6718
6719					requestTimeout(function() {
6720						var $block,
6721							selector,
6722							lightboxElements,
6723							$boxes;
6724
6725						if ( filterValue !== '' && filterValue !== '*' ) {
6726							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
6727							selector = '.' + filterValue;
6728							$.each($(selector, container), function(index, block) {
6729								lightboxElements = $('[data-lbox^=ilightbox]', block);
6730								if (lightboxElements.length) {
6731									lightboxElements.removeClass('lb-disabled');
6732									container.data('lbox', $(lightboxElements[0]).data('lbox'));
6733								}
6734								filterItems.push(block);
6735							});
6736							container.justifiedGallery({
6737								filter: selector,
6738								lastRow: 'nojustify'
6739							});
6740						} else {
6741							container.justifiedGallery({
6742								filter: false,
6743								lastRow: lastRow
6744							});
6745							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
6746							filterItems = $('> .tmb', container);
6747						}
6748						container.trigger('more-items-loaded');
6749						$(window).trigger('more-items-loaded');
6750						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6751
6752						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6753						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6754							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
6755							if (typeof getLightbox === 'object') {
6756								getLightbox.refresh();
6757							} else {
6758								UNCODE.lightbox();
6759							}
6760						}
6761
6762						if (transitionDuration == 0) {
6763							requestTimeout(function() {
6764								boxAnimation(filterItems, 0, false, container);
6765							}, 100);
6766						}
6767						requestTimeout(function() {
6768							Waypoint.refreshAll();
6769							container.trigger('more-items-loaded');
6770							$(window).trigger('more-items-loaded');
6771							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6772							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
6773								$(document).trigger('uncode-scrolltrigger-refresh');
6774							}
6775						}, 2000);
6776
6777					}, delay);
6778				} else {
6779					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6780						$.each(UNCODE.lightboxArray, function(index, val) {
6781							UNCODE.lightboxArray[index].destroy();
6782						});
6783					}
6784					$.each($('> .tmb > .t-inside', container), function(index, val) {
6785						var parent = $(val).parent(),
6786							objTimeout = parent.data('objTimeout');
6787						if (objTimeout) {
6788							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6789							clearRequestTimeout(objTimeout);
6790						}
6791						if (transitionDuration == 0) {
6792							if ($(val).hasClass('animate_when_almost_visible')) {
6793								$(val).addClass('zoom-reverse').removeClass('start_animation');
6794							} else {
6795								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6796							}
6797						}
6798					});
6799					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6800						UNCODE.lightbox();
6801					}
6802					container.parent().addClass('justified-loading');
6803					container.trigger('more-items-loaded');
6804					$(window).trigger('more-items-loaded');
6805					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6806				}
6807			};
6808
6809			if (!$filter.hasClass('active')) {
6810				/** Scroll top with filtering */
6811				if (filterContainer.hasClass('filter-scroll')) {
6812                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6813                    calc_scroll -= UNCODE.get_scroll_offset();
6814
6815					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6816						delta = bodyTop - calc_scroll,
6817						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6818						filterTolerance = false,
6819						filter_timeout;
6820					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6821
6822					if ( !UNCODE.isFullPage ) {
6823						if (scrollSpeed == 0) {
6824							$('html, body').scrollTop(calc_scroll);
6825							UNCODE.scrolling = false;
6826							filter_items();
6827						} else {
6828
6829							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6830								filter_items();
6831								filterTolerance = true;
6832							}
6833
6834							$('html, body').animate({
6835								scrollTop: calc_scroll
6836							},{
6837								easing: 'easeInOutQuad',
6838								duration: scrollSpeed,
6839								complete: function(){
6840									UNCODE.scrolling = false;
6841									if ( !filterTolerance ) {
6842										filter_timeout = setTimeout(function(){
6843											clearTimeout(filter_timeout);
6844											filter_items();
6845										}, 200);
6846									}
6847								}
6848							});
6849						}
6850					}
6851				} else {
6852					filter_items();
6853				}
6854			}
6855			evt.preventDefault();
6856		});
6857
6858		$filters.each(function(i, buttonGroup) {
6859			var $buttonGroup = $(buttonGroup);
6860			$buttonGroup.on('click', 'a', function() {
6861				$buttonGroup.find('.active').removeClass('active');
6862				$(this).addClass('active');
6863			});
6864
6865			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6866				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6867				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6868			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6869				e.preventDefault();
6870				$cats_filters.slideToggle(400, 'easeInOutCirc');
6871			});
6872		});
6873		window.addEventListener('boxResized', function(e) {
6874			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
6875				prevW = breakPointMe(UNCODE.wwidth);
6876				$.each($('.justified-layout'), function(index, val) {
6877					var gutter = $(this).data('gutter'),
6878						margins = gutterByBreakpoint( prevW, gutter);
6879					$(this).justifiedGallery({
6880						margins: margins
6881					});
6882					$(this).find('.mejs-video,.mejs-audio').each(function() {
6883						$(this).trigger('resize');
6884					});
6885				});
6886			}
6887		}, false);
6888
6889		init_justifiedGallery();
6890	};
6891};
6892
6893UNCODE.cssGrid = function() {
6894	if ($('.cssgrid-layout').length > 0) {
6895		var cssGridContainersArray = [];
6896		var transitionDuration = [];
6897		var $filters = $('.cssgrid-system .cssgrid-filters');
6898
6899		$('[class*="cssgrid-container"]').each(function() {
6900			cssGridContainersArray.push($(this));
6901			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6902		});
6903
6904		var init_cssGridAjax = function() {
6905			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
6906				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
6907					cssGridId = cssGridSystem.attr('id');
6908
6909				cssGridSystem.data('transitionDuration', transitionDuration[i]);
6910
6911				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
6912					$(cssGridContainersArray[i]).infinitescroll({
6913						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
6914						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6915						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
6916						animate: false,
6917						behavior: 'local',
6918						debug: false,
6919						loading: {
6920							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
6921							speed: 0,
6922							finished: undefined,
6923							msg: $('#' + cssGridId + ' .loadmore-button'),
6924						},
6925						errorCallback: function() {
6926							var cssgrid_system = $(this).closest('.cssgrid-system');
6927							$('.loading-button', cssgrid_system).hide();
6928							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
6929						}
6930					},
6931					// append the new items to cssGrid on the infinitescroll callback function.
6932					function(newElements, opts) {
6933						var $cssGrid = $(this),
6934							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
6935							cssGridId = cssGridSystemCont.attr('id'),
6936							filters = new Array(),
6937							$loading_button = cssGridSystemCont.find('.loading-button'),
6938							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
6939							$numPages = $('a', $infinite_button).data('pages'),
6940							$woo_results,
6941							delay = 300;
6942						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6943						$infinite_button.show();
6944						$loading_button.hide();
6945						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6946						$('> li', $cssGrid).remove();
6947						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
6948						$.each($(newElements), function (index, val) {
6949							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
6950								$woo_results = $(val);
6951								delete newElements[index];
6952							} else {
6953								$(val).addClass('tmb-grid');
6954								if ($(val).is("li")) {
6955									filters.push($(val)[0]);
6956								}
6957							}
6958							$(val).addClass('uncode-appended');
6959						});
6960						newElements = newElements.filter(function(x) {
6961							return filters.indexOf(x) < 0
6962						});
6963						$.each($(filters), function(index, val) {
6964							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
6965						});
6966						if ($woo_results && $woo_results.length > 0) {
6967							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
6968							var new_count = $woo_results.find('.woocommerce-result-count').text();
6969							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
6970							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
6971							function replaceMatch(match, p1, p2) {
6972        						return old_start + '–' + new_end;
6973							}
6974							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
6975							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
6976						}
6977
6978						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6979						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
6980						if (filterValue !== undefined && filterValue != '*') {
6981							$(newElements).hide();
6982							var els_to_show = $();
6983							$(newElements).each(function() {
6984								var el = $(this);
6985								if (el.hasClass(filterValue)) {
6986									els_to_show = els_to_show.add(el);
6987									el.show();
6988								}
6989							});
6990							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
6991						} else {
6992							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
6993						}
6994
6995						UNCODE.adaptive();
6996						if (SiteParameters.dynamic_srcset_active === '1') {
6997							UNCODE.refresh_dynamic_srcset_size($cssGrid);
6998						}
6999						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7000							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
7001							if (typeof getLightbox === 'object') {
7002								getLightbox.refresh();
7003							} else {
7004								UNCODE.lightbox();
7005							}
7006						}
7007						if ( typeof twttr !== 'undefined' ) {
7008							twttr.widgets.load(cssGridContainersArray[i]);
7009						}
7010
7011						UNCODE.carousel($(newElements));
7012						requestTimeout(function() {
7013							$cssGrid.trigger('more-items-loaded');
7014							$(window).trigger('more-items-loaded');
7015							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7016						}, 1000);
7017
7018					});
7019					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
7020						var $cssgrid_el = $(cssGridContainersArray[i]),
7021							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
7022						$cssgrid_el.infinitescroll('pause');
7023						$infinite_button.on('click', function(event) {
7024							event.preventDefault();
7025							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
7026							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
7027							cssGridId = $cssgrid_system.attr('id');
7028							$(event.currentTarget).html(SiteParameters.loading);
7029							$cssgrid_el.infinitescroll('resume');
7030							$cssgrid_el.infinitescroll('retrieve');
7031							$cssgrid_el.infinitescroll('pause');
7032						});
7033					}
7034				}
7035			}
7036		};
7037
7038		init_cssGridAjax();
7039
7040		if ($('.cssgrid-pagination').length > 0) {
7041			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
7042				evt.preventDefault();
7043
7044				if (SiteParameters.index_pagination_disable_scroll !== '1') {
7045					var container = $(this).closest('.cssgrid-system'),
7046						pagination_disable_scroll = container.attr('data-pagination-scroll'),
7047						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7048
7049					if ( pagination_disable_scroll === 'disabled' ) {
7050						return;
7051					}
7052
7053					calc_scroll -= UNCODE.get_scroll_offset();
7054
7055					var menu_container = $('.menu-sticky');
7056					var menu = menu_container.find('.menu-container');
7057
7058					if (menu_container.length > 0 && menu.length > 0) {
7059						calc_scroll = calc_scroll - menu.outerHeight();
7060					}
7061
7062					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7063						delta = bodyTop - calc_scroll,
7064						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7065					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7066
7067					if ( !UNCODE.isFullPage ) {
7068						if (scrollSpeed == 0) {
7069							$('html, body').scrollTop(calc_scroll);
7070						} else {
7071							$('html, body').animate({
7072								scrollTop: calc_scroll
7073							},{
7074								easing: 'easeInOutQuad',
7075								duration: scrollSpeed,
7076								complete: function(){
7077									UNCODE.scrolling = false;
7078								}
7079							});
7080						}
7081					}
7082				}
7083
7084				loadCssGrid($(this), true);
7085			});
7086		}
7087
7088		$filters.on('click', 'a.grid-nav-link', function(evt) {
7089			if ($(this).hasClass('no-grid-filter')) {
7090				return;
7091			}
7092			var $filter = $(this),
7093				filterContainer = $filter.closest('.cssgrid-filters'),
7094				filterValue = $filter.attr('data-filter'),
7095				containerSystem = $filter.closest('.cssgrid-system'),
7096				container = containerSystem.find($('.cssgrid-layout')),
7097				transitionDuration = containerSystem.data('transitionDuration'),
7098				delay = 300,
7099				filterItems = [],
7100				all_thumbs = container.find('.tmb-grid');
7101
7102			var filter_items = function(){
7103				if (filterValue !== undefined) {
7104					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7105						var parent = $(val).parent(),
7106							objTimeout = parent.data('objTimeout');
7107						if (objTimeout) {
7108							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7109							clearRequestTimeout(objTimeout);
7110						}
7111						if (transitionDuration == 0) {
7112							if ($(val).hasClass('animate_when_almost_visible')) {
7113								$(val).addClass('zoom-reverse').removeClass('start_animation');
7114							} else {
7115								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7116							}
7117						}
7118					});
7119					requestTimeout(function(){
7120						if ( filterValue == '*' ) {
7121							all_thumbs.show();
7122							all_thumbs.each(function(index, val) {
7123								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7124								filterItems.push($(this));
7125							});
7126						} else {
7127							all_thumbs.each(function() {
7128								var _tmb = $(this);
7129								if (_tmb.hasClass(filterValue)) {
7130									_tmb.show();
7131									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7132									filterItems.push(_tmb);
7133								} else {
7134									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7135									_tmb.hide();
7136								}
7137							});
7138						}
7139
7140						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7141
7142						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7143						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7144						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7145						if (lightboxElements.length) {
7146							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7147							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7148								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7149								if (typeof getLightbox === 'object') {
7150									getLightbox.refresh();
7151								} else {
7152									UNCODE.lightbox();
7153								}
7154							}
7155						}
7156						container.trigger('more-items-loaded');
7157						$(window).trigger('more-items-loaded');
7158						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7159					}, delay);
7160				} else {
7161					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7162						var parent = $(val).parent(),
7163							objTimeout = parent.data('objTimeout');
7164						if (objTimeout) {
7165							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7166							clearRequestTimeout(objTimeout);
7167						}
7168						if (transitionDuration == 0) {
7169							if ($(val).hasClass('animate_when_almost_visible')) {
7170								$(val).addClass('zoom-reverse').removeClass('start_animation');
7171							} else {
7172								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7173							}
7174						}
7175					});
7176					loadCssGrid($filter);
7177				}
7178			};
7179
7180			if (!$filter.hasClass('active')) {
7181				/** Scroll top with filtering */
7182				if (filterContainer.hasClass('filter-scroll')) {
7183                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7184                    calc_scroll -= UNCODE.get_scroll_offset();
7185
7186					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7187						delta = bodyTop - calc_scroll,
7188						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7189						filterTolerance = false,
7190						filter_timeout;
7191					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7192
7193					if ( !UNCODE.isFullPage ) {
7194						if (scrollSpeed == 0) {
7195							$('html, body').scrollTop(calc_scroll);
7196							UNCODE.scrolling = false;
7197							filter_items();
7198						} else {
7199
7200							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7201								filter_items();
7202								filterTolerance = true;
7203							}
7204
7205							$('html, body').animate({
7206								scrollTop: calc_scroll
7207							},{
7208								easing: 'easeInOutQuad',
7209								duration: scrollSpeed,
7210								complete: function(){
7211									UNCODE.scrolling = false;
7212									if ( !filterTolerance ) {
7213										filter_timeout = setTimeout(function(){
7214											clearTimeout(filter_timeout);
7215											filter_items();
7216										}, 200);
7217									}
7218								}
7219							});
7220						}
7221					}
7222				} else {
7223					filter_items();
7224				}
7225			}
7226			evt.preventDefault();
7227		});
7228
7229		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7230			var params = UNCODE.getURLParams(window.location);
7231			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7232
7233			UNCODE.lastURL = window.location.href;
7234
7235			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
7236				return;
7237			}
7238
7239			if (params.id === undefined) {
7240				$.each($('.cssgrid-system'), function(index, val) {
7241					loadCssGrid($(val));
7242				});
7243			} else {
7244				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7245					loadCssGrid($('#' + params.id));
7246				}
7247			}
7248		});
7249
7250		var loadCssGrid = function($href, $paginating) {
7251			var is_paginating = false;
7252
7253			if (undefined !== $paginating && $paginating) {
7254				var is_paginating = $paginating;
7255			}
7256
7257			var href = ($href.is("a") ? $href.attr('href') : location),
7258				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7259				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7260				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7261				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7262				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7263				cssgridId = cssgridSystem.attr('id');
7264			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7265				UNCODE.lastURL = href;
7266				history.pushState({
7267					myCSSgrid: true
7268				}, document.title, href);
7269			}
7270			cssgridWrapper.addClass('cssgrid-loading');
7271			if (is_paginating) {
7272				cssgridWrapper.addClass('grid-filtering');
7273			}
7274			$.ajax({
7275				url: href
7276			}).done(function(data) {
7277				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7278					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7279					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7280				requestTimeout(function() {
7281					cssgridContainer.html($resultItems);
7282					cssgridWrapper.removeClass('cssgrid-loading');
7283					cssgridWrapper.removeClass('grid-filtering');
7284					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7285					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7286					UNCODE.adaptive();
7287					if (SiteParameters.dynamic_srcset_active === '1') {
7288						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7289					}
7290					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7291						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7292						if (typeof getLightbox === 'object') {
7293							getLightbox.refresh();
7294						} else {
7295							UNCODE.lightbox();
7296						}
7297					}
7298					cssgridContainer.trigger('more-items-loaded');
7299					$(window).trigger('more-items-loaded');
7300					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7301				}, 300);
7302
7303				$('.pagination', cssgridFooter).remove();
7304				cssgridFooter.append($resultPagination);
7305
7306				if (cssgridResultCount.length > 0) {
7307					$('.woocommerce-result-count', cssgridResultCount).remove();
7308					cssgridResultCount.append($resultCount);
7309				}
7310			});
7311		};
7312
7313		$filters.each(function(i, buttonGroup) {
7314			var $buttonGroup = $(buttonGroup);
7315			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7316				$buttonGroup.find('.active').removeClass('active');
7317				$(this).addClass('active');
7318
7319			});
7320
7321			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7322				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7323				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7324			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7325				e.preventDefault();
7326				$cats_filters.slideToggle(400, 'easeInOutCirc');
7327			});
7328
7329		});
7330	};
7331};
7332
7333UNCODE.linearGrid = function(){
7334	$('.linear-wrapper').each(function(){
7335		var $wrap = $(this),
7336			$system = $wrap.closest('.linear-system'),
7337			$dragger = $('[data-dragger]', $system),
7338			$row = $wrap.closest('.vc_row[data-parent]'),
7339			_row = $row[0],
7340			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7341			vertical = $cont.hasClass('linear-or-vertical'),
7342			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7343			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7344			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7345			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7346			isInViewport = false,
7347			isHover = false,
7348			init = false,
7349			stableHeight = UNCODE.wheight,
7350			wCont, hCont, docH, marqueeTL;
7351
7352		if ( ! $('.tmb', $cont).length ) {
7353			return;
7354		}
7355
7356		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7357		var dataX = dataSpeed;
7358
7359		dataSpeed += 5;
7360
7361		var checkLinearGridSize = function(){
7362			if ( !$wrap.is(':visible') )  {
7363				return;
7364			}
7365			$wrap.find('.cont-appended').remove();
7366
7367			if ( vertical ) {
7368				if ( ! SiteParameters.is_frontend_editor ) {
7369					hCont = $cont.outerHeight();
7370					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7371					if ( hCont < docH ) {
7372						var res = docH - hCont * 3,
7373							times = 2 * Math.round((res/hCont+1) / 2);
7374					}
7375					for ( var i = 0; i < times; i++ ) {
7376						var $cloneCont = $cont.clone(),
7377							$cloneCont2 = $cont.clone(),
7378							trans = ( (i+2) ) * 100;
7379						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7380						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7381						$cloneCont.find('a[data-lbox]').each(function(){
7382							var dataLbox = $(this).attr('data-lbox');
7383							$(this).attr('data-lbox', dataLbox + '_' + i);
7384						});
7385						$cloneCont.find('.wp-video-shortcode').each(function(){
7386							var thisID = $(this).attr('id');
7387							$(this).attr('id', thisID + '_' + i);
7388						});
7389						$cloneCont2.find('a[data-lbox]').each(function(){
7390							var dataLbox = $(this).attr('data-lbox');
7391							$(this).attr('data-lbox', dataLbox + '_2' + i);
7392						});
7393						$cloneCont2.find('.wp-video-shortcode').each(function(){
7394							var thisID = $(this).attr('id');
7395							$(this).attr('id', thisID + '__' + i);
7396						});
7397						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7398							UNCODE.lightgallery($cloneCont);
7399							UNCODE.lightgallery($cloneCont2);
7400						}
7401					}
7402                }
7403			} else {
7404				wCont = $cont.outerWidth();
7405				if ( (wCont) < UNCODE.wwidth*2 ) {
7406					var res = UNCODE.wwidth*2 - (wCont),
7407						times = 2 * Math.round((res/wCont+1) / 2);
7408				}
7409				for ( var i = 0; i < times; i++ ) {
7410					var $cloneCont = $cont.clone(),
7411						$cloneCont2 = $cont.clone(),
7412						trans = ( (i+2) ) * 100;
7413					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7414					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7415					$cloneCont.find('a[data-lbox]').each(function(){
7416						var dataLbox = $(this).attr('data-lbox');
7417						$(this).attr('data-lbox', dataLbox + '_' + i);
7418					});
7419					$cloneCont.find('[id]').each(function(){
7420						var thisID = $(this).attr('id');
7421						$(this).attr('id', thisID + '_' + i);
7422					});
7423					$cloneCont2.find('a[data-lbox]').each(function(){
7424						var dataLbox = $(this).attr('data-lbox');
7425						$(this).attr('data-lbox', dataLbox + '_2' + i);
7426					});
7427					$cloneCont2.find('[id]').each(function(){
7428						var thisID = $(this).attr('id');
7429						$(this).attr('id', thisID + '__' + i);
7430					});
7431                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
7432                        UNCODE.lightgallery($cloneCont);
7433                        UNCODE.lightgallery($cloneCont2);
7434                    }
7435                }
7436			}
7437		};
7438		if ( clone ) {
7439			checkLinearGridSize();
7440			$(window).on('resize.linearGrid', function(){
7441				checkLinearGridSize();
7442			});
7443		}
7444
7445		var continuousLinearMarquee = function(_xStrt){
7446			if ( !$wrap.is(':visible') )  {
7447				return;
7448			}
7449			var ease = 'none';
7450			wCont = $cont.outerWidth();
7451			hCont = $cont.outerHeight();
7452
7453			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
7454				xEnd = vertical ? hCont : wCont,
7455				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7456				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
7457				speedSlow = (xEnd + xStrt) / 45,
7458				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7459
7460			marqueeTL = new TimelineMax({paused:true, reversed:true});
7461
7462			if ( isInViewport && !isHover && !freezed ) {
7463				marqueeTL.play();
7464
7465				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
7466					var $column = $wrap.closest('.wpb_column'),
7467						$col_link = $('.col-link', $column),
7468						$hover_sel = $wrap;
7469
7470					if ( $col_link.length ) {
7471						$hover_sel = $wrap.add($column);
7472					}
7473
7474					$hover_sel.on('mouseover', function(){
7475						if ( $wrap.attr('data-hover') === 'yes' ) {
7476							//speed = ( 10 - dataSpeed ) * 5;
7477							ease = 'power2.out';
7478							marqueeTL.duration( speedSlow );
7479						} else {
7480							marqueeTL.pause();
7481						}
7482						isHover = true;
7483					}).on('mouseout', function(){
7484						if ( $wrap.attr('data-hover') === 'yes' ) {
7485							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
7486							ease = 'power2.in';
7487							marqueeTL.duration( speed );
7488						} else {
7489							marqueeTL.play();
7490						}
7491						isHover = false;
7492					});
7493				}
7494
7495			}
7496	
7497			gsap.killTweensOf($wrap);
7498			if ( vertical ) {
7499				marqueeTL.fromTo( $wrap, {
7500					y: xStrt * direction
7501				},
7502				{
7503					duration: speed,
7504					y: xEnd * direction * -1,
7505					onComplete: function(){
7506						continuousLinearMarquee();
7507					},
7508					ease: ease,
7509					paused: freezed
7510				});
7511			} else {
7512				marqueeTL.fromTo( $wrap, {
7513					x: xStrt * direction
7514				},
7515				{
7516					duration: speed,
7517					x: xEnd * direction * -1,
7518					onComplete: function(){
7519						continuousLinearMarquee();
7520					},
7521					ease: ease,
7522					paused: freezed
7523				});
7524			}
7525		};
7526
7527		var dragLinearContinuous = function(){
7528			if ( !$wrap.is(':visible') )  {
7529				return;
7530			}
7531			var matrix, _x, _y,
7532				dragAction = false;
7533			Draggable.create($wrap[0], {
7534				type: vertical ? "y" : "x",
7535				bounds: document.getElementById("container"),
7536				inertia: false,
7537				onPress: function (e) {
7538				},
7539				onRelease: function (e) {
7540					if ( dragAction === true ) {
7541						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7542						_x = matrix[12] || matrix[4];
7543						_y = matrix[13] || matrix[5];
7544						if ( vertical ) {
7545							continuousLinearMarquee(_y * -1);
7546						} else {
7547							continuousLinearMarquee(_x * -1);
7548						}
7549						$wrap.removeClass('linear-dragging');
7550					}
7551				},
7552				onDrag: function (e) {
7553					dragAction = true;
7554					$wrap.addClass('linear-dragging');
7555				},
7556				onDragEnd: function (e) {
7557					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7558					_x = matrix[12] || matrix[4];
7559					_y = matrix[13] || matrix[5];
7560					wCont = $cont.outerWidth();
7561					hCont = $cont.outerHeight();
7562					if ( vertical ) {
7563						if ( Math.abs(_y) > hCont ) {
7564							if ( _y < 0 ) {
7565								_y = hCont + parseFloat( _y );
7566							} else {
7567								_y = parseFloat( _y ) - hCont;
7568							}
7569						}
7570						continuousLinearMarquee(_y * -1);
7571					} else {
7572						if ( Math.abs(_x) > wCont ) {
7573							if ( _x < 0 ) {
7574								_x = wCont + parseFloat( _x );
7575							} else {
7576								_x = parseFloat( _x ) - wCont;
7577							}
7578						}
7579						continuousLinearMarquee(_x * -1);
7580					}
7581					$wrap.removeClass('linear-dragging');
7582					dragAction = false;
7583				},
7584			});
7585		};
7586
7587		var runScrollLinear = function(){
7588			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7589			if ( !$wrap.is(':visible') || freezed )  {
7590				return;
7591			}
7592			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7593				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
7594			
7595			var linearGridScroll = function(){
7596				if ( isInViewport ) {
7597					var bound = _row.getBoundingClientRect();
7598
7599					var bound_top = bound.top,
7600						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
7601
7602					if ( vertical ) {
7603						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7604					} else {
7605						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7606					}
7607					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7608						requestAnimationFrame(linearGridScroll);
7609					}
7610				}
7611				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
7612					window.addEventListener("scroll", linearGridScroll);
7613				}
7614			};
7615
7616			$(window).on( 'load wwResize', function(e) {
7617				stableHeight = UNCODE.wheight;
7618				linearGridScroll();
7619			});
7620			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7621				requestAnimationFrame(linearGridScroll);
7622			}
7623		};
7624		
7625		var dragLinear = function(){
7626			if ( !$wrap.is(':visible') )  {
7627				return;
7628			}
7629			var matrix, _x, _y;
7630			Draggable.create($dragger[0], {
7631				type: vertical ? "y" : "x",
7632				bounds: document.getElementById("container"),
7633				inertia: false,
7634				onPress: function (e) {
7635				},
7636				onRelease: function (e) {
7637				},
7638				onDrag: function (e) {
7639					$wrap.addClass('linear-dragging');
7640				},
7641				onDragEnd: function (e) {
7642					matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7643					_x = matrix[12] || matrix[4];
7644					_y = matrix[13] || matrix[5];
7645					wCont = $cont.outerWidth();
7646					hCont = $cont.outerHeight();
7647					if ( vertical ) {
7648						if ( Math.abs(_y) > hCont ) {
7649							if ( _y < 0 ) {
7650								_y = hCont + parseFloat( _y );
7651							} else {
7652								_y = parseFloat( _y ) - hCont;
7653							}
7654							gsap.to( $dragger[0], {
7655								duration: 0,
7656								y: _y,
7657							});
7658						}
7659					} else {
7660						if ( Math.abs(_x) > wCont ) {
7661							if ( _x < 0 ) {
7662								_x = wCont + parseFloat( _x );
7663							} else {
7664								_x = parseFloat( _x ) - wCont;
7665							}
7666							gsap.to( $dragger[0], {
7667								duration: 0,
7668								x: _x,
7669							});
7670						}
7671					}
7672					$wrap.removeClass('linear-dragging');
7673				},
7674			});
7675		};
7676
7677		if ( ! $('body').hasClass('compose-mode') ) {
7678			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
7679				continuousLinearMarquee();
7680				$(window).on( 'wwResize', function(e) {
7681					continuousLinearMarquee();
7682				});	
7683				if ( $wrap.attr('data-draggable') === 'yes' ) {
7684					dragLinearContinuous();
7685				}
7686			}
7687
7688			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7689				runScrollLinear();
7690				if ( $wrap.attr('data-draggable') === 'yes' ) {
7691					dragLinear();
7692				}
7693			}
7694
7695			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7696				var observer = new IntersectionObserver(function(entries) {
7697						
7698					entries.forEach(function(entry){
7699						if ( entry.isIntersecting ) {
7700							isInViewport = true;
7701							if ( !init ) {
7702								init = true;
7703								continuousLinearMarquee();
7704							} else {
7705								if ( typeof marqueeTL !== 'undefined' ) {
7706									marqueeTL.play();
7707								}
7708							}
7709							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7710								requestAnimFrame(runScrollLinear);
7711							}
7712						} else {
7713							isInViewport = false;
7714							if ( typeof marqueeTL !== 'undefined' ) {
7715								marqueeTL.pause();
7716							}
7717						}
7718					});
7719				}, { 
7720					root: document,
7721				});
7722
7723				observer.observe(_row);
7724
7725			} else {
7726
7727				var checkVisible = function( el, off ) {
7728					if (typeof jQuery === "function" && el instanceof jQuery) {
7729						el = el[0];
7730					}
7731			
7732					off = typeof off=='undefined' ? 50 : off;
7733			
7734					var rect = el.getBoundingClientRect();
7735			
7736					return (
7737						(
7738							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7739							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7740							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7741						)
7742					);
7743				};
7744				
7745				var checkVisibility = function(){
7746
7747					if ( checkVisible($row) ) {
7748						isInViewport = true;
7749						if ( typeof marqueeTL !== 'undefined' ) {
7750							marqueeTL.play();
7751						}
7752					} else {
7753						isInViewport = false;
7754						if ( typeof marqueeTL !== 'undefined' ) {
7755							marqueeTL.pause();
7756						}
7757					}
7758				}
7759
7760				window.addEventListener("scroll", checkVisibility);
7761				checkVisibility();
7762
7763			}
7764		}
7765	});
7766};
7767UNCODE.preventDoubleTransition = function() {
7768	$('.sticky-element .animate_when_almost_visible').each(function(){
7769		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
7770			$el.addClass('do_not_reanimate');
7771		});
7772	});
7773};
7774
7775UNCODE.checkScrollForTabs = function(){
7776	var goToSection = window.location.hash.replace('#', ''),
7777		$index;
7778
7779	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
7780	goToSection = encodeURIComponent(goToSection);
7781	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
7782
7783	$index.attr('data-parent', 'parent-' + goToSection);
7784
7785	if (window.location.hash != undefined && window.location.hash != '') {
7786		requestTimeout(function() {
7787			scrollBody('parent-' + goToSection);
7788		}, 500);
7789	}
7790
7791	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
7792		var hash = (e.currentTarget).hash,
7793			index = (e.currentTarget).closest('.uncode-tabs');
7794		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
7795			$('a[href="' + hash + '"][data-tab-history]').click();
7796			scrollBody(index);
7797		}
7798	});
7799
7800	var scrollBody = function(index) {
7801
7802		var getSection = $('a[href="' + index + '"][data-tab-history]'),
7803			scrollTo,
7804			safeGap = 27;
7805
7806		if ( ! getSection.length ) {
7807			getSection = $('div[data-parent="' + index + '"]');
7808
7809			if ( getSection.attr('data-target') == 'row' ) {
7810				getSection = getSection.closest('.vc_row');
7811				safeGap = 0;
7812			}
7813		}
7814
7815		if (typeof getSection === 'undefined' || ! getSection.length ) {
7816			return;
7817		}
7818
7819		var body = $("html, body"),
7820		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7821		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
7822		getOffset = UNCODE.get_scroll_offset();
7823		if ( typeof getSection.offset() === 'undefined' )
7824			return;
7825		scrollTo = getSection.offset().top - safeGap;
7826		scrollTo -= getOffset;
7827
7828		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7829		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7830
7831		if (index != 0) {
7832			UNCODE.scrolling = true;
7833		}
7834
7835		if (scrollSpeed == 0) {
7836			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
7837			UNCODE.scrolling = false;
7838		} else {
7839			body.animate({
7840				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
7841			}, scrollSpeed, 'easeInOutQuad', function() {
7842				requestTimeout(function() {
7843					UNCODE.scrolling = false;
7844					if (getOffset != UNCODE.get_scroll_offset()) {
7845						scrollBody(index);
7846					}
7847				}, 100);
7848			});
7849		}
7850
7851	};
7852};
7853
7854UNCODE.printScreen = function() {
7855	var inlineMediaStyle = null,
7856		setResize;
7857
7858    function changeMediaStyle() {
7859		clearRequestTimeout(setResize);
7860		setResize = requestTimeout(function(){
7861	        var $head = document.getElementsByTagName('head')[0],
7862	        	$newStyle = document.createElement('style'),
7863	        	winW = window.innerWidth,
7864	        	printH = window.innerHeight;
7865
7866	        $newStyle.setAttribute('type', 'text/css');
7867	        $newStyle.setAttribute('media', 'print');
7868	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
7869
7870	        if (inlineMediaStyle != null) {
7871	            $head.replaceChild($newStyle, inlineMediaStyle)
7872	        } else {
7873	            $head.appendChild($newStyle);
7874	        }
7875	        inlineMediaStyle = $newStyle;
7876	    }, 1000);
7877    }
7878
7879    changeMediaStyle();
7880    window.addEventListener('resize', changeMediaStyle);
7881};
7882
7883UNCODE.fullPage = function() {
7884	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
7885		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
7886		return false;
7887	} else {
7888		requestTimeout(function() {
7889			window.scrollTo(0, 0);
7890		}, 10);
7891	}
7892
7893	var $masthead = $('#masthead'),
7894		$logo = $('#logo-container-mobile'),
7895		$logolink = $('[data-minheight]', $logo),
7896		logoMinScale = $logolink.data('minheight'),
7897		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
7898		$container = $('.main-container .post-content'),
7899		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
7900		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
7901		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
7902		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
7903		headerWithOpacity = $('.header-scroll-opacity', $header).length,
7904		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
7905		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
7906		scrollBar = true,
7907		effect,
7908		animationEndTimeOut,
7909		fp_anim_time = 900,
7910		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
7911		is_scrolling = false,
7912		dataNames = [],
7913		is_first = true,
7914		no_history = $('body').hasClass('uncode-scroll-no-history'),
7915		theres_footer = true;
7916
7917	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
7918		$('> div', $footer).each(function(index, el){
7919			if ( $(el).outerHeight() < 2 )
7920				theres_footer = false;
7921			else
7922				theres_footer = true;
7923		});
7924	}
7925
7926	if ( !$footer.length )
7927		theres_footer = false;
7928
7929	if ( !UNCODE.isFullPageSnap ) {
7930
7931		if ( $('body').hasClass('uncode-fullpage-zoom') )
7932			effect = 'scaleDown';
7933		else if ( $('body').hasClass('uncode-fullpage-parallax') )
7934			effect = 'moveparallax';
7935		else
7936			effect = 'movecurtain';
7937	}
7938
7939	if ( $('body').hasClass('uncode-fullpage-trid') )
7940		fp_anim_time = fp_anim_time*2;
7941
7942	if ( $header.length ) {
7943		if ( headerName !== '' )
7944			$header.attr('data-name', headerName);
7945		if ( headerLabel !== '' )
7946			$header.attr('data-label', headerLabel);
7947		$container.prepend($header);
7948	}
7949	if ( theres_footer ) {
7950		$container.append($footer);
7951		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
7952		$('aside.widget ul', $footer).addClass('no-list');
7953	}
7954
7955	var $all = $rows.add($header);
7956
7957	if ( theres_footer )
7958		$all = $all.add($footer);
7959
7960	$all.each(function(index, row) {
7961		if( index === 0 )
7962			$(row).addClass('uncode-scroll-active');
7963	});
7964
7965    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
7966
7967	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
7968		$("<ul class='onepage-pagination'></ul>").prependTo("body");
7969	}
7970
7971	$all.each(function(index, val) {
7972		var getName = $(val).data('name'),
7973			label;
7974
7975		if (typeof getName == 'undefined' || getName == 'undefined')
7976			getName = SiteParameters.slide_name + '-' + index;
7977
7978		//if ( dataNames.includes(getName) ) {
7979		if ( dataNames.indexOf(getName) > 0 ) {
7980			getName += '_' + index;
7981			$(val).data('name', getName);
7982		}
7983
7984		dataNames.push(getName);
7985
7986		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
7987
7988		if (typeof $(val).attr('data-label') !== 'undefined')
7989			label = $(val).attr('data-label');
7990		else label = '';
7991
7992		if ( $(val).is($footer) )
7993			return;
7994
7995		if (label != '' ) {
7996			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
7997			$('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>");
7998		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
7999			$('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>");
8000		}
8001	});
8002
8003	var checkVisible = function( el, off ) {
8004		if (typeof jQuery === "function" && el instanceof jQuery) {
8005			el = el[0];
8006		}
8007
8008		off = typeof off=='undefined' ? 50 : off;
8009
8010		var rect = el.getBoundingClientRect();
8011
8012		return (
8013			(
8014				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8015				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8016				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8017			)
8018		);
8019	};
8020
8021	var animationEndAction = function( index, nextIndex ) {
8022		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8023			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8024			player, iframe;
8025
8026		if ( !$nextSlide.is($footer) ) {
8027			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
8028		}
8029
8030		if ( !UNCODE.isFullPageSnap ) {
8031			activateKBurns( nextIndex );
8032		}
8033
8034		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8035			if ($(this).attr('data-provider') == 'vimeo') {
8036				iframe = $(this).find('iframe');
8037				player = new Vimeo.Player(iframe[0]);
8038				player.pause();
8039			} else if ($(this).attr('data-provider') == 'youtube') {
8040				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8041			} else {
8042				if ($(this).is('video')) {
8043					$(this)[0].volume = 0;
8044					$(this)[0].pause();
8045				}
8046			}
8047		});
8048
8049		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8050			if ( $nextSlide.is($header) )
8051				$header.removeClass('header-scrolled');
8052		}
8053
8054		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
8055		$otherEl.each(function(){
8056			var $otherThis = $(this),
8057				$bgwrapperOther = $('.background-inner', $otherThis);
8058			if ( !checkVisible($otherThis) )
8059				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
8060
8061		});
8062
8063		if ( !checkVisible($currentSlide) ) {
8064			$currentSlide.removeClass('uncode-scroll-visible');
8065			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
8066			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
8067				currentScroll.scrollTo(0, 0, 0);
8068		}
8069
8070		clearRequestTimeout(animationEndTimeOut);
8071		animationEndTimeOut = requestTimeout(function(){
8072			Waypoint.refreshAll();
8073			$( document.body ).trigger('uncode_waypoints');
8074			var eventFP = new CustomEvent('fp-slide-changed');
8075			window.dispatchEvent(eventFP);
8076			is_scrolling = false;
8077
8078			if ( is_first ) {
8079				$('ul.onepage-pagination a').removeClass('is-selected');
8080				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8081				is_first = false;
8082			}
8083
8084		}, 500);
8085	};
8086
8087	var postLeaveActions = function( nextIndex ){
8088		if ( menuHidden && ! UNCODE.isMobile )
8089			return false;
8090
8091		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8092			$cols = $('.uncol', $el),
8093			anchor = $el.data('anchor');
8094
8095		if ( ! UNCODE.isFullPageSnap ) {
8096			$.each($cols, function(index, val){
8097				if ( $(val).hasClass('style-light') ){
8098					$masthead.removeClass('style-dark-override').addClass('style-light-override');
8099					return false;
8100				} else if ( $(val).hasClass('style-dark') ) {
8101					$masthead.removeClass('style-light-override').addClass('style-dark-override');
8102					return false;
8103				}
8104			});
8105		}
8106
8107		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
8108			$('.menu-item' ).removeClass('active');
8109			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8110		}
8111
8112		if ( !UNCODE.isFullPageSnap ) {
8113			activateBackWash( nextIndex );
8114		}
8115	};
8116
8117	var activateBackWash = function( nextIndex ){
8118		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8119			$bgwrapper;
8120
8121		if ( $el.length ) {
8122			if ( $el.hasClass('with-zoomout') ) {
8123				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8124			} else if ( $('.with-zoomout', $el).length ) {
8125				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
8126			} else {
8127				return false;
8128			}
8129		} else {
8130			return false;
8131		}
8132
8133		$bgwrapper.addClass('uncode-zoomout');
8134
8135	};
8136
8137	var activateKBurns = function( nextIndex ){
8138		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8139			$bgwrapper;
8140
8141		if ( $el.length ) {
8142			if ( $el.hasClass('with-kburns') ) {
8143				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8144			} else if ( $('.with-kburns', $el).length ) {
8145				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
8146			} else {
8147				return false;
8148			}
8149		} else {
8150			return false;
8151		}
8152
8153		$bgwrapper.addClass('uncode-kburns');
8154
8155	};
8156
8157	var activateParallax = function( nextIndex, direction ){
8158
8159		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8160			$cell = $('.fp-tableCell', $el),
8161			animationEnd = 'webkitAnimationEnd animationend',
8162			cellAnim;
8163
8164		switch( direction ) {
8165			case 'up':
8166				cellAnim = 'moveFromTopInner';
8167				break;
8168			default:
8169				cellAnim = 'moveFromBottomInner';
8170		}
8171
8172		$cell.css({
8173			'animation-name': cellAnim,
8174			'animation-duration': fp_anim_time + 'ms',
8175			'animation-delay': '',
8176			'animation-timing-function': fp_easing,
8177			'animation-fill-mode': 'both',
8178		}).off(animationEnd)
8179		.on(animationEnd, function(event) {
8180			if ( event.originalEvent.animationName === cellAnim ) {
8181				$cell
8182					.css({
8183						'animation-name': '',
8184						'animation-duration': '',
8185						'animation-delay': '',
8186						'animation-timing-function': '',
8187						'animation-fill-mode': '',
8188					});
8189			}
8190		});
8191	};
8192
8193	var scrollHashes = function(){
8194		var hash = window.location.hash.replace('#', '').split('/'),
8195			hashInd;
8196		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
8197			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
8198				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
8199				$.fn.fullpage.moveTo(hashInd+1);
8200			}
8201		} else if( hash[0] === '' ) {
8202			$.fn.fullpage.moveTo(1);
8203		}
8204	};
8205
8206	var hideMenu = function( index, nextIndex ){
8207		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
8208			return false;
8209
8210		var hMenu = UNCODE.menuHeight,
8211			transTime = hMenu * 2;
8212
8213		if ( index === 1 && nextIndex > 1 ) {
8214			hMenu = hMenu * -1;
8215		} else if  ( index !== 1 && nextIndex === 1 ) {
8216			hMenu = 0;
8217		} else {
8218			return false;
8219		}
8220
8221		$masthead.css({
8222			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8223			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8224			'-webkit-transition': 'transform 0.5s ease-in-out',
8225			'transition': 'transform 0.5s ease-in-out'
8226		});
8227	};
8228
8229	var shrinkMenu = function( index, nextIndex ){
8230		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
8231			return false;
8232
8233		if ( index === 1 && nextIndex > 1 ) {
8234			$logo.addClass('shrinked');
8235			$('div', $logo).each(function(index, val){
8236				$(val).css({
8237					'height': logoMinScale,
8238					'line-height': logoMinScale
8239				});
8240				if ($(val).hasClass('text-logo')) {
8241					$(val).css({
8242						'font-size': logoMinScale + 'px'
8243					});
8244				}
8245			});
8246			requestTimeout(function() {
8247				UNCODE.menuMobileHeight = $masthead.outerHeight();
8248			}, 300);
8249		} else if ( index !== 1 && nextIndex === 1 ) {
8250			$logo.removeClass('shrinked');
8251			$('div', $logo).each(function(index, val){
8252				$(val).css({
8253					'height': logoMaxScale,
8254					'line-height': logoMaxScale
8255				});
8256				if ($(val).hasClass('text-logo')) {
8257					$(val).css({
8258						'font-size': logoMaxScale + 'px'
8259					});
8260				}
8261			});
8262			requestTimeout(function() {
8263				UNCODE.menuMobileHeight = $masthead.outerHeight();
8264			}, 300);
8265		} else {
8266			return false;
8267		}
8268
8269	};
8270
8271	var anchorLink = function(){
8272
8273		$container.add('.menu-item').find('a[href*="#"]').on('click', function(e) {
8274			var $this = $(e.currentTarget),
8275				hash = e.currentTarget.href.split('#'),
8276				current = window.location.href.split('#'),
8277				ind,
8278				currentMenuOpened = UNCODE.menuOpened,
8279				go = false;
8280
8281			var hash_url = hash[0].replace(/\/?$/, '/'),
8282				current_url = current[0].replace(/\/?$/, '/');
8283
8284			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
8285				hash = '#'+hash[1];
8286				e.preventDefault();
8287				go = true;
8288			}
8289
8290			if ( go ) {
8291
8292				if ( $(hash).length ) {
8293					ind = $(hash).closest('.fp-section').index();
8294				} else {
8295					hash = hash.slice(1);
8296					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
8297				}
8298
8299				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
8300					ind = $this.closest('.fp-section').index();
8301
8302				UNCODE.menuOpened = false;
8303
8304				$.fn.fullpage.moveTo(ind+1);
8305
8306				UNCODE.menuOpened = currentMenuOpened;
8307				if (UNCODE.menuOpened) {
8308					if (UNCODE.wwidth < UNCODE.mediaQuery) {
8309						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
8310					} else {
8311						$('.mmb-container-overlay .overlay-close').trigger('click');
8312						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
8313					}
8314				}
8315
8316			}
8317
8318		});
8319
8320		$('.header-scrolldown').on('click', function(event) {
8321			event.preventDefault();
8322			var scrollDown = $(this),
8323				ind = scrollDown.closest('.fp-section').index();
8324
8325			$.fn.fullpage.moveTo(ind+2);
8326		});
8327
8328		var anchor = $('.fp-section.active').data('anchor');
8329
8330		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
8331			$('.menu-item').removeClass('active');
8332			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8333		}
8334
8335	};
8336
8337	var slideLeave = function( index, nextIndex, direction ) {
8338		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8339			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8340			animationEnd = 'webkitAnimationEnd animationend',
8341			transitionEnd = 'webkitTransitionEnd transitionend',
8342			animOut = effect != 'scaleDown' ? effect + direction : effect,
8343			animIn,
8344			isFooter = false,
8345			isFooterNext = false,
8346			footerH = $footer.outerHeight(),
8347			timeout,
8348			player, iframe,
8349			footerCoeff;
8350		switch( direction ) {
8351			case 'up':
8352				animIn = 'moveFromTop';
8353				break;
8354			default:
8355				animIn = 'moveFromBottom';
8356		}
8357
8358		if ( $('body').hasClass('uncode-fullpage-trid') ) {
8359			animOut = animIn + 'trid';
8360			animIn = animOut + 'In';
8361		} else if ( UNCODE.isFullPageSnap ) {
8362			animIn = animOut = 'none';
8363		}
8364
8365		hideMenu(index, nextIndex);
8366		shrinkMenu(index, nextIndex);
8367
8368		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8369			if ($(this).attr('data-provider') == 'vimeo') {
8370				iframe = $(this).find('iframe');
8371				player = new Vimeo.Player(iframe[0]);
8372				player.pause();
8373			} else if ($(this).attr('data-provider') == 'youtube') {
8374				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8375			} else {
8376				if ($(this).is('video')) {
8377					$(this)[0].volume = 0;
8378					$(this)[0].pause();
8379				}
8380			}
8381		});
8382
8383		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
8384			if ($(this).attr('data-provider') == 'vimeo') {
8385				iframe = $(this).find('iframe');
8386				iframe.on('load', function(){
8387					player = new Vimeo.Player(iframe);
8388					player.setVolume(0);
8389					player.play();
8390				});
8391				player = new Vimeo.Player(iframe);
8392				player.setVolume(0);
8393				player.play();
8394			} else if ($(this).attr('data-provider') == 'youtube') {
8395				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
8396			} else {
8397				if ($(this).is('video')) {
8398					$(this)[0].volume = 0;
8399					$(this)[0].play();
8400				}
8401			}
8402		});
8403
8404		if ( $currentSlide.is($footer) )
8405			isFooter = true;
8406
8407		if ( $nextSlide.is($footer) )
8408			isFooterNext = true;
8409
8410		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8411			if ( $currentSlide.is($header) )
8412				$header.addClass('header-scrolled');
8413		}
8414
8415		footerCoeff = footerH;
8416
8417		if ( UNCODE.isFullPageSnap ) {
8418			postLeaveActions( nextIndex );
8419			activateBackWash( nextIndex );
8420			activateKBurns( nextIndex );
8421			requestTimeout(function(){
8422				animationEndAction( index, nextIndex );
8423			}, fp_anim_time+150);
8424		} else {
8425			if ( isFooterNext ) {
8426
8427				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
8428				$iscrollWrapper.addClass('no-scrolloverflow');
8429
8430				$nextSlide
8431				.add($currentSlide)
8432				.addClass('uncode-scroll-front')
8433				.addClass('uncode-scroll-active')
8434				.addClass('uncode-scroll-visible');
8435				$container.css({
8436					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8437					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8438					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8439					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8440				}).off(transitionEnd)
8441				.one(transitionEnd, function(){
8442					animationEndAction( index, nextIndex );
8443				});
8444
8445			} else if ( isFooter ) {
8446
8447				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
8448				.add($currentSlide)
8449				.addClass('uncode-scroll-front')
8450				.addClass('uncode-scroll-active')
8451				.addClass('uncode-scroll-visible');
8452				$container.css({
8453					'-webkit-transform': 'translate3d(0, 0, 0)',
8454					'transform': 'translate3d(0, 0, 0)',
8455					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8456					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8457				})
8458				.one(transitionEnd, function(){
8459					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
8460						clearRequestTimeout(timeout);
8461						timeout = requestTimeout(function(){
8462							$.fn.fullpage.moveTo(nextIndex);
8463							slideLeave( index-1, nextIndex, 'up' );
8464							$container.off(transitionEnd);
8465						}, 50);
8466					}
8467					animationEndAction( index, nextIndex );
8468				});
8469
8470			} else {
8471
8472				postLeaveActions( nextIndex );
8473
8474				if ( !$('body').hasClass('uncode-fullpage-trid') )
8475					activateParallax( nextIndex, direction );
8476
8477				var $outBg = $('.background-wrapper', $currentSlide);
8478
8479				$nextSlide
8480				.addClass('uncode-scroll-front')
8481				.addClass('uncode-scroll-active')
8482				.addClass('uncode-scroll-visible')
8483				.addClass('uncode-scroll-animating-in')
8484				.css({
8485					'z-index':4,
8486					'animation-name': animIn,
8487					'animation-duration': fp_anim_time + 'ms',
8488					'animation-delay': '',
8489					'animation-timing-function': fp_easing,
8490					'animation-fill-mode': 'both',
8491					'transition': 'initial',
8492				}).off(animationEnd)
8493				.on(animationEnd, function(event) {
8494					if ( event.originalEvent.animationName === animIn ) {
8495						$(this)
8496							.addClass('uncode-scroll-already')
8497							.removeClass('uncode-scroll-front')
8498							.removeClass('uncode-scroll-animating-in')
8499							.css({
8500								'animation-name': '',
8501								'animation-duration': '',
8502								'animation-delay': '',
8503								'animation-timing-function': '',
8504								'animation-fill-mode': '',
8505								'transition': 'initial',
8506							});
8507
8508						$currentSlide
8509							.removeClass('uncode-scroll-active')
8510							.add($outBg)
8511							.css({
8512								'animation-name': '',
8513								'animation-duration': '',
8514								'animation-delay': '',
8515								'animation-timing-function': '',
8516								'animation-fill-mode': '',
8517								'transition': 'initial',
8518							});
8519
8520						animationEndAction( index, nextIndex );
8521
8522					}
8523
8524					if ( nextIndex > 1 )
8525						$('body').addClass('window-scrolled');
8526					else
8527						$('body').removeClass('window-scrolled');
8528				});
8529
8530				$currentSlide
8531					.addClass('uncode-scroll-animating-out')
8532					.removeClass('uncode-scroll-front')
8533					.css({
8534						'z-index':'1',
8535						'animation-name': animOut,
8536						'animation-duration': fp_anim_time + 'ms',
8537						'animation-delay': '',
8538						'animation-timing-function': fp_easing,
8539						'animation-fill-mode': 'both',
8540						'transition': 'initial',
8541						'will-change': 'auto'
8542					}).off(animationEnd)
8543					.on(animationEnd, function(event) {
8544						if ( event.originalEvent.animationName === animOut ) {
8545							$currentSlide.removeClass('uncode-scroll-animating-out');
8546						}
8547					});
8548
8549				if ( $('body').hasClass('uncode-fp-opacity') ) {
8550					$currentSlide.find('> div').css({
8551						'animation-name': 'opacityout',
8552						'animation-duration': fp_anim_time + 'ms',
8553						'animation-delay': '',
8554						'animation-timing-function': fp_easing,
8555						'animation-fill-mode': 'both',
8556						'transition': 'initial',
8557					}).off(animationEnd)
8558					.on(animationEnd, function(event) {
8559						if ( event.originalEvent.animationName === 'opacityout' ) {
8560							$(event.currentTarget).css({
8561								'animation-name': '',
8562								'animation-duration': '',
8563								'animation-delay': '',
8564								'animation-timing-function': '',
8565								'animation-fill-mode': '',
8566								'transition': '',
8567							});
8568						}
8569					});
8570				}
8571			}
8572		}
8573
8574		$('.scroll-top').on('click', function(e){
8575			$.fn.fullpage.moveTo(1);
8576			return false;
8577		});
8578
8579	};
8580
8581	var init_fullPage = function(mode){
8582
8583		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
8584		// 	scrollBar = false;
8585		// }
8586
8587		var checkFPeffects;
8588
8589		$container.fullpage({
8590			sectionSelector: '.uncode-scroll-lock',
8591			scrollOverflow: true,
8592			scrollOverflowOptions: {
8593				click: false,
8594				preventDefaultException: { tagName:/.*/ }
8595			},
8596			navigation: false,
8597			scrollBar: scrollBar,
8598			scrollingSpeed: fp_anim_time,
8599			verticalCentered: true,
8600			anchors: no_history ? false : dataNames,
8601			recordHistory: !no_history,
8602			afterRender: function(){
8603				$('body').removeClass('fp-waiting');
8604				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
8605					var $invisible = $(this).addClass('hidden-scroll');//,
8606				});
8607				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
8608					var $visible = $(this).addClass('uncode-scroll-visible'),
8609						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
8610					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
8611				});
8612
8613				$('ul.onepage-pagination a').on('click', function(e){
8614					e.preventDefault();
8615					var $a = $(this),
8616						toIndex = $a.data('index');
8617
8618					$.fn.fullpage.moveTo(toIndex+1);
8619				});
8620
8621				requestTimeout(function(){
8622					scrollHashes();
8623				}, 1000);
8624
8625				$(window).on('hashchange', function(e){
8626					requestTimeout(function(){
8627						scrollHashes();
8628					}, 500);
8629				});
8630
8631				anchorLink();
8632
8633				if ( $('body').hasClass('uncode-fp-opacity') ) {
8634					$all.each(function(index, row) {
8635						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
8636							classBg;
8637
8638						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
8639							classBg = testmatch[0];
8640							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
8641						}
8642					});
8643				}
8644
8645				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
8646					$(window).on('menuOpen gdprOpen', function(){
8647						$.fn.fullpage.setAutoScrolling(false);
8648					}).on('menuClose gdprClose', function(){
8649						$.fn.fullpage.setAutoScrolling(true);
8650					});
8651				}
8652
8653				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
8654					requestTimeout(function(){
8655						$.fn.fullpage.setAutoScrolling(false);
8656					}, 1000);
8657				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
8658					$.fn.fullpage.setAutoScrolling(true);
8659				});
8660
8661				if ( !UNCODE.isFullPageSnap ) {
8662					clearRequestTimeout(checkFPeffects);
8663					checkFPeffects = requestTimeout(function(){
8664						activateBackWash( 1 );
8665						activateKBurns( 1 );
8666					}, 100);
8667				}
8668
8669			},
8670			onLeave: function( index, nextIndex, direction ){
8671
8672				if ( UNCODE.menuOpened || is_scrolling )
8673					return false;
8674
8675				is_scrolling = true;
8676
8677				var event = new CustomEvent('fp-slide-leave');
8678				window.dispatchEvent(event);
8679
8680				slideLeave( index, nextIndex, direction );
8681
8682				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
8683					if ( direction === 'up' ) {
8684						$.fn.fullpage.moveTo(nextIndex-1);
8685					} else {
8686						$.fn.fullpage.moveTo(nextIndex+1);
8687					}
8688					return false;
8689				}
8690
8691				$('ul.onepage-pagination a').removeClass('is-selected');
8692				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8693
8694			}
8695		});
8696	};
8697
8698	init_fullPage();
8699	$(window).on('load', function(){
8700		requestTimeout(function(){
8701			$.fn.fullpage.reBuild();
8702		}, 3000);
8703	});
8704
8705	var addScrollingClass,
8706		removeScrollingClass;
8707
8708	window.addEventListener("fp-slide-scroll", function(){
8709		addScrollingClass = requestTimeout( function(){
8710			$('body').addClass('fp-slide-scrolling');
8711		}, 10 );
8712
8713		clearRequestTimeout(removeScrollingClass);
8714		removeScrollingClass = requestTimeout( function(){
8715			$('body').removeClass('fp-slide-scrolling');
8716		}, 150 );
8717
8718		Waypoint.refreshAll();
8719	}, false);
8720
8721	var setFPheight = function(){
8722		var $body = document.body,
8723			$footer = document.getElementById('colophon'),
8724			$maincontainer = document.querySelector('.main-wrapper'),
8725			$boxcontainer = document.querySelector('.box-container'),
8726			$sections = document.querySelectorAll('.fp-section'),
8727			rect = $maincontainer.getBoundingClientRect(),
8728			rect2 = $boxcontainer.getBoundingClientRect(),
8729			$masthead = document.getElementById('masthead'),
8730			_hideMenu = false,
8731			menuHeight = UNCODE.menuHeight;
8732		$body.style.height = UNCODE.wheight + 'px';
8733
8734		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
8735			_hideMenu = true;
8736		}
8737		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
8738			menuHeight = 0
8739		}
8740
8741
8742		if ( theres_footer )
8743			$footer.style.top = (rect.height || rect2.height) + 'px';
8744
8745		for (var i = 0; i < $sections.length; i++) {
8746			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
8747		}
8748	};
8749
8750	setFPheight();
8751
8752	window.addEventListener('resize', setFPheight, false);
8753	window.addEventListener('orientationchange', setFPheight, false);
8754
8755};
8756
8757UNCODE.particles = function() {
8758	$(".vc-particles-background").each(function() {
8759		var $particle = $(this);
8760		var $parent = $particle.closest('[data-parent]');
8761
8762		$parent.prepend($particle);
8763		// $(window).trigger('resize');
8764	})
8765};
8766
8767
8768UNCODE.readMoreCol = function( $el ){
8769	if ( typeof $el === 'undefined' || $el === null ) {
8770		$el = $('body');
8771	}
8772	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
8773	$readMoreCols.each(function(){
8774		var $uncont = $(this),
8775			$row = $uncont.closest('.row-container'),
8776			max_h = $uncont.attr('data-ov-height'),
8777			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
8778			actual_max_h = $uncont.outerHeight(),
8779			inner_h,
8780			$read_more = $('+ .btn-more-wrap', $uncont),
8781			read_more_resize = $read_more.hasClass('trigger-resize'),
8782			marginClosedBtn = $uncont.attr('data-margin-closed'),
8783			marginClosed = 0,
8784			marginOpenBtn = $uncont.attr('data-margin-open'),
8785			marginOpen = 0,
8786			anim_t = 250,
8787			resized = false;
8788
8789		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
8790
8791		switch (marginClosedBtn) {
8792			case 'sm':
8793				marginClosed = 18
8794				break;
8795				
8796			case 'std':
8797				marginClosed = 36
8798				break;
8799				
8800			case 'lg':
8801				marginClosed = 72
8802				break;
8803				
8804			case '':
8805			default:
8806				marginClosed = 0
8807				break;
8808				
8809		}
8810
8811		switch (marginOpenBtn) {
8812			case 'sm':
8813				marginOpen = 18
8814				break;
8815				
8816			case 'std':
8817				marginOpen = 36
8818				break;
8819				
8820			case 'lg':
8821				marginOpen = 72
8822				break;
8823				
8824			case 'no':
8825				marginOpen = 0
8826				break;
8827				
8828		}
8829
8830		var checkToggleMobile = function(){
8831			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
8832				resized = true;
8833				if ( $read_more.hasClass('state-closed') ) {
8834					$uncont[0].style.height = '';
8835					$uncont[0].style.maxHeight = max_h_mobile;
8836				}
8837			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
8838				if ( $read_more.hasClass('state-closed') ) {
8839					$uncont[0].style.height = '';
8840					$uncont[0].style.maxHeight = max_h;
8841				}
8842				resized = false;
8843			}
8844		}
8845		checkToggleMobile();
8846		$(window).on('resize', function() {
8847			checkToggleMobile();
8848		});
8849
8850		$('a', $read_more).on('click', function(e){
8851			e.preventDefault();
8852
8853			var $a = $(this);
8854
8855			if ( $read_more.hasClass('state-closed') ) {
8856
8857				$read_more
8858					.removeClass('state-closed')
8859					.addClass('state-open');
8860
8861				$uncont.css({
8862					'max-height': 'none',
8863					'height': 'auto',
8864				});
8865	
8866				inner_h = parseFloat( $uncont.outerHeight() );
8867
8868				$uncont.css({
8869					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8870				});
8871		
8872				anim_t = inner_h - actual_max_h;
8873				if ( anim_t < 250 ) {
8874					anim_t = 250;
8875				} else if ( anim_t > 1000 ) {
8876					anim_t = 1000;
8877				}
8878
8879				$uncont.css({
8880					'transition-duration' : anim_t + 'ms'
8881				}).addClass('overflow-mask-animation').animate({
8882					'height': inner_h
8883				}, anim_t, 'easeInOutCubic', function(){
8884					$uncont.css({
8885						'height' : 'auto'
8886					}).removeClass('overflow-mask');
8887					if ( read_more_resize === true ) {
8888						window.dispatchEvent(new Event('resize'));
8889						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8890							ScrollTrigger.refresh(true);
8891						}
8892					}
8893				});
8894
8895				if ( marginOpen != '' ) {
8896					$read_more.animate({
8897						'margin-top' : marginOpen
8898					}, anim_t, 'easeInOutCubic');
8899				}
8900
8901			} else {
8902				$read_more
8903					.removeClass('state-open')
8904					.addClass('state-closed');
8905
8906				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
8907					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8908				}, anim_t, 'easeInOutCubic', function(){
8909					if ( read_more_resize === true ) {
8910						window.dispatchEvent(new Event('resize'));
8911						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8912							ScrollTrigger.refresh(true);
8913						}
8914					}
8915				});
8916
8917				if ( marginClosed !== '' ) {
8918					$read_more.animate({
8919						'margin-top' : marginClosed
8920					}, anim_t, 'easeInOutCubic');
8921				}
8922
8923				if ( $a.hasClass('toggle-scroll') ) {
8924                    var $masthead = $('#masthead > div:first-child'),
8925                        headH = $masthead.outerHeight(),
8926						rectTop = $row[0].getBoundingClientRect().top,
8927						checkNavBar = $a.hasClass('toggle-navbar'),
8928						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
8929                        offCont = ( $row.offset().top );
8930
8931					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
8932						checkNavBar = checkNavBarMobile;
8933					}
8934
8935					if ( checkNavBar ) {
8936						offCont = offCont - headH;
8937					}
8938			
8939					if ( rectTop < headH ) {
8940						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
8941							$(this).stop();
8942						}).animate({
8943							scrollTop: offCont
8944						}, anim_t, 'easeInOutCubic');
8945					}
8946				}
8947
8948			}
8949		});
8950	});
8951}
8952UNCODE.filters = function() {
8953	var $systems = $('.isotope-system, .cssgrid-system');
8954
8955	$systems.each(function(index, val){
8956		var $system = $(this),
8957			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
8958			$widgets = $('.widgetized-cb-wrapper', $system),
8959			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
8960			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
8961			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
8962			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
8963
8964		if ($system.hasClass('isotope-processed')) {
8965			return;
8966		}
8967
8968		$cats_trigger.on('click', function(e) {
8969			if ( ! $('html').hasClass('screen-sm') ) {
8970				// $widgets.add($sorting_dd).slideUp(400);
8971				e.preventDefault();
8972				$widgets.slideUp(400, 'easeInOutCirc');
8973			}
8974		});
8975
8976		$('.filters-toggle-trigger', $system).on('click', function(e) {
8977			e.preventDefault();
8978			var $filters = $('.isotope-filters .menu-horizontal', $system);
8979			$filters.slideToggle(400, 'easeInOutCirc');
8980			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8981		});
8982
8983		$widget_trgr.on('click', function(e) {
8984			e.preventDefault();
8985			$widgets.slideToggle(400, 'easeInOutCirc');
8986			if (!$('html').hasClass('screen-sm')) {
8987				$cats_filters.slideUp(400, 'easeInOutCirc');
8988			}
8989			window.dispatchEvent(new CustomEvent('boxResized'));
8990		});
8991
8992		$sorting_trgr.on('click', function(e) {
8993			e.preventDefault();
8994			if (!$('html').hasClass('screen-sm')) {
8995				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8996			}
8997		});
8998
8999		$system.addClass('isotope-processed');
9000	});
9001
9002};
9003
9004UNCODE.widgets = function() {
9005	var widget_collapses = $('.widget-collapse');
9006
9007	widget_collapses.each(function(){
9008		var widget_collapse = $(this),
9009			widget_title = widget_collapse.find('.widget-title'),
9010			widget = widget_title.closest('.widget'),
9011			content = widget.children().not('.widget-title'),
9012			setCTA;
9013
9014		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
9015			widget_title.toggleClass('open');
9016		}
9017
9018		widget_title.each(function() {
9019			var _this = $(this);
9020			var content = _this.closest('.widget').find('.widget-collapse-content');
9021
9022			$(window).on('load resize', function(){
9023				clearRequestTimeout(setCTA);
9024				setCTA = requestTimeout( function() {
9025					if ( content.is(':visible') ) {
9026						_this.addClass( 'open' );
9027					} else {
9028						_this.removeClass( 'open' );
9029					}
9030				}, 10 );
9031			})
9032
9033			_this.on( 'click', function(){
9034
9035				// Get content of :after element (+ icon) to check the visibility
9036				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
9037
9038				if (icon_content === 'none' || !icon_content) {
9039					return false;
9040				}
9041
9042				_this.toggleClass('open');
9043				var isOpen = _this.hasClass('open'),
9044					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
9045				content.animate({
9046					height: 'toggle',
9047					padding: 'toggle',
9048					opacity: 'toggle',
9049					top: isOpen ? 0 : hasBorder
9050				}, {
9051					duration: 400,
9052					easing: "easeInOutCirc",
9053				});
9054
9055				return false;
9056
9057			});
9058		});
9059	});
9060
9061	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
9062};
9063
9064UNCODE.unmodal = function() {
9065	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
9066		$('.unmodal-overlay').fadeIn();
9067		$('.unmodal-overlay').addClass('loading');
9068		$('body').addClass('uncode-unmodal-overlay-visible');
9069		$(window).trigger('unmodal-open');
9070	});
9071
9072	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
9073		$('.unmodal-overlay').fadeOut();
9074		$('.unmodal').fadeOut();
9075		$('body').removeClass('uncode-unmodal-overlay-visible');
9076		$('body').removeClass('uncode-unmodal-open');
9077		$('html').removeClass('uncode-unmodal-body-disable-scroll');
9078		$(document).trigger('unmodal-close');
9079		UNCODE.isUnmodalOpen = false;
9080	});
9081
9082	$(document).on('uncode-unmodal-show-content', function() {
9083		$('.unmodal-overlay').removeClass('loading');
9084		$('.unmodal').show();
9085		$('.unmodal').addClass('show-unmodal-with-animation');
9086		$('.unmodal-content')[0].scrollTop = 0;
9087		$('body').addClass('uncode-unmodal-open');
9088		UNCODE.isUnmodalOpen = true;
9089
9090		if ($('body').hasClass('qw-body-scroll-disabled')) {
9091			$('html').addClass('uncode-unmodal-body-disable-scroll');
9092		}
9093
9094		if ($('.unmodal').hasClass('auto-height')) {
9095			set_modal_height();
9096		}
9097	});
9098
9099	var set_modal_height = function() {
9100		var modal = $('.unmodal').css({height: 'auto'});
9101		var window_height = $(window).outerHeight();
9102		var modal_height = modal.outerHeight();
9103
9104		modal.css('height', 'auto');
9105
9106		if (modal_height > window_height) {
9107			modal.outerHeight(window_height);
9108		}
9109	}
9110
9111	if ($('.unmodal').hasClass('auto-height')) {
9112		var setCTA;
9113
9114		$(window).on('resize', function() {
9115			clearRequestTimeout(setCTA);
9116			setCTA = requestTimeout(function() {
9117				set_modal_height();
9118			}, 100);
9119		});
9120	}
9121};
9122
9123UNCODE.bgChanger = function() {
9124	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
9125		$bg_first = $('.vc_row[data-bg-remove]'),
9126		bg_remove = $bg_first.attr('data-bg-remove'),
9127		$first = $bg_changers.first(),
9128		$last = $bg_changers.last(),
9129		$bg_wrapper = $('#changer-back-color'),
9130		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
9131		setCTA, localH = UNCODE.wheight,
9132		isScrolling;
9133
9134	$bg_first.removeClass(bg_remove);
9135
9136	var bgChange = function($col, bgColor, skin, tmbskin){
9137		$bg_wrapper.attr( 'class', bgColor );
9138		var menuskin;
9139		if ( typeof skin !== 'undefined' ) {
9140			menuskin = skin.replace('style', 'menu')
9141		}
9142
9143		if ( $col.length ) {
9144			$('.uncol[data-skin-change]').each(function(){
9145				var $isoFooter = $('.isotope-footer', this);
9146				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
9147				if ( menuskin !== '' ) {
9148					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
9149				}
9150			});
9151
9152			$('.tmb[data-skin-change]').each(function(){
9153				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
9154			});
9155		}
9156	};
9157
9158	var $masthead = $('#masthead'),
9159		transDesktop,
9160		transMobile,
9161		changeSkin,
9162
9163	checkTransparencyAndChange = function( skin ){
9164		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
9165		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
9166		changeSkin = $masthead.hasClass('menu-change-skin');
9167
9168		if ( ! transDesktop && ! transMobile ) {
9169			return false;
9170		}
9171
9172		if ( ! changeSkin ) {
9173			return false;
9174		}
9175
9176		if ( skin === 'style-light' ){
9177			$masthead.removeClass('style-dark-override').addClass('style-light-override');
9178			return false;
9179		} else if ( skin === 'style-dark' ) {
9180			$masthead.removeClass('style-light-override').addClass('style-dark-override');
9181			return false;
9182		}
9183	};
9184
9185	var bg_waypoints = function(){
9186		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
9187
9188			$.each($bg_changers, function(index, row) {
9189
9190				var $row = $(row),
9191					$col = $('.uncol[data-skin-change]', $row).eq(0),
9192					skin,
9193					$tmbs,
9194					tmbskin,
9195					bgColor = $row.attr('data-bg-color');
9196
9197				if ( ! $row.is(':visible') ) {
9198					return false;
9199				}
9200
9201				if ( $col.length ) {
9202					skin = $col.attr('data-skin-change');
9203					$tmbs = $('.tmb[data-skin-change]', $row);
9204					tmbskin = skin.replace('style', 'tmb');
9205				}
9206
9207				if ( ! $row.hasClass('unscroll-horizontal') ) {
9208					$row.waypoint(function( dir ) {
9209						if ( dir === 'down' ) {
9210							bgChange($col, bgColor, skin, tmbskin);
9211							checkTransparencyAndChange(skin);
9212						} else {
9213							return;
9214						}
9215					}, {
9216						offset: '50%'
9217		  			});
9218
9219					$row.waypoint(function( dir ) {
9220						if ( dir === 'up' ) {
9221							bgChange($col, bgColor, skin, tmbskin);
9222							checkTransparencyAndChange(skin);
9223						} else {
9224							return;
9225						}
9226					}, {
9227						offset: function() {
9228							var clH = this.element.clientHeight,
9229								wH = window.innerHeight,
9230								ret = clH > 200 ? -100 : clH * -0.5;
9231							return ( wH / 2 ) - clH;
9232						}
9233					});
9234				}
9235
9236			});
9237
9238			$('body').addClass('bg-changer-init');
9239
9240		}
9241	};
9242
9243	var body = document.body,
9244	edges = false;
9245
9246	var throttle = function(fn, wait) {
9247		var time = Date.now();
9248		return function() {
9249			if ((time + wait - Date.now()) < 0) {
9250				fn();
9251				time = Date.now();
9252			}
9253		}
9254	}
9255
9256	var $wrapper = document.querySelector(".main-wrapper"),
9257		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
9258
9259	var $title = document.querySelector('#rotating');
9260	if ( $title !== null ) {
9261		$title.style.whiteSpace = 'nowrap';
9262		$title.style.transition = 'transform 200ms linear';
9263	}
9264
9265	window.addEventListener( 'scroll', throttle( function() {
9266		window.clearRequestTimeout( isScrolling );
9267
9268		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
9269
9270			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
9271				body = document.body,
9272				html = document.documentElement,
9273				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9274				$row = false,
9275				firstOff,
9276				lastOff;
9277
9278			if ( scrolled < 100 && $first.length ) {
9279				firstOff = $first.offset().top;
9280				if ( firstOff < 100 ) {
9281					var $row = $first;
9282				}
9283			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
9284				lastOff = $last.offset().top + $last.outerHeight();
9285				if ( lastOff > ( docH - 100 ) ) {
9286					var $row = $last;
9287				}
9288			}
9289
9290			if ( $row.length ) {
9291				var $col = $('.uncol[data-skin-change]', $row).eq(0),
9292					skin,
9293					$tmbs,
9294					tmbskin,
9295					bgColor = $row.attr('data-bg-color');
9296
9297				if ( $col.length ) {
9298					skin = $col.attr('data-skin-change');
9299					$tmbs = $('.tmb[data-skin-change]', $row);
9300					tmbskin = skin.replace('style', 'tmb');
9301				}
9302
9303				bgChange($col, bgColor, skin, tmbskin);
9304				checkTransparencyAndChange(skin);
9305				edges = true;
9306			}
9307
9308		}, 150);
9309
9310		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
9311			bg_waypoints();
9312			Waypoint.refreshAll();
9313			edges = false;
9314		}
9315
9316	}, 100), false);
9317
9318	$(window).on('resize', function() {
9319		clearRequestTimeout(setCTA);
9320		setCTA = requestTimeout(function() {
9321			if ( localH != UNCODE.wheight ) {
9322				localH = UNCODE.wheight;
9323				bg_waypoints();
9324				Waypoint.refreshAll();
9325			}
9326		}, 100);
9327	});
9328
9329	bg_waypoints();
9330
9331};
9332
9333UNCODE.skewIt = function() {
9334
9335	if ( $('body').hasClass('compose-mode') ) {
9336		return;
9337	}
9338
9339	var justscrolled = false;
9340
9341	var loadSkewIt = function(){
9342
9343		var $pageHeader = $('#page-header'),
9344			$page_body = $('.page-body'),
9345			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
9346
9347		if ( $header_skew.length ) {
9348			$pageHeader.addClass('uncode-skew').css({
9349				position: 'relative',
9350				zIndex: 1
9351			});
9352			$header_skew.removeClass('uncode-skew');
9353			$page_body.css({
9354				position: 'relative',
9355				zIndex: 0
9356			});
9357		}
9358
9359		var $skew = $('.uncode-skew'),
9360			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
9361			horizontal = $horizontal.length,
9362			stopSkewing,
9363			lastOffset = 0,
9364			lastDate = Date.now();
9365
9366		if ( ! $skew.length ) {
9367			return;
9368		}
9369
9370		var dropSkew = function(){
9371			if ( UNCODE.wwidth < UNCODE.mediaQuery )
9372				return;
9373
9374			$skew.each(function(){
9375				var $this = $(this),
9376					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9377
9378				if ( $drop.length ) {
9379					$this.css({
9380						'transform': 'skew(0)'
9381					});
9382					var bound = $this[0].getBoundingClientRect();
9383					$drop.css({
9384						left: bound.x * -1,
9385						top: bound.y * -1,
9386					});
9387				}
9388			});
9389		};
9390		dropSkew();
9391
9392		$(window).on('resize', dropSkew);
9393
9394		window.addEventListener( 'scroll', function() {
9395
9396			if ( justscrolled !== true ) {
9397				justscrolled = true;
9398				return;
9399			}
9400
9401			window.clearRequestTimeout( stopSkewing );
9402
9403			var now = Date.now(),
9404				delayInMs = now - lastDate,
9405				offset = window.pageYOffset || window.document.documentElement.scrollTop,
9406				newOffset = offset - lastOffset,
9407				speed = Math.pow((newOffset / delayInMs), 3) * -1,
9408				body = document.body,
9409				html = document.documentElement,
9410				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9411				wait = 50,
9412				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
9413
9414			if ((lastDate + wait - now) < 0) {
9415
9416				lastDate = now;
9417				lastOffset = offset;
9418
9419				if ( speed > 6 ) {
9420					speed = 6;
9421				} else if ( speed < -6 ) {
9422					speed = -6;
9423				}
9424
9425				if ( speed > 2 && offset < UNCODE.wheight ) {
9426					speed = 2;
9427				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
9428					speed = -2;
9429				}
9430
9431				var speedY = speed,
9432					speedX = speed * 1.25;
9433
9434				if ( horizontal ) {
9435					speedY = 0;
9436					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9437						speedX = 0;
9438						return;
9439					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
9440						speedX = 0;
9441						return;
9442					}
9443				} else {
9444					speedX = 0;
9445				}
9446
9447				if ( ! $skew.closest('.enter-st').length ) {
9448					speedX = 0;
9449				}
9450
9451				gsap.killTweensOf($skew);
9452				gsap.to( $skew, {
9453					duration: 0.2,
9454					skewY: (speedY * maxSpeed) + "deg",
9455					skewX: (speedX * maxSpeed) + "deg",
9456					ease: Power0.easeNone,
9457					transformOrigin: 'center',
9458				});
9459
9460			}
9461
9462			stopSkewing = requestTimeout(function() {
9463				gsap.killTweensOf($skew);
9464				gsap.to( $skew, {
9465					duration: 0.5,
9466					skewY: "0deg",
9467					skewX: "0deg",
9468					transformOrigin: 'center',
9469					ease: Expo.easeOut,
9470				});
9471
9472				$skew.each(function(){
9473					var $this = $(this),
9474						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9475
9476					if ( $drop.length ) {
9477						var bound = $this[0].getBoundingClientRect()
9478						$drop.css({
9479							left: bound.x * -1,
9480							top: bound.y * -1,
9481						});
9482					}
9483				});
9484
9485			}, 200);
9486
9487		}, false);
9488
9489	};
9490
9491	$(window).on('load', loadSkewIt);
9492
9493};
9494
9495UNCODE.rotateIt = function() {
9496
9497	if ( $('body').hasClass('compose-mode') ) {
9498		return;
9499	}
9500
9501	var frameRotate = false;
9502	var loadRotateIt = function(){
9503
9504		var $toRotate = $('.uncode-rotate');
9505
9506		$toRotate.each(function(){
9507			var $rotate = $(this),
9508				deg = 0,
9509				dir = true,
9510				coeff = 1,
9511				lastOffset = 0,
9512				lastDate = Date.now();
9513
9514			var checkScroll = function($rotate){
9515				// if ( ! $rotate.length ) {
9516				// 	return;
9517				// }
9518
9519				var now = Date.now(),
9520					delayInMs = now - lastDate,
9521					offset = window.pageYOffset || window.document.documentElement.scrollTop,
9522					newOffset = offset - lastOffset,
9523					speed = (newOffset / delayInMs) * 5,
9524					body = document.body,
9525					html = document.documentElement,
9526					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
9527
9528				lastDate = now;
9529				lastOffset = offset;
9530
9531				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
9532					deg = 0;
9533				}
9534
9535				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
9536					deg = parseFloat(deg) + parseFloat(speed);
9537				}
9538
9539				if ( $rotate.hasClass('uncode-rotate-hover') ) {
9540					$rotate.hover(function(){
9541						coeff = 1.75;
9542					}, function(){
9543						coeff = 1;
9544					});
9545				}
9546
9547				// if ( speed > 0 ) {
9548				// 	dir = true
9549				// } else if ( speed < 0 ) {
9550				// 	dir = false
9551				// }
9552
9553				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
9554					deg = deg+coeff;
9555					// if ( dir ) {
9556					// 	deg = deg+coeff;
9557					// } else {
9558					// 	deg = deg-coeff;
9559					// }
9560				}
9561
9562				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9563					return false;
9564				}
9565				
9566				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
9567					var undeg = deg*-1;
9568					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
9569				} else {
9570					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
9571				}
9572
9573				requestAnimationFrame(function() {
9574					if ( frameRotate === true ) {
9575						frameRotate = false;
9576						return;
9577					}
9578					checkScroll($rotate);
9579				});
9580			};
9581
9582			checkScroll($rotate);
9583
9584		});
9585
9586	};
9587
9588	$(window).on('load', loadRotateIt);
9589
9590	var checkRotate;
9591	var resizeRotate = function(){
9592		var $inlineRotates = $('.inline-rotate');
9593		$inlineRotates.each(function(){
9594			$(this).addClass('inline-rotate-standby');
9595		});
9596		clearTimeout(checkRotate);
9597		checkRotate = setTimeout(function(){
9598			$('.inline-rotate').each(function(){
9599				$(this).removeClass('inline-rotate-standby');
9600				frameRotate = true;
9601			});
9602			loadRotateIt();
9603		}, 500);
9604	};
9605
9606	$(window).off('resize.inline-rotate', resizeRotate)
9607	.on('resize.inline-rotate', resizeRotate);
9608
9609};
9610
9611var marqueeAttempts = 0,
9612	marqueeTO,
9613	marqueeCheckResize,
9614	initMarquee;
9615
9616UNCODE.textMarquee = function( $titles ) {
9617
9618	var isInitMarque = false;
9619
9620	var initTextMarquee = function( $titles ){
9621
9622		if ( typeof $titles == 'undefined' ) {
9623			$titles = $('.un-text-marquee');
9624		}
9625
9626		if ( ! $titles.length ) {
9627			return;
9628		}
9629
9630		isInitMarque = true;
9631
9632		var stableHeight = UNCODE.wheight;
9633
9634		$titles.each(function(){
9635			var $title = $(this),
9636				$span = $('> span, > i > span', $title),
9637				txt,
9638				first = true,
9639				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
9640				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
9641				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
9642				hasSticky = false,
9643				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
9644				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
9645				newW = UNCODE.wwidth,
9646				marqueeTL, inview;
9647
9648			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
9649				hasSticky = true;
9650				dataTrigger = 'row';
9651			}
9652
9653			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
9654				dataNavBar = dataNavBarMobile;
9655			}
9656
9657			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
9658			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
9659			var dataX = dataSpeed;
9660
9661			dataSpeed += 5;
9662
9663			$('.marquee-clone-wrap', $title).remove();
9664
9665			txt = $span.html();
9666
9667			if ( ! $('.marquee-original-core', $span).length ) {
9668				txt = $span.html();
9669				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
9670			} else {
9671				txt = $('.marquee-original-core', $span).html();
9672			}
9673
9674			var spanW,
9675				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
9676				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
9677				speed = 10 - dataSpeed;
9678
9679			$span.prepend($prepended);
9680			$span.append($appended);
9681
9682			var continuousTextMarquee = function () {
9683				var bound = $title
9684						.css({
9685							transform: "none",
9686							opacity: 0,
9687						})
9688						.offset(),
9689					ease = "none";
9690
9691				var xStrt =
9692						first || $title.hasClass("un-marquee-infinite")
9693							? 0
9694							: UNCODE.wwidth - bound.left,
9695					xEnd = $title.hasClass("un-marquee-infinite")
9696						? spanW
9697						: spanW + bound.left,
9698					xSpeed =
9699						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
9700						dataSpeed,
9701					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
9702					speedSlow = (xEnd + xStrt) / 45,
9703					transFormVal,
9704					translX;
9705
9706				marqueeTL = new TimelineMax({ paused: true, reversed: true });
9707				marqueeTL.play();
9708
9709				var inViewElement =
9710						dataTrigger === "row" ? ( hasSticky ? $title.closest('.sticky-trigger, .sticky-element').parent()[0] : $title.closest(".vc_row")[0] ) : $title[0],
9711					wayOff =
9712						dataTrigger === "row" && dataNavBar === "yes"
9713							? UNCODE.menuHeight
9714							: 0;
9715
9716				inview = new Waypoint.Inview({
9717					element: inViewElement,
9718					offset: wayOff,
9719					enter: function (direction) {
9720						marqueeTL.play();
9721					},
9722					exited: function (direction) {
9723						if (!$title.closest(".pin-spacer").length) {
9724							marqueeTL.pause();
9725						}
9726					},
9727				});
9728
9729				if ($title.hasClass("un-marquee-hover")) {
9730					var $column = $title.closest(".wpb_column"),
9731						$col_link = $(".col-link", $column),
9732						$hover_sel = $title;
9733
9734					if ($col_link.length) {
9735						$hover_sel = $title.add($column);
9736					}
9737					$hover_sel
9738						.on("mouseover", function () {
9739							ease = "power2.out";
9740							transFormVal = $title.css("transform").split(/[()]/)[1];
9741							translX = transFormVal.split(",")[4];
9742							speedSlow = (xEnd + (xStrt - translX)) / 45;
9743							marqueeTL.duration(speedSlow);
9744						})
9745						.on("mouseout", function () {
9746							ease = "power2.in";
9747							transFormVal = $title.css("transform").split(/[()]/)[1];
9748							translX = transFormVal.split(",")[4];
9749							speedSlow =
9750								((xEnd + (xStrt - translX)) /
9751									(dataSpeed * dataSpeed * dataSpeed) /
9752									5) *
9753								dataSpeed;
9754							marqueeTL.duration(speedSlow);
9755						});
9756				}
9757		
9758				gsap.killTweensOf($title);
9759				marqueeTL.fromTo( $title, {
9760					opacity: 1,
9761					x: xStrt * direction * -1
9762				},
9763				{
9764					duration: xSpeed,
9765					x: xEnd * direction,
9766					onComplete: function(){
9767						first = false;
9768						continuousTextMarquee();
9769					},
9770					onUpdate: function(){
9771						if ( ! $title[0].isConnected ) {
9772							marqueeTL.kill();
9773							initTextMarquee();
9774						}
9775					},
9776					ease: ease
9777				});
9778		
9779			};
9780			
9781			var runTextMarquee = function(){
9782				var time = Date.now();
9783
9784				var textMarqueeScroll = function(){
9785					var $row = $title.closest('.vc_row');
9786					if ( hasSticky ) {
9787						$row = $title.closest('.sticky-trigger, .sticky-element').parent();
9788					}					
9789					var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
9790
9791					if ( !$bound.length ) {
9792						return;
9793					}
9794
9795					var bound = $bound[0].getBoundingClientRect(),
9796						wait = 100,
9797						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
9798						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
9799
9800					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
9801						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
9802						marqueeAttempts < 2 ) {
9803
9804						clearRequestTimeout(marqueeTO);
9805
9806						marqueeTO = requestTimeout(function(){
9807							marqueeAttempts++;
9808							initTextMarquee();
9809						}, 100);
9810					}
9811
9812
9813					var bound_top = bound.top,
9814						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
9815
9816					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
9817						if ( dataTrigger === 'row-middle' ) {
9818							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5)
9819						}
9820						if ( dataNavBar === 'yes' ) {
9821							bound_top = bound_top - UNCODE.menuHeight;
9822						}
9823						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
9824					}
9825
9826					gsap.killTweensOf($title);
9827					gsap.to( $title, {
9828						duration: 0.24,
9829						x: gsap_calc,
9830					});
9831				};
9832
9833				textMarqueeScroll();
9834				$(window).on( 'load scroll', function(e) {
9835					textMarqueeScroll();
9836				});
9837
9838			};
9839
9840			var cloneSpan = function($_title, cntnt){
9841
9842				if ( $_title.hasClass('un-marquee-infinite') ) {
9843					$('> span.marquee-clone-wrap', $_title).text('');
9844				}
9845
9846				gsap.to( $_title, {
9847					duration: 0,
9848					x: 0
9849				});
9850				spanW = $span.outerWidth();
9851
9852				if ( !spanW ) {
9853					return;
9854				}
9855
9856				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
9857					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
9858
9859				if ( $_title.hasClass('un-marquee-infinite') ) {
9860
9861					for ( var i = 0; i < part; i++ ) {
9862						$prepended.append(cntnt + spaceSpan);
9863						$appended.append(cntnt + spaceSpan);
9864					}
9865				}
9866
9867				if ( $('body').hasClass('compose-mode') ) {
9868					$('.uncode_fe_safe').remove();
9869					return;
9870				}
9871
9872				if ( $title.closest('.marquee-freezed').length ) {
9873					return;
9874				}
9875
9876				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
9877					continuousTextMarquee();
9878				}
9879
9880				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
9881					runTextMarquee();
9882				}
9883
9884			};
9885
9886			var marqueeResize = function(e){
9887				clearRequestTimeout(marqueeCheckResize);
9888				marqueeCheckResize = requestTimeout(function(){
9889					if ( newW !== UNCODE.wwidth ) {
9890						gsap.killTweensOf($title);
9891						if ( typeof inview !== 'undefined' && inview !== null ) {
9892							inview.destroy();
9893						}
9894						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
9895							marqueeTL.kill();
9896						}
9897						first = true;
9898						initTextMarquee();
9899						newW = UNCODE.wwidth;
9900					}
9901				}, 1000);
9902			};
9903
9904			$(window).off('resize', marqueeResize)
9905			.on( 'resize', marqueeResize);
9906			$(window).off('uncode.re-layout', marqueeResize)
9907			.on( 'uncode.re-layout', marqueeResize);
9908
9909			cloneSpan($title, txt);
9910
9911			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9912				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
9913					var $_titles = $('.un-text-marquee',e.view.$el);
9914					clearRequestTimeout(marqueeCheckResize);
9915					marqueeCheckResize = requestTimeout(function(){
9916						initTextMarquee($_titles);
9917					}, 1000);
9918				});
9919			}
9920		});
9921
9922		$(window).on( 'load wwResize', function(e) {
9923			stableHeight = UNCODE.wheight;
9924		});
9925
9926	};
9927
9928	document.addEventListener("DOMContentLoaded", function() {
9929		if ( isInitMarque !== true ) {
9930			initTextMarquee();
9931		}
9932	});
9933
9934	$(window).on('focus load resize',function(){
9935		clearTimeout(initMarquee);
9936		initMarquee = setTimeout(function(){
9937			if ( isInitMarque !== true ) {
9938				initTextMarquee();
9939			}
9940		}, 500);
9941	});
9942	
9943	$(document).on('pumAfterOpen pumAfterClose', function(args){
9944		initTextMarquee();
9945	});
9946
9947};
9948	
9949UNCODE.parallax = function() {
9950	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
9951		if ($('.parallax-el').length > 0) {
9952			var parallax_elements = new Rellax('.parallax-el');
9953			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
9954			window.addEventListener('boxResized', function(e) {
9955				parallax_elements.refresh();
9956			}, false);
9957			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
9958				requestTimeout(function() {
9959					parallax_elements.refresh();
9960				}, 100);
9961			});
9962
9963			if ( typeof UNCODE.hDoc === 'undefined' ) {
9964				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
9965					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
9966			}
9967		
9968			function paralraf(time) {
9969				requestAnimationFrame(paralraf)
9970		
9971				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
9972					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
9973				
9974				if ( UNCODE.hDoc !== newHdoc ) {
9975					UNCODE.hDoc = newHdoc;
9976					parallax_elements.refresh();
9977				}
9978			}
9979		
9980			requestAnimationFrame(paralraf)
9981		
9982		}
9983	}
9984};
9985
9986UNCODE.magicCursor = function(){
9987	var $customCursor = $('#uncode-custom-cursor'),
9988		$customPilot = $('#uncode-custom-cursor-pilot'),
9989		$tooltip = $('.title-tooltip', $customCursor),
9990		$cursorSpan = $('> span', $tooltip),
9991		currentBg = false,
9992		fromTitle = false,
9993		setTime,
9994		mouseEvent;
9995
9996		var spanW, spanH,
9997		maxW = false;
9998
9999	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
10000		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
10001			$tooltip.css({opacity: 0});
10002			delayt_time += 400;
10003		}
10004		clearRequestTimeout(setTime);
10005		setTime = requestTimeout(function() {
10006
10007			$tooltip.css({opacity: ''});
10008
10009			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
10010
10011			if ( cursorTitle !== '' ) {
10012				if ( fromTitle && dataTitle === 'boing' ) {
10013					setTimeout(function(){
10014						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
10015					}, 5);
10016				}
10017				$cursorSpan.attr('class', fontClass).html( cursorTitle );
10018			} else {
10019				if ( cursorType !== 'auto' ) {
10020					$cursorSpan.html('');
10021				}
10022			}
10023
10024			$cursorSpan.addClass('in-tooltip');
10025
10026			$customCursor.attr('data-cursor', cursorType);
10027
10028			if ( fromTitle ) {
10029				$customCursor.addClass('from-tooltip-title');
10030			} else {
10031				$customCursor.removeClass('from-tooltip-title');
10032			}
10033
10034			if ( cursorBg !== false ) {
10035				$customCursor.attr('data-bg', 'transparent');
10036			} else {
10037				$customCursor.removeAttr('data-bg');
10038			}
10039
10040			currentBg = cursorBg;
10041
10042			if ( cursorTitle !== '' ) {
10043				fromTitle = true;
10044				$customCursor.attr('data-cursor', cursorType);
10045				$customCursor.attr('data-title', 'true');
10046				$cursorSpan.css({width: ''});
10047			} else {
10048				fromTitle = false;
10049				$customCursor.removeAttr('data-title');
10050			}
10051			spanW = $cursorSpan.outerWidth();
10052			
10053			if ( spanW >= maxW && maxW !== false ) {
10054				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
10055				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
10056					width: maxW
10057				});
10058				spanW = maxW;
10059			} else {
10060				$customCursor.find('> span:first-child').removeClass('max-width');
10061			}
10062			spanH = $cursorSpan.outerHeight();
10063			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
10064				$customCursor.find('> span:first-child').add($tooltip).css({
10065					width: spanW,
10066					height: spanH
10067				});
10068			} else {
10069				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
10070			}
10071			if ( $customPilot.length ) {
10072				$customPilot.attr('data-cursor', cursorType);
10073			}
10074		}, delayt_time);
10075	}
10076
10077	function changeCursor($wrap){
10078		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10079		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
10080			$href = $wrap.find(href),
10081			cursorType,
10082			cursorTitle = '',
10083			tooltip_class = '',
10084			cursorBg = false;
10085
10086		$wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) {
10087			var $this = $(this).addClass("cursor-init"),
10088				$tmb = $this.closest('.tmb'),
10089				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
10090				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
10091				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
10092				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
10093				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
10094				$title = $('.t-entry-title', $tmb),
10095				is_frontend_editor = $this.closest('.vc_controls').length,
10096				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
10097				$parent_cursor = $this.closest('[class*="custom-cursor"]');
10098
10099			if ( is_frontend_editor ) {
10100				cursorType = 'auto';
10101			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
10102				cursorType = data_cursor;
10103			} else if ( $parent_cursor.length ) {
10104				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
10105					cursorType = 'icon-light';
10106				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
10107					cursorType = 'icon-diff';
10108				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
10109					cursorType = 'icon-accent';
10110				} else {
10111					cursorType = 'icon-dark';
10112				}
10113			} else {
10114				cursorType = 'pointer';
10115			}
10116
10117			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
10118				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
10119					cursorTitle = custom_text;
10120				} else {
10121					cursorTitle = $title.clone();
10122					$('a', cursorTitle).replaceWith(function() {
10123						return this.childNodes;
10124					});
10125					$('*', cursorTitle).replaceWith(function(){
10126						return $(this).removeAttr('class');
10127					});
10128					cursorTitle = cursorTitle.html();
10129				}
10130			} else {
10131				cursorTitle = '';
10132			}
10133
10134			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
10135				tooltip_class = data_class;
10136			} else {
10137				tooltip_class = '';
10138			}
10139
10140			if ( cursor_bg == 'true' ) {
10141				cursorBg = true;
10142			} else {
10143				cursorBg = false;
10144			}
10145
10146			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
10147		}).on("mouseleave.cursor", href, function(e) {
10148			var outTime = 150;
10149			if ( currentBg !== false && cursorBg === false ) {
10150				outTime = 0;
10151			}
10152			delayChangeCursor('auto', '', false, outTime, false, '');
10153		});
10154
10155		$(window).on('disable-hover', function(event) {
10156			document.addEventListener("mousemove", function(e) {
10157				mouseEvent = e;
10158			});
10159			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
10160		});
10161
10162		$(window).on('enable-hover', function(event) {
10163			if ( typeof mouseEvent !== 'undefined' ) {
10164				var x = mouseEvent.clientX,
10165					y = mouseEvent.clientY;
10166
10167				var elements = document.elementsFromPoint(x, y),
10168					$element = $(elements[0]);
10169
10170				$element.closest(href).trigger('mouseenter');
10171			}
10172		});
10173
10174	}
10175
10176	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10177		changeCursor();
10178	});
10179
10180	$(document).ajaxComplete(function( event, xhr, settings ) {
10181		changeCursor();
10182	});
10183
10184	$('.isotope-container').on('isotope-layout-complete', function() {
10185		var $this = $(this);
10186		changeCursor($this);
10187	});
10188
10189};
10190
10191UNCODE.magneticCursor = function(){
10192	function magneticCursor($wrap){
10193		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10194		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'));
10195
10196		$magnetics.on('mousemove', function(e){
10197			var $this = $(this),
10198				$el,
10199				bound = e.currentTarget.getBoundingClientRect(),
10200				coeff = 30,
10201				hor = (bound.width / 2) - (e.clientX - bound.left),
10202				ver = (bound.height / 2) - (e.clientY - bound.top),
10203				toX = hor / bound.width * coeff,
10204				toY = ver / bound.height * coeff,
10205				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
10206				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
10207				toScale = Math.max(scaleX, scaleY);
10208
10209			if ( $this.hasClass('magnetic') ) {
10210				$el = $('.background-inner, .header-bg', $this);
10211			} else {
10212				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10213			}
10214
10215			gsap.killTweensOf($el);
10216			gsap.to( $el, {
10217				duration: 0.75,
10218				x: toX,
10219				y: toY,
10220				scale: toScale,
10221				ease: Power1.easeOut,
10222				transformPerspective: 900,
10223				transformOrigin: 'center',
10224				force3D: true
10225			});
10226		}).on('mouseout', function(e){
10227			var $this = $(this),
10228				$el
10229			if ( $this.hasClass('magnetic') ) {
10230				$el = $('.background-inner, .header-bg', $this);
10231			} else {
10232				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10233			}
10234			gsap.killTweensOf($el);
10235			gsap.to( $el, {
10236				duration: 0.6,
10237				y: 0,
10238				x: 0,
10239				scale: 1,
10240				ease: Power1.easeOut,
10241				transformPerspective: 900,
10242				transformOrigin: 'center',
10243				force3D: true
10244			});
10245		});
10246	};
10247
10248	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10249		magneticCursor();
10250	});
10251
10252	$(document).ajaxComplete(function( event, xhr, settings ) {
10253		magneticCursor();
10254	});
10255
10256	$('.isotope-container').on('isotope-layout-complete', function() {
10257		var $this = $(this);
10258		magneticCursor($this);
10259	});
10260
10261};
10262
10263UNCODE.dropImage = function() {
10264
10265	/****************************
10266	 * Image hover *
10267	****************************/
10268	function imageHover(){
10269		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10270			return;
10271		}
10272
10273		var $postLists = $('.uncode-post-titles');
10274		$postLists.each(function(){
10275			var $list = $(this),
10276				timing = parseFloat( $list.attr('data-timing') ),
10277				default_image = $list.hasClass('uncode-post-titles-default-image'),
10278				default_title = $list.hasClass('uncode-post-titles-default-title'),
10279				$tmbs = $('.tmb', $list),
10280				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
10281				clientX,
10282				clientY,
10283				$row_parent = $list.closest('.vc_row'),
10284				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
10285				$col_parent = $list.closest('.uncell'),
10286				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
10287				stoppedScrolling = true,
10288				setCTA;
10289
10290			timing *= 0.001;
10291
10292			var drop_bgs = function(){
10293				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
10294					var $drop = $(this),
10295						srcset = $drop.attr('data-bgset'),
10296						setArr = srcset.split(","),
10297						setArrOrder = [],
10298						biggest = 0,
10299						checkBg = false,
10300						desktopBG = $drop.data('[data-background-image]'),
10301						mobileBG = $drop.data('[data-mobile-background-image]');
10302
10303					if ( $drop.hasClass('srcset-bg-async') ) {
10304
10305						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
10306							return;
10307						}
10308						
10309					}
10310
10311					if ( SiteParameters.uncode_adaptive == true ) {
10312						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
10313							$drop.css({
10314								'background-image' : 'url(' + setArr[0] + ')'
10315							});
10316						}
10317					} else {
10318						for ( var i = 0; i < setArr.length; i++ ) {
10319							var setLoop = setArr[i].trim().split(" ");
10320							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
10321								var parseSet = parseFloat(setLoop[1]);
10322								if ( biggest < parseSet ) {
10323									biggest = parseSet;
10324								}
10325								setArrOrder[parseSet] = setLoop[0];
10326								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
10327									checkBg = true;
10328									$drop.css({
10329										'background-image' : 'url(' + setLoop[0] + ')'
10330									});
10331								}
10332							}
10333						}
10334
10335						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
10336							$drop.css({
10337								'background-image' : 'url(' + setArrOrder[biggest] + ')'
10338							});
10339						}
10340					}
10341
10342				});
10343			};
10344
10345			drop_bgs();
10346
10347			var dropMovesSize = function(){
10348				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
10349					return;
10350				}
10351				$drop_moves.each(function(){
10352					var $drop_move = $(this),
10353						dataW = $drop_move.attr('data-w'),
10354						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
10355					if ( typeof dataW !== 'undefined' && dataW !== null ) {
10356						dataW = screenInfo.width / 12 * parseFloat( dataW );
10357					}
10358					$drop_moves.css({
10359						width: dataW
10360					});
10361
10362					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10363						$anim_parent.on('animationend', function(){
10364							var bound = $anim_parent[0].getBoundingClientRect();
10365							$drop_move.css({
10366								left: bound.x * -1,
10367								top: bound.y * -1,
10368							});
10369						});
10370					}
10371				});
10372
10373
10374			};
10375
10376			dropMovesSize();
10377
10378			$(window).on( 'resize', function(){
10379				clearRequestTimeout(setCTA);
10380				setCTA = requestTimeout( function() {
10381					drop_bgs();
10382					dropMovesSize();
10383				}, 100 );
10384			});
10385
10386			if ( $drop_row_parents.length ) {
10387				$row_parent.addClass( 'drop-added' );
10388			}
10389
10390			$drop_row_parents.each(function(index, val){
10391				var $drop = $(val);
10392				$row_parent.prepend($drop);
10393				manageVideos($drop, false);
10394				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10395					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10396				}
10397				if ( default_image && index == 0 ) {
10398					manageVideos($drop, true);
10399					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10400						image_ph = new Image();
10401					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10402						image_ph.onload = function() {
10403							$drop.addClass('active');
10404							if ( default_title ) {
10405								$list.addClass('drop-hover');
10406								$tmbs.first().addClass('drop-active');
10407							}
10408						};
10409						image_ph.src = bg_img;
10410					}
10411				}
10412			});
10413
10414			if ( $drop_col_parents.length ) {
10415				$col_parent.addClass( 'drop-added' );
10416			}
10417
10418			$drop_col_parents.each(function(index, val){
10419				var $drop = $(this);
10420				$col_parent.prepend($drop);
10421				manageVideos($drop, false);
10422				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10423					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10424				}
10425				if ( default_image && index == 0 ) {
10426					manageVideos($drop, true);
10427					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10428						image_ph = new Image();
10429					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10430						image_ph.onload = function() {
10431							$drop.addClass('active');
10432							if ( default_title ) {
10433								$list.addClass('drop-hover');
10434								$tmbs.first().addClass('drop-active');
10435							}
10436						};
10437						image_ph.src = bg_img;
10438					}
10439				}
10440			});
10441
10442			function manageVideos( $el, start ) {
10443				var videoElem = $('video', $el),
10444					$iframe = $('iframe', $el),
10445					iframeID = $iframe.attr('id');
10446				if ( videoElem.length ) {
10447					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
10448						if ( start ) {
10449							videoElem[0].setCurrentTime(0);
10450							videoElem[0].play();
10451						} else {
10452							videoElem[0].pause();
10453							videoElem[0].setCurrentTime(0);
10454						}
10455					} else {
10456						if ( start ) {
10457							videoElem[0].currentTime = 0;
10458							videoElem[0].play();
10459						} else {
10460							videoElem[0].pause();
10461							videoElem[0].currentTime = 0;
10462						}
10463					}
10464				}
10465
10466				$el.data('active', start);
10467
10468				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
10469					var iframeIDv = iframeID.replace('okplayer-', ''),
10470						optionsV = $(window).data('okoptions-' + iframeIDv),
10471						vimeo = $iframe[0],
10472						playerV = new Vimeo.Player(vimeo),
10473						timeV = 0;
10474
10475					if (optionsV.time != null) {
10476						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
10477						for ( var i = 0; i < timeArr.length; i++ ) {
10478							if ( timeArr[i] === 'h' ) {
10479								timeV += parseFloat(timeArr[i-1]) * 3600;
10480							} else if ( timeArr[i] === 'm' ) {
10481								timeV += parseFloat(timeArr[i-1]) * 60;
10482							} else if ( timeArr[i] === 's' ) {
10483								timeV += parseFloat(timeArr[i-1]);
10484							}
10485						}
10486					}
10487					playerV.setCurrentTime(timeV);
10488					if ( start ) {
10489						playerV.setVolume(0);
10490						playerV.play();
10491					} else {
10492						playerV.pause();
10493					}
10494				} else if ( $el.attr('data-provider') === 'youtube' ) {
10495					if ( start ) {
10496						$el.trigger('uncode-resume');
10497					} else {
10498						$el.trigger('uncode-pause');
10499					}
10500				}
10501
10502			}
10503
10504			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
10505
10506				document.addEventListener("mousemove", function(e) {
10507					$drop_moves.each(function(){
10508						var $drop_move = $(this),
10509							duration = 0.4;
10510
10511						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
10512							duration = 0.8;
10513						}
10514
10515						clientX = e.clientX;
10516						clientY = e.clientY;
10517
10518						gsap.to( $drop_move, {
10519							duration: duration,
10520							x: clientX,
10521							y: clientY,
10522							ease: Power1.easeOut,
10523						});
10524					});
10525				});
10526
10527			} else {
10528
10529				$(window).on("touchend scroll", function(e) {
10530					$list.removeClass('drop-hover');
10531					$drop_moves.removeClass('active');
10532					$tmbs.removeClass('drop-active');
10533				});
10534
10535				$drop_moves.each(function(){
10536					var $drop_move = $(this),
10537						$tmb = $drop_move.closest('.tmb'),
10538						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
10539
10540					if ( $anim_parent.hasClass('uncode-skew') ) {
10541						$anim_parent.css({
10542							'transform': 'skew(0)'
10543						});
10544					}
10545
10546					$tmb.on('touchend', function(e){
10547						e.stopPropagation();
10548
10549						$drop_moves.removeClass('active');
10550						$tmbs.removeClass('drop-active');
10551
10552						$list.addClass('drop-hover');
10553						$tmb.addClass('drop-active');
10554						$drop_move.addClass('active');
10555						manageVideos($drop_move, true);
10556						clientX = e.changedTouches[0].clientX;
10557						clientY = e.changedTouches[0].clientY;
10558
10559						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10560							var bound = $anim_parent[0].getBoundingClientRect();
10561							clientX = clientX - bound.x;
10562							clientY = clientY - bound.y;
10563						}
10564
10565						$drop_move.css({
10566							left: clientX,
10567							top: clientY
10568						});
10569					});
10570				});
10571
10572			}
10573
10574			$tmbs.each(function(e){
10575				var $tmb = $(this),
10576					// $trgr = $('a', $tmb),
10577					$trgr = $tmb,
10578					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
10579					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
10579(.t-inside), .parallax-el'),
10580					$video = $('video', $tmb),
10581					$iframe = $('iframe', $tmb),
10582					$entryTxt = $('.t-entry-text', $tmb),
10583					stopBounding;
10584
10585				$entryTxt.add($drop_move).css({
10586					'transition-duration': timing + 's'
10587				});
10588
10589				if ( $video.length ) {
10590					var vidH = $video[0].videoHeight,
10591						vidW = $video[0].videoWidth;
10592					$video.css({
10593						'height': vidH,
10594						'width': vidW
10595					});
10596				}
10597
10598				if ( $iframe.length ) {
10599					var vidH = $drop_move.attr('data-height'),
10600						vidW = $drop_move.attr('data-width');
10601					$iframe.css({
10602						'height': vidH,
10603						'width': vidW
10604					});
10605				}
10606
10607				$iframe.each(function(){
10608					var $video = $(this),
10609						vidH = $video[0].videoHeight,
10610						vidW = $video[0].videoWidth;
10611					$video.css({
10612						'height': vidH,
10613						'width': vidW
10614					});
10615				});
10616
10617				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10618					$trgr.on('mouseenter',function(e){
10619
10620						$list.addClass('drop-hover');
10621						$tmbs.removeClass('drop-active');
10622						$tmb.addClass('drop-active');
10623						$drop_move.addClass('active');
10624						manageVideos($drop_move, true);
10625
10626						var clientX = e.clientX,
10627							clientY = e.clientY;
10628						$drop_move.css({
10629							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
10630						});
10631
10632					})
10633					.on('mouseleave', function(e){
10634						$list.removeClass('drop-hover');
10635						$drop_move.css({
10636							'transition-duration': ( timing*1.25 ) + 's'
10637						});
10638						$drop_move.removeClass('active');
10639						$tmb.removeClass('drop-active');
10640						$drop_move.on('transitionend', function(e){
10641							$drop_move.off('transitionend');
10642							$drop_move.css({
10643								'transition-duration': timing + 's'
10644							});
10645							manageVideos($drop_move,false);
10646						});
10647					});
10648
10649					document.addEventListener('visibilitychange', function(){
10650						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
10651							$drop_move.css({
10652								'transition-duration': '0s'
10653							});
10654							$drop_move.removeClass('active');
10655							manageVideos($drop_move, false);
10656						}
10657					});
10658
10659					document.addEventListener('scroll', function(){
10660						window.clearRequestTimeout( stopBounding );
10661						if ( stoppedScrolling ) {
10662							stoppedScrolling = false;
10663							if ( $drop_move.hasClass('active') ) {
10664								$list.removeClass('drop-hover');
10665								$tmbs.removeClass('drop-active');
10666								$drop_move.removeClass('active');
10667								$drop_move.on('transitionend', function(e){
10668									$drop_move.off('transitionend');
10669									$drop_move.css({
10670										'transition-duration': timing + 's'
10671									});
10672									manageVideos($drop_move,false);
10673								});
10674							}
10675						}
10676
10677						stopBounding = requestTimeout(function() {
10678							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10679								var bound = $anim_parent[0].getBoundingClientRect();
10680								$drop_move.css({
10681									left: bound.x * -1,
10682									top: bound.y * -1,
10683								});
10684							}
10685							stoppedScrolling = true;
10686						}, 500);
10687					});
10688				}
10689
10690				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
10691					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
10692
10693				$drop.css({
10694					'transition-duration': timing + 's'
10695				});
10696
10697				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
10698					$trgr.on('mouseenter',function(e){
10699						$row_parent.add($col_parent).addClass('drop-list-loaded');
10700						$list.addClass('drop-hover');
10701
10702						if ( !$tmb.hasClass('drop-active') ) {
10703							$tmbs.removeClass('drop-active');
10704							$tmb.addClass('drop-active');
10705							if ( default_image && !$drop.hasClass('active') ) {
10706								var $prev = $('[data-drop].active', $row_parent);
10707								$prev.css({
10708									'transition-duration': (timing*1.5) + 's'
10709								});
10710								$prev.removeClass('active');
10711								$prev.on('transitionend', function(e){
10712									$prev.off('transitionend');
10713									manageVideos($prev,false);
10714								});
10715							}
10716							$drop.css({
10717								'transition-duration': timing + 's'
10718							});
10719							$drop.off('transitionend');
10720							$drop.addClass('active');
10721							manageVideos($drop, true);
10722						}
10723					})
10724					.on('mouseleave', function(e){
10725						if ( ( default_image && !default_title ) || !default_image ) {
10726							$list.removeClass('drop-hover');
10727							$tmb.removeClass('drop-active');
10728						}
10729						if ( ! default_image ) {
10730							$drop.css({
10731								'transition-duration': (timing*1.5) + 's'
10732							});
10733							$drop.removeClass('active');
10734
10735							$drop.on('transitionend', function(e){
10736								$drop.off('transitionend');
10737								manageVideos($drop,false);
10738							});
10739						}
10740					});
10741
10742					document.addEventListener('visibilitychange', function(){
10743						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
10744							$drop.css({
10745								'transition-duration': '0s'
10746							});
10747							$drop.removeClass('active');
10748							manageVideos($drop, false);
10749						}
10750					});
10751				}
10752			});
10753
10754		});
10755	};
10756
10757	$(window).on('load', function(event) {
10758		imageHover();
10759	});
10760
10761	var drop_wp_animation = function() {
10762		var $postLists = $('.uncode-post-titles');
10763		$postLists.each(function(){
10764			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10765				new Waypoint({
10766					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10767					element: val,
10768					handler: function() {
10769						var element = $(this.element),
10770							parent = element.closest('.tmb'),
10771							currentIndex = parent.index(),
10772							delay = currentIndex,
10773							delayAttr = parseInt(element.attr('data-delay'));
10774						if (isNaN(delayAttr)) delayAttr = 100;
10775						var objTimeout = requestTimeout(function() {
10776							element.addClass('start_animation');
10777
10778							var nextTimeout = requestTimeout(function() {
10779								$('.drop-image-separator', parent).addClass('start_animation');
10780							}, 50);
10781
10782						}, delay * delayAttr);
10783						if (!UNCODE.isUnmodalOpen) {
10784							this.destroy();
10785						}
10786					},
10787					offset: UNCODE.isFullPage ? '100%' : '90%'
10788				})
10789			});
10790		});
10791	}
10792
10793	var runWaypoints_TO,
10794		runWaypoints_delay = 0;
10795
10796	var runWaypoints = function(){
10797		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10798			runWaypoints_delay = 400;
10799		}
10800		clearRequestTimeout(runWaypoints_TO);
10801		runWaypoints_TO = requestTimeout(function() {
10802			drop_wp_animation();
10803		}, runWaypoints_delay);
10804	};
10805	runWaypoints();
10806	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10807	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10808		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10809			// imageHover();
10810			runWaypoints();
10811		});
10812	}
10813};
10814
10815UNCODE.postTable = function() {
10816
10817	var clickRow = function(){
10818		var $postLists = $('.uncode-post-table');
10819
10820		$postLists.each(function(){
10821			var $postList = $(this),
10822				$tmbClicks = $('.tmb.tmb-click-row', $postList);
10823
10824			$tmbClicks.each(function(){
10825				var $tmb = $(this),
10826					$click = $('.table-click-row', $tmb);
10827				$('*:not(.table-click-row)', $tmb).on('click', function(e){
10828					e.preventDefault();
10829					e.stopPropagation();
10830					$click[0].click();
10831					return false;
10832				});
10833			});
10834
10835		})
10836	};
10837
10838	clickRow();
10839
10840	var hoverRow = function(){
10841		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
10842
10843		$postLists.on('mouseenter', function(){
10844			$(this).addClass('post-table-hover');
10845		});
10846		$postLists.on('mouseleave', function(){
10847			$(this).removeClass('post-table-hover');
10848		});
10849	}
10850
10851	hoverRow();
10852
10853	var drop_wp_animation = function() {
10854		var $postLists = $('.uncode-post-table');
10855		$postLists.each(function(){
10856			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10857				new Waypoint({
10858					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10859					element: val,
10860					handler: function() {
10861						var element = $(this.element),
10862							parent = element.closest('.tmb'),
10863							currentIndex = parent.index(),
10864							delay = currentIndex,
10865							delayAttr = parseInt(element.attr('data-delay'));
10866						if (isNaN(delayAttr)) delayAttr = 100;
10867						var objTimeout = requestTimeout(function() {
10868							element.addClass('start_animation');
10869						}, delay * delayAttr);
10870						if (!UNCODE.isUnmodalOpen) {
10871							this.destroy();
10872						}
10873					},
10874					offset: UNCODE.isFullPage ? '100%' : '90%'
10875				})
10876			});
10877		});
10878	}
10879
10880	var runWaypoints_TO,
10881		runWaypoints_delay = 0;
10882
10883	var runWaypoints = function(){
10884		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10885			runWaypoints_delay = 400;
10886		}
10887		clearRequestTimeout(runWaypoints_TO);
10888		runWaypoints_TO = requestTimeout(function() {
10889			drop_wp_animation();
10890		}, runWaypoints_delay);
10891	};
10892	runWaypoints();
10893	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10894	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10895		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10896			runWaypoints();
10897			// clickRow();
10898		});
10899	}
10900};
10901
10902UNCODE.rotatingTxt = function($ctxt) {
10903
10904	if ( $('body').hasClass('compose-mode') ) {
10905		return;
10906	}
10907
10908	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
10909	var setCTA;
10910
10911	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
10912		var $heading = $(this),
10913			// debug = 0,
10914			cycle = 0,
10915			$trgt,
10916			$toMove,
10917			$highl,
10918			$col = $heading.closest('.uncont'),
10919			txt,
10920			arrTxt,
10921			textFadeIn, textFadeOut,
10922			removeWraps;
10923
10924		var defineObjs = function() {
10925			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
10926				var $rtx = $(this),
10927					fx = $rtx.attr('data-fx'),
10928					wait = $rtx.attr('data-wait'),
10929					$prev = $(this).prev().addClass('prev-rotating-start'),
10930					splitToMove = [],
10931					splitArray = [],
10932					lineArray = [],
10933					lineIndex = 0,
10934					lineStart = true,
10935					lineEnd = false,
10936					startSplit = false,
10937					$line_wrap = $rtx.closest('.heading-line-wrap'),
10938					same_line = true,
10939					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
10940					indexRtx = $splits.index($rtx);
10941
10942				fx = typeof fx === 'undefined' ? '' : fx;
10943				wait = typeof wait === 'undefined' ? '' : wait;
10944
10945				$splits.each(function(key, val){
10946					var $split = $(this),
10947						$new_line_wrap = $split.closest('.heading-line-wrap');
10948
10949					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
10950						splitArray.push( $split );
10951					}
10952
10953					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10954						startSplit = false;
10955					}
10956
10957					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10958						splitArray.push( $split );
10959
10960						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
10961							same_line = true;
10962						} else {
10963							same_line = false;
10964						}
10965					}
10966
10967					if ( key == indexRtx ) {
10968						if ( /\S/.test($split.text()) ) {
10969							startSplit = true;
10970							$line_wrap = $split.closest('.heading-line-wrap');
10971							splitArray.push( $split );
10972						} else {
10973							indexRtx++;
10974						}
10975					}
10976
10977					$line_wrap = $new_line_wrap;
10978				});
10979
10980				$toMove = $($.map(splitToMove, function(el){return el.get();}));
10981				$trgt = $($.map(splitArray, function(el){return el.get();}));
10982
10983				if ( same_line ) {
10984					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
10985					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
10986				}
10987
10988				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
10989					$prev.addClass('empty-span-hidden');
10990				}
10991
10992				$highl = $('.heading-text-highlight-inner', $trgt);
10993
10994				$rtx.attr('data-animated', 'true');
10995				if ( cycle == 0 ) {
10996					$( document.body ).trigger('defer-highlights');
10997					cycle++;
10998					defineObjs();
10999					return;
11000				}
11001				cycle++;
11002
11003				txt = $rtx.attr('data-text');
11004				arrTxt = txt.split("|");
11005
11006				textFadeOut($trgt);
11007
11008			});
11009		};
11010
11011		removeWraps = function(){
11012
11013			// if ( debug == 1 ) return;
11014			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
11015			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
11016
11017
11018				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
11019					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
11020
11021				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
11022
11023				$splitFlow.each(function(){
11024					$(this).append($temp_highl);
11025				});
11026
11027				var $line_wrap = $wraps[wrap_k];
11028				var $parent_wrap = $line_wrap.parentNode;
11029				if ( $parent_wrap !== null ) {
11030					while ( $line_wrap.firstChild ) {
11031						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
11032					}
11033					$parent_wrap.removeChild($line_wrap);
11034				}
11035			}
11036			// debug++;
11037			defineObjs();
11038		};
11039
11040		var loop = 0;
11041		textFadeIn = function($trgt){
11042			var word = arrTxt[loop].split(" "),
11043				worsSpan = '',
11044				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11045				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11046				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
11047
11048			for (var w = 0; w < word.length; w++) {
11049				var highl;
11050				if ( $highl.length ) {
11051					highl = $highl[0].outerHTML;
11052				} else {
11053					highl = '';
11054				}
11055
11056				if ( w > 0 ) {
11057					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
11058				}
11059				var charachters = word[w].split('');
11060				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
11061				if ( ! SiteParameters.uncode_has_ligatures ) {
11062					for (var c = 0; c < charachters.length; c++) {
11063						worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
11064					}
11065				} else {
11066					worsSpan += word[w];
11067				}
11068				worsSpan += '</span>' + highl + '</span></span>';
11069			}
11070
11071			if ( $wrap.length && $wrap_inner.length ) {
11072				var words_w = $wrap_inner.outerWidth();
11073				$wrap.css({
11074					width: words_w
11075				});
11076
11077				$highl = $('.heading-text-highlight-inner', $wrap);
11078				$highl.prependTo($wrap);
11079
11080				$wrap_inner.css({
11081					opacity: 0
11082				});
11083
11084				$wrap_inner.html(worsSpan);
11085				$('.heading-text-highlight-inner', $wrap_inner).remove();
11086				words_w = $wrap_inner.innerWidth();
11087
11088				var duration = 0.45;
11089
11090				$heading.removeClass('auto-width');
11091				if ( words_w > $col.width() ) {
11092					$heading.addClass('auto-width');
11093					words_w = 'auto';
11094					duration = 0;
11095				}
11096
11097				$wrap.css({
11098					'width': words_w,
11099					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
11100				});
11101
11102				var $word_inner = $('.split-word-inner', $wrap_inner),
11103					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
11104
11105				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11106
11107				if ( !$target_fx.length ) {
11108					return;
11109				}
11110
11111				gsap.killTweensOf($target_fx);
11112
11113				if ( fx !== 'zoom' ) {
11114					gsap.fromTo( $target_fx, {
11115						y: fx === 'opacity' ? '0%' : '-10%'
11116					},{
11117						delay: duration,
11118						duration: 0.25,
11119						y: '0%',
11120						ease: Circ.easeOut,
11121					});
11122
11123					if ( !$wrap_inner.length ) {
11124						return;
11125					}
11126
11127					gsap.fromTo( $wrap_inner, {
11128						opacity: 0,
11129					},{
11130						delay: duration,
11131						duration: 0.25,
11132						opacity: 1,
11133						ease: Circ.easeOut,
11134						onComplete: function(){
11135							$('> .heading-text-highlight-inner', $wrap).remove();
11136							$wrap_inner.html(worsSpan);
11137							removeWraps();
11138						}
11139					})
11140
11141				} else {
11142					gsap.fromTo( $target_fx, {
11143						transformOrigin: '50%',
11144						opacity: 0,
11145						scale: 0.875,
11146					},{
11147						opacity: 1,
11148						delay: duration,
11149						duration: 0.25,
11150						scale: 1,
11151						ease: Circ.easeOut,
11152						onComplete: function(){
11153							$('> .heading-text-highlight-inner', $wrap).remove();
11154							$wrap_inner.html(worsSpan);
11155							removeWraps();
11156						}
11157					});
11158				}
11159
11160			} else {
11161
11162				if ( !$wrap_inner.length ) {
11163					return;
11164				}
11165
11166				gsap.to( $wrap_inner, {
11167					duration: 0.4,
11168					opacity: 0,
11169					ease: Power1.easeOut,
11170					onComplete: function(){
11171						$wrap_inner.html(worsSpan);
11172						words_w = $wrap_inner.innerWidth();
11173
11174						gsap.to( $wrap_inner, {
11175							duration: 0.2,
11176							opacity: 1,
11177							ease: Power1.easeOut,
11178							onComplete: function(){
11179								$('> .heading-text-highlight-inner', $wrap).remove();
11180								$wrap_inner.html(worsSpan);
11181								removeWraps();
11182							}
11183						})
11184					}
11185				});
11186			}
11187
11188			if ( loop < arrTxt.length-1 ) {
11189				loop++;
11190			} else {
11191				loop = 0;
11192			}
11193
11194		};
11195
11196		textFadeOut = function($trgt){
11197			var $word_inner = $('.split-word-inner', $trgt),
11198				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11199				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11200				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
11201				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
11202
11203			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
11204
11205			var gsap_param = {
11206					delay: wait,
11207					duration: 0.25,
11208					y: fx === '' ? '10%' : '0%',
11209					opacity: 0,
11210					ease: Circ.easeOut,
11211					onStart: function(){
11212						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
11213							$highl = $('.heading-text-highlight-inner', $wrap);
11214							$highl.prependTo($wrap);
11215						}
11216					},
11217					onComplete: textFadeIn,
11218					onCompleteParams: [$trgt]
11219				};
11220
11221			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11222
11223			if ( fx === '' ) {
11224				gsap_param.y = '10%';
11225			} else if ( fx === 'zoom' ) {
11226				gsap_param.scale = '1.045';
11227			}
11228
11229			if ( !$target_fx.length ) {
11230				return;
11231			}
11232
11233			if ( $heading.data('waypoint') !== true ) {
11234				var textInView = new Waypoint.Inview({
11235					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11236					element: $heading[0],
11237					enter: function(direction) {
11238						$heading.data('waypoint',true);
11239						gsap.fromTo( $target_fx, {
11240							transformOrigin: '50%'
11241						}, gsap_param );
11242					}
11243				});
11244			} else {
11245				gsap.fromTo( $target_fx, {
11246					transformOrigin: '50%'
11247				}, gsap_param );
11248			}
11249		};
11250
11251		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11252			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
11253				var $el = model.view.$el,
11254					shortcode = model.attributes.shortcode;
11255
11256				UNCODE.rotatingTxt($el);
11257			});
11258		} else {
11259			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
11260				$heading.on('already-animated', function(){
11261					removeWraps();
11262					window.addEventListener('removeOldLines', function(){
11263						clearRequestTimeout(setCTA);
11264						setCTA = requestTimeout( removeWraps, 150 );
11265					});
11266				});
11267			} else {
11268				$(window).on('load', function(){
11269					removeWraps();
11270					window.addEventListener('removeOldLines', function(){
11271						clearRequestTimeout(setCTA);
11272						setCTA = requestTimeout( removeWraps, 150 );
11273					});
11274				});
11275			}
11276		}
11277	});
11278
11279};
11280
11281UNCODE.verticalText = function() {
11282	$(window).on('menuCanvasOpen', function(){
11283		$('.vertical-text--fixed').fadeOut(500);
11284		$('.horizontal-text--fixed').fadeOut(500);
11285	}).on('menuCanvasClose', function(){
11286		$('.vertical-text--fixed').fadeIn(500);
11287		$('.horizontal-text--fixed').fadeIn(500);
11288	});
11289
11290	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
11291	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
11292	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
11293	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
11294
11295	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
11296		window.addEventListener('scroll', function(e) {
11297			var totalPageHeight = document.body.scrollHeight;
11298			var scrollPoint = window.scrollY + window.innerHeight;
11299
11300			if (window.scrollY > 0) {
11301				showOnTopVerticalTexts.fadeOut();
11302				showOnTopHorizontalTexts.fadeOut();
11303			} else {
11304				showOnTopVerticalTexts.fadeIn();
11305				showOnTopHorizontalTexts.fadeIn();
11306			}
11307
11308			if (scrollPoint >= totalPageHeight) {
11309				hideOnBottomVerticalTexts.fadeOut();
11310				hideOnBottomHorizontalTexts.fadeOut();
11311			} else {
11312				hideOnBottomVerticalTexts.fadeIn();
11313				hideOnBottomHorizontalTexts.fadeIn();
11314			}
11315		}, false);
11316	}
11317};
11318
11319UNCODE.stickyScroll = function( $el ) {
11320	if ( typeof $el === 'undefined' || $el === null ) {
11321		$el = $('body');
11322	}
11323	var checkVisible = function( el, dir ) {
11324		if (typeof jQuery === "function" && el instanceof jQuery) {
11325			el = el[0];
11326		}
11327
11328		var off = 50;
11329		dir = typeof dir=='undefined' ? 'right' : dir;
11330		var rect = el.getBoundingClientRect();
11331
11332		return (
11333			(
11334				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11335				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11336				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
11337			) &&
11338			(
11339				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11340				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11341				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
11342				( rect.right <= window.innerWidth && rect.left >= 0 )
11343			)
11344		);
11345	};
11346
11347	var setItemsRelHeight = function(reset) {
11348		var $_el = $el;
11349		if ( $el.is('.index-scroll') ) {
11350			var $_el = $el.closest('.uncont');
11351		}
11352		// $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
11353		// 	$.each($('.tmb', item), function(index, val) {
11354		// 		if ( reset === true ) {
11355		// 			$(val).css( 'visibility', 'hidden' );
11356		// 		} else {
11357		// 			$(val).css( 'visibility', 'visible' );
11358		// 		}
11359		// 	});
11360		// });
11361		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
11362			$.each($('.tmb', item), function(index, val) {
11363				if ( reset === true ) {
11364					$(val).css( 'visibility', 'hidden' );
11365					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
11366				} else {
11367					var $rowParent = $(item).closest('.row-parent'),
11368						rowRatio = $rowParent.attr('data-height-ratio'),
11369						$rowInner = $(item).closest('.row-child'),
11370						rowRatioInner = $rowInner.attr('data-height'),
11371						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11372						$colContainer = $(item).closest('.uncell'),
11373						$uncont = $(item).closest('.uncont'),
11374						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
11375						safe_heigth = $(item).data('safe-height'),
11376						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
11377						offSet = $(item).offset().top - $uncont.offset().top,
11378						multiplier_h,
11379						data_viewport_h,
11380						body_border = $('.body-borders .top-border').outerHeight() * 2,
11381						remove_menu = $(item).data('vp-menu');
11382
11383					if ( rowRatio === 'full' || rowRatio === '' ) {
11384						rowRatio = 1;
11385					} else {
11386						rowRatio = rowRatio / 100;
11387					}
11388
11389					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
11390						rowRatio = rowRatio;
11391					} else {
11392						rowRatio = rowRatio * rowRatioInner / 100;
11393					}
11394
11395					winHeight = winHeight * rowRatio;
11396
11397					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11398						multiplier_h = parseInt($(item).attr('data-vp-height'));
11399					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
11400						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
11401					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
11402						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
11403					}
11404
11405					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
11406						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
11407						if ( remove_menu === true ) {
11408							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
11409						}
11410						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
11411					} else {
11412						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
11413					}
11414
11415				}
11416			});
11417		});
11418		$('.index-scroll', $_el).each(function(i, item){
11419			var $uncoltable = $(item).closest('.uncoltable'),
11420				$rowParent = $(item).closest('.row-parent'),
11421				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11422				body_border = $('.body-borders .top-border').outerHeight() * 2,
11423				$index_row = $('.index-row', item),
11424				safe_heigth = $index_row.data('safe-height'),
11425				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
11426			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
11427				var data_viewport_h = winHeight - ( paddingRow + body_border );
11428				$uncoltable.css({
11429					'min-height': data_viewport_h
11430				});
11431			} else {
11432				$uncoltable.css({
11433					'min-height': 'auto'
11434				});
11435			}
11436		});
11437
11438	}
11439	setItemsRelHeight();
11440
11441	var $index_scrolls = $('.index-scroll', $el);
11442
11443	$index_scrolls.each(function(key, value){
11444		var $index = $(this),
11445			$parent_row = $index.closest('.vc_row[data-parent]'),
11446			$index_row = $('.index-row', $index),
11447			dir = $index_row.attr('data-direction');
11448		dir = typeof dir === 'undefined' ? 'right' : dir;
11449
11450		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
11451
11452		if ( $('.animate_when_almost_visible', $index).length ) {
11453			$index.addClass('opacity_0').addClass('scroll-refresh-hidden');
11454		}
11455
11456	});
11457
11458	var $horScrolls = $('.unscroll-horizontal', $el);
11459
11460	if ( $horScrolls.length ) {
11461
11462		$('body').addClass('scrolling-trigger');
11463
11464		$horScrolls.each(function(key, value){
11465			var $section = $(this),
11466				$index_scroll = $('.index-scroll', $section),
11467				$index_row = $('.index-row', $index_scroll),
11468				dir = $section.attr('data-direction'),
11469				wrap = $index_row.attr('data-wrap'),
11470				$pinWrap,
11471				$pinTrigger;
11472
11473			dir = typeof dir === 'undefined' ? 'right' : dir;
11474			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
11475			$pinWrap = $('<div class="pin-wrap" />');
11476			if ( SiteParameters.is_frontend_editor ) {
11477				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
11478				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
11479			} else {
11480				if ( wrap === 'column' ) {
11481					$index_scroll.wrapInner( $pinWrap );
11482				} else {
11483					$('> .row', $section).wrap( $pinWrap );
11484				}
11485				$section.wrapInner( $pinTrigger );
11486			}
11487
11488		});
11489
11490		var $pinWraps = $('.pin-wrap', $el);
11491
11492		var horScrollSizes = function(){
11493
11494			$pinWraps.each(function(key, val){
11495				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
11496					$pinTrigger = $pinWrap.closest('.pin-trigger'),
11497					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
11498					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
11499					$boxContainer = $('.box-container'),
11500					box_m = $boxContainer.css('margin-left'),
11501					st_active = true;
11502
11503				var setHorW,
11504				horWidth = function(){
11505					$index_scroll.each(function(){
11506						var $this = $(this),
11507							$index_row = $('.index-row', $this),
11508							$rowContainer = $index_row.closest('.vc_row'),
11509							$rowInner = $index_row.closest('.wpb_row'),
11510							$rowParent = $index_row.closest('.row-parent'),
11511							$tmbs = $('.tmb', $index_row),
11512							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
11513							$uncont = $index_row.closest('.uncont'),
11514							$parent_col = $index_row.closest('.wpb_column'),
11515							col_w = $uncont.width(),
11516							data_lg = parseFloat( $index_row.attr('data-lg') ),
11517							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
11518							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
11519							tmb_w;
11520
11521						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
11522						tmb_w = ( col_w + padding_tmb ) / data_lg;
11523
11524						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
11525							tmb_w = ( col_w + padding_tmb ) / data_sm;
11526						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
11527							tmb_w = ( col_w + padding_tmb ) / data_md;
11528						}
11529
11530						if ( !isNaN(tmb_w) ) {
11531							$tmbs.css({
11532								'width': tmb_w
11533							});
11534						}
11535
11536						$tmbs.css({
11537							'visibility': 'visible'
11538						});
11539
11540					});
11541				};
11542
11543				horWidth();
11544				clearRequestTimeout(setHorW);
11545				setHorW = requestTimeout( function(){
11546					setItemsRelHeight();
11547					horWidth();
11548				}, 100 );
11549
11550				if ( SiteParameters.is_frontend_editor ) {
11551					return;
11552				}
11553
11554				var $vmenu = $('body.vmenu .vmenu-container'),
11555					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
11556					winWidth = window.innerWidth - vmenuW,
11557					$tmb = $('.tmb', $index_scroll).eq(0),
11558					paddingRight = parseFloat( $tmb.css('padding-right') ),
11559					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_
11559scroll.width() + paddingRight ) ),
11560					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
11561					scroll_anim;
11562
11563				if ( $('body').hasClass('rtl') ) {
11564					if ( dir === 'left' ) {
11565						scroll_anim = gsap.fromTo( $pinWrap, {
11566							x: stickyScrollLength
11567						},{
11568							x: 0,
11569							ease: "none"
11570						});
11571					} else {
11572						scroll_anim = gsap.fromTo( $pinWrap, {
11573							x: 0
11574						},{
11575							x: stickyScrollLength,
11576							ease: "none"
11577						});
11578					}
11579				} else {
11580					if ( dir === 'left' ) {
11581						scroll_anim = gsap.fromTo( $pinWrap, {
11582							x: -stickyScrollLength
11583						},{
11584							x: 0,
11585							ease: "none"
11586						});
11587					} else {
11588						scroll_anim = gsap.fromTo( $pinWrap, {
11589							x: 0
11590						},{
11591							x: -stickyScrollLength,
11592							ease: "none"
11593						});
11594					}
11595				}
11596
11597				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
11598					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
11599				}
11600
11601				var animationIncrease;
11602
11603				var checkForAnimations = function(){
11604					animationIncrease = 0
11605					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11606						var _this = this;
11607						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
11608							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11609							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11610							requestTimeout(function() {
11611								$(_this).addClass('start_animation');
11612							}, delayAttr + animationIncrease);
11613							animationIncrease += 150;
11614						}
11615						$(_this).on([
11616							'webkitAnimationEnd',
11617							'mozAnimationEnd',
11618							'MSAnimationEnd',
11619							'oanimationend',
11620							'animationend'
11621						].join(' '), function(e) {
11622							$(e.currentTarget).removeClass('animate_when_almost_visible');
11623						});
11624					});
11625
11626					var batchTime = 0;
11627
11628					var resetBatch = function(){
11629						batchTime = 0;
11630					}
11631
11632					if (ScrollTrigger.isScrolling()) {
11633						resetBatch();
11634					}
11635					
11636					$('.tmb-mask-reveal', $pinTrigger).each(function(){
11637						var _this = this,
11638							$this = $(_this),
11639							$inside = $('.t-inside', $this),
11640							delay = parseFloat( $inside.attr('data-delay') ),
11641							speed = parseFloat( $inside.attr('data-speed') ),
11642							easing = $inside.attr('data-easing'),
11643							bgDelay = parseFloat( $inside.attr('data-bg-delay') );
11644
11645						delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
11646						speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
11647						easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
11648						bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
11649
11650						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) {
11651							$this.addClass('tmb-mask-init');
11652							if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) {
11653								gsap.to($('.t-entry-visual-tc', $this), speed, {
11654									clipPath: 'inset(0% 0% 0% 0%)',
11655									delay: delay + batchTime,
11656									ease: easing,
11657								});
11658								gsap.to($('.t-entry-visual-cont', $this), speed, {
11659									clipPath: 'inset(0% 0% 0% 0%)',
11660									scale: 1,
11661									delay: delay + batchTime + (speed*bgDelay),
11662									ease: easing,
11663									onComplete: resetBatch,
11664								});
11665							} else {
11666								gsap.to($('.t-entry-visual-cont', $this), speed, {
11667									clipPath: 'inset(0% 0% 0% 0%)',
11668									scale: 1,
11669									delay: delay + batchTime,
11670									ease: easing,
11671									onComplete: resetBatch,
11672								});
11673							}
11674							batchTime += 0.1;
11675						}
11676					});
11677				
11678				};
11679				checkForAnimations();
11680
11681				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
11682				var start = 0;
11683
11684				var horST = ScrollTrigger.create({
11685					id: "stickySectionScrolling" + key,
11686					scrub: true,
11687					trigger: $pinTrigger[0],
11688					pin: true,
11689					anticipatePin: 1,
11690					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
11691					end: function() { return "+="+stickyScrollLength; },
11692					animation: scroll_anim,
11693					ease: Sine.easeOut,
11694					onUpdate: checkForAnimations,
11695					invalidateOnRefresh: true,
11696					onEnter: function(){
11697						$pinTrigger.addClass('enter-st');
11698					},
11699					onEnterBack: function(){
11700						$pinTrigger.addClass('enter-st');
11701					},
11702					onLeave: function(){
11703						$pinTrigger.removeClass('enter-st');
11704					},
11705					onLeaveBack: function(){
11706						$pinTrigger.removeClass('enter-st');
11707					}
11708				});
11709
11710				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
11711				window.dispatchEvent(new CustomEvent('boxResized'));
11712
11713				var testSecondTrigger = function(){
11714					animationIncrease = 0
11715					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11716						var _this = this;
11717						if ( checkVisible(_this) ) {
11718							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11719							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11720							requestTimeout(function() {
11721								$(_this).addClass('start_animation');
11722							}, delayAttr + animationIncrease);
11723							animationIncrease += 150;
11724						}
11725					});
11726
11727				};
11728
11729				var verST = ScrollTrigger.create({
11730					id: "verticalSectionScrolling" + key,
11731					trigger: $pinTrigger[0],
11732					start: "top center",
11733					end: function() { return "+="+UNCODE.wheight; },
11734					onUpdate: testSecondTrigger,
11735					invalidateOnRefresh: true
11736				});
11737
11738				var setCTA,
11739
11740				dis_enable_ST = function(){
11741					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
11742						horST.kill();
11743						verST.kill();
11744						$pinTrigger.addClass('disabled');
11745						st_active = false;
11746					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
11747						horST.kill();
11748						verST.kill();
11749						$pinTrigger.addClass('disabled');
11750						st_active = false;
11751					}
11752				};
11753
11754				$(window).on('resize load', function() {
11755					clearRequestTimeout(setCTA);
11756					setCTA = requestTimeout(function() {
11757						dis_enable_ST();
11758						checkForAnimations();
11759					}, 500);
11760				});
11761
11762			});
11763		};
11764
11765		$(window).on( 'load', function(){
11766			horScrollSizes();
11767		});
11768		var setResize,
11769			setReLayout,
11770			doubleResize = true;
11771		$(window).on( 'load', function(){
11772			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
11773				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11774				Array.prototype.forEach.call($row_inners, function(el) {
11775					el.style.height = '';
11776					el.style.marginBottom = '';
11777				});
11778				setItemsRelHeight();
11779				horScrollSizes();
11780				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11781					$(document).trigger('uncode-scrolltrigger-refresh');
11782				}
11783			}
11784			var carousel = document.querySelector(".owl-carousel"),
11785				grid = document.querySelector(".isotope-container"),
11786				stickyAll = document.querySelectorAll(".index-scroll");
11787
11788			if ( stickyAll.length ) {
11789				var sticky = stickyAll[(stickyAll.length-1)];
11790			}
11791
11792			if ( typeof sticky !== "undefined" ) {
11793
11794				if ( typeof carousel !== "undefined" && carousel !== null ) {
11795					var carousel_position = sticky.compareDocumentPosition(carousel);
11796				}
11797				if ( typeof grid !== "undefined" && grid !== null ) {
11798					var grid_position = sticky.compareDocumentPosition(grid);
11799				}
11800
11801				if ( carousel_position === 2 || grid_position === 2 ) {
11802					setTimeout(function(){
11803						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11804							$(document).trigger('uncode-scrolltrigger-refresh');
11805						}
11806					}, 500);
11807				}
11808
11809			}
11810			
11811		});
11812        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
11813            android = /Android/.test(navigator.userAgent) && !window.MSStream;
11814		$(window).on( 'resize orientationchange', function(e){
11815			if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
11816				return;
11817			}
11818			setItemsRelHeight(true);
11819			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11820			Array.prototype.forEach.call($row_inners, function(el) {
11821				el.style.height = '';
11822				el.style.marginBottom = '';
11823			});
11824			clearRequestTimeout(setResize);
11825			setResize = requestTimeout( function(){
11826				setItemsRelHeight();
11827				horScrollSizes();
11828				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11829					$(document).trigger('uncode-scrolltrigger-refresh');
11830				}
11831				if ( doubleResize === true ) {
11832					window.dispatchEvent(new Event('resize'));
11833					doubleResize = false;
11834				} else {
11835					doubleResize = true;
11836				}
11837				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
11838			}, 100 );
11839		});
11840
11841		var show_pins = function(){
11842			$('.index-scroll').css({'opacity':'1'});
11843		};
11844		ScrollTrigger.addEventListener("refresh", show_pins);
11845		$(window).on( 'uncode.re-layout', function(){
11846			//$('.index-scroll').css({'opacity':'0'});
11847			$('.pin-spacer').each(function(){
11848				var space_h = $(this).outerHeight(),
11849					$row = $(this).closest('.row-container');
11850				$row.css({
11851					'height': space_h,
11852					'overflow': 'hidden'
11853				});
11854			});
11855			if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11856				ScrollTrigger.refresh(true);
11857			}
11858			clearRequestTimeout(setReLayout);
11859			setReLayout = requestTimeout( function(){
11860				$('.row-container').each(function(){
11861					$(this).css({
11862						'height': '',
11863						'overflow': ''
11864					});
11865				});
11866			}, 1000);
11867		});
11868	}
11869
11870};
11871
11872UNCODE.stickyTrigger = function( $el ) {
11873    if ( SiteParameters.is_frontend_editor ) {
11874        return false;
11875    }
11876
11877    var stickyTrigger = function(){
11878        var stickyTrick = $('.sticky-trigger').each(function(){
11879            var $sticky = $(this),
11880                $inside = $('> div', $sticky),
11881                insideH = $inside.outerHeight(),
11882                $row = $sticky.closest('.vc_row'),
11883                $uncont = $sticky.closest('.uncont'),
11884                rowBottom,
11885                uncontBottom,
11886                diffBottom;
11887
11888            ScrollTrigger.create({
11889                trigger: $sticky,
11890                start: function(){ return "top center-=" + insideH/2; },
11891                endTrigger: $row,
11892                end:  function(){
11893                    rowBottom = $row.offset().top + $row.outerHeight();
11894                    uncontBottom = $uncont.offset().top + $uncont.outerHeight();
11895                    diffBottom = rowBottom - uncontBottom;
11896                    return "bottom center+=" + ( insideH/2 + diffBottom );
11897                },
11898                anticipatePin: true,
11899                pin: true,
11900                pinSpacing: false,
11901                scrub: true,
11902                invalidateOnRefresh: true,
11903            });
11904
11905        });
11906    },
11907    setResizeSticky;
11908
11909    $(window).on( 'load', function(){
11910        stickyTrigger();
11911        var carousel = document.querySelector(".owl-carousel"),
11912            grid = document.querySelector(".isotope-container"),
11913            stickyAll = document.querySelectorAll(".sticky-trigger");
11914
11915        if ( stickyAll.length ) {
11916            var sticky = stickyAll[(stickyAll.length-1)];
11917        }
11918
11919        if ( typeof sticky !== "undefined" ) {
11920
11921            if ( typeof carousel !== "undefined" && carousel !== null ) {
11922                var carousel_position = sticky.compareDocumentPosition(carousel);
11923            }
11924            if ( typeof grid !== "undefined" && grid !== null ) {
11925                var grid_position = sticky.compareDocumentPosition(grid);
11926            }
11927
11928            if ( carousel_position === 2 || grid_position === 2 ) {
11929                setTimeout(function(){
11930                    $(document).trigger('uncode-scrolltrigger-refresh');
11931                }, 500);
11932            }
11933
11934        }
11935    });
11936
11937    var oldW = UNCODE.wwidth;
11938    $(window).on( 'resize uncode.re-layout', function(e){
11939        clearRequestTimeout(setResizeSticky);
11940        if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
11941            return;
11942        } else {
11943            oldW = UNCODE.wwidth;
11944        }
11945        setResizeSticky = requestTimeout( function(){
11946            stickyTrigger();
11947            $(document).trigger('uncode-scrolltrigger-refresh');
11948        }, 1000 );
11949    });
11950
11951    
11952};
11953
11954UNCODE.areaTextReveal = function() {
11955    if ( ! $('.text-reveal, .scroll-trigger-el').length ) {
11956        return;
11957    }
11958	if ( ! SiteParameters.is_frontend_editor ) {
11959        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
11960            android = /Android/.test(navigator.userAgent) && !window.MSStream,
11961            prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
11962            prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
11963                document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
11964            firstObs = true,
11965            isMobileUsing = false;
11966
11967        var observer = new ResizeObserver(function(){
11968            var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
11969                newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
11970                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
11971                set = false;
11972            if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
11973                set = true;
11974                prevW = newW;
11975            } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
11976                set = true;
11977                prevH = newH;
11978            }
11979            if ( set || firstObs ) {
11980                window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe'));
11981                firstObs = false;
11982            }
11983        }).observe(document.body);
11984
11985        if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
11986            window.scrollTo = function() {
11987                return;
11988            };
11989            isMobileUsing = true;
11990
11991            $('html, body').css({
11992                'overscroll-behavior': 'none'
11993            });
11994        }
11995
11996        var setTriggerObserve;
11997
11998        ScrollTrigger.observe({
11999            trigger: 'body',
12000            type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
12001            onUp: function() { ScrollTrigger.update(); },
12002        });
12003    }
12004
12005    var textReveal = function(){
12006
12007        if ( SiteParameters.is_frontend_editor ) {
12008            return;
12009        }
12010
12011        var setTxtReveal,
12012            txtTrggrStart = false;
12013
12014        function headingReveal($sel){
12015            txtTrggrStart = true;
12016            $('.text-reveal', $sel).each(function(val, key){
12017                var $txtReveal = $(this).attr('data-init-reveal', true),
12018                    $trigger = $txtReveal,
12019                    $rowParent = $txtReveal.closest('.row-container[data-parent]'),
12020                    hReveal = $txtReveal.outerHeight(),
12021                    $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'),
12022                    $sticky = $txtReveal.closest('.sticky-element'),
12023                    dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
12024                    dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
12025                    dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')),
12026                    $lines = $('.heading-line-wrap', $txtReveal),
12027                    $words = $('.split-word-inner', $txtReveal),
12028                    $chars = $('.split-char', $txtReveal),
12029                    $elToReveal = $words;
12030
12031                if ( $pin.length ) {
12032                    return;
12033                } else if ( $sticky.length ) {
12034                    hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop);
12035                    $trigger = $sticky.parent();
12036                }
12037
12038                if ( dataReveal === 'chars' ) {
12039                    $elToReveal = $chars;
12040                } else if ( dataReveal === 'lines' ) {
12041                    $elToReveal = $lines;
12042                }
12043                
12044                var tl = gsap.timeline({
12045                    scrollTrigger: {
12046                        trigger: $trigger,
12047                        start: "top +=" + (window.innerHeight/100*dataTop) + "px",
12048                        end: "+=" + hReveal + "px",
12049                        id: "txt_reveal_" + key,
12050                        scrub: true,
12051                    }
12052                });
12053                gsap.set(
12054                    $elToReveal, {
12055                        opacity: dataRevealOpacity,
12056                    }
12057                )
12058                tl.fromTo($elToReveal, {
12059                    opacity: dataRevealOpacity,
12060                    duration: 1,
12061                }, {
12062                    opacity: 1,
12063                    stagger: 0.05,
12064                    duration: 1,
12065
12066                });
12067                $(window).on('uncode.tl-refresh', function(){
12068                    if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
12069                        tl.scrollTrigger.refresh();
12070                    }
12071                });
12072
12073                $rowParent.one( 'uncodeWordLines', function(){
12074                    clearRequestTimeout(setTxtReveal);
12075                    setTxtReveal = requestTimeout( function(){
12076                        gsap.set($elToReveal, {clearProps: true});
12077                        tl.kill(true);
12078                        if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) {
12079                            ScrollTrigger.getById("txt_reveal_" + key).kill(true);
12080                        }
12081                        headingReveal($sel)
12082                    }, 100);
12083                });
12084
12085            });
12086        };
12087
12088        window.addEventListener("load", function (e) {
12089            if (!txtTrggrStart) {
12090                headingReveal($("body"));
12091                $(window).trigger("resize");
12092            }
12093        });
12094
12095        $('.row-container[data-parent]').each(function(){
12096            if (!txtTrggrStart) {
12097                var $this = $(this);
12098                $this.on('uncodeWordLines', function(){
12099                    headingReveal($this);
12100                });
12101            }
12102        });
12103
12104        $(window).on('uncode-sticky-trigger-observe', function(e){
12105            clearRequestTimeout(setTriggerObserve);
12106            setTriggerObserve = requestTimeout( function(){
12107                $(window).trigger('uncode.tl-refresh');
12108            }, 2000 );
12109        });
12110    
12111    };
12112    textReveal();
12113
12114    var areaReveal = function(){
12115        if ( SiteParameters.is_frontend_editor ) {
12116            return;
12117        }
12118
12119        $('.scroll-trigger-el').each(function(){
12120            var $scrollTrgrEl = $(this),
12121                $row = $('> .row', $scrollTrgrEl),
12122                $row_in = $('> .row-inner', $row),
12123                cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length,
12124                stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows',
12125                animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes',
12126                stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false,
12127                $animateTrgrEl = $scrollTrgrEl,
12128                noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes',
12129                noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'),
12130                els = $scrollTrgrEl.attr('data-anim-els'),
12131                sticky = $scrollTrgrEl.attr('data-anim-sticky'),
12132                noSpace = $scrollTrgrEl.attr('data-anim-no-space'),
12133                state = $scrollTrgrEl.attr('data-anim-state'),
12134                target = $scrollTrgrEl.attr('data-anim-target'),
12135                origin = $scrollTrgrEl.attr('data-anim-origin'),
12136                mask = $scrollTrgrEl.attr('data-anim-mask'),
12137                _scale = $scrollTrgrEl.attr('data-anim-scale'),
12138                stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes',
12139                opacity = $scrollTrgrEl.attr('data-anim-opacity'),
12140                radius = $scrollTrgrEl.attr('data-anim-radius'),
12141                radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'),
12142                clip_path = $scrollTrgrEl.attr('data-clip-path'),
12143                animation_x = $scrollTrgrEl.attr('data-anim-x'),
12144                animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'),
12145                animation_y = $scrollTrgrEl.attr('data-anim-y'),
12146                blur = $scrollTrgrEl.attr('data-anim-blur'),
12147                perspective = $scrollTrgrEl.attr('data-anim-perspective'),			
12148                rotate = $scrollTrgrEl.attr('data-anim-rotate'),	
12149                rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'),
12150                topBottom = $scrollTrgrEl.attr('data-anim-start'),	
12151                offTop = $scrollTrgrEl.attr('data-anim-top'),
12152                offBottom = $scrollTrgrEl.attr('data-anim-bottom'),
12153                safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0,
12154                animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'),
12155                easeOut = $scrollTrgrEl.attr('data-anim-ease'),
12156                offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'),
12157                stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards,
12158                $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(),
12159                setTxtReveal,
12160                txtTrggrStart = false,
12161                alreadyareaAnimateScrollTl = false;
12162    
12163            _scale = _scale === '' ? 0 : parseFloat( _scale );
12164            perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001;	
12165            offTop = offTop === '' ? 0 : parseFloat( offTop );
12166            offBottom = offBottom === '' ? 0 : parseFloat( offBottom );
12167            offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard );
12168
12169            function areaAnimateScrollTl($el, id, last) {
12170                alreadyareaAnimateScrollTl = true;
12171
12172                var pTop = parseFloat( $row.css('padding-top') ),
12173                    innerGap = pTop + offSetCard * id,
12174                    scale = _scale;
12175
12176                if ( isMobileUsing ) {
12177                    innerGap = 0;
12178                }
12179
12180                if ( stepScale ) {
12181                    if ( _scale < 100 ) {
12182                        scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) );
12183                    }
12184                }
12185
12186                if ( els === 'content' ) {
12187                    $animateTrgrEl = $('> .row', $scrollTrgrEl);
12188                } else if ( els === 'bg' ) {
12189                    $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl);
12190                } else {
12191                    $animateTrgrEl = $el;
12192                }
12193
12194                if ( rotate_alt === 'yes') {
12195                    rotate *= -1;
12196                    perspective *= -1;
12197                }
12198                
12199                if ( animation_x_alt === 'yes') {
12200                    animation_x *= -1;
12201                }
12202
12203                var $parentDiv = $el.closest('div[data-sticky]');
12204
12205                var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px";
12206
12207                var scrllTrggr = {
12208                    trigger: $parentDiv,
12209                    end: function(){
12210                        return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom)))
12211                    },
12212                    start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
12213                    pin: sticky === 'yes' || stickyCards ? true : false,
12214                    pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0),
12215                    scrub: true,
12216                    id: 'sticky_' + id,
12217                    anticipatePin: 1,
12218                    invalidateOnRefresh: true,
12219                    // markers: {
12220                    //     indent: 150 * id
12221                    // },
12222                    onToggle: function(){
12223                        $scrollTrgrEl.attr('data-revealed', true);
12224                    },
12225                };
12226
12227                if ( !stickyLast && state === 'end' ) {
12228                    last = false;
12229                } 
12230
12231                if ( stickyCards ) {
12232                    if ( state !== 'end' ) {
12233                        if ( animation_rows_start === 'center' ) {
12234                            scrllTrggr.start = "center center";
12235                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight);
12236                        } else if ( animation_rows_start === 'bottom' ) {
12237                            if ( stickyOpts !== 'no' ) {
12238                                scrllTrggr.start = "bottom bottom";
12239                                scrllTrggr.end = "bottom bottom";
12240                            }
12241                        } else {
12242                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2);
12243                        } 
12244                        if ( stickyOpts === 'no' ) {
12245                            scrllTrggr.endTrigger = $el;
12246                            scrllTrggr.end = "+=100%";
12247                        } else {
12248                            scrllTrggr.endTrigger = $row;
12249                        }
12250                    } else {
12251                        if ( animation_rows_start === 'center' ) {
12252                            scrllTrggr.start = "center center";
12253                        } else if ( animation_rows_start === 'bottom' ) {
12254                            scrllTrggr.start = "bottom bottom";
12255                        } 
12256                        if ( stickyOpts !== 'no' ) {
12257                            scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1));
12258                            scrllTrggr.endTrigger = $lastEl;
12259                        } else {
12260                            scrllTrggr.end = "bottom bottom";
12261                        }
12262                    }
12263                }
12264                
12265                var tl = gsap.timeline({
12266                    scrollTrigger: scrllTrggr
12267                });
12268
12269                // var mark = last ? {
12270                //         startColor:"blue",
12271                //         endColor:"orange",
12272                //     } : false;
12273
12274                if ( !stickyCards ) {
12275                    var tlConds = tl;
12276                } else {
12277                    var scrllTrggrConds = {
12278                        trigger: $parentDiv,
12279                        end: function(){
12280                            return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom)))
12281                        }, 
12282                        pin: (state === 'end' && last),
12283                        pinSpacing: false,
12284                        scrub: true,
12285                        id: 'card_' + id,
12286                        invalidateOnRefresh: true,
12287                        // markers: true,
12288                    };
12289                    if ( stickyCards ) {
12290                        if ( state !== 'end' ) {
12291                            if ( stickyOpts === '' ) {
12292                                scrllTrggrConds.end = "bottom bottom-=100%";
12293                                scrllTrggrConds.endTrigger = $row_in;
12294                            }
12295
12296                            if ( animation_rows_start === 'bottom' ) {
12297                                if ( stickyOpts !== 'no') {
12298                                    scrllTrggrConds.start = "top top+=" + window.innerHeight;
12299                                    scrllTrggrConds.end = "bottom bottom";
12300                                }
12301                            } else if ( animation_rows_start === 'center' ) {
12302                                scrllTrggrConds.start =  "center center";
12303                            } else {
12304                                scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12305                            }
12306                            
12307                        } else {
12308                            if ( stickyOpts === '' ) {
12309                                if ( animLast ) {
12310                                    scrllTrggrConds.end = "bottom bottom-=100%";
12311                                } else {
12312                                    scrllTrggrConds.end = "bottom bottom";
12313                                }
12314                                scrllTrggrConds.endTrigger = $lastEl;
12315                            }
12316
12317                            if ( animation_rows_start === 'bottom' && stickyOpts !== 'no' ) {
12318                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12319                                    scrllTrggrConds.start = "bottom bottom";
12320                                } else {
12321                                    scrllTrggrConds.start = "top top+=" + $el.outerHeight();
12322                                }
12323                            } else if ( animation_rows_start === 'center' ) {
12324                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12325                                    scrllTrggrConds.start =  "center center";
12326                                } else {
12327                                scrllTrggrConds.start =  "top+=" + ($el.outerHeight()/2) + " top+=" 
12327+ window.innerHeight/2;
12328                                }
12329                            } else {
12330                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12331                                    scrllTrggrConds.start = "top top";
12332                                } else {
12333                                    scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12334                                }
12335                            }
12336
12337                        }
12338
12339                    } else {
12340                        scrllTrggrConds.start =  start_topBottom;
12341                    }
12342
12343                    var tlConds = gsap.timeline({
12344                        scrollTrigger: scrllTrggrConds
12345                    });
12346                }
12347
12348                if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) {
12349                    if ( target === 'mask' ) {
12350                        if ( state !== 'end' ) {
12351                            if ( mask === 'auto' ) {
12352                                gsap.set(
12353                                    $animateTrgrEl, {
12354                                        clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12355                                        opacity: parseFloat(opacity)/100,
12356                                        filter: 'blur(' + blur + 'px)',
12357                                        visibility: 'visible',
12358                                    }
12359                                )
12360                                tlConds.fromTo($animateTrgrEl, {
12361                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12362                                    opacity: parseFloat(opacity)/100,
12363                                    filter: 'blur(' + blur + 'px)',
12364                                    duration: 1,
12365                                }, {
12366                                    opacity: 1,
12367                                    clipPath: 'inset(0% 0px round 0' + radiu
12367s_unit + ')',
12368                                    filter: 'blur(0px)',
12369                                    duration: 1,
12370                                    ease: easeOut,
12371                                    //delay: 0.1
12372                                });	
12373                            } else {
12374                                tlConds.fromTo($animateTrgrEl, {
12375                                    opacity: parseFloat(opacity)/100,
12376                                    clipPath: clip_path,
12377                                    filter: 'blur(' + blur + 'px)',
12378                                    duration: 1,
12379                                }, {
12380                                    opacity: 1,
12381                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12382                                    filter: 'blur(0px)',
12383                                    duration: 1,
12384                                    ease: easeOut,
12385                                    //delay: 0.1
12386                                });	
12387                            }
12388                        } else {
12389                            if ( mask === 'auto' ) {
12390                                tlConds.fromTo($animateTrgrEl, {
12391                                    opacity: 1,
12392                                    clipPath: 'inset(0% 0px round 0' + radiu
12392s_unit + ')',
12393                                    filter: 'blur(0px)',
12394                                    duration: 1,
12395                                },{
12396                                    opacity: parseFloat(opacity)/100,
12397                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12398                                    filter: 'blur(' + blur + 'px)',
12399                                    ease: easeOut,
12400                                    duration: 1,
12401                                    //delay: 0.1
12402                                });	
12403                            } else {
12404                                tlConds.fromTo($animateTrgrEl, {
12405                                    opacity: 1,
12406                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12407                                    filter: 'blur(0px)',
12408                                    duration: 1,
12409                                },{
12410                                    opacity: parseFloat(opacity)/100,
12411                                    clipPath: clip_path,
12412                                    filter: 'blur(' + blur + 'px)',
12413                                    duration: 1,
12414                                    ease: easeOut,
12415                                    //delay: 0.1
12416                                });	
12417                            }
12418                        }
12419                    } else {
12420                        if ( state !== 'end' ) {
12421                            if ( scale === 'auto' ) {
12422                                if ( radius ) {
12423                                    gsap.set(
12424                                        $animateTrgrEl, {
12425                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12426                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12427                                            x: animation_x + 'vw',
12428                                            y: animation_y + 'vh',
12429                                            filter: 'blur(' + blur + 'px)',
12430                                            rotation: rotate,
12431                                            rotationX: rotate == 0 ? perspective : 0,
12432                                            transformPerspective: '100vw',
12433                                            opacity: parseFloat(opacity)/100,
12434                                            transformOrigin: origin,
12435                                            borderRadius: radius + radius_unit,
12436                                            visibility: 'visible',
12437                                        }
12438                                    )
12439                                    tlConds.fromTo($animateTrgrEl, {
12440                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12441                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12442                                        x: animation_x + 'vw',
12443                                        y: animation_y + 'vh',
12444                                        filter: 'blur(' + blur + 'px)',
12445                                        rotation: rotate,
12446                                        rotationX: rotate == 0 ? perspective : 0,
12447                                        transformPerspective: '100vw',
12448                                        opacity: parseFloat(opacity)/100,
12449                                        borderRadius: radius + radius_unit,
12450                                        transformOrigin: origin,
12451                                        duration: 1,
12452                                    }, {
12453                                        scaleX: 1,
12454                                        scaleY: 1,
12455                                        x: 0,
12456                                        y: 0,
12457                                        filter: 'blur(0px)',
12458                                        rotation: 0,
12459                                        rotationX: 0,
12460                                        opacity: 1,
12461                                        borderRadius: 0 + radius_unit,
12462                                        transformOrigin: origin,
12463                                        duration: 1,
12464                                        ease: easeOut,
12465                                        //delay: 0.1
12466                                    });	
12467                                } else {
12468                                    gsap.set(
12469                                        $animateTrgrEl, {
12470                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12471                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12472                                            x: animation_x + 'vw',
12473                                            y: animation_y + 'vh',
12474                                            filter: 'blur(' + blur + 'px)',
12475                                            rotation: rotate,
12476                                            rotationX: rotate == 0 ? perspective : 0,
12477                                            transformPerspective: '100vw',
12478                                            opacity: parseFloat(opacity)/100,
12479                                            transformOrigin: origin,
12480                                            visibility: 'visible',
12481                                        }
12482                                    )
12483                                    tlConds.fromTo($animateTrgrEl, {
12484                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12485                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12486                                        x: animation_x + 'vw',
12487                                        y: animation_y + 'vh',
12488                                        filter: 'blur(' + blur + 'px)',
12489                                        rotation: rotate,
12490                                        rotationX: rotate == 0 ? perspective : 0,
12491                                        transformPerspective: '100vw',
12492                                        opacity: parseFloat(opacity)/100,
12493                                        transformOrigin: origin,
12494                                        duration: 1,
12495                                    }, {
12496                                        scaleX: 1,
12497                                        scaleY: 1,
12498                                        x: 0,
12499                                        y: 0,
12500                                        filter: 'blur(0px)',
12501                                        rotation: 0,
12502                                        rotationX: 0,
12503                                        opacity: 1,
12504                                        transformOrigin: origin,
12505                                        duration: 1,
12506                                        ease: easeOut,
12507                                        //delay: 0.1
12508                                    });	
12509                                }
12510                            } else {
12511                                if ( radius ) {
12512                                    gsap.set(
12513                                        $animateTrgrEl, {
12514                                            scaleX: parseFloat( scale ) / 100,
12515                                            scaleY: parseFloat( scale ) / 100,
12516                                            opacity: parseFloat(opacity)/100,
12517                                            x: animation_x + 'vw',
12518                                            y: animation_y + 'vh',
12519                                            filter: 'blur(' + blur + 'px)',
12520                                            rotation: rotate,
12521                                            rotationX: rotate == 0 ? perspective : 0,
12522                                            transformPerspective: '100vw',
12523                                            transformOrigin: origin,
12524                                            borderRadius: radius + radius_unit,
12525                                            visibility: 'visible',
12526                                        }
12527                                    )
12528                                    tlConds.fromTo($animateTrgrEl, {
12529                                        scaleX: parseFloat( scale ) / 100,
12530                                        scaleY: parseFloat( scale ) / 100,
12531                                        opacity: parseFloat(opacity)/100,
12532                                        x: animation_x + 'vw',
12533                                        y: animation_y + 'vh',
12534                                        filter: 'blur(' + blur + 'px)',
12535                                        rotation: rotate,
12536                                        rotationX: rotate == 0 ? perspective : 0,
12537                                        transformPerspective: '100vw',
12538                                        borderRadius: radius + radius_unit,
12539                                        transformOrigin: origin,
12540                                        duration: 1,
12541                                    }, {
12542                                        scaleX: 1,
12543                                        scaleY: 1,
12544                                        opacity: 1,
12545                                        x: 0,
12546                                        y: 0,
12547                                        filter: 'blur(0px)',
12548                                        rotation: 0,
12549                                        rotationX: 0,
12550                                        transformOrigin: origin,
12551                                        ease: easeOut,
12552                                        duration: 1,
12553                                        borderRadius: 0 + radius_unit,
12554                                        //delay: 0.1
12555                                    });	
12556                                } else {
12557                                    gsap.set(
12558                                        $animateTrgrEl, {
12559                                            scaleX: parseFloat( scale ) / 100,
12560                                            scaleY: parseFloat( scale ) / 100,
12561                                            opacity: parseFloat(opacity)/100,
12562                                            x: animation_x + 'vw',
12563                                            y: animation_y + 'vh',
12564                                            filter: 'blur(' + blur + 'px)',
12565                                            rotation: rotate,
12566                                            rotationX: rotate == 0 ? perspective : 0,
12567                                            transformPerspective: '100vw',
12568                                            transformOrigin: origin,
12569                                            visibility: 'visible',
12570                                        }
12571                                    )
12572                                    tlConds.fromTo($animateTrgrEl, {
12573                                        scaleX: parseFloat( scale ) / 100,
12574                                        scaleY: parseFloat( scale ) / 100,
12575                                        opacity: parseFloat(opacity)/100,
12576                                        x: animation_x + 'vw',
12577                                        y: animation_y + 'vh',
12578                                        filter: 'blur(' + blur + 'px)',
12579                                        rotation: rotate,
12580                                        rotationX: rotate == 0 ? perspective : 0,
12581                                        transformPerspective: '100vw',
12582                                        transformOrigin: origin,
12583                                        duration: 1,
12584                                    }, {
12585                                        scaleX: 1,
12586                                        scaleY: 1,
12587                                        opacity: 1,
12588                                        x: 0,
12589                                        y: 0,
12590                                        filter: 'blur(0px)',
12591                                        rotation: 0,
12592                                        rotationX: 0,
12593                                        transformOrigin: origin,
12594                                        duration: 1,
12595                                        ease: easeOut,
12596                                        //delay: 0.1
12597                                    });
12598                                }
12599                            }
12600                        } else {
12601                            if ( scale === 'auto' ) {
12602                                tlConds.fromTo($animateTrgrEl, {
12603                                    scaleX: 1,
12604                                    scaleY: 1,
12605                                    opacity: 1,
12606                                    x: 0,
12607                                    y: 0,
12608                                    filter: 'blur(0px)',
12609                                    rotation: 0,
12610                                    rotationX: 0,
12611                                    transformOrigin: origin,
12612                                    duration: 1,
12613                                }, {
12614                                    scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12615                                    scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12616                                    opacity: parseFloat(opacity)/100,
12617                                    x: animation_x + 'vw',
12618                                    y: animation_y + 'vh',
12619                                    filter: 'blur(' + blur + 'px)',
12620                                    rotation: rotate,
12621                                    rotationX: rotate == 0 ? perspective : 0,
12622                                    transformPerspective: '100vw',
12623                                    transformOrigin: origin,
12624                                    duration: 1,
12625                                    ease: easeOut,
12626                                    //delay: 0.1
12627                                })
12628                            } else {
12629                                tlConds.fromTo($animateTrgrEl, {
12630                                    scaleX: 1,
12631                                    scaleY: 1,
12632                                    opacity: 1,
12633                                    x: 0,
12634                                    y: 0,
12635                                    filter: 'blur(0px)',
12636                                    rotation: 0,
12637                                    rotationX: 0,
12638                                    transformPerspective: '100vw',
12639                                    transformOrigin: origin,
12640                                    borderRadius: 0 + radius_unit,
12641                                    duration: 1,
12642                                }, {
12643                                    scaleX: parseFloat( scale ) / 100,
12644                                    scaleY: parseFloat( scale ) / 100,
12645                                    opacity: parseFloat(opacity)/100,
12646                                    x: animation_x + 'vw',
12647                                    y: animation_y + 'vh',
12648                                    filter: 'blur(' + blur + 'px)',
12649                                    rotation: rotate,
12650                                    rotationX: rotate == 0 ? perspective : 0,
12651                                    transformPerspective: '100vw',
12652                                    transformOrigin: origin,
12653                                    borderRadius: radius + radius_unit,
12654                                    duration: 1,
12655                                    ease: easeOut,
12656                                    //delay: 0.1
12657                                })
12658                            }
12659                        }
12660                    }
12661                }
12662
12663                function headingReveal($el){
12664                    txtTrggrStart = true;
12665                    $('.text-reveal', $el).each(function(_key, _val){
12666                        var $txtReveal = $(_val),
12667                            dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
12668                            dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
12669                            $lines = $('.heading-line-wrap', $txtReveal),
12670                            $words = $('.split-word-inner', $txtReveal),
12671                            $chars = $('.split-char', $txtReveal),
12672                            _setTxtReveal,
12673                            $elToReveal = $words;
12674
12675                        if ( !(sticky === 'yes' || stickyCards) ) {
12676                            return;
12677                        }
12678            
12679                        easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut;
12680
12681                        if ( dataReveal === 'chars' ) {
12682                            $elToReveal = $chars;
12683                        } else if ( dataReveal === 'lines' ) {
12684                            $elToReveal = $lines;
12685                        }
12686
12687                        var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr;
12688                        scrllTrggrTxt.id = "txt_reveal_" + _key; 
12689                        scrllTrggrTxt.pin = false;
12690
12691                        gsap.set($elToReveal, {opacity: dataRevealOpacity});
12692                        var _tl = gsap.timeline({
12693                            scrollTrigger: scrllTrggrTxt
12694                        });
12695                        _tl.fromTo($elToReveal, {
12696                            opacity: dataRevealOpacity,
12697                        }, {
12698                            opacity: 1,
12699                            stagger: 0.05
12700                        });
12701
12702                        $scrollTrgrEl.one( 'uncodeWordLines', function(){
12703                            clearRequestTimeout(_setTxtReveal);
12704                            _setTxtReveal = requestTimeout( function(){
12705                                gsap.set($elToReveal, {clearProps: true});
12706                                _tl.kill(true);
12707                                if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) {
12708                                    ScrollTrigger.getById("txt_reveal_" + _key).kill(true);
12709                                }
12710                                headingReveal($el)
12711                            }, 100);
12712                        });
12713
12714                    });
12715                };
12716
12717                if (!txtTrggrStart) {
12718                    headingReveal($el);
12719                }
12720
12721                $scrollTrgrEl.one( 'uncodeWordLines', function(){
12722                    if (!txtTrggrStart) {
12723                        headingReveal($el);
12724                    }
12725                });
12726                
12727                var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
12728                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight );
12729                var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 
12730                    document.documentElement.clientWidth,  document.documentElement.scrollWidth,  document.documentElement.offsetWidth );
12731                    
12732                $(window).on('uncode-sticky-trigger-observe', function(e){
12733                    var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
12734                    var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );
12735                    $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false});
12736                    //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style');
12737                    if ( stickyCards ) {
12738                        $('.tmb', $scrollTrgrEl).removeAttr('style');
12739                    }
12740                    var scrollnow = document.body.scrollTop || document.documentElement.scrollTop;
12741                    clearRequestTimeout(setTxtReveal);
12742                    setTxtReveal = requestTimeout( function(){
12743                        $(document).trigger('uncode-scrolltrigger-refresh');
12744                        if ( isMobileUsing ) {
12745                            if ( typeof tl !== 'undefined' ) {
12746                                tl.scrollTrigger.refresh();
12747                            }
12748                            if ( typeof tlConds !== 'undefined' ) {
12749                                tlConds.scrollTrigger.refresh();
12750                            }
12751                            $(window).trigger('scroll');
12752                            _width = __width;
12753                        } else if ( _width !== __width && ( isMobileUsing ) ) {
12754                            window.dispatchEvent(new CustomEvent('vc-resize'));
12755                            if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
12756                                window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){
12757                                    if ( typeof tl !== 'undefined' ) {
12758                                        tl.scrollTrigger.refresh();
12759                                    }
12760                                    if ( typeof tlConds !== 'undefined' ) {
12761                                        tlConds.scrollTrigger.refresh();
12762                                    }
12763                                    window.lenis.scrollTo(scrollnow, {duration: 0.01});
12764                                }});
12765                            } else {
12766                                if ( typeof tl !== 'undefined' ) {
12767                                    tl.scrollTrigger.refresh();
12768                                }
12769                                if ( typeof tlConds !== 'undefined' ) {
12770                                    tlConds.scrollTrigger.refresh();
12771                                }
12772                                $(window).trigger('scroll');
12773                            }
12774                            _height = __height;
12775                        }
12776                    }, 500);
12777                });
12778
12779
12780                $(window).on('load ', function(e){
12781                    var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
12782                    if ( _height !== ___height ) {
12783                        $scrollTrgrEl.attr('data-toggled', true);
12784                        $(window).trigger('resize');
12785                        if ( typeof tl !== 'undefined' ) {
12786                            tl.scrollTrigger.refresh();
12787                        }
12788                        if ( typeof tlConds !== 'undefined' ) {
12789                            tlConds.scrollTrigger.refresh();
12790                        }
12791                        _height = ___height;
12792                    }
12793
12794                    
12795                    
12796                    $(document).trigger('uncode-scrolltrigger-refresh');
12797
12798                });
12799
12800            };
12801
12802            var callAreaAnimateScrollTl = function() {
12803                if ( stickyCards ) {
12804                    $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){
12805                        if ( key+1 < cardL || animLast || state !== 'end' ) {
12806                            var $this = $(val),
12807                                last = key+1===cardL;
12808                            areaAnimateScrollTl($this, key, last);
12809                        }
12810                    });
12811                } else {
12812                    areaAnimateScrollTl($scrollTrgrEl, 0, false);
12813                }    
12814            };
12815
12816            $(window).on('wwResize', function(){
12817                if ( !alreadyareaAnimateScrollTl ) {
12818                    if ( noMobile ) {
12819                        if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
12820                            return;
12821                        } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12822                            return;
12823                        }
12824                    }
12825                    
12826                    callAreaAnimateScrollTl();
12827                }
12828            })
12829
12830            if ( noMobile ) {
12831                if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
12832                    return;
12833                } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12834                    return;
12835                }
12836            }
12837
12838            callAreaAnimateScrollTl();
12839
12840        });
12841
12842    };
12843
12844    areaReveal();
12845
12846};
12847
12848UNCODE.thumbsReveal = function() {
12849    var recalc = false,
12850    revealThumbs = function( $el ){
12851        if ( typeof $el === 'undefined' || $el === null || !$el.length ) {
12852            $el = $('body');
12853        }
12854        $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){
12855            var $container = $(this),
12856                $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container),
12857                isContainer = false;
12858
12859            if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) {
12860                $stickys.each(function(){
12861                    var $sticky = $(this).addClass('tmb-mask-init'),
12862                        $rellax = $sticky.closest('.parallax-el'),
12863                        $inside = $('.t-inside', $sticky),
12864                        $media = $('img, video, .fluid-object', $sticky).attr('loading', ''),
12865                        val = parseFloat( $inside.attr('data-scroll-val') );
12866
12867                    if ( $rellax.length ) {
12868                        recalc = true;
12869                    }
12870
12871                    val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val;
12872                    
12873                    if ( $sticky.hasClass('tmb-mask-scroll') ) {
12874
12875                        var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both'))
12876                        ? val*0.05 : 0;
12877                        var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
12878                            ? val*4 : 0;
12879                        var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) ? parax*0.01 : 0;
12880
12881                        var tl = gsap.timeline({
12882                            scrollTrigger: {
12883                                trigger: $sticky,
12884                                scrub: true,
12885                            }
12886                        });
12887
12888                        tl.fromTo($media, {
12889                            yPercent: -(parax),
12890                            scale: 1 + zoom + extra,
12891                        }, {
12892                            yPercent: parax,
12893                            scale: 1 + extra,
12894                            ease: "none",
12895                        });
12896
12897                        if ( recalc ) {
12898                            $(window).on('uncode-thumbsreveal-refresh', function(){
12899                                if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
12900                                    tl.scrollTrigger.refresh();
12901                                }
12902                            });
12903                        }
12904                    }
12905                });
12906            }
12907
12908            if ( $container.has('.tmb-mask-reveal') ) {
12909                var $markTrigger = ".tmb-mask-reveal .t-entry-visual",
12910                staggerTime = 0.1;
12911
12912                $('.t-inside', $container).each(function(){
12913                    var checkEasing = $(this).attr('data-easing');
12914                    if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') {
12915                        gsap.registerPlugin(CustomEase);
12916                        return false;
12917                    }
12918                });
12919
12920                if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) {
12921                    $markTrigger = $container;
12922                    isContainer = true;
12923                    staggerTime = 0;
12924                }
12925
12926                ScrollTrigger.batch( $markTrigger, {
12927                    start: function( el ){
12928                        /*if ( el.trigger.offsetHeight < (window.innerHeight/2) ) {
12929                            return "bottom bottom";
12930                        } else {*/
12931                            return  "top 96%";
12932                        //}
12933                    },
12934                    onEnter: function(batch){
12935                        var $inside = $(batch).closest('.t-inside');
12936
12937                        if ( isContainer ) {
12938                            var $inside = $(batch).find('.t-inside').first();
12939                        }
12940
12941                        var delay = parseFloat( $inside.attr('data-delay') ),
12942                            speed = parseFloat( $inside.attr('data-speed') ),
12943                            easing = $inside.attr('data-easing'),
12944                            bgDelay = parseFloat( $inside.attr('data-bg-delay') );
12945
12946                        delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
12947                        speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
12948                        easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
12949                        bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
12950
12951                        if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) {
12952                            gsap.to($('.t-entry-visual-tc', batch), speed, {
12953                                clipPath: 'inset(0% 0% 0% 0%)',
12954                                stagger: staggerTime,
12955                                delay: delay,
12956                                ease: easing,
12957                            });
12958                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
12959                                clipPath: 'inset(0% 0% 0% 0%)',
12960                                stagger: staggerTime,
12961                                scale: 1,
12962                                delay: delay + (speed*bgDelay),
12963                                ease: easing,
12964                            });
12965                        } else {
12966                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
12967                                clipPath: 'inset(0% 0% 0% 0%)',
12968                                stagger: staggerTime,
12969                                scale: 1,
12970                                delay: delay,
12971                                ease: easing,
12972                            });
12973                        }
12974                                                    
12975                    }
12976                });
12977            }
12978
12979        });
12980
12981        function raf(time) {
12982            requestAnimationFrame(raf)
12983            $(window).trigger('uncode-thumbsreveal-refresh');
12984        }
12985
12986        if ( recalc ) {
12987            requestAnimationFrame(raf)
12988        }
12989
12990    };
12991    $(window).on( 'load more-items-loaded', function(){
12992        revealThumbs();
12993    });
12994
12995    $(document).on('uncode-ajax-filtered', function(){
12996        revealThumbs();
12997    });
12998
12999    if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
13000        window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
13001            var $el = model.view.$el,
13002                shortcode = model.attributes.shortcode;
13003
13004            if ( $el.is('.custom-grid-container') ) {
13005                $el = $el.parent();
13006            }
13007
13008            if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') {
13009                revealThumbs($el);
13010            }
13011        });
13012    }
13013
13014};
13015
13016UNCODE.revslider = function() {
13017	var revSlider6In = function(){
13018		$('rs-module').each(function(){
13019			var $slider = $(this);
13020
13021			$slider.on('revolution.slide.onloaded', function(e, data){
13022				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13023					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
13024						scrolltop = $(document).scrollTop();
13025					if ( style != undefined ) {
13026						UNCODE.switchColorsMenu(scrolltop, style);
13027					}
13028				}
13029			});
13030
13031			$slider.on('revolution.slide.onchange', function(e, data){
13032				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13033					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
13034						scrolltop = $(document).scrollTop();
13035					if ( style != undefined ) {
13036						UNCODE.switchColorsMenu(scrolltop, style);
13037					}
13038				}
13039			});
13040
13041		});
13042
13043	};
13044	revSlider6In();
13045	$(window).on("load", revSlider6In );
13046
13047	document.addEventListener("sr.module.ready", function(e) { 
13048		var $slider = $('#'+e.id),
13049			settings = SR7.JSON[e.id];
13050
13051		if ( typeof settings !== 'undefined' && settings !== null ) {
13052			if ( $slider.closest(".header-revslider").length ) {
13053				var style = settings.slides[1].slide.attr.data,
13054					scrolltop = $(document).scrollTop();
13055				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13056				style = style[1];
13057				if ( style[1] != undefined ) {
13058					UNCODE.switchColorsMenu(scrolltop, style);
13059				}
13060			}
13061		}
13062	});
13063
13064	document.addEventListener("sr.slide.afterChange", function(e) {
13065		var $slider = $('#'+e.id),
13066			settings = SR7.JSON[e.id];
13067
13068		if ( typeof settings !== 'undefined' && settings !== null ) {
13069			if ( $slider.closest(".header-revslider").length ) {
13070				var style = settings.slides[e.current.id].slide.attr.data,
13071					scrolltop = $(document).scrollTop();
13072				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13073				style = style[1];
13074				if ( style != undefined ) {
13075					UNCODE.switchColorsMenu(scrolltop, style);
13076				}
13077			}
13078		}
13079	});
13080
13081};
13082UNCODE.layerslider = function() {
13083	$(window).on("load", function() {
13084
13085		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
13086
13087			var slideData = slider.slides.current.data,
13088				scrolltop = $(document).scrollTop();
13089			if( slideData && slideData.skin ) {
13090
13091				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
13092
13093			}
13094		});
13095
13096	});
13097};
13098
13099UNCODE.ajax_filters = function () {
13100	var isAjaxing = false;
13101
13102/*************************
13103 *
13104 * Filters Menu and Widgets Area
13105 *
13106 ************************/
13107
13108 	var clear_clicked = false;
13109
13110 	var init_ajax_grid = function(){
13111
13112		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
13113		$grids.each(function(index, val){
13114			var $body = $('body'),
13115				$grid = $(val).addClass('init-ajax-grid'),
13116				starting_point = $grid.attr('data-toggle'),
13117				$trigger = $('.uncode-toggle-ajax-filters', $grid),
13118				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
13119				$isotope_wrapper = $('.isotope-wrapper', $grid),
13120				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
13121				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
13122				$footprint = $('.ajax-filter-footprint', $grid),
13123				sidebar_w,
13124				data_w = parseFloat( $sidebar.attr('data-max-width') ),
13125				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
13126				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
13127				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
13128				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13129				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
13130				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
13131				sidew,
13132				$inside_row = $('> .row-parent', $vc_row),
13133				bg_row,
13134				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
13135				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
13136				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
13137				sidebar_overlay = false,
13138				sidebar_hover = false,
13139				switchMobile = false,
13140				scrollTop;
13141
13142			if ( $vc_row.attr('class') ) {
13143				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
13144			}
13145
13146			if ( bg_row != null ) {
13147				$side_header.add($side_footer).addClass(bg_row[0]);
13148			}
13149
13150			$trigger.add($apply_filters).on('click', function(e){
13151				e.preventDefault();
13152				e.stopPropagation();
13153				$grid = $('.ajax-grid-system').eq(0);
13154				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13155				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13156				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13157				sidebar_w = $sidebar_wrapper.width();
13158				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13159				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
13160					$(this).trigger('uncode-ajax-clear-filters');
13161				}
13162				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13163					$grid.toggleClass('ajax-hide-filters-blanks');
13164					$sidebar.slideToggle({
13165						duration: 400,
13166						easing: 'easeOutQuad',
13167					});
13168				} else {
13169					$grid.removeClass('ajax-hide-filters-blanks');
13170					$grid.toggleClass('ajax-hide-filters');
13171					if ( $grid.hasClass('ajax-hide-filters') ) {
13172						$body.addClass('ajax-hide-filters');
13173					} else {
13174						scrollTop = $('html, body').scrollTop();
13175						$body.removeClass('ajax-hide-filters');
13176					}
13177				}
13178				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13179					$('html, body').scrollTop(scrollTop);
13180				}
13181				return false;
13182			});
13183
13184			$close_btn.on('click', function(e){
13185				e.preventDefault();
13186				$grid = $('.ajax-grid-system').eq(0);
13187				$grid.addClass('ajax-hide-filters');
13188				if ( $grid.hasClass('ajax-hide-filters') ) {
13189					$body.addClass('ajax-hide-filters');
13190				} else {
13191					scrollTop = $('html, body').scrollTop();
13192					$body.removeClass('ajax-hide-filters');
13193				}
13194				$('html, body').scrollTop(scrollTop);
13195			});
13196
13197			$sidebar_wrapper.on('mouseover',function(){
13198				sidebar_hover = true;
13199			}).on('mouseout', function(){
13200				sidebar_hover = false;
13201			});
13202
13203			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
13204				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
13205					return;
13206				}
13207				if (undefined !== from && from === 'select_active_attributes') {
13208					return;
13209				}
13210				if ($(e.target).closest('.select2-container--open').length ) {
13211					return;
13212				}
13213				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
13214					$grid.add($body).addClass('ajax-hide-filters');
13215				}
13216			});
13217
13218			$sorting_trgr.on('click', function(e) {
13219				e.preventDefault();
13220			});
13221
13222			var inside_width = function(){
13223				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13224				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13225				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13226				$inside_row = $('> .row-parent', $vc_row);
13227				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
13228					sidew = $sidebar.width();
13229					$inside_row.css({
13230						width: sidew
13231					});
13232				} else {
13233					$inside_row.css({
13234						width: ''
13235					});
13236				}
13237			};
13238			inside_width();
13239
13240			var ajax_sidebar_position = function(e, f_editor){
13241				$grid = $('.ajax-grid-system').eq(0);
13242				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13243				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13244				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13245				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13246				$inside_row = $('> .row-parent', $vc_row);
13247				scrollTop = $('html, body').scrollTop();
13248				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
13249					$grid.add($body).addClass('ajax-hide-filters');
13250					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
13251					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
13252					sidebar_overlay = true;
13253					$body.addClass('ajax-filter-sidebar-overlay');
13254					$sidebar_wrapper.addClass(skin);
13255					var sideHeadH = $side_header.outerHeight(),
13256						sideFooterH = $side_footer.outerHeight();
13257					if ( data_w !== '' && data_w > 0 ) {
13258						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
13259							$sidebar.css({
13260								'max-width': data_w
13261							});
13262						} else {
13263							$sidebar.css({
13264								'max-width':'none'
13265							});
13266						}
13267					}
13268					$vc_row.css({
13269						'padding-top':sideHeadH,
13270						'padding-bottom':sideFooterH
13271					});
13272					var sidew = $sidebar.width();
13273					$inside_row.css({
13274						width: sidew
13275					});
13276					switchMobile = true;
13277				} else {
13278					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
13279						scrollTop = $('html, body').scrollTop();
13280						$grid.add($body).removeClass('ajax-hide-filters');
13281					}
13282					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
13283						$grid.addClass('ajax-hide-filters-blanks');
13284						$sidebar.hide();
13285					}
13286					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
13287					$('.ajax-sidebar-placeholder', $grid).remove();
13288					sidebar_overlay = false;
13289					$body.removeClass('ajax-filter-sidebar-overlay');
13290					$sidebar_wrapper.removeClass(skin);
13291					if ( data_w !== '' && data_w > 0 ) {
13292						$sidebar.css({
13293							'max-width':'none'
13294						});
13295					}
13296					$vc_row.css({
13297						'padding-top':0,
13298						'padding-bottom':0,
13299					});
13300
13301					$inside_row.css({
13302						width: ''
13303					});
13304
13305					if ( f_editor === true ) {
13306						UNCODE.ajax_filters();
13307					}
13308
13309					switchMobile = false;
13310				}
13311				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13312					$('html, body').scrollTop(scrollTop);
13313				}
13314			};
13315
13316			var sidebar_width = function(){
13317				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13318					sidebar_w = $footprint.width();
13319					$sidebar.css({ width: sidebar_w });
13320				} else {
13321					$sidebar.css({ width: '' });
13322				}
13323			};
13324			sidebar_width();
13325
13326			if ( SiteParameters.is_frontend_editor ) {
13327				ajax_sidebar_position();
13328			}
13329
13330			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
13331				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
13332					ajax_sidebar_position(e);
13333				}
13334				sidebar_width();
13335			});
13336
13337			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
13338				ajax_sidebar_position(e, true);
13339			});
13340
13341			$isotope_wrapper.on('transitionend', function(e){
13342				if ( $(e.target).hasClass('isotope-wrapper') ) {
13343					window.dispatchEvent(new CustomEvent('boxResized'));
13344				}
13345				return false;
13346			});
13347
13348			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
13349				var $grid = $('.ajax-grid-system').eq(0);
13350				$grid.addClass('ajax-hide-filters');
13351			}
13352
13353		});
13354	};
13355
13356	init_ajax_grid();
13357	$(document).on('uncode-ajax-filtered', init_ajax_grid);
13358
13359/*************************
13360 *
13361 * Hover hack
13362 *
13363 ************************/
13364 	var widget_hover_hack = function() {
13365 		$('.widget, .uncode_widget').each(function(){
13366			var $widget = $(this),
13367				class_w = $widget.attr('class'),
13368				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
13369				$footer = $widget.closest('#colophon');
13370
13371			if ( class_w.indexOf('widget_yith') > 0 ) {
13372				return true;
13373			}
13374
13375			$lis.each(function(){
13376 				var $li = $(this),
13377 					$a = $('a', $li),
13378 					$label = $a.closest('label');
13379
13380				if ( !$footer.length ) {
13381					$li.addClass('no-evts');
13382				}
13383
13384				if ( ! $('span', $a).length ) {
13385 					$li.addClass( 'li-hover' );
13386 				}
13387
13388 				$('li', $li).hover(function(e){
13389 					$(e.target).parents('li').each(function(){
13390 						$(this).addClass( 'parent-li-hover' );
13391 					});
13392					}, function (e) {
13393 					$(e.target).parents('li').each(function(key, val){
13394 						if ( key === 0) {
13395	 						$(val).removeClass( 'parent-li-hover' );
13396	 					}
13397 					});
13398 				});
13399
13400				$li.off('mouseup').on('mouseup', function (e) {
13401					if (e.which !== 3) {
13402						e.stopPropagation();
13403						var $a = $('a', this).first();
13404						$a[0].click();
13405					}
13406	 			});
13407 			});
13408 		});
13409	  }
13410
13411	var ajax_filters_button_mode = $('body').hasClass('ajax-filters-button-mode');
13412
13413	if (!ajax_filters_button_mode && SiteParameters.disable_hover_hack !== '1') {
13414		widget_hover_hack();
13415		$(document).on('uncode-ajax-filtered', widget_hover_hack);
13416	}
13417
13418/*************************
13419 *
13420 * Init Filters
13421 *
13422 ************************/
13423
13424	function init_filters() {
13425		$(document).on('click', '.term-filter-link', function(e) {
13426			var _this = $(this);
13427			var widget = _this.closest('.uncode_widget');
13428			var container = get_filters_container();
13429
13430			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13431				return true;
13432			}
13433
13434			e.preventDefault();
13435
13436			if (widget.hasClass('widget-ajax-filters--checkbox')) {
13437				_this.parent().find('input[type="checkbox"]').trigger('click');
13438			} else {
13439				if (_this.hasClass('term-filter-link--active')) {
13440					_this.removeClass('term-filter-link--active');
13441				} else {
13442					_this.addClass('term-filter-link--active');
13443
13444					if (widget.hasClass('widget-ajax-filters--single')) {
13445						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
13446					}
13447				}
13448
13449				if (!ajax_filters_button_mode) {
13450					var url = _this.attr('href');
13451
13452					reload_items(container, url, true);
13453				}
13454			}
13455		});
13456
13457		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
13458			var _this = $(this);
13459			var widget = _this.closest('.uncode_widget');
13460			var link = _this.closest('.term-filter').find('.term-filter-link');
13461			var url = link.attr('href');
13462			var container = get_filters_container();
13463
13464			if (!ajax_filters_button_mode && widget.hasClass('widget-ajax-filters--no-ajax')) {
13465				window.location = url;
13466				return;
13467			}
13468
13469			if (widget.hasClass('widget-ajax-filters--single')) {
13470				widget.find('input[type="checkbox"]').each(function() {
13471					if (_this.attr('id') !== $(this).attr('id')) {
13472						$(this).prop('checked', false);
13473						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
13474					}
13475				});
13476			}
13477
13478			if (_this.prop('checked')) {
13479				link.addClass('term-filter-link--active');
13480			} else {
13481				link.removeClass('term-filter-link--active');
13482			}
13483
13484			if (!ajax_filters_button_mode) {
13485				reload_items(container, url, true);
13486			}
13487		});
13488
13489		$(document).on('change', 'select.select--term-filters', function(e) {
13490			var _this = $(this);
13491			var selected = _this.find('option:selected');
13492			var option = $(selected);
13493			var url = option.attr('data-term-filter-url');
13494			var container = get_filters_container();
13495			var widget = _this.closest('.uncode_widget');
13496
13497			if (!ajax_filters_button_mode) {
13498				if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13499					window.location = url;
13500				} else {
13501					reload_items(container, url, true);
13502				}
13503			}
13504		});
13505
13506		$(document).on('click', '.filter-list__link', function(e) {
13507			if (SiteParameters.is_frontend_editor) {
13508				return false;
13509			}
13510
13511			e.preventDefault();
13512
13513			var _this = $(this);
13514			var container = get_filters_container();
13515			var url = _this.attr('href');
13516			reload_items(container, url, true);
13517		});
13518
13519		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
13520			var _this = $(this);
13521			var container = get_filters_container();
13522			var url = _this.attr('href');
13523			reload_items(container, url, true);
13524		});
13525
13526		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
13527
13528			var _this = $(this);
13529			var container = get_filters_container();
13530			var url = _this.attr('href');
13531
13532			if ( container.length ) {
13533				e.preventDefault();
13534				reload_items(container, url, true);
13535			}
13536		});
13537
13538		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
13539			var _this = $(this);
13540			var container = get_filters_container();
13541
13542			if (container.length > 0) {
13543				e.preventDefault();
13544
13545				var min_price = $('#min_price').val();
13546				var max_price = $('#max_price').val();
13547				var location = window.location;
13548				var url = location.href;
13549				var page_uri = location.origin + location.pathname;
13550				var is_filtered = page_uri !== url;
13551
13552				if (is_filtered) {
13553					url = remove_parameter_from_url(url, 'min_price');
13554					url = remove_parameter_from_url(url, 'max_price');
13555				}
13556
13557				var concat = page_uri === url ? '?' : '&';
13558				var params = {'min_price': min_price, 'max_price': max_price};
13559
13560				url = url + concat + $.param(params);
13561
13562				reload_items(container, url, true);
13563			}
13564		});
13565
13566		var search_timer;
13567
13568		if (!ajax_filters_button_mode) {
13569			$(document).on('keyup', '.term-filters-search-input', function (e) {
13570				var _this = $(this);
13571				var container = get_filters_container();
13572				var value = _this.val();
13573
13574				if (search_timer) {
13575					clearTimeout(search_timer);
13576				}
13577
13578				search_timer = setTimeout(function () {
13579					update_search_url(container, value);
13580				}, 500);
13581			});
13582		}
13583
13584		$(document).on('click', '.btn-ajax-filters-trigger', function (e) {
13585			var container = get_filters_container();
13586
13587			if (container.length) {
13588				e.preventDefault();
13589				var paramMap = {};
13590
13591				$('.term-filter-link--active').each(function () {
13592					collect_from_query(paramMap, this.href.split('?')[1] || '');
13593				});
13594
13595				$('.select--term-filters').each(function () {
13596					var select = $(this);
13597					var val = select.val();
13598
13599					if (!val) {
13600						return
13601					};
13602
13603					var selected_option = select.find('option:selected');
13604					var qUrl = selected_option.data('term-filter-url') || '';
13605
13606					collect_from_query(paramMap, qUrl.split('?')[1] || '');
13607				});
13608
13609				var search = $('.term-filters-search-input');
13610
13611				if (search.length > 0) {
13612					var search_value = search.val().trim();
13613					if (search_value) {
13614						paramMap[SiteParameters.ajax_filter_key_search] = {};
13615						paramMap[SiteParameters.ajax_filter_key_search][search_value] = 1;
13616					}
13617				}
13618
13619				var qsParts = [];
13620				$.each(paramMap, function (key, valSet) {
13621					var vals = Object.keys(valSet);
13622					qsParts.push(key + '=' + vals.join(','));
13623				});
13624
13625				var final_url = window.location.origin + window.location.pathname;
13626
13627				if (qsParts.length > 0) {
13628					qsParts.push('unfilter=1');
13629
13630					var qs = qsParts.join('&');
13631					final_url = '?' + qs;
13632				}
13633
13634				reload_items(container, final_url, true);
13635			}
13636		});
13637	}
13638
13639	function collect_from_query(paramMap, query) {
13640		$.each(query.split('&'), function (_, pair) {
13641			if (!pair) {
13642				return
13643			};
13644
13645			var kv  = pair.split('=');
13646			var key = kv[0];
13647			var val = kv[1] || '';
13648
13649			if (key === 'unfilter') {
13650				return;
13651			}
13652			if (!paramMap[key]) {
13653				paramMap[key] = {}
13654			};
13655
13656			paramMap[key][val] = 1;
13657		});
13658	}
13659
13660	function update_search_url(container, search_value) {
13661		var location = window.location;
13662		var url = location.href;
13663		var page_uri = location.origin + location.pathname;
13664		var is_filtered = page_uri !== url;
13665		var key_search = SiteParameters.ajax_filter_key_search;
13666		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
13667
13668		if (is_filtered) {
13669			url = remove_parameter_from_url(url, key_search);
13670			url = remove_parameter_from_url(url, key_unfilter);
13671		}
13672
13673		if (search_value) {
13674			var concat = page_uri === url ? '?' : '&';
13675			var params = {};
13676
13677			params[key_search] = search_value;
13678			params[key_unfilter] = 1;
13679			url = url + concat + $.param(params);
13680		} else {
13681			url = remove_parameter_from_url(url, key_search);
13682		}
13683
13684		reload_items(container, url, true);
13685	}
13686
13687	function remove_parameter_from_url(url, parameter) {
13688		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
13689	}
13690
13691	function get_filters_container() {
13692		var container = $('.ajax-grid-system');
13693
13694		if (container.length == 0) {
13695			container = $('.ajax-filters');
13696		}
13697
13698		if (container.length == 0) {
13699			container = $('.ajax-filters-target');
13700		}
13701
13702		return container;
13703	}
13704
13705	function update_widgets_state(widgets_states, container) {
13706		for (var i = widgets_states.length - 1; i >= 0; i--) {
13707			var state = widgets_states[i];
13708
13709			if (!state.collapse) {
13710				continue;
13711			}
13712
13713			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
13714
13715			if (state.open) {
13716				new_widget.find('.widget-title').addClass('open');
13717				if (state.css) {
13718					new_widget.find('.widget-collapse-content').attr('style', state.css);
13719				}
13720			} else {
13721				new_widget.find('.widget-title').removeClass('open');
13722				if (state.css) {
13723					new_widget.find('.widget-collapse-content').attr('style', state.css);
13724				}
13725			}
13726		}
13727	}
13728
13729	// Find filters container
13730	function find_filters_container(context) {
13731		return context.find('.widget-ajax-filters').closest('.row-parent').find('.uncol').first();
13732	}
13733
13734	// Reload items via AJAX
13735	function reload_items(container, url, push) {
13736		if (isAjaxing) {
13737			return
13738		};
13739
13740		isAjaxing = true;
13741
13742		container.addClass('grid-filtering');
13743
13744		$.ajax({
13745			url     : url,
13746			success : function(response) {
13747				if (!response) {
13748					return;
13749				}
13750
13751				$(document).trigger('uncode-ajax-pre-filtered');
13752
13753				var container_id = container.attr('id');
13754				var pagination = $('.row-navigation');
13755				var filters_container;
13756
13757				var isTargetFilterMode = container.hasClass('ajax-filters-target');
13758
13759				if (isTargetFilterMode) {
13760					filters_container = find_filters_container($(document));
13761				}
13762
13763				if (container_id) {
13764					var container_to_append = $(response).find('#' + container_id);
13765					var pagination_to_append = $(response).find('.row-navigation');
13766					var filters_to_append;
13767					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
13768
13769					if (isTargetFilterMode) {
13770						filters_to_append = find_filters_container($(response));
13771					}
13772
13773					// Remember open/closed widgets
13774					var widgets = $('.uncode_widget');
13775					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
13776					var widgets_states = [];
13777
13778					widgets.each(function() {
13779						var widget = $(this);
13780						var id = widget.attr('data-id');
13781						var state = {
13782							'id': id,
13783							'collapse': false,
13784							'open': false,
13785							'css': false,
13786						};
13787
13788						var collapse_wrapper = widget.find('.widget-collapse-content');
13789
13790						if (collapse_wrapper.length > 0) {
13791							state.collapse = true;
13792
13793							var collapse_wrapper_css = collapse_wrapper.attr('style');
13794							var title = widget.find('.widget-title');
13795
13796							state.css = collapse_wrapper_css;
13797
13798							if (title.hasClass('open')) {
13799								state.open = true;
13800							} else {
13801								state.open = false;
13802							}
13803						}
13804
13805						widgets_states.push(state);
13806					});
13807
13808					// Update widgets state when it is not in target mode
13809					if (! isTargetFilterMode && offcanvas_sidebar_wrapper.length === 0) {
13810						update_widgets_state(widgets_states, container_to_append);
13811					}
13812
13813					// Update default sidebar state
13814					if (!container.hasClass('ajax-hide-filters')) {
13815						container_to_append.removeClass('ajax-hide-filters');
13816					}
13817
13818					// Update horizontal sidebar
13819					if (!container.hasClass('ajax-hide-filters-blanks')) {
13820						container_to_append.removeClass('ajax-hide-filters-blanks');
13821					}
13822					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
13823					if (horizontal_sidebar_wrapper.length > 0) {
13824						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
13825						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
13826						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
13827						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
13828
13829						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
13830						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
13831					}
13832
13833					// Append container
13834					container.replaceWith(container_to_append);
13835
13836					// Hide first thumbnail until the new srcset is loaded
13837					if (SiteParameters.dynamic_srcset_active === '1') {
13838						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
13839					}
13840
13841					// Remove loading attribute to images
13842					container_to_append.find('img').attr('loading', '');
13843
13844					// Append pagination
13845					if (pagination.length > 0) {
13846						if (pagination_to_append.length > 0) {
13847							pagination.html(pagination_to_append.html());
13848						} else {
13849							pagination.html('');
13850						}
13851					} else {
13852						if (pagination_to_append.length > 0) {
13853							$('.post-wrapper').append(pagination_to_append);
13854						}
13855					}
13856
13857					// Append filters
13858					if (isTargetFilterMode && filters_container.length > 0) {
13859						filters_container.html(filters_to_append.html());
13860					}
13861
13862					// Update widgets state when it is in target mode
13863					if (isTargetFilterMode && filters_container.length > 0) {
13864						update_widgets_state(widgets_states, filters_container);
13865					}
13866
13867					// Update off canvas sidebar (mobile and overlay)
13868					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
13869
13870					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
13871						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
13872						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
13873						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
13874						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
13875
13876						// Update widgets state
13877						update_widgets_state(widgets_states, sidebar_to_append);
13878
13879						// Update sidebar
13880						sidebar_container.html(sidebar_to_append.html());
13881					}
13882
13883					if (push) {
13884						UNCODE.lastURL = url;
13885						window.history.pushState(
13886							{ pageTitle: document.title },
13887							'',
13888							url
13889						);
13890					}
13891
13892					if (typeof UNCODE.isotopeLayout !== 'undefined') {
13893						UNCODE.isotopeLayout();
13894					}
13895					if (typeof UNCODE.justifiedGallery !== 'undefined') {
13896						UNCODE.justifiedGallery();
13897					}
13898					if (typeof UNCODE.cssGrid !== 'undefined') {
13899						UNCODE.cssGrid();
13900					}
13901					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
13902						UNCODE.lightbox();
13903					}
13904					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
13905						UNCODE.lightgallery();
13906					}
13907					if (typeof UNCODE.carousel !== 'undefined') {
13908						UNCODE.carousel($('body'));
13909					}
13910					UNCODE.animations();
13911					if (typeof UNCODE.filters !== 'undefined') {
13912						UNCODE.filters();
13913					}
13914					if (typeof UNCODE.widgets !== 'undefined') {
13915						UNCODE.widgets();
13916					}
13917
13918					if (SiteParameters.dynamic_srcset_active === '1') {
13919						UNCODE.refresh_dynamic_srcset_size();
13920					}
13921
13922					if (typeof UNCODE.menuSmartInit !== 'undefined') {
13923						UNCODE.menuSmartInit();
13924					}
13925
13926					if (typeof UNCODE.parallax !== 'undefined') {
13927						UNCODE.parallax();
13928					}
13929
13930					maybe_scroll_to_top();
13931
13932					var woo_select2_cats = $('.dropdown_product_cat');
13933
13934					if (woo_select2_cats.length > 0) {
13935						woo_select2_cats.on( 'change', function() {
13936							if ( $(this).val() != '' ) {
13937								var this_page = '';
13938								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
13939								if ( home_url.indexOf( '?' ) > 0 ) {
13940									this_page = home_url + '&product_cat=' + $(this).val();
13941								} else {
13942									this_page = home_url + '?product_cat=' + $(this).val();
13943								}
13944								location.href = this_page;
13945							} else {
13946								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
13947							}
13948						});
13949
13950						if ( $().selectWoo ) {
13951							var wc_product_cat_select = function() {
13952								woo_select2_cats.selectWoo( {
13953									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
13954									minimumResultsForSearch: 5,
13955									width: '100%',
13956									allowClear: true,
13957									language: {
13958										noResults: function() {
13959											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
13960										}
13961									}
13962								} );
13963							};
13964							wc_product_cat_select();
13965						}
13966					}
13967
13968					$(document).trigger('uncode-ajax-filtered');
13969					$(document.body).trigger('init_price_filter');
13970					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
13971					window.document.dispatchEvent(new Event("DOMContentLoaded", {
13972						bubbles: true,
13973						cancelable: true
13974					}));
13975
13976					isAjaxing = false;
13977				}
13978			},
13979			error: function() {
13980				container.removeClass('grid-filtering');
13981
13982				isAjaxing = false;
13983
13984				if (SiteParameters.enable_debug == true) {
13985					// This console log is disabled by default
13986					// So nothing is printed in a typical installation
13987					//
13988					// It can be enabled for debugging purposes setting
13989					// the 'uncode_enable_debug_on_js_scripts' filter to true
13990					console.log('There was an error retrieving the products');
13991				}
13992			}
13993		});
13994	}
13995
13996	// Scroll to top after filtering
13997	function maybe_scroll_to_top() {
13998		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
13999
14000		if (offcanvas_sidebar_wrapper.length > 0) {
14001			return;
14002		}
14003
14004		var container = get_filters_container();
14005		var bound = container[0].getBoundingClientRect();
14006
14007		if (bound.y < 0) {
14008			$(window).scrollTop(container.offset().top);
14009		}
14010	}
14011
14012	// Back/forward browser buttons
14013	$(window).on("popstate.ajaxfilters", function(e) {
14014		var location = window.location;
14015		var url = location.href;
14016		var params = UNCODE.getURLParams(window.location);
14017		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
14018
14019		UNCODE.lastURL = url;
14020
14021		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
14022			return;
14023		}
14024
14025		var container = get_filters_container();
14026
14027		reload_items(container, url, false);
14028	});
14029
14030	// Destroy load more before to init a new one
14031	$(window).on('uncode-ajax-pre-filtered', function() {
14032		if ($.fn.infinitescroll) {
14033			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
14034		}
14035	});
14036
14037	init_filters();
14038};
14039
14040UNCODE.videoThumbs = function() {
14041	var checkResize,
14042		newW = UNCODE.wwidth;
14043	var checkForVideos = function(){
14044
14045		$(window).on('okevents.y.change', function(e, y){
14046			var $video = $(y.target.g),
14047				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14048				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14049				restart = !$video_wrap.hasClass('play-pause'),
14050				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14051				setTime;
14052			if ( newW >= UNCODE.mediaQuery ) {
14053
14054				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
14055					$video_wrap.data('hovered', true);
14056					$video_wrap.addClass('played-on');
14057					y.target.pauseVideo();
14058					$tmb.on('mouseenter', function(){
14059						if ( restart ) {
14060							y.target.seekTo(0);
14061						}
14062						y.target.playVideo();
14063					}).on('mouseleave', function(){
14064						clearTimeout(setTime);
14065						setTime = setTimeout(function(){
14066							y.target.pauseVideo();
14067						}, 300);
14068					});
14069				}
14070
14071			} else {
14072				if( $mobile_video_wrap.length ) {
14073					$video_wrap.addClass('played-on');
14074					y.target.playVideo();
14075				}
14076			}
14077
14078		});
14079
14080		$(window).on('okevents.v.loaded', function(e, playerV){
14081			var $video = $(playerV.element),
14082				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14083				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14084				restart = !$video_wrap.hasClass('play-pause'),
14085				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
14085: $video.closest('.t-entry-visual, .un-inline-image'),
14086				setTime;
14087
14088			if ( newW >= UNCODE.mediaQuery ) {
14089				
14090				if( $video_wrap.length ) {
14091
14092					var playPromise = playerV.play();
14093					if (playPromise !== undefined) {
14094						playPromise.then(function( value ) {
14095							playerV.pause();
14096						});
14097					}
14098					$video_wrap.addClass('played-on');
14099					$tmb.on('mouseenter', function(){
14100						if ( restart ) {
14101							playerV.setCurrentTime(0)
14102						}
14103						playerV.play();
14104					}).on('mouseleave', function(){
14105						clearTimeout(setTime);
14106						setTime = setTimeout(function(){
14107							playerV.pause();
14108						}, 300);
14109					});
14110				}
14111
14112			} else {
14113
14114				if( $mobile_video_wrap.length ) {
14115					var playPromise = playerV.play();
14116					if (playPromise !== undefined) {
14117						playPromise.then(function( value ) {
14118							playerV.play();
14119						});
14120					}
14121					$video_wrap.addClass('played-on');
14122				}
14123			}
14124		});
14125
14126		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
14127			var $video = $(video),
14128				$noscript = $('noscript', $video),
14129				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14130				restart = !$video_wrap.hasClass('play-pause'),
14131				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14132				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14133				setTime,
14134			manageVideo = function(){
14135				video.currentTime = 0;
14136				video.pause();
14137				if ( newW >= UNCODE.mediaQuery ) {
14138					if ( $video_wrap.length ) {
14139						$video_wrap.addClass('played-on');
14140						$tmb.on('mouseenter', function(){
14141							if ( restart ) {
14142								video.currentTime = 0;
14143							}
14144							video.play();
14145						}).on('mouseleave', function(){
14146							clearTimeout(setTime);
14147							setTime = setTimeout(function(){
14148								video.pause();
14149							}, 300);
14150						});
14151					} else {
14152						video.play();
14153					}
14154				} else {
14155					if ( $mobile_video_wrap.length ) {
14156						$mobile_video_wrap.addClass('played-on');
14157						video.play();
14158					}
14159				}
14160
14161			};
14162			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
14163				$noscript.each(function(key, val){
14164					$noscript.after(val.textContent || val.innerText || val.innerHTML);
14165					$noscript.remove();
14166				});
14167			}
14168
14169			if (typeof MediaElement === "function") {
14170				$video.has('source[src]').mediaelementplayer({
14171					pauseOtherPlayers: false,
14172				});
14173			}
14174			if (video.readyState > 0) {
14175				manageVideo();
14176			} else {
14177				window.addEventListener("pageshow", function (event) {
14178					if (event.persisted) {
14179						manageVideo();
14180					}
14181				});				
14182				$video.on("loadedmetadata", function(_event) {
14183					manageVideo();
14184				});
14185			};
14186		});
14187	
14188	};
14189	
14190	checkForVideos();
14191
14192	var checkVideoResize = function(){
14193		clearRequestTimeout(checkResize);
14194		checkResize = requestTimeout(function(){
14195			if ( newW !== UNCODE.wwidth ) {
14196				checkForVideos();
14197				newW = UNCODE.wwidth;
14198			}
14199		}, 1000);
14200	};
14201
14202	$(window).off('resize.videos', checkVideoResize)
14203	.on( 'resize.videos', checkVideoResize);
14204
14205	$(window).off('more-items-loaded.videos', checkForVideos)
14206	.on('more-items-loaded.videos', checkForVideos);
14207
14208	$(document).off('uncode-ajax-filtered.videos', checkForVideos)
14209	.on('uncode-ajax-filtered.videos', checkForVideos);
14210
14211};
14212UNCODE.inlineImgs = function() {
14213    var linkInlineImgs = function(){
14214        $('.un-inline-image').each(function(){
14215            var $img = $(this),
14216                href = $(this).attr('data-link-href'),
14217                dataImg = $img.data();
14218			if ( dataImg != '' && href != null && href !== '' ) {
14219                var class_stra_a = 'unline-image-link';
14220                if ( $(this).hasClass('un-inline-space-over') ) {
14221                    class_stra_a += ' un-inline-space-over';
14222                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
14223                    class_stra_a += ' un-inline-space-gutter';
14224                }
14225                var str_a = '<a class="' + class_stra_a + '" ';
14226                for (var key in dataImg) {
14227                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
14228                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
14229                    }
14230                }
14231                str_a += ' />';
14232                $img.wrap(str_a);
14233			}
14234        });
14235    };
14236    $(window).on('load', linkInlineImgs );
14237};
14238UNCODE.lottie = function() {
14239    if ( SiteParameters.is_frontend_editor ) {
14240        var $lottie_wraps = $('div.uncode-lottie-wrap');
14241        $lottie_wraps.each(function(){
14242            var $lottie_wrap = $(this),
14243                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
14244                $player_clone = $div_player.clone(),
14245                player_id = $div_player.attr('data-id'),
14246                $lottie_players = $('lottie-player', $lottie_wrap).remove();
14247            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
14248                if ( $('#'+player_id).length ) {
14249                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
14250                }
14251                $player_clone.attr('id', player_id);
14252                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
14253                $div_player.after($player_clone);
14254                $div_player.attr('data-init',true);
14255            }
14256        });
14257    }
14258    var $players = $('.uncode-lottie-wrap lottie-player');
14259    $players.each(function(){
14260        var player = this,
14261            this_id = $(player).attr('id'),
14262            _player = document.getElementById(this_id),
14263            trigger = $(player).attr('data-trigger'),
14264            pFrames = $(player).attr('data-frames').split(','),
14265            srcPlayer = $(player).attr('src');
14266
14267        _player.load(srcPlayer);
14268
14269        _player.addEventListener("ready", function() {
14270
14271            var $_shadow = _player.shadowRoot;
14272            $($_shadow).find('.error').remove();
14273
14274            var tFrames = _player.getLottie().totalFrames / 100,
14275                pFrame_from = Math.round(tFrames * pFrames[0]),
14276                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
14277                loop = $(player).attr('loop'),
14278                mode,
14279                actions;
14280
14281            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
14282                if ( trigger === 'scroll' ) {
14283                    mode = 'scroll';
14284                    actions = [
14285                        {
14286                            visibility:[0, 1.0],
14287                            type: "seek",
14288                            frames: [pFrame_from, pFrame_to],
14289                        }
14290                    ];
14291                } else if ( trigger === 'viewport') {
14292                    mode = 'scroll';
14293                    actions = [
14294                        {
14295                            visibility: [0.20, 1.0],
14296                            frames: [pFrame_from, pFrame_to],
14297                            type: loop ? "loop" : "play"
14298                        }
14299                    ];
14300                } else if ( trigger === 'hover') {
14301                    $(player).on('mouseenter', function(){
14302                        _player.play();
14303                    }).on('mouseleave', function(){
14304                        _player.pause();
14305                    });
14306                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
14307                        _player.seek(pFrame_from);
14308                        _player.addEventListener("frame", function(){
14309                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
14310                                _player.seek(pFrame_from);
14311                            }
14312                        });
14313                    }
14314                }
14315                LottieInteractivity.create({
14316                    player: '#' + this_id,
14317                    mode: mode,
14318                    actions: actions
14319                });
14320            } else {
14321                if ( pFrame_from > 0 && pFrame_from < 99 ) {
14322                    _player.seek(pFrame_from);
14323                    _player.addEventListener("frame", function(){
14324                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
14325                            _player.seek(pFrame_from);
14326                        }
14327                    });
14328                }
14329            }
14330        });
14331
14332        $(window).on('unlottie-destroy', function(){
14333            _player.destroy();
14334        });
14335    });
14336};
14337
14338UNCODE.animatedBgGradient = function( _el ) {
14339
14340    var ev;
14341
14342	if ( typeof _el === 'undefined' || _el === null ) {
14343        _el = document;
14344        ev = false;
14345	} else {
14346        _el = _el[0];
14347        ev = 'shortcode:update';
14348    }
14349
14350    var simplex = new SimplexNoise();
14351
14352    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
14353		this.block = blockOverlay;
14354		this.wrap = canvasWrap;
14355		this.config();
14356		this.checker();
14357		this.loopRAF();
14358        this.animLoader();
14359    };
14360
14361    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
14362
14363    AnimGradient.config = function() {
14364        this.canvas = document.createElement('canvas');
14365        this.wrap.appendChild(this.canvas);
14366        this.ctx = this.canvas.getContext('2d');
14367        this.count = 0;        
14368        this.isOrientationChanged = false;
14369        this.res = UNCODE.isMobile ? 90 : 110;
14370        this.resPercent = 100/this.res;
14371        this.resAround = this.resPercent/100;
14372        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;
14373
14374        this.canvas.classList.add('uncode-bg-animated-gradient');
14375        this.canvas.setAttribute('height', this.res);
14376        this.canvas.setAttribute('width', this.res);
14377        this.canvas.style = 'height: 100%; position: relative; width:100%;';
14378
14379        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
14380
14381        this.cx = this.canvas.width/2;
14382        this.cy = this.canvas.height/2;
14383        this.data = this.imgdata.data;
14384
14385        this.opts = {
14386            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,
14387            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,
14388            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
14389        };
14390
14391        this.lavaTime = 1;
14392        this.bg_colors = [];
14393
14394        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
14395            return;
14396        }
14397
14398        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
14399            this.singleColor = true;
14400        }
14401
14402        if( this.opts.col_1st ) {
14403
14404            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
14405
14406            this.bg_colors.push({
14407                r: rgbColor1.r,
14408                g: rgbColor1.g,
14409                b: rgbColor1.b
14410            });
14411        }
14412
14413        if( this.opts.col_2nd ) {
14414
14415            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
14416
14417            this.bg_colors.push({
14418                r: rgbColor2.r,
14419                g: rgbColor2.g,
14420                b: rgbColor2.b
14421            });
14422        }
14423
14424    };
14425
14426    AnimGradient.checker = function() {
14427        var scope = this;
14428        this.checkInViewPort();
14429      
14430        window.addEventListener('resize', function() {
14431            if(UNCODE.isMobile && !scope.isOrientationChanged) {
14432                return;
14433            }
14434            scope.ratioCalc();
14435        });
14436
14437        window.addEventListener("orientationchange", function() {
14438            scope.isOrientationChanged = true;
14439        });
14440
14441        this.ratioCalc();
14442    }; 
14443
14444    AnimGradient.ratioCalc = function() {
14445      
14446        var blockW = this.block.clientWidth,
14447            blockH = this.block.clientHeight;
14448
14449        var blockRatio = blockH/blockW;
14450
14451        if(blockRatio < 1) {
14452            this.ratioParam = {
14453                x: 1.4,
14454                y: blockRatio*1.4
14455            }
14456        } else {
14457            this.ratioParam = {
14458                x: blockRatio/3,
14459                y: 1
14460            }
14461        }
14462         
14463    };
14464
14465    AnimGradient.checkInViewPort = function() {
14466		if( 'IntersectionObserver' in window ) {
14467		    var scope = this,
14468                observer = new IntersectionObserver(function(entries) {
14469  
14470                entries.forEach(function(entry){
14471                    if ( entry.isIntersecting ) {
14472                        scope.isInViewport = true;
14473                    } else {
14474                        scope.isInViewport = false;
14475                    }
14476                });
14477  
14478		    }, { 
14479			root: document,
14480		  });
14481  
14482		  observer.observe(this.block);
14483		}
14484	};
14485	
14486    AnimGradient.hexToRGB = function(hexval) {
14487        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
14488        if (!hexecuted) {
14489            return false;
14490        }
14491        return {
14492            r: parseInt(hexecuted[1], 16),
14493            g: parseInt(hexecuted[2], 16),
14494            b: parseInt(hexecuted[3], 16)
14495        }
14496    };
14497
14498    AnimGradient.factor = function(val_1, val_2, lava) { 
14499        return val_1 * (1 - lava) + val_2 * lava;
14500    };
14501
14502    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
14503        if (this.singleColor) {
14504            return this.bg_colors[0][wave_l];
14505        }
14506        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 );
14507        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
14508    };
14509
14510    AnimGradient.lava = function(x, y, grade) {
14511        var radians = (Math.PI / 180) * grade,
14512        cos = Math.cos(radians),
14513        sin = Math.sin(radians),
14514        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
14515        return nx;
14516    };
14517    
14518    AnimGradient.loopRAF = function() {
14519
14520      var scope = this;
14521
14522        if( this.isInViewport ) {
14523            for (var x = 0; x < this.res; x++) {
14524                for (var y = 0; y < this.res; y++) {
14525                    
14526                    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
14527        
14528                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
14529                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
14530                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
14531                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
14532                  
14533                }
14534            }
14535   
14536            this.count++;
14537          
14538            this.ctx.putImageData(this.imgdata, 0, 0);
14539         
14540        }
14541
14542        requestAnimationFrame(function() {
14543            scope.loopRAF();
14544        });
14545    };
14546
14547    AnimGradient.animLoader = function() {
14548        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
14549    };
14550
14551    var anim_init = function() {
14552        var bgs = _el.querySelectorAll('.block-bg-overlay');
14553      
14554        bgs.forEach(function(blockOverlay) {
14555            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
14556            if( !blockOverlay || !canvasWrap ) {
14557                return;
14558            }
14559            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
14560        });
14561    }
14562
14563    $(window).on('load', function(){
14564        anim_init();
14565    });
14566
14567    if ( ev === 'shortcode:update' ) {
14568        anim_init();
14569    }
14570
14571};
14572UNCODE.multibg = function(){
14573	var $bgsWraps = $('.uncode-multi-bgs'),
14574		$body = $('body');
14575	$bgsWraps.each(function(){
14576		var $bgWrap = $(this),
14577			transition = $bgWrap.attr('data-transition'),
14578			transitionTime = $bgWrap.attr('data-transition-time'),
14579			dataPace = $bgWrap.attr('data-transition-pace'),
14580			dataThreshold = $bgWrap.attr('data-transition-threshold'),
14581			dataTime = $bgWrap.attr('data-carousel-time'),
14582			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
14583			random = $bgWrap.attr('data-multi-random'),
14584			_bgWrap = $bgWrap[0],
14585			$multiBgs = $('.multi-background', $bgWrap),
14586			imgFirst,
14587			bgAmount = $multiBgs.length,
14588			isInViewport = false,
14589			lastScrollTop = 0,
14590			counter = 0,
14591			totMove = 0,
14592			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
14593			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
14594			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
14595			offX, offY,
14596			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
14597			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
14598			requestCarousel,
14599			is_header = $bgWrap.closest('#page-header').length,
14600			startTime = new Date();
14601
14602		transition = typeof transition === 'undefined' ? '' : transition;
14603
14604		if ( random === 'true' ) {
14605			UNCODE.shuffle($multiBgs);
14606		}
14607
14608		$multiBgs.find('.background-inner').attr('data-active','false');
14609
14610		imgFirst = $multiBgs.first().find('.background-inner').attr('data-active','true').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
14611
14612		var loadFirst = function(){
14613			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
14614				opacity: 1
14615			}, 250, 'easeInQuad').css({
14616				zIndex: 1
14617			});	
14618		}
14619
14620		var loadError = function(){
14621			console.log('Multi BG loading error');
14622		}
14623
14624		UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
14625
14626		var loadSlides = function( $thisBg ){
14627			$thisBg.attr('data-load', 'loaded');	
14628		}
14629
14630		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
14631			var $thisBg = $(val);
14632
14633			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
14634
14635				var _imgBg = $(val).find('.background-inner').css('background-image');
14636
14637				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
14638					$thisBg.attr('data-load', 'loaded');
14639				} else {
14640					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
14641					if ( typeof _imgBg !== 'undefined' ) {
14642						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
14643					}
14644				}
14645			}
14646		});
14647					
14648		var multiCarousel = function(e) {
14649
14650			clearRequestTimeout(requestCarousel);
14651
14652			var checkTime = new Date();
14653			if ( checkTime - startTime >= carouselTime && isInViewport ) {
14654				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
14655
14656				if ( $checkEl.attr('data-load') !== 'loaded' ) {
14657					requestTimeout(function(){
14658						multiCarousel();
14659					}, 100);
14660					return;
14661				}
14662
14663				counter++;
14664
14665				$multiBgs.each(function(ind, val){
14666					if ( ind === counter%bgAmount ) {
14667						$(val).stop(true,false).animate({
14668							opacity: 1
14669						}, wait, 'easeInQuad').css({
14670							zIndex: 1
14671						}).find('.background-inner').attr('data-active','true');
14672					} else {
14673						$(val).stop(true,false).animate({
14674							opacity: 0
14675						}, wait, 'easeInQuad', function(){
14676							console.log('check1', $(val));
14677							$(val).find('.background-inner').attr('data-active','false');
14678						}).css({
14679							zIndex: 0
14680						});
14681					}
14682				});
14683
14684			}
14685
14686			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
14687				requestCarousel = requestTimeout(multiCarousel, carouselTime);
14688			}
14689	
14690		};
14691
14692		var multiMove = function(e) {
14693			if ( $body.hasClass('navbar-hover') ) {
14694				return;
14695			}
14696			var checkTime = new Date(),
14697                bound = $bgWrap[0].getBoundingClientRect(),
14698                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
14699			if (offX) {
14700				totMove += Math.sqrt(
14701					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
14702				);
14703			}
14704			if (
14705                totMove >= pace && 
14706                checkTime - startTime >= wait &&
14707                e.clientX <= (bound.left + bound.width) &&
14708                e.clientX >= bound.left &&
14709                e.clientY <= (bound.top + bound.height) &&
14710                e.clientY >= bound.top
14711            ) {
14712				counter++;
14713				startTime = checkTime;
14714				$multiBgs.each(function(ind, val){
14715					if ( ind === counter%bgAmount ) {
14716						$(val).stop(true,false).animate({
14717							opacity: 1
14718						}, wait, 'easeInQuad').css({
14719							zIndex: 1
14720						}).find('.background-inner').attr('data-active','true');
14721					} else {
14722						$(val).stop(true,false).animate({
14723							opacity: 0
14724						}, wait, 'easeInQuad', function(){
14725							console.log('check2', $(val));
14726							$(val).find('.background-inner').attr('data-active','false');
14727						}).css({
14728							zIndex: 0
14729						});
14730					}
14731				});
14732
14733				totMove = 0;
14734			}
14735			
14736			offX = e.clientX;
14737			offY = e.clientY;
14738			
14739		};
14740
14741		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
14742			document.addEventListener("mousemove", multiMove);
14743		}
14744
14745		window.addEventListener('resize', function() {
14746			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
14747				document.removeEventListener("mousemove", multiMove);
14748				document.addEventListener("mousemove", multiMove);
14749			}
14750		});
14751
14752		var lightLoopRAF = function() {
14753
14754			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
14755				checkTime = new Date(),
14756				bound = $bgWrap[0].getBoundingClientRect(),
14757				thresholdHeader = is_header ? 100 : threshold,
14758				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
14759			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
14760				counter++;
14761				lastScrollTop = scrollTop;
14762				startTime = checkTime;
14763
14764				$multiBgs.each(function(ind, val){
14765					if ( ind === counter%bgAmount ) {
14766						$(val).stop(true,false).animate({
14767							opacity: 1
14768						}, wait, 'easeInQuad').css({
14769							zIndex: 1
14770						}).find('.background-inner').attr('data-active','true');
14771					} else {
14772						$(val).stop(true,false).animate({
14773							opacity: 0
14774						}, wait, 'easeInQuad', function(){
14775							console.log('check3', $(val));
14776							$(val).find('.background-inner').attr('data-active','false');
14777						}).css({
14778							zIndex: 0
14779						});
14780					}
14781				});
14782
14783			}
14784
14785			requestAnimationFrame(function() {
14786				if ( isInViewport ) {
14787					lightLoopRAF();
14788				}
14789			});
14790		};
14791
14792		var currentInd = 0;
14793
14794		var loopRAF = function() {
14795
14796			var multiBgRotate = function(slideInd){
14797				currentInd = slideInd;
14798				$multiBgs.each(function(ind, val){
14799					if ( ind === slideInd ) {
14800						$(val).stop(true,false).animate({
14801							opacity: 1
14802						}, wait, 'easeInQuad').css({
14803							zIndex: 1
14804						}).find('.background-inner').attr('data-active','true');
14805					} else {
14806						$(val).stop(true,false).animate({
14807							opacity: 0
14808						}, wait, 'easeInQuad', function(){
14809							console.log('check', $(val));
14810							$(val).find('.background-inner').attr('data-active','false');
14811						}).css({
14812							zIndex: 0
14813						});
14814					}
14815				});
14816			};
14817			var bound = $bgWrap[0].getBoundingClientRect(),
14818				thresholdPX = UNCODE.wheight * threshold / 100,
14819				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
14820				movePX = totMove / bgAmount,
14821				moving = UNCODE.wheight - (bound.top + thresholdPX),
14822				slideInd = 0;
14823
14824			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
14825				multiBgRotate(0);
14826			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
14827				multiBgRotate(bgAmount-1);
14828			} else {
14829				slideInd = Math.ceil(moving/movePX) - 1;
14830				if ( slideInd < 0 ) {
14831					slideInd = 0;
14832				} else if ( slideInd >= bgAmount ) {
14833					slideInd = bgAmount-1;
14834				}
14835				if ( slideInd !== currentInd ) {
14836					multiBgRotate(slideInd);
14837				}
14838			}
14839
14840			requestAnimationFrame(function() {
14841				if ( isInViewport ) {
14842					loopRAF();
14843				}
14844			});
14845		};
14846
14847		if( 'IntersectionObserver' in window ) {
14848		    var observer = new IntersectionObserver(function(entries) {
14849  
14850                entries.forEach(function(entry){
14851                    if ( entry.isIntersecting ) {
14852                        isInViewport = true;
14853						if ( transition === 'scroll' ) {
14854							if ( autoScroll ) {
14855								loopRAF();
14856							} else {
14857								lightLoopRAF();
14858							}
14859						} else {
14860							multiCarousel();
14861						}
14862                    } else {
14863                        isInViewport = false;
14864                   }
14865                });
14866  
14867		    }, { 
14868				root: document,
14869				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
14870		  	});
14871
14872			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
14873		  		observer.observe(_bgWrap);
14874			}
14875
14876			window.addEventListener('resize', function() {
14877				observer.unobserve(_bgWrap);
14878				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
14879					observer.observe(_bgWrap);
14880				}
14881			});
14882	
14883		}
14884
14885	});
14886}
14887
14888UNCODE.owlNav = function(target, ev) {
14889    target = target.replace(/#\S+/g, '');
14890    var $carousel = $('#'+target),
14891        $slider = $carousel.closest('.uncode-slider'),
14892        $checkNavs = $('.uncode-owl-nav');
14893    if ( !$checkNavs.length ) {
14894        return;
14895    }
14896
14897    if ( $slider.length ){
14898        target = $slider.attr('id');
14899    }
14900
14901    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
14902        $row;
14903
14904    if ( ! $navs.length ) {
14905        $row = $carousel.closest('.vc_row.row-container');
14906        $navs = $('.uncode-owl-nav:not([data-target])', $row);
14907    }
14908        
14909    if ( ! $navs.length ) {
14910        return;
14911    }
14912
14913    $navs.each(function(){
14914        var $nav = $(this),
14915            $outer = $nav.closest('.uncode-owl-nav-out'),
14916            $inner = $nav.find('.uncode-owl-nav-in'),
14917            $navDots = $('.uncode-nav-dots', $nav),
14918            $navCounter = $('.uncode-nav-counter', $nav),
14919            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
14920            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
14921            skinInherit = $nav.hasClass('skin-inherit'),
14922            digit = parseFloat($nav.attr('data-digit')),
14923            counterDigit = parseFloat($nav.attr('data-counter-digit')),
14924            navSpeed = parseFloat($carousel.attr('data-navspeed'));
14925        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
14926
14927        if ( $nav.hasClass('pos-abs') ){
14928            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
14929                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
14930            }
14931            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
14932        } 
14933
14934        $carousel.on('refreshed.owl.carousel', counter);
14935        $carousel.on('resized.owl.carousel', counter);
14936        $carousel.on('changed.owl.carousel', counter);
14937
14938        var totalSlides = 0;
14939
14940        function counter(event) {
14941            if (!event.namespace) {
14942                return;
14943            }
14944            var slides = event.relatedTarget,
14945                current = slides._current,
14946                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
14947                item = event.item,
14948                page = event.page,
14949                countPages = Math.ceil(item.count / page.size),
14950                $currentSlide = $carousel.find('.owl-item').eq(current),
14951                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
14952                activeSlide = Math.ceil(itemIndex / page.size),
14953                $prev = $nav.find('.uncode-nav-prev'),
14954                $next = $nav.find('.uncode-nav-next'),
14955                $col = $currentSlide.find('.uncol').first();
14956
14957            if ( totalSlides != countPages ) {
14958                totalSlides = countPages;
14959                $navDots.html('');
14960                var nav_html = '';
14961                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
14962                    var padN = sl_ind+1;
14963                    if ( digit && digit > 1 ) {
14964                        padN = String(padN).padStart(digit, '0');
14965                    }
14966                    nav_html += '<button class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '" tabindex="0"><span>' + padN + '</span></button>';
14967                }
14968                $navDots.html(nav_html);
14969
14970                var totalSlidesDigit = totalSlides;
14971
14972                if ( counterDigit && counterDigit > 1 ) {
14973                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
14974                }
14975                $counterTotal.html(totalSlidesDigit);
14976            }
14977
14978            if ( loop !== true ) {
14979                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
14980                if ( itemIndex === 1 ) {
14981                    $prev.addClass('uncode-nav-disabled');
14982                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
14983                    $next.addClass('uncode-nav-disabled');
14984                    activeSlide = Math.ceil(item.count / page.size);
14985                }
14986            }
14987
14988            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
14989            var activeSlideDigit = activeSlide;
14990
14991            if ( counterDigit && counterDigit > 1 ) {
14992                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
14993            }
14994            $counterIndex.html(activeSlideDigit);
14995
14996            if ( skinInherit ) {
14997                if ( $col.hasClass('style-light') ){
14998                    $nav.removeClass('style-dark').addClass('style-light');
14999                } else if ( $col.hasClass('style-dark') ) {
15000                    $nav.removeClass('style-light').addClass('style-dark');
15001                }
15002            }
15003
15004            $inner.removeClass('uncode-owl-nav-waiting');
15005
15006            if ( $nav.hasClass('outer-width') ) {
15007                var navW = $nav.outerWidth(),
15008                    nexW = $next.outerWidth(),
15009                    prevW = $prev.outerWidth(),
15010                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
15011
15012                if ( $nav.hasClass('h-align-justify') ) {
15013                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
15014                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
15015                        $inner.css({'margin': 'auto'});
15016                    } else {
15017                        $inner.css({'margin': ''});
15018                    }
15019                } else {
15020                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
15021                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
15022                        $inner.css({'margin': 'auto'});
15023                    } else {
15024                        $inner.css({'margin': ''});
15025                    }
15026                }
15027            }
15028        }
15029
15030        $nav.on('click', '.uncode-nav-index', function(){
15031            var $bullet = $(this),
15032                slide_index = parseFloat( $bullet.attr('data-key') );
15033            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
15034        });
15035        $nav.on('click', '.uncode-nav-prev', function(){
15036            $carousel.trigger('prev.owl.carousel', [navSpeed]);
15037        });
15038        $nav.on('click', '.uncode-nav-next', function(){
15039            $carousel.trigger('next.owl.carousel', [navSpeed]);
15040        });
15041
15042        if ( $nav.hasClass('animated-arrows') ) {
15043            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
15044                $(this).addClass("hover"); 
15045            }).on('animationend', function(){
15046                $(this).removeClass("hover");  
15047            });
15048        }
15049
15050        var positionNav = function(){
15051            if ( $nav.hasClass('window-width') ) {
15052                var navOff = parseFloat( $nav.offset().left ) * -1;
15053                if ( navOff > 0 ) {
15054                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
15055                } else {
15056                    $inner.css({ transform: 'none' });
15057                }
15058            }
15059        }
15060        positionNav();
15061        $(window).on('resize', positionNav);
15062    });
15063
15064    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
15065};
15066
15067	UNCODE.init = function() {
15068		var wfl_check = false, wfl_request, waypoint_request;
15069		UNCODE.preventDoubleTransition();
15070		UNCODE.betterResize();
15071		UNCODE.utils();
15072		UNCODE.magnetic();
15073		if (typeof UNCODE.accessibility !== 'undefined') {
15074			UNCODE.accessibility();
15075		}
15076		if (typeof UNCODE.rowParallax !== 'undefined') {
15077			UNCODE.rowParallax();
15078		}
15079		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
15080			UNCODE.changeSkinOnScroll();
15081		}
15082		if (typeof UNCODE.share !== 'undefined') {
15083			UNCODE.share();
15084		}
15085		if (typeof UNCODE.tooltip !== 'undefined') {
15086			UNCODE.tooltip();
15087		}
15088		if (typeof UNCODE.counters !== 'undefined') {
15089			UNCODE.counters();
15090		}
15091		if (typeof UNCODE.countdowns !== 'undefined') {
15092			UNCODE.countdowns();
15093		}
15094		if (typeof UNCODE.tabs !== 'undefined') {
15095			UNCODE.tabs();
15096		}
15097		if (typeof UNCODE.collapse !== 'undefined') {
15098			UNCODE.collapse();
15099		}
15100		if (typeof UNCODE.bigText !== 'undefined') {
15101			UNCODE.bigText();
15102		}
15103		UNCODE.menuSystem();
15104		if (typeof UNCODE.bgChanger !== 'undefined') {
15105			UNCODE.bgChanger();
15106		}
15107		if (typeof UNCODE.magicCursor !== 'undefined') {
15108			UNCODE.magicCursor();
15109		}
15110		if (typeof UNCODE.magneticCursor !== 'undefined') {
15111			UNCODE.magneticCursor();
15112		}
15113		if (typeof UNCODE.dropImage !== 'undefined') {
15114			UNCODE.dropImage();
15115		}
15116		if (typeof UNCODE.postTable !== 'undefined') {
15117			UNCODE.postTable();
15118		}
15119		if (typeof UNCODE.rotatingTxt !== 'undefined') {
15120			UNCODE.rotatingTxt();
15121		}
15122		if (typeof UNCODE.okvideo !== 'undefined') {
15123			UNCODE.okvideo();
15124			window.addEventListener( "uncode-more-items-loaded", function() {
15125				UNCODE.okvideo("uncode-more-items-loaded");
15126			});
15127		}
15128		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
15129			UNCODE.backgroundSelfVideos();
15130		}
15131		UNCODE.tapHover();
15132		if (typeof UNCODE.isotopeLayout !== 'undefined') {
15133			UNCODE.isotopeLayout();
15134		}
15135		if (typeof UNCODE.justifiedGallery !== 'undefined') {
15136			UNCODE.justifiedGallery();
15137		}
15138		if (typeof UNCODE.cssGrid !== 'undefined') {
15139			UNCODE.cssGrid();
15140		}
15141		if (typeof UNCODE.linearGrid !== 'undefined') {
15142			UNCODE.linearGrid();
15143		}
15144		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
15145			UNCODE.lightbox();
15146		}
15147		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
15148			$(window).on('load more-items-loaded',function(){
15149				UNCODE.lightgallery();
15150			});
15151		}
15152		if (typeof UNCODE.carousel !== 'undefined') {
15153			UNCODE.carousel($('body'));
15154		}
15155		if (typeof UNCODE.lettering !== 'undefined') {
15156			UNCODE.lettering();
15157		}
15158		UNCODE.animations();
15159		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
15160			UNCODE.stickyElements();
15161		}
15162		if (typeof UNCODE.twentytwenty !== 'undefined') {
15163			UNCODE.twentytwenty();
15164		}
15165		UNCODE.disableHoverScroll();
15166		UNCODE.printScreen();
15167		if (typeof UNCODE.particles !== 'undefined') {
15168			UNCODE.particles();
15169		}
15170		if (typeof UNCODE.filters !== 'undefined') {
15171			UNCODE.filters();
15172		}
15173		if (typeof UNCODE.ajax_filters !== 'undefined') {
15174			UNCODE.ajax_filters();
15175		}
15176		if (typeof UNCODE.widgets !== 'undefined') {
15177			UNCODE.widgets();
15178		}
15179		if (typeof UNCODE.unmodal !== 'undefined') {
15180			UNCODE.unmodal();
15181		}
15182		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
15183			if ( !UNCODE.isFullPage ) {
15184				UNCODE.checkScrollForTabs();
15185			}
15186		}
15187		if (typeof UNCODE.onePage !== 'undefined') {
15188			UNCODE.onePage(UNCODE.isMobile);
15189		}
15190		if (typeof UNCODE.fullPage !== 'undefined') {
15191			$(document).ready(function(){
15192				UNCODE.fullPage();
15193			});
15194		}
15195		if (typeof UNCODE.skewIt !== 'undefined') {
15196			UNCODE.skewIt();
15197		}
15198		if (typeof UNCODE.rotateIt !== 'undefined') {
15199			UNCODE.rotateIt();
15200		}
15201		if (typeof UNCODE.textMarquee !== 'undefined') {
15202			UNCODE.textMarquee();
15203		}
15204		if (typeof UNCODE.stickyScroll !== 'undefined') {
15205			UNCODE.stickyScroll();
15206		}
15207		if (typeof UNCODE.stickyTrigger !== 'undefined') {
15208			UNCODE.stickyTrigger();
15209		}
15210		if (typeof UNCODE.areaTextReveal !== 'undefined') {
15211			UNCODE.areaTextReveal();
15212		}
15213		if (typeof UNCODE.thumbsReveal !== 'undefined') {
15214			UNCODE.thumbsReveal();
15215		}
15216		if (typeof UNCODE.verticalText !== 'undefined') {
15217			UNCODE.verticalText();
15218		}
15219		if (typeof UNCODE.videoThumbs !== 'undefined') {
15220			UNCODE.videoThumbs();
15221		}
15222		if (typeof UNCODE.revslider !== 'undefined') {
15223			UNCODE.revslider();
15224		}
15225		if (typeof UNCODE.layerslider !== 'undefined') {
15226			UNCODE.layerslider();
15227		}
15228		if (typeof UNCODE.lottie !== 'undefined') {
15229			UNCODE.lottie();
15230		}
15231		if (typeof UNCODE.inlineImgs !== 'undefined') {
15232			UNCODE.inlineImgs();
15233		}
15234		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
15235			UNCODE.animatedBgGradient();
15236		}
15237		if (typeof UNCODE.readMoreCol !== 'undefined') {
15238			UNCODE.readMoreCol();
15239		}
15240		if (typeof UNCODE.multibg !== 'undefined') {
15241			UNCODE.multibg();
15242		}
15243		if (typeof UNCODE.flexEqual !== 'undefined') {
15244			UNCODE.flexEqual();
15245		}
15246		$(window).on('load',function(){
15247			clearRequestTimeout(waypoint_request);
15248			waypoint_request = requestTimeout( function(){
15249				Waypoint.refreshAll();
15250			}, 1000);
15251		});
15252		$(window).one('load',function(){
15253			if (typeof UNCODE.parallax !== 'undefined') {
15254				UNCODE.parallax();
15255			}
15256		});
15257	}
15258
15259	if ( ! SiteParameters.is_frontend_editor ) {
15260		UNCODE.init();
15261	}
15262
15263
15264})(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.