PageSourceSearch

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

js brainbehaviorclinic.com collected 2026-10-10 02:37:43 UTC 526,786 bytes, 15,807 lines download raw bytes

1/* ----------------------------------------------------------
2 * Uncode App
3 * ---------------------------------------------------------- */
4
5(function($) {
6	"use strict";
7	var UNCODE = window.UNCODE || {};
8	window.UNCODE = UNCODE;
9
10	window.requestAnimFrame = (function() {
11	return  window.requestAnimationFrame	   ||
12			window.webkitRequestAnimationFrame ||
13			window.mozRequestAnimationFrame	||
14			window.oRequestAnimationFrame	  ||
15			window.msRequestAnimationFrame	 ||
16			function(/* function */ callback, /* DOMElement */ element){
17				window.setTimeout(callback, 1000 / 60);
18			};
19})();
20
21window.requestTimeout = function(fn, delay) {
22	if( !window.requestAnimationFrame	  	&&
23		!window.webkitRequestAnimationFrame &&
24		!(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
25		!window.oRequestAnimationFrame	  &&
26		!window.msRequestAnimationFrame)
27			return window.setTimeout(fn, delay);
28
29	var start = new Date().getTime(),
30		handle = new Object();
31
32	function loop(){
33		var current = new Date().getTime(),
34			delta = current - start;
35
36		delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop);
37	};
38
39	handle.value = requestAnimFrame(loop);
40	return handle;
41};
42
43window.clearRequestTimeout = function(handle) {
44	if ( typeof handle !== 'undefined' ) {
45		window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
46		window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
47		window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
48		window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
49		window.oCancelRequestAnimationFrame	? window.oCancelRequestAnimationFrame(handle.value) :
50		window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
51		clearTimeout(handle);
52	}
53};
54
55function uncodeVisibilityChange() {
56	if (document.hidden) {
57		window.dispatchEvent(new CustomEvent('is-blur'));
58	} else {
59		window.dispatchEvent(new CustomEvent('is-focus'));
60	}
61  }
62document.addEventListener('visibilitychange', uncodeVisibilityChange, false);
63
64if ( SiteParameters.smoothScroll === 'on' && ! SiteParameters.is_frontend_editor ) {
65	window.lenis = new Lenis({
66		duration: 1
67	})
68
69	UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
70		document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
71
72	function raf(time) {
73		window.lenis.raf(time)
74		requestAnimationFrame(raf)
75		window.dispatchEvent(new CustomEvent('lenis-scroll'));
76
77		if ( SiteParameters.uncode_smooth_scroll_safe ) {
78			var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
79				document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
80			
81			if ( UNCODE.hDoc !== newHdoc ) {
82				UNCODE.hDoc = newHdoc;
83				window.lenis.resize();
84				//window.dispatchEvent(new CustomEvent('boxResized'));
85			}
86		}
87	}
88
89	requestAnimationFrame(raf)
90
91	$(window).on('unmodal-open uncode-sidecart-open', function(){
92		window.lenis.stop();
93	});
94
95	$(window).on('uncode-sidecart-closed', function(){
96		window.lenis.start();
97	});
98
99	$(document).on('unmodal-close', function(){
100		window.lenis.start();
101	});
102
103}
104
105var checkScrollTriggerRefresh;
106
107$(function(){
108	$(document).on('uncode-scrolltrigger-refresh', function(){
109		clearRequestTimeout(checkScrollTriggerRefresh);
110		checkScrollTriggerRefresh = requestTimeout(function(){
111			ScrollTrigger.refresh();
112			$('.scroll-refresh-hidden').removeClass('opacity_0');
113		}, 500);
114	});
115});
116
117UNCODE.checkImgLoad = function( src, cb, err, el ) {
118	var img = new Image();
119	img.onload = function () {
120		var result = (img.width > 0) && (img.height > 0);
121		cb(el);
122	};
123	img.onerror = function () {
124		err();
125	};
126	img.src = src
127};
128
129UNCODE.betterResize = function() {
130	var setResize,
131		doubleResize = true,
132		oldW = UNCODE.wwidth,
133		oldH = UNCODE.wheight,
134		setCTA;
135	$(window).on( 'resize orientationchange', function(){
136		if ( oldW === UNCODE.wwidth ) {
137			return;
138		} else {
139			oldW = UNCODE.wwidth;
140			$(window).trigger('wwResize');
141		}
142
143		if ( oldH === UNCODE.wheight ) {
144			return;
145		} else {
146			oldH = UNCODE.wheight;
147			$(window).trigger('whResize');
148		}
149	});
150
151	$(window).on( 'resize orientationchange', function(){
152		clearRequestTimeout(setCTA);
153		setCTA = requestTimeout( function(){ $(window).trigger('resize-int'); }, 100 );
154	});
155};
156
157UNCODE.shuffle = function(array) {
158	var currentIndex = array.length,
159		randomIndex;
160  
161	while (currentIndex > 0) {
162		randomIndex = Math.floor(Math.random() * currentIndex);
163		currentIndex--;
164		[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
165	}
166  
167	return array;
168};
169
170Number.isInteger = Number.isInteger || function(value) {
171    return typeof value === "number" &&
172           isFinite(value) &&
173           Math.floor(value) === value;
174};
175
176UNCODE.utils = function() {
177	$(document).on('mouseover', 'a', function () {
178		if (!$(this).hasClass('star')) {
179			$(this).attr('data-title', $(this).attr('title'));
180			$(this).removeAttr('title');
181		}
182	});
183	$(document).on('mouseout', 'a', function () {
184		if (!$(this).hasClass('star')) {
185			$(this).attr('title', $(this).attr('data-title'));
186			$(this).removeAttr('data-title');
187		}
188	});
189
190	this.get_scroll_offset = function(e) {
191
192		var scroll_offset = 0,
193			target,
194			trigger;
195
196		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
197			target = e.target;
198			trigger = e.currentTarget;
199		}
200
201		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
202			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
203				UNCODE.hideMenu(100);
204			}
205		}
206
207		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) {
208			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
209			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
210				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile && ! $('.menu-mobile-transparent').length ) ) {
211					if ( !$('.menu-hided').length ) {
212						if ( $('body').hasClass('hmenu-center') ) {
213							scroll_offset += ~~$('.menu-sticky .menu-container').outerHeight();
214						} else {
215							scroll_offset += ~~$('.logo-container:visible').outerHeight();
216						}
217					}
218				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && UNCODE.wwidth > UNCODE.mediaQuery ) {
219					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
220					scroll_offset += (~~$('.menu-sticky .menu-container').outerHeight()) - ( $('.navbar-brand').data('minheight') + shrink );
221				} else {
222					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
223						scroll_offset += UNCODE.menuMobileHeight;
224					} else {
225						if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('vmenu') && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) {
226							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
227						} else {
228							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
229								scroll_offset += UNCODE.menuMobileHeight;
230							}
231						}
232					}
233				}
234			}
235
236		}
237
238		scroll_offset += UNCODE.bodyBorder;
239
240		return scroll_offset;
241	}
242
243	if ( !UNCODE.isFullPage ) {
244		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
245
246			var hash = (e.currentTarget).hash,
247			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
248			anchor = '';
249			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
250			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
251				e.preventDefault();
252				if (!$('#tab-reviews').is(':visible')) {
253					$('a[href="#tab-reviews"]').trigger('click');
254				}
255				var calc_scroll = $('.wootabs .tab-content').offset().top;
256				calc_scroll -= UNCODE.get_scroll_offset(e);
257
258				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
259					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
260
261					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
262						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
263					}
264				}
265
266				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
267					delta = bodyTop - calc_scroll,
268					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
269				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
270
271				requestTimeout(function(){
272					if (scrollSpeed == 0) {
273						$('html, body').scrollTop(calc_scroll);
274						UNCODE.scrolling = false;
275					} else {
276   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
277							$(this).stop();
278						}).animate({
279								scrollTop: calc_scroll
280							}, scrollSpeed, 'easeInOutCubic', function() {
281								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
282								UNCODE.scrolling = false;
283							}
284						);
285					}
286				}, 200);
287				return;
288			}
289			if (hash != undefined) {
290				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
291				var anchor = this.hash.slice(1);
292				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
293			  		if ( !specialFormat.test(hash) ) {
294			  			if ( $(hash).length )
295			  				anchor = $(hash);
296			  		}
297				}
298			}
299
300			if (is_scrolltop || anchor != '') {
301				if (is_scrolltop) {
302					e.preventDefault();
303					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
304					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
305					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
306
307					if (scrollSpeed == 0) {
308						$('html, body').scrollTop(0);
309						UNCODE.scrolling = false;
310					} else {
311   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
312							$(this).stop();
313						}).animate({
314							scrollTop: 0
315						}, scrollSpeed, 'easeInOutCubic', function() {
316							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
317							UNCODE.scrolling = false;
318						});
319					}
320				} else {
321					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
322					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a, #uncode-mobile-menu-block .menu-item > a'), function(index, val) {
323						var get_href = $(val).attr('href');
324						if (get_href != undefined) {
325							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
326							else $(val).parent().removeClass('active');
327						}
328					});
329					if (scrollSection.length) {
330						if ( $('body').hasClass('uncode-scroll-no-history') ) {
331							e.preventDefault();
332						}
333
334						if (UNCODE.menuOpened) {
335							if (UNCODE.wwidth < UNCODE.mediaQuery) {
336								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
337							} else {
338								$('.mmb-container-overlay .overlay-close').trigger('click');
339								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
340							}
341						}
342
343						var calc_scroll = scrollSection.offset().top,
344							getOffset = UNCODE.get_scroll_offset(e),
345							$logo = $('.logo-container:visible'),
346							logoH,
347							$menu = $('#masthead .menu-container'),
348							menuH;
349
350						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
351
352						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
353							delta = bodyTop - calc_scroll,
354							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
355						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
356
357						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
358							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
359								logoH = $logo.outerHeight(),
360								menuH = $menu.outerHeight();
361								if ( calc_scroll < ( logoH + menuH ) ) {
362									calc_scroll = 0;
363								}
364							}
365						}
366
367						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
368							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
369						}
370
371						if (scrollSpeed == 0) {
372							$('html, body').scrollTop(calc_scroll);
373							UNCODE.scrolling = false;
374						} else {
375	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
376								$(this).stop();
377							}).animate({
378								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
379							}, scrollSpeed, 'easeInOutCubic', function() {
380								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
381								UNCODE.scrolling = false;
382								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
383								||
384								$('.menu-hided').length ) {
385									calc_scroll = scrollSection.offset().top;
386									getOffset = UNCODE.get_scroll_offset(e);
387									calc_scroll -= getOffset;
388									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
389										$(this).stop();
390									}).animate({
391										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
392										}, scrollSpeed, 'easeInOutCubic', function() {
393											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
394											UNCODE.scrolling = false;
395										}
396									);
397								}
398							});
399						}
400					}
401				}
402			}
403		});
404		$('.header-scrolldown').on('click', function(event) {
405
406			event.preventDefault();
407
408			var pageHeader = $(event.target).closest('#page-header'),
409				pageHeaderTop = pageHeader.offset().top,
410				pageHeaderHeight = pageHeader.outerHeight(),
411				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
412			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
413
414			var calc_scroll = pageHeaderTop + pageHeaderHeight,
415			getOffset = UNCODE.get_scroll_offset(event);
416			calc_scroll -= getOffset;
417
418			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
419				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
420
421				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
422					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
423				}
424			}
425
426			if (scrollSpeed == 0) {
427				$('html, body').scrollTop(calc_scroll);
428				UNCODE.scrolling = false;
429			} else {
430					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
431						$(this).stop();
432					}).animate({
433						scrollTop: calc_scroll
434					}, scrollSpeed, 'easeInOutCubic', function() {
435						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
436						UNCODE.scrolling = false;
437						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
438							calc_scroll = pageHeaderTop + pageHeaderHeight;
439							getOffset = UNCODE.get_scroll_offset(event);
440							calc_scroll -= getOffset;
441								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
442									$(this).stop();
443								}).animate({
444									scrollTop: calc_scroll
445								}, scrollSpeed, 'easeInOutCubic', function() {
446									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
447									UNCODE.scrolling = false;
448								}
449							);
450						}
451					}
452				);
453			}
454		});
455	}
456
457	// Colomun hover effect
458	// =================
459	$(document).on('mouseenter', '.col-link', function(e) {
460		var uncol = $(e.target).prev('.uncol'),
461		el = uncol.find('.column-background');
462		if (el) {
463			$('.btn-container .btn', uncol).addClass('active');
464			var elOverlay = $(el[0]).find('.block-bg-overlay');
465			if (elOverlay.length) {
466				var getOpacity = $(elOverlay).css('opacity');
467				if (getOpacity != 1) {
468					getOpacity = Math.round(getOpacity * 100) / 100;
469					var newOpacity = getOpacity + .1;
470					$(elOverlay).data('data-opacity', getOpacity);
471					$(elOverlay).css('opacity', newOpacity);
472				}
473			}
474		}
475	}).on('mouseleave', '.col-link', function(e) {
476		var uncol = $(e.target).prev('.uncol'),
477		el = uncol.find('.column-background');
478		$('.btn-container .btn', uncol).removeClass('active');
479		if (el) {
480			var elOverlay = $(el[0]).find('.block-bg-overlay');
481			if (elOverlay.length) {
482				var getOpacity = $(elOverlay).data('data-opacity');
483				$(elOverlay).css('opacity', getOpacity);
484			}
485		}
486	});
487
488	// Admin bar
489	// ============
490	var fixAdminBar = function() {
491		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
492			var getAdminBar = $('#wpadminbar');
493			if (getAdminBar.length) {
494				if (getAdminBar.css('position') !== 'hidden') {
495					var getAdminBarHeight = getAdminBar.height();
496					if (getAdminBar.css('position') === 'fixed') {
497						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
498						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
499					} else {
500						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
501						$('.body-borders .top-border').css({'margin-top':'0px'});
502					}
503				}
504			}
505		}
506	};
507	window.addEventListener('load', fixAdminBar);
508	window.addEventListener('resize', fixAdminBar);
509	// Print
510	// ===========
511	var beforePrint = function() {
512		window.dispatchEvent(new CustomEvent('resize'));
513		window.dispatchEvent(UNCODE.boxEvent);
514	};
515
516	if (window.matchMedia) {
517		var mediaQueryList = window.matchMedia('print');
518		mediaQueryList.addListener(function(mql) {
519			if (mql.matches) {
520				beforePrint();
521			}
522		});
523	}
524
525	window.onbeforeprint = beforePrint;
526
527	// Safari srcset
528	var safariSrcSet = function(){
529		if ( !SiteParameters.is_frontend_editor ) {
530			$('html.safari img[sizes]').each(function(){
531				var $img = $(this),
532					sizeImg = parseInt($img.attr('sizes'));
533				if ( typeof(sizeImg) === 'number' ) {
534					$img.attr('sizes', (sizeImg) + 'px');
535				}
536			});
537		}
538	};
539	window.addEventListener('load', safariSrcSet);
540}
541
542UNCODE.lettering = function() {
543
544	var setCTA;
545	var highlightStill = function(){
546
547		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
548
549		$.each($heading_texts, function(key, el) {
550			var $heading = $(el);
551
552			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
553				return;
554			}
555
556			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
557				return;
558			}
559
560			var waypoint = new Waypoint({
561				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
562				element: el,
563				handler: function() {
564					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
565						anims_l = $anims.length;
566					$anims.each(function(_key_, _el_){
567						var $anim = $(_el_);
568
569						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
570							$anim.addClass('heading-text-highlight-animated');
571
572							if ( $heading.data('animate') === true ) {
573								$anim.css({
574									'-webkit-transition-duration': '0ms',
575									'-moz-transition-duration': '0ms',
576									'-o-transition-duration': '0ms',
577									'transition-duration': '0ms',
578								});
579							} else {
580								$anim.css({
581									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
582									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
583									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
584									'transition-delay': ((_key_ + 2) * 200) + 'ms',
585								});
586							}
587						}
588
589					});
590					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
591						$heading.data('animate', true);
592					});
593					$anims.removeAttr('data-animated');
594				},
595				offset: '100%'
596			});
597
598		});
599
600		Waypoint.refreshAll();
601		$( document.body ).trigger('uncode_waypoints');
602		if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
603			$(document).trigger('uncode-scrolltrigger-refresh');
604		}
605
606	}
607
608	requestTimeout(function(){
609		highlightStill();
610		$(window).on( 'wwResize', function(){
611			clearRequestTimeout(setCTA);
612			setCTA = requestTimeout( highlightStill, 100 );
613		});
614	}, 400);
615
616};
617
618UNCODE.isUnmodalOpen = false;
619
620var manageVideoSize = function(){
621
622	var setVideoFit;
623	$('.wp-block-embed').each(function(){
624
625		var $this = $(this);
626
627		if ( $('iframe', $this).length ) {
628
629			var $iframe = $('> iframe, > a > iframe', $this),
630				w = parseFloat($iframe.attr('width')),
631				h = parseFloat($iframe.attr('height')),
632				url = $iframe.attr('src'),
633				ratio, frW;
634
635			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
636
637				ratio = h / w;
638				var setResizeiFto,
639					resizeiFrame = function(){
640					frW = $iframe.width();
641					$iframe.css({
642						height: frW * ratio
643					});
644				};
645				resizeiFrame();
646				$(window).on( 'wwResize load', function(){
647					clearRequestTimeout(setResizeiFto);
648					setResizeiFto = requestTimeout( function() {
649						resizeiFrame();
650					}, 10 );
651				});
652
653			}
654
655		}
656
657	});
658
659};
660
661manageVideoSize();
662
663UNCODE.vivus = function(icon, time, delay, file) {
664	if (typeof Vivus !== 'undefined') {
665		var icon_options = {
666			type: 'delayed',
667			pathTimingFunction: Vivus.EASE_OUT,
668			animTimingFunction: Vivus.LINEAR,
669			duration: time,
670		}
671
672		if (delay) {
673			icon_options.delayStart = delay;
674		}
675
676		if (file) {
677			icon_options.file = file;
678		}
679
680		new Vivus(icon, icon_options);
681	}
682};
683
684UNCODE.lastURL = '';
685
686UNCODE.getURLParams = function(current_location, is_string) {
687	var params = {};
688	if (is_string) {
689		var url = current_location.split('?')[1];
690	} else {
691		var url = current_location.search;
692		url = url.substring(1);
693	}
694	if (url) {
695		var parts = url.split('&');
696		for (var i = 0; i < parts.length; i++) {
697			var nv = parts[i].split('=');
698			if (!nv[0]) {
699				continue;
700			}
701			params[nv[0]] = nv[1] || true;
702		}
703	}
704	return params;
705}
706
707UNCODE.hasEqualURLParams = function(obj1, obj2) {
708	for (var i in obj1) {
709		if (obj1.hasOwnProperty(i)) {
710			if (!obj2.hasOwnProperty(i)) {
711				return false;
712			}
713			if (obj1[i] != obj2[i]) {
714				return false;
715			}
716		}
717	}
718	for (var i in obj2) {
719		if (obj2.hasOwnProperty(i)) {
720			if (!obj1.hasOwnProperty(i)) {
721				return false;
722			}
723			if (obj1[i] != obj2[i]) {
724				return false;
725			}
726		}
727	}
728    return true;
729}
730
731UNCODE.magnetic = function(){
732	
733	$(document).on('mousemove', '.un-magnetic-zone', function(e){
734
735		var $zone = $(this),
736			zoneOff = $zone.offset(),
737			$mgntcEl = $('.un-magnetic-el', this),
738			elBound = this.getBoundingClientRect(),
739			maxSize = Math.max($zone.outerWidth(), $zone.outerHeight());
740
741		var Xvalue = e.pageX - (zoneOff.left + maxSize / 2),
742	  		Yvalue = e.pageY - (zoneOff.top + maxSize / 2);
743	  
744		$mgntcEl.each(function(key, val){
745			var magneticValue = $(val).attr('data-mgntc') || 0.5;
746		
747			val.animate({
748				transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)',
749			},{
750				duration: 500,
751				fill: 'forwards',
752			})
753	  	});
754	})
755	
756	$(document).on('mouseleave', '.un-magnetic-zone', function(e){
757		var $mgntcEl = $('.un-magnetic-el', this);
758
759		$mgntcEl.each(function(key, val){
760			val.animate({
761		  		transform: 'translate(0)',
762			},{
763		  		duration: 500,
764		  		fill: 'forwards',
765			})
766	  	});
767	})
768};
769UNCODE.rowParallax = function(){
770
771	if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) {
772		return;
773	}
774
775	var $rows = $('.parallax-move'),
776		stableHeight = UNCODE.wheight;
777	$rows.each(function(){
778		var $row = $(this),
779			_row = $row[0],
780			dataMove = $row.attr('data-parallax-move'),
781			dataSafe = $row.attr('data-parallax-safe'),
782            rowInViewport = false,
783			trans;
784
785		if ( $row.find('.parallax-move').length ) {
786			return;
787		}
788
789		dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe;
790		dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove;           
791        dataMove = dataMove / 10;
792
793        if ( 'IntersectionObserver' in window ) {
794			var observer = new IntersectionObserver(function(entries) {
795	
796				entries.forEach(function(entry){
797					if ( entry.isIntersecting ) {
798						rowInViewport = true;
799					} else {
800						rowInViewport = false;
801					}
802				});
803	
804			}, { 
805				root: document,
806			});
807	
808			observer.observe(_row);
809		} else {
810            rowInViewport = true;
811		}
812
813		var loopRAF = function() {
814			if( rowInViewport ) {
815				var bound = _row.getBoundingClientRect(),
816					bound_top = bound.top,
817					bound_height = bound.height,
818					move = true,
819					scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
820					docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
821						document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ),
822					fromBottom = docH - (scrolled + bound_top + bound_height);
823
824                if ( bound_height > stableHeight && dataSafe === 'yes' ) {
825                    $row.find('>div').css({
826                        'transform':'none'
827                    });
828                    move = false;
829				}
830
831				if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) {
832					$row.find('>div').css({
833						'transform':'none'
834					});
835					move = false;
836				}
837
838				if ( move ) {
839
840					if ( fromBottom < stableHeight ) {
841						//maybe Footer
842						trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove);
843                    } else if ( scrolled + bound_top < stableHeight ) {
844						//maybe Header
845						trans = scrolled*(dataMove);
846					} else {
847						trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove);
848					}
849
850                    $row.find('>div').css({
851                        'transform':'translateY(' + (trans) + 'px) translateZ(0)',
852                    });
853                }
854			}
855	
856			requestAnimationFrame(loopRAF);
857		};
858		
859		requestAnimationFrame(loopRAF);
860
861	});
862
863	$(window).on( 'load resize', function(e) {
864		if ( ! UNCODE.isMobile ) {
865			stableHeight = UNCODE.wheight;
866		}
867	});
868
869	$(window).on( 'load wwResize', function(e) {
870		if ( UNCODE.isMobile ) {
871			stableHeight = UNCODE.wheight;
872		}
873	});
874
875}
876
877UNCODE.changeSkinOnScroll = function(){
878	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
879		return;
880	}
881	var $masthead = $('#masthead'),
882		transDesktop,
883		transMobile,
884		changeSkin,
885
886	checkTransparencyAndChange = function( $col ){
887		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
888		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
889		changeSkin = $masthead.hasClass('menu-change-skin');
890
891		if ( ! transDesktop && ! transMobile ) {
892			return false;
893		}
894
895		if ( ! changeSkin ) {
896			return false;
897		}
898
899		if ( $col.hasClass('style-light') ){
900			$masthead.removeClass('style-dark-override').addClass('style-light-override');
901			return false;
902		} else if ( $col.hasClass('style-dark') ) {
903			$masthead.removeClass('style-light-override').addClass('style-dark-override');
904			return false;
905		}
906	};
907
908	var prev_row = 'normal',
909		odd = true,
910		$rows = $('.vc_row[data-parent]:visible:not(.overlay-menu *):not(#uncode-mobile-menu-block *)');
911	$.each($rows, function(index, row){
912		var $row = $(row),
913			$col = $('.uncol', $row).first(),
914			$slider = $('.uncode-slider', $row);
915
916		if ( $row.closest('li.menu-item').length ) {
917			return;
918		}
919
920		var wayDown = new Waypoint({
921			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
922			element: row,
923			handler: function(direction) {
924				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
925					if ( $slider.length ) {
926						$col = $('.owl-item.index-active .uncol', $slider).first();
927					}
928					checkTransparencyAndChange($col);
929				}
930				if ( odd === false ) {
931					if ( row.hasAttribute('data-bg-changer') ) {
932						prev_row = 'bg-changer';
933					} else {
934						prev_row = 'normal';
935					}
936					odd = true;
937				} else {
938					odd = false;
939				}
940			},
941			offset: function() {
942				return UNCODE.menuHeight / 2
943			}
944		});
945		var wayUp = new Waypoint({
946			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
947			element: row,
948			handler: function(direction) {
949				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
950					if ( $slider.length ) {
951						$col = $('.owl-item.index-active .uncol', $slider).first();
952					}
953					checkTransparencyAndChange($col);
954				}
955				if ( odd === false ) {
956					if ( row.hasAttribute('data-bg-changer') ) {
957						prev_row = 'bg-changer';
958					} else {
959						prev_row = 'normal';
960					}
961					odd = true;
962				} else {
963					odd = false;
964				}
965			},
966			offset: function() {
967				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
968			}
969		});
970	});
971
972};
973
974UNCODE.share = function() {
975	if (typeof Share !== 'undefined') {
976		var share_button_element = $('.share-button');
977		var share_button_url = share_button_element.data('url');
978
979		var share_button_config = {
980			ui: {
981				flyout: "top center",
982				button_font: false,
983				button_text: '',
984				icon_font: false
985			}
986		};
987
988		if (share_button_url) {
989			share_button_config.url = share_button_url.replace("&", "%26");
990		}
991
992		var share_button_top = new Share('.share-button', share_button_config);
993
994		$('li[data-network]', share_button_element).each(function(){
995			var label = SiteParameters.uncode_share_label,
996				network = $(this).attr('data-network');
997			label = label.replace("%", network);
998			$(this).attr('aria-label', label);
999		});
1000	}
1001};
1002
1003UNCODE.tooltip = function() {
1004	if (typeof jQuery.fn.tooltip !== 'undefined') {
1005		$('.btn-tooltip').tooltip();
1006	}
1007};
1008
1009UNCODE.counters = function() {
1010	var $counters = $('.uncode-counter:not(.counter-init)');
1011	$counters.each(function(){
1012		var $counter = $(this).addClass('counter-init');
1013		if ( SiteParameters.is_frontend_editor ) {
1014			$counter.addClass('started');
1015		}
1016		if ( $counter.closest( '.owl-carousel' ).length ) {
1017			return;
1018		}
1019		$counter.addClass('started').counterUp({
1020			delay: 10,
1021			time: 1500
1022		});
1023	});
1024};
1025
1026UNCODE.countdowns = function() {
1027	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
1028	$countdowns.each(function() {
1029		var $this = $(this).addClass('counter-init'),
1030			finalDate = $(this).data('uncode-countdown');
1031		$this.countdown(finalDate, function(event) {
1032			$this.html(event.strftime('<span>%D <small>' + SiteParameters.days + '</small></span> <span>%H <small>' + SiteParameters.hours + '</small></span> <span>%M <small>' + SiteParameters.minutes + '</small></span> <span>%S <small>' + SiteParameters.seconds + '</small></span>'));
1033		});
1034	});
1035};
1036
1037UNCODE.tabs = function() {
1038
1039	var tabSwitcher = function($el){
1040		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1040ical):not(.tab-switch)', $el).each(function(key, value){
1041			var $navs = $(value),
1042				$active = $('li.active', $navs),
1043				$active_a = $('> a', $active),
1044				$active_span = $('> span', $active_a),
1045				vertical = $navs.closest('.vertical-tab-menu').length;
1046			
1047			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
1048				$navs.append('<span class="switcher-cursor" aria-hidden="true" tabindex="-1" />');
1049			}
1050
1051			var $cursor = $('.switcher-cursor', $navs),
1052				active_w = $('a', $active).outerWidth(),
1053				span_w = $active_span.outerWidth(),
1054				active_pos = $active.position(),
1055				active_a_pos = $active_a.position(),
1056				span_pos = $active_span.position(),
1057				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
1058				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
1059
1060			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
1061
1062			if ( ! vertical ) {
1063				$cursor.css({
1064					left: cursor_left,
1065					width: cursor_w
1066				});
1067			}
1068
1069			$navs.addClass('switch-init');
1070		});
1071	};
1072
1073	var $body = $('body');
1074	tabSwitcher($body);
1075
1076	var tabHoverIntent = function(){
1077		var setHover;
1078		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
1079			.on('mouseover', function(e){
1080				var $this = $(e.target);
1081				setHover = requestTimeout(function() {
1082					$this.trigger('hover-int');
1083				}, 50);
1084			})
1085			.on('mouseout', function(){
1086				clearRequestTimeout(setHover);
1087			});
1088	};
1089	tabHoverIntent();
1090
1091	var tabInit = function(){
1092		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
1093			e.preventDefault()
1094			var $el = $(this);
1095			$el.tab('show');
1096			var $container = $el.closest('.uncode-tabs');
1097			tabSwitcher($container);
1098			requestTimeout(function() {
1099				window.dispatchEvent(UNCODE.boxEvent);
1100				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
1101
1102				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
1103					window.dispatchEvent(new CustomEvent('boxResized'));
1104				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
1105					window.dispatchEvent(new Event('resize'));
1106					$(window).trigger('uncode.re-layout');
1107				} 
1108
1109				var $active_panel = $('.tab-pane.active', $tabs);
1110
1111				$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) {
1112					var element = $(val),
1113						delayAttr = element.attr('data-delay');
1114					if (delayAttr == undefined) delayAttr = 0;
1115					requestTimeout(function() {
1116						element.addClass('start_animation');
1117					}, delayAttr);
1118				});
1119
1120			}, 300);
1121
1122			var $tabs = $(e.currentTarget).closest('.uncode-tabs'),
1123				$non_active_panel = $('.tab-pane:not(.active)', $tabs);
1124			$.each($('.start_animation:not(.t-inside):not(.drop-image-separator)', $non_active_panel), function(index, val) {
1125				var element = $(val);
1126				element.removeClass('start_animation');
1127			});
1128
1129			var $li = $el.closest('li'),
1130				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1131			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1132			$('.tab-pane', $li).slideDown(250);
1133			var completeSlideDown = requestTimeout(function(){
1134				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1135					var pos = $el.offset(),
1136						rect = $el[0].getBoundingClientRect(),
1137						$masthead = $('#masthead > .menu-container'),
1138						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1139
1140					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1141						$('html, body').animate({
1142							scrollTop: ( pos.top ) - considerMenu
1143						},{
1144							easing: 'easeInOutQuad',
1145							duration: 250
1146						});
1147					}
1148				}
1149			}, 260);
1150		});
1151	}
1152	tabInit();
1153
1154	var tabResponsive = function(){
1155		if ( SiteParameters.is_frontend_editor ) {
1156			return true;
1157		}
1158		var $tabContainers = $('.tab-container.tabs-breakpoint');
1159		$tabContainers.each(function(){
1160			var $tabContainer = $(this),
1161				$tabContent = $('.tab-content', $tabContainer),
1162				$nav = $('.nav-tabs', $tabContainer),
1163				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1164
1165			$('> li', $nav).each(function(){
1166				var $li = $(this),
1167					dataID = $li.attr('data-tab-id');
1168
1169				if ( UNCODE.wwidth <= mQuery ) {
1170					if ( ! $('.tab-pane', $li ).length ) {
1171						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1172						$tabContainer.addClass('tabs-appended');
1173						$li.append($append_pane);
1174					}
1175
1176					if ( $li.hasClass('active') ) {
1177						$('> a', $li).triggerHandler('click.bs.tab.data-api');
1178					}
1179				} else {
1180					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1181						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1182						$tabContainer.removeClass('tabs-appended');
1183						$tabContent.prepend($append_pane.removeAttr('style'));
1184					}
1185				}
1186			});
1187		});
1188
1189	}
1190	tabResponsive();
1191
1192	$(window).on('wwResize', function(){
1193		tabHoverIntent();
1194		tabSwitcher($body);
1195	});
1196
1197	var setCTA;
1198	$(window).on( 'resize', function(){
1199		clearRequestTimeout(setCTA);
1200		setCTA = requestTimeout( tabResponsive, 100 );
1201	});
1202
1203	$('.nav-tabs').each(function(){
1204		var $nav = $(this),
1205			$lis = $('> li:not(.active)', $nav),
1206			$links = $('.tab-excerpt-link', $nav);
1207		$('.tab-excerpt', $lis).slideUp(400, function(){
1208			$(this).addClass('init');
1209		});
1210
1211		$links.each(function(){
1212			var $link = $(this),
1213				$par_a = $link.closest('a'),
1214				href = $link.attr('data-href'),
1215				target = $link.attr('data-target');
1216			$par_a.addClass('inner-link');
1217			$link.on('click', function(){
1218				var _link = document.createElement('a');
1219				_link.href = href;
1220				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1221				_link.click();
1222			});
1223		});
1224		$nav.addClass('tab-init');
1225	});
1226
1227	$('.uncode-tabs.tabs-no-lazy').each(function(){
1228		var $tabs = $(this),
1229			$panes = $('.tab-pane:not(.active)', $tabs);
1230		$panes.each(function(){
1231			var $pane = $(this),
1232				$imgs = $('img[loading="lazy"]', $pane);
1233			$imgs.removeAttr('loading');
1234			$imgs.removeAttr('decoding');
1235		});
1236	});
1237
1238};
1239UNCODE.collapse = function() {
1240	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1241		var $this = $(this),
1242			href
1243		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1244		var $target = $(target)
1245		var parent = $this.attr('data-parent')
1246		var $parent = parent && $(parent)
1247		var $title = $(this).parent()
1248		var $accordion = $(e.target).closest('.uncode-accordion')
1249		var $group = $this.closest('.group')
1250		var $panel_group = $this.closest('.panel-group')
1251		if ($parent) {
1252			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1253			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1254				$title.removeClass('active');
1255				$group.removeClass('active-group');
1256			} else {
1257				if ( $panel_group.attr('data-no-toggle') != true ) {
1258					$parent.find('.panel-title').removeClass('active')
1259					$parent.find('.group').removeClass('active-group')
1260				}
1261				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1262				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1263			}
1264		}
1265		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1266		requestTimeout(function() {
1267			var $accordion = $(e.target).closest('.uncode-accordion');
1268			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1269			  window.dispatchEvent(new CustomEvent('boxResized'));
1270			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1271				window.dispatchEvent(new Event('resize'));
1272				$(window).trigger('uncode.re-layout');
1273			} 
1274
1275			var $active_panel = $('.panel.active-group', $parent);
1276
1277			$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) {
1278				var element = $(val),
1279					delayAttr = element.attr('data-delay');
1280				if (delayAttr == undefined) delayAttr = 0;
1281				requestTimeout(function() {
1282					element.addClass('start_animation');
1283				}, delayAttr);
1284			});
1285
1286		}, 500);
1287
1288		$group.find('.panel-title:not(.active) > a').trigger('blur');
1289
1290	});
1291
1292	$('.uncode-accordion.tabs-no-lazy').each(function(){
1293		var $accordion = $(this),
1294			$panes = $('.panel:not(.active-group)', $accordion);
1295		$panes.each(function(){
1296			var $pane = $(this),
1297				$imgs = $('img[loading="lazy"]', $pane);
1298			$imgs.removeAttr('loading');
1299			$imgs.removeAttr('decoding');
1300		});
1301	});
1302};
1303
1304UNCODE.accessibility = function() {
1305    if ( ! SiteParameters.uncode_is_accessible ) {
1306        return;
1307    }
1308
1309    //
1310
1311};
1312UNCODE.bigText = function(el) {
1313	var bigTextLaunch = function(){
1314		if (el == undefined) {
1315			el = $('body');
1316		}
1317		$.each($('.bigtext', el), function(index, val) {
1318			$(val).bigtext({
1319				minfontsize: 24
1320			});
1321			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1322				opacity: 1
1323			});
1324			requestTimeout(function() {
1325				if ($(val).find('.animate_when_almost_visible').length != 0) {
1326					$(val).css({opacity: 1});
1327				}
1328			}, 400);
1329		});
1330	};
1331
1332	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1333		bigTextLaunch();
1334	}
1335	$(window).on( 'load', bigTextLaunch );
1336};
1337
1338UNCODE.process_shortpixel_image = function(image) {
1339	var data = {
1340		action: 'shortpixel_manual_optimization',
1341		image_id: image,
1342		cleanup: true
1343	};
1344
1345	$.get(SiteParameters.ajax_url, data);
1346};
1347
1348UNCODE.animateSubInside = function( _this, remove ){
1349	if ( typeof remove !== 'undefined' && remove === true ) {
1350		$(document).trigger('sub-menu-slide-up');
1351		$('.animate_when_almost_visible, .translate_when_almost_visible', _this).each(function(){
1352			$(this).removeClass('start_animation').css({ 'animation-delay': '0s', 'transition-delay': '0s'});
1353		});
1354	} else {
1355		$.each($('.translate_when_almost_visible:not(.start_animation), .animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', _this), function(index, val) {
1356			var element = $(val),
1357				delayAttr = element.attr('data-delay');
1358			if (delayAttr == undefined) delayAttr = 0;
1359			element.css({ 'animation-delay': delayAttr + 'ms', 'transition-delay': delayAttr + 'ms'});
1360			element.addClass('start_animation');
1361		});
1362		document.dispatchEvent(new CustomEvent('sub-menu-slide-down'));
1363	}
1364};
1365
1366
1367UNCODE.menuSystem = function() {
1368
1369	function menuMobile() {
1370		var $body = $('body'),
1371			scrolltop,
1372			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile:not(.vc_element)'),
1373			$masthead = $('#masthead'),
1374			$menuBlock = $('#uncode-mobile-menu-block'),
1375			$box,
1376			$el,
1377			$el_transp,
1378			elHeight,
1379			offCanvasAnim,
1380			check,
1381			animating = false,
1382			stickyMobile = false,
1383			menuClose = new CustomEvent('menuMobileClose'),
1384			menuOpen = new CustomEvent('menuMobileOpen');
1385		UNCODE.menuOpened = false;
1386		$mobileToggleButton.on('click', function(event) {
1387			event.stopPropagation();
1388			var btn = this;
1389			if ($(btn).hasClass('overlay-close')) return;
1390			event.preventDefault();
1391			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1392			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1393				$box = $(this).closest('.box-container').find('.main-menu-container:not(.no-mobile):not(.main-wrapper *)');
1394				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand):not(.main-wrapper *), .menu-sidebar-inner:not(.main-wrapper *)');
1395				$el_transp = $('.menu-absolute.menu-transparent');
1396				if (UNCODE.isMobile) {
1397					if ( $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical, .menu-mobile-centered, .menu-sticky-mobile').length ) {
1398						stickyMobile = true;
1399						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1400					} else {
1401						elHeight = 0;
1402						$.each($box.find('> div'), function(index, val) {
1403							elHeight += $(val).outerHeight();
1404						});
1405					}
1406				} else {
1407					elHeight = 0;
1408					$.each($el, function(index, val) {
1409						elHeight += $(val).outerHeight();
1410					});
1411				}
1412				var open = function() {
1413					clearTimeout(offCanvasAnim);
1414					if (!animating) {
1415						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1416						scrolltop = $(window).scrollTop();
1417						window.dispatchEvent(menuOpen);
1418						animating = true;
1419						UNCODE.menuOpened = true;
1420						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1421							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1422								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1423							}
1424							if ($('body.menu-offcanvas').length) {
1425								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1426								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1427							} else {
1428								if ( $('.menu-hide, .menu-sticky').length ) {
1429									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1430										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1431									}
1432								}
1433							}
1434						}
1435						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1436							//$("#masthead")[0].scrollIntoView();
1437							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + 
1437UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1438						}
1439						$box.addClass('open-items');
1440						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1441							$el_transp.addClass('is_mobile_open');
1442						}
1443						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1444							btn.classList.add('close');
1445							$box.animate({
1446								height: elHeight
1447							}, 600, "easeInOutCirc", function() {
1448								animating = false;
1449								if (!stickyMobile) $box.css('height', 'auto');
1450							});
1451						} else {
1452							animating = false;
1453						}
1454
1455						if ( $menuBlock.length ) {
1456							UNCODE.animateSubInside($menuBlock);
1457						}
1458					}
1459				};
1460
1461				var close = function() {
1462					clearTimeout(offCanvasAnim);
1463					if (!animating) {
1464						window.dispatchEvent(menuClose);
1465						animating = true;
1466						UNCODE.menuOpened = false;
1467						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1468							btn.classList.remove('close');
1469							btn.classList.add('closing');
1470						}
1471						$box.addClass('close');
1472						requestTimeout(function() {
1473							$box.removeClass('close');
1474							$box.removeClass('open-items');
1475							btn.classList.remove('closing');
1476							if ($el_transp.length) {
1477								$el_transp.removeClass('is_mobile_open');
1478							}
1479						}, 500);
1480						$body.removeClass('opening-overlay-menu');
1481						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1482							$box.animate({
1483								height: 0
1484							}, {
1485								duration: 600,
1486								easing: "easeInOutCirc",
1487								complete: function(elements) {
1488									$(elements).css('height', '');
1489									animating = false;
1490									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1491										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1492									}
1493									$body.removeClass('open-overlay-menu');
1494									if ( $menuBlock.length ) {
1495										UNCODE.animateSubInside($menuBlock, true);
1496									}
1497								}
1498							});
1499						} else {
1500							animating = false;
1501							offCanvasAnim = setTimeout(function(){
1502								$body.removeClass('open-overlay-menu');
1503								if ( $menuBlock.length ) {
1504									UNCODE.animateSubInside($menuBlock, true);
1505								}
1506							}, 1000);
1507						}
1508					}
1509				};
1510				check = (!UNCODE.menuOpened) ? open() : close();
1511			}
1512		});
1513
1514		$('html').on('click', function(event){
1515			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1516				$('.uncode-close-offcanvas-mobile:visible').trigger('click');
1517			}
1518		});
1519
1520		window.addEventListener('menuMobileTrigged', function(e) {
1521			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1522		});
1523		window.addEventListener('orientationchange', function(e) {
1524			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1525		});
1526		window.addEventListener("resize", function() {
1527			if ($(window).width() < UNCODE.mediaQuery) {
1528				if (UNCODE.isMobile) {
1529					var $box = $('.box-container .main-menu-container'),
1530						$el = $('.box-container .menu-horizontal-inner:not(.no-mobile), .box-container .menu-sidebar-inner:not(.no-mobile)');
1531					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1532						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1533							elHeight = 0;
1534							$.each($el, function(index, val) {
1535								elHeight += $(val).outerHeight();
1536							});
1537							elHeight = window.innerHeight - $('.menu-wrapper.menu-sticky .menu-container .row-menu-inner, .menu-wrapper.menu-hide-only .menu-container .row-menu-inner').height() - (UNCODE.bodyBorder * 2) + 1;
1538							$($box).css('height', elHeight + 'px');
1539						}
1540					}
1541				}
1542			} else {
1543				$('.menu-hide-vertical').removeAttr('style');
1544				$('.menu-container-mobile').removeAttr('style');
1545				$('.vmenu-container.menu-container').removeAttr('style');
1546
1547				if ( UNCODE.menuOpened ) {
1548					$('.open-items').removeClass('open-items');
1549					$('.is_mobile_open').removeClass('is_mobile_open');
1550					$('.open-overlay-menu').removeClass('open-overlay-menu');
1551					$('.opening-overlay-menu').removeClass('opening-overlay-menu');
1552				}
1553			}
1554		});
1555
1556		$(window).on('scroll', function(){
1557			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1558				$(window).scrollTop(scrolltop);
1559				return false;
1560			}
1561		});
1562
1563	};
1564
1565	function menuOffCanvas() {
1566		var menuClose = new CustomEvent('menuCanvasClose'),
1567			menuOpen = new CustomEvent('menuCanvasOpen');
1568		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1569			if ($(window).width() > UNCODE.mediaQuery) {
1570				if ( $('body.vmenu-offcanvas-overlay').length ) {
1571					if ($(event.currentTarget).hasClass('off-close')) {
1572						$(event.currentTarget).removeClass('off-close');
1573						requestTimeout(function() {
1574							window.dispatchEvent(menuClose);
1575						}, 500);
1576
1577					} else {
1578						$(event.currentTarget).addClass('off-close');
1579						window.dispatchEvent(menuOpen);
1580					}
1581				} else {
1582					if ($(event.currentTarget).hasClass('close')) {
1583						$(event.currentTarget).removeClass('close');
1584						$(event.currentTarget).addClass('closing');
1585						requestTimeout(function() {
1586							$(event.currentTarget).removeClass('closing');
1587							window.dispatchEvent(menuClose);
1588						}, 500);
1589
1590					} else {
1591						$(event.currentTarget).addClass('close');
1592						window.dispatchEvent(menuOpen);
1593					}
1594				}
1595			}
1596
1597			$('body').toggleClass('off-opened');
1598		});
1599
1600		$('body').on('click.menu-off-canvas-mobile', function(e){
1601			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1602				var $vMenuCont = $('#masthead .vmenu-container'),
1603					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1604
1605					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1606					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1607					vmenu_off = $vMenuCont.offset(),
1608					vmenu_l = parseFloat(vmenu_off.left),
1609					vmenu_t = parseFloat(vmenu_off.top),
1610					vmenu_r = vmenu_l + vmenu_w,
1611					vmenu_b = vmenu_t + vmenu_h,
1612
1613					close_h = parseFloat( $close_menu.outerHeight() ),
1614					close_w = parseFloat( $close_menu.outerWidth() ),
1615					close_off = $close_menu.offset(),
1616					close_l = parseFloat(close_off.left),
1617					close_t = parseFloat(close_off.top),
1618					close_r = close_l + close_w,
1619					close_b = close_t + close_h;
1620				if (
1621					!(
1622						e.clientX > vmenu_l &&
1623						e.clientX < vmenu_r
1624					)
1625					||
1626					(
1627						e.clientX > close_l &&
1628						e.clientX < close_r
1629					)
1630				) {
1631					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1632				}
1633			}
1634		});
1635	};
1636
1637	function menuOverlay() {
1638		if ( $('.overlay').length ) {
1639			$('.overlay').removeClass('hidden');
1640		}
1641		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1642			$('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li, .uncode-menu-additional-text').each(function(index, el) {
1643				var transDelay = (index / 20) + 0.1;
1644				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1645					transDelay = transDelay + 0.3;
1646				$(this)[0].setAttribute('style', '-webkit-transition-delay:' + transDelay + 's; -moz-transition-delay:' + transDelay + 's; -ms-transition-delay:' + transDelay + 's; -o-transition-delay:' + transDelay + 's; transition-delay:' + transDelay + 's');
1647			});
1648		}
1649	};
1650
1651	function menuToggleAnimation() {
1652		var $block = $('body'),
1653			$menuBlocks = $('.menu.unmenu-block', $block),
1654			$allSeqs = $('[data-delay-seq]', $block);
1655
1656		$allSeqs.each(function(key, seq){
1657			$(seq).removeAttr('data-delay');
1658		});
1659
1660		$menuBlocks.each(function(key, menu){
1661
1662			var $animatesHidden = $('.translate_when_almost_visible', menu).filter(':hidden');
1663			$animatesHidden.each(function(key_, seq){
1664				$(seq).removeClass('translate_when_almost_visible').addClass('not_translate_when_almost_visible');
1665			});
1666
1667			var $animatesVisibile = $('.not_translate_when_almost_visible', menu).filter(':visible');
1668			$animatesVisibile.each(function(key_, seq){
1669				$(seq).removeClass('not_translate_when_almost_visible').addClass('translate_when_almost_visible');
1670			});
1671
1672			var $delaySequentials = $('[data-delay-seq]', menu).filter(':visible'),
1673				delay = parseFloat( $delaySequentials.first().attr('data-delay-seq') ),
1674				interval = parseFloat( $delaySequentials.first().attr('data-interval') );
1675			$delaySequentials.each(function(_key, seq){
1676				$(seq).attr('data-delay', delay + (interval*_key));
1677			});
1678		});
1679	}
1680	//menuToggleAnimation();
1681	$(document).on('unblock-toggles-init', menuToggleAnimation);
1682
1683	var $secondary_parent;
1684	function menuAppend() {
1685
1686		var $menuBlock = $('#uncode-mobile-menu-block').length;
1687		if ( $menuBlock ) {
1688			return;
1689		}
1690		var $body = $('body'),
1691			$menuCont = $('.menu-container:not(.vmenu-container)'),
1692			$vMenuCont = $('.menu-container.vmenu-container'),
1693			$cta = $('.navbar-cta'),
1694			$socials = $('.navbar-social:not(.appended-navbar)'),
1695			$ul = $('.navbar-main ul.menu-primary-inner'),
1696			$ulCta,
1697			$ulSocials,
1698			$navLast,
1699			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1700			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1701			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1702			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1703			$ulFirst = $('> ul', $firstNav),
1704			setCTA,
1705			appendCTA = function(){
1706				return true;
1707			},
1708			appendSocials = function(){
1709				return true;
1710			},
1711			appendSplit = function(){
1712				return true;
1713			};
1714
1715		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1716			$ulCta = $('> ul', $cta);
1717			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1718
1719			appendCTA = function(){
1720				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1721					$ul.after($ulCta);
1722				} else {
1723					$cta.append($ulCta);
1724				}
1725			}
1726		}
1727
1728		if ( ! $body.hasClass('cta-not-appended') ) {
1729			appendCTA();
1730		}
1731
1732		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1733		$smartSocial.each(function(){
1734			var $_smartSocial = $(this);
1735			$('> li', $_smartSocial).each(function(){
1736				var $li = $(this);
1737				if ( $li.hasClass('mobile-hidden') ) {
1738					$_smartSocial.addClass('mobile-hidden');
1739				} else {
1740					$_smartSocial.removeClass('mobile-hidden');
1741					return false;
1742				}
1743			});
1744
1745			$('> li', $_smartSocial).each(function(){
1746				var $li = $(this);
1747				if ( $li.hasClass('tablet-hidden') ) {
1748					$_smartSocial.addClass('tablet-hidden');
1749				} else {
1750					$_smartSocial.removeClass('tablet-hidden');
1751					return false;
1752				}
1753			});
1754		});
1755
1756		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1757			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1758			if ( $body.hasClass('hmenu-center-split') ) {
1759				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1760			} else {
1761				$navLast = $('.navbar-nav-last', $vMenuCont);
1762			}
1763
1764			if ( ! $navLast.length ) {
1765				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1766				if ( $body.hasClass('hmenu-center-split') ) {
1767					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1768					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1769				} else {
1770					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1771					$navLast = $('.navbar-nav-last', $vMenuCont);
1772				}
1773			}
1774
1775			appendSocials = function(){
1776				if ( !$body.hasClass('menu-overlay-center') ) {
1777				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1778				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1779				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1780				// 		$ulSocials.each(function(){
1781				// 			var $li_social = $(this);
1782				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1783				// 		});
1784				// 	}
1785				// } else {
1786					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1787						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1788						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1789							$('> ul.menu-smart-social li', $socials).remove();
1790						}
1791						$navLast.append($ulSocials);
1792					} else {
1793						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1794							$('> ul.menu-smart-social li', $navLast).remove();
1795						}
1796						$socials.append($ulSocials);
1797					}
1798				}
1799			}
1800			appendSocials();
1801		}
1802
1803		if ( $vMenuCont.length ) {
1804			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1805		} else {
1806			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1807		}
1808		if ( $accordion_secondary.length ) {
1809			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1810			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1811				if ( !$accordion_secondary_ph.length ) {
1812					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1813				}
1814				if ( $vMenuCont.length ) {
1815					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1816				} else {
1817					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1818						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1819					} else {
1820						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1821					}
1822				}
1823			} else {
1824				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1825					$accordion_secondary_ph.before($accordion_secondary);
1826				}
1827			}
1828		}
1829
1830		if ( $vMenuCont.length ) {
1831			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1832		} else {
1833			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1834		}
1835
1836		if ( $extra_icons.length ) {
1837			if ( $vMenuCont.length ) {
1838				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1839					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1840						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1841							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1842						$not_social.each(function(){
1843							if ( ! $primary_after.length ) {
1844								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1845								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1846								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1847							}
1848							var $extra_li = $(this);
1849							$primary_after.find('> ul').append($extra_li);
1850						});
1851					} else {
1852						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1853							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1854						$not_social.each(function(){
1855							var $extra_li = $(this);
1856							$extra_icons.find('> ul').append($extra_li);
1857						});
1858					}
1859				} /*else {
1860					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1861					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1862						if ( !$extra_icons_ph.length ) {
1863							$extra_icons.after('<span class="extra-icons-ph" />');
1864						}
1865						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1866							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1867						} else {
1868							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1869						}
1870					} else {
1871						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1872							$extra_icons_ph.before($extra_icons);
1873						}
1874					}
1875				}*/
1876			} else {
1877				if ( ! $body.hasClass('hmenu-center-double') ) {
1878					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1879						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1880							$primary_after = $('.nav.navbar-main-after', $menuCont);
1881
1882						if ( ! $primary_after.length && $not_social.length ) {
1883							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1884								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1885							} else {
1886								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1887							}
1888							$primary_after = $('.nav.navbar-main-after', $menuCont);
1889							$primary_after.append('<ul class="menu-smart sm menu-smart-social" role="menu" />');
1890						}
1891						var tablet_hidden = true,
1892							mobile_hidden = true;
1893						$not_social.each(function(){
1894							var $extra_li = $(this);
1895							$primary_after.find('> ul').append($extra_li);
1896							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1897								tablet_hidden = false;
1898							}
1899							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1900								mobile_hidden = false;
1901							}
1902						});
1903						if ( tablet_hidden === true && $not_social.length ) {
1904							$primary_after.addClass('tablet-hidden');
1905						}
1906						if ( mobile_hidden === true && $not_social.length ) {
1907							$primary_after.addClass('mobile-hidden');
1908						}
1909					} else {
1910						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1911
1912						if ( $primary_after.length ) {
1913							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1914							$not_social.each(function(){
1915								var $extra_li = $(this);
1916								$extra_icons.find('> ul').append($extra_li);
1917							});
1918							$primary_after.remove();
1919						}
1920					}
1921				}
1922			}
1923		}
1924
1925		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1926			appendSplit = function(){
1927				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1928					if ( $extra_icons.length ) {
1929						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1930							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1931								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1932							$not_social.each(function(){
1933								var $extra_li = $(this);
1934								$append_ul.append($extra_li);
1935							});
1936							if ( $secondNav.length ) {
1937								$secondNav.append($append_ul);
1938							} else {
1939								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1940							}
1941						}
1942					}
1943					if ( $secondNav.length ) {
1944						$secondNav.prepend($ulFirst);
1945					} else {
1946						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1947					}
1948					$firstMenu.hide();
1949				} else {
1950					$firstNav.append($ulFirst);
1951					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1952					if ( $append_ul.length ) {
1953						var $not_social = $('> li:not(.social-icon)', $append_ul);
1954						$not_social.each(function(){
1955							var $extra_li = $(this);
1956							$extra_icons.find('> ul').append($extra_li);
1957						});
1958					}
1959					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1960					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1961					$firstMenu.css({
1962						'display': 'table-cell'
1963					});
1964				}
1965			}
1966		}
1967		appendSplit();
1968
1969		$(window).on( 'wwResize', function(){
1970			clearRequestTimeout(setCTA);
1971			setCTA = requestTimeout( function() {
1972				appendCTA();
1973				appendSocials();
1974				appendSplit();
1975			}, 10 );
1976		});
1977	}
1978	//menuMobileButton();
1979	menuMobile();
1980	menuOffCanvas();
1981	menuAppend();
1982	menuOverlay();
1983
1984	var stickyDropdownSearch = function(){
1985		var $masthead = $('#masthead'),
1986			$ddSearch = $('.overlay.overlay-search', $masthead),
1987			$styles = $('#stickyDropdownSearch').remove();
1988		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1989			var $menuWrapper = $('.menu-wrapper'),
1990				$navbar = $('.menu-container-mobile', $menuWrapper),
1991				navbarH = $navbar.outerHeight(),
1992				//$topbar = $('.top-menu', $menuWrapper),
1993				//topbarH = $topbar.outerHeight(),
1994				_css;
1995
1996			_css = '<style id="stickyDropdownSearch">';
1997			_css += '@media (max-width: 959px) {';
1998			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
1999			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
2000			_css += '}';
2001			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
2002			_css += 'position: fixed;';
2003			_css += 'top: 0;';
2004			_css += '}';
2005			_css += '</style>';
2006
2007			$(_css).appendTo($('head'));
2008		}
2009	}
2010	stickyDropdownSearch();
2011
2012	var setMenuOverlay;
2013	$(window).on( 'wwResize', function(){
2014		if ( $('.overlay').length && $(window).width() > 1024 ) {
2015			$('.overlay').addClass('hidden');
2016		}
2017		clearRequestTimeout(setMenuOverlay);
2018		setMenuOverlay = requestTimeout( function(){
2019			menuOverlay();
2020			menuAppend();
2021			stickyDropdownSearch();
2022		}, 150 );
2023	});
2024	UNCODE.menuMegaBlock();
2025	UNCODE.menuSmartInit();
2026	$(window).on('wwResize', function(){
2027		UNCODE.menuSmartInit();
2028	});
2029
2030	$(window).on('menuOpen', function(){
2031		var $overlay = $('.overlay.overlay-unblock');
2032		if ( $overlay.length ) {
2033			UNCODE.animateSubInside($overlay);
2034		}
2035	});
2036
2037	$(window).on('menuClosed', function(){
2038		var $overlay = $('.overlay.overlay-unblock');
2039		if ( $overlay.length ) {
2040			UNCODE.animateSubInside($overlay, true);
2041			var $smartMenus = $overlay.find('.menu-smart');
2042			$smartMenus.each(function(key, smartMenu){
2043				$(smartMenu).smartmenus('menuHideAll');
2044			});
2045		}
2046	});
2047};
2048
2049UNCODE.menuSmartInit = function() {
2050	var $menusmart = $('[class*="menu-smart"]'),
2051		$masthead = $('#masthead'),
2052		$hMenu = $('.menu-horizontal-inner', $masthead),
2053		$focus = $('.overlay-menu-focus'),
2054		$uls_anim = $('> li> ul[role="menu"]', $menusmart),
2055		showTimeout = 50,
2056		hideTimeout = 50,
2057		showTimeoutFunc, hideTimeoutFunc, subMenuRT;
2058
2059	if ( typeof $masthead.attr('data-menu-anim') !== 'undefined' && $masthead.attr('data-menu-anim') !== '' ) {
2060		var menu_anim = $masthead.attr('data-menu-anim');
2061		if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
2062			$uls_anim.each(function(){
2063				var $ul_anim = $(this);
2064				if ( !$('> li[data-block]', $ul_anim).length ) {
2065					$ul_anim.addClass('animate_when_almost_visible');
2066					$ul_anim.addClass(menu_anim);
2067				} else {
2068					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2069					if ( dataB !== 'no-anim' && !dataB.includes('slight-anim') ) {
2070						$ul_anim.addClass('animate_when_almost_visible');
2071						$ul_anim.addClass(dataB);
2072					}
2073				}
2074			});
2075		} else {
2076			$uls_anim.each(function(){
2077				var $ul_anim = $(this);
2078				if ( !$('> li[data-block]', $ul_anim).length ) {
2079					$ul_anim.removeClass('animate_when_almost_visible');
2080					$ul_anim.removeClass(menu_anim);
2081				} else {
2082					console.log($ul_anim);
2083					var dataB = $('> li[data-block]', $ul_anim).attr('data-block');
2084					console.log(dataB);
2085					$ul_anim.removeClass('animate_when_almost_visible');
2086					$ul_anim.removeClass(dataB);
2087				}
2088			});
2089		}
2090	}
2091
2092	$('> li.menu-item-has-children', $menusmart).hover(function(){
2093		$(this).data('hover', true);
2094	}, function(){
2095		$(this).data('hover', false);
2096	});
2097
2098	$('> li.menu-item-has-children', $menusmart).each(function(){
2099		var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
2100	});
2101
2102	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
2103		e.preventDefault();
2104	});
2105
2106	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
2107			
2108		var $notLis = $('> .nav > ul > li a', $hMenu),
2109			$menuA = $('a', $masthead).not($notLis),
2110			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
2111			showFuncCond = function() { return true };
2112
2113		if ( $('body').hasClass('focus-megamenu') ) {
2114			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.need-focus');
2115			showFuncCond = function($ul) { return $ul.hasClass('need-focus') };
2116		} else if ( $('body').hasClass('focus-links') ) {
2117			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
2118		}
2119
2120		$hoverSelector.hover(function(){
2121			clearRequestTimeout(hideTimeoutFunc);
2122			showTimeoutFunc = requestTimeout(function(){
2123				$('body').addClass('navbar-hover');
2124			}, showTimeout*2);
2125		}, function(){
2126			hideTimeoutFunc = requestTimeout(function(){
2127				if ( ! $('.overlay-search.open', $masthead).length ) {
2128					$('body').removeClass('navbar-hover');
2129				}
2130			}, hideTimeout*2);
2131		});
2132	} else {
2133		showFuncCond = function() { return false };
2134	}
2135
2136	if ($menusmart.length > 0) {
2137		var objShowTimeout;
2138		$menusmart.smartmenus({
2139			subIndicators: false,
2140			subIndicatorsPos: 'append',
2141			//subMenusMinWidth: '13em',
2142			showOnClick: SiteParameters.menuShowOnClick,
2143			subIndicatorsText: '',
2144			showTimeout: showTimeout,
2145			hideTimeout: hideTimeout,
2146			scrollStep: 8,
2147			showFunction: function($ul, complete) {
2148				$(document).trigger('un-menu-show', $ul);
2149				clearRequestTimeout(showTimeoutFunc);
2150				$ul.fadeIn(0, 'linear', function(){
2151					complete();
2152					if ( $ul.hasClass('vc_row') ) {
2153						$ul.css({
2154							'display': 'table'
2155						});
2156					}
2157					if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') ) {
2158						$('body').addClass('open-megamenu');
2159					}
2160					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
2161						$('body').addClass('navbar-hover');
2162					}
2163					var showed = 0;
2164					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(index, val){
2165						var $element = $(this),
2166							delayAttr = $element.attr('data-delay');
2167						if ( !$element.closest('.owl-carousel').length && ! $element.closest('.cssgrid-animate-sequential').length ) {
2168							if (delayAttr == undefined) delayAttr = 0;
2169							requestTimeout(function() {
2170								$element.addClass('start_animation');
2171							}, delayAttr);
2172						} else if ( $element.closest('.cssgrid-animate-sequential').length ) {
2173							var grid = $element.closest('.cssgrid-animate-sequential');
2174
2175							var delay = index,
2176								delayAttr = parseInt($element.attr('data-delay'));
2177							if (isNaN(delayAttr)) delayAttr = 100;
2178							delay -= showed;
2179							objShowTimeout = requestTimeout(function() {
2180								$element.removeClass('zoom-reverse').addClass('start_animation');
2181								showed = index;
2182							}, delay * delayAttr);
2183						}
2184					});
2185					if ( $ul.is('.animate_when_almost_visible') ) {
2186						$ul.addClass('start_animation');
2187					}
2188				}).addClass('open-animated');
2189			},
2190			hideFunction: function($ul, complete) {
2191				if ( $('.overlay-menu-focus').length && $ul.hasClass('need-focus') && ! $('.overlay-search.open', $masthead).length ) {
2192					$('body').removeClass('open-megamenu');
2193				}
2194				var fixIE = $('html.ie').length;
2195				if (fixIE) {
2196					var $rowParent = $($ul).closest('.main-menu-container');
2197					$rowParent.height('auto');
2198				}
2199				$ul.fadeOut(0, 'linear', function(){
2200					complete();
2201					$ul.removeClass('open-animated');
2202					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
2203						$('body').removeClass('open-submenu');
2204					}
2205					$('.animate_when_almost_visible, .translate_when_almost_visible', $ul).each(function(){
2206						$(this).removeClass('start_animation');
2207					});
2208					if ( $ul.is('.animate_when_almost_visible') ) {
2209						$ul.removeClass('start_animation');
2210					}
2211				});
2212				$ul.find('.start_animation').each(function(index, val) {
2213					clearRequestTimeout(subMenuRT);
2214					$(val).removeClass('start_animation');
2215				});
2216				$(document).trigger('un-menu-hide', $ul);
2217				clearRequestTimeout(objShowTimeout);
2218			},
2219			collapsibleShowFunction: function($ul, complete) {
2220				$ul.slideDown(400, 'easeInOutCirc', function(){
2221					UNCODE.animateSubInside($ul);
2222					complete();
2223				});
2224			},
2225			collapsibleHideFunction: function($ul, complete) {
2226				$ul.slideUp(200, 'easeInOutCirc', function(){
2227					complete();
2228				});
2229				$(document).trigger('sub-menu-slide-up');
2230			},
2231			hideOnClick: SiteParameters.menuHideOnClick,
2232		});
2233
2234		if ( $('body').hasClass('menu-accordion-active') ) {
2235			$menusmart.each(function(key, menu){
2236				$(menu).addClass('menu-smart-init');
2237				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2238			});
2239		}
2240
2241		$menusmart.each(function(key, menu){
2242			$(menu).on('beforecollapse.smapi', function( e, $sub ){
2243				if ( $('> .trigger-window-resize', $sub).length ) {
2244					window.dispatchEvent(new Event('resize'));
2245					$(window).trigger('uncode.re-layout');
2246				} else if ( $('> .trigger-box-resize', $sub).length ) {
2247					window.dispatchEvent(new CustomEvent('boxResized'));
2248				}
2249				return false;
2250			});
2251		});
2252		
2253		$(document).on( 'uncode.smartmenu-appended', function(){
2254			requestTimeout(function(){
2255				$menusmart.smartmenus( 'refresh' );
2256			}, 1000);
2257		});
2258
2259	}
2260
2261	$('.main-menu-container').each(function(){
2262		var $main_cont = $(this),
2263			$uls = $('ul:not(.nav-tabs)', $main_cont);
2264
2265		$uls.each(function(){
2266			var $ul = $(this),
2267				mobile_hidden = true,
2268				tablet_hidden = true;
2269			$('> li:not(.hidden)', $ul).each(function(){
2270				if ( !$(this).hasClass('mobile-hidden') ) {
2271					mobile_hidden = false;
2272					return false;
2273				}
2274			});
2275			$('> li:not(.hidden)', $ul).each(function(){
2276				if ( !$(this).hasClass('tablet-hidden') ) {
2277					tablet_hidden = false;
2278					return false;
2279				}
2280			});
2281			if ( mobile_hidden ) {
2282				$ul.addClass('mobile-hidden');
2283			}
2284			if ( tablet_hidden ) {
2285				$ul.addClass('tablet-hidden');
2286			}
2287		});
2288
2289		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2290
2291		$divUlsMB.each(function(){
2292			var $divUlMB = $(this),
2293				div_mobile_hidden = true,
2294				div_tablet_hidden = true;
2295
2296			$('> ul:not(.hidden)', $divUlMB).each(function(){
2297				if ( !$(this).hasClass('mobile-hidden') ) {
2298					div_mobile_hidden = false;
2299					return false;
2300				}
2301			});
2302			$('> ul:not(.hidden)', $divUlMB).each(function(){
2303				if ( !$(this).hasClass('tablet-hidden') ) {
2304					div_tablet_hidden = false;
2305					return false;
2306				}
2307			});
2308			if ( div_mobile_hidden ) {
2309				$divUlMB.addClass('mobile-hidden');
2310			}
2311			if ( div_tablet_hidden ) {
2312				$divUlMB.addClass('tablet-hidden');
2313			}
2314		});
2315	});
2316
2317	var overlaySearchButton = function(){
2318		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2319
2320		$search_wrap.each(function(){
2321			var $form = $('form', this),
2322				$icon = $('i', $form);
2323
2324			$icon.on('click', function(){
2325				$form.submit();
2326			});
2327		});
2328	};
2329	overlaySearchButton();
2330}
2331
2332UNCODE.menuMegaBlock = function() {
2333	var $megaBlocks = $('.megamenu-block-wrapper');
2334	if ( ! $megaBlocks.length ) {
2335		return;
2336	}
2337
2338	$megaBlocks.each(function(){
2339		var $megaLi = $(this),
2340			//$parentLi = $megaLi.closest('li.menu-item').addClass('mega-menu'),
2341			dataLi = $megaLi.attr('data-block'),
2342			$megaUl = $megaLi.closest('ul').addClass('block-wrapper-parent unmenu-inner-ul'),
2343			$innerUl = $megaLi.find('ul').addClass('unmenu-inner-ul');
2344		$megaUl.addClass(dataLi);
2345		//$('.column_parent > .uncol .uncont:not(.uncont *)', $megaLi).addClass(dataLi);
2346		$('img', $megaLi).removeAttr('loading');
2347	});
2348}
2349
2350UNCODE.unBlockMenu = function(){
2351	//Menu block
2352	var $unBlockMenus = $('.menu.unmenu-block');
2353
2354	$unBlockMenus.each(function(){
2355		var $unBlockMenu = $(this),
2356			$lastOnes;
2357
2358		if ( !$unBlockMenu.hasClass('first-grid') ) {
2359			$lastOnes = $('ul', $unBlockMenu).last();
2360			$lastOnes.each(function(){
2361                var _cols = $(this).css('grid-template-columns');
2362				if ( _cols.split(' ').length > 1 && !_cols.startsWith('repeat(1,')) {
2363					$unBlockMenu.addClass('has-last-ones');
2364					$(this).addClass('last-one');
2365				} else {
2366					var $parentLi = $(this).closest('li'),
2367						$siblingLi = $parentLi.next();
2368					if ( !$siblingLi.length ) {
2369						$unBlockMenu.addClass('has-last-ones');
2370						$(this).addClass('last-one');
2371					}
2372				}
2373			});
2374		} else {
2375			var checkGrids = function(){
2376				$unBlockMenu.find('.last-ul').removeClass('last-one');
2377				var _cols = $unBlockMenu.css('grid-template-columns'),
2378                    cols = _cols.match(/^repeat\(\s*(\d+)\s*,/) ? parseInt(_cols.match[1], 10) : _cols.split(' ').length,
2379					$lis = $('> li', $unBlockMenu),
2380					totLi = $lis.length,
2381					lastRowCount = totLi - (totLi % cols || cols),
2382					$lastLis = $lis.slice(cols).addClass('last-lis'),
2383    				$lastRowLis = $lis.slice(lastRowCount);
2384				$lastRowLis.each(function(){
2385					var $lastRowLi = $(this);
2386					$lastRowLi.find('ul').last().addClass('last-one');
2387				});
2388			}
2389			$(window).on('wwResize', checkGrids);
2390			checkGrids();
2391
2392		}
2393
2394	});
2395
2396	//Accordion
2397
2398	var $tgglBlocks = $('.unmenu-collapse');
2399	$tgglBlocks.each(function(key, val){
2400		var $acc = $(val),
2401			$titles = $('.menu-item-has-children > *:first-child', $acc),
2402			run = true;
2403
2404		var checkRun = function(){
2405			if ( $acc.hasClass('unmenu-collapse-mobile') && UNCODE.wwidth >= UNCODE.mediaQuery ) {
2406				run = false;
2407			} else {
2408				run = true;
2409			}
2410
2411			if ( $titles.length ) {
2412				$titles.each(function(_key, _val){
2413					var $title = $(_val),
2414						$sub = $title.closest('li').find('> ul.un-submenu');
2415
2416					$sub.each(function(key, val){
2417						if ( run ) {
2418
2419							var total = $sub.length;
2420							var completed = 0;
2421				
2422							$(val).slideUp({
2423								duration: 1,
2424								complete: function() {
2425									$(this).addClass('toggle-init');
2426
2427									completed++;
2428
2429									if ( completed === total ) {
2430										$(document).trigger('unblock-toggles-init');
2431										$( document.body ).trigger( 'uncode_waypoints' );
2432									}
2433								}
2434							});
2435						} else {
2436							$(val).show();
2437						}
2438					});
2439				});
2440			}
2441		}
2442		checkRun();
2443
2444		$(window).on('wwResize menuClosed', checkRun);
2445
2446		if ( $titles.length ) {
2447			$titles.each(function(_key, _val){
2448				var $title = $(_val),
2449					$sub = $title.closest('li').find('> ul.un-submenu'),
2450					$menu = $sub.closest('.menu.unmenu-block'),
2451					$ulS;
2452
2453				$title.off('click').on('click', function(e){
2454					e.preventDefault();
2455					$ulS = $menu.find('ul:visible').not($sub).not($sub.parents('ul'))
2456					if ( run ) {
2457						if ( $sub.is(':visible') ) {
2458							$sub.slideUp(200, 'easeInOutCirc', function(){
2459								$.each($('.start_animation', $sub), function(index, val) {
2460									var element = $(val);
2461									element.removeClass('start_animation');
2462
2463								});
2464								$sub.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2465								$(document).trigger('sub-menu-slide-up');
2466							});
2467						} else {
2468							$ulS.slideUp({
2469								duration: 200,
2470								easing: 'easeInOutCirc',
2471								start: function(){
2472									var _this = $(this);
2473									_this.parents('li').eq(0).addClass('un-submenu-closed').removeClass('un-submenu-open');
2474									$(document).trigger('sub-menu-slide-up');
2475								}
2476							});
2477
2478							$sub.slideDown({
2479								duration: 400,
2480								easing: 'easeInOutCirc',
2481								start: function() {
2482									var _this = $(this);
2483									_this.css('height', 0);
2484									if ( _this.hasClass('is-grid') ) {
2485										_this.css('display','grid');
2486									}
2487
2488									UNCODE.animateSubInside(_this)
2489									_this.parents('li').eq(0).addClass('un-submenu-open').removeClass('un-submenu-closed');
2490								}
2491							});
2492						}
2493
2494					}
2495				});
2496			});
2497
2498			if ( $acc.closest('#masthead').length ) {
2499				$(window).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
2500					$acc.find('ul.un-submenu').slideUp(200, 'easeInOutCirc');
2501				});
2502			}
2503		}
2504
2505	});
2506	
2507};
2508
2509UNCODE.mobileMenuBlockSkins = function(){
2510	var $mobileBlock = $('#uncode-mobile-menu-block'),
2511		$parentDark = $mobileBlock.closest('.submenu-dark'),
2512		$parentLight = $mobileBlock.closest('.submenu-light');
2513
2514
2515	if ( $parentDark.length ) {
2516		var $cols = $('.uncol.style-light:not(.style-spec):not(.style-run)', $mobileBlock);
2517		$cols.each(function(key, val){
2518			var $col = $(val).removeClass('style-light').addClass('style-dark style-run');
2519		});
2520	}
2521
2522	if ( $parentLight.length ) {
2523		var $cols = $('.uncol.style-dark:not(.style-spec):not(.style-run)', $mobileBlock);
2524		$cols.each(function(key, val){
2525			var $col = $(val).removeClass('style-dark').addClass('style-light style-run');
2526		});
2527	}
2528};
2529UNCODE.okvideo = function(ev) {
2530	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2531	$.okvideo = function(options) {
2532		// if the option var was just a string, turn it into an object
2533		if (typeof options !== 'object') options = {
2534			'video': options
2535		};
2536		var base = this;
2537		// kick things off
2538		base.init = function() {
2539			base.options = $.extend({}, $.okvideo.options, options);
2540			// support older versions of okvideo
2541			if (base.options.video === null) base.options.video = base.options.source;
2542			base.setOptions();
2543			var target = base.options.target || $('body');
2544			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2545			var zIndex = base.options.controls === 3 ? -999 : "auto";
2546			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2547				var mask = '<div id="okplayer-mask-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:-998;height:100%;width:100%;"></div>';
2548				if (OKEvents.utils.isMobile()) {
2549					target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
2550				} else {
2551					if (base.options.controls === 3) {
2552						target.append(mask)
2553					}
2554					if (base.options.adproof === 1) {
2555						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:-10%;top:-10%;overflow:hidden;z-index:' + zIndex + ';height:120%;width:120%;"></div>');
2556					} else {
2557						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
2558					}
2559				}
2560				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2561				if (base.options.playlist.list === null) {
2562					if (base.options.video.provider === 'youtube') {
2563						base.loadYouTubeAPI();
2564					} else if (base.options.video.provider === 'vimeo') {
2565						base.options.volume /= 100;
2566						base.loadVimeoAPI();
2567					}
2568				} else {
2569					base.loadYouTubeAPI();
2570				}
2571			}
2572		};
2573		// clean the options
2574		base.setOptions = function() {
2575			// exchange 'true' for '1' and 'false' for 3
2576			for (var key in this.options) {
2577				if (this.options[key] === true) this.options[key] = 1;
2578				if (this.options[key] === false) this.options[key] = 3;
2579			}
2580			if (base.options.playlist.list === null) {
2581				base.options.video = base.determineProvider();
2582			}
2583			// pass options to the window
2584			$(window).data('okoptions-' + base.options.id, base.options);
2585		};
2586		// insert js into the head and exectue a callback function
2587		base.insertJS = function(src, callback, provider){
2588			var tag;
2589			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2590				delete UNCODE.insertedSripts[src];
2591				var tags = document.getElementsByTagName('script');
2592				for (var i = tags.length; i >= 0; i--){
2593					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2594						tags[i].parentNode.removeChild(tags[i]);
2595					}
2596				}
2597			} else {
2598				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2599					tag = UNCODE.insertedSripts[src];
2600					if (callback){
2601						if (tag.readyState){  //IE
2602							tag.onreadystatechange = function(){
2603								if (tag.readyState === "loaded" ||
2604									tag.readyState === "complete"){
2605									tag.onreadystatechange = null;
2606									callback();
2607								}
2608							};
2609						} else {
2610							$(tag).on('load', callback);
2611						}
2612					}
2613					return;
2614				}
2615			}
2616			tag = document.createElement('script');
2617			if (callback){
2618				if (tag.readyState){  //IE
2619					tag.onreadystatechange = function(){
2620						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2621							tag.onreadystatechange = null;
2622							callback();
2623						}
2624					};
2625				} else {
2626					tag.onload = function() {
2627						callback();
2628					};
2629				}
2630			}
2631			tag.src = src;
2632			var firstScriptTag = document.getElementsByTagName('script')[0];
2633			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2634			if ( ! UNCODE.insertedSripts ) {
2635				UNCODE.insertedSripts = [];
2636			}
2637			UNCODE.insertedSripts[src] = tag;
2638		};
2639		// load the youtube api
2640		base.loadYouTubeAPI = function(callback) {
2641			if ( ev === 'uncode-more-items-loaded' ) {
2642				onYouTubeIframeAPIReady();
2643			} else {
2644				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2645			}
2646		};
2647		base.loadYouTubePlaylist = function() {
2648			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2649		};
2650		// load the vimeo api by replacing the div with an iframe and loading js
2651		base.loadVimeoAPI = function() {
2652			var source = '//player.vimeo.com/video/' + base.options.video.id + '?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',
2653			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2654			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2655			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2656			base.insertJS('//player.vimeo.com/api/player.js', function() {
2657				vimeoPlayerReady(base.options.id);
2658			}, 'vimeo');
2659		};
2660		// is it from youtube or vimeo?
2661		base.determineProvider = function() {
2662			var a = document.createElement('a');
2663			a.href = base.options.video;
2664			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2665				var videoid = a.href.split('/')[3].toString();
2666				var query = videoid.substring(videoid.indexOf('?') + 1);
2667				if (query != '') {
2668					var vars = query.split('&');
2669					for (var i = 0; i < vars.length; i++) {
2670						var pair = vars[i].split('=');
2671						if (pair[0] == 'v') {
2672							videoid = pair[1];
2673						}
2674					}
2675				}
2676				return {
2677					"provider": "youtube",
2678					"id": videoid
2679				};
2680			} else if (/vimeo.com/.test(base.options.video)) {
2681				return {
2682					"provider": "vimeo",
2683					"id": (a.href.split('/')[3].toString()).split('#')[0],
2684				};
2685			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2686				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2687				if (id.length == 11) {
2688					return {
2689						"provider": "youtube",
2690						"id": id.toString()
2691					};
2692				} else {
2693					for (var i = 0; i < base.options.video.length; i++) {
2694						if (typeof parseInt(base.options.video[i]) !== "number") {
2695							throw 'not vimeo but thought it was for a sec';
2696						}
2697					}
2698					return {
2699						"provider": "vimeo",
2700						"id": base.options.video
2701					};
2702				}
2703			} else {
2704				throw "OKVideo: Invalid video source";
2705			}
2706		};
2707		base.init();
2708	};
2709
2710	var checkResize,
2711		newW = UNCODE.wwidth;
2712
2713	$.okvideo.options = {
2714		id: null,
2715		source: null, // Deprecate dis l8r
2716		video: null,
2717		playlist: { // eat ur heart out @brokyo
2718			list: null,
2719			index: 0,
2720			startSeconds: 0,
2721			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2722		},
2723		disableKeyControl: 1,
2724		captions: 0,
2725		loop: 1,
2726		hd: 1,
2727		volume: 0,
2728		adproof: false,
2729		unstarted: null,
2730		onFinished: null,
2731		onReady: null,
2732		onPlay: null,
2733		onPause: null,
2734		buffering: null,
2735		controls: false,
2736		autoplay: true,
2737		annotations: true,
2738		cued: null
2739	};
2740	$.fn.okvideo = function(options) {
2741		options.target = this;
2742		return this.each(function() {
2743			(new $.okvideo(options));
2744		});
2745	};
2746
2747	var checkForVideos = function(){
2748		$(".uncode-video-container.video").each(function(index, el) {
2749			var $this = $(this),
2750				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2751				url = $this.attr('data-video'),
2752				id = $this.attr('data-id'),
2753				cloned = $this.closest('.owl-item');
2754
2755			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2756				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2757					$this.okvideo({
2758						id: id,
2759						source: url.split('#')[0],
2760						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2761						autoplay: 1,
2762						controls: 0,
2763						volume: 0,
2764						adproof: 0,
2765						caller: $this,
2766						hd: 1,
2767						onReady: function(player) {
2768							var getPlayer = player.c || player.h || player,
2769							$iframe,
2770							getContainer = $(getPlayer).closest('.background-element');
2771							if (getContainer.length) {
2772								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2773							}
2774
2775							if ( $this.hasClass('drop-move') ) {
2776
2777								var $iframe = $(getPlayer),
2778									w = parseFloat($iframe.attr('width')),
2779									h = parseFloat($iframe.attr('height')),
2780									ratio = h / w,
2781									setResizeiFto,
2782								resizeiFrame = function(){
2783									var dataW = $this.attr('data-w'),
2784										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2785										newH = newW * ratio;
2786									$iframe.css({
2787										width: newW,
2788										height: newH
2789									});
2790								};
2791								resizeiFrame();
2792								$(window).on( 'load', resizeiFrame );
2793								$(window).on( 'resize', function(){
2794									clearRequestTimeout(setResizeiFto);
2795									setResizeiFto = requestTimeout( function() {
2796										resizeiFrame();
2797									}, 10 );
2798								});
2799
2800							}
2801
2802						}
2803					});
2804				}
2805			}
2806		});
2807	};
2808
2809	checkForVideos();
2810
2811	$(window).on('load', function(){
2812		$('.mejs-fullscreen-button button').on('click', function(){
2813			var $button = $(this),
2814				$stuck = $button.closest('.is_stucked');
2815
2816			if ( $stuck.length ) {
2817				$stuck = $(this).trigger("sticky_kit:detach");
2818				window.scrollTo(0, 0);
2819			}
2820		});
2821	});
2822
2823	var checkVideoResize = function(){
2824		clearRequestTimeout(checkResize);
2825		checkResize = requestTimeout(function(){
2826			if ( newW !== UNCODE.wwidth ) {
2827				newW = UNCODE.wwidth;
2828				checkForVideos();
2829			}
2830		}, 1000);
2831	};
2832
2833	$(window).off('resize', checkVideoResize)
2834	.on( 'resize', checkVideoResize);
2835
2836};
2837
2838$(document).on('uncode-ajax-filtered.videos', function(){
2839	UNCODE.okvideo("uncode-more-items-loaded");
2840});
2841UNCODE.backgroundSelfVideos = function( $ctx ) {
2842
2843	var backgroundSelfVideosInit = function( $ctx ) {
2844		if ( SiteParameters.block_mobile_videos === true ) {
2845			return false;
2846		}
2847		if (typeof MediaElement === "function") {
2848			if ( typeof $ctx === 'undefined' ) {
2849				$ctx = document;
2850			}
2851		
2852			$(".background-video-shortcode", $ctx).each(function(index, el) {
2853				if ( $(this).closest('mediaelementwrapper').length ) {
2854					return true;
2855				}
2856				var $video_el = $(this),
2857					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2858					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2859					video_id = $video_el.attr('id');
2860
2861				if ( SiteParameters.is_frontend_editor ) {
2862					video_id = video_id + '_' + index;
2863					$video_el.attr('id', video_id);
2864				}
2865
2866				var media = new MediaElement(video_id, {
2867					startVolume: 0,
2868					loop: true,
2869					success: function(mediaElement, domObject) {
2870						domObject.volume = 0;
2871						$(mediaElement).data('started', false);
2872						mediaElement.addEventListener('timeupdate', function(e) {
2873							if (!$(e.target).data('started')) {
2874								$(mediaElement).data('started', true);
2875							}
2876						});
2877						mediaElement.addEventListener('loadedmetadata', function(e) {
2878							$('body').removeClass('video-not-supported');
2879							mediaElement.play();
2880						});
2881						if (!UNCODE.isMobile) {
2882							requestTimeout(function() {
2883								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2884							}, 100);
2885						}
2886						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2887							mediaElement.play();
2888						}
2889
2890						if ( $parent_drop_move.length ) {
2891							var setResizeMEto,
2892								resizeMediaElement = function(){
2893								var dataW = $parent_drop_move.attr('data-w'),
2894									videoW = domObject.width,
2895									videoH = domObject.height,
2896									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2897									newH = newW / ( videoW / videoH );
2898
2899								$(domObject).css({
2900									'height': newH,
2901									'width': newW
2902								});
2903							};
2904							$(window).on( 'resize load', function(){
2905								clearRequestTimeout(setResizeMEto);
2906								setResizeMEto = requestTimeout( function() {
2907									resizeMediaElement();
2908								}, 10 );
2909							});
2910						}
2911
2912						mediaElement.addEventListener('play', function() {
2913							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2914							$(mediaElement).closest('#page-header').addClass('video-started');
2915							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2916						}, true);
2917
2918					},
2919					// fires when a problem is detected
2920					error: function() {}
2921				});
2922			});
2923		} else {
2924
2925			if ( typeof $ctx === 'undefined' ) {
2926				$ctx = document;
2927			}
2928		
2929			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2930			Array.from(videos).forEach(function(video_el) {
2931				video_el.addEventListener('loadedmetadata', function(e) {
2932					$('body').removeClass('video-not-supported');
2933					video_el.play();
2934				});
2935				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2936					video_el.muted = true;
2937					video_el.loop = true;
2938					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2939					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2940					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2941					$('body').removeClass('video-not-supported');
2942					video_el.play();
2943				} else {
2944					requestTimeout(function(){
2945                         backgroundSelfVideosInit( $ctx );
2946					}, 1000);
2947				}
2948			});
2949		}
2950	};
2951
2952	backgroundSelfVideosInit( $ctx );
2953
2954	$(document).on('un-menu-show', function(){
2955		setTimeout(function(){
2956			UNCODE.initVideoComponent(document.body, '.un-submenu .uncode-video-container.video:not(.drop-move):not(.fluid-object), .un-submenu .uncode-video-container.self-video:not(.drop-move)');
2957		}, 1);
2958	});
2959
2960
2961	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2962		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2963			var $el = model.view.$el,
2964				shortcode = model.attributes.shortcode;
2965
2966			if (typeof MediaElement === "function") {
2967				backgroundSelfVideosInit( $el );
2968			} else {
2969				backgroundSelfVideosInit( $el[0] );
2970			}
2971		});
2972	}
2973};
2974
2975UNCODE.is_scrolling = false;
2976
2977UNCODE.disableHoverScroll = function() {
2978
2979	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2980		var body = document.body,
2981		timer;
2982
2983		window.addEventListener('scroll', function() {
2984			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2985			clearRequestTimeout(timer);
2986			if ( body.classList && !body.classList.contains('disable-hover') ) {
2987				body.classList.add('disable-hover');
2988				window.dispatchEvent(new CustomEvent('disable-hover'));
2989			}
2990			UNCODE.is_scrolling = true;
2991
2992			timer = requestTimeout(function() {
2993				if ( body.classList ) {
2994					body.classList.remove('disable-hover');
2995					window.dispatchEvent(new CustomEvent('enable-hover'));
2996				}
2997				UNCODE.is_scrolling = false;
2998			}, delay);
2999		}, false);
3000	}
3001};
3002
3003UNCODE.isotopeLayout = function() {
3004	if ($('.isotope-layout').length > 0) {
3005		var isotopeContainersArray = [],
3006			typeGridArray = [],
3007			layoutGridArray = [],
3008			screenLgArray = [],
3009			screenMdArray = [],
3010			screenSmArray = [],
3011			transitionDuration = [],
3012			$filterItems = [],
3013			$filters = $('.isotope-system .isotope-filters'),
3014			$itemSelector = '.tmb-iso',
3015			$items,
3016			itemMargin,
3017			correctionFactor = 0,
3018			firstLoad = true,
3019			isOriginLeft = $('body').hasClass('rtl') ? false : true;
3020		$('[class*="isotope-container"]').each(function(index) {
3021			var _this = $(this);
3022			var isoData = _this.data(),
3023			$data_lg,
3024			$data_md,
3025			$data_sm;
3026			_this.children('.tmb').addClass('tmb-iso');
3027			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
3028			else $data_lg = '1000';
3029			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
3030			else $data_md = '600';
3031			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
3032			else $data_sm = '480';
3033			screenLgArray.push($data_lg);
3034			screenMdArray.push($data_md);
3035			screenSmArray.push($data_sm);
3036			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
3037			if (isoData.type == 'metro') typeGridArray.push(true);
3038			else typeGridArray.push(false);
3039			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
3040			else layoutGridArray.push('masonry');
3041			isotopeContainersArray.push(_this);
3042			_this.attr('data-iso-index', index);
3043		});
3044		var colWidth = function(index) {
3045				$(isotopeContainersArray[index]).width('');
3046				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
3047					widthAvailable = $(isotopeContainersArray[index]).width(),
3048					columnNum = 12,
3049					columnWidth = 0,
3050					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
3051					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
3052					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
3053					$rowContainer,
3054					paddingRow,
3055					$colContainer,
3056					paddingCol;
3057
3058				if ( consider_menu )
3059					winHeight = winHeight - UNCODE.menuHeight;
3060
3061				if ( data_vp_height === '1' ) {
3062					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
3063					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
3064					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
3065					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
3066					winHeight = winHeight - ( paddingRow + paddingCol );
3067				}
3068
3069				if (isPx) {
3070					columnWidth = Math.ceil(widthAvailable / columnNum);
3071					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
3072				} else {
3073					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
3074				}
3075				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
3076				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
3077				for (var i = 0, len = $items.length; i < len; i++) {
3078					var $item = $($items[i]),
3079						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
3080						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
3081						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
3082
3083
3084					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
3085						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
3086					}
3087
3088					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
3089						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
3090					}
3091
3092					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
3093						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3094							switch (parseInt(multiplier_w[1])) {
3095								case (5):
3096								case (4):
3097								case (3):
3098									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3099									multiplier_w[1] = 6;
3100									break;
3101								case (2):
3102								case (1):
3103									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
3104									multiplier_w[1] = 3;
3105									break;
3106								default:
3107									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3108									multiplier_w[1] = 12;
3109									break;
3110							}
3111
3112							if (multiplier_w[1] == 2.4) { // 5 columns
3113								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3114								multiplier_w[1] = 6;
3115							}
3116						}
3117					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
3118						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3119							switch (parseInt(multiplier_w[1])) {
3120								case (5):
3121								case (4):
3122								case (3):
3123								case (2):
3124								case (1):
3125									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3126									multiplier_w[1] = 6;
3127									break;
3128								default:
3129									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3130									multiplier_w[1] = 12;
3131									break;
3132							}
3133
3134							if (multiplier_w[1] == 2.4) { // 5 columns
3135								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
3136								multiplier_w[1] = 6;
3137							}
3138						}
3139					} else if (widthAvailable < screenSmArray[index]) {
3140						if (multiplier_w != null && multiplier_w[1] !== undefined) {
3141							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
3142							multiplier_w[1] = 12;
3143							if (typeGridArray[index]) multiplier_h[1] = 12;
3144						}
3145					}
3146					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
3147						height;
3148
3149					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
3150						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
3151						if ( widthAvailable < screenSmArray[index] ) {
3152							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
3153						}
3154					} else {
3155						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
3156					}
3157
3158					if (width >= widthAvailable) {
3159						$item.css({
3160							width: widthAvailable
3161						});
3162						if (typeGridArray[index]) {
3163							$item.children().add($item.find('.backimg')).css({
3164								height: height
3165							});
3166						}
3167					} else {
3168						$item.css({
3169							width: width
3170						});
3171						if (typeGridArray[index]) {
3172							$item.children().add($item.find('.backimg')).css({
3173								height: height
3174							});
3175						}
3176					}
3177				}
3178				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
3179					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
3180				} else {
3181					return columnWidth;
3182				}
3183			},
3184			init_isotope = function() {
3185				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
3186					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
3187						isotopeId = isotopeSystem.attr('id'),
3188						$layoutMode = layoutGridArray[i],
3189						setIsotopeFirstRowTimeOut,
3190					setIsotopeFirstRow = function(items){
3191						var firstRow = true;
3192						$(items).each(function(index, val){
3193							var el = items[index].element,
3194								el_top = items[index].position.y,
3195								$el = $(el);
3196							if ( index > 0 && el_top > 0 && firstRow ) {
3197								firstRow = false;
3198							} else if ( index == 0 && el_top == 0 ) {
3199								firstRow = true;
3200							}
3201							if ( firstRow ) {
3202								$el.removeClass('tmb-isotope-further-row');
3203							} else {
3204								$el.addClass('tmb-isotope-further-row');
3205							}
3206						});
3207					};
3208					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
3209						//resizable: true,
3210						itemSelector: $itemSelector,
3211						layoutMode: $layoutMode,
3212						transitionDuration: transitionDuration[i],
3213						masonry: {
3214							columnWidth: colWidth(i)
3215						},
3216						vertical: {
3217							horizontalAlignment: 0.5,
3218						},
3219						sortBy: 'original-order',
3220						isOriginLeft: isOriginLeft
3221					})
3222					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
3223					.on('layoutComplete', function( event, items ){
3224						if ( typeof items[0] !== 'undefined' ) {
3225							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3226								setIsotopeFirstRow(items);
3227							}
3228						}
3229					})
3230					.on('arrangeComplete', function( event, items ){
3231						if ( typeof items[0] !== 'undefined' ) {
3232							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
3233								clearRequestTimeout(setIsotopeFirstRowTimeOut);
3234								setIsotopeFirstRowTimeOut = requestTimeout(function(){
3235									setIsotopeFirstRow(items);
3236								}, 100);
3237							}
3238						}
3239					});
3240					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
3241						$(isotopeContainersArray[i]).infinitescroll({
3242								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
3243								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
3244								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
3245								animate: false,
3246								behavior: 'local',
3247								debug: false,
3248								loading: {
3249									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
3250									speed: 0,
3251									finished: undefined,
3252									msg: $('#' + isotopeId + ' .loadmore-button'),
3253								},
3254								errorCallback: function() {
3255									var isotope_system = $(this).closest('.isotope-system');
3256									$('.loading-button', isotope_system).hide();
3257									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
3258								}
3259							},
3260							// append the new items to isotope on the infinitescroll callback function.
3261							function(newElements, opts) {
3262								var $isotope = $(this),
3263									isotope_system = $isotope.closest('.isotope-system'),
3264									isotopeId = isotope_system.attr('id'),
3265									filters = new Array(),
3266									$loading_button = isotope_system.find('.loading-button'),
3267									$infinite_button = isotope_system.find('.loadmore-button'),
3268									$numPages = $('a', $infinite_button).data('pages'),
3269									$woo_results,
3270									delay = 300;
3271								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
3272								$infinite_button.show();
3273								$loading_button.hide();
3274								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
3275								$('> li', $isotope).remove();
3276								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
3277								$.each($(newElements), function (index, val) {
3278									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
3279										$woo_results = $(val);
3280										delete newElements[index];
3281									} else {
3282										$(val).addClass('tmb-iso');
3283										if ($(val).is("li")) {
3284											filters.push($(val)[0]);
3285										}
3286									}
3287									$(val).addClass('uncode-appended');
3288								});
3289								newElements = newElements.filter(function(x) {
3290									return filters.indexOf(x) < 0
3291								});
3292								$.each($(filters), function(index, val) {
3293									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
3294								});
3295								if ($woo_results && $woo_results.length > 0) {
3296									var old_count = isotope_system.find('.woocommerce-result-count').text();
3297									var new_count = $woo_results.find('.woocommerce-result-count').text();
3298									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
3299									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
3300									function replaceMatch(match, p1, p2) {
3301        								return old_start + '–' + new_end;
3302									}
3303									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
3304									isotope_system.find('.woocommerce-result-count').text(new_count_text);
3305								}
3306								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
3307								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3308									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
3309									if (typeof getLightbox === 'object') {
3310										getLightbox.refresh();
3311									} else {
3312										UNCODE.lightbox();
3313									}
3314								}
3315								if ( typeof twttr !== 'undefined' )
3316									twttr.widgets.load(isotopeContainersArray[i]);
3317
3318								requestTimeout(function() {
3319									Waypoint.refreshAll();
3320									$isotope.trigger('more-items-loaded');
3321									$(window).trigger('more-items-loaded');
3322									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3323									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3324										$(document).trigger('uncode-scrolltrigger-refresh');
3325									}
3326								}, 1000);
3327
3328							});
3329						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
3330							var $infinite_isotope = $(isotopeContainersArray[i]),
3331								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
3332							$infinite_isotope.infinitescroll('pause');
3333							$infinite_button.on('click', function(event) {
3334								event.preventDefault();
3335								var $infinite_system = $(event.target).closest('.isotope-system'),
3336								$infinite_isotope = $infinite_system.find('.isotope-container'),
3337								isotopeId = $infinite_system.attr('id');
3338								$(event.currentTarget).html(SiteParameters.loading);
3339								$infinite_isotope.infinitescroll('resume');
3340								$infinite_isotope.infinitescroll('retrieve');
3341								$infinite_isotope.infinitescroll('pause');
3342							});
3343						}
3344					}
3345				}
3346			},
3347			onLayout = function(isotopeObj, startIndex, needsReload) {
3348				var needsReload = needsReload ? true : false;
3349
3350				if (typeof UNCODE.bigText !== 'undefined') {
3351					UNCODE.bigText();
3352				}
3353				isotopeObj.css('opacity', 1);
3354				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
3355
3356				requestTimeout(function() {
3357					if (startIndex > 0) {
3358						reloadIsotope(isotopeObj);
3359						if (SiteParameters.dynamic_srcset_active === '1') {
3360							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3361							UNCODE.adaptive_srcset(isotopeObj);
3362						}
3363						// window.dispatchEvent(UNCODE.boxEvent);
3364					} else if (needsReload) {
3365						reloadIsotope(isotopeObj);
3366					}
3367
3368					UNCODE.adaptive();
3369					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
3370						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
3371					}
3372					if (typeof MediaElement === "function") {
3373						$(isotopeObj).find('audio,video').each(function() {
3374							$(this).mediaelementplayer({
3375	 							pauseOtherPlayers: false,
3376							});
3377						});
3378					}
3379					if ($(isotopeObj).find('.nested-carousel').length) {
3380						if (typeof UNCODE.carousel !== 'undefined') {
3381							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
3382						}
3383						requestTimeout(function() {
3384							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3385						}, 200);
3386					} else {
3387						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
3388					}
3389					isotopeObj.trigger('isotope-layout-complete');
3390
3391				}, 100);
3392
3393			},
3394			boxAnimation = function(items, startIndex, sequential, container) {
3395				var $allItems = items.length - startIndex,
3396					showed = 0,
3397					index = 0;
3398				if (container.closest('.owl-item').length == 1) return false;
3399				$.each(items, function(index, val) {
3400					var $this = $(val),
3401						elInner = $('> .t-inside', val);
3402					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3403						return;
3404					}
3405					if (val[0]) val = val[0];
3406					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
3407						new Waypoint({
3408							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3409							element: val,
3410							handler: function() {
3411								var element = $('> .t-inside', this.element),
3412									parent = $(this.element),
3413									currentIndex = parent.index();
3414								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
3415									delayAttr = parseInt(element.attr('data-delay'));
3416								if (isNaN(delayAttr)) delayAttr = 100;
3417								delay -= showed;
3418								var objTimeout = requestTimeout(function() {
3419									element.removeClass('zoom-reverse').addClass('start_animation');
3420									showed = parent.index();
3421									if ( container.data('isotope') ) {
3422										container.isotope('layout');
3423									}
3424								}, delay * delayAttr)
3425								parent.data('objTimeout', objTimeout);
3426								if (!UNCODE.isUnmodalOpen) {
3427									this.destroy();
3428								}
3429							},
3430							offset: '100%'
3431						})
3432					} else {
3433						if (elInner.hasClass('force-anim')) {
3434							elInner.addClass('start_animation');
3435						} else {
3436							elInner.css('opacity', 1);
3437						}
3438						container.isotope('layout');
3439					}
3440
3441					index++;
3442				});
3443			},
3444			reloadIsotope = function(isotopeObj) {
3445				var isoIndex = $(isotopeObj).attr('data-iso-index');
3446				var $layoutMode = ($(isotopeObj).data('layout'));
3447				if ($layoutMode === undefined) {
3448					$layoutMode = 'masonry';
3449				}
3450				if (isotopeObj.data('isotope')) {
3451					isotopeObj.isotope({
3452						itemSelector: $itemSelector,
3453						layoutMode: $layoutMode,
3454						transitionDuration: transitionDuration[isoIndex],
3455						masonry: {
3456							columnWidth: colWidth(isoIndex)
3457						},
3458						vertical: {
3459							horizontalAlignment: 0.5,
3460						},
3461						sortBy: 'original-order',
3462						isOriginLeft: isOriginLeft
3463					});
3464				}
3465			}
3466			;
3467		if ($('.isotope-pagination').length > 0) {
3468			$('.isotope-system').on('click', '.pagination a', function(evt) {
3469				evt.preventDefault();
3470
3471				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3472					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3473						container = $(this).closest('.isotope-system'),
3474						pagination_disable_scroll = container.attr('data-pagination-scroll'),
3475						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3476					calc_scroll -= UNCODE.get_scroll_offset();
3477
3478					if ( pagination_disable_scroll !== 'disabled' ) {
3479						var menu_container = $('.menu-sticky');
3480						var menu = menu_container.find('.menu-container');
3481
3482						if (menu_container.length > 0 && menu.length > 0) {
3483							calc_scroll = calc_scroll - menu.outerHeight();
3484						}
3485
3486						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3487							delta = bodyTop - calc_scroll,
3488							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3489						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3490
3491						if (!UNCODE.isFullPage) {
3492							if (scrollSpeed == 0) {
3493								$('html, body').scrollTop(calc_scroll);
3494							} else {
3495								$('html, body').animate({
3496									scrollTop: calc_scroll
3497								}, {
3498									easing: 'easeInOutQuad',
3499									duration: scrollSpeed,
3500									complete: function () {
3501										UNCODE.scrolling = false;
3502									}
3503								});
3504							}
3505						}
3506					}
3507				}
3508
3509				loadIsotope($(this), true);
3510			});
3511		}
3512		$filters.on('click', 'a.isotope-nav-link', function(evt) {
3513			if ($(this).hasClass('no-isotope-filter')) {
3514				return;
3515			}
3516			var $filter = $(this),
3517				filterContainer = $filter.closest('.isotope-filters'),
3518				filterValue = $filter.attr('data-filter'),
3519				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
3520				transitionDuration = container.data().isotope.options.transitionDuration,
3521				delay = 300,
3522				filterItems = [];
3523
3524			var filter_items = function(){
3525				if (filterValue !== undefined) {
3526					container.addClass('grid-filtering');
3527					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3528						var parent = $(val).parent(),
3529							objTimeout = parent.data('objTimeout');
3530						if (objTimeout) {
3531							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3532							clearRequestTimeout(objTimeout);
3533						}
3534						if (transitionDuration == 0) {
3535							if ($(val).hasClass('animate_when_almost_visible')) {
3536								$(val).addClass('zoom-reverse').removeClass('start_animation');
3537							} else {
3538								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3539							}
3540						}
3541					});
3542					requestTimeout(function(){
3543						if ( filterValue == '*' ) {
3544							container.removeClass('isotope-filtered');
3545						} else {
3546							container.addClass('isotope-filtered');
3547						}
3548						container.isotope({
3549							filter: function() {
3550								var block = $(this),
3551								filterable = (filterValue == '*') || block.hasClass(filterValue),
3552								lightboxElements = $('[data-lbox^=ilightbox]', block);
3553								if (filterable) {
3554									if (lightboxElements.length) {
3555										lightboxElements.removeClass('lb-disabled');
3556										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3557									}
3558									filterItems.push(block);
3559								} else {
3560									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3561								}
3562								container.trigger('more-items-loaded');
3563								$(window).trigger('more-items-loaded');
3564								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3565								return filterable;
3566							}
3567						});
3568						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3569
3570					}, delay);
3571
3572					/** once filtered - start **/
3573					container.isotope('once', 'arrangeComplete', function() {
3574						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3575							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3576							if (typeof getLightbox === 'object') {
3577								getLightbox.refresh();
3578							} else {
3579								UNCODE.lightbox();
3580							}
3581						}
3582						if (transitionDuration == 0) {
3583							requestTimeout(function() {
3584								boxAnimation(filterItems, 0, false, container);
3585							}, 100);
3586						}
3587						requestTimeout(function() {
3588							Waypoint.refreshAll();
3589							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3590								$(document).trigger('uncode-scrolltrigger-refresh');
3591							}
3592							container.removeClass('grid-filtering');
3593						}, 2000);
3594					});
3595					/** once filtered - end **/
3596				} else {
3597					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3598						$.each(UNCODE.lightboxArray, function(index, val) {
3599							UNCODE.lightboxArray[index].destroy();
3600						});
3601					}
3602					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3603						var parent = $(val).parent(),
3604							objTimeout = parent.data('objTimeout');
3605						if (objTimeout) {
3606							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3607							clearRequestTimeout(objTimeout);
3608						}
3609						if (transitionDuration == 0) {
3610							if ($(val).hasClass('animate_when_almost_visible')) {
3611								$(val).addClass('zoom-reverse').removeClass('start_animation');
3612							} else {
3613								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3614							}
3615						}
3616					});
3617					container.parent().addClass('grid-loading');
3618					loadIsotope($filter);
3619				}
3620			};
3621
3622			if (!$filter.hasClass('active')) {
3623				/** Scroll top with filtering */
3624				if (filterContainer.hasClass('filter-scroll')) {
3625                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3626                    calc_scroll -= UNCODE.get_scroll_offset();
3627
3628					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3629						delta = bodyTop - calc_scroll,
3630						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3631						filterTolerance = false,
3632						filter_timeout;
3633					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3634
3635					if ( !UNCODE.isFullPage ) {
3636						if (scrollSpeed == 0) {
3637							$('html, body').scrollTop(calc_scroll);
3638							UNCODE.scrolling = false;
3639							filter_items();
3640						} else {
3641
3642							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3643								filter_items();
3644								filterTolerance = true;
3645							}
3646
3647							$('html, body').animate({
3648								scrollTop: calc_scroll
3649							},{
3650								easing: 'easeInOutQuad',
3651								duration: scrollSpeed,
3652								complete: function(){
3653									UNCODE.scrolling = false;
3654									if ( !filterTolerance ) {
3655										filter_timeout = setTimeout(function(){
3656											clearTimeout(filter_timeout);
3657											filter_items();
3658										}, 200);
3659									}
3660								}
3661							});
3662						}
3663					}
3664				} else {
3665					filter_items();
3666				}
3667			}
3668			evt.preventDefault();
3669		});
3670
3671		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3672			var params = UNCODE.getURLParams(window.location);
3673			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3674
3675			UNCODE.lastURL = window.location.href;
3676
3677			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
3678				return;
3679			}
3680
3681			if (params.id === undefined) {
3682				$.each($('.isotope-system'), function(index, val) {
3683					loadIsotope($(val));
3684				});
3685			} else {
3686				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3687					loadIsotope($('#' + params.id));
3688				}
3689			}
3690		});
3691
3692		var loadIsotope = function($href, $paginating) {
3693			var is_paginating = false;
3694
3695			if (undefined !== $paginating && $paginating) {
3696				var is_paginating = $paginating;
3697			}
3698
3699			var href = ($href.is("a") ? $href.attr('href') : location),
3700				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3701				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3702				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3703				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3704				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3705				isotopeId = isotopeSystem.attr('id');
3706			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3707				UNCODE.lastURL = href;
3708				history.pushState({
3709					myIsotope: true
3710				}, document.title, href);
3711			}
3712			if (is_paginating) {
3713				isotopeWrapper.addClass('grid-filtering');
3714			}
3715			$.ajax({
3716				url: href
3717			}).done(function(data) {
3718				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3719					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3720					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3721				isotopeWrapper.addClass('isotope-reloaded');
3722				requestTimeout(function() {
3723					isotopeWrapper.removeClass('grid-loading');
3724					isotopeWrapper.removeClass('isotope-reloaded');
3725					isotopeWrapper.removeClass('grid-filtering');
3726				}, 500);
3727				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3728					var parent = $(val).parent(),
3729						objTimeout = parent.data('objTimeout');
3730					if (objTimeout) {
3731						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3732						clearRequestTimeout(objTimeout);
3733					}
3734					if ($(val).hasClass('animate_when_almost_visible')) {
3735						$(val).addClass('zoom-reverse').removeClass('start_animation');
3736					} else {
3737						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3738					}
3739				});
3740				requestTimeout(function() {
3741					if (isotopeContainer.data('isotope')) {
3742						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3743						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3744						UNCODE.adaptive();
3745						if (SiteParameters.dynamic_srcset_active === '1') {
3746							UNCODE.adaptive_srcset(isotopeContainer);
3747						}
3748						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3749							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3750							if (typeof getLightbox === 'object') {
3751								getLightbox.refresh();
3752							} else {
3753								UNCODE.lightbox();
3754							}
3755						}
3756					}
3757					isotopeContainer.trigger('more-items-loaded');
3758					$(window).trigger('more-items-loaded');
3759					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3760				}, 300);
3761				$('.pagination', isotopeFooter).remove();
3762				isotopeFooter.append($resultPagination);
3763
3764				if (isotopeResultCount.length > 0) {
3765					$('.woocommerce-result-count', isotopeResultCount).remove();
3766					isotopeResultCount.append($resultCount);
3767				}
3768			});
3769		};
3770		$filters.each(function(i, buttonGroup) {
3771			var $buttonGroup = $(buttonGroup);
3772			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3773				$buttonGroup.find('.active').removeClass('active');
3774				$(this).addClass('active');
3775
3776			});
3777
3778			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3779				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3780				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3781			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3782				e.preventDefault();
3783				$cats_filters.slideToggle(400, 'easeInOutCirc');
3784			});
3785
3786		});
3787		window.addEventListener('boxResized', function(e) {
3788			if (UNCODE.printDialogOpen !== false) {
3789				return false;
3790			}
3791			$.each($('.isotope-layout'), function(index, val) {
3792				var $layoutMode = ($(this).data('layout'));
3793				if ($layoutMode === undefined) $layoutMode = 'masonry';
3794				if ($(this).data('isotope')) {
3795					$(this).isotope({
3796						itemSelector: $itemSelector,
3797						layoutMode: $layoutMode,
3798						transitionDuration: transitionDuration[index],
3799						masonry: {
3800							columnWidth: colWidth(index)
3801						},
3802						vertical: {
3803							horizontalAlignment: 0.5,
3804						},
3805						sortBy: 'original-order',
3806						isOriginLeft: isOriginLeft
3807					});
3808					$(this).isotope('unbindResize');
3809					if (SiteParameters.dynamic_srcset_active === '1') {
3810						UNCODE.refresh_dynamic_srcset_size($(this));
3811					}
3812				}
3813				$(this).find('.mejs-video,.mejs-audio').each(function() {
3814					$(this).trigger('resize');
3815				});
3816			});
3817		}, false);
3818
3819		init_isotope();
3820	};
3821}
3822
3823UNCODE.lightbox = function() {
3824	if ( SiteParameters.lbox_enhanced ) {
3825		return true;
3826	}
3827	UNCODE.lightboxArray = {};
3828	requestTimeout(function() {
3829		var groupsArr = {};
3830		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3831			var group = this.getAttribute("data-lbox"),
3832				values = $(this).data();
3833			$(this).attr('data-lbox-init','true')
3834			groupsArr[group] = values;
3835		});
3836		for (var i in groupsArr) {
3837			var skin = groupsArr[i].skin || 'black',
3838				path = groupsArr[i].dir || 'horizontal',
3839				thumbs = !groupsArr[i].notmb || false,
3840				arrows = !groupsArr[i].noarr || false,
3841				social = groupsArr[i].social || false,
3842				deeplink = groupsArr[i].deep || false,
3843				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3844				counter = $els.length,
3845				dataAlbum = $els.attr('data-album');
3846			if (social) social = {
3847				facebook: true,
3848				twitter: true,
3849				reddit: true,
3850				digg: true
3851			};
3852			UNCODE.lightboxArray[i] = $els.iLightBox({
3853				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3854				skin: skin,
3855				path: path,
3856				linkId: deeplink,
3857				infinite: false,
3858				//fullViewPort: 'fit',
3859				smartRecognition: false,
3860				fullAlone: true,
3861				maxScale: 1,
3862				minScale: .02,
3863				//fullStretchTypes: 'flash, video',
3864				overlay: {
3865					opacity: .94
3866				},
3867				controls: {
3868					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3869					fullscreen: true,
3870					thumbnail: thumbs,
3871					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3872				},
3873				show: {
3874					speed: 200
3875				},
3876				hide: {
3877					speed: 200
3878				},
3879				social: {
3880					start: false,
3881					buttons: social
3882				},
3883				caption: {
3884					start: false
3885				},
3886				styles: {
3887					nextOpacity: 1,
3888					nextScale: 1,
3889					prevOpacity: 1,
3890					prevScale: 1
3891				},
3892				effects: {
3893					switchSpeed: 400
3894				},
3895				slideshow: {
3896					pauseTime: 5000
3897				},
3898				thumbnails: {
3899					maxWidth: 60,
3900					maxHeight: 60,
3901					activeOpacity: .2
3902				},
3903				html5video: {
3904					preload: true
3905				},
3906				callback: {
3907					onOpen: function(){
3908						$(window).trigger('uncode-custom-cursor');
3909						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3910							iNoBounce.enable();
3911						}
3912					},
3913					onHide: function(){
3914						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3915							iNoBounce.disable()
3916						}
3917					},
3918				}
3919			});
3920
3921			$(document).on('infinite-loaded', function(){
3922				UNCODE.lightboxArray[i].refresh();
3923			});
3924
3925			$(window).on('gdprOpen', function(){
3926				UNCODE.lightboxArray[i].close();
3927			});
3928		};
3929	}, 100);
3930
3931	$(document).on('click', '.lb-disabled', function(e){
3932		e.preventDefault();
3933	});
3934};
3935
3936UNCODE.lightgallery = function( $el ) {
3937	var createSelectors = function(){
3938		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
3939			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3940				$(this).addClass('lbox-trigger-item');
3941			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3942				$(this).addClass('lbox-nested-item');
3943			} else {
3944				$(this).removeClass('lbox-trigger-item');
3945				$(this).removeClass('lbox-nested-item');
3946			}
3947		});
3948	};
3949
3950	createSelectors();
3951
3952	var galleries = [],
3953		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3954			return !$(this).closest('.nested-carousel').length;
3955		}),
3956		$_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 *'), 
3957		$galleries = $_galleries.filter(function( index ) {
3958			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3959		}),
3960		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3961
3962	if ( typeof $el === 'undefined' ) {
3963		$el = $galleries.add( $nested );
3964	}
3965
3966	var $disabled = $('a.lb-disabled');
3967	$disabled.on('click', function(e){
3968		e.preventDefault();
3969	});
3970
3971	var beforeSlide = function(event) {
3972		var detail = event.detail,
3973			info = detail.info,
3974			item = detail.item,
3975			$slide = $(detail.currentSlide.selector),
3976			$video = $('video', $slide),
3977			$previous = $(detail.previousSlide.selector),
3978			$prevVideo = $('video', $previous),
3979			isAudio = false;
3980
3981		if ( typeof info.src !== 'undefined' ) {
3982			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3983		}
3984
3985		if ( ! $video.length && ( info.video || isAudio ) ) {
3986			if ( info.video ) {
3987				if ( typeof info.video === 'object' ) {
3988					var infoJson = info.video;
3989				} else {
3990					var infoJson = JSON.parse(info.video);
3991				}
3992				var src = infoJson.source[0].src,
3993					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3994					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3995					loop = $(item).attr('data-loop');
3996
3997			} else if ( isAudio ) {
3998				var src = info.src,
3999					autoplay = true,
4000					loop = false;
4001			}
4002			if ( typeof src !== 'undefined' ) {
4003				$slide.addClass('has-html5');
4004				var video = document.createElement('video');
4005				video.src = src;
4006				video.preload = 'auto';
4007				video.controls = 'controls';
4008				video.controlsList = 'nodownload';
4009				if ( autoplay ) {
4010					video.autoplay = 'autoplay';
4011				}
4012				if ( muted ) {
4013					video.muted = 'muted';
4014				}
4015				if ( loop ) {
4016					video.loop = 'loop';
4017				}
4018				$(video).appendTo($slide);
4019			}
4020		} else {
4021			var $video = $('video', $slide);
4022			if ( $video.length ) {
4023				$video[0].currentTime = 0;
4024				if ( $video[0].autoplay ) {
4025					$video[0].play();
4026				}
4027			}
4028		}
4029		if ( $prevVideo.length ) {
4030			$prevVideo[0].currentTime = 0;
4031			$prevVideo[0].pause();
4032		}
4033	};
4034
4035	var beforeOpen = function(event) {
4036		var detail = event.detail,
4037			items = detail.items,
4038			galleryItems = detail.galleryItems,
4039			outer = detail.outer.selector,
4040			i, ii;
4041		for ( i = 0; i < galleryItems.length; i++ ) {
4042			var item = galleryItems[i];
4043			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
4044				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
4045			}
4046		}
4047		for ( ii = 0; ii < items.length; ii++ ) {
4048			var item = items[ii];
4049			if ( $(item).attr('data-icon') === 'video' ) {
4050				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
4051			}
4052		}
4053
4054	};
4055
4056	//caption builder
4057	var captionBuilder = function($el){
4058		$el.each( function( index, val ) {
4059			var $gallery = $(this).attr('data-lbox-init','true'),
4060				$_a = '.lbox-trigger-item',
4061				$_nested_a = '.lbox-nested-item';
4062
4063			$gallery.find($_a).add($_nested_a).each(function(){
4064				var $a = $(this),
4065					$img = $('img', $a).first(),
4066					imgw = $img.attr('data-width'),
4067					imgh = $img.attr('data-height'),
4068					caption = $a.attr('data-caption'),
4069					title = $a.attr('data-title');
4070
4071				if ( $img.length && $img.attr('data-crop') != true ) {
4072					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
4073						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
4074					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
4075						$a.attr('data-external-thumb-image', $img[0].src);
4076					}
4077				}
4078
4079				if ( typeof title !== 'undefined' && title !== '' ) {
4080					title = '<h6>' + title + '</h6>';
4081				} else {
4082					title = '';
4083				}
4084
4085				if ( typeof caption !== 'undefined' && caption !== '' ) {
4086					caption = '<p>' + caption + '</p>';
4087					title += caption;
4088				}
4089
4090				if ( title !== '' ) {
4091					$a.attr( 'title', title );
4092				}
4093
4094				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') ) ) {
4095					$a.attr('data-lg-size', imgw + '-' + imgh);
4096				}
4097			});
4098		});
4099	};
4100	captionBuilder($el);
4101
4102	//regular galleries
4103	$el.each( function( index, val ) {
4104		var $gallery = $(this),
4105			$_a = '.lbox-trigger-item',
4106			$_nested_a = '.lbox-nested-item',
4107			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
4108			galleryID = $_first.attr('data-lbox'),
4109			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
4110			tmb = $_first.attr('data-notmb'),
4111			social = $_first.attr('data-social'),
4112			deep = $_first.attr('data-deep'),
4113			zoom = $_first.attr('data-zoom-origin'),
4114			actual = $_first.attr('data-actual-size'),
4115			download = $_first.attr('data-download'),
4116			controls = $_first.attr('data-arrows') !== 'no',
4117			fullScreen = $_first.attr('data-full'),
4118			counter = $_first.attr('data-counter'),
4119			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
4120			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4121			connect = $_first.attr('data-connect'),
4122			lgPlugins = [lgVideo],
4123			itemsLoadedTimeOut;
4124
4125		if ( typeof galleryID === 'undefined' ) {
4126			galleryID = $gallery.attr('id');
4127		}
4128
4129		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4130		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4131
4132		if ( typeof tmb == 'undefined' || !tmb ) {
4133			lgPlugins.push(lgThumbnail);
4134		}
4135		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
4136			lgPlugins.push(lgZoom);
4137		}
4138		if ( typeof deep != 'undefined' && deep != '' ) {
4139			lgPlugins.push(lgHash);
4140		}
4141		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4142			lgPlugins.push(lgFullscreen);
4143		}
4144		if ( social ) {
4145			lgPlugins.push(lgShare);
4146		}
4147
4148		if ( galleries.indexOf( galleryID ) !== -1 ) {
4149			return true;
4150		}
4151
4152		galleries.push( galleryID );
4153		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
4154			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
4155		var gallery = lightGallery( $triggerGal[0], {
4156			addClass: containerClass,
4157			plugins: lgPlugins,
4158			mode: transition,
4159			selector: $selector,
4160			galleryId: galleryID,
4161			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4162			iframeWidth: '848px',
4163			iframeMaxWidth: '90%',
4164			iframeMaxHeight: '90%',
4165			exThumbImage: 'data-external-thumb-image',
4166			loadYouTubeThumbnail: false,
4167			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ),
4168			// autoplayFirstVideo: false,
4169			pager: false,
4170			startClass: 'lg-start-opacity',
4171			zoomFromOrigin: zoom,
4172			controls: controls,
4173			download: ( typeof download != 'undefined' && download != '' ),
4174			thumbWidth: 50,
4175			thumbHeight: '50px',
4176			counter: $triggerGal.find($selector).length > 1 ? counter : false,
4177			loadYouTubePoster: false,
4178			enableDrag: $triggerGal.find($selector).length > 1,
4179			mobileSettings: {
4180				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4181			},
4182		});
4183
4184		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
4185			e.preventDefault();
4186			var index = $(this).closest('.owl-item.cloned').attr('data-index');
4187			gallery.openGallery(index-1);
4188		});
4189
4190		$gallery.on('uncode-gallery-trigger', function(){
4191			gallery.openGallery(0);
4192		});
4193
4194		$triggerGal.on('more-items-loaded', function(e, items) {
4195			clearRequestTimeout(itemsLoadedTimeOut);
4196			itemsLoadedTimeOut = requestTimeout(function(){
4197				createSelectors();
4198				captionBuilder($triggerGal);
4199				gallery.refresh();
4200			}, 100);
4201		});
4202
4203		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4204			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4205				$el = model.view.$el;
4206				if ( $el.find($triggerGal).length ) {
4207					gallery.destroy();
4208				}
4209			});
4210		}
4211
4212		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
4213		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
4214		$triggerGal[0].addEventListener('lgAfterOpen', function(){
4215			$(window).trigger('uncode-custom-cursor');
4216		});
4217
4218	});
4219
4220	if ( typeof $el !== 'undefined' ) {
4221
4222		//album galleries
4223		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
4224			var album = val,
4225				galleryID = index,
4226				$album = $(album),
4227				params = $album.attr('data-album'),
4228				tmb = $(val).attr('data-notmb'),
4229				social = $(val).attr('data-social'),
4230				deep = $(val).attr('data-deep'),
4231				actual = $(val).attr('data-actual-size'),
4232				download = $(val).attr('data-download'),
4233				controls = $(val).attr('data-arrows') !== 'no',
4234				fullScreen = $(val).attr('data-full'),
4235				counter = $(val).attr('data-counter'),
4236				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
4237				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
4238				lgPlugins = [lgVideo];
4239
4240			$(val).attr('data-lbox-init','true');
4241
4242			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
4243			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
4244
4245			if ( typeof tmb == 'undefined' || !tmb ) {
4246				lgPlugins.push(lgThumbnail);
4247			}
4248			if ( typeof actual != 'undefined' && actual != '' ) {
4249				lgPlugins.push(lgZoom);
4250			}
4251			if ( typeof deep != 'undefined' && deep != '' ) {
4252				lgPlugins.push(lgHash);
4253			}
4254			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
4255				lgPlugins.push(lgFullscreen);
4256			}
4257			if ( social ) {
4258				lgPlugins.push(lgShare);
4259			}
4260
4261			var gallery = window.lightGallery(album, {
4262				dynamic: true,
4263				plugins: lgPlugins,
4264				dynamicEl: JSON.parse(params),
4265				galleryId: galleryID,
4266				addClass: containerClass,
4267				mode: transition,
4268				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
4269				iframeWidth: '848px',
4270				iframeMaxWidth: '90%',
4271				iframeMaxHeight: '90%',
4272				loadYouTubeThumbnail: false,
4273				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
4274				// autoplayFirstVideo: false,
4275				pager: false,
4276				startClass: 'lg-start-opacity',
4277				zoomFromOrigin: false,
4278				controls: controls,
4279				download: ( typeof download != 'undefined' && download != '' ),
4280				thumbWidth: 50,
4281				thumbHeight: '50px',
4282				loadYouTubePoster: false,
4283				counter: counter,
4284				exThumbImage: 'data-external-thumb-image',
4285				loadYouTubePoster: false,
4286				mobileSettings: {
4287					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
4288				},
4289			});
4290
4291			$album.on('click', function(){
4292				gallery.openGallery(0);
4293			});
4294
4295			album.addEventListener('lgBeforeSlide', beforeSlide);
4296			album.addEventListener('lgBeforeOpen', beforeOpen);
4297			album.addEventListener('lgAfterOpen', function(){
4298				$(window).trigger('uncode-custom-cursor');
4299			});
4300
4301			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4302				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
4303					$el = model.view.$el;
4304					if ( $el.find($album).length ) {
4305						gallery.destroy();
4306					}
4307				});
4308			}
4309
4310		});
4311
4312		//single images
4313		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
4314			var gallery = lightGallery( $('.page-wrapper')[0], {
4315				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
4316				iframeWidth: '848px',
4317				iframeMaxWidth: '90%',
4318				iframeMaxHeight: '90%',
4319				loadYouTubeThumbnail: false,
4320				// autoplayFirstVideo: false,
4321				startClass: 'lg-start-opacity',
4322				thumbWidth: 50,
4323				thumbHeight: '50px',
4324				download: false,
4325				loadYouTubePoster: false,
4326				counter: false
4327			});
4328
4329			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
4330			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
4331		});
4332	}
4333
4334	var galleryButtons = function(){
4335		var $buttons = $('.btn-gallery-trigger');
4336		$buttons.each(function(key, val){
4337			var $button = $(val),
4338				target = $button.attr('data-target'),
4339				$gallery = $('.un-media-gallery').first(),
4340				$row = $button.closest('.vc_row[data-parent]');
4341			if ( typeof target !== 'undefined' && target !== '' && $('.un-media-gallery#' + target).length  ) {
4342				$gallery = $('.un-media-gallery#' + target);
4343			} else if ( $('.un-media-gallery', $row).length ) {
4344				$gallery = $('.un-media-gallery', $row).first();
4345			}
4346			
4347			$button.on('click', 'a', function(e){
4348				e.preventDefault();
4349				$gallery.find('[data-lbox-init]').first().trigger('uncode-gallery-trigger');
4350			});
4351		});
4352	};
4353	galleryButtons();
4354};
4355
4356UNCODE.carousel = function(container) {
4357	var $owlContainers = $('.owl-carousel-container:not(.test-init)', container);
4358	$owlContainers.each(function() {
4359		var $owlContainer = $(this).addClass('test-init'),
4360			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
4361			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
4362			values = {},
4363			tempTimeStamp,
4364			newWidth = UNCODE.wwidth,
4365			$owlInsideEqual = [];
4366		$owlSelector.each(function() {
4367			var itemID = $(this).attr('id'),
4368				$elSelector = $(('#' + itemID).toString());
4369			values['id'] = itemID;
4370			values['items'] = 1;
4371			values['columns'] = 3;
4372			values['fade'] = false;
4373			values['nav'] = false;
4374			values['navmobile'] = false;
4375			values['navskin'] = 'light';
4376			values['navspeed'] = 400;
4377			values['dots'] = false;
4378			values['dotsmobile'] = false;
4379			values['loop'] = false;
4380			values['autoplay'] = false;
4381			values['timeout'] = 3000;
4382			values['autoheight'] = false;
4383			values['stagepadding'] = 0;
4384			values['margin'] = 0;
4385			values['lg'] = 1;
4386			values['md'] = 1;
4387			values['sm'] = 1;
4388			$.each($(this).data(), function(i, v) {
4389				values[i] = v;
4390			});
4391
4392			if ($(this).closest('.uncode-slider').length) {
4393				values['navskin'] = '';
4394				values['navmobile'] = false;
4395				//values['dotsmobile'] = true;
4396			} else {
4397				values['navskin'] = ' style-'+values['navskin']+' style-override';
4398			}
4399
4400			var setIndexActive = function(event, init){
4401				var init = typeof init === 'undefined' ? false : init,
4402					thiis = $(event.currentTarget);
4403				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
4404					var scrolltop = $(document).scrollTop(),
4405						size = event.page.size,
4406						i;
4407					var setIndex = requestTimeout(function() {
4408						for ( i = 0; i < size; i++ ) {
4409							var itemCont = event.item.index != null ? (event.item.index + i) : i;
4410							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
4411							if (thiis.closest('.row-slider').length) {
4412								if (currentItem == undefined) {
4413									currentItem = thiis.children()[i];
4414								}
4415								if ($(currentItem).closest('#page-header').length) {
4416									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4417										UNCODE.switchColorsMenu(scrolltop, 'dark');
4418									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4419										UNCODE.switchColorsMenu(scrolltop, 'light');
4420									}
4421								}
4422								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
4423								if (owlCustomNav.length) {
4424									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4425										owlCustomNav.addClass('style-dark').removeClass('style-light');
4426									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4427										owlCustomNav.addClass('style-light').removeClass('style-dark');
4428									}
4429								}
4430							}
4431							var itendIndex = $(currentItem).attr('data-index');
4432							if ( isNaN(itendIndex) ) {
4433								itendIndex = 1;
4434							}
4435							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
4436							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
4437							if ($.fn.counterUp) {
4438								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
4439									var $counter = $(this);
4440									$counter.addClass('started').counterUp({
4441										delay: 10,
4442										time: 1500
4443									});
4444								});
4445							}
4446						}
4447						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
4448					}, 200);
4449				}
4450				tempTimeStamp = event.timeStamp;
4451			}
4452
4453			/** Initialize */
4454			$elSelector.on('initialize.owl.carousel', function(event) {
4455				if (typeof UNCODE.owlNav !== 'undefined') {
4456					UNCODE.owlNav(itemID, event);
4457				}
4458
4459				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4460					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
4461						var shortcode = model.attributes.shortcode,
4462							$el = model.view.$el,
4463							$row_wrap = $el.closest('.row');
4464						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4465							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
4466						}
4467					});
4468					window.parent.vc.events.on('shortcodeView:updated', function(model) {
4469						var shortcode = model.attributes.shortcode;
4470						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4471							tempTimeStamp = Math.floor(Date.now() / 1000);
4472						}
4473					});
4474					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
4475						var shortcode = model.attributes.shortcode;
4476						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4477							UNCODE.owlNav(itemID, event);
4478							$elSelector.trigger('refresh.owl.carousel');
4479						}
4480					});
4481				}
4482				// if ( $elSelector.closest('.mega-menu-inner').length ) {
4483				// 	$elSelector.closest('.mega-menu-inner').css({
4484				// 		visibility: 'hidden',
4485				// 		display: 'block'
4486				// 	});
4487				// 	$elSelector.data('owl.carousel');
4488				// 	$elSelector.trigger('refresh.owl.carousel');
4489				// 	$elSelector.closest('.mega-menu-inner').css({
4490				// 		display: 'none',
4491				// 		visibility: '',
4492				// 	});
4493				// }
4494				// $elSelector.closest('[class*="menu-smart"]').on('show.smapi', function(e, p){
4495				// 	$elSelector.trigger("to.owl.carousel", 0);
4496				// });
4497			});
4498
4499			/** Initialized */
4500			$elSelector.on('initialized.owl.navigation', function(event) {
4501				$('.owl-dot', event.currentTarget).each(function(key, val){
4502					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4503				});
4504			});
4505
4506			$elSelector.on('initialized.owl.carousel', function(event) {
4507
4508				if ( $('.isotope-container', event.currentTarget).length ) {
4509					window.dispatchEvent(UNCODE.boxEvent);
4510				}
4511
4512				$('.owl-dot.active', $elSelector).on('click', function(){
4513					return false;
4514				});
4515
4516				var thiis = $(event.currentTarget),
4517					// get the time from the data method
4518					time = thiis.data("timer-id"),
4519					rowParent = thiis.closest('.row-parent');
4520
4521				if ( typeof rowParent[0] !== 'undefined' ) {
4522					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4523				}
4524
4525				if (time) {
4526					clearRequestTimeout(time);
4527				}
4528
4529				thiis.addClass('showControls');
4530				var new_time = requestTimeout(function() {
4531					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4532					if (thiis.hasClass('owl-height-viewport'))
4533						setItemsRelHeight(thiis);
4534					if (thiis.hasClass('owl-height-equal'))
4535						setItemsHeight(thiis);
4536					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4537					if (thiis.closest('.unequal, .unexpand').length) {
4538						UNCODE.setRowHeight(rowParent[0], true);
4539					}
4540					if (SiteParameters.dynamic_srcset_active === '1') {
4541						UNCODE.refresh_dynamic_srcset_size(thiis);
4542					}
4543				}, 350);
4544				// save the new time
4545				thiis.data("timer-id", new_time);
4546
4547				var scrolltop = $(document).scrollTop();
4548				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4549
4550				//if (!UNCODE.isMobile) {
4551					/** fix autoplay when visible **/
4552				$(window).on('load', function(){
4553					if (thiis.data('autoplay')) {
4554						if ( !thiis.closest('.sticky-element').length || thiis.closest('.un-submenu').length || thiis.closest('.overlay').length ) {
4555							thiis.trigger('stop.owl.autoplay');
4556						} else {
4557							thiis.trigger('play.owl.autoplay');
4558						}
4559					}
4560					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4561						return;
4562					}
4563					if ( ! thiis.closest('.sticky-element').length && ! thiis.closest('.un-submenu').length && ! thiis.closest('.overlay').length ) {
4564						var carouselInView = new Waypoint.Inview({
4565							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4566							element: thiis[0],
4567							exited: function() {
4568								var el = $(this.element);
4569								if (el.data('autoplay') ) {
4570									el.trigger('stop.owl.autoplay');
4571									el.data('stopped','true');
4572								}
4573							},
4574							enter: function(direction) {
4575								var el = $(this.element);
4576								requestTimeout(function() {
4577									if (el.data('autoplay')) {
4578										el.trigger('play.owl.autoplay');
4579										el.data('stopped','false');
4580									}
4581								}, 100);
4582							}
4583						});
4584					}
4585					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4586						setTimeout(function(){
4587							window.lenis.resize();
4588						}, 1000);
4589					}
4590			  	
4591				});
4592				//}
4593
4594				// $(window).on('frontend:carousel_updated', function(){
4595				// 	Waypoint.refreshAll();
4596				// });
4597
4598				if (!thiis.closest('.isotope-system').length && !thiis.closest('.megamenu-block-wrapper').length && !thiis.closest('.overlay').length) {
4599					requestTimeout(function() {
4600						animate_thumb($('.t-inside', el), event);
4601					}, 400);
4602				} 
4603				if (thiis.closest('.isotope-system').length ) {
4604					requestTimeout(function() {
4605						thiis.closest('.isotope-container').isotope('layout');
4606					}, 400);
4607				}
4608				if (thiis.closest('.megamenu-block-wrapper').length ) {
4609					$(document).on('un-menu-show', function(e, $ul){
4610						if ( thiis.closest($ul).length ) {
4611							animate_thumb($('.t-inside', el), event);
4612						}
4613					});
4614				}
4615				if (thiis.closest('.overlay').length ) {
4616					$(window).on('menuOpen', function(e, $ul){
4617						animate_thumb($('.t-inside', el), event);
4618					});
4619				}
4620
4621				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4622				currentIndex = $(currentItem).attr('data-index');
4623
4624				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4625					if ($(val).closest('.uncode-slider').length) {
4626						$(val).removeClass('start_animation');
4627					}
4628				});
4629				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4630					if ($(val).closest('.uncode-slider').length) {
4631						$(val).removeClass('already-animated');
4632					}
4633				});
4634
4635				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4636					if ($(val).closest('.uncode-slider').length) {
4637						$(val).removeAttr('data-animated');
4638					}
4639				});
4640
4641				$.each($('.owl-item.cloned', thiis), function(index, val) {
4642					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4643				});
4644
4645				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4646					if ($(val).attr('data-index') != currentIndex) {
4647						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4648						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4649					}
4650					if ($(val).attr('data-index') != currentIndex) {
4651						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4652					}
4653					if ($(val).attr('data-index') == currentIndex) {
4654						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4655					}
4656				});
4657
4658				if (thiis.closest('.uncode-slider').length) {
4659					var el = thiis.closest('.row-parent')[0],
4660						section = thiis.closest('.vc_section');
4661					if ( section.length ) {
4662						el = $('> .row-parent', section)[0];
4663					}
4664					if ($(el).data('imgready')) {
4665						firstLoaded(el, event);
4666					} else {
4667						el.addEventListener("imgLoaded", function(el) {
4668							firstLoaded(el.target, event);
4669						}, false);
4670					}
4671					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4672					if (transHeight != null) {
4673						requestTimeout(function() {
4674							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4675						}, 100);
4676					}
4677				} else {
4678					var el = thiis;
4679					el.closest('.uncode-slider').addClass('slider-loaded');
4680				}
4681
4682				requestTimeout(function() {
4683					if (typeof UNCODE.bigText !== 'undefined') {
4684						UNCODE.bigText(thiis);
4685					}
4686					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4687						if (thiis.data('autoplay')) pauseOnHover(thiis);
4688					}
4689				}, 500);
4690
4691				if (thiis.closest('.unequal').length) {
4692					$owlInsideEqual.push(thiis.closest('.row-parent'));
4693				}
4694
4695				var containerClasses = '',
4696					containerStyle = '';
4697				if ( $('.owl-dots-classes', $owlContainer).length ) {
4698					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4699					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4700					$('.owl-dots-classes', $owlContainer).remove();
4701				}
4702
4703				if ( containerClasses !== '' ) {
4704					requestTimeout(function() {
4705						if ( containerClasses !== '' )
4706							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4707						if ( containerStyle !== '' )
4708							$('.owl-dots', $owlContainer).addClass(containerClasses);
4709					}, 100);
4710				}
4711
4712				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4713					$(val).closest('.row-inner').css({
4714						'margin-top': '-1px'
4715					});
4716				});
4717
4718				if ($.fn.isotope) {
4719					if ( thiis.closest('.isotope-container').length ) {
4720						if (thiis.closest('.isotope-container').data('isotope')) {
4721							requestTimeout(function(){
4722								thiis.closest('.isotope-container').isotope('layout');
4723							}, 300);
4724						}
4725						$(window).on('load', function(){
4726							if (thiis.closest('.isotope-container').data('isotope')) {
4727								thiis.closest('.isotope-container').isotope('layout');
4728							}
4729						});
4730					}
4731				}
4732
4733				if (thiis.data('autoplay')) {
4734					$(window).on('menuOpen', function(){
4735						if ( thiis.closest('.overlay').length ) {
4736							thiis.trigger('play.owl.autoplay');
4737							thiis.data('stopped','false');
4738						} else {
4739							thiis.trigger('stop.owl.autoplay');
4740							thiis.data('stopped','true');
4741						}
4742					});
4743					$(window).on('menuClose', function(){
4744						if ( thiis.closest('.overlay').length ) {
4745							thiis.trigger('stop.owl.autoplay');
4746							thiis.data('stopped','true');
4747						} else {
4748							thiis.trigger('play.owl.autoplay');
4749							thiis.data('stopped','false');
4750						}
4751					});
4752				}
4753
4754				setIndexActive(event, true);
4755
4756				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4757						return !$(this).closest('.nested-carousel').length;
4758					}),
4759					$_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),
4760					$galleries = $_galleries.filter(function( index ) {
4761						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4762					});
4763
4764				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4765					UNCODE.lightgallery( $galleries );
4766				}
4767
4768				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4769					$(document).trigger('uncode-scrolltrigger-refresh');
4770				}
4771
4772				if (thiis.closest('.overlay').length && thiis.data('autoplay')) {
4773					thiis.trigger('stop.owl.autoplay');
4774					thiis.data('stopped','true');
4775				}
4776
4777				if (thiis.closest('.un-submenu').length && thiis.data('autoplay')) {
4778					thiis.trigger('stop.owl.autoplay');
4779					thiis.data('stopped','false');
4780					$(document).on('un-menu-show', function(){
4781						thiis.trigger('play.owl.autoplay');
4782						thiis.data('stopped','false');
4783					}).on('un-menu-hide', function(){
4784						thiis.trigger('stop.owl.autoplay');
4785						thiis.data('stopped','true');
4786					});
4787				}
4788			});
4789
4790			$elSelector.on('resized.owl.carousel', function(event) {
4791				$('.owl-dot', event.currentTarget).each(function(key, val){
4792					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4793				});
4794			});
4795
4796			$elSelector.on('resized.owl.carousel', function(event) {
4797				var thiis = $(event.currentTarget);
4798				// if ($(this).closest('.nested-carousel').length) {
4799				// 	requestTimeout(function() {
4800				// 		window.dispatchEvent(UNCODE.boxEvent);
4801				// 	}, 200);
4802				// }
4803				if ( thiis.hasClass('owl-height-equal') )
4804					setItemsHeight(thiis);
4805
4806				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4807					newWidth = UNCODE.wwidth;
4808					setItemsRelHeight($elSelector);
4809				}
4810
4811				setIndexActive(event);
4812
4813				if (SiteParameters.dynamic_srcset_active === '1') {
4814					UNCODE.refresh_dynamic_srcset_size(thiis);
4815				}
4816
4817				if ($.fn.isotope) {
4818					$(window).on('load', function(){
4819						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4820							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4821						}
4822					});
4823				}
4824
4825				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4826					setTimeout(function(){
4827						window.lenis.resize();
4828					}, 1000);
4829				}
4830				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4831					$(document).trigger('uncode-scrolltrigger-refresh');
4832				}
4833			});
4834
4835			$elSelector.on('refreshed.owl.carousel', function(event) {
4836				setIndexActive(event);
4837			});
4838
4839			/** detect resize window for fluid height layout */
4840			var setFluidResize;
4841			function manageFluidCarouseHeight() {
4842				clearRequestTimeout(setFluidResize);
4843				setFluidResize = requestTimeout(function(){
4844					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4845						newWidth = UNCODE.wwidth;
4846						setItemsRelHeight($elSelector);
4847					}
4848				}, 100);
4849			}
4850			window.addEventListener('resize', manageFluidCarouseHeight);
4851
4852			/** Change */
4853			$elSelector.on('change.owl.carousel', function(event) {
4854				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4855			});
4856
4857			/** Changed */
4858			$elSelector.on('changed.owl.carousel', function(event) {
4859				var $row = $elSelector.parents('.row')[0];
4860				if ( typeof $row !== 'undefined' ) {
4861					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4862				}
4863				setIndexActive(event);
4864			});
4865
4866			var checkDrag = function(e) {
4867				$elSelector.addClass('owl-dragging');
4868			};
4869			$elSelector.on('drag.owl.carousel', function(event) {
4870				document.addEventListener("mousemove", checkDrag);
4871			});
4872
4873			$elSelector.on('dragged.owl.carousel', function(event) {
4874				$elSelector.removeClass('owl-dragging');
4875				document.removeEventListener("mousemove", checkDrag);
4876			});
4877
4878			$elSelector.on('translate.owl.carousel', function(event) {
4879				if (UNCODE.isMobile) {
4880					$(event.currentTarget).addClass('owl-translating');
4881				}
4882			});
4883
4884			/** Translated */
4885			$elSelector.on('translated.owl.carousel', function(event) {
4886
4887				var thiis = $(event.currentTarget),
4888					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4889					currentIndex = $(currentItem).attr('data-index'),
4890					stagePadding = thiis.data('stagepadding');
4891
4892				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4893
4894				if (!UNCODE.isMobile) {
4895					UNCODE.owlPlayVideo(thiis);
4896				}
4897
4898				requestTimeout(function(){
4899					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4900					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4901					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4902						if (lastDelayElems == undefined) lastDelayElems = 0;
4903						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4904						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4905						thiis.trigger('stop.owl.autoplay');
4906						requestTimeout(function() {
4907							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4908						}, maxDelay);
4909					}
4910				}, 200);
4911
4912				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4913					if ($(val).closest('.uncode-slider').length) {
4914						$(val).removeClass('start_animation');
4915					}
4916				});
4917
4918				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4919					if ($(val).closest('.uncode-slider').length) {
4920						$(val).removeClass('already-animated');
4921					}
4922				});
4923
4924				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4925					if ($(val).closest('.uncode-slider').length) {
4926						$(val).removeAttr('data-animated');
4927					}
4928				});
4929
4930				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4931					if ($(val).attr('data-index') != currentIndex) {
4932						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4933						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4934					}
4935					if ($(val).attr('data-index') != currentIndex) {
4936						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4937					}
4938					if ($(val).attr('data-index') == currentIndex) {
4939						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4940					}
4941				});
4942
4943				if (UNCODE.isMobile) {
4944					thiis.removeClass('owl-translating');
4945				}
4946
4947				setIndexActive(event);
4948			});
4949
4950			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4951
4952			/** Init carousel */
4953			$elSelector.not('.showControls').owlCarousel({
4954				items: values['items'],
4955				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4956				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4957				nav: values['nav'],
4958				dots: values['dots'],
4959				loop: values['loop'],
4960				stagePadding: values['stagepadding'],
4961				margin: 0,
4962				video: true,
4963				autoWidth: false,
4964				autoplay: false,
4965				autoplayTimeout: values['timeout'],
4966				autoplaySpeed: values['navspeed'],
4967				autoplayHoverPause: $(this).closest('.uncode-slider').length || $(this).closest('.carousel-no-hover').length ? false : true,
4968				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4969				itemSelector: SiteParameters.uncode_carousel_itemSelector,
4970				rtl: $('body').hasClass('rtl') ? true : false,
4971				fluidSpeed: true,
4972				navSpeed: values['navspeed'],
4973				dotsSpeed: values['navspeed'] / values['items'],
4974				navElement: ['button type="button" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" aria-label="' + SiteParameters.uncode_next_label + '"'],
4975				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4976				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>'],
4977				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4978				responsiveClass: true,
4979				responsiveBaseElement: '.box-container',
4980				responsive: {
4981					0: {
4982						items: values['sm'],
4983						nav: values['navmobile'],
4984						dots: values['dotsmobile'],
4985						dotsSpeed: values['navspeed'] / values['sm'],
4986					},
4987					480: {
4988						items: values['sm'],
4989						nav: values['navmobile'],
4990						dots: values['dotsmobile'],
4991						dotsSpeed: values['navspeed'] / values['sm'],
4992					},
4993					570: {
4994						items: values['md'],
4995						nav: values['navmobile'],
4996						dots: values['dotsmobile'],
4997						dotsSpeed: values['navspeed'] / values['md'],
4998					},
4999					960: {
5000						items: values['lg'],
5001						dotsSpeed: values['navspeed'] / values['lg'],
5002					}
5003				}
5004			});
5005
5006			var transDuration = parseFloat(values['navspeed']) * 0.3;
5007			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
5008
5009			$('.owl-item .tmb', $elSelector).css({
5010				'-webkit-transition-delay': transDuration + 'ms',
5011				'-moz-transition-delay': transDuration + 'ms',
5012				'-o-transition-delay': transDuration + 'ms',
5013				'transition-delay': transDuration + 'ms',
5014				'-webkit-transition-duration': transDuration2 + 'ms',
5015				'-moz-transition-duration': transDuration2 + 'ms',
5016				'-o-transition-duration': transDuration2 + 'ms',
5017				'transition-duration': transDuration2 + 'ms',
5018			});
5019
5020			requestTimeout(function() {
5021				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5022					UNCODE.setRowHeight($owlInsideEqual[i]);
5023				};
5024			}, 300);
5025
5026			$(window).on('load', function(){
5027				var $elCarousel = $elSelector.data('owl.carousel');
5028				if ( typeof $elCarousel !== 'undefined' ) {
5029					$elCarousel.trigger('refreshed');
5030					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
5031						UNCODE.setRowHeight($owlInsideEqual[i]);
5032					};
5033				}
5034			});
5035
5036			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
5037				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5038					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
5039					$('#' + carousel_id).find('.owl-item').each( function() {
5040						var $item = $(this),
5041							index = ( $item.index() + 1 );
5042						$item.attr('data-index', index);
5043					});
5044				}
5045			});
5046
5047			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5048				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
5049					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
5050						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
5051						$('#' + carousel_id).find('.owl-item').each( function() {
5052							var $item = $(this),
5053								index = ( $item.index() + 1 );
5054							$item.attr('data-index', index);
5055						});
5056					}
5057				});
5058			}
5059
5060		});
5061
5062		function firstLoaded(el, event) {
5063			var el = $(el),
5064			uncode_slider = el.find('.uncode-slider');
5065			el.find('.owl-carousel').css('opacity', 1);
5066			uncode_slider.addClass('slider-loaded');
5067			if (typeof UNCODE.bigText !== 'undefined') {
5068				UNCODE.bigText(el.find('.owl-item.active'));
5069			}
5070			//if (!UNCODE.isMobile) {
5071				requestTimeout(function() {
5072					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
5073					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
5074					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
5075						if (lastDelayElems == undefined) lastDelayElems = 0;
5076						if (lastDelayThumb == undefined) lastDelayThumb = 0;
5077						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
5078						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
5079						requestTimeout(function() {
5080							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
5081						}, maxDelay);
5082					}
5083				}, 500);
5084
5085			//}
5086		}
5087
5088		function navHover(el) {
5089			var $owlCont = el,
5090				$owlPrev = $owlCont.find('.owl-prev'),
5091				$owlNext = $owlCont.find('.owl-next'),
5092				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
5093				$owlPagination = $owlCont.next(),
5094				owlPrevW = $owlPrev.outerWidth(),
5095				owlNextW = $owlNext.outerWidth(),
5096				owlDotsH = $owlDots.innerHeight(),
5097				owlTime = 400,
5098				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5099			if ( $('body').hasClass('rtl') ) {
5100				$owlPrev.css("margin-right", -owlPrevW);
5101				$owlNext.css("margin-left", -owlNextW);
5102			} else {
5103				$owlPrev.css("margin-left", -owlPrevW);
5104				$owlNext.css("margin-right", -owlNextW);
5105			}
5106			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
5107			$owlCont.mouseenter(function() {
5108				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5109				$owlPrev.add($owlNext).css({
5110					marginLeft: 0,
5111					marginRight: 0
5112				});
5113				if (!owlNested) {
5114					$owlDots.css({
5115						opacity: 1,
5116						bottom: 0
5117					});
5118				}
5119			}).mouseleave(function() {
5120				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
5121				if ( $('body').hasClass('rtl') ) {
5122					$owlPrev.css("margin-right", -owlPrevW);
5123					$owlNext.css("margin-left", -owlNextW);
5124				} else {
5125					$owlPrev.css("margin-left", -owlPrevW);
5126					$owlNext.css("margin-right", -owlNextW);
5127				}
5128				if (!owlNested) {
5129					$owlDots.css({
5130						opacity: 1,
5131						bottom: -owlDotsH
5132					});
5133				}
5134			});
5135		};
5136
5137		function animate_elems($this) {
5138			var lastDelay;
5139			$.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) {
5140				var element = $(val),
5141					delayAttr = element.attr('data-delay'),
5142					$first_item = element.closest('.owl-item[data-index="1"]');
5143
5144				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
5145					return false;
5146				}
5147
5148				if (delayAttr == undefined) delayAttr = 0;
5149				requestTimeout(function() {
5150					element.addClass('start_animation');
5151				}, delayAttr);
5152				lastDelay = delayAttr;
5153			});
5154			return lastDelay;
5155		}
5156
5157		function animate_thumb(items, event) {
5158			var lastDelay,
5159				itemIndex,
5160				thiis = $(event.currentTarget),
5161				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
5162				numActives = $('.owl-item.active', thiis).length,
5163				stagePadding = thiis.data('stagepadding');
5164
5165			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
5166
5167			thiis.data('tempIndex', event.item.index);
5168				$.each(items, function(index, val) {
5169					var parent = $(val).closest('.owl-item');
5170					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5171						return;
5172					}
5173					if (!$(val).hasClass('start_animation')) {
5174						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
5175							var thumbInView = new Waypoint.Inview({
5176							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5177							  element: val,
5178							  enter: function(direction) {
5179								var element = $(this.element),
5180										delayAttr = parseInt(element.attr('data-delay')),
5181										itemIndex = element.closest('.owl-item').index() + 1,
5182										menuIndex = parseFloat(element.closest('.owl-item').attr('data-index')),
5183										diffItem = Math.abs(itemIndex - tempIndex) - 1;
5184									if ( thiis.closest('.megamenu-block-wrapper').length ) {
5185										diffItem = menuIndex;
5186									} else {
5187										if (itemIndex > tempIndex) {
5188											thiis.data('tempIndex', itemIndex);
5189										}
5190									}
5191									if (isNaN(delayAttr)) delayAttr = 100;
5192									if (stagePadding) {
5193										var objTimeout = requestTimeout(function() {
5194											if ( !element.closest('.overlay:not(.open)').length ) {
5195												element.addClass('start_animation');
5196											}
5197										}, index * delayAttr);
5198										lastDelay = index * delayAttr;
5199									} else {
5200										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
5201										var objTimeout = requestTimeout(function() {
5202											element.attr('data-test', diffItem + ' ' + delayAttr).addClass('start_animation');
5203										}, diffItem * delayAttr);
5204										lastDelay = diffItem * delayAttr;
5205									}
5206									parent.data('objTimeout', objTimeout);
5207									if (!UNCODE.isUnmodalOpen) {
5208										this.destroy();
5209									}
5210								}
5211							});
5212						}
5213					}
5214				});
5215				return lastDelay;
5216			}
5217
5218		function setItemsHeight(item) {
5219			$.each($('.owl-item', item), function(index, val) {
5220				var availableThumbHeight = $('.t-inside', $(val)).height(),
5221				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
5222				difference = availableThumbHeight - innerThumbHeight;
5223				if ($('.tmb-content-under', val).length) {
5224					var visualPart = $('.t-entry-visual', val);
5225					if (visualPart.length) {
5226						difference -= $('.t-entry-visual', val).height();
5227					}
5228				}
5229				if (! $('.tmb-content-lateral', val).length)
5230					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
5231			});
5232		}
5233
5234		function setItemsRelHeight(item) {
5235			$.each($('.owl-item', item), function(index, val) {
5236				var $rowContainer = $(item).parents('.row-parent').eq(0),
5237					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
5238					$colContainer = $(item).parents('.uncell').eq(0),
5239					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
5240					winHeight = UNCODE.wheight,
5241					multiplier_h = parseInt($(item).attr('data-vp-height')),
5242					data_viewport_h,
5243					consider_menu = $(item).data('vp-menu');
5244
5245				if ( consider_menu ) {
5246					winHeight = winHeight - UNCODE.menuHeight;
5247				}
5248
5249				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
5250				$('.t-inside', val).css( 'height', data_viewport_h );
5251			});
5252		}
5253
5254		function pauseOnHover(slider) {
5255			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
5256			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
5257				mouseenter: function () {
5258					$(slider).addClass('owl-mouseenter');
5259					$(slider).trigger('stop.owl.autoplay');
5260				},
5261				mouseleave: function () {
5262					$(slider).removeClass('owl-mouseenter');
5263					$(slider).trigger('play.owl.autoplay');
5264				}
5265			});
5266		}
5267	});
5268};
5269
5270UNCODE.owlPlayVideo = function(carousel) {
5271	var player, iframe;
5272	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
5273		var content = $(val).html();
5274		if (content == '') {
5275			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
5276			$(val).append(getCloned);
5277		}
5278		if ($(this).attr('data-provider') == 'vimeo') {
5279			iframe = $(this).find('iframe');
5280			player = new Vimeo.Player(iframe[0]);
5281			player.play();
5282		} else if ($(this).attr('data-provider') == 'youtube') {
5283			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
5284		} else {
5285			var player = $(this).find('video');
5286			if (player.length) {
5287				$(this).find('video')[0].volume = 0;
5288				$(this).find('video')[0].play();
5289				$(val).css('opacity', 1);
5290			}
5291		}
5292	});
5293};
5294
5295UNCODE.owlStopVideo = function(carousel) {
5296	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
5297		var player, iframe;
5298		if ($(this).attr('data-provider') == 'vimeo') {
5299			iframe = $(this).find('iframe');
5300			player = new Vimeo.Player(iframe[0]);
5301			player.pause();
5302		} else if ($(this).attr('data-provider') == 'youtube') {
5303			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
5304		} else {
5305			var player = $(this).find('video');
5306			if (player.length) {
5307				$(this).find('video')[0].volume = 0;
5308				$(this).find('video')[0].play();
5309			}
5310		}
5311	});
5312};
5313
5314UNCODE.animations = function() {
5315
5316	var runWaypoints_TO,
5317		runWaypoints_carousel_TO,
5318		runWaypoints_delay = 0,
5319	highlightComplexFunc = function($wrap, ev){
5320
5321		var $lines = $('.heading-line-wrap', $wrap),
5322			not_animate = false;
5323
5324		if ( $wrap.data('animate') === true ) {
5325			not_animate = true;
5326		}
5327
5328		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
5329		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
5330			return;
5331		}
5332
5333		$lines.each(function(_key, _value){
5334			var $line = $(_value),
5335				$inners = $('.split-word-inner', $line),
5336				$highlights = $('.heading-text-highlight-inner', $line);
5337
5338			var highlitInnerFunc = function(ev){
5339				var delay = 0;
5340				$highlights.each(function(h_key, high){
5341					var $highlight = $(high),
5342						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
5343						$nextSplit = $split.nextUntil(),
5344						$next = $('.heading-text-highlight-inner', $nextSplit),
5345						countCh = $split.text().length;
5346
5347					$highlight.css({
5348						'-webkit-transition-duration': (30 * countCh) + 'ms',
5349						'-moz-transition-duration': (30 * countCh) + 'ms',
5350						'-o-transition-duration': (30 * countCh) + 'ms',
5351						'transition-duration': (30 * countCh) + 'ms',
5352					});
5353
5354					delay += (30 * countCh);
5355
5356					$next.css({
5357						'-webkit-transition-delay': delay + 'ms',
5358						'-moz-transition-delay': delay + 'ms',
5359						'-o-transition-delay': delay + 'ms',
5360						'transition-delay': delay + 'ms',
5361					});
5362				});
5363				$highlights.removeAttr('data-animated');
5364				if ( _key+1 === $lines.length ) {
5365					$wrap.data('animate', true);
5366				}
5367			};
5368
5369			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
5370				if ( not_animate ) {
5371					$highlights.each(function(h_key, high){
5372						var $highlight = $(high);
5373						$highlight.css({
5374							'-webkit-transition-duration': '0ms',
5375							'-moz-transition-duration': '0ms',
5376							'-o-transition-duration': '0ms',
5377							'transition-duration': '0ms',
5378						});
5379					});
5380					$highlights.removeAttr('data-animated');
5381				} else {
5382					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
5383						highlitInnerFunc();
5384					} else {
5385						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
5386					}
5387				}
5388			}
5389		});
5390	};
5391
5392	$.each($('.header-content-inner'), function(index, val) {
5393		var element = $(val),
5394			transition = '';
5395		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
5396		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
5397		if (element.hasClass('left-t-right')) transition = 'left-t-right';
5398		if (element.hasClass('right-t-left')) transition = 'right-t-left';
5399		if (element.hasClass('zoom-in')) transition = 'zoom-in';
5400		if (element.hasClass('zoom-out')) transition = 'zoom-out';
5401		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
5402		if (element.hasClass('slight-anim')) transition = 'slight-anim';
5403		if (transition != '') {
5404			$(val).removeClass(transition);
5405			var container = element,
5406				containerDelay = container.attr('data-delay'),
5407				containerSpeed = container.attr('data-speed'),
5408				items = $('.header-title > *, .post-info', container);
5409			$.each(items, function(index, val) {
5410				var element = $(val),
5411					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
5412					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
5413				if (!element.hasClass('animate_when_almost_visible') && !element.hasClass('translate_when_almost_visible')) {
5414					delayAttr = Number(delayAttr) + (400 * index);
5415					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
5416					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
5417				}
5418			});
5419			container.css('opacity', 1);
5420		}
5421	});
5422
5423	function animate_css_grids_on_load() {
5424		$('.cssgrid-system').each(function() {
5425			var grid = $(this);
5426			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
5427			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
5428		});
5429	}
5430
5431	var delayAdd = 0;
5432
5433	window.waypoint_animation = function(ev) {
5434		$.each($('.translate_when_almost_visible:not(.start_animation), .animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-linear .animate_when_almost_visible:not(.start_animation), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)').filter(function(){
5435				var $el = $(this);
5436				if (!$el.is('[data-delay-seq]')) return true;
5437				return $el.is('[data-delay]');
5438			}), function(index, val) {
5439			if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length || $(val).closest('.tab-pane:not(.active)').length || $(val).closest('.panel:not(.active-group)').length || $(val).closest('.un-submenu').length || $(val).closest('#uncode-mobile-menu-block').length || $(val).closest('.has-unblock').length ) && !SiteParameters.is_frontend_editor ) ) {
5440				return true;
5441			}
5442			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5443				return;
5444			}
5445			var run = true,
5446				$carousel = $(val).closest('.owl-carousel'),
5447				marquee = $(val).closest('.tmb-linear').length;
5448			if ( $carousel.length ) {
5449				run = false;
5450			}
5451			if ( $(val).closest('.megamenu-block-wrapper').length ) {
5452				run = false;
5453			}
5454			if (run) {
5455				new Waypoint({
5456					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5457					element: val,
5458					handler: function() {
5459						var element = $(this.element),
5460							index = element.index(),
5461							delayAttr = element.attr('data-delay');
5462						if (delayAttr == undefined) delayAttr = 0;
5463						// delayAttr = parseFloat(delayAttr) + delayAdd;
5464						// if ( marquee ) {
5465						// 	delayAdd += 50;
5466						// } else {
5467						// 	delayAdd = 0;
5468						// }
5469						requestTimeout(function() {
5470							element.addClass('start_animation');
5471						}, delayAttr);
5472						if (!UNCODE.isUnmodalOpen) {
5473							this.destroy();
5474						}
5475					},
5476					offset: UNCODE.isFullPage ? '100%' : '90%'
5477				});
5478			}
5479		});
5480		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
5481			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5482				return;
5483			}
5484			var run = true,
5485				$carousel = $(val).closest('.owl-carousel');
5486			if ( $carousel.length ) {
5487				run = false;
5488			}
5489			if (run) {
5490				new Waypoint({
5491					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5492					element: val,
5493					handler: function() {
5494						var $element = $(this.element),
5495							$childs = $('.animate_when_parent_almost_visible', $element);
5496						$childs.each(function(key,el){
5497							var $child = $(el),
5498								delaySpeed = $child.attr('data-speed'),
5499								delayAttr = $child.attr('data-delay'),
5500								intervalAttr = $child.attr('data-interval');
5501							if (delayAttr == undefined) {
5502								delayAttr = 50*key;
5503							}
5504							requestTimeout(function() {
5505								$child.addClass('start_animation');
5506								if ( $child.hasClass('anim-line-checker') ) {
5507									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5508										var $line = $child.closest('.heading-line-wrap');
5509									});
5510								}
5511								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5512								highlightComplexFunc($wrapText, ev);
5513								if ( $child.hasClass('anim-tot-checker') ) {
5514									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5515										if ( $child.hasClass('anim-tot-checker') ) {
5516											$wrapText.addClass('already-animated');
5517											$element.trigger('already-animated');
5518										}
5519									});
5520								}
5521							}, delayAttr );
5522						});
5523						$element.addClass('start_animation');
5524						if (!UNCODE.isUnmodalOpen) {
5525							this.destroy();
5526						}
5527					},
5528					offset: UNCODE.isFullPage ? '100%' : '90%'
5529				});
5530			}
5531		});
5532	}
5533	window.waypoint_carousel_animation = function(ev) {
5534		$.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) {
5535			if ( $(val).hasClass('el-text-split') ) {
5536				return true;
5537			}
5538			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5539				return;
5540			}
5541			var run = true,
5542				$carousel = $(val).closest('.owl-carousel'),
5543				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5544				$all_first = $('.owl-item[data-index="1"]', $carousel);
5545			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5546				run = false;
5547			}
5548			if (run) {
5549				new Waypoint({
5550					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5551					element: val,
5552					handler: function() {
5553						var element = $(this.element),
5554							index = element.index(),
5555							delayAttr = element.attr('data-delay');
5556						if (delayAttr == undefined) delayAttr = 0;
5557						requestTimeout(function() {
5558							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5559								$all_first.attr('data-already-reached', 'true');
5560							}
5561							element.addClass('start_animation');
5562						}, delayAttr);
5563						if (!UNCODE.isUnmodalOpen) {
5564							this.destroy();
5565						}
5566					},
5567					offset: UNCODE.isFullPage ? '100%' : '90%'
5568				});
5569			}
5570		});
5571		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
5572			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5573				return;
5574			}
5575			var run = true,
5576				$carousel = $(val).closest('.owl-carousel'),
5577				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5578				$all_first = $('.owl-item[data-index="1"]', $carousel);
5579			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5580				run = false;
5581			}
5582			if (run) {
5583				new Waypoint({
5584					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5585					element: val,
5586					handler: function() {
5587						var $element = $(this.element),
5588							$childs = $('.animate_when_parent_almost_visible', $element);
5589						$childs.each(function(key,el){
5590							var $child = $(el),
5591								delaySpeed = $child.attr('data-speed'),
5592								delayAttr = $child.attr('data-delay'),
5593								intervalAttr = $child.attr('data-interval');
5594							if (delayAttr == undefined) {
5595								delayAttr = 50*key;
5596							}
5597							requestTimeout(function() {
5598								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5599									$all_first.attr('data-already-reached', 'true');
5600								}
5601								$child.addClass('start_animation');
5602								if ( $child.hasClass('anim-line-checker') ) {
5603									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5604										var $line = $child.closest('.heading-line-wrap');
5605									});
5606								}
5607								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5608								highlightComplexFunc($wrapText, ev);
5609								if ( $child.hasClass('anim-tot-checker') ) {
5610									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5611										if ( $child.hasClass('anim-tot-checker') ) {
5612											$wrapText.addClass('already-animated');
5613										}
5614									});
5615								}
5616							}, delayAttr );
5617						});
5618						$element.addClass('start_animation');
5619						if (!UNCODE.isUnmodalOpen) {
5620							this.destroy();
5621						}
5622					},
5623					offset: UNCODE.isFullPage ? '100%' : '90%'
5624				});
5625			}
5626		});
5627	}
5628
5629	var runWaypoints = function(ev){
5630		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5631			runWaypoints_delay = 400;
5632		}
5633		clearRequestTimeout(runWaypoints_TO);
5634		runWaypoints_TO = requestTimeout(function() {
5635			window.waypoint_animation(ev);
5636		}, runWaypoints_delay);
5637
5638		clearRequestTimeout(runWaypoints_carousel_TO);
5639		runWaypoints_carousel_TO = requestTimeout(function() {
5640			window.waypoint_carousel_animation(ev);
5641		}, 400);
5642	};
5643	runWaypoints();
5644	animate_css_grids_on_load();
5645
5646	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5647		runWaypoints(ev);
5648	});
5649	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5650		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5651		window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints );
5652	}
5653};
5654
5655UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5656	var $allItems = elements.length - startIndex,
5657		showed = 0,
5658		index = 0,
5659		use_index = false
5660		;
5661
5662	if (filtering) {
5663		if (sequential) {
5664			use_index = true;
5665		}
5666		sequential = false;
5667	}
5668
5669	$.each(elements, function(index, val) {
5670		var $this = $(val),
5671			elInner = $('> .t-inside', val);
5672
5673		if ( ( UNCODE.isUnmodalOpen && !val.closest('#unmodal-content') ) || $(val).closest('.un-submenu').length || $(val).closest('uncode-mobile-menu-block').length ) {
5674			return;
5675		}
5676		if (val[0]) val = val[0];
5677
5678		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5679			new Waypoint({
5680				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5681				element: val,
5682				handler: function() {
5683					var element = $('> .t-inside', this.element),
5684						parent = $(this.element);
5685					var _index = use_index? index : 0;
5686
5687					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5688						delayAttr = parseInt(element.attr('data-delay'));
5689					if (isNaN(delayAttr)) delayAttr = 100;
5690					if (sequential || use_index) {
5691						delay -= showed;
5692					}
5693					var objTimeout = requestTimeout(function() {
5694						element.removeClass('zoom-reverse').addClass('start_animation');
5695						showed = index;
5696					}, delay * delayAttr);
5697					parent.data('objTimeout', objTimeout);
5698					if (!UNCODE.isUnmodalOpen) {
5699						this.destroy();
5700					}
5701				},
5702				offset: UNCODE.isFullPage ? '100%' : '90%'
5703			});
5704		}
5705
5706		index++;
5707	});
5708};
5709
5710UNCODE.tapHover = function() {
5711
5712	var isTouch = (
5713		'ontouchstart' in window ||
5714		navigator.maxTouchPoints > 0 ||
5715		navigator.msMaxTouchPoints > 0
5716	);
5717
5718	if (isTouch) {
5719		var $el = $('.tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), 
5720			elClass = "hover";
5721
5722		$(window).on('click', function() {
5723			$el.removeClass(elClass);
5724		});
5725
5726		$el.on('click', function(e) {
5727			e.stopPropagation();
5728			var link = $(this);
5729			if ( ! link.hasClass(elClass)) {
5730				e.preventDefault();
5731				link.addClass("hover");
5732				$el.not(this).removeClass(elClass);
5733				return false;
5734			}
5735		});
5736	}
5737};
5738
5739UNCODE.onePage = function(isMobile) {
5740	var current = 0,
5741		last = 0,
5742		lastScrollTop = 0,
5743		forceScroll = false,
5744		lastScrolled = 0,
5745		isSectionscroller = ($('.main-onepage').length) ? true : false,
5746		isOnePage = false,
5747		getOffset = function () {
5748			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);
5749			return calculateOffset;
5750		}
5751
5752	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5753
5754	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5755	// 	return false;
5756
5757	function init_onepage() {
5758		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5759			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5760		}
5761		last = $('.onepage-pagination li').last().find('a').data('index');
5762		$.each($('div[data-parent="true"]'), function(index, val) {
5763			$(this).attr('data-section', index);
5764			if (isMobile) return;
5765			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5766				return;
5767			}
5768			var sectionDown = new Waypoint({
5769				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5770				element: val,
5771				handler: function(direction) {
5772					if (direction == 'down') {
5773						changeMenuActive(this.element, index);
5774					}
5775				},
5776				offset: function() {
5777					return 5 + getOffset()
5778				}
5779			});
5780			var sectionUp = new Waypoint({
5781				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5782				element: val,
5783				handler: function(direction) {
5784					if (direction == 'up') {
5785						changeMenuActive(this.element, index);
5786					}
5787				},
5788				offset: function() {
5789					return -5 - getOffset()
5790				}
5791			});
5792
5793			if (isSectionscroller) {
5794				var label;
5795				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5796				else label = '';
5797				var getName = $(this).attr('data-name');
5798				if (getName == undefined) getName = index;
5799				if (label != '') {
5800					isOnePage = true;
5801					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5802					$('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>");
5803				}
5804			}
5805		});
5806
5807		if (isSectionscroller) {
5808			$.each($('ul.onepage-pagination li'), function(index, val) {
5809				var $this = $(val),
5810					$a = ('a', $this);
5811				$a.on('click', function(evt) {
5812					if ( $('.is-selected', $this).length || UNCODE.scrolling ) {
5813						return false;
5814					}
5815					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5816						evt.preventDefault();
5817					}
5818					Waypoint.refreshAll();
5819					var el = $('a', evt.currentTarget);
5820					current = lastScrolled = parseInt(el.attr('data-index'));
5821					lastScrolled += 1;
5822					scrollBody(current);
5823				});
5824			});
5825		}
5826
5827		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5828		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5829			goToSection = String(window.location.hash).replace(/^#/, "");
5830			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5831		}
5832
5833		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5834			current = lastScrolled = goToSection;
5835			$(window).on('load', function(){
5836				if ( $('.owl-carousel').length ) {
5837					requestTimeout(function(){
5838						scrollBody(goToSection);
5839					}, 400);
5840				} else {
5841					scrollBody(goToSection);
5842				}
5843			});
5844		}
5845
5846	}
5847
5848	function changeMenuActive(section, index) {
5849		current = lastScrolled = parseInt($(section).attr('data-section'));
5850		if (isOnePage) {
5851			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5852			if (newSection.length) {
5853				$('ul.onepage-pagination li a').removeClass('is-selected');
5854				newSection.addClass('is-selected');
5855			}
5856			var getName = $('[data-section="' + index + '"]').attr('data-name');
5857			if (getName != undefined && getName !== '') {
5858				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5859					var get_href = $(val).attr('href');
5860					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5861						$(val).closest('.menu-smart').find('.active').removeClass('active');
5862						$(val).parent().addClass('active');
5863					}
5864				});
5865			}
5866		}
5867	}
5868
5869	if (isOnePage) {
5870		$(window).on('scroll', function() {
5871			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5872			if (bodyTop == 0) {
5873				$('ul.onepage-pagination li a').removeClass('is-selected');
5874				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5875				var getName = $('[data-section=0]').attr('data-name');
5876				if (getName != undefined && getName !== '') {
5877					$.each($('.menu-container .menu-item > a'), function(i, val) {
5878						var get_href = $(val).attr('href');
5879						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5880							$(val).closest('ul').find('.active').removeClass('active');
5881							$(val).parent().addClass('active');
5882						}
5883					});
5884				}
5885			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5886				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5887				if (lastSection.length) {
5888					$('ul.onepage-pagination li a').removeClass('is-selected');
5889					lastSection.addClass('is-selected');
5890				}
5891			}
5892		});
5893	}
5894
5895	var scrollBody = function(index) {
5896		$('ul.onepage-pagination li a').removeClass('is-selected');
5897		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5898
5899		var getSection = $('[data-section=' + index + ']'),
5900			scrollTo;
5901
5902		if (getSection == undefined) return;
5903
5904		var body = $("html, body"),
5905			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5906			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5907			getOffset = UNCODE.get_scroll_offset(index);
5908		if ( typeof getSection.offset() === 'undefined' )
5909			return;
5910		scrollTo = getSection.offset().top;
5911
5912		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5913		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5914			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5915			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5916				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5917			}
5918
5919			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5920				if ( index === 0 ) {
5921					scrollTo = 0;
5922				} else {
5923					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5924				}
5925			} else {
5926				scrollTo -= getOffset;
5927			}
5928		}
5929
5930		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5931		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5932
5933		if (index != 0) {
5934			UNCODE.scrolling = true;
5935		}
5936
5937		if (scrollSpeed == 0) {
5938			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5939			UNCODE.scrolling = false;
5940		} else {
5941			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5942				$(this).stop();
5943			}).animate({
5944				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5945			}, scrollSpeed, 'easeInOutCubic', function() {
5946				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5947				UNCODE.scrolling = false;
5948				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5949				||
5950				$('.menu-hided').length ) {
5951					scrollTo = getSection.offset().top;
5952					getOffset = UNCODE.get_scroll_offset(index);
5953					scrollTo -= getOffset;
5954					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5955						$(this).stop();
5956					}).animate({
5957						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5958						}, scrollSpeed, 'easeInOutCubic', function() {
5959							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5960							UNCODE.scrolling = false;
5961						}
5962					);
5963				}
5964			});
5965		}
5966
5967	};
5968
5969	init_onepage();
5970};
5971
5972UNCODE.stickyElements = function() {
5973	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5974	if (!isMobile_wide ) {
5975
5976		var $pageHeader = $('#page-header'),
5977			$headerRow = $('.vc_row', $pageHeader),
5978			$headerSection = $headerRow.closest('section[data-parent]'),
5979			startSticky = false;
5980
5981		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
5982			$headerRow.removeClass('sticky-element');
5983			$pageHeader.addClass('sticky-element');
5984			startSticky = true;
5985		}
5986
5987		var calculateOffset = function(el) {
5988			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5989				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5990				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5991				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5992
5993			sideOffset += UNCODE.bodyBorder;
5994
5995			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5996			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5997				if ($('.menu-shrink').length) {
5998					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5999				} else {
6000					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
6001				}
6002			}
6003
6004			return sideOffset;
6005
6006		},
6007
6008		initStickyElement = function($els) {
6009			if ( $('body').hasClass('vc-safe-mode') ) {
6010				return true;
6011			}
6012			if ( typeof $els === 'undefined' ) {
6013				$els = $('.sticky-element');
6014			}
6015			$.each($els, function(index, element) {
6016				if ($(element).closest('.tab-pane').length) {
6017					var $paneParent = $(element).closest('.tab-pane');
6018					if ( !$paneParent.hasClass('active') ) {
6019						return true;
6020					}
6021				}
6022				$(element).stick_in_parent({
6023					sticky_class: 'is_stucked',
6024					offset_top: calculateOffset(element),
6025					bottoming: true,
6026					inner_scrolling: SiteParameters.sticky_elements === 'on'
6027				});
6028			});
6029		};
6030
6031		var oldW = UNCODE.wwidth,
6032			oldH = UNCODE.wHeight;
6033
6034		requestTimeout(function() {
6035			if ($('.sticky-element').length) {
6036
6037				if ($(window).width() > UNCODE.mediaQuery) {
6038					initStickyElement();
6039
6040					if ( startSticky === true ) {
6041						$('#page-header').trigger('sticky_kit:recalc');
6042					}
6043				}
6044
6045				$(window).on('resize lateral_resize', function(event) {
6046					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
6047						$(".sticky-element").trigger("sticky_kit:detach");
6048						if ($(window).width() > UNCODE.mediaQuery) {
6049							initStickyElement();
6050						}
6051						oldW = UNCODE.wwidth;
6052						oldH = UNCODE.wHeight;
6053					}
6054				});
6055			}
6056		}, 1000);
6057
6058		if ($('.sticky-element').length) {
6059			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
6060				requestTimeout(function() {
6061					$(document.body).trigger("sticky_kit:recalc");
6062				}, 100);
6063			});
6064		}
6065
6066		var $panels = $('.panel-collapse');
6067		if ( $panels.length ) {
6068			$panels.each(function(){
6069				var $panel = $(this);
6070				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
6071					$(document.body).trigger("sticky_kit:recalc");
6072				});
6073			});
6074		}
6075
6076		$('.nav-tabs a').on('shown.bs.tab', function(e){
6077			var $tabs = $(e.target).closest('.tab-container'),
6078				$panel = $('.tab-pane.active', $tabs),
6079				$els = $(e.target).nextAll(".sticky-element");
6080
6081			$els.trigger("sticky_kit:detach");
6082			initStickyElement($els);
6083		});
6084
6085		$(window).on('vc-safe-mode-on', function(){
6086			$(".sticky-element").trigger("sticky_kit:detach");
6087		});
6088
6089		$(window).on('vc-safe-mode-off', function(){
6090			initStickyElement();
6091		});
6092	}
6093};
6094
6095UNCODE.twentytwenty = function() {
6096
6097  if (!$('.twentytwenty-container').length) return;
6098
6099// DOM.event.move
6100//
6101// 2.0.0
6102//
6103// Stephen Band
6104//
6105// Triggers 'movestart', 'move' and 'moveend' events after
6106// mousemoves following a mousedown cross a distance threshold,
6107// similar to the native 'dragstart', 'drag' and 'dragend' events.
6108// Move events are throttled to animation frames. Move event objects
6109// have the properties:
6110//
6111// pageX:
6112// pageY:     Page coordinates of pointer.
6113// startX:
6114// startY:    Page coordinates of pointer at movestart.
6115// distX:
6116// distY:     Distance the pointer has moved since movestart.
6117// deltaX:
6118// deltaY:    Distance the finger has moved since last event.
6119// velocityX:
6120// velocityY: Average velocity over last few events.
6121
6122
6123(function(fn) {
6124	if (typeof define === 'function' && define.amd) {
6125        define([], fn);
6126    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
6127        module.exports = fn;
6128	} else {
6129		fn();
6130	}
6131})(function(){
6132	var assign = Object.assign || window.jQuery && jQuery.extend;
6133
6134	// Number of pixels a pressed pointer travels before movestart
6135	// event is fired.
6136	var threshold = 8;
6137
6138	// Shim for requestAnimationFrame, falling back to timer. See:
6139	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
6140	var requestFrame = (function(){
6141		return (
6142			window.requestAnimationFrame ||
6143			window.webkitRequestAnimationFrame ||
6144			window.mozRequestAnimationFrame ||
6145			window.oRequestAnimationFrame ||
6146			window.msRequestAnimationFrame ||
6147			function(fn, element){
6148				return window.setTimeout(function(){
6149					fn();
6150				}, 25);
6151			}
6152		);
6153	})();
6154
6155	// Shim for customEvent
6156	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
6157	(function () {
6158		if ( typeof window.CustomEvent === "function" ) return false;
6159		function CustomEvent ( event, params ) {
6160			params = params || { bubbles: false, cancelable: false, detail: undefined };
6161			var evt = document.createEvent( 'CustomEvent' );
6162			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
6163			return evt;
6164		}
6165
6166		CustomEvent.prototype = window.Event.prototype;
6167		window.CustomEvent = CustomEvent;
6168	})();
6169
6170	var ignoreTags = {
6171			textarea: true,
6172			input: true,
6173			select: true,
6174			button: true
6175		};
6176
6177	var mouseevents = {
6178		move:   'mousemove',
6179		cancel: 'mouseup dragstart',
6180		end:    'mouseup'
6181	};
6182
6183	var touchevents = {
6184		move:   'touchmove',
6185		cancel: 'touchend',
6186		end:    'touchend'
6187	};
6188
6189	var rspaces = /\s+/;
6190
6191
6192	// DOM Events
6193
6194	var eventOptions = { bubbles: true, cancelable: true };
6195
6196	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
6197
6198	function createEvent(type) {
6199		return new CustomEvent(type, eventOptions);
6200	}
6201
6202	function getEvents(node) {
6203		return node[eventsSymbol] || (node[eventsSymbol] = {});
6204	}
6205
6206	function on(node, types, fn, data, selector) {
6207		types = types.split(rspaces);
6208
6209		var events = getEvents(node);
6210		var i = types.length;
6211		var handlers, type;
6212
6213		function handler(e) { fn(e, data); }
6214
6215		while (i--) {
6216			type = types[i];
6217			handlers = events[type] || (events[type] = []);
6218			handlers.push([fn, handler]);
6219			node.addEventListener(type, handler);
6220		}
6221	}
6222
6223	function off(node, types, fn, selector) {
6224		types = types.split(rspaces);
6225
6226		var events = getEvents(node);
6227		var i = types.length;
6228		var type, handlers, k;
6229
6230		if (!events) { return; }
6231
6232		while (i--) {
6233			type = types[i];
6234			handlers = events[type];
6235			if (!handlers) { continue; }
6236			k = handlers.length;
6237			while (k--) {
6238				if (handlers[k][0] === fn) {
6239					node.removeEventListener(type, handlers[k][1]);
6240					handlers.splice(k, 1);
6241				}
6242			}
6243		}
6244	}
6245
6246	function trigger(node, type, properties) {
6247		// Don't cache events. It prevents you from triggering an event of a
6248		// given type from inside the handler of another event of that type.
6249		var event = createEvent(type);
6250		if (properties) { assign(event, properties); }
6251		node.dispatchEvent(event);
6252	}
6253
6254
6255	// Constructors
6256
6257	function Timer(fn){
6258		var callback = fn,
6259		    active = false,
6260		    running = false;
6261
6262		function trigger(time) {
6263			if (active){
6264				callback();
6265				requestFrame(trigger);
6266				running = true;
6267				active = false;
6268			}
6269			else {
6270				running = false;
6271			}
6272		}
6273
6274		this.kick = function(fn) {
6275			active = true;
6276			if (!running) { trigger(); }
6277		};
6278
6279		this.end = function(fn) {
6280			var cb = callback;
6281
6282			if (!fn) { return; }
6283
6284			// If the timer is not running, simply call the end callback.
6285			if (!running) {
6286				fn();
6287			}
6288			// If the timer is running, and has been kicked lately, then
6289			// queue up the current callback and the end callback, otherwise
6290			// just the end callback.
6291			else {
6292				callback = active ?
6293					function(){ cb(); fn(); } :
6294					fn ;
6295
6296				active = true;
6297			}
6298		};
6299	}
6300
6301
6302	// Functions
6303
6304	function noop() {}
6305
6306	function preventDefault(e) {
6307		e.preventDefault();
6308	}
6309
6310	function isIgnoreTag(e) {
6311		return !!ignoreTags[e.target.tagName.toLowerCase()];
6312	}
6313
6314	function isPrimaryButton(e) {
6315		// Ignore mousedowns on any button other than the left (or primary)
6316		// mouse button, or when a modifier key is pressed.
6317		return (e.which === 1 && !e.ctrlKey && !e.altKey);
6318	}
6319
6320	function identifiedTouch(touchList, id) {
6321		var i, l;
6322
6323		if (touchList.identifiedTouch) {
6324			return touchList.identifiedTouch(id);
6325		}
6326
6327		// touchList.identifiedTouch() does not exist in
6328		// webkit yet… we must do the search ourselves...
6329
6330		i = -1;
6331		l = touchList.length;
6332
6333		while (++i < l) {
6334			if (touchList[i].identifier === id) {
6335				return touchList[i];
6336			}
6337		}
6338	}
6339
6340	function changedTouch(e, data) {
6341		var touch = identifiedTouch(e.changedTouches, data.identifier);
6342
6343		// This isn't the touch you're looking for.
6344		if (!touch) { return; }
6345
6346		// Chrome Android (at least) includes touches that have not
6347		// changed in e.changedTouches. That's a bit annoying. Check
6348		// that this touch has changed.
6349		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
6350
6351		return touch;
6352	}
6353
6354
6355	// Handlers that decide when the first movestart is triggered
6356
6357	function mousedown(e){
6358		// Ignore non-primary buttons
6359		if (!isPrimaryButton(e)) { return; }
6360
6361		// Ignore form and interactive elements
6362		if (isIgnoreTag(e)) { return; }
6363
6364		on(document, mouseevents.move, mousemove, e);
6365		on(document, mouseevents.cancel, mouseend, e);
6366	}
6367
6368	function mousemove(e, data){
6369		checkThreshold(e, data, e, removeMouse);
6370	}
6371
6372	function mouseend(e, data) {
6373		removeMouse();
6374	}
6375
6376	function removeMouse() {
6377		off(document, mouseevents.move, mousemove);
6378		off(document, mouseevents.cancel, mouseend);
6379	}
6380
6381	function touchstart(e) {
6382		// Don't get in the way of interaction with form elements
6383		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
6384
6385		var touch = e.changedTouches[0];
6386
6387		// iOS live updates the touch objects whereas Android gives us copies.
6388		// That means we can't trust the touchstart object to stay the same,
6389		// so we must copy the data. This object acts as a template for
6390		// movestart, move and moveend event objects.
6391		var data = {
6392			target:     touch.target,
6393			pageX:      touch.pageX,
6394			pageY:      touch.pageY,
6395			identifier: touch.identifier,
6396
6397			// The only way to make handlers individually unbindable is by
6398			// making them unique.
6399			touchmove:  function(e, data) { touchmove(e, data); },
6400			touchend:   function(e, data) { touchend(e, data); }
6401		};
6402
6403		on(document, touchevents.move, data.touchmove, data);
6404		on(document, touchevents.cancel, data.touchend, data);
6405	}
6406
6407	function touchmove(e, data) {
6408		var touch = changedTouch(e, data);
6409		if (!touch) { return; }
6410		checkThreshold(e, data, touch, removeTouch);
6411	}
6412
6413	function touchend(e, data) {
6414		var touch = identifiedTouch(e.changedTouches, data.identifier);
6415		if (!touch) { return; }
6416		removeTouch(data);
6417	}
6418
6419	function removeTouch(data) {
6420		off(document, touchevents.move, data.touchmove);
6421		off(document, touchevents.cancel, data.touchend);
6422	}
6423
6424	function checkThreshold(e, data, touch, fn) {
6425		var distX = touch.pageX - data.pageX;
6426		var distY = touch.pageY - data.pageY;
6427
6428		// Do nothing if the threshold has not been crossed.
6429		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
6430
6431		triggerStart(e, data, touch, distX, distY, fn);
6432	}
6433
6434	function triggerStart(e, data, touch, distX, distY, fn) {
6435		var touches = e.targetTouches;
6436		var time = e.timeStamp - data.timeStamp;
6437
6438		// Create a movestart object with some special properties that
6439		// are passed only to the movestart handlers.
6440		var template = {
6441			altKey:     e.altKey,
6442			ctrlKey:    e.ctrlKey,
6443			shiftKey:   e.shiftKey,
6444			startX:     data.pageX,
6445			startY:     data.pageY,
6446			distX:      distX,
6447			distY:      distY,
6448			deltaX:     distX,
6449			deltaY:     distY,
6450			pageX:      touch.pageX,
6451			pageY:      touch.pageY,
6452			velocityX:  distX / time,
6453			velocityY:  distY / time,
6454			identifier: data.identifier,
6455			targetTouches: touches,
6456			finger: touches ? touches.length : 1,
6457			enableMove: function() {
6458				this.moveEnabled = true;
6459				this.enableMove = noop;
6460				e.preventDefault();
6461			}
6462		};
6463
6464		// Trigger the movestart event.
6465		trigger(data.target, 'movestart', template);
6466
6467		// Unbind handlers that tracked the touch or mouse up till now.
6468		fn(data);
6469	}
6470
6471
6472	// Handlers that control what happens following a movestart
6473
6474	function activeMousemove(e, data) {
6475		var timer  = data.timer;
6476
6477		data.touch = e;
6478		data.timeStamp = e.timeStamp;
6479		timer.kick();
6480	}
6481
6482	function activeMouseend(e, data) {
6483		var target = data.target;
6484		var event  = data.event;
6485		var timer  = data.timer;
6486
6487		removeActiveMouse();
6488
6489		endEvent(target, event, timer, function() {
6490			// Unbind the click suppressor, waiting until after mouseup
6491			// has been handled.
6492			setTimeout(function(){
6493				off(target, 'click', preventDefault);
6494			}, 0);
6495		});
6496	}
6497
6498	function removeActiveMouse() {
6499		off(document, mouseevents.move, activeMousemove);
6500		off(document, mouseevents.end, activeMouseend);
6501	}
6502
6503	function activeTouchmove(e, data) {
6504		var event = data.event;
6505		var timer = data.timer;
6506		var touch = changedTouch(e, event);
6507
6508		if (!touch) { return; }
6509
6510		// Stop the interface from gesturing
6511		e.preventDefault();
6512
6513		event.targetTouches = e.targetTouches;
6514		data.touch = touch;
6515		data.timeStamp = e.timeStamp;
6516
6517		timer.kick();
6518	}
6519
6520	function activeTouchend(e, data) {
6521		var target = data.target;
6522		var event  = data.event;
6523		var timer  = data.timer;
6524		var touch  = identifiedTouch(e.changedTouches, event.identifier);
6525
6526		// This isn't the touch you're looking for.
6527		if (!touch) { return; }
6528
6529		removeActiveTouch(data);
6530		endEvent(target, event, timer);
6531	}
6532
6533	function removeActiveTouch(data) {
6534		off(document, touchevents.move, data.activeTouchmove);
6535		off(document, touchevents.end, data.activeTouchend);
6536	}
6537
6538
6539	// Logic for triggering move and moveend events
6540
6541	function updateEvent(event, touch, timeStamp) {
6542		var time = timeStamp - event.timeStamp;
6543
6544		event.distX =  touch.pageX - event.startX;
6545		event.distY =  touch.pageY - event.startY;
6546		event.deltaX = touch.pageX - event.pageX;
6547		event.deltaY = touch.pageY - event.pageY;
6548
6549		// Average the velocity of the last few events using a decay
6550		// curve to even out spurious jumps in values.
6551		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
6552		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
6553		event.pageX =  touch.pageX;
6554		event.pageY =  touch.pageY;
6555	}
6556
6557	function endEvent(target, event, timer, fn) {
6558		timer.end(function(){
6559			trigger(target, 'moveend', event);
6560			return fn && fn();
6561		});
6562	}
6563
6564
6565	// Set up the DOM
6566
6567	function movestart(e) {
6568		if (e.defaultPrevented) { return; }
6569		if (!e.moveEnabled) { return; }
6570
6571		var event = {
6572			startX:        e.startX,
6573			startY:        e.startY,
6574			pageX:         e.pageX,
6575			pageY:         e.pageY,
6576			distX:         e.distX,
6577			distY:         e.distY,
6578			deltaX:        e.deltaX,
6579			deltaY:        e.deltaY,
6580			velocityX:     e.velocityX,
6581			velocityY:     e.velocityY,
6582			identifier:    e.identifier,
6583			targetTouches: e.targetTouches,
6584			finger:        e.finger
6585		};
6586
6587		var data = {
6588			target:    e.target,
6589			event:     event,
6590			timer:     new Timer(update),
6591			touch:     undefined,
6592			timeStamp: e.timeStamp
6593		};
6594
6595		function update(time) {
6596			updateEvent(event, data.touch, data.timeStamp);
6597			trigger(data.target, 'move', event);
6598		}
6599
6600		if (e.identifier === undefined) {
6601			// We're dealing with a mouse event.
6602			// Stop clicks from propagating during a move
6603			on(e.target, 'click', preventDefault);
6604			on(document, mouseevents.move, activeMousemove, data);
6605			on(document, mouseevents.end, activeMouseend, data);
6606		}
6607		else {
6608			// In order to unbind correct handlers they have to be unique
6609			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6610			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6611
6612			// We're dealing with a touch.
6613			on(document, touchevents.move, data.activeTouchmove, data);
6614			on(document, touchevents.end, data.activeTouchend, data);
6615		}
6616	}
6617
6618	on(document, 'mousedown', mousedown);
6619	on(document, 'touchstart', touchstart);
6620	on(document, 'movestart', movestart);
6621
6622
6623	// jQuery special events
6624	//
6625	// jQuery event objects are copies of DOM event objects. They need
6626	// a little help copying the move properties across.
6627
6628	if (!window.jQuery) { return; }
6629
6630	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6631
6632	function enableMove1(e) { e.enableMove(); }
6633	function enableMove2(e) { e.enableMove(); }
6634	function enableMove3(e) { e.enableMove(); }
6635
6636	function add(handleObj) {
6637		var handler = handleObj.handler;
6638
6639		handleObj.handler = function(e) {
6640			// Copy move properties across from originalEvent
6641			var i = properties.length;
6642			var property;
6643
6644			while(i--) {
6645				property = properties[i];
6646				e[property] = e.originalEvent[property];
6647			}
6648
6649			handler.apply(this, arguments);
6650		};
6651	}
6652
6653	jQuery.event.special.movestart = {
6654		setup: function() {
6655			// Movestart must be enabled to allow other move events
6656			on(this, 'movestart', enableMove1);
6657
6658			// Do listen to DOM events
6659			return false;
6660		},
6661
6662		teardown: function() {
6663			off(this, 'movestart', enableMove1);
6664			return false;
6665		},
6666
6667		add: add
6668	};
6669
6670	jQuery.event.special.move = {
6671		setup: function() {
6672			on(this, 'movestart', enableMove2);
6673			return false;
6674		},
6675
6676		teardown: function() {
6677			off(this, 'movestart', enableMove2);
6678			return false;
6679		},
6680
6681		add: add
6682	};
6683
6684	jQuery.event.special.moveend = {
6685		setup: function() {
6686			on(this, 'movestart', enableMove3);
6687			return false;
6688		},
6689
6690		teardown: function() {
6691			off(this, 'movestart', enableMove3);
6692			return false;
6693		},
6694
6695		add: add
6696	};
6697});
6698
6699  $.fn.twentytwenty = function(options) {
6700    var options = $.extend({
6701      default_offset_pct: 0.5,
6702      orientation: 'horizontal',
6703      before_label: 'Before',
6704      after_label: 'After',
6705      no_overlay: false,
6706      move_slider_on_hover: false,
6707      move_with_handle_only: true,
6708      click_to_move: false
6709    }, options);
6710
6711    return this.each(function() {
6712
6713      var sliderPct = options.default_offset_pct;
6714      var container = $(this);
6715      var sliderOrientation = options.orientation;
6716      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6717      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6718
6719
6720      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6721      if(!options.no_overlay) {
6722        container.append("<div class='twentytwenty-overlay'></div>");
6723        var overlay = container.find(".twentytwenty-overlay");
6724        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6725        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6726      }
6727      var beforeImg = container.find("img:first");
6728      var afterImg = container.find("img:last");
6729      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6730      var slider = container.find(".twentytwenty-handle");
6731      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6732      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6733      container.addClass("twentytwenty-container");
6734      beforeImg.addClass("twentytwenty-before");
6735      afterImg.addClass("twentytwenty-after");
6736
6737      var calcOffset = function(dimensionPct) {
6738        var w = beforeImg.width();
6739        var h = beforeImg.height();
6740        return {
6741          w: w+"px",
6742          h: h+"px",
6743          cw: (dimensionPct*w)+"px",
6744          ch: (dimensionPct*h)+"px"
6745        };
6746      };
6747
6748      var adjustContainer = function(offset) {
6749      	if (sliderOrientation === 'vertical') {
6750          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6751          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6752      	}
6753      	else {
6754          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6755          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6756    	}
6757        container.css("height", offset.h);
6758      };
6759
6760      var adjustSlider = function(pct) {
6761        var offset = calcOffset(pct);
6762        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6763        adjustContainer(offset);
6764      };
6765
6766      // Return the number specified or the min/max number if it outside the range given.
6767      var minMaxNumber = function(num, min, max) {
6768        return Math.max(min, Math.min(max, num));
6769      };
6770
6771      // Calculate the slider percentage based on the position.
6772      var getSliderPercentage = function(positionX, positionY) {
6773        var sliderPercentage = (sliderOrientation === 'vertical') ?
6774          (positionY-offsetY)/imgHeight :
6775          (positionX-offsetX)/imgWidth;
6776
6777        return minMaxNumber(sliderPercentage, 0, 1);
6778      };
6779
6780
6781      $(window).on("resize.twentytwenty", function(e) {
6782        adjustSlider(sliderPct);
6783      });
6784
6785      var offsetX = 0;
6786      var offsetY = 0;
6787      var imgWidth = 0;
6788      var imgHeight = 0;
6789      var onMoveStart = function(e) {
6790        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6791          e.preventDefault();
6792        }
6793        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6794          e.preventDefault();
6795        }
6796        container.addClass("active");
6797        offsetX = container.offset().left;
6798        offsetY = container.offset().top;
6799        imgWidth = beforeImg.width();
6800        imgHeight = beforeImg.height();
6801      };
6802      var onMove = function(e) {
6803        if (container.hasClass("active")) {
6804          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6805          adjustSlider(sliderPct);
6806        }
6807      };
6808      var onMoveEnd = function() {
6809          container.removeClass("active");
6810      };
6811
6812      var moveTarget = options.move_with_handle_only ? slider : container;
6813      moveTarget.on("movestart",onMoveStart);
6814      moveTarget.on("move",onMove);
6815      moveTarget.on("moveend",onMoveEnd);
6816
6817      if (options.move_slider_on_hover) {
6818        container.on("mouseenter", onMoveStart);
6819        container.on("mousemove", onMove);
6820        container.on("mouseleave", onMoveEnd);
6821      }
6822
6823      slider.on("touchmove", function(e) {
6824        e.preventDefault();
6825      });
6826
6827      container.find("img").on("mousedown", function(event) {
6828        event.preventDefault();
6829      });
6830
6831      if (options.click_to_move) {
6832        container.on('click', function(e) {
6833          offsetX = container.offset().left;
6834          offsetY = container.offset().top;
6835          imgWidth = beforeImg.width();
6836          imgHeight = beforeImg.height();
6837
6838          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6839          adjustSlider(sliderPct);
6840        });
6841      }
6842
6843      $(window).trigger("resize.twentytwenty");
6844    });
6845  };
6846
6847
6848  $(window).on("load", function(e) {
6849  	$('.twentytwenty-container').each(function(){
6850  		var $container = $(this);
6851  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6852  			$container.twentytwenty();
6853  		}
6854  		$('img', $container).on('async-done', function(){
6855	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6856	  			$container.twentytwenty();
6857	  		}
6858	    });
6859  	});
6860  });
6861}
6862
6863UNCODE.justifiedGallery = function() {
6864
6865	var breakPointMe = function( val ) {
6866		val = parseInt( val );
6867		if ( isNaN(val) ) {
6868			return false;
6869		}
6870		if ( val >= 1500 ) {
6871			return 1;
6872		} else if ( val < 1500 && val >= 960 ) {
6873			return 2;
6874		} else if ( val < 960 && val >= 570 ) {
6875			return 3;
6876		} else if ( val < 570 ) {
6877			return 4;
6878		}
6879	}
6880
6881	var gutterByBreakpoint = function( bp, gutter ) {
6882		var ret;
6883		switch(gutter) {
6884		    case 'no-gutter':
6885		    	ret = 0;
6886		        break;
6887		    case 'px-gutter':
6888		    	ret = 1;
6889		        break;
6890		    case 'half-gutter':
6891		    	ret = 18;
6892		        break;
6893		    case 'double-gutter':
6894				switch(bp) {
6895				    case 3:
6896				    case 4:
6897				    	ret = 36;
6898				        break;
6899				    default:
6900				    	ret = 72;
6901				        break;
6902				}
6903		        break;
6904		    case 'triple-gutter':
6905				switch(bp) {
6906				    case 3:
6907				    case 4:
6908				    	ret = 36;
6909				        break;
6910				    default:
6911				    	ret = 108;
6912				        break;
6913				}
6914		        break;
6915		    case 'quad-gutter':
6916				switch(bp) {
6917				    case 2:
6918				    	ret = 108;
6919				        break;
6920				    case 3:
6921				    	ret = 72;
6922				        break;
6923				    case 4:
6924				    	ret = 36;
6925				        break;
6926				    default:
6927				    	ret = 144;
6928				        break;
6929				}
6930		        break;
6931		    default:
6932		    	ret = 36;//single-gutter
6933		}
6934		return ret;
6935	}
6936
6937	if ($('.justified-layout').length > 0) {
6938		var justifiedContainersArray = [],
6939			typeGridArray = [],
6940			layoutGridArray = [],
6941			transitionDuration = [],
6942			$filterItems = [],
6943			$filters = $('.justified-system .isotope-filters'),
6944			$itemSelector = '.tmb',
6945			$items,
6946			itemMargin,
6947			correctionFactor = 0,
6948			firstLoad = true,
6949			isOriginLeft = $('body').hasClass('rtl') ? false : true,
6950			prevW = breakPointMe(UNCODE.wwidth);
6951		$('[class*="justified-container"]').each(function() {
6952			var isoData = $(this).data();
6953			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6954			if (isoData.type == 'metro') typeGridArray.push(true);
6955			else typeGridArray.push(false);
6956			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
6957			else layoutGridArray.push('justified');
6958			justifiedContainersArray.push($(this));
6959		});
6960		var init_justifiedGallery = function() {
6961			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
6962				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
6963					justifiedId = justifiedSystem.attr('id'),
6964					$layoutMode = layoutGridArray[i],
6965					gutter = $(justifiedContainersArray[i]).data('gutter'),
6966					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
6967					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
6968					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6969					margins;
6970
6971				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6972				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6973				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6974
6975				margins = gutterByBreakpoint(prevW, gutter);
6976
6977				$(justifiedContainersArray[i]).justifiedGallery({
6978					rowHeight: rowHeight,
6979					maxRowHeight: maxRowHeight,
6980					margins: margins,
6981					cssAnimation: true,
6982					lastRow: lastRow,
6983					waitThumbnailsLoad: false
6984				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6985
6986				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6987					$(justifiedContainersArray[i]).infinitescroll({
6988							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6989							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6990							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6991							animate: false,
6992							behavior: 'local',
6993							debug: false,
6994							loading: {
6995								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6996								speed: 0,
6997								finished: undefined,
6998								msg: $('#' + justifiedId + ' .loadmore-button'),
6999							},
7000							errorCallback: function() {
7001								var justified_system = $(this).closest('.justified-system');
7002								$('.loading-button', justified_system).hide();
7003								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
7004							}
7005						},
7006						// append the new items to galleryJustified on the infinitescroll callback function.
7007						function(newElements, opts) {
7008							var $galleryJustified = $(this),
7009								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
7010								filters = new Array(),
7011								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
7012								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
7013								$numPages = $('a', $infinite_button).data('pages'),
7014								delay = 300;
7015							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7016							$infinite_button.show();
7017							$loading_button.hide();
7018							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7019							$('> li', $galleryJustified).remove();
7020							$.each($(newElements), function(index, val) {
7021								$(val).addClass('tmb-iso');
7022								if ($(val).is("li")) {
7023									filters.push($(val)[0]);
7024								}
7025								$(val).addClass('uncode-appended');
7026							});
7027							newElements = newElements.filter(function(x) {
7028								return filters.indexOf(x) < 0
7029							});
7030							$.each($(filters), function(index, val) {
7031								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
7032							});
7033							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
7034							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7035								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
7036								if (typeof getLightbox === 'object') {
7037									getLightbox.refresh();
7038								} else {
7039									UNCODE.lightbox();
7040								}
7041							}
7042							if ( typeof twttr !== 'undefined' )
7043								twttr.widgets.load(justifiedContainersArray[i]);
7044
7045							requestTimeout(function() {
7046								$galleryJustified.trigger('more-items-loaded');
7047								$(window).trigger('more-items-loaded');
7048								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7049							}, 1000);
7050						});
7051					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
7052						var $infinite_justified = $(justifiedContainersArray[i]),
7053							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
7054						$infinite_justified.infinitescroll('pause');
7055						$infinite_button.on('click', function(event) {
7056							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7057								$.each(UNCODE.lightboxArray, function(index, val) {
7058									UNCODE.lightboxArray[index].destroy();
7059								});
7060							}
7061							event.preventDefault();
7062							var $justified_system = $(event.target).closest('.justified-system'),
7063							$infinite_justified = $justified_system.find('.justified-container'),
7064							justifiedId = $justified_system.attr('id');
7065							$(event.currentTarget).html(SiteParameters.loading);
7066							$infinite_justified.infinitescroll('resume');
7067							$infinite_justified.infinitescroll('retrieve');
7068							$infinite_justified.infinitescroll('pause');
7069							$infinite_justified.trigger('more-items-loaded');
7070							$(window).trigger('more-items-loaded');
7071							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7072						});
7073					}
7074				}
7075			}
7076		},
7077		onLayout = function(justifiedObj, startIndex) {
7078			justifiedObj.css('opacity', 1);
7079			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
7080			$('.tmb', justifiedObj).addClass('justified-object-loaded');
7081
7082			requestTimeout(function() {
7083				// window.dispatchEvent(UNCODE.boxEvent);
7084				UNCODE.adaptive();
7085				if (SiteParameters.dynamic_srcset_active === '1') {
7086					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
7087				}
7088				if (typeof MediaElement === "function") {
7089					$(justifiedObj).find('audio,video').each(function() {
7090						$(this).mediaelementplayer({
7091								pauseOtherPlayers: false,
7092						});
7093					});
7094				}
7095				if ($(justifiedObj).find('.nested-carousel').length) {
7096					if (typeof UNCODE.carousel !== 'undefined') {
7097						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
7098					}
7099					requestTimeout(function() {
7100						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7101						justifiedObj.addClass('justified-gallery-finished')
7102						Waypoint.refreshAll();
7103					}, 200);
7104				} else {
7105					requestTimeout(function() {
7106						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
7107						justifiedObj.addClass('justified-gallery-finished')
7108						Waypoint.refreshAll();
7109					}, 300);
7110				}
7111			}, 100);
7112
7113		},
7114		boxAnimation = function(items, startIndex, sequential, container) {
7115			var $allItems = items.length - startIndex,
7116				showed = 0,
7117				index = 0;
7118			if (container.closest('.owl-item').length == 1) return false;
7119			$.each(items, function(index, val) {
7120				var elInner = $('> .t-inside', val);
7121				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
7122					return;
7123				}
7124				if (val[0]) val = val[0];
7125				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
7126					new Waypoint({
7127						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
7128						element: val,
7129						handler: function() {
7130							var element = $('> .t-inside', this.element),
7131								parent = $(this.element),
7132								currentIndex = parent.index();
7133							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
7134								delayAttr = parseInt(element.attr('data-delay'));
7135							if (isNaN(delayAttr)) delayAttr = 100;
7136							delay -= showed;
7137							var objTimeout = requestTimeout(function() {
7138								element.removeClass('zoom-reverse').addClass('start_animation');
7139								showed = parent.index();
7140							}, delay * delayAttr);
7141							parent.data('objTimeout', objTimeout);
7142							if (!UNCODE.isUnmodalOpen) {
7143								this.destroy();
7144							}
7145						},
7146						offset: '100%'
7147					})
7148				} else {
7149					elInner.removeClass('animate_when_almost_visible');
7150					$(val).addClass('no-waypoint-animation');
7151					/*if (elInner.hasClass('force-anim')) {
7152						elInner.addClass('start_animation');
7153					} else {
7154						elInner.css('opacity', 1);
7155					}*/
7156				}
7157				index++;
7158			});
7159		};
7160		$filters.on('click', 'a[data-filter]', function(evt) {
7161			var $filter = $(this),
7162				filterContainer = $filter.closest('.isotope-filters'),
7163				filterValue = $filter.attr('data-filter'),
7164				container = $filter.closest('.justified-system').find($('.justified-layout')),
7165				lastRow = container.data('last-row'),
7166				transitionDuration = 0,
7167				delay = 300,
7168				filterItems = [];
7169
7170			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
7171
7172			var filter_items = function(){
7173				if (filterValue !== undefined) {
7174					$.each($('> .tmb > .t-inside', container), function(index, val) {
7175						var parent = $(val).parent(),
7176							objTimeout = parent.data('objTimeout');
7177						if (objTimeout) {
7178							$(val).removeClass('zoom-reverse');
7179							clearRequestTimeout(objTimeout);
7180						}
7181						if (transitionDuration == 0) {
7182							if ($(val).hasClass('animate_when_almost_visible')) {
7183								$(val).addClass('zoom-reverse').removeClass('start_animation');
7184							} else {
7185								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7186							}
7187						}
7188					});
7189
7190					requestTimeout(function() {
7191						var $block,
7192							selector,
7193							lightboxElements,
7194							$boxes;
7195
7196						if ( filterValue !== '' && filterValue !== '*' ) {
7197							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
7198							selector = '.' + filterValue;
7199							$.each($(selector, container), function(index, block) {
7200								lightboxElements = $('[data-lbox^=ilightbox]', block);
7201								if (lightboxElements.length) {
7202									lightboxElements.removeClass('lb-disabled');
7203									container.data('lbox', $(lightboxElements[0]).data('lbox'));
7204								}
7205								filterItems.push(block);
7206							});
7207							container.justifiedGallery({
7208								filter: selector,
7209								lastRow: 'nojustify'
7210							});
7211						} else {
7212							container.justifiedGallery({
7213								filter: false,
7214								lastRow: lastRow
7215							});
7216							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
7217							filterItems = $('> .tmb', container);
7218						}
7219						container.trigger('more-items-loaded');
7220						$(window).trigger('more-items-loaded');
7221						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7222
7223						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7224						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7225							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
7226							if (typeof getLightbox === 'object') {
7227								getLightbox.refresh();
7228							} else {
7229								UNCODE.lightbox();
7230							}
7231						}
7232
7233						if (transitionDuration == 0) {
7234							requestTimeout(function() {
7235								boxAnimation(filterItems, 0, false, container);
7236							}, 100);
7237						}
7238						requestTimeout(function() {
7239							Waypoint.refreshAll();
7240							container.trigger('more-items-loaded');
7241							$(window).trigger('more-items-loaded');
7242							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7243							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
7244								$(document).trigger('uncode-scrolltrigger-refresh');
7245							}
7246						}, 2000);
7247
7248					}, delay);
7249				} else {
7250					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7251						$.each(UNCODE.lightboxArray, function(index, val) {
7252							UNCODE.lightboxArray[index].destroy();
7253						});
7254					}
7255					$.each($('> .tmb > .t-inside', container), function(index, val) {
7256						var parent = $(val).parent(),
7257							objTimeout = parent.data('objTimeout');
7258						if (objTimeout) {
7259							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7260							clearRequestTimeout(objTimeout);
7261						}
7262						if (transitionDuration == 0) {
7263							if ($(val).hasClass('animate_when_almost_visible')) {
7264								$(val).addClass('zoom-reverse').removeClass('start_animation');
7265							} else {
7266								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7267							}
7268						}
7269					});
7270					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7271						UNCODE.lightbox();
7272					}
7273					container.parent().addClass('justified-loading');
7274					container.trigger('more-items-loaded');
7275					$(window).trigger('more-items-loaded');
7276					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7277				}
7278			};
7279
7280			if (!$filter.hasClass('active')) {
7281				/** Scroll top with filtering */
7282				if (filterContainer.hasClass('filter-scroll')) {
7283                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7284                    calc_scroll -= UNCODE.get_scroll_offset();
7285
7286					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7287						delta = bodyTop - calc_scroll,
7288						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7289						filterTolerance = false,
7290						filter_timeout;
7291					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7292
7293					if ( !UNCODE.isFullPage ) {
7294						if (scrollSpeed == 0) {
7295							$('html, body').scrollTop(calc_scroll);
7296							UNCODE.scrolling = false;
7297							filter_items();
7298						} else {
7299
7300							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7301								filter_items();
7302								filterTolerance = true;
7303							}
7304
7305							$('html, body').animate({
7306								scrollTop: calc_scroll
7307							},{
7308								easing: 'easeInOutQuad',
7309								duration: scrollSpeed,
7310								complete: function(){
7311									UNCODE.scrolling = false;
7312									if ( !filterTolerance ) {
7313										filter_timeout = setTimeout(function(){
7314											clearTimeout(filter_timeout);
7315											filter_items();
7316										}, 200);
7317									}
7318								}
7319							});
7320						}
7321					}
7322				} else {
7323					filter_items();
7324				}
7325			}
7326			evt.preventDefault();
7327		});
7328
7329		$filters.each(function(i, buttonGroup) {
7330			var $buttonGroup = $(buttonGroup);
7331			$buttonGroup.on('click', 'a', function() {
7332				$buttonGroup.find('.active').removeClass('active');
7333				$(this).addClass('active');
7334			});
7335
7336			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7337				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7338				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7339			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7340				e.preventDefault();
7341				$cats_filters.slideToggle(400, 'easeInOutCirc');
7342			});
7343		});
7344		window.addEventListener('boxResized', function(e) {
7345			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
7346				prevW = breakPointMe(UNCODE.wwidth);
7347				$.each($('.justified-layout'), function(index, val) {
7348					var gutter = $(this).data('gutter'),
7349						margins = gutterByBreakpoint( prevW, gutter);
7350					$(this).justifiedGallery({
7351						margins: margins
7352					});
7353					$(this).find('.mejs-video,.mejs-audio').each(function() {
7354						$(this).trigger('resize');
7355					});
7356				});
7357			}
7358		}, false);
7359
7360		init_justifiedGallery();
7361	};
7362};
7363
7364UNCODE.cssGrid = function() {
7365	if ($('.cssgrid-layout').length > 0) {
7366		var cssGridContainersArray = [];
7367		var transitionDuration = [];
7368		var $filters = $('.cssgrid-system .cssgrid-filters');
7369
7370		$('[class*="cssgrid-container"]').each(function() {
7371			cssGridContainersArray.push($(this));
7372			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
7373		});
7374
7375		var init_cssGridAjax = function() {
7376			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
7377				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
7378					cssGridId = cssGridSystem.attr('id');
7379
7380				cssGridSystem.data('transitionDuration', transitionDuration[i]);
7381
7382				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
7383					$(cssGridContainersArray[i]).infinitescroll({
7384						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
7385						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
7386						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
7387						animate: false,
7388						behavior: 'local',
7389						debug: false,
7390						loading: {
7391							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
7392							speed: 0,
7393							finished: undefined,
7394							msg: $('#' + cssGridId + ' .loadmore-button'),
7395						},
7396						errorCallback: function() {
7397							var cssgrid_system = $(this).closest('.cssgrid-system');
7398							$('.loading-button', cssgrid_system).hide();
7399							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
7400						}
7401					},
7402					// append the new items to cssGrid on the infinitescroll callback function.
7403					function(newElements, opts) {
7404						var $cssGrid = $(this),
7405							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
7406							cssGridId = cssGridSystemCont.attr('id'),
7407							filters = new Array(),
7408							$loading_button = cssGridSystemCont.find('.loading-button'),
7409							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
7410							$numPages = $('a', $infinite_button).data('pages'),
7411							$woo_results,
7412							delay = 300;
7413						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
7414						$infinite_button.show();
7415						$loading_button.hide();
7416						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
7417						$('> li', $cssGrid).remove();
7418						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
7419						$.each($(newElements), function (index, val) {
7420							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
7421								$woo_results = $(val);
7422								delete newElements[index];
7423							} else {
7424								$(val).addClass('tmb-grid');
7425								if ($(val).is("li")) {
7426									filters.push($(val)[0]);
7427								}
7428							}
7429							$(val).addClass('uncode-appended');
7430						});
7431						newElements = newElements.filter(function(x) {
7432							return filters.indexOf(x) < 0
7433						});
7434						$.each($(filters), function(index, val) {
7435							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
7436						});
7437						if ($woo_results && $woo_results.length > 0) {
7438							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
7439							var new_count = $woo_results.find('.woocommerce-result-count').text();
7440							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
7441							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
7442							function replaceMatch(match, p1, p2) {
7443        						return old_start + '–' + new_end;
7444							}
7445							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
7446							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
7447						}
7448
7449						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
7450						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
7451						if (filterValue !== undefined && filterValue != '*') {
7452							$(newElements).hide();
7453							var els_to_show = $();
7454							$(newElements).each(function() {
7455								var el = $(this);
7456								if (el.hasClass(filterValue)) {
7457									els_to_show = els_to_show.add(el);
7458									el.show();
7459								}
7460							});
7461							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
7462						} else {
7463							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
7464						}
7465
7466						UNCODE.adaptive();
7467						if (SiteParameters.dynamic_srcset_active === '1') {
7468							UNCODE.refresh_dynamic_srcset_size($cssGrid);
7469						}
7470						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7471							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
7472							if (typeof getLightbox === 'object') {
7473								getLightbox.refresh();
7474							} else {
7475								UNCODE.lightbox();
7476							}
7477						}
7478						if ( typeof twttr !== 'undefined' ) {
7479							twttr.widgets.load(cssGridContainersArray[i]);
7480						}
7481
7482						UNCODE.carousel($(newElements));
7483						requestTimeout(function() {
7484							$cssGrid.trigger('more-items-loaded');
7485							$(window).trigger('more-items-loaded');
7486							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7487						}, 1000);
7488
7489					});
7490					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
7491						var $cssgrid_el = $(cssGridContainersArray[i]),
7492							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
7493						$cssgrid_el.infinitescroll('pause');
7494						$infinite_button.on('click', function(event) {
7495							event.preventDefault();
7496							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
7497							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
7498							cssGridId = $cssgrid_system.attr('id');
7499							$(event.currentTarget).html(SiteParameters.loading);
7500							$cssgrid_el.infinitescroll('resume');
7501							$cssgrid_el.infinitescroll('retrieve');
7502							$cssgrid_el.infinitescroll('pause');
7503						});
7504					}
7505				}
7506			}
7507		};
7508
7509		init_cssGridAjax();
7510
7511		if ($('.cssgrid-pagination').length > 0) {
7512			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
7513				evt.preventDefault();
7514
7515				if (SiteParameters.index_pagination_disable_scroll !== '1') {
7516					var container = $(this).closest('.cssgrid-system'),
7517						pagination_disable_scroll = container.attr('data-pagination-scroll'),
7518						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7519
7520					if ( pagination_disable_scroll !== 'disabled' ) {
7521						calc_scroll -= UNCODE.get_scroll_offset();
7522
7523						var menu_container = $('.menu-sticky');
7524						var menu = menu_container.find('.menu-container');
7525
7526						if (menu_container.length > 0 && menu.length > 0) {
7527							calc_scroll = calc_scroll - menu.outerHeight();
7528						}
7529
7530						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7531							delta = bodyTop - calc_scroll,
7532							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7533						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7534
7535						if ( !UNCODE.isFullPage ) {
7536							if (scrollSpeed == 0) {
7537								$('html, body').scrollTop(calc_scroll);
7538							} else {
7539								$('html, body').animate({
7540									scrollTop: calc_scroll
7541								},{
7542									easing: 'easeInOutQuad',
7543									duration: scrollSpeed,
7544									complete: function(){
7545										UNCODE.scrolling = false;
7546									}
7547								});
7548							}
7549						}
7550					}
7551				}
7552
7553				loadCssGrid($(this), true);
7554			});
7555		}
7556
7557		$filters.on('click', 'a.grid-nav-link', function(evt) {
7558			if ($(this).hasClass('no-grid-filter')) {
7559				return;
7560			}
7561			var $filter = $(this),
7562				filterContainer = $filter.closest('.cssgrid-filters'),
7563				filterValue = $filter.attr('data-filter'),
7564				containerSystem = $filter.closest('.cssgrid-system'),
7565				container = containerSystem.find($('.cssgrid-layout')),
7566				transitionDuration = containerSystem.data('transitionDuration'),
7567				delay = 300,
7568				filterItems = [],
7569				all_thumbs = container.find('.tmb-grid');
7570
7571			var filter_items = function(){
7572				if (filterValue !== undefined) {
7573					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7574						var parent = $(val).parent(),
7575							objTimeout = parent.data('objTimeout');
7576						if (objTimeout) {
7577							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7578							clearRequestTimeout(objTimeout);
7579						}
7580						if (transitionDuration == 0) {
7581							if ($(val).hasClass('animate_when_almost_visible')) {
7582								$(val).addClass('zoom-reverse').removeClass('start_animation');
7583							} else {
7584								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7585							}
7586						}
7587					});
7588					requestTimeout(function(){
7589						if ( filterValue == '*' ) {
7590							all_thumbs.show();
7591							all_thumbs.each(function(index, val) {
7592								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7593								filterItems.push($(this));
7594							});
7595						} else {
7596							all_thumbs.each(function() {
7597								var _tmb = $(this);
7598								if (_tmb.hasClass(filterValue)) {
7599									_tmb.show();
7600									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7601									filterItems.push(_tmb);
7602								} else {
7603									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7604									_tmb.hide();
7605								}
7606							});
7607						}
7608
7609						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7610
7611						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7612						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7613						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7614						if (lightboxElements.length) {
7615							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7616							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7617								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7618								if (typeof getLightbox === 'object') {
7619									getLightbox.refresh();
7620								} else {
7621									UNCODE.lightbox();
7622								}
7623							}
7624						}
7625						container.trigger('more-items-loaded');
7626						$(window).trigger('more-items-loaded');
7627						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7628					}, delay);
7629				} else {
7630					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7631						var parent = $(val).parent(),
7632							objTimeout = parent.data('objTimeout');
7633						if (objTimeout) {
7634							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7635							clearRequestTimeout(objTimeout);
7636						}
7637						if (transitionDuration == 0) {
7638							if ($(val).hasClass('animate_when_almost_visible')) {
7639								$(val).addClass('zoom-reverse').removeClass('start_animation');
7640							} else {
7641								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7642							}
7643						}
7644					});
7645					loadCssGrid($filter);
7646				}
7647			};
7648
7649			if (!$filter.hasClass('active')) {
7650				/** Scroll top with filtering */
7651				if (filterContainer.hasClass('filter-scroll')) {
7652                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7653                    calc_scroll -= UNCODE.get_scroll_offset();
7654
7655					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7656						delta = bodyTop - calc_scroll,
7657						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7658						filterTolerance = false,
7659						filter_timeout;
7660					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7661
7662					if ( !UNCODE.isFullPage ) {
7663						if (scrollSpeed == 0) {
7664							$('html, body').scrollTop(calc_scroll);
7665							UNCODE.scrolling = false;
7666							filter_items();
7667						} else {
7668
7669							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7670								filter_items();
7671								filterTolerance = true;
7672							}
7673
7674							$('html, body').animate({
7675								scrollTop: calc_scroll
7676							},{
7677								easing: 'easeInOutQuad',
7678								duration: scrollSpeed,
7679								complete: function(){
7680									UNCODE.scrolling = false;
7681									if ( !filterTolerance ) {
7682										filter_timeout = setTimeout(function(){
7683											clearTimeout(filter_timeout);
7684											filter_items();
7685										}, 200);
7686									}
7687								}
7688							});
7689						}
7690					}
7691				} else {
7692					filter_items();
7693				}
7694			}
7695			evt.preventDefault();
7696		});
7697
7698		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7699			var params = UNCODE.getURLParams(window.location);
7700			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7701
7702			UNCODE.lastURL = window.location.href;
7703
7704			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
7705				return;
7706			}
7707
7708			if (params.id === undefined) {
7709				$.each($('.cssgrid-system'), function(index, val) {
7710					loadCssGrid($(val));
7711				});
7712			} else {
7713				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7714					loadCssGrid($('#' + params.id));
7715				}
7716			}
7717		});
7718
7719		var loadCssGrid = function($href, $paginating) {
7720			var is_paginating = false;
7721
7722			if (undefined !== $paginating && $paginating) {
7723				var is_paginating = $paginating;
7724			}
7725
7726			var href = ($href.is("a") ? $href.attr('href') : location),
7727				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7728				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7729				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7730				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7731				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7732				cssgridId = cssgridSystem.attr('id');
7733			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7734				UNCODE.lastURL = href;
7735				history.pushState({
7736					myCSSgrid: true
7737				}, document.title, href);
7738			}
7739			cssgridWrapper.addClass('cssgrid-loading');
7740			if (is_paginating) {
7741				cssgridWrapper.addClass('grid-filtering');
7742			}
7743			$.ajax({
7744				url: href
7745			}).done(function(data) {
7746				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7747					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7748					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7749				requestTimeout(function() {
7750					cssgridContainer.html($resultItems);
7751					cssgridWrapper.removeClass('cssgrid-loading');
7752					cssgridWrapper.removeClass('grid-filtering');
7753					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7754					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7755					UNCODE.adaptive();
7756					if (SiteParameters.dynamic_srcset_active === '1') {
7757						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7758					}
7759					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7760						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7761						if (typeof getLightbox === 'object') {
7762							getLightbox.refresh();
7763						} else {
7764							UNCODE.lightbox();
7765						}
7766					}
7767					cssgridContainer.trigger('more-items-loaded');
7768					$(window).trigger('more-items-loaded');
7769					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7770				}, 300);
7771
7772				$('.pagination', cssgridFooter).remove();
7773				cssgridFooter.append($resultPagination);
7774
7775				if (cssgridResultCount.length > 0) {
7776					$('.woocommerce-result-count', cssgridResultCount).remove();
7777					cssgridResultCount.append($resultCount);
7778				}
7779			});
7780		};
7781
7782		$filters.each(function(i, buttonGroup) {
7783			var $buttonGroup = $(buttonGroup);
7784			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7785				$buttonGroup.find('.active').removeClass('active');
7786				$(this).addClass('active');
7787
7788			});
7789
7790			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7791				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7792				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7793			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7794				e.preventDefault();
7795				$cats_filters.slideToggle(400, 'easeInOutCirc');
7796			});
7797
7798		});
7799	};
7800};
7801
7802UNCODE.linearGrid = function(){
7803	$('.linear-wrapper').each(function(){
7804		var $wrap = $(this),
7805			$system = $wrap.closest('.linear-system'),
7806			$dragger = $('[data-dragger]', $system),
7807			$row = $wrap.closest('.vc_row[data-parent]'),
7808			_row = $row[0],
7809			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7810			vertical = $cont.hasClass('linear-or-vertical'),
7811			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7812			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7813			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7814			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7815			isInMenu = $wrap.closest('.megamenu-block-wrapper').length,
7816			isInViewport = false,
7817			isHover = false,
7818			init = false,
7819			stableHeight = UNCODE.wheight,
7820			wCont, hCont, docH, marqueeTL;
7821
7822		if ( ! $('.tmb', $cont).length ) {
7823			return;
7824		}
7825
7826		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7827		var dataX = dataSpeed;
7828
7829		dataSpeed += 5;
7830
7831		var checkLinearGridSize = function(){
7832			if ( !$wrap.is(':visible') )  {
7833				return;
7834			}
7835			$wrap.find('.cont-appended').remove();
7836
7837			if ( vertical ) {
7838				if ( ! SiteParameters.is_frontend_editor ) {
7839					hCont = $cont.outerHeight();
7840					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7841					if ( hCont < docH ) {
7842						var res = docH - hCont * 3,
7843							times = 2 * Math.round((res/hCont+1) / 2);
7844					}
7845					for ( var i = 0; i < times; i++ ) {
7846						var $cloneCont = $cont.clone(),
7847							$cloneCont2 = $cont.clone(),
7848							trans = ( (i+2) ) * 100;
7849						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7850						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7851						$cloneCont.find('a[data-lbox]').each(function(){
7852							var dataLbox = $(this).attr('data-lbox');
7853							$(this).attr('data-lbox', dataLbox + '_' + i);
7854						});
7855						$cloneCont.find('.wp-video-shortcode').each(function(){
7856							var thisID = $(this).attr('id');
7857							$(this).attr('id', thisID + '_' + i);
7858						});
7859						$cloneCont2.find('a[data-lbox]').each(function(){
7860							var dataLbox = $(this).attr('data-lbox');
7861							$(this).attr('data-lbox', dataLbox + '_2' + i);
7862						});
7863						$cloneCont2.find('.wp-video-shortcode').each(function(){
7864							var thisID = $(this).attr('id');
7865							$(this).attr('id', thisID + '__' + i);
7866						});
7867						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7868							UNCODE.lightgallery($cloneCont);
7869							UNCODE.lightgallery($cloneCont2);
7870						}
7871					}
7872                }
7873			} else {
7874				wCont = $cont.outerWidth();
7875				if ( (wCont) < UNCODE.wwidth*2 ) {
7876					var res = UNCODE.wwidth*2 - (wCont),
7877						times = 2 * Math.round((res/wCont+1) / 2);
7878				}
7879				for ( var i = 0; i < times; i++ ) {
7880					var $cloneCont = $cont.clone(),
7881						$cloneCont2 = $cont.clone(),
7882						trans = ( (i+2) ) * 100;
7883					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7884					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7885					$cloneCont.find('a[data-lbox]').each(function(){
7886						var dataLbox = $(this).attr('data-lbox');
7887						$(this).attr('data-lbox', dataLbox + '_' + i);
7888					});
7889					$cloneCont.find('[id]').each(function(){
7890						var thisID = $(this).attr('id');
7891						$(this).attr('id', thisID + '_' + i);
7892					});
7893					$cloneCont2.find('a[data-lbox]').each(function(){
7894						var dataLbox = $(this).attr('data-lbox');
7895						$(this).attr('data-lbox', dataLbox + '_2' + i);
7896					});
7897					$cloneCont2.find('[id]').each(function(){
7898						var thisID = $(this).attr('id');
7899						$(this).attr('id', thisID + '__' + i);
7900					});
7901                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
7902                        UNCODE.lightgallery($cloneCont);
7903                        UNCODE.lightgallery($cloneCont2);
7904                    }
7905                }
7906			}
7907		};
7908		if ( clone ) {
7909			checkLinearGridSize();
7910			$(window).on('resize.linearGrid', function(){
7911				checkLinearGridSize();
7912			});
7913		}
7914
7915		var continuousLinearMarquee = function(_xStrt){
7916			if ( !$wrap.is(':visible') )  {
7917				return;
7918			}
7919			var ease = 'none';
7920			wCont = $cont.outerWidth();
7921			hCont = $cont.outerHeight();
7922
7923			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
7924				xEnd = vertical ? hCont : wCont,
7925				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7926				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
7927				speedSlow = (xEnd + xStrt) / 45,
7928				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7929
7930			marqueeTL = new TimelineMax({paused:true, reversed:true});
7931
7932			if ( (isInViewport && !isHover && !freezed) || isInMenu ) {
7933				marqueeTL.play();
7934
7935				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
7936					var $column = $wrap.closest('.wpb_column'),
7937						$col_link = $('.col-link', $column),
7938						$hover_sel = $wrap;
7939
7940					if ( $col_link.length ) {
7941						$hover_sel = $wrap.add($column);
7942					}
7943
7944					$hover_sel.on('mouseover', function(){
7945						if ( $wrap.attr('data-hover') === 'yes' ) {
7946							//speed = ( 10 - dataSpeed ) * 5;
7947							ease = 'power2.out';
7948							marqueeTL.duration( speedSlow );
7949						} else {
7950							marqueeTL.pause();
7951						}
7952						isHover = true;
7953					}).on('mouseout', function(){
7954						if ( $wrap.attr('data-hover') === 'yes' ) {
7955							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
7956							ease = 'power2.in';
7957							marqueeTL.duration( speed );
7958						} else {
7959							marqueeTL.play();
7960						}
7961						isHover = false;
7962					});
7963				}
7964
7965				$(document).on('sub-menu-slide-up', function(){
7966					if ( isInMenu ) {
7967						marqueeTL.pause();
7968					}
7969				});
7970
7971			}
7972	
7973			gsap.killTweensOf($wrap);
7974			if ( vertical ) {
7975				marqueeTL.fromTo( $wrap, {
7976					y: xStrt * direction
7977				},
7978				{
7979					duration: speed,
7980					y: xEnd * direction * -1,
7981					onComplete: function(){
7982						continuousLinearMarquee();
7983					},
7984					ease: ease,
7985					paused: freezed
7986				});
7987			} else {
7988				marqueeTL.fromTo( $wrap, {
7989					x: xStrt * direction
7990				},
7991				{
7992					duration: speed,
7993					x: xEnd * direction * -1,
7994					onComplete: function(){
7995						continuousLinearMarquee();
7996					},
7997					ease: ease,
7998					paused: freezed
7999				});
8000			}
8001		};
8002
8003		var dragLinearContinuous = function(){
8004			if ( !$wrap.is(':visible') )  {
8005				return;
8006			}
8007			var matrix, _x, _y,
8008				dragAction = false;
8009			Draggable.create($wrap[0], {
8010				type: vertical ? "y" : "x",
8011				bounds: document.getElementById("container"),
8012				inertia: false,
8013				onPress: function (e) {
8014				},
8015				onRelease: function (e) {
8016					if ( dragAction === true ) {
8017						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8018						_x = matrix[12] || matrix[4];
8019						_y = matrix[13] || matrix[5];
8020						if ( vertical ) {
8021							continuousLinearMarquee(_y * -1);
8022						} else {
8023							continuousLinearMarquee(_x * -1);
8024						}
8025						$wrap.removeClass('linear-dragging');
8026					}
8027				},
8028				onDrag: function (e) {
8029					dragAction = true;
8030					$wrap.addClass('linear-dragging');
8031				},
8032				onDragEnd: function (e) {
8033					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8034					_x = matrix[12] || matrix[4];
8035					_y = matrix[13] || matrix[5];
8036					wCont = $cont.outerWidth();
8037					hCont = $cont.outerHeight();
8038					if ( vertical ) {
8039						if ( Math.abs(_y) > hCont ) {
8040							if ( _y < 0 ) {
8041								_y = hCont + parseFloat( _y );
8042							} else {
8043								_y = parseFloat( _y ) - hCont;
8044							}
8045						}
8046						continuousLinearMarquee(_y * -1);
8047					} else {
8048						if ( Math.abs(_x) > wCont ) {
8049							if ( _x < 0 ) {
8050								_x = wCont + parseFloat( _x );
8051							} else {
8052								_x = parseFloat( _x ) - wCont;
8053							}
8054						}
8055						continuousLinearMarquee(_x * -1);
8056					}
8057					$wrap.removeClass('linear-dragging');
8058					dragAction = false;
8059				},
8060			});
8061		};
8062
8063		var runScrollLinear = function(){
8064			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
8065			if ( (!$wrap.is(':visible') || freezed) )  {
8066				return;
8067			}
8068			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
8069				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
8070			
8071			var linearGridScroll = function(){
8072				if ( isInViewport ) {
8073					var bound = _row.getBoundingClientRect();
8074
8075					var bound_top = bound.top,
8076						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
8077
8078					if ( vertical ) {
8079						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8080					} else {
8081						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
8082					}
8083					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8084						requestAnimationFrame(linearGridScroll);
8085					}
8086				}
8087				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
8088					window.addEventListener("scroll", linearGridScroll);
8089				}
8090			};
8091
8092			$(window).on( 'load wwResize', function(e) {
8093				stableHeight = UNCODE.wheight;
8094				linearGridScroll();
8095			});
8096			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8097				requestAnimationFrame(linearGridScroll);
8098			}
8099		};
8100		
8101		var dragLinear = function(){
8102			if ( !$wrap.is(':visible') )  {
8103				return;
8104			}
8105			var matrix, _x, _y;
8106			Draggable.create($dragger[0], {
8107				type: vertical ? "y" : "x",
8108				bounds: document.getElementById("container"),
8109				inertia: false,
8110				onPress: function (e) {
8111				},
8112				onRelease: function (e) {
8113				},
8114				onDrag: function (e) {
8115					$wrap.addClass('linear-dragging');
8116				},
8117				onDragEnd: function (e) {
8118					matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
8119					_x = matrix[12] || matrix[4];
8120					_y = matrix[13] || matrix[5];
8121					wCont = $cont.outerWidth();
8122					hCont = $cont.outerHeight();
8123					if ( vertical ) {
8124						if ( Math.abs(_y) > hCont ) {
8125							if ( _y < 0 ) {
8126								_y = hCont + parseFloat( _y );
8127							} else {
8128								_y = parseFloat( _y ) - hCont;
8129							}
8130							gsap.to( $dragger[0], {
8131								duration: 0,
8132								y: _y,
8133							});
8134						}
8135					} else {
8136						if ( Math.abs(_x) > wCont ) {
8137							if ( _x < 0 ) {
8138								_x = wCont + parseFloat( _x );
8139							} else {
8140								_x = parseFloat( _x ) - wCont;
8141							}
8142							gsap.to( $dragger[0], {
8143								duration: 0,
8144								x: _x,
8145							});
8146						}
8147					}
8148					$wrap.removeClass('linear-dragging');
8149				},
8150			});
8151		};
8152
8153		if ( ! $('body').hasClass('compose-mode') ) {
8154			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
8155				continuousLinearMarquee();
8156				$(window).on( 'wwResize', function(e) {
8157					continuousLinearMarquee();
8158				});	
8159				$(document).on('sub-menu-slide-down', function(){
8160					if ( isInMenu ) {
8161						continuousLinearMarquee();
8162					}
8163				});
8164				if ( $wrap.attr('data-draggable') === 'yes' ) {
8165					dragLinearContinuous();
8166				}
8167			}
8168
8169			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8170				runScrollLinear();
8171				if ( $wrap.attr('data-draggable') === 'yes' ) {
8172					dragLinear();
8173				}
8174			}
8175
8176			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
8177				var observer = new IntersectionObserver(function(entries) {
8178						
8179					entries.forEach(function(entry){
8180						if ( entry.isIntersecting ) {
8181							isInViewport = true;
8182							if ( !init ) {
8183								init = true;
8184								continuousLinearMarquee();
8185							} else {
8186								if ( typeof marqueeTL !== 'undefined' ) {
8187									marqueeTL.play();
8188								}
8189							}
8190							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
8191								requestAnimFrame(runScrollLinear);
8192							}
8193						} else {
8194							isInViewport = false;
8195							if ( typeof marqueeTL !== 'undefined' ) {
8196								marqueeTL.pause();
8197							}
8198						}
8199					});
8200				}, { 
8201					root: document,
8202				});
8203
8204				observer.observe(_row);
8205
8206			} else {
8207
8208				var checkVisible = function( el, off ) {
8209					if (typeof jQuery === "function" && el instanceof jQuery) {
8210						el = el[0];
8211					}
8212			
8213					off = typeof off=='undefined' ? 50 : off;
8214			
8215					var rect = el.getBoundingClientRect();
8216			
8217					return (
8218						(
8219							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8220							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8221							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8222						)
8223					);
8224				};
8225				
8226				var checkVisibility = function(){
8227
8228					if ( checkVisible($row) ) {
8229						isInViewport = true;
8230						if ( typeof marqueeTL !== 'undefined' ) {
8231							marqueeTL.play();
8232						}
8233					} else {
8234						isInViewport = false;
8235						if ( typeof marqueeTL !== 'undefined' ) {
8236							marqueeTL.pause();
8237						}
8238					}
8239				}
8240
8241				window.addEventListener("scroll", checkVisibility);
8242				checkVisibility();
8243
8244			}
8245		}
8246	});
8247};
8248UNCODE.preventDoubleTransition = function() {
8249	$('.sticky-element .animate_when_almost_visible').each(function(){
8250		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
8251			$el.addClass('do_not_reanimate');
8252		});
8253	});
8254};
8255
8256UNCODE.checkScrollForTabs = function(){
8257	var goToSection = window.location.hash.replace('#', ''),
8258		$index;
8259
8260	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
8261	goToSection = encodeURIComponent(goToSection);
8262	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
8263
8264	$index.attr('data-parent', 'parent-' + goToSection);
8265
8266	if (window.location.hash != undefined && window.location.hash != '') {
8267		requestTimeout(function() {
8268			scrollBody('parent-' + goToSection);
8269		}, 500);
8270	}
8271
8272	$('.page-body a[href^="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
8273		var hash = (e.currentTarget).hash;
8274		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
8275			$('a[href="' + hash + '"][data-tab-history]').click();
8276			scrollBody(hash);
8277		}
8278	});
8279
8280	var scrollBody = function(index) {
8281
8282		var getSection = $('a[href="' + index + '"][data-tab-history]'),
8283			scrollTo,
8284			safeGap = 27;
8285
8286		if ( ! getSection.length ) {
8287			getSection = $('div[data-parent="' + index + '"]');
8288
8289			if ( getSection.attr('data-target') == 'row' ) {
8290				getSection = getSection.closest('.vc_row');
8291				safeGap = 0;
8292			}
8293		}
8294
8295		if (typeof getSection === 'undefined' || ! getSection.length ) {
8296			return;
8297		}
8298
8299		var body = $("html, body"),
8300		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
8301		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
8302		getOffset = UNCODE.get_scroll_offset();
8303		if ( typeof getSection.offset() === 'undefined' )
8304			return;
8305		scrollTo = getSection.offset().top - safeGap;
8306		scrollTo -= getOffset;
8307
8308		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
8309		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
8310
8311		if (index != 0) {
8312			UNCODE.scrolling = true;
8313		}
8314
8315		if (scrollSpeed == 0) {
8316			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
8317			UNCODE.scrolling = false;
8318		} else {
8319			body.animate({
8320				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
8321			}, scrollSpeed, 'easeInOutQuad', function() {
8322				requestTimeout(function() {
8323					UNCODE.scrolling = false;
8324					if (getOffset != UNCODE.get_scroll_offset()) {
8325						scrollBody(index);
8326					}
8327				}, 100);
8328			});
8329		}
8330
8331	};
8332};
8333
8334UNCODE.printScreen = function() {
8335	var inlineMediaStyle = null,
8336		setResize;
8337
8338    function changeMediaStyle() {
8339		clearRequestTimeout(setResize);
8340		setResize = requestTimeout(function(){
8341	        var $head = document.getElementsByTagName('head')[0],
8342	        	$newStyle = document.createElement('style'),
8343	        	winW = window.innerWidth,
8344	        	printH = window.innerHeight;
8345
8346	        $newStyle.setAttribute('type', 'text/css');
8347	        $newStyle.setAttribute('media', 'print');
8348	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
8349
8350	        if (inlineMediaStyle != null) {
8351	            $head.replaceChild($newStyle, inlineMediaStyle)
8352	        } else {
8353	            $head.appendChild($newStyle);
8354	        }
8355	        inlineMediaStyle = $newStyle;
8356	    }, 1000);
8357    }
8358
8359    changeMediaStyle();
8360    window.addEventListener('resize', changeMediaStyle);
8361};
8362
8363UNCODE.fullPage = function() {
8364	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
8365		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
8366		return false;
8367	} else {
8368		requestTimeout(function() {
8369			window.scrollTo(0, 0);
8370		}, 10);
8371	}
8372
8373	var $masthead = $('#masthead'),
8374		$logo = $('#logo-container-mobile'),
8375		$logolink = $('[data-minheight]', $logo),
8376		logoMinScale = $logolink.data('minheight'),
8377		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
8378		$container = $('.main-container .post-content'),
8379		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
8380		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
8381		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
8382		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
8383		headerWithOpacity = $('.header-scroll-opacity', $header).length,
8384		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
8385		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
8386		scrollBar = true,
8387		effect,
8388		animationEndTimeOut,
8389		fp_anim_time = 900,
8390		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
8391		is_scrolling = false,
8392		dataNames = [],
8393		is_first = true,
8394		no_history = $('body').hasClass('uncode-scroll-no-history'),
8395		theres_footer = true;
8396
8397	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
8398		$('> div', $footer).each(function(index, el){
8399			if ( $(el).outerHeight() < 2 )
8400				theres_footer = false;
8401			else
8402				theres_footer = true;
8403		});
8404	}
8405
8406	if ( !$footer.length )
8407		theres_footer = false;
8408
8409	if ( !UNCODE.isFullPageSnap ) {
8410
8411		if ( $('body').hasClass('uncode-fullpage-zoom') )
8412			effect = 'scaleDown';
8413		else if ( $('body').hasClass('uncode-fullpage-parallax') )
8414			effect = 'moveparallax';
8415		else
8416			effect = 'movecurtain';
8417	}
8418
8419	if ( $('body').hasClass('uncode-fullpage-trid') )
8420		fp_anim_time = fp_anim_time*2;
8421
8422	if ( $header.length ) {
8423		if ( headerName !== '' )
8424			$header.attr('data-name', headerName);
8425		if ( headerLabel !== '' )
8426			$header.attr('data-label', headerLabel);
8427		$container.prepend($header);
8428	}
8429	if ( theres_footer ) {
8430		$container.append($footer);
8431		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
8432		$('aside.widget ul', $footer).addClass('no-list');
8433	}
8434
8435	var $all = $rows.add($header);
8436
8437	if ( theres_footer )
8438		$all = $all.add($footer);
8439
8440	$all.each(function(index, row) {
8441		if( index === 0 )
8442			$(row).addClass('uncode-scroll-active');
8443	});
8444
8445    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
8446
8447	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
8448		$("<ul class='onepage-pagination'></ul>").prependTo("body");
8449	}
8450
8451	$all.each(function(index, val) {
8452		var getName = $(val).data('name'),
8453			label;
8454
8455		if (typeof getName == 'undefined' || getName == 'undefined')
8456			getName = SiteParameters.slide_name + '-' + index;
8457
8458		//if ( dataNames.includes(getName) ) {
8459		if ( dataNames.indexOf(getName) > 0 ) {
8460			getName += '_' + index;
8461			$(val).data('name', getName);
8462		}
8463
8464		dataNames.push(getName);
8465
8466		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
8467
8468		if (typeof $(val).attr('data-label') !== 'undefined')
8469			label = $(val).attr('data-label');
8470		else label = '';
8471
8472		if ( $(val).is($footer) )
8473			return;
8474
8475		if (label != '' ) {
8476			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
8477			$('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>");
8478		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
8479			$('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>");
8480		}
8481	});
8482
8483	var checkVisible = function( el, off ) {
8484		if (typeof jQuery === "function" && el instanceof jQuery) {
8485			el = el[0];
8486		}
8487
8488		off = typeof off=='undefined' ? 50 : off;
8489
8490		var rect = el.getBoundingClientRect();
8491
8492		return (
8493			(
8494				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8495				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8496				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8497			)
8498		);
8499	};
8500
8501	var animationEndAction = function( index, nextIndex ) {
8502		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8503			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8504			player, iframe;
8505
8506		if ( !$nextSlide.is($footer) ) {
8507			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
8508		}
8509
8510		if ( !UNCODE.isFullPageSnap ) {
8511			activateKBurns( nextIndex );
8512		}
8513
8514		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8515			if ($(this).attr('data-provider') == 'vimeo') {
8516				iframe = $(this).find('iframe');
8517				player = new Vimeo.Player(iframe[0]);
8518				player.pause();
8519			} else if ($(this).attr('data-provider') == 'youtube') {
8520				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8521			} else {
8522				if ($(this).is('video')) {
8523					$(this)[0].volume = 0;
8524					$(this)[0].pause();
8525				}
8526			}
8527		});
8528
8529		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8530			if ( $nextSlide.is($header) )
8531				$header.removeClass('header-scrolled');
8532		}
8533
8534		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
8535		$otherEl.each(function(){
8536			var $otherThis = $(this),
8537				$bgwrapperOther = $('.background-inner', $otherThis);
8538			if ( !checkVisible($otherThis) )
8539				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
8540
8541		});
8542
8543		if ( !checkVisible($currentSlide) ) {
8544			$currentSlide.removeClass('uncode-scroll-visible');
8545			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
8546			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
8547				currentScroll.scrollTo(0, 0, 0);
8548		}
8549
8550		clearRequestTimeout(animationEndTimeOut);
8551		animationEndTimeOut = requestTimeout(function(){
8552			Waypoint.refreshAll();
8553			$( document.body ).trigger('uncode_waypoints');
8554			var eventFP = new CustomEvent('fp-slide-changed');
8555			window.dispatchEvent(eventFP);
8556			is_scrolling = false;
8557
8558			if ( is_first ) {
8559				$('ul.onepage-pagination a').removeClass('is-selected');
8560				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8561				is_first = false;
8562			}
8563
8564		}, 500);
8565	};
8566
8567	var postLeaveActions = function( nextIndex ){
8568		if ( menuHidden && ! UNCODE.isMobile )
8569			return false;
8570
8571		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8572			$cols = $('.uncol', $el),
8573			anchor = $el.data('anchor');
8574
8575		if ( ! UNCODE.isFullPageSnap ) {
8576			$.each($cols, function(index, val){
8577				if ( $(val).hasClass('style-light') ){
8578					$masthead.removeClass('style-dark-override').addClass('style-light-override');
8579					return false;
8580				} else if ( $(val).hasClass('style-dark') ) {
8581					$masthead.removeClass('style-light-override').addClass('style-dark-override');
8582					return false;
8583				}
8584			});
8585		}
8586
8587		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
8588			$('.menu-item' ).removeClass('active');
8589			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8590		}
8591
8592		if ( !UNCODE.isFullPageSnap ) {
8593			activateBackWash( nextIndex );
8594		}
8595	};
8596
8597	var activateBackWash = function( nextIndex ){
8598		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8599			$bgwrapper;
8600
8601		if ( $el.length ) {
8602			if ( $el.hasClass('with-zoomout') ) {
8603				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8604			} else if ( $('.with-zoomout', $el).length ) {
8605				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
8606			} else {
8607				return false;
8608			}
8609		} else {
8610			return false;
8611		}
8612
8613		$bgwrapper.addClass('uncode-zoomout');
8614
8615	};
8616
8617	var activateKBurns = function( nextIndex ){
8618		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8619			$bgwrapper;
8620
8621		if ( $el.length ) {
8622			if ( $el.hasClass('with-kburns') ) {
8623				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8624			} else if ( $('.with-kburns', $el).length ) {
8625				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
8626			} else {
8627				return false;
8628			}
8629		} else {
8630			return false;
8631		}
8632
8633		$bgwrapper.addClass('uncode-kburns');
8634
8635	};
8636
8637	var activateParallax = function( nextIndex, direction ){
8638
8639		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8640			$cell = $('.fp-tableCell', $el),
8641			animationEnd = 'webkitAnimationEnd animationend',
8642			cellAnim;
8643
8644		switch( direction ) {
8645			case 'up':
8646				cellAnim = 'moveFromTopInner';
8647				break;
8648			default:
8649				cellAnim = 'moveFromBottomInner';
8650		}
8651
8652		$cell.css({
8653			'animation-name': cellAnim,
8654			'animation-duration': fp_anim_time + 'ms',
8655			'animation-delay': '',
8656			'animation-timing-function': fp_easing,
8657			'animation-fill-mode': 'both',
8658		}).off(animationEnd)
8659		.on(animationEnd, function(event) {
8660			if ( event.originalEvent.animationName === cellAnim ) {
8661				$cell
8662					.css({
8663						'animation-name': '',
8664						'animation-duration': '',
8665						'animation-delay': '',
8666						'animation-timing-function': '',
8667						'animation-fill-mode': '',
8668					});
8669			}
8670		});
8671	};
8672
8673	var scrollHashes = function(){
8674		var hash = window.location.hash.replace('#', '').split('/'),
8675			hashInd;
8676		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
8677			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
8678				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
8679				$.fn.fullpage.moveTo(hashInd+1);
8680			}
8681		} else if( hash[0] === '' ) {
8682			$.fn.fullpage.moveTo(1);
8683		}
8684	};
8685
8686	var hideMenu = function( index, nextIndex ){
8687		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
8688			return false;
8689
8690		var hMenu = UNCODE.menuHeight,
8691			transTime = hMenu * 2;
8692
8693		if ( index === 1 && nextIndex > 1 ) {
8694			hMenu = hMenu * -1;
8695		} else if  ( index !== 1 && nextIndex === 1 ) {
8696			hMenu = 0;
8697		} else {
8698			return false;
8699		}
8700
8701		$masthead.css({
8702			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8703			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8704			'-webkit-transition': 'transform 0.5s ease-in-out',
8705			'transition': 'transform 0.5s ease-in-out'
8706		});
8707	};
8708
8709	var shrinkMenu = function( index, nextIndex ){
8710		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
8711			return false;
8712
8713		if ( index === 1 && nextIndex > 1 ) {
8714			$logo.addClass('shrinked');
8715			$('div', $logo).each(function(index, val){
8716				$(val).css({
8717					'height': logoMinScale,
8718					'line-height': logoMinScale
8719				});
8720				if ($(val).hasClass('text-logo')) {
8721					$(val).css({
8722						'font-size': logoMinScale + 'px'
8723					});
8724				}
8725			});
8726			requestTimeout(function() {
8727				UNCODE.menuMobileHeight = $masthead.outerHeight();
8728			}, 300);
8729		} else if ( index !== 1 && nextIndex === 1 ) {
8730			$logo.removeClass('shrinked');
8731			$('div', $logo).each(function(index, val){
8732				$(val).css({
8733					'height': logoMaxScale,
8734					'line-height': logoMaxScale
8735				});
8736				if ($(val).hasClass('text-logo')) {
8737					$(val).css({
8738						'font-size': logoMaxScale + 'px'
8739					});
8740				}
8741			});
8742			requestTimeout(function() {
8743				UNCODE.menuMobileHeight = $masthead.outerHeight();
8744			}, 300);
8745		} else {
8746			return false;
8747		}
8748
8749	};
8750
8751	var anchorLink = function(){
8752
8753		$container.add('.menu-item').find('a[href*="#"]').on('click', function(e) {
8754			var $this = $(e.currentTarget),
8755				hash = e.currentTarget.href.split('#'),
8756				current = window.location.href.split('#'),
8757				ind,
8758				currentMenuOpened = UNCODE.menuOpened,
8759				go = false;
8760
8761			var hash_url = hash[0].replace(/\/?$/, '/'),
8762				current_url = current[0].replace(/\/?$/, '/');
8763
8764			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
8765				hash = '#'+hash[1];
8766				e.preventDefault();
8767				go = true;
8768			}
8769
8770			if ( go ) {
8771
8772				if ( $(hash).length ) {
8773					ind = $(hash).closest('.fp-section').index();
8774				} else {
8775					hash = hash.slice(1);
8776					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
8777				}
8778
8779				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
8780					ind = $this.closest('.fp-section').index();
8781
8782				UNCODE.menuOpened = false;
8783
8784				$.fn.fullpage.moveTo(ind+1);
8785
8786				UNCODE.menuOpened = currentMenuOpened;
8787				if (UNCODE.menuOpened) {
8788					if (UNCODE.wwidth < UNCODE.mediaQuery) {
8789						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
8790					} else {
8791						$('.mmb-container-overlay .overlay-close').trigger('click');
8792						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
8793					}
8794				}
8795
8796			}
8797
8798		});
8799
8800		$('.header-scrolldown').on('click', function(event) {
8801			event.preventDefault();
8802			var scrollDown = $(this),
8803				ind = scrollDown.closest('.fp-section').index();
8804
8805			$.fn.fullpage.moveTo(ind+2);
8806		});
8807
8808		var anchor = $('.fp-section.active').data('anchor');
8809
8810		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
8811			$('.menu-item').removeClass('active');
8812			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8813		}
8814
8815	};
8816
8817	var slideLeave = function( index, nextIndex, direction ) {
8818		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8819			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8820			animationEnd = 'webkitAnimationEnd animationend',
8821			transitionEnd = 'webkitTransitionEnd transitionend',
8822			animOut = effect != 'scaleDown' ? effect + direction : effect,
8823			animIn,
8824			isFooter = false,
8825			isFooterNext = false,
8826			footerH = $footer.outerHeight(),
8827			timeout,
8828			player, iframe,
8829			footerCoeff;
8830		switch( direction ) {
8831			case 'up':
8832				animIn = 'moveFromTop';
8833				break;
8834			default:
8835				animIn = 'moveFromBottom';
8836		}
8837
8838		if ( $('body').hasClass('uncode-fullpage-trid') ) {
8839			animOut = animIn + 'trid';
8840			animIn = animOut + 'In';
8841		} else if ( UNCODE.isFullPageSnap ) {
8842			animIn = animOut = 'none';
8843		}
8844
8845		hideMenu(index, nextIndex);
8846		shrinkMenu(index, nextIndex);
8847
8848		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8849			if ($(this).attr('data-provider') == 'vimeo') {
8850				iframe = $(this).find('iframe');
8851				player = new Vimeo.Player(iframe[0]);
8852				player.pause();
8853			} else if ($(this).attr('data-provider') == 'youtube') {
8854				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8855			} else {
8856				if ($(this).is('video')) {
8857					$(this)[0].volume = 0;
8858					$(this)[0].pause();
8859				}
8860			}
8861		});
8862
8863		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
8864			if ($(this).attr('data-provider') == 'vimeo') {
8865				iframe = $(this).find('iframe');
8866				iframe.on('load', function(){
8867					player = new Vimeo.Player(iframe);
8868					player.setVolume(0);
8869					player.play();
8870				});
8871				player = new Vimeo.Player(iframe);
8872				player.setVolume(0);
8873				player.play();
8874			} else if ($(this).attr('data-provider') == 'youtube') {
8875				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
8876			} else {
8877				if ($(this).is('video')) {
8878					$(this)[0].volume = 0;
8879					$(this)[0].play();
8880				}
8881			}
8882		});
8883
8884		if ( $currentSlide.is($footer) )
8885			isFooter = true;
8886
8887		if ( $nextSlide.is($footer) )
8888			isFooterNext = true;
8889
8890		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8891			if ( $currentSlide.is($header) )
8892				$header.addClass('header-scrolled');
8893		}
8894
8895		footerCoeff = footerH;
8896
8897		if ( UNCODE.isFullPageSnap ) {
8898			postLeaveActions( nextIndex );
8899			activateBackWash( nextIndex );
8900			activateKBurns( nextIndex );
8901			requestTimeout(function(){
8902				animationEndAction( index, nextIndex );
8903			}, fp_anim_time+150);
8904		} else {
8905			if ( isFooterNext ) {
8906
8907				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
8908				$iscrollWrapper.addClass('no-scrolloverflow');
8909
8910				$nextSlide
8911				.add($currentSlide)
8912				.addClass('uncode-scroll-front')
8913				.addClass('uncode-scroll-active')
8914				.addClass('uncode-scroll-visible');
8915				$container.css({
8916					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8917					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8918					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8919					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8920				}).off(transitionEnd)
8921				.one(transitionEnd, function(){
8922					animationEndAction( index, nextIndex );
8923				});
8924
8925			} else if ( isFooter ) {
8926
8927				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
8928				.add($currentSlide)
8929				.addClass('uncode-scroll-front')
8930				.addClass('uncode-scroll-active')
8931				.addClass('uncode-scroll-visible');
8932				$container.css({
8933					'-webkit-transform': 'translate3d(0, 0, 0)',
8934					'transform': 'translate3d(0, 0, 0)',
8935					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8936					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8937				})
8938				.one(transitionEnd, function(){
8939					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
8940						clearRequestTimeout(timeout);
8941						timeout = requestTimeout(function(){
8942							$.fn.fullpage.moveTo(nextIndex);
8943							slideLeave( index-1, nextIndex, 'up' );
8944							$container.off(transitionEnd);
8945						}, 50);
8946					}
8947					animationEndAction( index, nextIndex );
8948				});
8949
8950			} else {
8951
8952				postLeaveActions( nextIndex );
8953
8954				if ( !$('body').hasClass('uncode-fullpage-trid') )
8955					activateParallax( nextIndex, direction );
8956
8957				var $outBg = $('.background-wrapper', $currentSlide);
8958
8959				$nextSlide
8960				.addClass('uncode-scroll-front')
8961				.addClass('uncode-scroll-active')
8962				.addClass('uncode-scroll-visible')
8963				.addClass('uncode-scroll-animating-in')
8964				.css({
8965					'z-index':4,
8966					'animation-name': animIn,
8967					'animation-duration': fp_anim_time + 'ms',
8968					'animation-delay': '',
8969					'animation-timing-function': fp_easing,
8970					'animation-fill-mode': 'both',
8971					'transition': 'initial',
8972				}).off(animationEnd)
8973				.on(animationEnd, function(event) {
8974					if ( event.originalEvent.animationName === animIn ) {
8975						$(this)
8976							.addClass('uncode-scroll-already')
8977							.removeClass('uncode-scroll-front')
8978							.removeClass('uncode-scroll-animating-in')
8979							.css({
8980								'animation-name': '',
8981								'animation-duration': '',
8982								'animation-delay': '',
8983								'animation-timing-function': '',
8984								'animation-fill-mode': '',
8985								'transition': 'initial',
8986							});
8987
8988						$currentSlide
8989							.removeClass('uncode-scroll-active')
8990							.add($outBg)
8991							.css({
8992								'animation-name': '',
8993								'animation-duration': '',
8994								'animation-delay': '',
8995								'animation-timing-function': '',
8996								'animation-fill-mode': '',
8997								'transition': 'initial',
8998							});
8999
9000						animationEndAction( index, nextIndex );
9001
9002					}
9003
9004					if ( nextIndex > 1 )
9005						$('body').addClass('window-scrolled');
9006					else
9007						$('body').removeClass('window-scrolled');
9008				});
9009
9010				$currentSlide
9011					.addClass('uncode-scroll-animating-out')
9012					.removeClass('uncode-scroll-front')
9013					.css({
9014						'z-index':'1',
9015						'animation-name': animOut,
9016						'animation-duration': fp_anim_time + 'ms',
9017						'animation-delay': '',
9018						'animation-timing-function': fp_easing,
9019						'animation-fill-mode': 'both',
9020						'transition': 'initial',
9021						'will-change': 'auto'
9022					}).off(animationEnd)
9023					.on(animationEnd, function(event) {
9024						if ( event.originalEvent.animationName === animOut ) {
9025							$currentSlide.removeClass('uncode-scroll-animating-out');
9026						}
9027					});
9028
9029				if ( $('body').hasClass('uncode-fp-opacity') ) {
9030					$currentSlide.find('> div').css({
9031						'animation-name': 'opacityout',
9032						'animation-duration': fp_anim_time + 'ms',
9033						'animation-delay': '',
9034						'animation-timing-function': fp_easing,
9035						'animation-fill-mode': 'both',
9036						'transition': 'initial',
9037					}).off(animationEnd)
9038					.on(animationEnd, function(event) {
9039						if ( event.originalEvent.animationName === 'opacityout' ) {
9040							$(event.currentTarget).css({
9041								'animation-name': '',
9042								'animation-duration': '',
9043								'animation-delay': '',
9044								'animation-timing-function': '',
9045								'animation-fill-mode': '',
9046								'transition': '',
9047							});
9048						}
9049					});
9050				}
9051			}
9052		}
9053
9054		$('.scroll-top').on('click', function(e){
9055			$.fn.fullpage.moveTo(1);
9056			return false;
9057		});
9058
9059	};
9060
9061	var init_fullPage = function(mode){
9062
9063		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
9064		// 	scrollBar = false;
9065		// }
9066
9067		var checkFPeffects;
9068
9069		$container.fullpage({
9070			sectionSelector: '.uncode-scroll-lock',
9071			scrollOverflow: true,
9072			scrollOverflowOptions: {
9073				click: false,
9074				preventDefaultException: { tagName:/.*/ }
9075			},
9076			normalScrollElements: ".masthead-vertical",
9077			navigation: false,
9078			scrollBar: scrollBar,
9079			scrollingSpeed: fp_anim_time,
9080			verticalCentered: true,
9081			anchors: no_history ? false : dataNames,
9082			recordHistory: !no_history,
9083			afterRender: function(){
9084				$('body').removeClass('fp-waiting');
9085				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
9086					var $invisible = $(this).addClass('hidden-scroll');//,
9087				});
9088				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
9089					var $visible = $(this).addClass('uncode-scroll-visible'),
9090						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
9091					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
9092				});
9093
9094				$('ul.onepage-pagination a').on('click', function(e){
9095					e.preventDefault();
9096					var $a = $(this),
9097						toIndex = $a.data('index');
9098
9099					$.fn.fullpage.moveTo(toIndex+1);
9100				});
9101
9102				requestTimeout(function(){
9103					scrollHashes();
9104				}, 1000);
9105
9106				$(window).on('hashchange', function(e){
9107					requestTimeout(function(){
9108						scrollHashes();
9109					}, 500);
9110				});
9111
9112				anchorLink();
9113
9114				if ( $('body').hasClass('uncode-fp-opacity') ) {
9115					$all.each(function(index, row) {
9116						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
9117							classBg;
9118
9119						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
9120							classBg = testmatch[0];
9121							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
9122						}
9123					});
9124				}
9125
9126				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
9127					$(window).on('menuOpen gdprOpen', function(){
9128						$.fn.fullpage.setAutoScrolling(false);
9129					}).on('menuClose gdprClose', function(){
9130						$.fn.fullpage.setAutoScrolling(true);
9131					});
9132				}
9133
9134				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
9135					requestTimeout(function(){
9136						$.fn.fullpage.setAutoScrolling(false);
9137					}, 1000);
9138				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
9139					$.fn.fullpage.setAutoScrolling(true);
9140				});
9141
9142				if ( !UNCODE.isFullPageSnap ) {
9143					clearRequestTimeout(checkFPeffects);
9144					checkFPeffects = requestTimeout(function(){
9145						activateBackWash( 1 );
9146						activateKBurns( 1 );
9147					}, 100);
9148				}
9149
9150			},
9151			onLeave: function( index, nextIndex, direction ){
9152
9153				if ( UNCODE.menuOpened || is_scrolling )
9154					return false;
9155
9156				is_scrolling = true;
9157
9158				var event = new CustomEvent('fp-slide-leave');
9159				window.dispatchEvent(event);
9160
9161				slideLeave( index, nextIndex, direction );
9162
9163				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
9164					if ( direction === 'up' ) {
9165						$.fn.fullpage.moveTo(nextIndex-1);
9166					} else {
9167						$.fn.fullpage.moveTo(nextIndex+1);
9168					}
9169					return false;
9170				}
9171
9172				$('ul.onepage-pagination a').removeClass('is-selected');
9173				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
9174
9175			}
9176		});
9177	};
9178
9179	init_fullPage();
9180	$(window).on('load', function(){
9181		requestTimeout(function(){
9182			$.fn.fullpage.reBuild();
9183		}, 3000);
9184	});
9185
9186	var addScrollingClass,
9187		removeScrollingClass;
9188
9189	window.addEventListener("fp-slide-scroll", function(){
9190		addScrollingClass = requestTimeout( function(){
9191			$('body').addClass('fp-slide-scrolling');
9192		}, 10 );
9193
9194		clearRequestTimeout(removeScrollingClass);
9195		removeScrollingClass = requestTimeout( function(){
9196			$('body').removeClass('fp-slide-scrolling');
9197		}, 150 );
9198
9199		Waypoint.refreshAll();
9200	}, false);
9201
9202	var setFPheight = function(){
9203		var $body = document.body,
9204			$footer = document.getElementById('colophon'),
9205			$maincontainer = document.querySelector('.main-wrapper'),
9206			$boxcontainer = document.querySelector('.box-container'),
9207			$sections = document.querySelectorAll('.fp-section'),
9208			rect = $maincontainer.getBoundingClientRect(),
9209			rect2 = $boxcontainer.getBoundingClientRect(),
9210			$masthead = document.getElementById('masthead'),
9211			_hideMenu = false,
9212			menuHeight = UNCODE.menuHeight;
9213		$body.style.height = UNCODE.wheight + 'px';
9214
9215		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
9216			_hideMenu = true;
9217		}
9218		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
9219			menuHeight = 0
9220		}
9221
9222
9223		if ( theres_footer )
9224			$footer.style.top = (rect.height || rect2.height) + 'px';
9225
9226		for (var i = 0; i < $sections.length; i++) {
9227			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
9228		}
9229	};
9230
9231	setFPheight();
9232
9233	window.addEventListener('resize', setFPheight, false);
9234	window.addEventListener('orientationchange', setFPheight, false);
9235
9236};
9237
9238UNCODE.particles = function() {
9239	$(".vc-particles-background").each(function() {
9240		var $particle = $(this);
9241		var $parent = $particle.closest('[data-parent]');
9242
9243		$parent.prepend($particle);
9244		// $(window).trigger('resize');
9245	})
9246};
9247
9248
9249UNCODE.readMoreCol = function( $el ){
9250	if ( typeof $el === 'undefined' || $el === null ) {
9251		$el = $('body');
9252	}
9253	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
9254	$readMoreCols.each(function(){
9255		var $uncont = $(this),
9256			$row = $uncont.closest('.row-container'),
9257			max_h = $uncont.attr('data-ov-height'),
9258			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
9259			actual_max_h = $uncont.outerHeight(),
9260			inner_h,
9261			$read_more = $('+ .btn-more-wrap', $uncont),
9262			read_more_resize = $read_more.hasClass('trigger-resize'),
9263			marginClosedBtn = $uncont.attr('data-margin-closed'),
9264			marginClosed = 0,
9265			marginOpenBtn = $uncont.attr('data-margin-open'),
9266			marginOpen = 0,
9267			anim_t = 250,
9268			resized = false;
9269
9270		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
9271
9272		switch (marginClosedBtn) {
9273			case 'sm':
9274				marginClosed = 18
9275				break;
9276				
9277			case 'std':
9278				marginClosed = 36
9279				break;
9280				
9281			case 'lg':
9282				marginClosed = 72
9283				break;
9284				
9285			case '':
9286			default:
9287				marginClosed = 0
9288				break;
9289				
9290		}
9291
9292		switch (marginOpenBtn) {
9293			case 'sm':
9294				marginOpen = 18
9295				break;
9296				
9297			case 'std':
9298				marginOpen = 36
9299				break;
9300				
9301			case 'lg':
9302				marginOpen = 72
9303				break;
9304				
9305			case 'no':
9306				marginOpen = 0
9307				break;
9308				
9309		}
9310
9311		var checkToggleMobile = function(){
9312			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
9313				resized = true;
9314				if ( $read_more.hasClass('state-closed') ) {
9315					$uncont[0].style.height = '';
9316					$uncont[0].style.maxHeight = max_h_mobile;
9317				}
9318			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
9319				if ( $read_more.hasClass('state-closed') ) {
9320					$uncont[0].style.height = '';
9321					$uncont[0].style.maxHeight = max_h;
9322				}
9323				resized = false;
9324			}
9325		}
9326		checkToggleMobile();
9327		$(window).on('resize', function() {
9328			checkToggleMobile();
9329		});
9330
9331		$('a', $read_more).on('click', function(e){
9332			e.preventDefault();
9333
9334			var $a = $(this);
9335
9336			if ( $read_more.hasClass('state-closed') ) {
9337
9338				$read_more
9339					.removeClass('state-closed')
9340					.addClass('state-open');
9341
9342				$uncont.css({
9343					'max-height': 'none',
9344					'height': 'auto',
9345				});
9346	
9347				inner_h = parseFloat( $uncont.outerHeight() );
9348
9349				$uncont.css({
9350					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
9351				});
9352		
9353				anim_t = inner_h - actual_max_h;
9354				if ( anim_t < 250 ) {
9355					anim_t = 250;
9356				} else if ( anim_t > 1000 ) {
9357					anim_t = 1000;
9358				}
9359
9360				$uncont.css({
9361					'transition-duration' : anim_t + 'ms'
9362				}).addClass('overflow-mask-animation').animate({
9363					'height': inner_h
9364				}, anim_t, 'easeInOutCubic', function(){
9365					$uncont.css({
9366						'height' : 'auto'
9367					}).removeClass('overflow-mask');
9368					if ( read_more_resize === true ) {
9369						window.dispatchEvent(new Event('resize'));
9370						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
9371							ScrollTrigger.refresh(true);
9372						}
9373					}
9374				});
9375
9376				if ( marginOpen != '' ) {
9377					$read_more.animate({
9378						'margin-top' : marginOpen
9379					}, anim_t, 'easeInOutCubic');
9380				}
9381
9382			} else {
9383				$read_more
9384					.removeClass('state-open')
9385					.addClass('state-closed');
9386
9387				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
9388					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
9389				}, anim_t, 'easeInOutCubic', function(){
9390					if ( read_more_resize === true ) {
9391						window.dispatchEvent(new Event('resize'));
9392						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
9393							ScrollTrigger.refresh(true);
9394						}
9395					}
9396				});
9397
9398				if ( marginClosed !== '' ) {
9399					$read_more.animate({
9400						'margin-top' : marginClosed
9401					}, anim_t, 'easeInOutCubic');
9402				}
9403
9404				if ( $a.hasClass('toggle-scroll') ) {
9405                    var $masthead = $('#masthead > div:first-child'),
9406                        headH = $masthead.outerHeight(),
9407						rectTop = $row[0].getBoundingClientRect().top,
9408						checkNavBar = $a.hasClass('toggle-navbar'),
9409						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
9410                        offCont = ( $row.offset().top );
9411
9412					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
9413						checkNavBar = checkNavBarMobile;
9414					}
9415
9416					if ( checkNavBar ) {
9417						offCont = offCont - headH;
9418					}
9419			
9420					if ( rectTop < headH ) {
9421						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
9422							$(this).stop();
9423						}).animate({
9424							scrollTop: offCont
9425						}, anim_t, 'easeInOutCubic');
9426					}
9427				}
9428
9429			}
9430		});
9431	});
9432}
9433UNCODE.filters = function() {
9434	var $systems = $('.isotope-system, .cssgrid-system');
9435
9436	$systems.each(function(index, val){
9437		var $system = $(this),
9438			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
9439			$widgets = $('.widgetized-cb-wrapper', $system),
9440			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
9441			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
9442			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
9443			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
9444
9445		if ($system.hasClass('isotope-processed')) {
9446			return;
9447		}
9448
9449		$cats_trigger.on('click', function(e) {
9450			if ( ! $('html').hasClass('screen-sm') ) {
9451				// $widgets.add($sorting_dd).slideUp(400);
9452				e.preventDefault();
9453				$widgets.slideUp(400, 'easeInOutCirc');
9454			}
9455		});
9456
9457		$('.filters-toggle-trigger', $system).on('click', function(e) {
9458			e.preventDefault();
9459			var $filters = $('.isotope-filters .menu-horizontal', $system);
9460			$filters.slideToggle(400, 'easeInOutCirc');
9461			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
9462		});
9463
9464		$widget_trgr.on('click', function(e) {
9465			e.preventDefault();
9466			$widgets.slideToggle(400, 'easeInOutCirc');
9467			if (!$('html').hasClass('screen-sm')) {
9468				$cats_filters.slideUp(400, 'easeInOutCirc');
9469			}
9470			window.dispatchEvent(new CustomEvent('boxResized'));
9471		});
9472
9473		$sorting_trgr.on('click', function(e) {
9474			e.preventDefault();
9475			if (!$('html').hasClass('screen-sm')) {
9476				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
9477			}
9478		});
9479
9480		$system.addClass('isotope-processed');
9481	});
9482
9483};
9484
9485UNCODE.widgets = function() {
9486	var widget_collapses = $('.widget-collapse');
9487
9488	widget_collapses.each(function(){
9489		var widget_collapse = $(this),
9490			widget_title = widget_collapse.find('.widget-title'),
9491			widget = widget_title.closest('.widget'),
9492			content = widget.children().not('.widget-title'),
9493			setCTA;
9494
9495		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
9496			widget_title.toggleClass('open');
9497		}
9498
9499		widget_title.each(function() {
9500			var _this = $(this);
9501			var content = _this.closest('.widget').find('.widget-collapse-content');
9502
9503			$(window).on('load resize', function(){
9504				clearRequestTimeout(setCTA);
9505				setCTA = requestTimeout( function() {
9506					if ( content.is(':visible') ) {
9507						_this.addClass( 'open' );
9508					} else {
9509						_this.removeClass( 'open' );
9510					}
9511				}, 10 );
9512			})
9513
9514			_this.on( 'click', function(){
9515
9516				// Get content of :after element (+ icon) to check the visibility
9517				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
9518
9519				if (icon_content === 'none' || !icon_content) {
9520					return false;
9521				}
9522
9523				_this.toggleClass('open');
9524				var isOpen = _this.hasClass('open'),
9525					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
9526				content.animate({
9527					height: 'toggle',
9528					padding: 'toggle',
9529					opacity: 'toggle',
9530					top: isOpen ? 0 : hasBorder
9531				}, {
9532					duration: 400,
9533					easing: "easeInOutCirc",
9534				});
9535
9536				return false;
9537
9538			});
9539		});
9540	});
9541
9542	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
9543};
9544
9545UNCODE.unmodal = function() {
9546	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
9547		$('.unmodal-overlay').fadeIn();
9548		$('.unmodal-overlay').addClass('loading');
9549		$('body').addClass('uncode-unmodal-overlay-visible');
9550		$(window).trigger('unmodal-open');
9551	});
9552
9553	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
9554		$('.unmodal-overlay').fadeOut();
9555		$('.unmodal').fadeOut();
9556		$('body').removeClass('uncode-unmodal-overlay-visible');
9557		$('body').removeClass('uncode-unmodal-open');
9558		$('html').removeClass('uncode-unmodal-body-disable-scroll');
9559		$(document).trigger('unmodal-close');
9560		UNCODE.isUnmodalOpen = false;
9561	});
9562
9563	$(document).on('uncode-unmodal-show-content', function() {
9564		$('.unmodal-overlay').removeClass('loading');
9565		$('.unmodal').show();
9566		$('.unmodal').addClass('show-unmodal-with-animation');
9567		$('.unmodal-content')[0].scrollTop = 0;
9568		$('body').addClass('uncode-unmodal-open');
9569		UNCODE.isUnmodalOpen = true;
9570
9571		if ($('body').hasClass('qw-body-scroll-disabled')) {
9572			$('html').addClass('uncode-unmodal-body-disable-scroll');
9573		}
9574
9575		if ($('.unmodal').hasClass('auto-height')) {
9576			set_modal_height();
9577		}
9578	});
9579
9580	var set_modal_height = function() {
9581		var modal = $('.unmodal').css({height: 'auto'});
9582		var window_height = $(window).outerHeight();
9583		var modal_height = modal.outerHeight();
9584
9585		modal.css('height', 'auto');
9586
9587		if (modal_height > window_height) {
9588			modal.outerHeight(window_height);
9589		}
9590	}
9591
9592	if ($('.unmodal').hasClass('auto-height')) {
9593		var setCTA;
9594
9595		$(window).on('resize', function() {
9596			clearRequestTimeout(setCTA);
9597			setCTA = requestTimeout(function() {
9598				set_modal_height();
9599			}, 100);
9600		});
9601	}
9602};
9603
9604UNCODE.bgChanger = function() {
9605	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
9606		$bg_first = $('.vc_row[data-bg-remove]'),
9607		bg_remove = $bg_first.attr('data-bg-remove'),
9608		$first = $bg_changers.first(),
9609		$last = $bg_changers.last(),
9610		$bg_wrapper = $('#changer-back-color'),
9611		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
9612		setCTA, localH = UNCODE.wheight,
9613		isScrolling;
9614
9615	$bg_first.removeClass(bg_remove);
9616
9617	var bgChange = function($col, bgColor, skin, tmbskin){
9618		$bg_wrapper.attr( 'class', bgColor );
9619		var menuskin;
9620		if ( typeof skin !== 'undefined' ) {
9621			menuskin = skin.replace('style', 'menu')
9622		}
9623
9624		if ( $col.length ) {
9625			$('.uncol[data-skin-change]').each(function(){
9626				var $isoFooter = $('.isotope-footer', this);
9627				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
9628				if ( menuskin !== '' ) {
9629					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
9630				}
9631			});
9632
9633			$('.tmb[data-skin-change]').each(function(){
9634				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
9635			});
9636		}
9637	};
9638
9639	var $masthead = $('#masthead'),
9640		transDesktop,
9641		transMobile,
9642		changeSkin,
9643
9644	checkTransparencyAndChange = function( skin ){
9645		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
9646		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
9647		changeSkin = $masthead.hasClass('menu-change-skin');
9648
9649		if ( ! transDesktop && ! transMobile ) {
9650			return false;
9651		}
9652
9653		if ( ! changeSkin ) {
9654			return false;
9655		}
9656
9657		if ( skin === 'style-light' ){
9658			$masthead.removeClass('style-dark-override').addClass('style-light-override');
9659			return false;
9660		} else if ( skin === 'style-dark' ) {
9661			$masthead.removeClass('style-light-override').addClass('style-dark-override');
9662			return false;
9663		}
9664	};
9665
9666	var bg_waypoints = function(){
9667		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
9668
9669			$.each($bg_changers, function(index, row) {
9670
9671				var $row = $(row),
9672					$col = $('.uncol[data-skin-change]', $row).eq(0),
9673					skin,
9674					$tmbs,
9675					tmbskin,
9676					bgColor = $row.attr('data-bg-color');
9677
9678				if ( ! $row.is(':visible') ) {
9679					return false;
9680				}
9681
9682				if ( $col.length ) {
9683					skin = $col.attr('data-skin-change');
9684					$tmbs = $('.tmb[data-skin-change]', $row);
9685					tmbskin = skin.replace('style', 'tmb');
9686				}
9687
9688				if ( ! $row.hasClass('unscroll-horizontal') ) {
9689					$row.waypoint(function( dir ) {
9690						if ( dir === 'down' ) {
9691							bgChange($col, bgColor, skin, tmbskin);
9692							checkTransparencyAndChange(skin);
9693						} else {
9694							return;
9695						}
9696					}, {
9697						offset: '50%'
9698		  			});
9699
9700					$row.waypoint(function( dir ) {
9701						if ( dir === 'up' ) {
9702							bgChange($col, bgColor, skin, tmbskin);
9703							checkTransparencyAndChange(skin);
9704						} else {
9705							return;
9706						}
9707					}, {
9708						offset: function() {
9709							var clH = this.element.clientHeight,
9710								wH = window.innerHeight,
9711								ret = clH > 200 ? -100 : clH * -0.5;
9712							return ( wH / 2 ) - clH;
9713						}
9714					});
9715				}
9716
9717			});
9718
9719			$('body').addClass('bg-changer-init');
9720
9721		}
9722	};
9723
9724	var body = document.body,
9725	edges = false;
9726
9727	var throttle = function(fn, wait) {
9728		var time = Date.now();
9729		return function() {
9730			if ((time + wait - Date.now()) < 0) {
9731				fn();
9732				time = Date.now();
9733			}
9734		}
9735	}
9736
9737	var $wrapper = document.querySelector(".main-wrapper"),
9738		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
9739
9740	var $title = document.querySelector('#rotating');
9741	if ( $title !== null ) {
9742		$title.style.whiteSpace = 'nowrap';
9743		$title.style.transition = 'transform 200ms linear';
9744	}
9745
9746	window.addEventListener( 'scroll', throttle( function() {
9747		window.clearRequestTimeout( isScrolling );
9748
9749		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
9750
9751			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
9752				body = document.body,
9753				html = document.documentElement,
9754				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9755				$row = false,
9756				firstOff,
9757				lastOff;
9758
9759			if ( scrolled < 100 && $first.length ) {
9760				firstOff = $first.offset().top;
9761				if ( firstOff < 100 ) {
9762					var $row = $first;
9763				}
9764			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
9765				lastOff = $last.offset().top + $last.outerHeight();
9766				if ( lastOff > ( docH - 100 ) ) {
9767					var $row = $last;
9768				}
9769			}
9770
9771			if ( $row.length ) {
9772				var $col = $('.uncol[data-skin-change]', $row).eq(0),
9773					skin,
9774					$tmbs,
9775					tmbskin,
9776					bgColor = $row.attr('data-bg-color');
9777
9778				if ( $col.length ) {
9779					skin = $col.attr('data-skin-change');
9780					$tmbs = $('.tmb[data-skin-change]', $row);
9781					tmbskin = skin.replace('style', 'tmb');
9782				}
9783
9784				bgChange($col, bgColor, skin, tmbskin);
9785				checkTransparencyAndChange(skin);
9786				edges = true;
9787			}
9788
9789		}, 150);
9790
9791		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
9792			bg_waypoints();
9793			Waypoint.refreshAll();
9794			edges = false;
9795		}
9796
9797	}, 100), false);
9798
9799	$(window).on('resize', function() {
9800		clearRequestTimeout(setCTA);
9801		setCTA = requestTimeout(function() {
9802			if ( localH != UNCODE.wheight ) {
9803				localH = UNCODE.wheight;
9804				bg_waypoints();
9805				Waypoint.refreshAll();
9806			}
9807		}, 100);
9808	});
9809
9810	bg_waypoints();
9811
9812};
9813
9814UNCODE.skewIt = function() {
9815
9816	if ( $('body').hasClass('compose-mode') ) {
9817		return;
9818	}
9819
9820	var justscrolled = false;
9821
9822	var loadSkewIt = function(){
9823
9824		var $pageHeader = $('#page-header'),
9825			$page_body = $('.page-body'),
9826			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
9827
9828		if ( $header_skew.length ) {
9829			$pageHeader.addClass('uncode-skew').css({
9830				position: 'relative',
9831				zIndex: 1
9832			});
9833			$header_skew.removeClass('uncode-skew');
9834			$page_body.css({
9835				position: 'relative',
9836				zIndex: 0
9837			});
9838		}
9839
9840		var $skew = $('.uncode-skew'),
9841			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
9842			horizontal = $horizontal.length,
9843			stopSkewing,
9844			lastOffset = 0,
9845			lastDate = Date.now();
9846
9847		if ( ! $skew.length ) {
9848			return;
9849		}
9850
9851		var dropSkew = function(){
9852			if ( UNCODE.wwidth < UNCODE.mediaQuery )
9853				return;
9854
9855			$skew.each(function(){
9856				var $this = $(this),
9857					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9858
9859				if ( $drop.length ) {
9860					$this.css({
9861						'transform': 'skew(0)'
9862					});
9863					var bound = $this[0].getBoundingClientRect();
9864					$drop.css({
9865						left: bound.x * -1,
9866						top: bound.y * -1,
9867					});
9868				}
9869			});
9870		};
9871		dropSkew();
9872
9873		$(window).on('resize', dropSkew);
9874
9875		window.addEventListener( 'scroll', function() {
9876
9877			if ( justscrolled !== true ) {
9878				justscrolled = true;
9879				return;
9880			}
9881
9882			window.clearRequestTimeout( stopSkewing );
9883
9884			var now = Date.now(),
9885				delayInMs = now - lastDate,
9886				offset = window.pageYOffset || window.document.documentElement.scrollTop,
9887				newOffset = offset - lastOffset,
9888				speed = Math.pow((newOffset / delayInMs), 3) * -1,
9889				body = document.body,
9890				html = document.documentElement,
9891				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9892				wait = 50,
9893				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
9894
9895			if ((lastDate + wait - now) < 0) {
9896
9897				lastDate = now;
9898				lastOffset = offset;
9899
9900				if ( speed > 6 ) {
9901					speed = 6;
9902				} else if ( speed < -6 ) {
9903					speed = -6;
9904				}
9905
9906				if ( speed > 2 && offset < UNCODE.wheight ) {
9907					speed = 2;
9908				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
9909					speed = -2;
9910				}
9911
9912				var speedY = speed,
9913					speedX = speed * 1.25;
9914
9915				if ( horizontal ) {
9916					speedY = 0;
9917					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9918						speedX = 0;
9919						return;
9920					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
9921						speedX = 0;
9922						return;
9923					}
9924				} else {
9925					speedX = 0;
9926				}
9927
9928				if ( ! $skew.closest('.enter-st').length ) {
9929					speedX = 0;
9930				}
9931
9932				gsap.killTweensOf($skew);
9933				gsap.to( $skew, {
9934					duration: 0.2,
9935					skewY: (speedY * maxSpeed) + "deg",
9936					skewX: (speedX * maxSpeed) + "deg",
9937					ease: Power0.easeNone,
9938					transformOrigin: 'center',
9939				});
9940
9941			}
9942
9943			stopSkewing = requestTimeout(function() {
9944				gsap.killTweensOf($skew);
9945				gsap.to( $skew, {
9946					duration: 0.5,
9947					skewY: "0deg",
9948					skewX: "0deg",
9949					transformOrigin: 'center',
9950					ease: Expo.easeOut,
9951				});
9952
9953				$skew.each(function(){
9954					var $this = $(this),
9955						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9956
9957					if ( $drop.length ) {
9958						var bound = $this[0].getBoundingClientRect()
9959						$drop.css({
9960							left: bound.x * -1,
9961							top: bound.y * -1,
9962						});
9963					}
9964				});
9965
9966			}, 200);
9967
9968		}, false);
9969
9970	};
9971
9972	$(window).on('load', loadSkewIt);
9973
9974};
9975
9976UNCODE.rotateIt = function() {
9977
9978	if ( $('body').hasClass('compose-mode') ) {
9979		return;
9980	}
9981
9982	var frameRotate = false;
9983	var loadRotateIt = function(){
9984
9985		var $toRotate = $('.uncode-rotate');
9986
9987		$toRotate.each(function(){
9988			var $rotate = $(this),
9989				deg = 0,
9990				dir = true,
9991				coeff = 1,
9992				lastOffset = 0,
9993				lastDate = Date.now();
9994
9995			var checkScroll = function($rotate){
9996				// if ( ! $rotate.length ) {
9997				// 	return;
9998				// }
9999
10000				var now = Date.now(),
10001					delayInMs = now - lastDate,
10002					offset = window.pageYOffset || window.document.documentElement.scrollTop,
10003					newOffset = offset - lastOffset,
10004					speed = (newOffset / delayInMs) * 5,
10005					body = document.body,
10006					html = document.documentElement,
10007					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
10008
10009				lastDate = now;
10010				lastOffset = offset;
10011
10012				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
10013					deg = 0;
10014				}
10015
10016				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
10017					deg = parseFloat(deg) + parseFloat(speed);
10018				}
10019
10020				if ( $rotate.hasClass('uncode-rotate-hover') ) {
10021					$rotate.hover(function(){
10022						coeff = 1.75;
10023					}, function(){
10024						coeff = 1;
10025					});
10026				}
10027
10028				// if ( speed > 0 ) {
10029				// 	dir = true
10030				// } else if ( speed < 0 ) {
10031				// 	dir = false
10032				// }
10033
10034				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
10035					deg = deg+coeff;
10036					// if ( dir ) {
10037					// 	deg = deg+coeff;
10038					// } else {
10039					// 	deg = deg-coeff;
10040					// }
10041				}
10042
10043				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
10044					return false;
10045				}
10046				
10047				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
10048					var undeg = deg*-1;
10049					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
10050				} else {
10051					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
10052				}
10053
10054				requestAnimationFrame(function() {
10055					if ( frameRotate === true ) {
10056						frameRotate = false;
10057						return;
10058					}
10059					checkScroll($rotate);
10060				});
10061			};
10062
10063			checkScroll($rotate);
10064
10065		});
10066
10067	};
10068
10069	$(window).on('load', loadRotateIt);
10070
10071	var checkRotate;
10072	var resizeRotate = function(){
10073		var $inlineRotates = $('.inline-rotate');
10074		$inlineRotates.each(function(){
10075			$(this).addClass('inline-rotate-standby');
10076		});
10077		clearTimeout(checkRotate);
10078		checkRotate = setTimeout(function(){
10079			$('.inline-rotate').each(function(){
10080				$(this).removeClass('inline-rotate-standby');
10081				frameRotate = true;
10082			});
10083			loadRotateIt();
10084		}, 500);
10085	};
10086
10087	$(window).off('resize.inline-rotate', resizeRotate)
10088	.on('resize.inline-rotate', resizeRotate);
10089
10090};
10091
10092var marqueeAttempts = 0,
10093	marqueeTO,
10094	marqueeCheckResize,
10095	initMarquee;
10096
10097UNCODE.textMarquee = function( $titles ) {
10098
10099	var isInitMarque = false;
10100
10101	var initTextMarquee = function( $titles ){
10102
10103		if ( typeof $titles == 'undefined' ) {
10104			$titles = $('.un-text-marquee');
10105		}
10106
10107		if ( ! $titles.length ) {
10108			return;
10109		}
10110
10111		isInitMarque = true;
10112
10113		var stableHeight = UNCODE.wheight;
10114
10115		$titles.each(function(){
10116			var $title = $(this),
10117				$span = $('> span, > i > span', $title),
10118				txt,
10119				first = true,
10120				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
10121				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
10122				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
10123				hasSticky = false,
10124				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
10125				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
10126				newW = UNCODE.wwidth,
10127				marqueeTL, inview,
10128				isInMenu = $title.closest('.megamenu-block-wrapper').length;
10129
10130			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
10131				hasSticky = true;
10132				dataTrigger = 'row';
10133			}
10134
10135			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
10136				dataNavBar = dataNavBarMobile;
10137			}
10138
10139			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
10140			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
10141			var dataX = dataSpeed;
10142
10143			dataSpeed += 5;
10144
10145			$('.marquee-clone-wrap', $title).remove();
10146
10147			txt = $span.html();
10148
10149			if ( ! $('.marquee-original-core', $span).length ) {
10150				txt = $span.html();
10151				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
10152			} else {
10153				txt = $('.marquee-original-core', $span).html();
10154			}
10155
10156			var spanW,
10157				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
10158				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
10159				speed = 10 - dataSpeed;
10160
10161			$span.prepend($prepended);
10162			$span.append($appended);
10163
10164			var continuousTextMarquee = function () {
10165				var bound = $title
10166						.css({
10167							transform: "none",
10168							opacity: 0,
10169						})
10170						.offset(),
10171					ease = "none";
10172
10173				var xStrt =
10174						first || $title.hasClass("un-marquee-infinite")
10175							? 0
10176							: UNCODE.wwidth - bound.left,
10177					xEnd = $title.hasClass("un-marquee-infinite")
10178						? spanW
10179						: spanW + bound.left,
10180					xSpeed =
10181						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
10182						dataSpeed,
10183					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
10184					speedSlow = (xEnd + xStrt) / 45,
10185					transFormVal,
10186					translX;
10187
10188				marqueeTL = new TimelineMax({ paused: true, reversed: true });
10189				marqueeTL.play();
10190
10191				var inViewElement =
10192						dataTrigger === "row" ? ( hasSticky ? $title.closest('.sticky-trigger, .sticky-element').parent()[0] : $title.closest(".vc_row")[0] ) : $title[0],
10193					wayOff =
10194						dataTrigger === "row" && dataNavBar === "yes"
10195							? UNCODE.menuHeight
10196							: 0;
10197
10198				if ( isInMenu ) {
10199					$(document).on('un-menu-show.marquee', function(e, $ul){
10200						marqueeTL.restart();
10201					});
10202					$(document).on('un-menu-hide.marquee', function(e, $ul){
10203						marqueeTL.pause();
10204					});
10205				} else {
10206					inview = new Waypoint.Inview({
10207						element: inViewElement,
10208						offset: wayOff,
10209						enter: function (direction) {
10210							marqueeTL.play();
10211						},
10212						exited: function (direction) {
10213							if (!$title.closest(".pin-spacer").length) {
10214								marqueeTL.pause();
10215							}
10216						},
10217					});
10218				}
10219
10220				if ($title.hasClass("un-marquee-hover")) {
10221					var $column = $title.closest(".wpb_column"),
10222						$col_link = $(".col-link", $column),
10223						$hover_sel = $title;
10224
10225					if ($col_link.length) {
10226						$hover_sel = $title.add($column);
10227					}
10228					$hover_sel
10229						.on("mouseover", function () {
10230							ease = "power2.out";
10231							transFormVal = $title.css("transform").split(/[()]/)[1];
10232							translX = transFormVal.split(",")[4];
10233							speedSlow = (xEnd + (xStrt - translX)) / 45;
10234							marqueeTL.duration(speedSlow);
10235						})
10236						.on("mouseout", function () {
10237							ease = "power2.in";
10238							transFormVal = $title.css("transform").split(/[()]/)[1];
10239							translX = transFormVal.split(",")[4];
10240							speedSlow =
10241								((xEnd + (xStrt - translX)) /
10242									(dataSpeed * dataSpeed * dataSpeed) /
10243									5) *
10244								dataSpeed;
10245							marqueeTL.duration(speedSlow);
10246						});
10247				}
10248		
10249				gsap.killTweensOf($title);
10250				marqueeTL.fromTo( $title, {
10251					opacity: 1,
10252					x: xStrt * direction * -1
10253				},
10254				{
10255					duration: xSpeed,
10256					x: xEnd * direction,
10257					onComplete: function(){
10258						first = false;
10259						if ( isInMenu ) {
10260							marqueeTL.restart();
10261						} else {
10262							continuousTextMarquee();
10263						}
10264					},
10265					onUpdate: function(){
10266						if ( ! $title[0].isConnected ) {
10267							marqueeTL.kill();
10268							initTextMarquee();
10269						}
10270					},
10271					ease: ease
10272				});
10273		
10274			};
10275			
10276			var runTextMarquee = function(){
10277				var time = Date.now();
10278
10279				var textMarqueeScroll = function(){
10280					var $row = $title.closest('.vc_row');
10281					if ( hasSticky ) {
10282						$row = $title.closest('.sticky-trigger, .sticky-element').parent();
10283					}					
10284					var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
10285
10286					if ( !$bound.length ) {
10287						return;
10288					}
10289
10290					var bound = $bound[0].getBoundingClientRect(),
10291						wait = 100,
10292						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
10293						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
10294
10295					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
10296						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
10297						marqueeAttempts < 2 ) {
10298
10299						clearRequestTimeout(marqueeTO);
10300
10301						marqueeTO = requestTimeout(function(){
10302							marqueeAttempts++;
10303							runTextMarquee();
10304						}, 100);
10305					}
10306
10307
10308					var bound_top = bound.top,
10309						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
10310
10311					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
10312						if ( dataTrigger === 'row-middle' ) {
10313							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5)
10314						}
10315						if ( dataNavBar === 'yes' ) {
10316							bound_top = bound_top - UNCODE.menuHeight;
10317						}
10318						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
10319					}
10320
10321					gsap.killTweensOf($title);
10322					gsap.to( $title, {
10323						duration: 0.24,
10324						x: gsap_calc,
10325					});
10326				};
10327
10328				textMarqueeScroll();
10329				$(window).on( 'load scroll', function(e) {
10330					textMarqueeScroll();
10331				});
10332
10333			};
10334
10335			var cloneSpan = function($_title, cntnt){
10336
10337				if ( $_title.hasClass('un-marquee-infinite') ) {
10338					$('> span.marquee-clone-wrap', $_title).text('');
10339				}
10340
10341				gsap.to( $_title, {
10342					duration: 0,
10343					x: 0
10344				});
10345				spanW = $span.outerWidth();
10346
10347
10348				if ( !spanW ) {
10349					return;
10350				}
10351
10352				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
10353					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
10354
10355				if ( $_title.hasClass('un-marquee-infinite') ) {
10356
10357					for ( var i = 0; i < part; i++ ) {
10358						$prepended.append(cntnt + spaceSpan);
10359						$appended.append(cntnt + spaceSpan);
10360					}
10361				}
10362
10363				if ( $('body').hasClass('compose-mode') ) {
10364					$('.uncode_fe_safe').remove();
10365					return;
10366				}
10367
10368				if ( $title.closest('.marquee-freezed').length ) {
10369					return;
10370				}
10371
10372				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
10373					continuousTextMarquee();
10374				}
10375
10376				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
10377					runTextMarquee();
10378				}
10379
10380			};
10381
10382			var marqueeResize = function(e){
10383				if ( isInMenu ) {
10384					return;
10385				}
10386				var tOut = 1000;
10387				if ( isInMenu ) {
10388						gsap.killTweensOf($title);
10389						if ( typeof inview !== 'undefined' && inview !== null ) {
10390							inview.destroy();
10391						}
10392						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
10393							marqueeTL.kill();
10394						}
10395						first = true;
10396						initTextMarquee();
10397				} else {
10398					clearRequestTimeout(marqueeCheckResize);
10399					marqueeCheckResize = requestTimeout(function(){
10400						if ( newW !== UNCODE.wwidth ) {
10401							gsap.killTweensOf($title);
10402							if ( typeof inview !== 'undefined' && inview !== null ) {
10403								inview.destroy();
10404							}
10405							if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
10406								marqueeTL.kill();
10407							}
10408							first = true;
10409							initTextMarquee();
10410							newW = UNCODE.wwidth;
10411						}
10412					}, tOut);
10413				}
10414			};
10415
10416			$(window).off('resize', marqueeResize)
10417			.on( 'resize', marqueeResize);
10418			$(window).off('uncode.re-layout', marqueeResize)
10419			.on( 'uncode.re-layout', marqueeResize);
10420
10421			cloneSpan($title, txt);
10422
10423			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10424				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
10425					var $_titles = $('.un-text-marquee',e.view.$el);
10426					clearRequestTimeout(marqueeCheckResize);
10427					marqueeCheckResize = requestTimeout(function(){
10428						initTextMarquee($_titles);
10429					}, 1000);
10430				});
10431			}
10432		});
10433
10434		$(window).on( 'load wwResize', function(e) {
10435			stableHeight = UNCODE.wheight;
10436		});
10437
10438	};
10439
10440	document.addEventListener("DOMContentLoaded", function() {
10441		if ( isInitMarque !== true ) {
10442			initTextMarquee();
10443		}
10444	});
10445
10446	$(window).on('focus load resize',function(){
10447		clearTimeout(initMarquee);
10448		initMarquee = setTimeout(function(){
10449			if ( isInitMarque !== true ) {
10450				initTextMarquee();
10451			}
10452		}, 500);
10453	});
10454	
10455	$(document).on('pumAfterOpen pumAfterClose uncode-scrolltrigger-refresh', function(args){
10456			initTextMarquee();
10457	});
10458
10459};
10460	
10461UNCODE.parallax = function() {
10462	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
10463		if ($('.parallax-el').length > 0) {
10464			var parallax_elements = new Rellax('.parallax-el');
10465			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
10466			window.addEventListener('boxResized', function(e) {
10467				parallax_elements.refresh();
10468			}, false);
10469			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
10470				requestTimeout(function() {
10471					parallax_elements.refresh();
10472				}, 100);
10473			});
10474
10475			if ( typeof UNCODE.hDoc === 'undefined' ) {
10476				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
10477					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
10478			}
10479		
10480			function paralraf(time) {
10481				requestAnimationFrame(paralraf)
10482		
10483				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
10484					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
10485				
10486				if ( UNCODE.hDoc !== newHdoc ) {
10487					UNCODE.hDoc = newHdoc;
10488					parallax_elements.refresh();
10489				}
10490			}
10491		
10492			requestAnimationFrame(paralraf)
10493		
10494		}
10495	}
10496};
10497
10498UNCODE.magicCursor = function(){
10499	var $customCursor = $('#uncode-custom-cursor'),
10500		$customPilot = $('#uncode-custom-cursor-pilot'),
10501		$tooltip = $('.title-tooltip', $customCursor),
10502		$cursorSpan = $('> span', $tooltip),
10503		currentBg = false,
10504		fromTitle = false,
10505		setTime,
10506		mouseEvent;
10507
10508		var spanW, spanH,
10509		maxW = false;
10510
10511	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
10512		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
10513			$tooltip.css({opacity: 0});
10514			delayt_time += 400;
10515		}
10516		clearRequestTimeout(setTime);
10517		setTime = requestTimeout(function() {
10518
10519			$tooltip.css({opacity: ''});
10520
10521			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
10522
10523			if ( cursorTitle !== '' ) {
10524				if ( fromTitle && dataTitle === 'boing' ) {
10525					setTimeout(function(){
10526						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
10527					}, 5);
10528				}
10529				$cursorSpan.attr('class', fontClass).html( cursorTitle );
10530			} else {
10531				if ( cursorType !== 'auto' ) {
10532					$cursorSpan.html('');
10533				}
10534			}
10535
10536			$cursorSpan.addClass('in-tooltip');
10537
10538			$customCursor.attr('data-cursor', cursorType);
10539
10540			if ( fromTitle ) {
10541				$customCursor.addClass('from-tooltip-title');
10542			} else {
10543				$customCursor.removeClass('from-tooltip-title');
10544			}
10545
10546			if ( cursorBg !== false ) {
10547				$customCursor.attr('data-bg', 'transparent');
10548			} else {
10549				$customCursor.removeAttr('data-bg');
10550			}
10551
10552			currentBg = cursorBg;
10553
10554			if ( cursorTitle !== '' ) {
10555				fromTitle = true;
10556				$customCursor.attr('data-cursor', cursorType);
10557				$customCursor.attr('data-title', 'true');
10558				$cursorSpan.css({width: ''});
10559			} else {
10560				fromTitle = false;
10561				$customCursor.removeAttr('data-title');
10562			}
10563			spanW = $cursorSpan.outerWidth();
10564			
10565			if ( spanW >= maxW && maxW !== false ) {
10566				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
10567				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
10568					width: maxW
10569				});
10570				spanW = maxW;
10571			} else {
10572				$customCursor.find('> span:first-child').removeClass('max-width');
10573			}
10574			spanH = $cursorSpan.outerHeight();
10575			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
10576				$customCursor.find('> span:first-child').add($tooltip).css({
10577					width: spanW,
10578					height: spanH
10579				});
10580			} else {
10581				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
10582			}
10583			if ( $customPilot.length ) {
10584				$customPilot.attr('data-cursor', cursorType);
10585			}
10586		}, delayt_time);
10587	}
10588
10589	function changeCursor($wrap){
10590		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10591		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
10592			$href = $wrap.find(href),
10593			cursorType,
10594			cursorTitle = '',
10595			tooltip_class = '',
10596			cursorBg = false;
10597
10598		$wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) {
10599			var $this = $(this).addClass("cursor-init"),
10600				$tmb = $this.closest('.tmb'),
10601				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
10602				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
10603				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
10604				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
10605				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
10606				$title = $('.t-entry-title', $tmb),
10607				is_frontend_editor = $this.closest('.vc_controls').length,
10608				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
10609				$parent_cursor = $this.closest('[class*="custom-cursor"]');
10610
10611			if ( is_frontend_editor ) {
10612				cursorType = 'auto';
10613			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
10614				cursorType = data_cursor;
10615			} else if ( $parent_cursor.length ) {
10616				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
10617					cursorType = 'icon-light';
10618				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
10619					cursorType = 'icon-diff';
10620				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
10621					cursorType = 'icon-accent';
10622				} else {
10623					cursorType = 'icon-dark';
10624				}
10625			} else {
10626				cursorType = 'pointer';
10627			}
10628
10629			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
10630				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
10631					cursorTitle = custom_text;
10632				} else {
10633					cursorTitle = $title.clone();
10634					$('a', cursorTitle).replaceWith(function() {
10635						return this.childNodes;
10636					});
10637					$('*', cursorTitle).replaceWith(function(){
10638						return $(this).removeAttr('class');
10639					});
10640					cursorTitle = cursorTitle.html();
10641				}
10642			} else {
10643				cursorTitle = '';
10644			}
10645
10646			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
10647				tooltip_class = data_class;
10648			} else {
10649				tooltip_class = '';
10650			}
10651
10652			if ( cursor_bg == 'true' ) {
10653				cursorBg = true;
10654			} else {
10655				cursorBg = false;
10656			}
10657
10658			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
10659		}).on("mouseleave.cursor", href, function(e) {
10660			var outTime = 150;
10661			if ( currentBg !== false && cursorBg === false ) {
10662				outTime = 0;
10663			}
10664			delayChangeCursor('auto', '', false, outTime, false, '');
10665		});
10666
10667		$(window).on('disable-hover', function(event) {
10668			document.addEventListener("mousemove", function(e) {
10669				mouseEvent = e;
10670			});
10671			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
10672		});
10673
10674		$(window).on('enable-hover', function(event) {
10675			if ( typeof mouseEvent !== 'undefined' ) {
10676				var x = mouseEvent.clientX,
10677					y = mouseEvent.clientY;
10678
10679				var elements = document.elementsFromPoint(x, y),
10680					$element = $(elements[0]);
10681
10682				$element.closest(href).trigger('mouseenter');
10683			}
10684		});
10685
10686	}
10687
10688	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10689		changeCursor();
10690	});
10691
10692	$(document).ajaxComplete(function( event, xhr, settings ) {
10693		changeCursor();
10694	});
10695
10696	$('.isotope-container').on('isotope-layout-complete', function() {
10697		var $this = $(this);
10698		changeCursor($this);
10699	});
10700
10701};
10702
10703UNCODE.magneticCursor = function(){
10704	function magneticCursor($wrap){
10705		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10706		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'));
10707
10708		$magnetics.on('mousemove', function(e){
10709			var $this = $(this),
10710				$el,
10711				bound = e.currentTarget.getBoundingClientRect(),
10712				coeff = 30,
10713				hor = (bound.width / 2) - (e.clientX - bound.left),
10714				ver = (bound.height / 2) - (e.clientY - bound.top),
10715				toX = hor / bound.width * coeff,
10716				toY = ver / bound.height * coeff,
10717				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
10718				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
10719				toScale = Math.max(scaleX, scaleY);
10720
10721			if ( $this.hasClass('magnetic') ) {
10722				$el = $('.background-inner, .header-bg', $this);
10723			} else {
10724				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10725			}
10726
10727			gsap.killTweensOf($el);
10728			gsap.to( $el, {
10729				duration: 0.75,
10730				x: toX,
10731				y: toY,
10732				scale: toScale,
10733				ease: Power1.easeOut,
10734				transformPerspective: 900,
10735				transformOrigin: 'center',
10736				force3D: true
10737			});
10738		}).on('mouseout', function(e){
10739			var $this = $(this),
10740				$el
10741			if ( $this.hasClass('magnetic') ) {
10742				$el = $('.background-inner, .header-bg', $this);
10743			} else {
10744				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10745			}
10746			gsap.killTweensOf($el);
10747			gsap.to( $el, {
10748				duration: 0.6,
10749				y: 0,
10750				x: 0,
10751				scale: 1,
10752				ease: Power1.easeOut,
10753				transformPerspective: 900,
10754				transformOrigin: 'center',
10755				force3D: true
10756			});
10757		});
10758	};
10759
10760	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10761		magneticCursor();
10762	});
10763
10764	$(document).ajaxComplete(function( event, xhr, settings ) {
10765		magneticCursor();
10766	});
10767
10768	$('.isotope-container').on('isotope-layout-complete', function() {
10769		var $this = $(this);
10770		magneticCursor($this);
10771	});
10772
10773};
10774
10775UNCODE.dropImage = function() {
10776
10777	/****************************
10778	 * Image hover *
10779	****************************/
10780	function imageHover(){
10781		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10782			return;
10783		}
10784
10785		var $postLists = $('.uncode-post-titles');
10786		$postLists.each(function(){
10787			var $list = $(this),
10788				timing = parseFloat( $list.attr('data-timing') ),
10789				default_image = $list.hasClass('uncode-post-titles-default-image'),
10790				default_title = $list.hasClass('uncode-post-titles-default-title'),
10791				$tmbs = $('.tmb', $list),
10792				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
10793				clientX,
10794				clientY,
10795				$row_parent = $list.closest('.vc_row'),
10796				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
10797				$col_parent = $list.closest('.uncell'),
10798				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
10799				stoppedScrolling = true,
10800				setCTA;
10801
10802			timing *= 0.001;
10803
10804			var drop_bgs = function(){
10805				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
10806					var $drop = $(this),
10807						srcset = $drop.attr('data-bgset'),
10808						setArr = srcset.split(","),
10809						setArrOrder = [],
10810						biggest = 0,
10811						checkBg = false,
10812						desktopBG = $drop.data('[data-background-image]'),
10813						mobileBG = $drop.data('[data-mobile-background-image]');
10814
10815					if ( $drop.hasClass('srcset-bg-async') ) {
10816
10817						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
10818							return;
10819						}
10820						
10821					}
10822
10823					if ( SiteParameters.uncode_adaptive == true ) {
10824						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
10825							$drop.css({
10826								'background-image' : 'url(' + setArr[0] + ')'
10827							});
10828						}
10829					} else {
10830						for ( var i = 0; i < setArr.length; i++ ) {
10831							var setLoop = setArr[i].trim().split(" ");
10832							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
10833								var parseSet = parseFloat(setLoop[1]);
10834								if ( biggest < parseSet ) {
10835									biggest = parseSet;
10836								}
10837								setArrOrder[parseSet] = setLoop[0];
10838								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
10839									checkBg = true;
10840									$drop.css({
10841										'background-image' : 'url(' + setLoop[0] + ')'
10842									});
10843								}
10844							}
10845						}
10846
10847						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
10848							$drop.css({
10849								'background-image' : 'url(' + setArrOrder[biggest] + ')'
10850							});
10851						}
10852					}
10853
10854				});
10855			};
10856
10857			drop_bgs();
10858
10859			var dropMovesSize = function(){
10860				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
10861					return;
10862				}
10863				$drop_moves.each(function(){
10864					var $drop_move = $(this),
10865						dataW = $drop_move.attr('data-w'),
10866						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
10867					if ( typeof dataW !== 'undefined' && dataW !== null ) {
10868						dataW = screenInfo.width / 12 * parseFloat( dataW );
10869					}
10870					$drop_moves.css({
10871						width: dataW
10872					});
10873
10874					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10875						$anim_parent.on('animationend', function(){
10876							var bound = $anim_parent[0].getBoundingClientRect();
10877							$drop_move.css({
10878								left: bound.x * -1,
10879								top: bound.y * -1,
10880							});
10881						});
10882					}
10883				});
10884
10885
10886			};
10887
10888			dropMovesSize();
10889
10890			$(window).on( 'resize', function(){
10891				clearRequestTimeout(setCTA);
10892				setCTA = requestTimeout( function() {
10893					drop_bgs();
10894					dropMovesSize();
10895				}, 100 );
10896			});
10897
10898			if ( $drop_row_parents.length ) {
10899				$row_parent.addClass( 'drop-added' );
10900			}
10901
10902			$drop_row_parents.each(function(index, val){
10903				var $drop = $(val);
10904				$row_parent.prepend($drop);
10905				manageVideos($drop, false);
10906				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10907					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10908				}
10909				if ( default_image && index == 0 ) {
10910					manageVideos($drop, true);
10911					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10912						image_ph = new Image();
10913					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10914						image_ph.onload = function() {
10915							$drop.addClass('active');
10916							if ( default_title ) {
10917								$list.addClass('drop-hover');
10918								$tmbs.first().addClass('drop-active');
10919							}
10920						};
10921						image_ph.src = bg_img;
10922					}
10923				}
10924			});
10925
10926			if ( $drop_col_parents.length ) {
10927				$col_parent.addClass( 'drop-added' );
10928			}
10929
10930			$drop_col_parents.each(function(index, val){
10931				var $drop = $(this);
10932				$col_parent.prepend($drop);
10933				manageVideos($drop, false);
10934				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10935					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10936				}
10937				if ( default_image && index == 0 ) {
10938					manageVideos($drop, true);
10939					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10940						image_ph = new Image();
10941					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10942						image_ph.onload = function() {
10943							$drop.addClass('active');
10944							if ( default_title ) {
10945								$list.addClass('drop-hover');
10946								$tmbs.first().addClass('drop-active');
10947							}
10948						};
10949						image_ph.src = bg_img;
10950					}
10951				}
10952			});
10953
10954			function manageVideos( $el, start ) {
10955				var videoElem = $('video', $el),
10956					$iframe = $('iframe', $el),
10957					iframeID = $iframe.attr('id');
10958				if ( videoElem.length ) {
10959					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
10960						if ( start ) {
10961							videoElem[0].setCurrentTime(0);
10962							videoElem[0].play();
10963						} else {
10964							videoElem[0].pause();
10965							videoElem[0].setCurrentTime(0);
10966						}
10967					} else {
10968						if ( start ) {
10969							videoElem[0].currentTime = 0;
10970							videoElem[0].play();
10971						} else {
10972							videoElem[0].pause();
10973							videoElem[0].currentTime = 0;
10974						}
10975					}
10976				}
10977
10978				$el.data('active', start);
10979
10980				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
10981					var iframeIDv = iframeID.replace('okplayer-', ''),
10982						optionsV = $(window).data('okoptions-' + iframeIDv),
10983						vimeo = $iframe[0],
10984						playerV = new Vimeo.Player(vimeo),
10985						timeV = 0;
10986
10987					if (optionsV.time != null) {
10988						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
10989						for ( var i = 0; i < timeArr.length; i++ ) {
10990							if ( timeArr[i] === 'h' ) {
10991								timeV += parseFloat(timeArr[i-1]) * 3600;
10992							} else if ( timeArr[i] === 'm' ) {
10993								timeV += parseFloat(timeArr[i-1]) * 60;
10994							} else if ( timeArr[i] === 's' ) {
10995								timeV += parseFloat(timeArr[i-1]);
10996							}
10997						}
10998					}
10999					playerV.setCurrentTime(timeV);
11000					if ( start ) {
11001						playerV.setVolume(0);
11002						playerV.play();
11003					} else {
11004						playerV.pause();
11005					}
11006				} else if ( $el.attr('data-provider') === 'youtube' ) {
11007					if ( start ) {
11008						$el.trigger('uncode-resume');
11009					} else {
11010						$el.trigger('uncode-pause');
11011					}
11012				}
11013
11014			}
11015
11016			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11017
11018				document.addEventListener("mousemove", function(e) {
11019					$drop_moves.each(function(){
11020						var $drop_move = $(this),
11021							duration = 0.4;
11022
11023						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
11024							duration = 0.8;
11025						}
11026
11027						clientX = e.clientX;
11028						clientY = e.clientY;
11029
11030						gsap.to( $drop_move, {
11031							duration: duration,
11032							x: clientX,
11033							y: clientY,
11034							ease: Power1.easeOut,
11035						});
11036					});
11037				});
11038
11039			} else {
11040
11041				$(window).on("touchend scroll", function(e) {
11042					$list.removeClass('drop-hover');
11043					$drop_moves.removeClass('active');
11044					$tmbs.removeClass('drop-active');
11045				});
11046
11047				$drop_moves.each(function(){
11048					var $drop_move = $(this),
11049						$tmb = $drop_move.closest('.tmb'),
11050						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
11051
11052					if ( $anim_parent.hasClass('uncode-skew') ) {
11053						$anim_parent.css({
11054							'transform': 'skew(0)'
11055						});
11056					}
11057
11058					$tmb.on('touchend', function(e){
11059						e.stopPropagation();
11060
11061						$drop_moves.removeClass('active');
11062						$tmbs.removeClass('drop-active');
11063
11064						$list.addClass('drop-hover');
11065						$tmb.addClass('drop-active');
11066						$drop_move.addClass('active');
11067						manageVideos($drop_move, true);
11068						clientX = e.changedTouches[0].clientX;
11069						clientY = e.changedTouches[0].clientY;
11070
11071						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
11072							var bound = $anim_parent[0].getBoundingClientRect();
11073							clientX = clientX - bound.x;
11074							clientY = clientY - bound.y;
11075						}
11076
11077						$drop_move.css({
11078							left: clientX,
11079							top: clientY
11080						});
11081					});
11082				});
11083
11084			}
11085
11086			$tmbs.each(function(e){
11087				var $tmb = $(this),
11088					// $trgr = $('a', $tmb),
11089					$trgr = $tmb,
11090					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
11091					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
11091(.t-inside), .parallax-el'),
11092					$video = $('video', $tmb),
11093					$iframe = $('iframe', $tmb),
11094					$entryTxt = $('.t-entry-text', $tmb),
11095					stopBounding;
11096
11097				$entryTxt.add($drop_move).css({
11098					'transition-duration': timing + 's'
11099				});
11100
11101				if ( $video.length ) {
11102					var vidH = $video[0].videoHeight,
11103						vidW = $video[0].videoWidth;
11104					$video.css({
11105						'height': vidH,
11106						'width': vidW
11107					});
11108				}
11109
11110				if ( $iframe.length ) {
11111					var vidH = $drop_move.attr('data-height'),
11112						vidW = $drop_move.attr('data-width');
11113					$iframe.css({
11114						'height': vidH,
11115						'width': vidW
11116					});
11117				}
11118
11119				$iframe.each(function(){
11120					var $video = $(this),
11121						vidH = $video[0].videoHeight,
11122						vidW = $video[0].videoWidth;
11123					$video.css({
11124						'height': vidH,
11125						'width': vidW
11126					});
11127				});
11128
11129				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
11130					$trgr.on('mouseenter',function(e){
11131
11132						$list.addClass('drop-hover');
11133						$tmbs.removeClass('drop-active');
11134						$tmb.addClass('drop-active');
11135						$drop_move.addClass('active');
11136						manageVideos($drop_move, true);
11137
11138						var clientX = e.clientX,
11139							clientY = e.clientY;
11140						$drop_move.css({
11141							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
11142						});
11143
11144					})
11145					.on('mouseleave', function(e){
11146						$list.removeClass('drop-hover');
11147						$drop_move.css({
11148							'transition-duration': ( timing*1.25 ) + 's'
11149						});
11150						$drop_move.removeClass('active');
11151						$tmb.removeClass('drop-active');
11152						$drop_move.on('transitionend', function(e){
11153							$drop_move.off('transitionend');
11154							$drop_move.css({
11155								'transition-duration': timing + 's'
11156							});
11157							manageVideos($drop_move,false);
11158						});
11159					});
11160
11161					document.addEventListener('visibilitychange', function(){
11162						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
11163							$drop_move.css({
11164								'transition-duration': '0s'
11165							});
11166							$drop_move.removeClass('active');
11167							manageVideos($drop_move, false);
11168						}
11169					});
11170
11171					document.addEventListener('scroll', function(){
11172						window.clearRequestTimeout( stopBounding );
11173						if ( stoppedScrolling ) {
11174							stoppedScrolling = false;
11175							if ( $drop_move.hasClass('active') ) {
11176								$list.removeClass('drop-hover');
11177								$tmbs.removeClass('drop-active');
11178								$drop_move.removeClass('active');
11179								$drop_move.on('transitionend', function(e){
11180									$drop_move.off('transitionend');
11181									$drop_move.css({
11182										'transition-duration': timing + 's'
11183									});
11184									manageVideos($drop_move,false);
11185								});
11186							}
11187						}
11188
11189						stopBounding = requestTimeout(function() {
11190							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
11191								var bound = $anim_parent[0].getBoundingClientRect();
11192								$drop_move.css({
11193									left: bound.x * -1,
11194									top: bound.y * -1,
11195								});
11196							}
11197							stoppedScrolling = true;
11198						}, 500);
11199					});
11200				}
11201
11202				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
11203					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
11204
11205				$drop.css({
11206					'transition-duration': timing + 's'
11207				});
11208
11209				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
11210					$trgr.on('mouseenter',function(e){
11211						$row_parent.add($col_parent).addClass('drop-list-loaded');
11212						$list.addClass('drop-hover');
11213
11214						if ( !$tmb.hasClass('drop-active') ) {
11215							$tmbs.removeClass('drop-active');
11216							$tmb.addClass('drop-active');
11217							if ( default_image && !$drop.hasClass('active') ) {
11218								var $prev = $('[data-drop].active', $row_parent);
11219								$prev.css({
11220									'transition-duration': (timing*1.5) + 's'
11221								});
11222								$prev.removeClass('active');
11223								$prev.on('transitionend', function(e){
11224									$prev.off('transitionend');
11225									manageVideos($prev,false);
11226								});
11227							}
11228							$drop.css({
11229								'transition-duration': timing + 's'
11230							});
11231							$drop.off('transitionend');
11232							$drop.addClass('active');
11233							manageVideos($drop, true);
11234						}
11235					})
11236					.on('mouseleave', function(e){
11237						if ( ( default_image && !default_title ) || !default_image ) {
11238							$list.removeClass('drop-hover');
11239							$tmb.removeClass('drop-active');
11240						}
11241						if ( ! default_image ) {
11242							$drop.css({
11243								'transition-duration': (timing*1.5) + 's'
11244							});
11245							$drop.removeClass('active');
11246
11247							$drop.on('transitionend', function(e){
11248								$drop.off('transitionend');
11249								manageVideos($drop,false);
11250							});
11251						}
11252					});
11253
11254					document.addEventListener('visibilitychange', function(){
11255						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
11256							$drop.css({
11257								'transition-duration': '0s'
11258							});
11259							$drop.removeClass('active');
11260							manageVideos($drop, false);
11261						}
11262					});
11263				}
11264			});
11265
11266		});
11267	};
11268
11269	$(window).on('load', function(event) {
11270		imageHover();
11271	});
11272
11273	var drop_wp_animation = function() {
11274		var $postLists = $('.uncode-post-titles');
11275		$postLists.each(function(){
11276			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
11277				new Waypoint({
11278					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11279					element: val,
11280					handler: function() {
11281						var element = $(this.element),
11282							parent = element.closest('.tmb'),
11283							currentIndex = parent.index(),
11284							delay = currentIndex,
11285							delayAttr = parseInt(element.attr('data-delay'));
11286						if (isNaN(delayAttr)) delayAttr = 100;
11287						var objTimeout = requestTimeout(function() {
11288							element.addClass('start_animation');
11289
11290							var nextTimeout = requestTimeout(function() {
11291								$('.drop-image-separator', parent).addClass('start_animation');
11292							}, 50);
11293
11294						}, delay * delayAttr);
11295						if (!UNCODE.isUnmodalOpen) {
11296							this.destroy();
11297						}
11298					},
11299					offset: UNCODE.isFullPage ? '100%' : '90%'
11300				})
11301			});
11302		});
11303	}
11304
11305	var runWaypoints_TO,
11306		runWaypoints_delay = 0;
11307
11308	var runWaypoints = function(){
11309		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
11310			runWaypoints_delay = 400;
11311		}
11312		clearRequestTimeout(runWaypoints_TO);
11313		runWaypoints_TO = requestTimeout(function() {
11314			drop_wp_animation();
11315		}, runWaypoints_delay);
11316	};
11317	runWaypoints();
11318	$( document.body ).on( 'uncode_waypoints', runWaypoints );
11319	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11320		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
11321			// imageHover();
11322			runWaypoints();
11323		});
11324	}
11325};
11326
11327UNCODE.postTable = function() {
11328
11329	var clickRow = function(){
11330		var $postLists = $('.uncode-post-table');
11331
11332		$postLists.each(function(){
11333			var $postList = $(this),
11334				$tmbClicks = $('.tmb.tmb-click-row', $postList);
11335
11336			$tmbClicks.each(function(){
11337				var $tmb = $(this),
11338					$click = $('.table-click-row', $tmb);
11339				$('*:not(.table-click-row)', $tmb).on('click', function(e){
11340					e.preventDefault();
11341					e.stopPropagation();
11342					$click[0].click();
11343					return false;
11344				});
11345			});
11346
11347		})
11348	};
11349
11350	clickRow();
11351
11352	var hoverRow = function(){
11353		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
11354
11355		$postLists.on('mouseenter', function(){
11356			$(this).addClass('post-table-hover');
11357		});
11358		$postLists.on('mouseleave', function(){
11359			$(this).removeClass('post-table-hover');
11360		});
11361	}
11362
11363	hoverRow();
11364
11365	var drop_wp_animation = function() {
11366		var $postLists = $('.uncode-post-table');
11367		$postLists.each(function(){
11368			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
11369				new Waypoint({
11370					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11371					element: val,
11372					handler: function() {
11373						var element = $(this.element),
11374							parent = element.closest('.tmb'),
11375							currentIndex = parent.index(),
11376							delay = currentIndex,
11377							delayAttr = parseInt(element.attr('data-delay'));
11378						if (isNaN(delayAttr)) delayAttr = 100;
11379						var objTimeout = requestTimeout(function() {
11380							element.addClass('start_animation');
11381						}, delay * delayAttr);
11382						if (!UNCODE.isUnmodalOpen) {
11383							this.destroy();
11384						}
11385					},
11386					offset: UNCODE.isFullPage ? '100%' : '90%'
11387				})
11388			});
11389		});
11390	}
11391
11392	var runWaypoints_TO,
11393		runWaypoints_delay = 0;
11394
11395	var runWaypoints = function(){
11396		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
11397			runWaypoints_delay = 400;
11398		}
11399		clearRequestTimeout(runWaypoints_TO);
11400		runWaypoints_TO = requestTimeout(function() {
11401			drop_wp_animation();
11402		}, runWaypoints_delay);
11403	};
11404	runWaypoints();
11405	$( document.body ).on( 'uncode_waypoints', runWaypoints );
11406	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11407		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
11408			runWaypoints();
11409			// clickRow();
11410		});
11411	}
11412};
11413
11414UNCODE.rotatingTxt = function($ctxt) {
11415
11416	if ( $('body').hasClass('compose-mode') ) {
11417		return;
11418	}
11419
11420	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
11421	var setCTA;
11422
11423	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
11424		var $heading = $(this),
11425			// debug = 0,
11426			cycle = 0,
11427			$trgt,
11428			$toMove,
11429			$highl,
11430			$col = $heading.closest('.uncont'),
11431			txt,
11432			arrTxt,
11433			textFadeIn, textFadeOut,
11434			removeWraps;
11435
11436		var defineObjs = function() {
11437			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
11438				var $rtx = $(this),
11439					fx = $rtx.attr('data-fx'),
11440					wait = $rtx.attr('data-wait'),
11441					$prev = $(this).prev().addClass('prev-rotating-start'),
11442					splitToMove = [],
11443					splitArray = [],
11444					lineArray = [],
11445					lineIndex = 0,
11446					lineStart = true,
11447					lineEnd = false,
11448					startSplit = false,
11449					$line_wrap = $rtx.closest('.heading-line-wrap'),
11450					same_line = true,
11451					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
11452					indexRtx = $splits.index($rtx);
11453
11454				fx = typeof fx === 'undefined' ? '' : fx;
11455				wait = typeof wait === 'undefined' ? '' : wait;
11456
11457				$splits.each(function(key, val){
11458					var $split = $(this),
11459						$new_line_wrap = $split.closest('.heading-line-wrap');
11460
11461					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
11462						splitArray.push( $split );
11463					}
11464
11465					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
11466						startSplit = false;
11467					}
11468
11469					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
11470						splitArray.push( $split );
11471
11472						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
11473							same_line = true;
11474						} else {
11475							same_line = false;
11476						}
11477					}
11478
11479					if ( key == indexRtx ) {
11480						if ( /\S/.test($split.text()) ) {
11481							startSplit = true;
11482							$line_wrap = $split.closest('.heading-line-wrap');
11483							splitArray.push( $split );
11484						} else {
11485							indexRtx++;
11486						}
11487					}
11488
11489					$line_wrap = $new_line_wrap;
11490				});
11491
11492				$toMove = $($.map(splitToMove, function(el){return el.get();}));
11493				$trgt = $($.map(splitArray, function(el){return el.get();}));
11494
11495				if ( same_line ) {
11496					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
11497					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
11498				}
11499
11500				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
11501					$prev.addClass('empty-span-hidden');
11502				}
11503
11504				$highl = $('.heading-text-highlight-inner', $trgt);
11505
11506				$rtx.attr('data-animated', 'true');
11507				if ( cycle == 0 ) {
11508					$( document.body ).trigger('defer-highlights');
11509					cycle++;
11510					defineObjs();
11511					return;
11512				}
11513				cycle++;
11514
11515				txt = $rtx.attr('data-text');
11516				arrTxt = txt.split("|");
11517
11518				textFadeOut($trgt);
11519
11520			});
11521		};
11522
11523		removeWraps = function(){
11524
11525			// if ( debug == 1 ) return;
11526			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
11527			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
11528
11529
11530				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
11531					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
11532
11533				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
11534
11535				$splitFlow.each(function(){
11536					$(this).append($temp_highl);
11537				});
11538
11539				var $line_wrap = $wraps[wrap_k];
11540				var $parent_wrap = $line_wrap.parentNode;
11541				if ( $parent_wrap !== null ) {
11542					while ( $line_wrap.firstChild ) {
11543						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
11544					}
11545					$parent_wrap.removeChild($line_wrap);
11546				}
11547			}
11548			// debug++;
11549			defineObjs();
11550		};
11551
11552		var loop = 0;
11553		textFadeIn = function($trgt){
11554			var word = arrTxt[loop].split(" "),
11555				worsSpan = '',
11556				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11557				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11558				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
11559
11560			for (var w = 0; w < word.length; w++) {
11561				var highl;
11562				if ( $highl.length ) {
11563					highl = $highl[0].outerHTML;
11564				} else {
11565					highl = '';
11566				}
11567
11568				if ( w > 0 ) {
11569					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
11570				}
11571				var charachters = word[w].split('');
11572				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
11573				if ( ! SiteParameters.uncode_has_ligatures ) {
11574					for (var c = 0; c < charachters.length; c++) {
11575						worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
11576					}
11577				} else {
11578					worsSpan += word[w];
11579				}
11580				worsSpan += '</span>' + highl + '</span></span>';
11581			}
11582
11583			if ( $wrap.length && $wrap_inner.length ) {
11584				var words_w = $wrap_inner.outerWidth();
11585				$wrap.css({
11586					width: words_w
11587				});
11588
11589				$highl = $('.heading-text-highlight-inner', $wrap);
11590				$highl.prependTo($wrap);
11591
11592				$wrap_inner.css({
11593					opacity: 0
11594				});
11595
11596				$wrap_inner.html(worsSpan);
11597				$('.heading-text-highlight-inner', $wrap_inner).remove();
11598				words_w = $wrap_inner.innerWidth();
11599
11600				var duration = 0.45;
11601
11602				$heading.removeClass('auto-width');
11603				if ( words_w > $col.width() ) {
11604					$heading.addClass('auto-width');
11605					words_w = 'auto';
11606					duration = 0;
11607				}
11608
11609				$wrap.css({
11610					'width': words_w,
11611					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
11612				});
11613
11614				var $word_inner = $('.split-word-inner', $wrap_inner),
11615					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
11616
11617				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11618
11619				if ( !$target_fx.length ) {
11620					return;
11621				}
11622
11623				gsap.killTweensOf($target_fx);
11624
11625				if ( fx !== 'zoom' ) {
11626					gsap.fromTo( $target_fx, {
11627						y: fx === 'opacity' ? '0%' : '-10%'
11628					},{
11629						delay: duration,
11630						duration: 0.25,
11631						y: '0%',
11632						ease: Circ.easeOut,
11633					});
11634
11635					if ( !$wrap_inner.length ) {
11636						return;
11637					}
11638
11639					gsap.fromTo( $wrap_inner, {
11640						opacity: 0,
11641					},{
11642						delay: duration,
11643						duration: 0.25,
11644						opacity: 1,
11645						ease: Circ.easeOut,
11646						onComplete: function(){
11647							$('> .heading-text-highlight-inner', $wrap).remove();
11648							$wrap_inner.html(worsSpan);
11649							removeWraps();
11650						}
11651					})
11652
11653				} else {
11654					gsap.fromTo( $target_fx, {
11655						transformOrigin: '50%',
11656						opacity: 0,
11657						scale: 0.875,
11658					},{
11659						opacity: 1,
11660						delay: duration,
11661						duration: 0.25,
11662						scale: 1,
11663						ease: Circ.easeOut,
11664						onComplete: function(){
11665							$('> .heading-text-highlight-inner', $wrap).remove();
11666							$wrap_inner.html(worsSpan);
11667							removeWraps();
11668						}
11669					});
11670				}
11671
11672			} else {
11673
11674				if ( !$wrap_inner.length ) {
11675					return;
11676				}
11677
11678				gsap.to( $wrap_inner, {
11679					duration: 0.4,
11680					opacity: 0,
11681					ease: Power1.easeOut,
11682					onComplete: function(){
11683						$wrap_inner.html(worsSpan);
11684						words_w = $wrap_inner.innerWidth();
11685
11686						gsap.to( $wrap_inner, {
11687							duration: 0.2,
11688							opacity: 1,
11689							ease: Power1.easeOut,
11690							onComplete: function(){
11691								$('> .heading-text-highlight-inner', $wrap).remove();
11692								$wrap_inner.html(worsSpan);
11693								removeWraps();
11694							}
11695						})
11696					}
11697				});
11698			}
11699
11700			if ( loop < arrTxt.length-1 ) {
11701				loop++;
11702			} else {
11703				loop = 0;
11704			}
11705
11706		};
11707
11708		textFadeOut = function($trgt){
11709			var $word_inner = $('.split-word-inner', $trgt),
11710				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11711				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11712				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
11713				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
11714
11715			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
11716
11717			var gsap_param = {
11718					delay: wait,
11719					duration: 0.25,
11720					y: fx === '' ? '10%' : '0%',
11721					opacity: 0,
11722					ease: Circ.easeOut,
11723					onStart: function(){
11724						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
11725							$highl = $('.heading-text-highlight-inner', $wrap);
11726							$highl.prependTo($wrap);
11727						}
11728					},
11729					onComplete: textFadeIn,
11730					onCompleteParams: [$trgt]
11731				};
11732
11733			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11734
11735			if ( fx === '' ) {
11736				gsap_param.y = '10%';
11737			} else if ( fx === 'zoom' ) {
11738				gsap_param.scale = '1.045';
11739			}
11740
11741			if ( !$target_fx.length ) {
11742				return;
11743			}
11744
11745			if ( $heading.data('waypoint') !== true ) {
11746				var textInView = new Waypoint.Inview({
11747					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11748					element: $heading[0],
11749					enter: function(direction) {
11750						$heading.data('waypoint',true);
11751						gsap.fromTo( $target_fx, {
11752							transformOrigin: '50%'
11753						}, gsap_param );
11754					}
11755				});
11756			} else {
11757				gsap.fromTo( $target_fx, {
11758					transformOrigin: '50%'
11759				}, gsap_param );
11760			}
11761		};
11762
11763		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11764			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
11765				var $el = model.view.$el,
11766					shortcode = model.attributes.shortcode;
11767
11768				UNCODE.rotatingTxt($el);
11769			});
11770		} else {
11771			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
11772				$heading.on('already-animated', function(){
11773					removeWraps();
11774					window.addEventListener('removeOldLines', function(){
11775						clearRequestTimeout(setCTA);
11776						setCTA = requestTimeout( removeWraps, 150 );
11777					});
11778				});
11779			} else {
11780				$(window).on('load', function(){
11781					removeWraps();
11782					window.addEventListener('removeOldLines', function(){
11783						clearRequestTimeout(setCTA);
11784						setCTA = requestTimeout( removeWraps, 150 );
11785					});
11786				});
11787			}
11788		}
11789	});
11790
11791};
11792
11793UNCODE.verticalText = function() {
11794	$(window).on('menuCanvasOpen', function(){
11795		$('.vertical-text--fixed').fadeOut(500);
11796		$('.horizontal-text--fixed').fadeOut(500);
11797	}).on('menuCanvasClose', function(){
11798		$('.vertical-text--fixed').fadeIn(500);
11799		$('.horizontal-text--fixed').fadeIn(500);
11800	});
11801
11802	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
11803	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
11804	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
11805	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
11806
11807	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
11808		window.addEventListener('scroll', function(e) {
11809			var totalPageHeight = document.body.scrollHeight;
11810			var scrollPoint = window.scrollY + window.innerHeight;
11811
11812			if (window.scrollY > 0) {
11813				showOnTopVerticalTexts.fadeOut();
11814				showOnTopHorizontalTexts.fadeOut();
11815			} else {
11816				showOnTopVerticalTexts.fadeIn();
11817				showOnTopHorizontalTexts.fadeIn();
11818			}
11819
11820			if (scrollPoint >= totalPageHeight) {
11821				hideOnBottomVerticalTexts.fadeOut();
11822				hideOnBottomHorizontalTexts.fadeOut();
11823			} else {
11824				hideOnBottomVerticalTexts.fadeIn();
11825				hideOnBottomHorizontalTexts.fadeIn();
11826			}
11827		}, false);
11828	}
11829};
11830
11831UNCODE.stickyScroll = function( $el ) {
11832	if ( typeof $el === 'undefined' || $el === null ) {
11833		$el = $('body');
11834	}
11835	var checkVisible = function( el, dir ) {
11836		if (typeof jQuery === "function" && el instanceof jQuery) {
11837			el = el[0];
11838		}
11839
11840		var off = 50;
11841		dir = typeof dir=='undefined' ? 'right' : dir;
11842		var rect = el.getBoundingClientRect();
11843
11844		return (
11845			(
11846				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11847				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11848				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
11849			) &&
11850			(
11851				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11852				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11853				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
11854				( rect.right <= window.innerWidth && rect.left >= 0 )
11855			)
11856		);
11857	};
11858
11859	var setItemsRelHeight = function(reset) {
11860		var $_el = $el;
11861		if ( $el.is('.index-scroll') ) {
11862			var $_el = $el.closest('.uncont');
11863		}
11864		// $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
11865		// 	$.each($('.tmb', item), function(index, val) {
11866		// 		if ( reset === true ) {
11867		// 			$(val).css( 'visibility', 'hidden' );
11868		// 		} else {
11869		// 			$(val).css( 'visibility', 'visible' );
11870		// 		}
11871		// 	});
11872		// });
11873		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
11874			$.each($('.tmb', item), function(index, val) {
11875				if ( reset === true ) {
11876					$(val).css( 'visibility', 'hidden' );
11877					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
11878				} else {
11879					var $rowParent = $(item).closest('.row-parent'),
11880						rowRatio = $rowParent.attr('data-height-ratio'),
11881						$rowInner = $(item).closest('.row-child'),
11882						rowRatioInner = $rowInner.attr('data-height'),
11883						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11884						$colContainer = $(item).closest('.uncell'),
11885						$uncont = $(item).closest('.uncont'),
11886						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
11887						safe_heigth = $(item).data('safe-height'),
11888						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
11889						offSet = $(item).offset().top - $uncont.offset().top,
11890						multiplier_h,
11891						data_viewport_h,
11892						body_border = $('.body-borders .top-border').outerHeight() * 2,
11893						remove_menu = $(item).data('vp-menu');
11894
11895					if ( rowRatio === 'full' || rowRatio === '' ) {
11896						rowRatio = 1;
11897					} else {
11898						rowRatio = rowRatio / 100;
11899					}
11900
11901					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
11902						rowRatio = rowRatio;
11903					} else {
11904						rowRatio = rowRatio * rowRatioInner / 100;
11905					}
11906
11907					winHeight = winHeight * rowRatio;
11908
11909					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11910						multiplier_h = parseInt($(item).attr('data-vp-height'));
11911					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
11912						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
11913					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
11914						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
11915					}
11916
11917					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
11918						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
11919						if ( remove_menu === true ) {
11920							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
11921						}
11922						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
11923					} else {
11924						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
11925					}
11926
11927				}
11928			});
11929		});
11930		$('.index-scroll', $_el).each(function(i, item){
11931			var $uncoltable = $(item).closest('.uncoltable'),
11932				$rowParent = $(item).closest('.row-parent'),
11933				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11934				body_border = $('.body-borders .top-border').outerHeight() * 2,
11935				$index_row = $('.index-row', item),
11936				safe_heigth = $index_row.data('safe-height'),
11937				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
11938			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
11939				var data_viewport_h = winHeight - ( paddingRow + body_border );
11940				$uncoltable.css({
11941					'min-height': data_viewport_h
11942				});
11943			} else {
11944				$uncoltable.css({
11945					'min-height': 'auto'
11946				});
11947			}
11948		});
11949
11950	}
11951	setItemsRelHeight();
11952
11953	var $index_scrolls = $('.index-scroll', $el);
11954
11955	$index_scrolls.each(function(key, value){
11956		var $index = $(this),
11957			$parent_row = $index.closest('.vc_row[data-parent]'),
11958			$index_row = $('.index-row', $index),
11959			dir = $index_row.attr('data-direction');
11960		dir = typeof dir === 'undefined' ? 'right' : dir;
11961
11962		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
11963
11964		if ( $('.animate_when_almost_visible', $index).length ) {
11965			$index.addClass('opacity_0').addClass('scroll-refresh-hidden');
11966		}
11967
11968	});
11969
11970	var $horScrolls = $('.unscroll-horizontal', $el);
11971
11972	if ( $horScrolls.length ) {
11973
11974		$('body').addClass('scrolling-trigger');
11975
11976		$horScrolls.each(function(key, value){
11977			var $section = $(this),
11978				$index_scroll = $('.index-scroll', $section),
11979				$index_row = $('.index-row', $index_scroll),
11980				dir = $section.attr('data-direction'),
11981				wrap = $index_row.attr('data-wrap'),
11982				$pinWrap,
11983				$pinTrigger;
11984
11985			dir = typeof dir === 'undefined' ? 'right' : dir;
11986			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
11987			$pinWrap = $('<div class="pin-wrap" />');
11988			if ( SiteParameters.is_frontend_editor ) {
11989				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
11990				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
11991			} else {
11992				if ( wrap === 'column' ) {
11993					$index_scroll.wrapInner( $pinWrap );
11994				} else {
11995					$('> .row', $section).wrap( $pinWrap );
11996				}
11997				$section.wrapInner( $pinTrigger );
11998			}
11999
12000		});
12001
12002		var $pinWraps = $('.pin-wrap', $el);
12003
12004		var horScrollSizes = function(){
12005
12006			$pinWraps.each(function(key, val){
12007				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
12008					$pinTrigger = $pinWrap.closest('.pin-trigger'),
12009					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
12010					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
12011					$boxContainer = $('.box-container'),
12012					box_m = $boxContainer.css('margin-left'),
12013					st_active = true;
12014
12015				var setHorW,
12016				horWidth = function(){
12017					$index_scroll.each(function(){
12018						var $this = $(this),
12019							$index_row = $('.index-row', $this),
12020							$rowContainer = $index_row.closest('.vc_row'),
12021							$rowInner = $index_row.closest('.wpb_row'),
12022							$rowParent = $index_row.closest('.row-parent'),
12023							$tmbs = $('.tmb', $index_row),
12024							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
12025							$uncont = $index_row.closest('.uncont'),
12026							$parent_col = $index_row.closest('.wpb_column'),
12027							col_w = $uncont.width(),
12028							data_lg = parseFloat( $index_row.attr('data-lg') ),
12029							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
12030							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
12031							tmb_w;
12032
12033						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
12034						tmb_w = ( col_w + padding_tmb ) / data_lg;
12035
12036						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
12037							tmb_w = ( col_w + padding_tmb ) / data_sm;
12038						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
12039							tmb_w = ( col_w + padding_tmb ) / data_md;
12040						}
12041
12042						if ( !isNaN(tmb_w) ) {
12043							$tmbs.css({
12044								'width': tmb_w
12045							});
12046						}
12047
12048						$tmbs.css({
12049							'visibility': 'visible'
12050						});
12051
12052					});
12053				};
12054
12055				horWidth();
12056				clearRequestTimeout(setHorW);
12057				setHorW = requestTimeout( function(){
12058					setItemsRelHeight();
12059					horWidth();
12060				}, 100 );
12061
12062				if ( SiteParameters.is_frontend_editor ) {
12063					return;
12064				}
12065
12066				var $vmenu = $('body.vmenu .vmenu-container'),
12067					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
12068					winWidth = window.innerWidth - vmenuW,
12069					$tmb = $('.tmb', $index_scroll).eq(0),
12070					paddingRight = parseFloat( $tmb.css('padding-right') ),
12071					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_
12071scroll.width() + paddingRight ) ),
12072					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
12073					scroll_anim;
12074
12075				if ( $('body').hasClass('rtl') ) {
12076					if ( dir === 'left' ) {
12077						scroll_anim = gsap.fromTo( $pinWrap, {
12078							x: stickyScrollLength
12079						},{
12080							x: 0,
12081							ease: "none"
12082						});
12083					} else {
12084						scroll_anim = gsap.fromTo( $pinWrap, {
12085							x: 0
12086						},{
12087							x: stickyScrollLength,
12088							ease: "none"
12089						});
12090					}
12091				} else {
12092					if ( dir === 'left' ) {
12093						scroll_anim = gsap.fromTo( $pinWrap, {
12094							x: -stickyScrollLength
12095						},{
12096							x: 0,
12097							ease: "none"
12098						});
12099					} else {
12100						scroll_anim = gsap.fromTo( $pinWrap, {
12101							x: 0
12102						},{
12103							x: -stickyScrollLength,
12104							ease: "none"
12105						});
12106					}
12107				}
12108
12109				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
12110					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
12111				}
12112
12113				var animationIncrease;
12114
12115				var checkForAnimations = function(){
12116					animationIncrease = 0
12117					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
12118						var _this = this;
12119						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
12120							var delayAttr = parseFloat( $(_this).attr('data-delay') );
12121							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
12122							requestTimeout(function() {
12123								$(_this).addClass('start_animation');
12124							}, delayAttr + animationIncrease);
12125							animationIncrease += 150;
12126						}
12127						$(_this).on([
12128							'webkitAnimationEnd',
12129							'mozAnimationEnd',
12130							'MSAnimationEnd',
12131							'oanimationend',
12132							'animationend'
12133						].join(' '), function(e) {
12134							$(e.currentTarget).removeClass('animate_when_almost_visible');
12135						});
12136					});
12137
12138					var batchTime = 0;
12139
12140					var resetBatch = function(){
12141						batchTime = 0;
12142					}
12143
12144					if (ScrollTrigger.isScrolling()) {
12145						resetBatch();
12146					}
12147					
12148					$('.tmb-mask-reveal', $pinTrigger).each(function(){
12149						var _this = this,
12150							$this = $(_this),
12151							$inside = $('.t-inside', $this),
12152							delay = parseFloat( $inside.attr('data-delay') ),
12153							speed = parseFloat( $inside.attr('data-speed') ),
12154							easing = $inside.attr('data-easing'),
12155							bgDelay = parseFloat( $inside.attr('data-bg-delay') );
12156
12157						delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
12158						speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
12159						easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
12160						bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
12161
12162						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) {
12163							$this.addClass('tmb-mask-init');
12164							if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) {
12165								gsap.to($('.t-entry-visual-tc', $this), speed, {
12166									clipPath: 'inset(0% 0% 0% 0%)',
12167									delay: delay + batchTime,
12168									ease: easing,
12169								});
12170								gsap.to($('.t-entry-visual-cont', $this), speed, {
12171									clipPath: 'inset(0% 0% 0% 0%)',
12172									scale: 1,
12173									delay: delay + batchTime + (speed*bgDelay),
12174									ease: easing,
12175									onComplete: resetBatch,
12176								});
12177							} else {
12178								gsap.to($('.t-entry-visual-cont', $this), speed, {
12179									clipPath: 'inset(0% 0% 0% 0%)',
12180									scale: 1,
12181									delay: delay + batchTime,
12182									ease: easing,
12183									onComplete: resetBatch,
12184								});
12185							}
12186							batchTime += 0.1;
12187						}
12188					});
12189				
12190				};
12191				checkForAnimations();
12192
12193				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
12194				var start = 0;
12195
12196				var horST = ScrollTrigger.create({
12197					id: "stickySectionScrolling" + key,
12198					scrub: true,
12199					trigger: $pinTrigger[0],
12200					pin: true,
12201					anticipatePin: 1,
12202					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
12203					end: function() { return "+="+stickyScrollLength; },
12204					animation: scroll_anim,
12205					ease: Sine.easeOut,
12206					onUpdate: checkForAnimations,
12207					invalidateOnRefresh: true,
12208					onEnter: function(){
12209						$pinTrigger.addClass('enter-st');
12210					},
12211					onEnterBack: function(){
12212						$pinTrigger.addClass('enter-st');
12213					},
12214					onLeave: function(){
12215						$pinTrigger.removeClass('enter-st');
12216					},
12217					onLeaveBack: function(){
12218						$pinTrigger.removeClass('enter-st');
12219					}
12220				});
12221
12222				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
12223				window.dispatchEvent(new CustomEvent('boxResized'));
12224
12225				var testSecondTrigger = function(){
12226					animationIncrease = 0
12227					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
12228						var _this = this;
12229						if ( checkVisible(_this) ) {
12230							var delayAttr = parseFloat( $(_this).attr('data-delay') );
12231							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
12232							requestTimeout(function() {
12233								$(_this).addClass('start_animation');
12234							}, delayAttr + animationIncrease);
12235							animationIncrease += 150;
12236						}
12237					});
12238
12239				};
12240
12241				var verST = ScrollTrigger.create({
12242					id: "verticalSectionScrolling" + key,
12243					trigger: $pinTrigger[0],
12244					start: "top center",
12245					end: function() { return "+="+UNCODE.wheight; },
12246					onUpdate: testSecondTrigger,
12247					invalidateOnRefresh: true
12248				});
12249
12250				var setCTA,
12251
12252				dis_enable_ST = function(){
12253					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
12254						horST.kill();
12255						verST.kill();
12256						$pinTrigger.addClass('disabled');
12257						st_active = false;
12258					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12259						horST.kill();
12260						verST.kill();
12261						$pinTrigger.addClass('disabled');
12262						st_active = false;
12263					}
12264				};
12265
12266				$(window).on('resize load', function() {
12267					clearRequestTimeout(setCTA);
12268					setCTA = requestTimeout(function() {
12269						dis_enable_ST();
12270						checkForAnimations();
12271					}, 500);
12272				});
12273
12274			});
12275		};
12276
12277		$(window).on( 'load', function(){
12278			horScrollSizes();
12279		});
12280		var setResize,
12281			setReLayout,
12282			doubleResize = true;
12283		$(window).on( 'load', function(){
12284			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
12285				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
12286				Array.prototype.forEach.call($row_inners, function(el) {
12287					el.style.height = '';
12288					el.style.marginBottom = '';
12289				});
12290				setItemsRelHeight();
12291				horScrollSizes();
12292				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12293					$(document).trigger('uncode-scrolltrigger-refresh');
12294				}
12295			}
12296			var carousel = document.querySelector(".owl-carousel"),
12297				grid = document.querySelector(".isotope-container"),
12298				stickyAll = document.querySelectorAll(".index-scroll");
12299
12300			if ( stickyAll.length ) {
12301				var sticky = stickyAll[(stickyAll.length-1)];
12302			}
12303
12304			if ( typeof sticky !== "undefined" ) {
12305
12306				if ( typeof carousel !== "undefined" && carousel !== null ) {
12307					var carousel_position = sticky.compareDocumentPosition(carousel);
12308				}
12309				if ( typeof grid !== "undefined" && grid !== null ) {
12310					var grid_position = sticky.compareDocumentPosition(grid);
12311				}
12312
12313				if ( carousel_position === 2 || grid_position === 2 ) {
12314					setTimeout(function(){
12315						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12316							$(document).trigger('uncode-scrolltrigger-refresh');
12317						}
12318					}, 500);
12319				}
12320
12321			}
12322			
12323		});
12324        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
12325            android = /Android/.test(navigator.userAgent) && !window.MSStream;
12326		$(window).on( 'resize orientationchange', function(e){
12327			if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
12328				return;
12329			}
12330			setItemsRelHeight(true);
12331			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
12332			Array.prototype.forEach.call($row_inners, function(el) {
12333				el.style.height = '';
12334				el.style.marginBottom = '';
12335			});
12336			clearRequestTimeout(setResize);
12337			setResize = requestTimeout( function(){
12338				setItemsRelHeight();
12339				horScrollSizes();
12340				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12341					$(document).trigger('uncode-scrolltrigger-refresh');
12342				}
12343				if ( doubleResize === true ) {
12344					window.dispatchEvent(new Event('resize'));
12345					doubleResize = false;
12346				} else {
12347					doubleResize = true;
12348				}
12349				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
12350			}, 100 );
12351		});
12352
12353		var show_pins = function(){
12354			$('.index-scroll').css({'opacity':'1'});
12355		};
12356		ScrollTrigger.addEventListener("refresh", show_pins);
12357		$(window).on( 'uncode.re-layout', function(){
12358			//$('.index-scroll').css({'opacity':'0'});
12359			$('.pin-spacer').each(function(){
12360				var space_h = $(this).outerHeight(),
12361					$row = $(this).closest('.row-container');
12362				$row.css({
12363					'height': space_h,
12364					'overflow': 'hidden'
12365				});
12366			});
12367			if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
12368				ScrollTrigger.refresh(true);
12369			}
12370			clearRequestTimeout(setReLayout);
12371			setReLayout = requestTimeout( function(){
12372				$('.row-container').each(function(){
12373					$(this).css({
12374						'height': '',
12375						'overflow': ''
12376					});
12377				});
12378			}, 1000);
12379		});
12380	}
12381
12382};
12383
12384UNCODE.stickyTrigger = function( $el ) {
12385    if ( SiteParameters.is_frontend_editor ) {
12386        return false;
12387    }
12388
12389    var stickyTrigger = function(){
12390        var stickyTrick = $('.sticky-trigger').each(function(){
12391            var $sticky = $(this),
12392                $inside = $('> div', $sticky),
12393                insideH = $inside.outerHeight(),
12394                $row = $sticky.closest('.vc_row'),
12395                $uncont = $sticky.closest('.uncont'),
12396                rowBottom,
12397                uncontBottom,
12398                diffBottom;
12399
12400            ScrollTrigger.create({
12401                trigger: $sticky,
12402                start: function(){ return "top center-=" + insideH/2; },
12403                endTrigger: $row,
12404                end:  function(){
12405                    rowBottom = $row.offset().top + $row.outerHeight();
12406                    uncontBottom = $uncont.offset().top + $uncont.outerHeight();
12407                    diffBottom = rowBottom - uncontBottom;
12408                    return "bottom center+=" + ( insideH/2 + diffBottom );
12409                },
12410                anticipatePin: true,
12411                pin: true,
12412                pinSpacing: false,
12413                scrub: true,
12414                invalidateOnRefresh: true,
12415            });
12416
12417        });
12418    },
12419    setResizeSticky;
12420
12421    $(window).on( 'load', function(){
12422        stickyTrigger();
12423        var carousel = document.querySelector(".owl-carousel"),
12424            grid = document.querySelector(".isotope-container"),
12425            stickyAll = document.querySelectorAll(".sticky-trigger");
12426
12427        if ( stickyAll.length ) {
12428            var sticky = stickyAll[(stickyAll.length-1)];
12429        }
12430
12431        if ( typeof sticky !== "undefined" ) {
12432
12433            if ( typeof carousel !== "undefined" && carousel !== null ) {
12434                var carousel_position = sticky.compareDocumentPosition(carousel);
12435            }
12436            if ( typeof grid !== "undefined" && grid !== null ) {
12437                var grid_position = sticky.compareDocumentPosition(grid);
12438            }
12439
12440            if ( carousel_position === 2 || grid_position === 2 ) {
12441                setTimeout(function(){
12442                    $(document).trigger('uncode-scrolltrigger-refresh');
12443                }, 500);
12444            }
12445
12446        }
12447    });
12448
12449    var oldW = UNCODE.wwidth;
12450    $(window).on( 'resize uncode.re-layout', function(e){
12451        clearRequestTimeout(setResizeSticky);
12452        if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
12453            return;
12454        } else {
12455            oldW = UNCODE.wwidth;
12456        }
12457        setResizeSticky = requestTimeout( function(){
12458            stickyTrigger();
12459            $(document).trigger('uncode-scrolltrigger-refresh');
12460        }, 1000 );
12461    });
12462
12463    
12464};
12465
12466UNCODE.areaTextReveal = function() {
12467    if ( ! $('.text-reveal, .scroll-trigger-el').length ) {
12468        return;
12469    }
12470	if ( ! SiteParameters.is_frontend_editor ) {
12471        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
12472            android = /Android/.test(navigator.userAgent) && !window.MSStream,
12473            prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
12474            prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
12475                document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
12476            firstObs = true,
12477            isMobileUsing = false;
12478
12479        var observer = new ResizeObserver(function(){
12480            var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
12481                newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
12482                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
12483                set = false;
12484            if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
12485                set = true;
12486                prevW = newW;
12487            } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
12488                set = true;
12489                prevH = newH;
12490            }
12491            if ( set || firstObs ) {
12492                window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe'));
12493                firstObs = false;
12494            }
12495        }).observe(document.body);
12496
12497        if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
12498            window.scrollTo = function() {
12499                return;
12500            };
12501            isMobileUsing = true;
12502
12503            $('html, body').css({
12504                'overscroll-behavior': 'none'
12505            });
12506        }
12507
12508        var setTriggerObserve;
12509
12510        ScrollTrigger.observe({
12511            trigger: 'body',
12512            type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
12513            onUp: function() { ScrollTrigger.update(); },
12514        });
12515    }
12516
12517    var textReveal = function(){
12518
12519        if ( SiteParameters.is_frontend_editor ) {
12520            return;
12521        }
12522
12523        var setTxtReveal,
12524            txtTrggrStart = false;
12525
12526        function headingReveal($sel){
12527            txtTrggrStart = true;
12528            $('.text-reveal', $sel).each(function(val, key){
12529                var $txtReveal = $(this).attr('data-init-reveal', true),
12530                    $trigger = $txtReveal,
12531                    $rowParent = $txtReveal.closest('.row-container[data-parent]'),
12532                    hReveal = $txtReveal.outerHeight(),
12533                    $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'),
12534                    $sticky = $txtReveal.closest('.sticky-element'),
12535                    dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
12536                    dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
12537                    dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')),
12538                    $lines = $('.heading-line-wrap', $txtReveal),
12539                    $words = $('.split-word-inner', $txtReveal),
12540                    $chars = $('.split-char', $txtReveal),
12541                    $elToReveal = $words;
12542
12543                if ( $pin.length ) {
12544                    return;
12545                } else if ( $sticky.length ) {
12546                    hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop);
12547                    $trigger = $sticky.parent();
12548                }
12549
12550                if ( dataReveal === 'chars' ) {
12551                    $elToReveal = $chars;
12552                } else if ( dataReveal === 'lines' ) {
12553                    $elToReveal = $lines;
12554                }
12555                
12556                var tl = gsap.timeline({
12557                    scrollTrigger: {
12558                        trigger: $trigger,
12559                        start: "top +=" + (window.innerHeight/100*dataTop) + "px",
12560                        end: "+=" + hReveal + "px",
12561                        id: "txt_reveal_" + key,
12562                        scrub: true,
12563                    }
12564                });
12565                gsap.set(
12566                    $elToReveal, {
12567                        opacity: dataRevealOpacity,
12568                    }
12569                )
12570                tl.fromTo($elToReveal, {
12571                    opacity: dataRevealOpacity,
12572                    duration: 1,
12573                }, {
12574                    opacity: 1,
12575                    stagger: 0.05,
12576                    duration: 1,
12577
12578                });
12579                $(window).on('uncode.tl-refresh', function(){
12580                    if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
12581                        tl.scrollTrigger.refresh();
12582                    }
12583                });
12584
12585                $rowParent.one( 'uncodeWordLines', function(){
12586                    clearRequestTimeout(setTxtReveal);
12587                    setTxtReveal = requestTimeout( function(){
12588                        gsap.set($elToReveal, {clearProps: true});
12589                        tl.kill(true);
12590                        if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) {
12591                            ScrollTrigger.getById("txt_reveal_" + key).kill(true);
12592                        }
12593                        headingReveal($sel)
12594                    }, 100);
12595                });
12596
12597            });
12598        };
12599
12600        window.addEventListener("load", function (e) {
12601            if (!txtTrggrStart) {
12602                headingReveal($("body"));
12603                $(window).trigger("resize");
12604            }
12605        });
12606
12607        $('.row-container[data-parent]').each(function(){
12608            if (!txtTrggrStart) {
12609                var $this = $(this);
12610                $this.on('uncodeWordLines', function(){
12611                    headingReveal($this);
12612                });
12613            }
12614        });
12615
12616        $(window).on('uncode-sticky-trigger-observe', function(e){
12617            clearRequestTimeout(setTriggerObserve);
12618            setTriggerObserve = requestTimeout( function(){
12619                $(window).trigger('uncode.tl-refresh');
12620            }, 2000 );
12621        });
12622    
12623    };
12624    textReveal();
12625
12626    var areaReveal = function(){
12627        if ( SiteParameters.is_frontend_editor ) {
12628            return;
12629        }
12630
12631        $('.scroll-trigger-el').each(function(){
12632            var $scrollTrgrEl = $(this),
12633                $row = $('> .row', $scrollTrgrEl),
12634                $row_in = $('> .row-inner', $row),
12635                cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length,
12636                stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows',
12637                animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes',
12638                stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false,
12639                $animateTrgrEl = $scrollTrgrEl,
12640                noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes',
12641                noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'),
12642                els = $scrollTrgrEl.attr('data-anim-els'),
12643                sticky = $scrollTrgrEl.attr('data-anim-sticky'),
12644                noSpace = $scrollTrgrEl.attr('data-anim-no-space'),
12645                state = $scrollTrgrEl.attr('data-anim-state'),
12646                target = $scrollTrgrEl.attr('data-anim-target'),
12647                origin = $scrollTrgrEl.attr('data-anim-origin'),
12648                mask = $scrollTrgrEl.attr('data-anim-mask'),
12649                _scale = $scrollTrgrEl.attr('data-anim-scale'),
12650                stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes',
12651                opacity = $scrollTrgrEl.attr('data-anim-opacity'),
12652                radius = $scrollTrgrEl.attr('data-anim-radius'),
12653                radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'),
12654                clip_path = $scrollTrgrEl.attr('data-clip-path'),
12655                animation_x = $scrollTrgrEl.attr('data-anim-x'),
12656                animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'),
12657                animation_y = $scrollTrgrEl.attr('data-anim-y'),
12658                blur = $scrollTrgrEl.attr('data-anim-blur'),
12659                perspective = $scrollTrgrEl.attr('data-anim-perspective'),			
12660                rotate = $scrollTrgrEl.attr('data-anim-rotate'),	
12661                rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'),
12662                topBottom = $scrollTrgrEl.attr('data-anim-start'),	
12663                offTop = $scrollTrgrEl.attr('data-anim-top'),
12664                offBottom = $scrollTrgrEl.attr('data-anim-bottom'),
12665                safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0,
12666                animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'),
12667                mobile_rows_start = $scrollTrgrEl.attr('data-mobile-start-point'),
12668                mobile_start_add = $scrollTrgrEl.attr('data-mobile-start-point-add'),
12669                easeOut = $scrollTrgrEl.attr('data-anim-ease'),
12670                offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'),
12671                stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards,
12672                $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(),
12673                setTxtReveal,
12674                txtTrggrStart = false,
12675                alreadyareaAnimateScrollTl = false;
12676    
12677            _scale = _scale === '' ? 0 : parseFloat( _scale );
12678            perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001;	
12679            offTop = offTop === '' ? 0 : parseFloat( offTop );
12680            offBottom = offBottom === '' ? 0 : parseFloat( offBottom );
12681            offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard );
12682
12683            function areaAnimateScrollTl($el, id, last) {
12684                alreadyareaAnimateScrollTl = true;
12685
12686                var pTop = parseFloat( $row.css('padding-top') ),
12687                    innerGap = pTop + offSetCard * id,
12688                    scale = _scale,
12689                    rows_start = animation_rows_start;
12690                    
12691                if ( isMobileUsing && typeof mobile_rows_start !== 'undefined' ) {
12692                    rows_start = mobile_rows_start;
12693                    innerGap = 0 + parseFloat(mobile_start_add);
12694                }
12695
12696                if ( stepScale ) {
12697                    if ( _scale < 100 ) {
12698                        scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) );
12699                    }
12700                }
12701
12702                if ( els === 'content' ) {
12703                    $animateTrgrEl = $('> .row', $scrollTrgrEl);
12704                } else if ( els === 'bg' ) {
12705                    $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl);
12706                } else {
12707                    $animateTrgrEl = $el;
12708                }
12709
12710                if ( rotate_alt === 'yes') {
12711                    rotate *= -1;
12712                    perspective *= -1;
12713                }
12714                
12715                if ( animation_x_alt === 'yes') {
12716                    animation_x *= -1;
12717                }
12718
12719                var $parentDiv = $el.closest('div[data-sticky]');
12720
12721                var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px";
12722
12723                var scrllTrggr = {
12724                    trigger: $parentDiv,
12725                    end: function(){
12726                        return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom)))
12727                    },
12728                    start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
12729                    pin: sticky === 'yes' || stickyCards ? true : false,
12730                    pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0),
12731                    scrub: true,
12732                    id: 'sticky_' + id,
12733                    anticipatePin: 1,
12734                    invalidateOnRefresh: true,
12735                    // markers: {
12736                    //     indent: 150 * id
12737                    // },
12738                    onToggle: function(){
12739                        $scrollTrgrEl.attr('data-revealed', true);
12740                    },
12741                };
12742
12743
12744                if ( !stickyLast && state === 'end' ) {
12745                    last = false;
12746                } 
12747
12748                if ( stickyCards ) {
12749                    if ( state !== 'end' ) {
12750                        if ( rows_start === 'center' ) {
12751                            scrllTrggr.start = "center center";
12752                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight);
12753                        } else if ( rows_start === 'bottom' ) {
12754                            if ( stickyOpts !== 'no' ) {
12755                                scrllTrggr.start = "bottom bottom-=" + (innerGap-1)
12756                                scrllTrggr.end = "bottom bottom";
12757                            }
12758                        } else {
12759                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2);
12760                        } 
12761                        if ( stickyOpts === 'no' ) {
12762                            scrllTrggr.endTrigger = $el;
12763                            scrllTrggr.end = "+=100%";
12764                        } else {
12765                            scrllTrggr.endTrigger = $row;
12766                        }
12767                    } else {
12768                        if ( rows_start === 'center' ) {
12769                            scrllTrggr.start = "center center";
12770                        } else if ( rows_start === 'bottom' ) {
12771                            scrllTrggr.start = "bottom bottom";
12772                        } 
12773                        if ( stickyOpts !== 'no' ) {
12774                            scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1));
12775                            scrllTrggr.endTrigger = $lastEl;
12776                        } else {
12777                            scrllTrggr.end = "bottom bottom";
12778                        }
12779                    }
12780                }
12781                
12782                var tl = gsap.timeline({
12783                    scrollTrigger: scrllTrggr
12784                });
12785
12786                // var mark = last ? {
12787                //         startColor:"blue",
12788                //         endColor:"orange",
12789                //     } : false;
12790
12791                if ( !stickyCards ) {
12792                    var tlConds = tl;
12793                } else {
12794                    var scrllTrggrConds = {
12795                        trigger: $parentDiv,
12796                        end: function(){
12797                            return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom)))
12798                        }, 
12799                        pin: (state === 'end' && last),
12800                        pinSpacing: false,
12801                        scrub: true,
12802                        id: 'card_' + id,
12803                        invalidateOnRefresh: true,
12804                        // markers: true,
12805                    };
12806
12807                    if ( stickyCards ) {
12808                        if ( state !== 'end' ) {
12809                            if ( stickyOpts === '' ) {
12810                                scrllTrggrConds.end = "bottom bottom-=100%";
12811                                scrllTrggrConds.endTrigger = $row_in;
12812                            }
12813
12814                            if ( rows_start === 'bottom' ) {
12815                                if ( stickyOpts !== 'no') {
12816                                    scrllTrggrConds.start = "top top+=" + window.innerHeight;
12817                                    scrllTrggrConds.end = "bottom bottom";
12818                                }
12819                            } else if ( rows_start === 'center' ) {
12820                                scrllTrggrConds.start =  "center center";
12821                            } else {
12822                                scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12823                            }
12824                            
12825                        } else {
12826                            if ( stickyOpts === '' ) {
12827                                if ( animLast ) {
12828                                    scrllTrggrConds.end = "bottom bottom-=100%";
12829                                } else {
12830                                    scrllTrggrConds.end = "bottom bottom";
12831                                }
12832                                scrllTrggrConds.endTrigger = $lastEl;
12833                            }
12834
12835                            if ( rows_start === 'bottom' && stickyOpts !== 'no' ) {
12836                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12837                                    scrllTrggrConds.start = "bottom bottom";
12838                                } else {
12839                                    scrllTrggrConds.start = "top top+=" + $el.outerHeight();
12840                                }
12841                            } else if ( rows_start === 'center' ) {
12842                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12843                                    scrllTrggrConds.start =  "center center";
12844                                } else {
12845                                scrllTrggrConds.start =  "top+=" + ($el.outerHeight()/2) + " top+=" 
12845+ window.innerHeight/2;
12846                                }
12847                            } else {
12848                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12849                                    scrllTrggrConds.start = "top top";
12850                                } else {
12851                                    scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12852                                }
12853                            }
12854
12855                        }
12856
12857                    } else {
12858                        scrllTrggrConds.start =  start_topBottom;
12859                    }
12860
12861                    var tlConds = gsap.timeline({
12862                        scrollTrigger: scrllTrggrConds
12863                    });
12864                }
12865
12866                if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) {
12867                    if ( target === 'mask' ) {
12868                        if ( state !== 'end' ) {
12869                            if ( mask === 'auto' ) {
12870                                gsap.set(
12871                                    $animateTrgrEl, {
12872                                        clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12873                                        opacity: parseFloat(opacity)/100,
12874                                        filter: 'blur(' + blur + 'px)',
12875                                        visibility: 'visible',
12876                                    }
12877                                )
12878                                tlConds.fromTo($animateTrgrEl, {
12879                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12880                                    opacity: parseFloat(opacity)/100,
12881                                    filter: 'blur(' + blur + 'px)',
12882                                    duration: 1,
12883                                }, {
12884                                    opacity: 1,
12885                                    clipPath: 'inset(0% 0px round 0' + radiu
12885s_unit + ')',
12886                                    filter: 'blur(0px)',
12887                                    duration: 1,
12888                                    ease: easeOut,
12889                                    //delay: 0.1
12890                                });	
12891                            } else {
12892                                tlConds.fromTo($animateTrgrEl, {
12893                                    opacity: parseFloat(opacity)/100,
12894                                    clipPath: clip_path,
12895                                    filter: 'blur(' + blur + 'px)',
12896                                    duration: 1,
12897                                }, {
12898                                    opacity: 1,
12899                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12900                                    filter: 'blur(0px)',
12901                                    duration: 1,
12902                                    ease: easeOut,
12903                                    //delay: 0.1
12904                                });	
12905                            }
12906                        } else {
12907                            if ( mask === 'auto' ) {
12908                                tlConds.fromTo($animateTrgrEl, {
12909                                    opacity: 1,
12910                                    clipPath: 'inset(0% 0px round 0' + radiu
12910s_unit + ')',
12911                                    filter: 'blur(0px)',
12912                                    duration: 1,
12913                                },{
12914                                    opacity: parseFloat(opacity)/100,
12915                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12916                                    filter: 'blur(' + blur + 'px)',
12917                                    ease: easeOut,
12918                                    duration: 1,
12919                                    //delay: 0.1
12920                                });	
12921                            } else {
12922                                tlConds.fromTo($animateTrgrEl, {
12923                                    opacity: 1,
12924                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12925                                    filter: 'blur(0px)',
12926                                    duration: 1,
12927                                },{
12928                                    opacity: parseFloat(opacity)/100,
12929                                    clipPath: clip_path,
12930                                    filter: 'blur(' + blur + 'px)',
12931                                    duration: 1,
12932                                    ease: easeOut,
12933                                    //delay: 0.1
12934                                });	
12935                            }
12936                        }
12937                    } else {
12938                        if ( state !== 'end' ) {
12939                            if ( scale === 'auto' ) {
12940                                if ( radius ) {
12941                                    gsap.set(
12942                                        $animateTrgrEl, {
12943                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12944                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12945                                            x: animation_x + 'vw',
12946                                            y: animation_y + 'vh',
12947                                            filter: 'blur(' + blur + 'px)',
12948                                            rotation: rotate,
12949                                            rotationX: rotate == 0 ? perspective : 0,
12950                                            transformPerspective: '100vw',
12951                                            opacity: parseFloat(opacity)/100,
12952                                            transformOrigin: origin,
12953                                            borderRadius: radius + radius_unit,
12954                                            visibility: 'visible',
12955                                        }
12956                                    )
12957                                    tlConds.fromTo($animateTrgrEl, {
12958                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12959                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12960                                        x: animation_x + 'vw',
12961                                        y: animation_y + 'vh',
12962                                        filter: 'blur(' + blur + 'px)',
12963                                        rotation: rotate,
12964                                        rotationX: rotate == 0 ? perspective : 0,
12965                                        transformPerspective: '100vw',
12966                                        opacity: parseFloat(opacity)/100,
12967                                        borderRadius: radius + radius_unit,
12968                                        transformOrigin: origin,
12969                                        duration: 1,
12970                                    }, {
12971                                        scaleX: 1,
12972                                        scaleY: 1,
12973                                        x: 0,
12974                                        y: 0,
12975                                        filter: 'blur(0px)',
12976                                        rotation: 0,
12977                                        rotationX: 0,
12978                                        opacity: 1,
12979                                        borderRadius: 0 + radius_unit,
12980                                        transformOrigin: origin,
12981                                        duration: 1,
12982                                        ease: easeOut,
12983                                        //delay: 0.1
12984                                    });	
12985                                } else {
12986                                    gsap.set(
12987                                        $animateTrgrEl, {
12988                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12989                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12990                                            x: animation_x + 'vw',
12991                                            y: animation_y + 'vh',
12992                                            filter: 'blur(' + blur + 'px)',
12993                                            rotation: rotate,
12994                                            rotationX: rotate == 0 ? perspective : 0,
12995                                            transformPerspective: '100vw',
12996                                            opacity: parseFloat(opacity)/100,
12997                                            transformOrigin: origin,
12998                                            visibility: 'visible',
12999                                        }
13000                                    )
13001                                    tlConds.fromTo($animateTrgrEl, {
13002                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13003                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13004                                        x: animation_x + 'vw',
13005                                        y: animation_y + 'vh',
13006                                        filter: 'blur(' + blur + 'px)',
13007                                        rotation: rotate,
13008                                        rotationX: rotate == 0 ? perspective : 0,
13009                                        transformPerspective: '100vw',
13010                                        opacity: parseFloat(opacity)/100,
13011                                        transformOrigin: origin,
13012                                        duration: 1,
13013                                    }, {
13014                                        scaleX: 1,
13015                                        scaleY: 1,
13016                                        x: 0,
13017                                        y: 0,
13018                                        filter: 'blur(0px)',
13019                                        rotation: 0,
13020                                        rotationX: 0,
13021                                        opacity: 1,
13022                                        transformOrigin: origin,
13023                                        duration: 1,
13024                                        ease: easeOut,
13025                                        //delay: 0.1
13026                                    });	
13027                                }
13028                            } else {
13029                                if ( radius ) {
13030                                    gsap.set(
13031                                        $animateTrgrEl, {
13032                                            scaleX: parseFloat( scale ) / 100,
13033                                            scaleY: parseFloat( scale ) / 100,
13034                                            opacity: parseFloat(opacity)/100,
13035                                            x: animation_x + 'vw',
13036                                            y: animation_y + 'vh',
13037                                            filter: 'blur(' + blur + 'px)',
13038                                            rotation: rotate,
13039                                            rotationX: rotate == 0 ? perspective : 0,
13040                                            transformPerspective: '100vw',
13041                                            transformOrigin: origin,
13042                                            borderRadius: radius + radius_unit,
13043                                            visibility: 'visible',
13044                                        }
13045                                    )
13046                                    tlConds.fromTo($animateTrgrEl, {
13047                                        scaleX: parseFloat( scale ) / 100,
13048                                        scaleY: parseFloat( scale ) / 100,
13049                                        opacity: parseFloat(opacity)/100,
13050                                        x: animation_x + 'vw',
13051                                        y: animation_y + 'vh',
13052                                        filter: 'blur(' + blur + 'px)',
13053                                        rotation: rotate,
13054                                        rotationX: rotate == 0 ? perspective : 0,
13055                                        transformPerspective: '100vw',
13056                                        borderRadius: radius + radius_unit,
13057                                        transformOrigin: origin,
13058                                        duration: 1,
13059                                    }, {
13060                                        scaleX: 1,
13061                                        scaleY: 1,
13062                                        opacity: 1,
13063                                        x: 0,
13064                                        y: 0,
13065                                        filter: 'blur(0px)',
13066                                        rotation: 0,
13067                                        rotationX: 0,
13068                                        transformOrigin: origin,
13069                                        ease: easeOut,
13070                                        duration: 1,
13071                                        borderRadius: 0 + radius_unit,
13072                                        //delay: 0.1
13073                                    });	
13074                                } else {
13075                                    gsap.set(
13076                                        $animateTrgrEl, {
13077                                            scaleX: parseFloat( scale ) / 100,
13078                                            scaleY: parseFloat( scale ) / 100,
13079                                            opacity: parseFloat(opacity)/100,
13080                                            x: animation_x + 'vw',
13081                                            y: animation_y + 'vh',
13082                                            filter: 'blur(' + blur + 'px)',
13083                                            rotation: rotate,
13084                                            rotationX: rotate == 0 ? perspective : 0,
13085                                            transformPerspective: '100vw',
13086                                            transformOrigin: origin,
13087                                            visibility: 'visible',
13088                                        }
13089                                    )
13090                                    tlConds.fromTo($animateTrgrEl, {
13091                                        scaleX: parseFloat( scale ) / 100,
13092                                        scaleY: parseFloat( scale ) / 100,
13093                                        opacity: parseFloat(opacity)/100,
13094                                        x: animation_x + 'vw',
13095                                        y: animation_y + 'vh',
13096                                        filter: 'blur(' + blur + 'px)',
13097                                        rotation: rotate,
13098                                        rotationX: rotate == 0 ? perspective : 0,
13099                                        transformPerspective: '100vw',
13100                                        transformOrigin: origin,
13101                                        duration: 1,
13102                                    }, {
13103                                        scaleX: 1,
13104                                        scaleY: 1,
13105                                        opacity: 1,
13106                                        x: 0,
13107                                        y: 0,
13108                                        filter: 'blur(0px)',
13109                                        rotation: 0,
13110                                        rotationX: 0,
13111                                        transformOrigin: origin,
13112                                        duration: 1,
13113                                        ease: easeOut,
13114                                        //delay: 0.1
13115                                    });
13116                                }
13117                            }
13118                        } else {
13119                            if ( scale === 'auto' ) {
13120                                tlConds.fromTo($animateTrgrEl, {
13121                                    scaleX: 1,
13122                                    scaleY: 1,
13123                                    opacity: 1,
13124                                    x: 0,
13125                                    y: 0,
13126                                    filter: 'blur(0px)',
13127                                    rotation: 0,
13128                                    rotationX: 0,
13129                                    transformOrigin: origin,
13130                                    duration: 1,
13131                                }, {
13132                                    scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13133                                    scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
13134                                    opacity: parseFloat(opacity)/100,
13135                                    x: animation_x + 'vw',
13136                                    y: animation_y + 'vh',
13137                                    filter: 'blur(' + blur + 'px)',
13138                                    rotation: rotate,
13139                                    rotationX: rotate == 0 ? perspective : 0,
13140                                    transformPerspective: '100vw',
13141                                    transformOrigin: origin,
13142                                    duration: 1,
13143                                    ease: easeOut,
13144                                    //delay: 0.1
13145                                })
13146                            } else {
13147                                tlConds.fromTo($animateTrgrEl, {
13148                                    scaleX: 1,
13149                                    scaleY: 1,
13150                                    opacity: 1,
13151                                    x: 0,
13152                                    y: 0,
13153                                    filter: 'blur(0px)',
13154                                    rotation: 0,
13155                                    rotationX: 0,
13156                                    transformPerspective: '100vw',
13157                                    transformOrigin: origin,
13158                                    borderRadius: 0 + radius_unit,
13159                                    duration: 1,
13160                                }, {
13161                                    scaleX: parseFloat( scale ) / 100,
13162                                    scaleY: parseFloat( scale ) / 100,
13163                                    opacity: parseFloat(opacity)/100,
13164                                    x: animation_x + 'vw',
13165                                    y: animation_y + 'vh',
13166                                    filter: 'blur(' + blur + 'px)',
13167                                    rotation: rotate,
13168                                    rotationX: rotate == 0 ? perspective : 0,
13169                                    transformPerspective: '100vw',
13170                                    transformOrigin: origin,
13171                                    borderRadius: radius + radius_unit,
13172                                    duration: 1,
13173                                    ease: easeOut,
13174                                    //delay: 0.1
13175                                })
13176                            }
13177                        }
13178                    }
13179                }
13180
13181                function headingReveal($el){
13182                    txtTrggrStart = true;
13183                    $('.text-reveal', $el).each(function(_key, _val){
13184                        var $txtReveal = $(_val),
13185                            dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
13186                            dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
13187                            $lines = $('.heading-line-wrap', $txtReveal),
13188                            $words = $('.split-word-inner', $txtReveal),
13189                            $chars = $('.split-char', $txtReveal),
13190                            _setTxtReveal,
13191                            $elToReveal = $words;
13192
13193                        if ( !(sticky === 'yes' || stickyCards) ) {
13194                            return;
13195                        }
13196            
13197                        easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut;
13198
13199                        if ( dataReveal === 'chars' ) {
13200                            $elToReveal = $chars;
13201                        } else if ( dataReveal === 'lines' ) {
13202                            $elToReveal = $lines;
13203                        }
13204
13205                        var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr;
13206                        scrllTrggrTxt.id = "txt_reveal_" + _key; 
13207                        scrllTrggrTxt.pin = false;
13208
13209                        gsap.set($elToReveal, {opacity: dataRevealOpacity});
13210                        var _tl = gsap.timeline({
13211                            scrollTrigger: scrllTrggrTxt
13212                        });
13213                        _tl.fromTo($elToReveal, {
13214                            opacity: dataRevealOpacity,
13215                        }, {
13216                            opacity: 1,
13217                            stagger: 0.05
13218                        });
13219
13220                        $scrollTrgrEl.one( 'uncodeWordLines', function(){
13221                            clearRequestTimeout(_setTxtReveal);
13222                            _setTxtReveal = requestTimeout( function(){
13223                                gsap.set($elToReveal, {clearProps: true});
13224                                _tl.kill(true);
13225                                if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) {
13226                                    ScrollTrigger.getById("txt_reveal_" + _key).kill(true);
13227                                }
13228                                headingReveal($el)
13229                            }, 100);
13230                        });
13231
13232                    });
13233                };
13234
13235                if (!txtTrggrStart) {
13236                    headingReveal($el);
13237                }
13238
13239                $scrollTrgrEl.one( 'uncodeWordLines', function(){
13240                    if (!txtTrggrStart) {
13241                        headingReveal($el);
13242                    }
13243                });
13244                
13245                var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
13246                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight );
13247                var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 
13248                    document.documentElement.clientWidth,  document.documentElement.scrollWidth,  document.documentElement.offsetWidth );
13249                    
13250                $(window).on('uncode-sticky-trigger-observe', function(e){
13251                    var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
13252                    var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );
13253                    $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false});
13254                    //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style');
13255                    if ( stickyCards ) {
13256                        $('.tmb', $scrollTrgrEl).removeAttr('style');
13257                    }
13258                    var scrollnow = document.body.scrollTop || document.documentElement.scrollTop;
13259                    clearRequestTimeout(setTxtReveal);
13260                    setTxtReveal = requestTimeout( function(){
13261                        $(document).trigger('uncode-scrolltrigger-refresh');
13262                        if ( isMobileUsing ) {
13263                            if ( typeof tl !== 'undefined' ) {
13264                                tl.scrollTrigger.refresh();
13265                            }
13266                            if ( typeof tlConds !== 'undefined' ) {
13267                                tlConds.scrollTrigger.refresh();
13268                            }
13269                            $(window).trigger('scroll');
13270                            _width = __width;
13271                        } else if ( _width !== __width && ( isMobileUsing ) ) {
13272                            window.dispatchEvent(new CustomEvent('vc-resize'));
13273                            if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
13274                                window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){
13275                                    if ( typeof tl !== 'undefined' ) {
13276                                        tl.scrollTrigger.refresh();
13277                                    }
13278                                    if ( typeof tlConds !== 'undefined' ) {
13279                                        tlConds.scrollTrigger.refresh();
13280                                    }
13281                                    window.lenis.scrollTo(scrollnow, {duration: 0.01});
13282                                }});
13283                            } else {
13284                                if ( typeof tl !== 'undefined' ) {
13285                                    tl.scrollTrigger.refresh();
13286                                }
13287                                if ( typeof tlConds !== 'undefined' ) {
13288                                    tlConds.scrollTrigger.refresh();
13289                                }
13290                                $(window).trigger('scroll');
13291                            }
13292                            _height = __height;
13293                        }
13294                    }, 500);
13295                });
13296
13297
13298                $(window).on('load ', function(e){
13299                    var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
13300                    if ( _height !== ___height ) {
13301                        $scrollTrgrEl.attr('data-toggled', true);
13302                        $(window).trigger('resize');
13303                        if ( typeof tl !== 'undefined' ) {
13304                            tl.scrollTrigger.refresh();
13305                        }
13306                        if ( typeof tlConds !== 'undefined' ) {
13307                            tlConds.scrollTrigger.refresh();
13308                        }
13309                        _height = ___height;
13310                    }
13311
13312                    
13313                    
13314                    $(document).trigger('uncode-scrolltrigger-refresh');
13315
13316                });
13317
13318            };
13319
13320            var callAreaAnimateScrollTl = function() {
13321                if ( stickyCards ) {
13322                    $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){
13323                        if ( key+1 < cardL || animLast || state !== 'end' ) {
13324                            var $this = $(val),
13325                                last = key+1===cardL;
13326                            areaAnimateScrollTl($this, key, last);
13327                        }
13328                    });
13329                } else {
13330                    areaAnimateScrollTl($scrollTrgrEl, 0, false);
13331                }    
13332            };
13333
13334            $(window).on('wwResize', function(){
13335                if ( !alreadyareaAnimateScrollTl ) {
13336                    if ( noMobile ) {
13337                        if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13338                            return;
13339                        } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13340                            return;
13341                        }
13342                    }
13343                    
13344                    callAreaAnimateScrollTl();
13345                }
13346            })
13347
13348            if ( noMobile ) {
13349                if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
13350                    return;
13351                } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13352                    return;
13353                }
13354            }
13355
13356            callAreaAnimateScrollTl();
13357
13358        });
13359
13360    };
13361
13362    areaReveal();
13363
13364};
13365UNCODE.thumbsReveal = function() {
13366    var recalc = false,
13367    revealThumbs = function( $el ){
13368        if ( typeof $el === 'undefined' || $el === null || !$el.length ) {
13369            $el = $('body');
13370        }
13371        $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){
13372            var $container = $(this),
13373                $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container),
13374                isContainer = false;
13375
13376            if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) {
13377                $stickys.each(function(){
13378                    var $sticky = $(this).addClass('tmb-mask-init'),
13379                        $rellax = $sticky.closest('.parallax-el'),
13380                        $inside = $('.t-inside', $sticky),
13381                        $media = $('img, video, .fluid-object', $sticky).attr('loading', ''),
13382                        val = parseFloat( $inside.attr('data-scroll-val') );
13383
13384                    if ( $rellax.length ) {
13385                        recalc = true;
13386                    }
13387
13388                    val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val;
13389                    
13390                    if ( $sticky.hasClass('tmb-mask-scroll') ) {
13391
13392                        var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both'))
13393                        ? val*0.05 : 0;
13394                        var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
13395                            ? val*4 : 0;
13396                        var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) ? parax*0.01 : 0;
13397
13398                        var tl = gsap.timeline({
13399                            scrollTrigger: {
13400                                trigger: $sticky,
13401                                scrub: true,
13402                            }
13403                        });
13404
13405                        tl.fromTo($media, {
13406                            yPercent: -(parax),
13407                            scale: 1 + zoom + extra,
13408                        }, {
13409                            yPercent: parax,
13410                            scale: 1 + extra,
13411                            ease: "none",
13412                        });
13413
13414                        if ( recalc ) {
13415                            $(window).on('uncode-thumbsreveal-refresh', function(){
13416                                if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
13417                                    tl.scrollTrigger.refresh();
13418                                }
13419                            });
13420                        }
13421                    }
13422                });
13423            }
13424
13425            if ( $container.has('.tmb-mask-reveal') ) {
13426                var $markTrigger = ".tmb-mask-reveal .t-entry-visual",
13427                staggerTime = 0.1;
13428
13429                $('.t-inside', $container).each(function(){
13430                    var checkEasing = $(this).attr('data-easing');
13431                    if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') {
13432                        gsap.registerPlugin(CustomEase);
13433                        return false;
13434                    }
13435                });
13436
13437                if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) {
13438                    $markTrigger = $container;
13439                    isContainer = true;
13440                    staggerTime = 0;
13441                }
13442
13443                ScrollTrigger.batch( $markTrigger, {
13444                    start: function( el ){
13445                        /*if ( el.trigger.offsetHeight < (window.innerHeight/2) ) {
13446                            return "bottom bottom";
13447                        } else {*/
13448                            return  "top 96%";
13449                        //}
13450                    },
13451                    onEnter: function(batch){
13452                        var $inside = $(batch).closest('.t-inside');
13453
13454                        if ( isContainer ) {
13455                            var $inside = $(batch).find('.t-inside').first();
13456                        }
13457
13458                        var delay = parseFloat( $inside.attr('data-delay') ),
13459                            speed = parseFloat( $inside.attr('data-speed') ),
13460                            easing = $inside.attr('data-easing'),
13461                            bgDelay = parseFloat( $inside.attr('data-bg-delay') );
13462
13463                        delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
13464                        speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
13465                        easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
13466                        bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
13467
13468                        if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) {
13469                            gsap.to($('.t-entry-visual-tc', batch), speed, {
13470                                clipPath: 'inset(0% 0% 0% 0%)',
13471                                stagger: staggerTime,
13472                                delay: delay,
13473                                ease: easing,
13474                            });
13475                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
13476                                clipPath: 'inset(0% 0% 0% 0%)',
13477                                stagger: staggerTime,
13478                                scale: 1,
13479                                delay: delay + (speed*bgDelay),
13480                                ease: easing,
13481                            });
13482                        } else {
13483                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
13484                                clipPath: 'inset(0% 0% 0% 0%)',
13485                                stagger: staggerTime,
13486                                scale: 1,
13487                                delay: delay,
13488                                ease: easing,
13489                            });
13490                        }
13491                                                    
13492                    }
13493                });
13494            }
13495
13496        });
13497
13498        function raf(time) {
13499            requestAnimationFrame(raf)
13500            $(window).trigger('uncode-thumbsreveal-refresh');
13501        }
13502
13503        if ( recalc ) {
13504            requestAnimationFrame(raf)
13505        }
13506
13507    };
13508    $(window).on( 'load more-items-loaded', function(){
13509        revealThumbs();
13510    });
13511
13512    $(document).on('uncode-ajax-filtered', function(){
13513        revealThumbs();
13514    });
13515
13516    if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
13517        window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
13518            var $el = model.view.$el,
13519                shortcode = model.attributes.shortcode;
13520
13521            if ( $el.is('.custom-grid-container') ) {
13522                $el = $el.parent();
13523            }
13524
13525            if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') {
13526                revealThumbs($el);
13527            }
13528        });
13529    }
13530
13531};
13532
13533UNCODE.revslider = function() {
13534	var revSlider6In = function(){
13535		$('rs-module').each(function(){
13536			var $slider = $(this);
13537
13538			$slider.on('revolution.slide.onloaded', function(e, data){
13539				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13540					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
13541						scrolltop = $(document).scrollTop();
13542					if ( style != undefined ) {
13543						UNCODE.switchColorsMenu(scrolltop, style);
13544					}
13545				}
13546			});
13547
13548			$slider.on('revolution.slide.onchange', function(e, data){
13549				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13550					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
13551						scrolltop = $(document).scrollTop();
13552					if ( style != undefined ) {
13553						UNCODE.switchColorsMenu(scrolltop, style);
13554					}
13555				}
13556			});
13557
13558		});
13559
13560	};
13561	revSlider6In();
13562	$(window).on("load", revSlider6In );
13563
13564	document.addEventListener("sr.module.ready", function(e) { 
13565		var $slider = $('#'+e.id),
13566			settings = SR7.JSON[e.id];
13567
13568		if ( typeof settings !== 'undefined' && settings !== null ) {
13569			if ( $slider.closest(".header-revslider").length ) {
13570				var style = settings.slides[1].slide.attr.data,
13571					scrolltop = $(document).scrollTop();
13572				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13573				style = style[1];
13574				if ( style[1] != undefined ) {
13575					UNCODE.switchColorsMenu(scrolltop, style);
13576				}
13577			}
13578		}
13579	});
13580
13581	document.addEventListener("sr.slide.afterChange", function(e) {
13582		var $slider = $('#'+e.id),
13583			settings = SR7.JSON[e.id];
13584
13585		if ( typeof settings !== 'undefined' && settings !== null ) {
13586			if ( $slider.closest(".header-revslider").length ) {
13587				var style = settings.slides[e.current.id].slide.attr.data,
13588					scrolltop = $(document).scrollTop();
13589				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13590				style = style[1];
13591				if ( style != undefined ) {
13592					UNCODE.switchColorsMenu(scrolltop, style);
13593				}
13594			}
13595		}
13596	});
13597
13598};
13599UNCODE.layerslider = function() {
13600	$(window).on("load", function() {
13601
13602		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
13603
13604			var slideData = slider.slides.current.data,
13605				scrolltop = $(document).scrollTop();
13606			if( slideData && slideData.skin ) {
13607
13608				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
13609
13610			}
13611		});
13612
13613	});
13614};
13615
13616UNCODE.ajax_filters = function () {
13617	var isAjaxing = false;
13618
13619/*************************
13620 *
13621 * Filters Menu and Widgets Area
13622 *
13623 ************************/
13624
13625 	var clear_clicked = false;
13626
13627 	var init_ajax_grid = function(){
13628
13629		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
13630		$grids.each(function(index, val){
13631			var $body = $('body'),
13632				$grid = $(val).addClass('init-ajax-grid'),
13633				starting_point = $grid.attr('data-toggle'),
13634				$trigger = $('.uncode-toggle-ajax-filters', $grid),
13635				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
13636				$isotope_wrapper = $('.isotope-wrapper', $grid),
13637				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
13638				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
13639				$footprint = $('.ajax-filter-footprint', $grid),
13640				sidebar_w,
13641				data_w = parseFloat( $sidebar.attr('data-max-width') ),
13642				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
13643				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
13644				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
13645				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13646				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
13647				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
13648				sidew,
13649				$inside_row = $('> .row-parent', $vc_row),
13650				bg_row,
13651				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
13652				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
13653				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
13654				sidebar_overlay = false,
13655				sidebar_hover = false,
13656				switchMobile = false,
13657				scrollTop;
13658
13659			if ( $vc_row.attr('class') ) {
13660				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
13661			}
13662
13663			if ( bg_row != null ) {
13664				$side_header.add($side_footer).addClass(bg_row[0]);
13665			}
13666
13667			$trigger.add($apply_filters).on('click', function(e){
13668				e.preventDefault();
13669				e.stopPropagation();
13670				$grid = $('.ajax-grid-system').eq(0);
13671				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13672				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13673				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13674				sidebar_w = $sidebar_wrapper.width();
13675				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13676				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
13677					$(this).trigger('uncode-ajax-clear-filters');
13678				}
13679				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13680					$grid.toggleClass('ajax-hide-filters-blanks');
13681					$sidebar.slideToggle({
13682						duration: 400,
13683						easing: 'easeOutQuad',
13684					});
13685				} else {
13686					$grid.removeClass('ajax-hide-filters-blanks');
13687					$grid.toggleClass('ajax-hide-filters');
13688					if ( $grid.hasClass('ajax-hide-filters') ) {
13689						$body.addClass('ajax-hide-filters');
13690					} else {
13691						scrollTop = $('html, body').scrollTop();
13692						$body.removeClass('ajax-hide-filters');
13693					}
13694				}
13695				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13696					$('html, body').scrollTop(scrollTop);
13697				}
13698				return false;
13699			});
13700
13701			$close_btn.on('click', function(e){
13702				e.preventDefault();
13703				$grid = $('.ajax-grid-system').eq(0);
13704				$grid.addClass('ajax-hide-filters');
13705				if ( $grid.hasClass('ajax-hide-filters') ) {
13706					$body.addClass('ajax-hide-filters');
13707				} else {
13708					scrollTop = $('html, body').scrollTop();
13709					$body.removeClass('ajax-hide-filters');
13710				}
13711				$('html, body').scrollTop(scrollTop);
13712			});
13713
13714			$sidebar_wrapper.on('mouseover',function(){
13715				sidebar_hover = true;
13716			}).on('mouseout', function(){
13717				sidebar_hover = false;
13718			});
13719
13720			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
13721				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
13722					return;
13723				}
13724				if (undefined !== from && from === 'select_active_attributes') {
13725					return;
13726				}
13727				if ($(e.target).closest('.select2-container--open').length ) {
13728					return;
13729				}
13730				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
13731					$grid.add($body).addClass('ajax-hide-filters');
13732				}
13733			});
13734
13735			$sorting_trgr.on('click', function(e) {
13736				e.preventDefault();
13737			});
13738
13739			var inside_width = function(){
13740				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13741				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13742				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13743				$inside_row = $('> .row-parent', $vc_row);
13744				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
13745					sidew = $sidebar.width();
13746					$inside_row.css({
13747						width: sidew
13748					});
13749				} else {
13750					$inside_row.css({
13751						width: ''
13752					});
13753				}
13754			};
13755			inside_width();
13756
13757			var ajax_sidebar_position = function(e, f_editor){
13758				$grid = $('.ajax-grid-system').eq(0);
13759				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13760				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13761				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13762				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13763				$inside_row = $('> .row-parent', $vc_row);
13764				scrollTop = $('html, body').scrollTop();
13765				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
13766					$grid.add($body).addClass('ajax-hide-filters');
13767					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
13768					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
13769					sidebar_overlay = true;
13770					$body.addClass('ajax-filter-sidebar-overlay');
13771					$sidebar_wrapper.addClass(skin);
13772					var sideHeadH = $side_header.outerHeight(),
13773						sideFooterH = $side_footer.outerHeight();
13774					if ( data_w !== '' && data_w > 0 ) {
13775						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
13776							$sidebar.css({
13777								'max-width': data_w
13778							});
13779						} else {
13780							$sidebar.css({
13781								'max-width':'none'
13782							});
13783						}
13784					}
13785					$vc_row.css({
13786						'padding-top':sideHeadH,
13787						'padding-bottom':sideFooterH
13788					}).attr('data-lenis-prevent', true);
13789					var sidew = $sidebar.width();
13790					$inside_row.css({
13791						width: sidew
13792					});
13793					switchMobile = true;
13794				} else {
13795					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
13796						scrollTop = $('html, body').scrollTop();
13797						$grid.add($body).removeClass('ajax-hide-filters');
13798					}
13799					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
13800						$grid.addClass('ajax-hide-filters-blanks');
13801						$sidebar.hide();
13802					}
13803					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
13804					$('.ajax-sidebar-placeholder', $grid).remove();
13805					sidebar_overlay = false;
13806					$body.removeClass('ajax-filter-sidebar-overlay');
13807					$sidebar_wrapper.removeClass(skin);
13808					if ( data_w !== '' && data_w > 0 ) {
13809						$sidebar.css({
13810							'max-width':'none'
13811						});
13812					}
13813					$vc_row.css({
13814						'padding-top':0,
13815						'padding-bottom':0,
13816					}).removeAttr('data-lenis-prevent');
13817
13818					$inside_row.css({
13819						width: ''
13820					});
13821
13822					if ( f_editor === true ) {
13823						UNCODE.ajax_filters();
13824					}
13825
13826					switchMobile = false;
13827				}
13828				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13829					$('html, body').scrollTop(scrollTop);
13830				}
13831			};
13832
13833			var sidebar_width = function(){
13834				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13835					sidebar_w = $footprint.width();
13836					$sidebar.css({ width: sidebar_w });
13837				} else {
13838					$sidebar.css({ width: '' });
13839				}
13840			};
13841			sidebar_width();
13842
13843			if ( SiteParameters.is_frontend_editor ) {
13844				ajax_sidebar_position();
13845			}
13846
13847			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
13848				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
13849					ajax_sidebar_position(e);
13850				}
13851				sidebar_width();
13852			});
13853
13854			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
13855				ajax_sidebar_position(e, true);
13856			});
13857
13858			$isotope_wrapper.on('transitionend', function(e){
13859				if ( $(e.target).hasClass('isotope-wrapper') ) {
13860					window.dispatchEvent(new CustomEvent('boxResized'));
13861				}
13862				return false;
13863			});
13864
13865			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
13866				var $grid = $('.ajax-grid-system').eq(0);
13867				$grid.addClass('ajax-hide-filters');
13868			}
13869
13870		});
13871	};
13872
13873	init_ajax_grid();
13874	$(document).on('uncode-ajax-filtered', init_ajax_grid);
13875
13876/*************************
13877 *
13878 * Hover hack
13879 *
13880 ************************/
13881 	var widget_hover_hack = function() {
13882 		$('.widget, .uncode_widget').each(function(){
13883			var $widget = $(this),
13884				class_w = $widget.attr('class'),
13885				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
13886				$footer = $widget.closest('#colophon');
13887
13888			if ( class_w.indexOf('widget_yith') > 0 ) {
13889				return true;
13890			}
13891
13892			$lis.each(function(){
13893 				var $li = $(this),
13894 					$a = $('a', $li),
13895 					$label = $a.closest('label');
13896
13897				if ( !$footer.length ) {
13898					$li.addClass('no-evts');
13899				}
13900
13901				if ( ! $('span', $a).length ) {
13902 					$li.addClass( 'li-hover' );
13903 				}
13904
13905 				$('li', $li).hover(function(e){
13906 					$(e.target).parents('li').each(function(){
13907 						$(this).addClass( 'parent-li-hover' );
13908 					});
13909					}, function (e) {
13910 					$(e.target).parents('li').each(function(key, val){
13911 						if ( key === 0) {
13912	 						$(val).removeClass( 'parent-li-hover' );
13913	 					}
13914 					});
13915 				});
13916
13917				$li.off('mouseup').on('mouseup', function (e) {
13918					if (e.which !== 3) {
13919						e.stopPropagation();
13920						var $a = $('a', this).first();
13921						$a[0].click();
13922					}
13923	 			});
13924 			});
13925 		});
13926	  }
13927
13928	var ajax_filters_button_mode = $('body').hasClass('ajax-filters-button-mode');
13929
13930	if (!ajax_filters_button_mode && SiteParameters.disable_hover_hack !== '1') {
13931		widget_hover_hack();
13932		$(document).on('uncode-ajax-filtered', widget_hover_hack);
13933	}
13934
13935/*************************
13936 *
13937 * Init Filters
13938 *
13939 ************************/
13940
13941	function init_filters() {
13942		$(document).on('click', '.term-filter-link', function(e) {
13943			var _this = $(this);
13944			var widget = _this.closest('.uncode_widget');
13945			var container = get_filters_container();
13946
13947			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13948				return true;
13949			}
13950
13951			e.preventDefault();
13952
13953			if (widget.hasClass('widget-ajax-filters--checkbox')) {
13954				_this.parent().find('input[type="checkbox"]').trigger('click');
13955			} else {
13956				if (_this.hasClass('term-filter-link--active')) {
13957					_this.removeClass('term-filter-link--active');
13958				} else {
13959					_this.addClass('term-filter-link--active');
13960
13961					if (widget.hasClass('widget-ajax-filters--single')) {
13962						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
13963					}
13964				}
13965
13966				if (!ajax_filters_button_mode) {
13967					var url = _this.attr('href');
13968
13969					reload_items(container, url, true);
13970				}
13971			}
13972		});
13973
13974		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
13975			var _this = $(this);
13976			var widget = _this.closest('.uncode_widget');
13977			var link = _this.closest('.term-filter').find('.term-filter-link');
13978			var url = link.attr('href');
13979			var container = get_filters_container();
13980
13981			if (!ajax_filters_button_mode && widget.hasClass('widget-ajax-filters--no-ajax')) {
13982				window.location = url;
13983				return;
13984			}
13985
13986			if (widget.hasClass('widget-ajax-filters--single')) {
13987				widget.find('input[type="checkbox"]').each(function() {
13988					if (_this.attr('id') !== $(this).attr('id')) {
13989						$(this).prop('checked', false);
13990						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
13991					}
13992				});
13993			}
13994
13995			if (_this.prop('checked')) {
13996				link.addClass('term-filter-link--active');
13997			} else {
13998				link.removeClass('term-filter-link--active');
13999			}
14000
14001			if (!ajax_filters_button_mode) {
14002				reload_items(container, url, true);
14003			}
14004		});
14005
14006		$(document).on('change', 'select.select--term-filters', function(e) {
14007			var _this = $(this);
14008			var selected = _this.find('option:selected');
14009			var option = $(selected);
14010			var url = option.attr('data-term-filter-url');
14011			var container = get_filters_container();
14012			var widget = _this.closest('.uncode_widget');
14013
14014			if (!ajax_filters_button_mode) {
14015				if (widget.hasClass('widget-ajax-filters--no-ajax')) {
14016					window.location = url;
14017				} else {
14018					reload_items(container, url, true);
14019				}
14020			}
14021		});
14022
14023		$(document).on('click', '.filter-list__link', function(e) {
14024			if (SiteParameters.is_frontend_editor) {
14025				return false;
14026			}
14027
14028			e.preventDefault();
14029
14030			var _this = $(this);
14031			var container = get_filters_container();
14032			var url = _this.attr('href');
14033			reload_items(container, url, true);
14034		});
14035
14036		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
14037			var _this = $(this);
14038			var container = get_filters_container();
14039			var url = _this.attr('href');
14040			reload_items(container, url, true);
14041		});
14042
14043		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
14044
14045			var _this = $(this);
14046			var container = get_filters_container();
14047			var url = _this.attr('href');
14048
14049			if ( container.length ) {
14050				e.preventDefault();
14051				reload_items(container, url, true);
14052			}
14053		});
14054
14055		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
14056			var _this = $(this);
14057			var container = get_filters_container();
14058
14059			if (container.length > 0) {
14060				e.preventDefault();
14061
14062				var min_price = $('#min_price').val();
14063				var max_price = $('#max_price').val();
14064				var location = window.location;
14065				var url = location.href;
14066				var page_uri = location.origin + location.pathname;
14067				var is_filtered = page_uri !== url;
14068
14069				if (is_filtered) {
14070					url = remove_parameter_from_url(url, 'min_price');
14071					url = remove_parameter_from_url(url, 'max_price');
14072				}
14073
14074				var concat = page_uri === url ? '?' : '&';
14075				var params = {'min_price': min_price, 'max_price': max_price};
14076
14077				url = url + concat + $.param(params);
14078
14079				reload_items(container, url, true);
14080			}
14081		});
14082
14083		var search_timer;
14084
14085		if (!ajax_filters_button_mode) {
14086			$(document).on('keyup', '.term-filters-search-input', function (e) {
14087				var _this = $(this);
14088				var container = get_filters_container();
14089				var value = _this.val();
14090
14091				if (search_timer) {
14092					clearTimeout(search_timer);
14093				}
14094
14095				search_timer = setTimeout(function () {
14096					update_search_url(container, value);
14097				}, 500);
14098			});
14099		}
14100
14101		$(document).on('click', '.btn-ajax-filters-trigger', function (e) {
14102			var container = get_filters_container();
14103
14104			if (container.length) {
14105				e.preventDefault();
14106				var paramMap = {};
14107
14108				$('.term-filter-link--active').each(function () {
14109					collect_from_query(paramMap, this.href.split('?')[1] || '');
14110				});
14111
14112				$('.select--term-filters').each(function () {
14113					var select = $(this);
14114					var val = select.val();
14115
14116					if (!val) {
14117						return
14118					};
14119
14120					var selected_option = select.find('option:selected');
14121					var qUrl = selected_option.data('term-filter-url') || '';
14122
14123					collect_from_query(paramMap, qUrl.split('?')[1] || '');
14124				});
14125
14126				var search = $('.term-filters-search-input');
14127
14128				if (search.length > 0) {
14129					var search_value = search.val().trim();
14130					if (search_value) {
14131						paramMap[SiteParameters.ajax_filter_key_search] = {};
14132						paramMap[SiteParameters.ajax_filter_key_search][search_value] = 1;
14133					}
14134				}
14135
14136				var qsParts = [];
14137				$.each(paramMap, function (key, valSet) {
14138					var vals = Object.keys(valSet);
14139					qsParts.push(key + '=' + vals.join(','));
14140				});
14141
14142				var final_url = window.location.origin + window.location.pathname;
14143
14144				if (qsParts.length > 0) {
14145					qsParts.push('unfilter=1');
14146
14147					var qs = qsParts.join('&');
14148					final_url = '?' + qs;
14149				}
14150
14151				reload_items(container, final_url, true);
14152			}
14153		});
14154	}
14155
14156	function collect_from_query(paramMap, query) {
14157		$.each(query.split('&'), function (_, pair) {
14158			if (!pair) {
14159				return
14160			};
14161
14162			var kv  = pair.split('=');
14163			var key = kv[0];
14164			var val = kv[1] || '';
14165
14166			if (key === 'unfilter') {
14167				return;
14168			}
14169			if (!paramMap[key]) {
14170				paramMap[key] = {}
14171			};
14172
14173			paramMap[key][val] = 1;
14174		});
14175	}
14176
14177	function update_search_url(container, search_value) {
14178		var location = window.location;
14179		var url = location.href;
14180		var page_uri = location.origin + location.pathname;
14181		var is_filtered = page_uri !== url;
14182		var key_search = SiteParameters.ajax_filter_key_search;
14183		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
14184
14185		if (is_filtered) {
14186			url = remove_parameter_from_url(url, key_search);
14187			url = remove_parameter_from_url(url, key_unfilter);
14188		}
14189
14190		if (search_value) {
14191			var concat = page_uri === url ? '?' : '&';
14192			var params = {};
14193
14194			params[key_search] = search_value;
14195			params[key_unfilter] = 1;
14196			url = url + concat + $.param(params);
14197		} else {
14198			url = remove_parameter_from_url(url, key_search);
14199		}
14200
14201		reload_items(container, url, true);
14202	}
14203
14204	function remove_parameter_from_url(url, parameter) {
14205		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
14206	}
14207
14208	function get_filters_container() {
14209		var container = $('.ajax-grid-system');
14210
14211		if (container.length == 0) {
14212			container = $('.ajax-filters');
14213		}
14214
14215		if (container.length == 0) {
14216			container = $('.ajax-filters-target');
14217		}
14218
14219		return container;
14220	}
14221
14222	function update_widgets_state(widgets_states, container) {
14223		for (var i = widgets_states.length - 1; i >= 0; i--) {
14224			var state = widgets_states[i];
14225
14226			if (!state.collapse) {
14227				continue;
14228			}
14229
14230			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
14231
14232			if (state.open) {
14233				new_widget.find('.widget-title').addClass('open');
14234				if (state.css) {
14235					new_widget.find('.widget-collapse-content').attr('style', state.css);
14236				}
14237			} else {
14238				new_widget.find('.widget-title').removeClass('open');
14239				if (state.css) {
14240					new_widget.find('.widget-collapse-content').attr('style', state.css);
14241				}
14242			}
14243		}
14244	}
14245
14246	// Find filters container
14247	function find_filters_container(context) {
14248		const widget = context.find('.widget-ajax-filters');
14249
14250		// Try first: closest .ajax-filters-sidebar
14251		const sidebar = widget.closest('.ajax-filters-sidebar');
14252		if (sidebar.length) {
14253			return sidebar.find('.uncol').last();
14254		}
14255
14256		// Fallback: closest .row-parent
14257		const rowParent = widget.closest('.row-parent');
14258		if (rowParent.length) {
14259			return rowParent.find('.uncol').last();
14260		}
14261
14262		return $();
14263	}
14264
14265	// Reload items via AJAX
14266	function reload_items(container, url, push) {
14267		if (isAjaxing) {
14268			return
14269		};
14270
14271		isAjaxing = true;
14272
14273		container.addClass('grid-filtering');
14274
14275		$.ajax({
14276			url     : url,
14277			success : function(response) {
14278				if (!response) {
14279					return;
14280				}
14281
14282				$(document).trigger('uncode-ajax-pre-filtered');
14283
14284				var container_id = container.attr('id');
14285				var pagination = $('.row-navigation');
14286				var filters_container;
14287
14288				var isTargetFilterMode = container.hasClass('ajax-filters-target');
14289
14290				if (isTargetFilterMode) {
14291					filters_container = find_filters_container($(document));
14292				}
14293
14294				if (container_id) {
14295					var container_to_append = $(response).find('#' + container_id);
14296					var pagination_to_append = $(response).find('.row-navigation');
14297					var filters_to_append;
14298					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
14299
14300					if (isTargetFilterMode) {
14301						filters_to_append = find_filters_container($(response));
14302					}
14303
14304					// Remember open/closed widgets
14305					var widgets = $('.uncode_widget');
14306					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
14307					var widgets_states = [];
14308
14309					widgets.each(function() {
14310						var widget = $(this);
14311						var id = widget.attr('data-id');
14312						var state = {
14313							'id': id,
14314							'collapse': false,
14315							'open': false,
14316							'css': false,
14317						};
14318
14319						var collapse_wrapper = widget.find('.widget-collapse-content');
14320
14321						if (collapse_wrapper.length > 0) {
14322							state.collapse = true;
14323
14324							var collapse_wrapper_css = collapse_wrapper.attr('style');
14325							var title = widget.find('.widget-title');
14326
14327							state.css = collapse_wrapper_css;
14328
14329							if (title.hasClass('open')) {
14330								state.open = true;
14331							} else {
14332								state.open = false;
14333							}
14334						}
14335
14336						widgets_states.push(state);
14337					});
14338
14339					// Update widgets state when it is not in target mode
14340					if (! isTargetFilterMode && offcanvas_sidebar_wrapper.length === 0) {
14341						update_widgets_state(widgets_states, container_to_append);
14342					}
14343
14344					// Update default sidebar state
14345					if (!container.hasClass('ajax-hide-filters')) {
14346						container_to_append.removeClass('ajax-hide-filters');
14347					}
14348
14349					// Update horizontal sidebar
14350					if (!container.hasClass('ajax-hide-filters-blanks')) {
14351						container_to_append.removeClass('ajax-hide-filters-blanks');
14352					}
14353					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
14354					if (horizontal_sidebar_wrapper.length > 0) {
14355						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
14356						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
14357						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
14358						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
14359
14360						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
14361						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
14362					}
14363
14364					// Append container
14365					container.replaceWith(container_to_append);
14366
14367					// Hide first thumbnail until the new srcset is loaded
14368					if (SiteParameters.dynamic_srcset_active === '1') {
14369						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
14370					}
14371
14372					// Remove loading attribute to images
14373					container_to_append.find('img').attr('loading', '');
14374
14375					// Append pagination
14376					if (pagination.length > 0) {
14377						if (pagination_to_append.length > 0) {
14378							pagination.html(pagination_to_append.html());
14379						} else {
14380							pagination.html('');
14381						}
14382					} else {
14383						if (pagination_to_append.length > 0) {
14384							$('.post-wrapper').append(pagination_to_append);
14385						}
14386					}
14387
14388					// Append filters
14389					if (isTargetFilterMode && filters_container.length > 0) {
14390						filters_container.html(filters_to_append.html());
14391					}
14392
14393					// Update widgets state when it is in target mode
14394					if (isTargetFilterMode && filters_container.length > 0) {
14395						update_widgets_state(widgets_states, filters_container);
14396					}
14397
14398					// Update off canvas sidebar (mobile and overlay)
14399					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
14400
14401					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
14402						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
14403						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
14404						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
14405						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
14406
14407						// Update widgets state
14408						update_widgets_state(widgets_states, sidebar_to_append);
14409
14410						// Update sidebar
14411						sidebar_container.html(sidebar_to_append.html());
14412					}
14413
14414					if (push) {
14415						UNCODE.lastURL = url;
14416						window.history.pushState(
14417							{ pageTitle: document.title },
14418							'',
14419							url
14420						);
14421					}
14422
14423					if (typeof UNCODE.isotopeLayout !== 'undefined') {
14424						UNCODE.isotopeLayout();
14425					}
14426					if (typeof UNCODE.justifiedGallery !== 'undefined') {
14427						UNCODE.justifiedGallery();
14428					}
14429					if (typeof UNCODE.cssGrid !== 'undefined') {
14430						UNCODE.cssGrid();
14431					}
14432					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
14433						UNCODE.lightbox();
14434					}
14435					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
14436						UNCODE.lightgallery();
14437					}
14438					if (typeof UNCODE.carousel !== 'undefined') {
14439						UNCODE.carousel($('body'));
14440					}
14441					UNCODE.animations();
14442					if (typeof UNCODE.filters !== 'undefined') {
14443						UNCODE.filters();
14444					}
14445					if (typeof UNCODE.widgets !== 'undefined' && !(isTargetFilterMode && filters_container.length > 0)) {
14446						UNCODE.widgets();
14447					}
14448
14449					if (SiteParameters.dynamic_srcset_active === '1') {
14450						UNCODE.refresh_dynamic_srcset_size();
14451					}
14452
14453					if (typeof UNCODE.menuSmartInit !== 'undefined') {
14454						UNCODE.menuSmartInit();
14455					}
14456
14457					if (typeof UNCODE.parallax !== 'undefined') {
14458						UNCODE.parallax();
14459					}
14460
14461					maybe_scroll_to_top();
14462
14463					var woo_select2_cats = $('.dropdown_product_cat');
14464
14465					if (woo_select2_cats.length > 0) {
14466						woo_select2_cats.on( 'change', function() {
14467							if ( $(this).val() != '' ) {
14468								var this_page = '';
14469								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
14470								if ( home_url.indexOf( '?' ) > 0 ) {
14471									this_page = home_url + '&product_cat=' + $(this).val();
14472								} else {
14473									this_page = home_url + '?product_cat=' + $(this).val();
14474								}
14475								location.href = this_page;
14476							} else {
14477								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
14478							}
14479						});
14480
14481						if ( $().selectWoo ) {
14482							var wc_product_cat_select = function() {
14483								woo_select2_cats.selectWoo( {
14484									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
14485									minimumResultsForSearch: 5,
14486									width: '100%',
14487									allowClear: true,
14488									language: {
14489										noResults: function() {
14490											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
14491										}
14492									}
14493								} );
14494							};
14495							wc_product_cat_select();
14496						}
14497					}
14498
14499					$(document).trigger('uncode-ajax-filtered');
14500					$(document.body).trigger('init_price_filter');
14501					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
14502					window.document.dispatchEvent(new Event("DOMContentLoaded", {
14503						bubbles: true,
14504						cancelable: true
14505					}));
14506
14507					isAjaxing = false;
14508				}
14509			},
14510			error: function() {
14511				container.removeClass('grid-filtering');
14512
14513				isAjaxing = false;
14514
14515				if (SiteParameters.enable_debug == true) {
14516					// This console log is disabled by default
14517					// So nothing is printed in a typical installation
14518					//
14519					// It can be enabled for debugging purposes setting
14520					// the 'uncode_enable_debug_on_js_scripts' filter to true
14521					console.log('There was an error retrieving the products');
14522				}
14523			}
14524		});
14525	}
14526
14527	// Scroll to top after filtering
14528	function maybe_scroll_to_top() {
14529		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
14530
14531		if (offcanvas_sidebar_wrapper.length > 0) {
14532			return;
14533		}
14534
14535		var container = get_filters_container();
14536		var bound = container[0].getBoundingClientRect();
14537
14538		if (bound.y < 0) {
14539			$(window).scrollTop(container.offset().top);
14540		}
14541	}
14542
14543	// Back/forward browser buttons
14544	$(window).on("popstate.ajaxfilters", function(e) {
14545		var location = window.location;
14546		var url = location.href;
14547		var params = UNCODE.getURLParams(window.location);
14548		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
14549
14550		UNCODE.lastURL = url;
14551
14552		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
14553			return;
14554		}
14555
14556		var container = get_filters_container();
14557
14558		reload_items(container, url, false);
14559	});
14560
14561	// Destroy load more before to init a new one
14562	$(window).on('uncode-ajax-pre-filtered', function() {
14563		if ($.fn.infinitescroll) {
14564			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
14565		}
14566	});
14567
14568	init_filters();
14569};
14570
14571UNCODE.videoThumbs = function() {
14572	var checkResize,
14573		newW = UNCODE.wwidth;
14574	var checkForVideos = function(){
14575
14576		$(window).on('okevents.y.change', function(e, y){
14577			var $video = $(y.target.g),
14578				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14579				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14580				restart = !$video_wrap.hasClass('play-pause'),
14581				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14582				setTime;
14583			if ( newW >= UNCODE.mediaQuery ) {
14584
14585				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
14586					$video_wrap.data('hovered', true);
14587					$video_wrap.addClass('played-on');
14588					y.target.pauseVideo();
14589					$tmb.on('mouseenter', function(){
14590						if ( restart ) {
14591							y.target.seekTo(0);
14592						}
14593						y.target.playVideo();
14594					}).on('mouseleave', function(){
14595						clearTimeout(setTime);
14596						setTime = setTimeout(function(){
14597							y.target.pauseVideo();
14598						}, 300);
14599					});
14600				}
14601
14602			} else {
14603				if( $mobile_video_wrap.length ) {
14604					$video_wrap.addClass('played-on');
14605					y.target.playVideo();
14606				}
14607			}
14608
14609		});
14610
14611		$(window).on('okevents.v.loaded', function(e, playerV){
14612			var $video = $(playerV.element),
14613				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14614				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14615				restart = !$video_wrap.hasClass('play-pause'),
14616				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
14616: $video.closest('.t-entry-visual, .un-inline-image'),
14617				setTime;
14618
14619			if ( newW >= UNCODE.mediaQuery ) {
14620				
14621				if( $video_wrap.length ) {
14622
14623					var playPromise = playerV.play();
14624					if (playPromise !== undefined) {
14625						playPromise.then(function( value ) {
14626							playerV.pause();
14627						});
14628					}
14629					$video_wrap.addClass('played-on');
14630					$tmb.on('mouseenter', function(){
14631						if ( restart ) {
14632							playerV.setCurrentTime(0)
14633						}
14634						playerV.play();
14635					}).on('mouseleave', function(){
14636						clearTimeout(setTime);
14637						setTime = setTimeout(function(){
14638							playerV.pause();
14639						}, 300);
14640					});
14641				}
14642
14643			} else {
14644
14645				if( $mobile_video_wrap.length ) {
14646					var playPromise = playerV.play();
14647					if (playPromise !== undefined) {
14648						playPromise.then(function( value ) {
14649							playerV.play();
14650						});
14651					}
14652					$video_wrap.addClass('played-on');
14653				}
14654			}
14655		});
14656
14657		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
14658			var $video = $(video),
14659				$noscript = $('noscript', $video),
14660				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14661				restart = !$video_wrap.hasClass('play-pause'),
14662				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14663				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14664				setTime,
14665			manageVideo = function(){
14666				video.currentTime = 0;
14667				video.pause();
14668				if ( newW >= UNCODE.mediaQuery ) {
14669					if ( $video_wrap.length ) {
14670						$video_wrap.addClass('played-on');
14671						$tmb.on('mouseenter', function(){
14672							if ( restart ) {
14673								video.currentTime = 0;
14674							}
14675							video.play();
14676						}).on('mouseleave', function(){
14677							clearTimeout(setTime);
14678							setTime = setTimeout(function(){
14679								video.pause();
14680							}, 300);
14681						});
14682					} else {
14683						video.play();
14684					}
14685				} else {
14686					if ( $mobile_video_wrap.length ) {
14687						$mobile_video_wrap.addClass('played-on');
14688						video.play();
14689					}
14690				}
14691
14692			};
14693			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
14694				$noscript.each(function(key, val){
14695					$noscript.after(val.textContent || val.innerText || val.innerHTML);
14696					$noscript.remove();
14697				});
14698			}
14699
14700			if (typeof MediaElement === "function") {
14701				$video.has('source[src]').mediaelementplayer({
14702					pauseOtherPlayers: false,
14703				});
14704			}
14705			if (video.readyState > 0) {
14706				manageVideo();
14707			} else {
14708				window.addEventListener("pageshow", function (event) {
14709					if (event.persisted) {
14710						manageVideo();
14711					}
14712				});				
14713				$video.on("loadedmetadata", function(_event) {
14714					manageVideo();
14715				});
14716			};
14717		});
14718	
14719	};
14720	
14721	checkForVideos();
14722
14723	var checkVideoResize = function(){
14724		clearRequestTimeout(checkResize);
14725		checkResize = requestTimeout(function(){
14726			if ( newW !== UNCODE.wwidth ) {
14727				checkForVideos();
14728				newW = UNCODE.wwidth;
14729			}
14730		}, 1000);
14731	};
14732
14733	$(window).off('resize.videos', checkVideoResize)
14734	.on( 'resize.videos', checkVideoResize);
14735
14736	$(window).off('more-items-loaded.videos', checkForVideos)
14737	.on('more-items-loaded.videos', checkForVideos);
14738
14739	$(document).off('uncode-ajax-filtered.videos', checkForVideos)
14740	.on('uncode-ajax-filtered.videos', checkForVideos);
14741
14742};
14743UNCODE.inlineImgs = function() {
14744    var linkInlineImgs = function(){
14745        $('.un-inline-image').each(function(){
14746            var $img = $(this),
14747                href = $(this).attr('data-link-href'),
14748                dataImg = $img.data();
14749			if ( dataImg != '' && href != null && href !== '' ) {
14750                var class_stra_a = 'unline-image-link';
14751                if ( $(this).hasClass('un-inline-space-over') ) {
14752                    class_stra_a += ' un-inline-space-over';
14753                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
14754                    class_stra_a += ' un-inline-space-gutter';
14755                }
14756                var str_a = '<a class="' + class_stra_a + '" ';
14757                for (var key in dataImg) {
14758                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
14759                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
14760                    }
14761                }
14762                str_a += ' />';
14763                $img.wrap(str_a);
14764			}
14765        });
14766    };
14767    $(window).on('load', linkInlineImgs );
14768};
14769UNCODE.lottie = function() {
14770    if ( SiteParameters.is_frontend_editor ) {
14771        var $lottie_wraps = $('div.uncode-lottie-wrap');
14772        $lottie_wraps.each(function(){
14773            var $lottie_wrap = $(this),
14774                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
14775                $player_clone = $div_player.clone(),
14776                player_id = $div_player.attr('data-id'),
14777                $lottie_players = $('lottie-player', $lottie_wrap).remove();
14778            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
14779                if ( $('#'+player_id).length ) {
14780                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
14781                }
14782                $player_clone.attr('id', player_id);
14783                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
14784                $div_player.after($player_clone);
14785                $div_player.attr('data-init',true);
14786            }
14787        });
14788    }
14789    var $players = $('.uncode-lottie-wrap lottie-player');
14790    $players.each(function(){
14791        var player = this,
14792            this_id = $(player).attr('id'),
14793            _player = document.getElementById(this_id),
14794            trigger = $(player).attr('data-trigger'),
14795            pFrames = $(player).attr('data-frames').split(','),
14796            srcPlayer = $(player).attr('src');
14797
14798        _player.load(srcPlayer);
14799
14800        _player.addEventListener("ready", function() {
14801
14802            var $_shadow = _player.shadowRoot;
14803            $($_shadow).find('.error').remove();
14804
14805            var tFrames = _player.getLottie().totalFrames / 100,
14806                pFrame_from = Math.round(tFrames * pFrames[0]),
14807                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
14808                loop = $(player).attr('loop'),
14809                mode,
14810                actions;
14811
14812            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
14813                if ( trigger === 'scroll' ) {
14814                    mode = 'scroll';
14815                    actions = [
14816                        {
14817                            visibility:[0, 1.0],
14818                            type: "seek",
14819                            frames: [pFrame_from, pFrame_to],
14820                        }
14821                    ];
14822                } else if ( trigger === 'viewport') {
14823                    mode = 'scroll';
14824                    actions = [
14825                        {
14826                            visibility: [0.20, 1.0],
14827                            frames: [pFrame_from, pFrame_to],
14828                            type: loop ? "loop" : "play"
14829                        }
14830                    ];
14831                } else if ( trigger === 'hover') {
14832                    $(player).on('mouseenter', function(){
14833                        _player.play();
14834                    }).on('mouseleave', function(){
14835                        _player.pause();
14836                    });
14837                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
14838                        _player.seek(pFrame_from);
14839                        _player.addEventListener("frame", function(){
14840                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
14841                                _player.seek(pFrame_from);
14842                            }
14843                        });
14844                    }
14845                }
14846                LottieInteractivity.create({
14847                    player: '#' + this_id,
14848                    mode: mode,
14849                    actions: actions
14850                });
14851            } else {
14852                if ( pFrame_from > 0 && pFrame_from < 99 ) {
14853                    _player.seek(pFrame_from);
14854                    _player.addEventListener("frame", function(){
14855                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
14856                            _player.seek(pFrame_from);
14857                        }
14858                    });
14859                }
14860            }
14861        });
14862
14863        $(window).on('unlottie-destroy', function(){
14864            _player.destroy();
14865        });
14866    });
14867};
14868
14869UNCODE.animatedBgGradient = function( _el ) {
14870
14871    var ev;
14872
14873	if ( typeof _el === 'undefined' || _el === null ) {
14874        _el = document;
14875        ev = false;
14876	} else {
14877        _el = _el[0];
14878        ev = 'shortcode:update';
14879    }
14880
14881    var simplex = new SimplexNoise();
14882
14883    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
14884		this.block = blockOverlay;
14885		this.wrap = canvasWrap;
14886		this.config();
14887		this.checker();
14888		this.loopRAF();
14889        this.animLoader();
14890    };
14891
14892    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
14893
14894    AnimGradient.config = function() {
14895        this.canvas = document.createElement('canvas');
14896        this.wrap.appendChild(this.canvas);
14897        this.ctx = this.canvas.getContext('2d');
14898        this.count = 0;        
14899        this.isOrientationChanged = false;
14900        this.res = UNCODE.isMobile ? 90 : 110;
14901        this.resPercent = 100/this.res;
14902        this.resAround = this.resPercent/100;
14903        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;
14904
14905        this.canvas.classList.add('uncode-bg-animated-gradient');
14906        this.canvas.setAttribute('height', this.res);
14907        this.canvas.setAttribute('width', this.res);
14908        this.canvas.style = 'height: 100%; position: relative; width:100%;';
14909
14910        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
14911
14912        this.cx = this.canvas.width/2;
14913        this.cy = this.canvas.height/2;
14914        this.data = this.imgdata.data;
14915
14916        this.opts = {
14917            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,
14918            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,
14919            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
14920        };
14921
14922        this.lavaTime = 1;
14923        this.bg_colors = [];
14924
14925        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
14926            return;
14927        }
14928
14929        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
14930            this.singleColor = true;
14931        }
14932
14933        if( this.opts.col_1st ) {
14934
14935            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
14936
14937            this.bg_colors.push({
14938                r: rgbColor1.r,
14939                g: rgbColor1.g,
14940                b: rgbColor1.b
14941            });
14942        }
14943
14944        if( this.opts.col_2nd ) {
14945
14946            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
14947
14948            this.bg_colors.push({
14949                r: rgbColor2.r,
14950                g: rgbColor2.g,
14951                b: rgbColor2.b
14952            });
14953        }
14954
14955    };
14956
14957    AnimGradient.checker = function() {
14958        var scope = this;
14959        this.checkInViewPort();
14960      
14961        window.addEventListener('resize', function() {
14962            if(UNCODE.isMobile && !scope.isOrientationChanged) {
14963                return;
14964            }
14965            scope.ratioCalc();
14966        });
14967
14968        window.addEventListener("orientationchange", function() {
14969            scope.isOrientationChanged = true;
14970        });
14971
14972        this.ratioCalc();
14973    }; 
14974
14975    AnimGradient.ratioCalc = function() {
14976      
14977        var blockW = this.block.clientWidth,
14978            blockH = this.block.clientHeight;
14979
14980        if ( blockH == 0 || blockW == 0 )
14981            return;
14982
14983        var blockRatio = blockH/blockW;
14984
14985        if(blockRatio < 1) {
14986            this.ratioParam = {
14987                x: 1.4,
14988                y: blockRatio*1.4
14989            }
14990        } else {
14991            this.ratioParam = {
14992                x: blockRatio/3,
14993                y: 1
14994            }
14995        }
14996         
14997    };
14998
14999    AnimGradient.checkInViewPort = function() {
15000        var scope = this;
15001        if ( $(scope.block).closest('.unmenu-inner-ul').length ) {
15002            scope.isInViewport = true;
15003        } else if( 'IntersectionObserver' in window ) {
15004		    var observer = new IntersectionObserver(function(entries) {
15005  
15006                entries.forEach(function(entry){
15007                    if ( entry.isIntersecting ) {
15008                        scope.isInViewport = true;
15009                    } else {
15010                        scope.isInViewport = false;
15011                    }
15012                });
15013  
15014		    }, { 
15015			root: document,
15016		  });
15017  
15018		  observer.observe(scope.block);
15019		}
15020	};
15021	
15022    AnimGradient.hexToRGB = function(hexval) {
15023        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
15024        if (!hexecuted) {
15025            return false;
15026        }
15027        return {
15028            r: parseInt(hexecuted[1], 16),
15029            g: parseInt(hexecuted[2], 16),
15030            b: parseInt(hexecuted[3], 16)
15031        }
15032    };
15033
15034    AnimGradient.factor = function(val_1, val_2, lava) { 
15035        return val_1 * (1 - lava) + val_2 * lava;
15036    };
15037
15038    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
15039        if (this.singleColor) {
15040            return this.bg_colors[0][wave_l];
15041        }
15042        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 );
15043        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
15044    };
15045
15046    AnimGradient.lava = function(x, y, grade) {
15047        var radians = (Math.PI / 180) * grade,
15048        cos = Math.cos(radians),
15049        sin = Math.sin(radians),
15050        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
15051        return nx;
15052    };
15053    
15054    AnimGradient.loopRAF = function() {
15055
15056      var scope = this;
15057
15058        if( this.isInViewport && typeof this.ratioParam !== 'undefined' ) {
15059            for (var x = 0; x < this.res; x++) {
15060                for (var y = 0; y < this.res; y++) {
15061                    
15062                    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
15063        
15064                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
15065                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
15066                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
15067                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
15068                  
15069                }
15070            }
15071   
15072            this.count++;
15073          
15074            this.ctx.putImageData(this.imgdata, 0, 0);
15075         
15076        }
15077
15078        requestAnimationFrame(function() {
15079            scope.loopRAF();
15080        });
15081    };
15082
15083    AnimGradient.animLoader = function() {
15084        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
15085    };
15086
15087    var anim_init = function() {
15088        var bgs = _el.querySelectorAll('.block-bg-overlay');
15089      
15090        bgs.forEach(function(blockOverlay) {
15091            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
15092            if( !blockOverlay || !canvasWrap ) {
15093                return;
15094            }
15095            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
15096        });
15097    }
15098
15099    $(window).on('load', function(){
15100        anim_init();
15101    });
15102
15103    if ( ev === 'shortcode:update' ) {
15104        anim_init();
15105    }
15106
15107};
15108UNCODE.multibg = function(){
15109	var $bgsWraps = $('.uncode-multi-bgs'),
15110		$body = $('body');
15111	$bgsWraps.each(function(){
15112		var $bgWrap = $(this),
15113			transition = $bgWrap.attr('data-transition'),
15114			transitionTime = $bgWrap.attr('data-transition-time'),
15115			dataPace = $bgWrap.attr('data-transition-pace'),
15116			dataThreshold = $bgWrap.attr('data-transition-threshold'),
15117			dataTime = $bgWrap.attr('data-carousel-time'),
15118			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
15119			random = $bgWrap.attr('data-multi-random'),
15120			_bgWrap = $bgWrap[0],
15121			$multiBgs = $('.multi-background', $bgWrap),
15122			imgFirst,
15123			bgAmount = $multiBgs.length,
15124			isInViewport = false,
15125			lastScrollTop = 0,
15126			counter = 0,
15127			totMove = 0,
15128			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
15129			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
15130			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
15131			offX, offY,
15132			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
15133			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
15134			requestCarousel,
15135			is_header = $bgWrap.closest('#page-header').length,
15136			startTime = new Date();
15137
15138		transition = typeof transition === 'undefined' ? '' : transition;
15139
15140		if ( random === 'true' ) {
15141			UNCODE.shuffle($multiBgs);
15142		}
15143
15144		$multiBgs.find('.background-inner').attr('data-active','false');
15145
15146		imgFirst = $multiBgs.first().find('.background-inner').attr('data-active','true').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
15147
15148		var loadFirst = function(){
15149			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
15150				opacity: 1
15151			}, 250, 'easeInQuad').css({
15152				zIndex: 1
15153			});	
15154		}
15155
15156		var loadError = function(){
15157			console.log('Multi BG loading error');
15158		}
15159
15160		if ( imgFirst && imgFirst !== 'none' ) {
15161			UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
15162		} else {
15163			loadFirst();
15164		}
15165
15166		var loadSlides = function( $thisBg ){
15167			$thisBg.attr('data-load', 'loaded');	
15168		}
15169
15170		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
15171			var $thisBg = $(val);
15172
15173			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
15174
15175				var _imgBg = $(val).find('.background-inner').css('background-image');
15176
15177				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
15178					$thisBg.attr('data-load', 'loaded');
15179				} else {
15180					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
15181					if ( typeof _imgBg !== 'undefined' ) {
15182						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
15183					}
15184				}
15185			}
15186		});
15187					
15188		var multiCarousel = function(e) {
15189
15190			clearRequestTimeout(requestCarousel);
15191
15192			var checkTime = new Date();
15193			if ( checkTime - startTime >= carouselTime && isInViewport ) {
15194				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
15195
15196				if ( $checkEl.attr('data-load') !== 'loaded' ) {
15197					requestTimeout(function(){
15198						multiCarousel();
15199					}, 100);
15200					return;
15201				}
15202
15203				counter++;
15204
15205				$multiBgs.each(function(ind, val){
15206					if ( ind === counter%bgAmount ) {
15207						$(val).stop(true,false).animate({
15208							opacity: 1
15209						}, wait, 'easeInQuad').css({
15210							zIndex: 1
15211						}).find('.background-inner').attr('data-active','true');
15212					} else {
15213						$(val).stop(true,false).animate({
15214							opacity: 0
15215						}, wait, 'easeInQuad', function(){
15216							$(val).find('.background-inner').attr('data-active','false');
15217						}).css({
15218							zIndex: 0
15219						});
15220					}
15221				});
15222
15223			}
15224
15225			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
15226				requestCarousel = requestTimeout(multiCarousel, carouselTime);
15227			}
15228	
15229		};
15230
15231		var multiMove = function(e) {
15232			if ( $body.hasClass('navbar-hover') ) {
15233				return;
15234			}
15235			var checkTime = new Date(),
15236                bound = $bgWrap[0].getBoundingClientRect(),
15237                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
15238			if (offX) {
15239				totMove += Math.sqrt(
15240					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
15241				);
15242			}
15243			if (
15244                totMove >= pace && 
15245                checkTime - startTime >= wait &&
15246                e.clientX <= (bound.left + bound.width) &&
15247                e.clientX >= bound.left &&
15248                e.clientY <= (bound.top + bound.height) &&
15249                e.clientY >= bound.top
15250            ) {
15251				counter++;
15252				startTime = checkTime;
15253				$multiBgs.each(function(ind, val){
15254					if ( ind === counter%bgAmount ) {
15255						$(val).stop(true,false).animate({
15256							opacity: 1
15257						}, wait, 'easeInQuad').css({
15258							zIndex: 1
15259						}).find('.background-inner').attr('data-active','true');
15260					} else {
15261						$(val).stop(true,false).animate({
15262							opacity: 0
15263						}, wait, 'easeInQuad', function(){
15264							$(val).find('.background-inner').attr('data-active','false');
15265						}).css({
15266							zIndex: 0
15267						});
15268					}
15269				});
15270
15271				totMove = 0;
15272			}
15273			
15274			offX = e.clientX;
15275			offY = e.clientY;
15276			
15277		};
15278
15279		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
15280			document.addEventListener("mousemove", multiMove);
15281		}
15282
15283		window.addEventListener('resize', function() {
15284			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
15285				document.removeEventListener("mousemove", multiMove);
15286				document.addEventListener("mousemove", multiMove);
15287			}
15288		});
15289
15290		var lightLoopRAF = function() {
15291
15292			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
15293				checkTime = new Date(),
15294				bound = $bgWrap[0].getBoundingClientRect(),
15295				thresholdHeader = is_header ? 100 : threshold,
15296				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
15297			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
15298				counter++;
15299				lastScrollTop = scrollTop;
15300				startTime = checkTime;
15301
15302				$multiBgs.each(function(ind, val){
15303					if ( ind === counter%bgAmount ) {
15304						$(val).stop(true,false).animate({
15305							opacity: 1
15306						}, wait, 'easeInQuad').css({
15307							zIndex: 1
15308						}).find('.background-inner').attr('data-active','true');
15309					} else {
15310						$(val).stop(true,false).animate({
15311							opacity: 0
15312						}, wait, 'easeInQuad', function(){
15313							$(val).find('.background-inner').attr('data-active','false');
15314						}).css({
15315							zIndex: 0
15316						});
15317					}
15318				});
15319
15320			}
15321
15322			requestAnimationFrame(function() {
15323				if ( isInViewport ) {
15324					lightLoopRAF();
15325				}
15326			});
15327		};
15328
15329		var currentInd = 0;
15330
15331		var loopRAF = function() {
15332
15333			var multiBgRotate = function(slideInd){
15334				currentInd = slideInd;
15335				$multiBgs.each(function(ind, val){
15336					if ( ind === slideInd ) {
15337						$(val).stop(true,false).animate({
15338							opacity: 1
15339						}, wait, 'easeInQuad').css({
15340							zIndex: 1
15341						}).find('.background-inner').attr('data-active','true');
15342					} else {
15343						$(val).stop(true,false).animate({
15344							opacity: 0
15345						}, wait, 'easeInQuad', function(){
15346							$(val).find('.background-inner').attr('data-active','false');
15347						}).css({
15348							zIndex: 0
15349						});
15350					}
15351				});
15352			};
15353			var bound = $bgWrap[0].getBoundingClientRect(),
15354				thresholdPX = UNCODE.wheight * threshold / 100,
15355				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
15356				movePX = totMove / bgAmount,
15357				moving = UNCODE.wheight - (bound.top + thresholdPX),
15358				slideInd = 0;
15359
15360			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
15361				multiBgRotate(0);
15362			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
15363				multiBgRotate(bgAmount-1);
15364			} else {
15365				slideInd = Math.ceil(moving/movePX) - 1;
15366				if ( slideInd < 0 ) {
15367					slideInd = 0;
15368				} else if ( slideInd >= bgAmount ) {
15369					slideInd = bgAmount-1;
15370				}
15371				if ( slideInd !== currentInd ) {
15372					multiBgRotate(slideInd);
15373				}
15374			}
15375
15376			requestAnimationFrame(function() {
15377				if ( isInViewport ) {
15378					loopRAF();
15379				}
15380			});
15381		};
15382
15383		if( 'IntersectionObserver' in window ) {
15384		    var observer = new IntersectionObserver(function(entries) {
15385  
15386                entries.forEach(function(entry){
15387                    if ( entry.isIntersecting ) {
15388                        isInViewport = true;
15389						if ( transition === 'scroll' ) {
15390							if ( autoScroll ) {
15391								loopRAF();
15392							} else {
15393								lightLoopRAF();
15394							}
15395						} else {
15396							multiCarousel();
15397						}
15398                    } else {
15399                        isInViewport = false;
15400                   }
15401                });
15402  
15403		    }, { 
15404				root: document,
15405				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
15406		  	});
15407
15408			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
15409		  		observer.observe(_bgWrap);
15410			}
15411
15412			window.addEventListener('resize', function() {
15413				observer.unobserve(_bgWrap);
15414				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
15415					observer.observe(_bgWrap);
15416				}
15417			});
15418	
15419		}
15420
15421	});
15422}
15423
15424UNCODE.owlNav = function(target, ev) {
15425    target = target.replace(/#\S+/g, '');
15426    var $carousel = $('#'+target),
15427        $slider = $carousel.closest('.uncode-slider'),
15428        $checkNavs = $('.uncode-owl-nav');
15429    if ( !$checkNavs.length ) {
15430        return;
15431    }
15432
15433    if ( $slider.length ){
15434        target = $slider.attr('id');
15435    }
15436
15437    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
15438        $row;
15439
15440    if ( ! $navs.length ) {
15441        $row = $carousel.closest('.vc_row.row-container');
15442        $navs = $('.uncode-owl-nav:not([data-target])', $row);
15443    }
15444        
15445    if ( ! $navs.length ) {
15446        return;
15447    }
15448
15449    $navs.each(function(){
15450        var $nav = $(this),
15451            $outer = $nav.closest('.uncode-owl-nav-out'),
15452            $inner = $nav.find('.uncode-owl-nav-in'),
15453            $navDots = $('.uncode-nav-dots', $nav),
15454            $navCounter = $('.uncode-nav-counter', $nav),
15455            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
15456            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
15457            skinInherit = $nav.hasClass('skin-inherit'),
15458            digit = parseFloat($nav.attr('data-digit')),
15459            counterDigit = parseFloat($nav.attr('data-counter-digit')),
15460            navSpeed = parseFloat($carousel.attr('data-navspeed'));
15461        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
15462
15463        if ( $nav.hasClass('pos-abs') ){
15464            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
15465                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
15466            }
15467            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
15468        } 
15469
15470        $carousel.on('refreshed.owl.carousel', counter);
15471        $carousel.on('resized.owl.carousel', counter);
15472        $carousel.on('changed.owl.carousel', counter);
15473
15474        if ( $carousel.closest('.un-submenu').length ) {
15475            $carousel.on('initialized.owl.carousel', counter);
15476        }
15477
15478        var totalSlides = 0;
15479
15480        function counter(event) {
15481            if (!event.namespace) {
15482                return;
15483            }
15484            var slides = event.relatedTarget,
15485                current = slides._current,
15486                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
15487                item = event.item,
15488                page = event.page,
15489                countPages = Math.ceil(item.count / page.size),
15490                $currentSlide = $carousel.find('.owl-item').eq(current),
15491                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
15492                activeSlide = Math.ceil(itemIndex / page.size),
15493                $prev = $nav.find('.uncode-nav-prev'),
15494                $next = $nav.find('.uncode-nav-next'),
15495                $col = $currentSlide.find('.uncol').first();
15496
15497            if ( totalSlides != countPages ) {
15498                totalSlides = countPages;
15499                $navDots.html('');
15500                var nav_html = '';
15501                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
15502                    var padN = sl_ind+1;
15503                    if ( digit && digit > 1 ) {
15504                        padN = String(padN).padStart(digit, '0');
15505                    }
15506                    nav_html += '<button class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '" tabindex="0"><span>' + padN + '</span></button>';
15507                }
15508                $navDots.html(nav_html);
15509
15510                var totalSlidesDigit = totalSlides;
15511
15512                if ( counterDigit && counterDigit > 1 ) {
15513                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
15514                }
15515                $counterTotal.html(totalSlidesDigit);
15516            }
15517
15518            if ( loop !== true ) {
15519                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
15520                if ( itemIndex === 1 ) {
15521                    $prev.addClass('uncode-nav-disabled');
15522                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
15523                    $next.addClass('uncode-nav-disabled');
15524                    activeSlide = Math.ceil(item.count / page.size);
15525                }
15526            }
15527
15528            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
15529            var activeSlideDigit = activeSlide;
15530
15531            if ( counterDigit && counterDigit > 1 ) {
15532                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
15533            }
15534            $counterIndex.html(activeSlideDigit);
15535
15536            if ( skinInherit ) {
15537                if ( $col.hasClass('style-light') ){
15538                    $nav.removeClass('style-dark').addClass('style-light');
15539                } else if ( $col.hasClass('style-dark') ) {
15540                    $nav.removeClass('style-light').addClass('style-dark');
15541                }
15542            }
15543
15544            $inner.removeClass('uncode-owl-nav-waiting');
15545
15546            if ( $nav.hasClass('outer-width') ) {
15547                var navW = $nav.outerWidth(),
15548                    nexW = $next.outerWidth(),
15549                    prevW = $prev.outerWidth(),
15550                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
15551
15552                if ( $nav.hasClass('h-align-justify') ) {
15553                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
15554                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
15555                        $inner.css({'margin': 'auto'});
15556                    } else {
15557                        $inner.css({'margin': ''});
15558                    }
15559                } else {
15560                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
15561                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
15562                        $inner.css({'margin': 'auto'});
15563                    } else {
15564                        $inner.css({'margin': ''});
15565                    }
15566                }
15567            }
15568        }
15569
15570        $nav.on('click', '.uncode-nav-index', function(){
15571            var $bullet = $(this),
15572                slide_index = parseFloat( $bullet.attr('data-key') );
15573            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
15574        });
15575        $nav.on('click', '.uncode-nav-prev', function(){
15576            $carousel.trigger('prev.owl.carousel', [navSpeed]);
15577        });
15578        $nav.on('click', '.uncode-nav-next', function(){
15579            $carousel.trigger('next.owl.carousel', [navSpeed]);
15580        });
15581
15582        if ( $nav.hasClass('animated-arrows') ) {
15583            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
15584                $(this).addClass("hover"); 
15585            }).on('animationend', function(){
15586                $(this).removeClass("hover");  
15587            });
15588        }
15589
15590        var positionNav = function(){
15591            if ( $nav.hasClass('window-width') ) {
15592                var navOff = parseFloat( $nav.offset().left ) * -1;
15593                if ( navOff > 0 ) {
15594                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
15595                } else {
15596                    $inner.css({ transform: 'none' });
15597                }
15598            }
15599        }
15600        positionNav();
15601        $(window).on('resize', positionNav);
15602        $(document).on('un-menu-show', positionNav);
15603    });
15604
15605    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
15606};
15607
15608	UNCODE.init = function() {
15609		var wfl_check = false, wfl_request, waypoint_request;
15610		UNCODE.preventDoubleTransition();
15611		UNCODE.betterResize();
15612		UNCODE.utils();
15613		UNCODE.unBlockMenu();
15614		UNCODE.mobileMenuBlockSkins();
15615		UNCODE.magnetic();
15616		if (typeof UNCODE.accessibility !== 'undefined') {
15617			UNCODE.accessibility();
15618		}
15619		if (typeof UNCODE.rowParallax !== 'undefined') {
15620			UNCODE.rowParallax();
15621		}
15622		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
15623			UNCODE.changeSkinOnScroll();
15624		}
15625		if (typeof UNCODE.share !== 'undefined') {
15626			UNCODE.share();
15627		}
15628		if (typeof UNCODE.tooltip !== 'undefined') {
15629			UNCODE.tooltip();
15630		}
15631		if (typeof UNCODE.counters !== 'undefined') {
15632			UNCODE.counters();
15633		}
15634		if (typeof UNCODE.countdowns !== 'undefined') {
15635			UNCODE.countdowns();
15636		}
15637		if (typeof UNCODE.tabs !== 'undefined') {
15638			UNCODE.tabs();
15639		}
15640		if (typeof UNCODE.collapse !== 'undefined') {
15641			UNCODE.collapse();
15642		}
15643		if (typeof UNCODE.bigText !== 'undefined') {
15644			UNCODE.bigText();
15645		}
15646		UNCODE.menuSystem();
15647		if (typeof UNCODE.bgChanger !== 'undefined') {
15648			UNCODE.bgChanger();
15649		}
15650		if (typeof UNCODE.magicCursor !== 'undefined') {
15651			UNCODE.magicCursor();
15652		}
15653		if (typeof UNCODE.magneticCursor !== 'undefined') {
15654			UNCODE.magneticCursor();
15655		}
15656		if (typeof UNCODE.dropImage !== 'undefined') {
15657			UNCODE.dropImage();
15658		}
15659		if (typeof UNCODE.postTable !== 'undefined') {
15660			UNCODE.postTable();
15661		}
15662		if (typeof UNCODE.rotatingTxt !== 'undefined') {
15663			UNCODE.rotatingTxt();
15664		}
15665		if (typeof UNCODE.okvideo !== 'undefined') {
15666			UNCODE.okvideo();
15667			window.addEventListener( "uncode-more-items-loaded", function() {
15668				UNCODE.okvideo("uncode-more-items-loaded");
15669			});
15670		}
15671		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
15672			UNCODE.backgroundSelfVideos();
15673		}
15674		UNCODE.tapHover();
15675		if (typeof UNCODE.isotopeLayout !== 'undefined') {
15676			UNCODE.isotopeLayout();
15677		}
15678		if (typeof UNCODE.justifiedGallery !== 'undefined') {
15679			UNCODE.justifiedGallery();
15680		}
15681		if (typeof UNCODE.cssGrid !== 'undefined') {
15682			UNCODE.cssGrid();
15683		}
15684		if (typeof UNCODE.linearGrid !== 'undefined') {
15685			UNCODE.linearGrid();
15686		}
15687		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
15688			UNCODE.lightbox();
15689		}
15690		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
15691			$(window).on('load more-items-loaded',function(){
15692				UNCODE.lightgallery();
15693			});
15694		}
15695		if (typeof UNCODE.carousel !== 'undefined') {
15696			UNCODE.carousel($('body'));
15697		}
15698		if (typeof UNCODE.lettering !== 'undefined') {
15699			UNCODE.lettering();
15700		}
15701		UNCODE.animations();
15702		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
15703			UNCODE.stickyElements();
15704		}
15705		if (typeof UNCODE.twentytwenty !== 'undefined') {
15706			UNCODE.twentytwenty();
15707		}
15708		UNCODE.disableHoverScroll();
15709		UNCODE.printScreen();
15710		if (typeof UNCODE.particles !== 'undefined') {
15711			UNCODE.particles();
15712		}
15713		if (typeof UNCODE.filters !== 'undefined') {
15714			UNCODE.filters();
15715		}
15716		if (typeof UNCODE.ajax_filters !== 'undefined') {
15717			UNCODE.ajax_filters();
15718		}
15719		if (typeof UNCODE.widgets !== 'undefined') {
15720			UNCODE.widgets();
15721		}
15722		if (typeof UNCODE.unmodal !== 'undefined') {
15723			UNCODE.unmodal();
15724		}
15725		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
15726			if ( !UNCODE.isFullPage ) {
15727				UNCODE.checkScrollForTabs();
15728			}
15729		}
15730		if (typeof UNCODE.onePage !== 'undefined') {
15731			UNCODE.onePage(UNCODE.isMobile);
15732		}
15733		if (typeof UNCODE.fullPage !== 'undefined') {
15734			$(document).ready(function(){
15735				UNCODE.fullPage();
15736			});
15737		}
15738		if (typeof UNCODE.skewIt !== 'undefined') {
15739			UNCODE.skewIt();
15740		}
15741		if (typeof UNCODE.rotateIt !== 'undefined') {
15742			UNCODE.rotateIt();
15743		}
15744		if (typeof UNCODE.textMarquee !== 'undefined') {
15745			UNCODE.textMarquee();
15746		}
15747		if (typeof UNCODE.stickyScroll !== 'undefined') {
15748			UNCODE.stickyScroll();
15749		}
15750		if (typeof UNCODE.stickyTrigger !== 'undefined') {
15751			UNCODE.stickyTrigger();
15752		}
15753		if (typeof UNCODE.areaTextReveal !== 'undefined') {
15754			UNCODE.areaTextReveal();
15755		}
15756		if (typeof UNCODE.thumbsReveal !== 'undefined') {
15757			UNCODE.thumbsReveal();
15758		}
15759		if (typeof UNCODE.verticalText !== 'undefined') {
15760			UNCODE.verticalText();
15761		}
15762		if (typeof UNCODE.videoThumbs !== 'undefined') {
15763			UNCODE.videoThumbs();
15764		}
15765		if (typeof UNCODE.revslider !== 'undefined') {
15766			UNCODE.revslider();
15767		}
15768		if (typeof UNCODE.layerslider !== 'undefined') {
15769			UNCODE.layerslider();
15770		}
15771		if (typeof UNCODE.lottie !== 'undefined') {
15772			UNCODE.lottie();
15773		}
15774		if (typeof UNCODE.inlineImgs !== 'undefined') {
15775			UNCODE.inlineImgs();
15776		}
15777		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
15778			UNCODE.animatedBgGradient();
15779		}
15780		if (typeof UNCODE.readMoreCol !== 'undefined') {
15781			UNCODE.readMoreCol();
15782		}
15783		if (typeof UNCODE.multibg !== 'undefined') {
15784			UNCODE.multibg();
15785		}
15786		if (typeof UNCODE.flexEqual !== 'undefined') {
15787			UNCODE.flexEqual();
15788		}
15789		$(window).on('load',function(){
15790			clearRequestTimeout(waypoint_request);
15791			waypoint_request = requestTimeout( function(){
15792				Waypoint.refreshAll();
15793			}, 1000);
15794		});
15795		$(window).one('load',function(){
15796			if (typeof UNCODE.parallax !== 'undefined') {
15797				UNCODE.parallax();
15798			}
15799		});
15800	}
15801
15802	if ( ! SiteParameters.is_frontend_editor ) {
15803		UNCODE.init();
15804	}
15805
15806
15807})(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.