PageSourceSearch

https://www.trecq.ca/wp-content/themes/uncode/library/js/app.js?ver=2139963009

js trecq.ca collected 2026-10-08 19:45:56 UTC 508,059 bytes, 15,268 lines download raw bytes

1/* ----------------------------------------------------------
2 * Uncode App
3 * ---------------------------------------------------------- */
4
5(function($) {
6	"use strict";
7	var UNCODE = window.UNCODE || {};
8	window.UNCODE = UNCODE;
9
10	window.requestAnimFrame = (function() {
11	return  window.requestAnimationFrame	   ||
12			window.webkitRequestAnimationFrame ||
13			window.mozRequestAnimationFrame	||
14			window.oRequestAnimationFrame	  ||
15			window.msRequestAnimationFrame	 ||
16			function(/* function */ callback, /* DOMElement */ element){
17				window.setTimeout(callback, 1000 / 60);
18			};
19})();
20
21window.requestTimeout = function(fn, delay) {
22	if( !window.requestAnimationFrame	  	&&
23		!window.webkitRequestAnimationFrame &&
24		!(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
25		!window.oRequestAnimationFrame	  &&
26		!window.msRequestAnimationFrame)
27			return window.setTimeout(fn, delay);
28
29	var start = new Date().getTime(),
30		handle = new Object();
31
32	function loop(){
33		var current = new Date().getTime(),
34			delta = current - start;
35
36		delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop);
37	};
38
39	handle.value = requestAnimFrame(loop);
40	return handle;
41};
42
43window.clearRequestTimeout = function(handle) {
44	if ( typeof handle !== 'undefined' ) {
45		window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
46		window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
47		window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
48		window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
49		window.oCancelRequestAnimationFrame	? window.oCancelRequestAnimationFrame(handle.value) :
50		window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
51		clearTimeout(handle);
52	}
53};
54
55function uncodeVisibilityChange() {
56	if (document.hidden) {
57		window.dispatchEvent(new CustomEvent('is-blur'));
58	} else {
59		window.dispatchEvent(new CustomEvent('is-focus'));
60	}
61  }
62document.addEventListener('visibilitychange', uncodeVisibilityChange, false);
63
64if ( SiteParameters.smoothScroll === 'on' && ! SiteParameters.is_frontend_editor ) {
65	window.lenis = new Lenis({
66		duration: 1
67	})
68
69	UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
70		document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
71
72	function raf(time) {
73		window.lenis.raf(time)
74		requestAnimationFrame(raf)
75		window.dispatchEvent(new CustomEvent('lenis-scroll'));
76
77		if ( SiteParameters.uncode_smooth_scroll_safe ) {
78			var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
79				document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
80			
81			if ( UNCODE.hDoc !== newHdoc ) {
82				UNCODE.hDoc = newHdoc;
83				window.lenis.resize();
84				//window.dispatchEvent(new CustomEvent('boxResized'));
85			}
86		}
87	}
88
89	requestAnimationFrame(raf)
90
91	$(window).on('unmodal-open uncode-sidecart-open', function(){
92		window.lenis.stop();
93	});
94
95	$(window).on('uncode-sidecart-closed', function(){
96		window.lenis.start();
97	});
98
99	$(document).on('unmodal-close', function(){
100		window.lenis.start();
101	});
102
103}
104
105var checkScrollTriggerRefresh;
106
107$(function(){
108	$(document).on('uncode-scrolltrigger-refresh', function(){
109		clearRequestTimeout(checkScrollTriggerRefresh);
110		checkScrollTriggerRefresh = requestTimeout(function(){
111			ScrollTrigger.refresh();
112			$('.scroll-refresh-hidden').removeClass('opacity_0');
113		}, 500);
114	});
115});
116
117UNCODE.checkImgLoad = function( src, cb, err, el ) {
118	var img = new Image();
119	img.onload = function () {
120		var result = (img.width > 0) && (img.height > 0);
121		cb(el);
122	};
123	img.onerror = function () {
124		err();
125	};
126	img.src = src
127};
128
129UNCODE.betterResize = function() {
130	var setResize,
131		doubleResize = true,
132		oldW = UNCODE.wwidth,
133		oldH = UNCODE.wheight,
134		setCTA;
135	$(window).on( 'resize orientationchange', function(){
136		if ( oldW === UNCODE.wwidth ) {
137			return;
138		} else {
139			oldW = UNCODE.wwidth;
140			$(window).trigger('wwResize');
141		}
142
143		if ( oldH === UNCODE.wheight ) {
144			return;
145		} else {
146			oldH = UNCODE.wheight;
147			$(window).trigger('whResize');
148		}
149	});
150
151	$(window).on( 'resize orientationchange', function(){
152		clearRequestTimeout(setCTA);
153		setCTA = requestTimeout( function(){ $(window).trigger('resize-int'); }, 100 );
154	});
155};
156
157UNCODE.shuffle = function(array) {
158	var currentIndex = array.length,
159		randomIndex;
160  
161	while (currentIndex > 0) {
162		randomIndex = Math.floor(Math.random() * currentIndex);
163		currentIndex--;
164		[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
165	}
166  
167	return array;
168};
169
170Number.isInteger = Number.isInteger || function(value) {
171    return typeof value === "number" &&
172           isFinite(value) &&
173           Math.floor(value) === value;
174};
175
176UNCODE.utils = function() {
177	$(document).on('mouseover', 'a', function () {
178		if (!$(this).hasClass('star')) {
179			$(this).attr('data-title', $(this).attr('title'));
180			$(this).removeAttr('title');
181		}
182	});
183	$(document).on('mouseout', 'a', function () {
184		if (!$(this).hasClass('star')) {
185			$(this).attr('title', $(this).attr('data-title'));
186			$(this).removeAttr('data-title');
187		}
188	});
189
190	this.get_scroll_offset = function(e) {
191
192		var scroll_offset = 0,
193			target,
194			trigger;
195
196		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
197			target = e.target;
198			trigger = e.currentTarget;
199		}
200
201		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
202			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
203				UNCODE.hideMenu(100);
204			}
205		}
206
207		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) {
208			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
209			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
210				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) {
211					if ( !$('.menu-hided').length ) {
212						if ( $('body').hasClass('hmenu-center') ) {
213							scroll_offset += ~~$('.menu-sticky .menu-container').outerHeight();
214						} else {
215							scroll_offset += ~~$('.logo-container:visible').outerHeight();
216						}
217					}
218				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
219					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
220					scroll_offset += (~~$('.menu-sticky .menu-container').outerHeight()) - ( $('.navbar-brand').data('minheight') + shrink );
221				} else {
222					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
223						scroll_offset += UNCODE.menuMobileHeight;
224					} else {
225						if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('vmenu') && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) {
226							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
227						} else {
228							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
229								scroll_offset += UNCODE.menuMobileHeight;
230							}
231						}
232					}
233				}
234			}
235
236		}
237
238		scroll_offset += UNCODE.bodyBorder;
239
240		return scroll_offset;
241	}
242
243	if ( !UNCODE.isFullPage ) {
244		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
245
246			var hash = (e.currentTarget).hash,
247			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
248			anchor = '';
249			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
250			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
251				e.preventDefault();
252				if (!$('#tab-reviews').is(':visible')) {
253					$('a[href="#tab-reviews"]').trigger('click');
254				}
255				var calc_scroll = $('.wootabs .tab-content').offset().top;
256				calc_scroll -= UNCODE.get_scroll_offset(e);
257
258				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
259					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
260
261					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
262						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
263					}
264				}
265
266				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
267					delta = bodyTop - calc_scroll,
268					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
269				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
270
271				requestTimeout(function(){
272					if (scrollSpeed == 0) {
273						$('html, body').scrollTop(calc_scroll);
274						UNCODE.scrolling = false;
275					} else {
276   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
277							$(this).stop();
278						}).animate({
279								scrollTop: calc_scroll
280							}, scrollSpeed, 'easeInOutCubic', function() {
281								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
282								UNCODE.scrolling = false;
283							}
284						);
285					}
286				}, 200);
287				return;
288			}
289			if (hash != undefined) {
290				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
291				var anchor = this.hash.slice(1);
292				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
293			  		if ( !specialFormat.test(hash) ) {
294			  			if ( $(hash).length )
295			  				anchor = $(hash);
296			  		}
297				}
298			}
299
300			if (is_scrolltop || anchor != '') {
301				if (is_scrolltop) {
302					e.preventDefault();
303					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
304					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
305					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
306
307					if (scrollSpeed == 0) {
308						$('html, body').scrollTop(0);
309						UNCODE.scrolling = false;
310					} else {
311   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
312							$(this).stop();
313						}).animate({
314							scrollTop: 0
315						}, scrollSpeed, 'easeInOutCubic', function() {
316							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
317							UNCODE.scrolling = false;
318						});
319					}
320				} else {
321					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
322					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
323						var get_href = $(val).attr('href');
324						if (get_href != undefined) {
325							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
326							else $(val).parent().removeClass('active');
327						}
328					});
329					if (scrollSection.length) {
330						if ( $('body').hasClass('uncode-scroll-no-history') ) {
331							e.preventDefault();
332						}
333
334						if (UNCODE.menuOpened) {
335							if (UNCODE.wwidth < UNCODE.mediaQuery) {
336								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
337							} else {
338								$('.mmb-container-overlay .overlay-close').trigger('click');
339								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
340							}
341						}
342
343						var calc_scroll = scrollSection.offset().top,
344							getOffset = UNCODE.get_scroll_offset(e),
345							$logo = $('.logo-container:visible'),
346							logoH,
347							$menu = $('#masthead .menu-container'),
348							menuH;
349
350						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
351
352						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
353							delta = bodyTop - calc_scroll,
354							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
355						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
356
357						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
358							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
359								logoH = $logo.outerHeight(),
360								menuH = $menu.outerHeight();
361								if ( calc_scroll < ( logoH + menuH ) ) {
362									calc_scroll = 0;
363								}
364							}
365						}
366
367						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
368							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
369						}
370
371						if (scrollSpeed == 0) {
372							$('html, body').scrollTop(calc_scroll);
373							UNCODE.scrolling = false;
374						} else {
375	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
376								$(this).stop();
377							}).animate({
378								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
379							}, scrollSpeed, 'easeInOutCubic', function() {
380								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
381								UNCODE.scrolling = false;
382								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
383								||
384								$('.menu-hided').length ) {
385									calc_scroll = scrollSection.offset().top;
386									getOffset = UNCODE.get_scroll_offset(e);
387									calc_scroll -= getOffset;
388									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
389										$(this).stop();
390									}).animate({
391										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
392										}, scrollSpeed, 'easeInOutCubic', function() {
393											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
394											UNCODE.scrolling = false;
395										}
396									);
397								}
398							});
399						}
400					}
401				}
402			}
403		});
404		$('.header-scrolldown').on('click', function(event) {
405
406			event.preventDefault();
407
408			var pageHeader = $(event.target).closest('#page-header'),
409				pageHeaderTop = pageHeader.offset().top,
410				pageHeaderHeight = pageHeader.outerHeight(),
411				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
412			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
413
414			var calc_scroll = pageHeaderTop + pageHeaderHeight,
415			getOffset = UNCODE.get_scroll_offset(event);
416			calc_scroll -= getOffset;
417
418			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
419				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
420
421				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
422					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
423				}
424			}
425
426			if (scrollSpeed == 0) {
427				$('html, body').scrollTop(calc_scroll);
428				UNCODE.scrolling = false;
429			} else {
430					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
431						$(this).stop();
432					}).animate({
433						scrollTop: calc_scroll
434					}, scrollSpeed, 'easeInOutCubic', function() {
435						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
436						UNCODE.scrolling = false;
437						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
438							calc_scroll = pageHeaderTop + pageHeaderHeight;
439							getOffset = UNCODE.get_scroll_offset(event);
440							calc_scroll -= getOffset;
441								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
442									$(this).stop();
443								}).animate({
444									scrollTop: calc_scroll
445								}, scrollSpeed, 'easeInOutCubic', function() {
446									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
447									UNCODE.scrolling = false;
448								}
449							);
450						}
451					}
452				);
453			}
454		});
455	}
456
457	// Colomun hover effect
458	// =================
459	$(document).on('mouseenter', '.col-link', function(e) {
460		var uncol = $(e.target).prev('.uncol'),
461		el = uncol.find('.column-background');
462		if (el) {
463			$('.btn-container .btn', uncol).addClass('active');
464			var elOverlay = $(el[0]).find('.block-bg-overlay');
465			if (elOverlay.length) {
466				var getOpacity = $(elOverlay).css('opacity');
467				if (getOpacity != 1) {
468					getOpacity = Math.round(getOpacity * 100) / 100;
469					var newOpacity = getOpacity + .1;
470					$(elOverlay).data('data-opacity', getOpacity);
471					$(elOverlay).css('opacity', newOpacity);
472				}
473			}
474		}
475	}).on('mouseleave', '.col-link', function(e) {
476		var uncol = $(e.target).prev('.uncol'),
477		el = uncol.find('.column-background');
478		$('.btn-container .btn', uncol).removeClass('active');
479		if (el) {
480			var elOverlay = $(el[0]).find('.block-bg-overlay');
481			if (elOverlay.length) {
482				var getOpacity = $(elOverlay).data('data-opacity');
483				$(elOverlay).css('opacity', getOpacity);
484			}
485		}
486	});
487
488	// Admin bar
489	// ============
490	var fixAdminBar = function() {
491		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
492			var getAdminBar = $('#wpadminbar');
493			if (getAdminBar.length) {
494				if (getAdminBar.css('position') !== 'hidden') {
495					var getAdminBarHeight = getAdminBar.height();
496					if (getAdminBar.css('position') === 'fixed') {
497						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
498						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
499					} else {
500						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
501						$('.body-borders .top-border').css({'margin-top':'0px'});
502					}
503				}
504			}
505		}
506	};
507	window.addEventListener('load', fixAdminBar);
508	window.addEventListener('resize', fixAdminBar);
509	// Print
510	// ===========
511	var beforePrint = function() {
512		window.dispatchEvent(new CustomEvent('resize'));
513		window.dispatchEvent(UNCODE.boxEvent);
514	};
515
516	if (window.matchMedia) {
517		var mediaQueryList = window.matchMedia('print');
518		mediaQueryList.addListener(function(mql) {
519			if (mql.matches) {
520				beforePrint();
521			}
522		});
523	}
524
525	window.onbeforeprint = beforePrint;
526
527	// Safari srcset
528	var safariSrcSet = function(){
529		if ( !SiteParameters.is_frontend_editor ) {
530			$('html.safari img[sizes]').each(function(){
531				var $img = $(this),
532					sizeImg = parseInt($img.attr('sizes'));
533				if ( typeof(sizeImg) === 'number' ) {
534					$img.attr('sizes', (sizeImg) + 'px');
535				}
536			});
537		}
538	};
539	window.addEventListener('load', safariSrcSet);
540}
541
542UNCODE.lettering = function() {
543
544	var setCTA;
545	var highlightStill = function(){
546
547		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
548
549		$.each($heading_texts, function(key, el) {
550			var $heading = $(el);
551
552			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
553				return;
554			}
555
556			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
557				return;
558			}
559
560			var waypoint = new Waypoint({
561				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
562				element: el,
563				handler: function() {
564					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
565						anims_l = $anims.length;
566					$anims.each(function(_key_, _el_){
567						var $anim = $(_el_);
568
569						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
570							$anim.addClass('heading-text-highlight-animated');
571
572							if ( $heading.data('animate') === true ) {
573								$anim.css({
574									'-webkit-transition-duration': '0ms',
575									'-moz-transition-duration': '0ms',
576									'-o-transition-duration': '0ms',
577									'transition-duration': '0ms',
578								});
579							} else {
580								$anim.css({
581									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
582									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
583									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
584									'transition-delay': ((_key_ + 2) * 200) + 'ms',
585								});
586							}
587						}
588
589					});
590					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
591						$heading.data('animate', true);
592					});
593					$anims.removeAttr('data-animated');
594				},
595				offset: '100%'
596			});
597
598		});
599
600		Waypoint.refreshAll();
601		$( document.body ).trigger('uncode_waypoints');
602		if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
603			$(document).trigger('uncode-scrolltrigger-refresh');
604		}
605
606	}
607
608	requestTimeout(function(){
609		highlightStill();
610		$(window).on( 'wwResize', function(){
611			clearRequestTimeout(setCTA);
612			setCTA = requestTimeout( highlightStill, 100 );
613		});
614	}, 400);
615
616};
617
618UNCODE.isUnmodalOpen = false;
619
620var manageVideoSize = function(){
621
622	var setVideoFit;
623	$('.wp-block-embed').each(function(){
624
625		var $this = $(this);
626
627		if ( $('iframe', $this).length ) {
628
629			var $iframe = $('> iframe, > a > iframe', $this),
630				w = parseFloat($iframe.attr('width')),
631				h = parseFloat($iframe.attr('height')),
632				url = $iframe.attr('src'),
633				ratio, frW;
634
635			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
636
637				ratio = h / w;
638				var setResizeiFto,
639					resizeiFrame = function(){
640					frW = $iframe.width();
641					$iframe.css({
642						height: frW * ratio
643					});
644				};
645				resizeiFrame();
646				$(window).on( 'wwResize load', function(){
647					clearRequestTimeout(setResizeiFto);
648					setResizeiFto = requestTimeout( function() {
649						resizeiFrame();
650					}, 10 );
651				});
652
653			}
654
655		}
656
657	});
658
659};
660
661manageVideoSize();
662
663UNCODE.vivus = function(icon, time, delay, file) {
664	if (typeof Vivus !== 'undefined') {
665		var icon_options = {
666			type: 'delayed',
667			pathTimingFunction: Vivus.EASE_OUT,
668			animTimingFunction: Vivus.LINEAR,
669			duration: time,
670		}
671
672		if (delay) {
673			icon_options.delayStart = delay;
674		}
675
676		if (file) {
677			icon_options.file = file;
678		}
679
680		new Vivus(icon, icon_options);
681	}
682};
683
684UNCODE.lastURL = '';
685
686UNCODE.getURLParams = function(current_location, is_string) {
687	var params = {};
688	if (is_string) {
689		var url = current_location.split('?')[1];
690	} else {
691		var url = current_location.search;
692		url = url.substring(1);
693	}
694	if (url) {
695		var parts = url.split('&');
696		for (var i = 0; i < parts.length; i++) {
697			var nv = parts[i].split('=');
698			if (!nv[0]) {
699				continue;
700			}
701			params[nv[0]] = nv[1] || true;
702		}
703	}
704	return params;
705}
706
707UNCODE.hasEqualURLParams = function(obj1, obj2) {
708	for (var i in obj1) {
709		if (obj1.hasOwnProperty(i)) {
710			if (!obj2.hasOwnProperty(i)) {
711				return false;
712			}
713			if (obj1[i] != obj2[i]) {
714				return false;
715			}
716		}
717	}
718	for (var i in obj2) {
719		if (obj2.hasOwnProperty(i)) {
720			if (!obj1.hasOwnProperty(i)) {
721				return false;
722			}
723			if (obj1[i] != obj2[i]) {
724				return false;
725			}
726		}
727	}
728    return true;
729}
730
731UNCODE.magnetic = function(){
732	
733	$(document).on('mousemove', '.un-magnetic-zone', function(e){
734
735		var $zone = $(this),
736			zoneOff = $zone.offset(),
737			$mgntcEl = $('.un-magnetic-el', this),
738			elBound = this.getBoundingClientRect(),
739			maxSize = Math.max($zone.outerWidth(), $zone.outerHeight());
740
741		var Xvalue = e.pageX - (zoneOff.left + maxSize / 2),
742	  		Yvalue = e.pageY - (zoneOff.top + maxSize / 2);
743	  
744		$mgntcEl.each(function(key, val){
745			var magneticValue = $(val).attr('data-mgntc') || 0.5;
746		
747			val.animate({
748				transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)',
749			},{
750				duration: 500,
751				fill: 'forwards',
752			})
753	  	});
754	})
755	
756	$(document).on('mouseleave', '.un-magnetic-zone', function(e){
757		var $mgntcEl = $('.un-magnetic-el', this);
758
759		$mgntcEl.each(function(key, val){
760			val.animate({
761		  		transform: 'translate(0)',
762			},{
763		  		duration: 500,
764		  		fill: 'forwards',
765			})
766	  	});
767	})
768};
769
770UNCODE.rowParallax = function(){
771
772	if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) {
773		return;
774	}
775
776	var $rows = $('.parallax-move'),
777		stableHeight = UNCODE.wheight;
778	$rows.each(function(){
779		var $row = $(this),
780			_row = $row[0],
781			dataMove = $row.attr('data-parallax-move'),
782			dataSafe = $row.attr('data-parallax-safe'),
783            rowInViewport = false,
784			trans;
785
786		if ( $row.find('.parallax-move').length ) {
787			return;
788		}
789
790		dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe;
791		dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove;           
792        dataMove = dataMove / 10;
793
794        if ( 'IntersectionObserver' in window ) {
795			var observer = new IntersectionObserver(function(entries) {
796	
797				entries.forEach(function(entry){
798					if ( entry.isIntersecting ) {
799						rowInViewport = true;
800					} else {
801						rowInViewport = false;
802					}
803				});
804	
805			}, { 
806				root: document,
807			});
808	
809			observer.observe(_row);
810		} else {
811            rowInViewport = true;
812		}
813
814		var loopRAF = function() {
815			if( rowInViewport ) {
816				var bound = _row.getBoundingClientRect(),
817					bound_top = bound.top,
818					bound_height = bound.height,
819					move = true,
820					scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
821					docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
822						document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ),
823					fromBottom = docH - (scrolled + bound_top + bound_height);
824
825                if ( bound_height > stableHeight && dataSafe === 'yes' ) {
826                    $row.find('>div').css({
827                        'transform':'none'
828                    });
829                    move = false;
830				}
831
832				if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) {
833					$row.find('>div').css({
834						'transform':'none'
835					});
836					move = false;
837				}
838
839				if ( move ) {
840
841					if ( fromBottom < stableHeight ) {
842						//maybe Footer
843						trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove);
844                    } else if ( scrolled + bound_top < stableHeight ) {
845						//maybe Header
846						trans = scrolled*(dataMove);
847					} else {
848						trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove);
849					}
850
851                    $row.find('>div').css({
852                        'transform':'translateY(' + (trans) + 'px) translateZ(0)',
853                    });
854                }
855			}
856	
857			requestAnimationFrame(loopRAF);
858		};
859		
860		requestAnimationFrame(loopRAF);
861
862	});
863
864	$(window).on( 'load resize', function(e) {
865		if ( ! UNCODE.isMobile ) {
866			stableHeight = UNCODE.wheight;
867		}
868	});
869
870	$(window).on( 'load wwResize', function(e) {
871		if ( UNCODE.isMobile ) {
872			stableHeight = UNCODE.wheight;
873		}
874	});
875
876}
877
878UNCODE.changeSkinOnScroll = function(){
879	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
880		return;
881	}
882	var $masthead = $('#masthead'),
883		transDesktop,
884		transMobile,
885		changeSkin,
886
887	checkTransparencyAndChange = function( $col ){
888		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
889		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
890		changeSkin = $masthead.hasClass('menu-change-skin');
891
892		if ( ! transDesktop && ! transMobile ) {
893			return false;
894		}
895
896		if ( ! changeSkin ) {
897			return false;
898		}
899
900		if ( $col.hasClass('style-light') ){
901			$masthead.removeClass('style-dark-override').addClass('style-light-override');
902			return false;
903		} else if ( $col.hasClass('style-dark') ) {
904			$masthead.removeClass('style-light-override').addClass('style-dark-override');
905			return false;
906		}
907	};
908
909	var prev_row = 'normal',
910		odd = true,
911		$rows = $('.vc_row[data-parent]:visible');
912	$.each($rows, function(index, row){
913		var $row = $(row),
914			$col = $('.uncol', $row).first(),
915			$slider = $('.uncode-slider', $row);
916
917		var wayDown = new Waypoint({
918			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
919			element: row,
920			handler: function(direction) {
921				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
922					if ( $slider.length ) {
923						$col = $('.owl-item.index-active .uncol', $slider).first();
924					}
925					checkTransparencyAndChange($col);
926				}
927				if ( odd === false ) {
928					if ( row.hasAttribute('data-bg-changer') ) {
929						prev_row = 'bg-changer';
930					} else {
931						prev_row = 'normal';
932					}
933					odd = true;
934				} else {
935					odd = false;
936				}
937			},
938			offset: function() {
939				return UNCODE.menuHeight / 2
940			}
941		});
942		var wayUp = new Waypoint({
943			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
944			element: row,
945			handler: function(direction) {
946				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
947					if ( $slider.length ) {
948						$col = $('.owl-item.index-active .uncol', $slider).first();
949					}
950					checkTransparencyAndChange($col);
951				}
952				if ( odd === false ) {
953					if ( row.hasAttribute('data-bg-changer') ) {
954						prev_row = 'bg-changer';
955					} else {
956						prev_row = 'normal';
957					}
958					odd = true;
959				} else {
960					odd = false;
961				}
962			},
963			offset: function() {
964				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
965			}
966		});
967	});
968
969};
970
971UNCODE.share = function() {
972	if (typeof Share !== 'undefined') {
973		var share_button_element = $('.share-button');
974		var share_button_url = share_button_element.data('url');
975
976		var share_button_config = {
977			ui: {
978				flyout: "top center",
979				button_font: false,
980				button_text: '',
981				icon_font: false
982			}
983		};
984
985		if (share_button_url) {
986			share_button_config.url = share_button_url.replace("&", "%26");
987		}
988
989		var share_button_top = new Share('.share-button', share_button_config);
990
991		$('li[data-network]', share_button_element).each(function(){
992			var label = SiteParameters.uncode_share_label,
993				network = $(this).attr('data-network');
994			label = label.replace("%", network);
995			$(this).attr('aria-label', label);
996		});
997	}
998};
999
1000UNCODE.tooltip = function() {
1001	if (typeof jQuery.fn.tooltip !== 'undefined') {
1002		$('.btn-tooltip').tooltip();
1003	}
1004};
1005
1006UNCODE.counters = function() {
1007	var $counters = $('.uncode-counter:not(.counter-init)');
1008	$counters.each(function(){
1009		var $counter = $(this).addClass('counter-init');
1010		if ( SiteParameters.is_frontend_editor ) {
1011			$counter.addClass('started');
1012		}
1013		if ( $counter.closest( '.owl-carousel' ).length ) {
1014			return;
1015		}
1016		$counter.addClass('started').counterUp({
1017			delay: 10,
1018			time: 1500
1019		});
1020	});
1021};
1022
1023UNCODE.countdowns = function() {
1024	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
1025	$countdowns.each(function() {
1026		var $this = $(this).addClass('counter-init'),
1027			finalDate = $(this).data('uncode-countdown');
1028		$this.countdown(finalDate, function(event) {
1029			$this.html(event.strftime('<span>%D <small>' + SiteParameters.days + '</small></span> <span>%H <small>' + SiteParameters.hours + '</small></span> <span>%M <small>' + SiteParameters.minutes + '</small></span> <span>%S <small>' + SiteParameters.seconds + '</small></span>'));
1030		});
1031	});
1032};
1033
1034UNCODE.tabs = function() {
1035
1036	var tabSwitcher = function($el){
1037		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1037ical):not(.tab-switch)', $el).each(function(key, value){
1038			var $navs = $(value),
1039				$active = $('li.active', $navs),
1040				$active_a = $('> a', $active),
1041				$active_span = $('> span', $active_a),
1042				vertical = $navs.closest('.vertical-tab-menu').length;
1043			
1044			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
1045				$navs.append('<span class="switcher-cursor" aria-hidden="true" tabindex="-1" />');
1046			}
1047
1048			var $cursor = $('.switcher-cursor', $navs),
1049				active_w = $('a', $active).outerWidth(),
1050				span_w = $active_span.outerWidth(),
1051				active_pos = $active.position(),
1052				active_a_pos = $active_a.position(),
1053				span_pos = $active_span.position(),
1054				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
1055				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
1056
1057			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
1058
1059			if ( ! vertical ) {
1060				$cursor.css({
1061					left: cursor_left,
1062					width: cursor_w
1063				});
1064			}
1065
1066			$navs.addClass('switch-init');
1067		});
1068	};
1069
1070	var $body = $('body');
1071	tabSwitcher($body);
1072
1073	var tabHoverIntent = function(){
1074		var setHover;
1075		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
1076			.on('mouseover', function(e){
1077				var $this = $(e.target);
1078				setHover = requestTimeout(function() {
1079					$this.trigger('hover-int');
1080				}, 50);
1081			})
1082			.on('mouseout', function(){
1083				clearRequestTimeout(setHover);
1084			});
1085	};
1086	tabHoverIntent();
1087
1088	var tabInit = function(){
1089		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
1090			e.preventDefault()
1091			var $el = $(this);
1092			$el.tab('show');
1093			var $container = $el.closest('.uncode-tabs');
1094			tabSwitcher($container);
1095			requestTimeout(function() {
1096				window.dispatchEvent(UNCODE.boxEvent);
1097				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
1098
1099				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
1100					window.dispatchEvent(new CustomEvent('boxResized'));
1101				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
1102					window.dispatchEvent(new Event('resize'));
1103					$(window).trigger('uncode.re-layout');
1104				} 
1105
1106				var $active_panel = $('.tab-pane.active', $tabs);
1107
1108				$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) {
1109					var element = $(val),
1110						delayAttr = element.attr('data-delay');
1111					if (delayAttr == undefined) delayAttr = 0;
1112					requestTimeout(function() {
1113						element.addClass('start_animation');
1114					}, delayAttr);
1115				});
1116
1117			}, 300);
1118
1119			var $li = $el.closest('li'),
1120				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1121			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1122			$('.tab-pane', $li).slideDown(250);
1123			var completeSlideDown = requestTimeout(function(){
1124				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1125					var pos = $el.offset(),
1126						rect = $el[0].getBoundingClientRect(),
1127						$masthead = $('#masthead > .menu-container'),
1128						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1129
1130					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1131						$('html, body').animate({
1132							scrollTop: ( pos.top ) - considerMenu
1133						},{
1134							easing: 'easeInOutQuad',
1135							duration: 250
1136						});
1137					}
1138				}
1139			}, 260);
1140		});
1141	}
1142	tabInit();
1143
1144	var tabResponsive = function(){
1145		if ( SiteParameters.is_frontend_editor ) {
1146			return true;
1147		}
1148		var $tabContainers = $('.tab-container.tabs-breakpoint');
1149		$tabContainers.each(function(){
1150			var $tabContainer = $(this),
1151				$tabContent = $('.tab-content', $tabContainer),
1152				$nav = $('.nav-tabs', $tabContainer),
1153				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1154
1155			$('> li', $nav).each(function(){
1156				var $li = $(this),
1157					dataID = $li.attr('data-tab-id');
1158
1159				if ( UNCODE.wwidth <= mQuery ) {
1160					if ( ! $('.tab-pane', $li ).length ) {
1161						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1162						$tabContainer.addClass('tabs-appended');
1163						$li.append($append_pane);
1164					}
1165
1166					if ( $li.hasClass('active') ) {
1167						$('> a', $li).click();
1168					}
1169				} else {
1170					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1171						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1172						$tabContainer.removeClass('tabs-appended');
1173						$tabContent.prepend($append_pane.removeAttr('style'));
1174					}
1175				}
1176			});
1177		});
1178
1179	}
1180	tabResponsive();
1181
1182	$(window).on('wwResize', function(){
1183		tabHoverIntent();
1184		tabSwitcher($body);
1185	});
1186
1187	var setCTA;
1188	$(window).on( 'resize', function(){
1189		clearRequestTimeout(setCTA);
1190		setCTA = requestTimeout( tabResponsive, 100 );
1191	});
1192
1193	$('.nav-tabs').each(function(){
1194		var $nav = $(this),
1195			$lis = $('> li:not(.active)', $nav),
1196			$links = $('.tab-excerpt-link', $nav);
1197		$('.tab-excerpt', $lis).slideUp(400, function(){
1198			$(this).addClass('init');
1199		});
1200
1201		$links.each(function(){
1202			var $link = $(this),
1203				$par_a = $link.closest('a'),
1204				href = $link.attr('data-href'),
1205				target = $link.attr('data-target');
1206			$par_a.addClass('inner-link');
1207			$link.on('click', function(){
1208				var _link = document.createElement('a');
1209				_link.href = href;
1210				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1211				_link.click();
1212			});
1213		});
1214		$nav.addClass('tab-init');
1215	});
1216
1217	$('.uncode-tabs.tabs-no-lazy').each(function(){
1218		var $tabs = $(this),
1219			$panes = $('.tab-pane:not(.active)', $tabs);
1220		$panes.each(function(){
1221			var $pane = $(this),
1222				$imgs = $('img[loading="lazy"]', $pane);
1223			$imgs.removeAttr('loading');
1224			$imgs.removeAttr('decoding');
1225		});
1226	});
1227
1228};
1229UNCODE.collapse = function() {
1230	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1231		var $this = $(this),
1232			href
1233		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1234		var $target = $(target)
1235		var parent = $this.attr('data-parent')
1236		var $parent = parent && $(parent)
1237		var $title = $(this).parent()
1238		var $accordion = $(e.target).closest('.uncode-accordion')
1239		var $group = $this.closest('.group')
1240		var $panel_group = $this.closest('.panel-group')
1241		if ($parent) {
1242			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1243			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1244				$title.removeClass('active');
1245				$group.removeClass('active-group');
1246			} else {
1247				if ( $panel_group.attr('data-no-toggle') != true ) {
1248					$parent.find('.panel-title').removeClass('active')
1249					$parent.find('.group').removeClass('active-group')
1250				}
1251				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1252				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1253			}
1254		}
1255		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1256		requestTimeout(function() {
1257			var $accordion = $(e.target).closest('.uncode-accordion');
1258			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1259			  window.dispatchEvent(new CustomEvent('boxResized'));
1260			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1261				window.dispatchEvent(new Event('resize'));
1262				$(window).trigger('uncode.re-layout');
1263			} 
1264
1265			var $active_panel = $('.panel.active-group', $parent);
1266
1267			$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) {
1268				var element = $(val),
1269					delayAttr = element.attr('data-delay');
1270				if (delayAttr == undefined) delayAttr = 0;
1271				requestTimeout(function() {
1272					element.addClass('start_animation');
1273				}, delayAttr);
1274			});
1275
1276		}, 500);
1277
1278		$group.find('.panel-title:not(.active) > a').trigger('blur');
1279
1280	});
1281
1282	$('.uncode-accordion.tabs-no-lazy').each(function(){
1283		var $accordion = $(this),
1284			$panes = $('.panel:not(.active-group)', $accordion);
1285		$panes.each(function(){
1286			var $pane = $(this),
1287				$imgs = $('img[loading="lazy"]', $pane);
1288			$imgs.removeAttr('loading');
1289			$imgs.removeAttr('decoding');
1290		});
1291	});
1292};
1293
1294UNCODE.accessibility = function() {
1295    if ( ! SiteParameters.uncode_is_accessible ) {
1296        return;
1297    }
1298
1299    //
1300
1301};
1302UNCODE.bigText = function(el) {
1303	var bigTextLaunch = function(){
1304		if (el == undefined) {
1305			el = $('body');
1306		}
1307		$.each($('.bigtext', el), function(index, val) {
1308			$(val).bigtext({
1309				minfontsize: 24
1310			});
1311			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1312				opacity: 1
1313			});
1314			requestTimeout(function() {
1315				if ($(val).find('.animate_when_almost_visible').length != 0) {
1316					$(val).css({opacity: 1});
1317				}
1318			}, 400);
1319		});
1320	};
1321
1322	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1323		bigTextLaunch();
1324	}
1325	$(window).on( 'load', bigTextLaunch );
1326};
1327
1328UNCODE.process_shortpixel_image = function(image) {
1329	var data = {
1330		action: 'shortpixel_manual_optimization',
1331		image_id: image,
1332		cleanup: true
1333	};
1334
1335	$.get(SiteParameters.ajax_url, data);
1336};
1337
1338UNCODE.menuSystem = function() {
1339
1340	function menuMobile() {
1341		var $body = $('body'),
1342			scrolltop,
1343			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'),
1344			$masthead = $('#masthead'),
1345			$box,
1346			$el,
1347			$el_transp,
1348			elHeight,
1349			offCanvasAnim,
1350			check,
1351			animating = false,
1352			stickyMobile = false,
1353			menuClose = new CustomEvent('menuMobileClose'),
1354			menuOpen = new CustomEvent('menuMobileOpen');
1355		UNCODE.menuOpened = false;
1356		$mobileToggleButton.on('click', function(event) {
1357			event.stopPropagation();
1358			var btn = this;
1359			if ($(btn).hasClass('overlay-close')) return;
1360			event.preventDefault();
1361			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1362			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1363				$box = $(this).closest('.box-container').find('.main-menu-container');
1364				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
1365				$el_transp = $('.menu-absolute.menu-transparent');
1366				if (UNCODE.isMobile) {
1367					if ( $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical, .menu-mobile-centered, .menu-sticky-mobile').length ) {
1368						stickyMobile = true;
1369						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1370					} else {
1371						elHeight = 0;
1372						$.each($box.find('> div'), function(index, val) {
1373							elHeight += $(val).outerHeight();
1374						});
1375					}
1376				} else {
1377					elHeight = 0;
1378					$.each($el, function(index, val) {
1379						elHeight += $(val).outerHeight();
1380					});
1381				}
1382				var open = function() {
1383					clearTimeout(offCanvasAnim);
1384					if (!animating) {
1385						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1386						scrolltop = $(window).scrollTop();
1387						window.dispatchEvent(menuOpen);
1388						animating = true;
1389						UNCODE.menuOpened = true;
1390						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1391							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1392								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1393							}
1394							if ($('body.menu-offcanvas').length) {
1395								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1396								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1397							} else {
1398								if ( $('.menu-hide, .menu-sticky').length ) {
1399									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1400										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1401									}
1402								}
1403							}
1404						}
1405						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1406							//$("#masthead")[0].scrollIntoView();
1407							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1408						}
1409						$box.addClass('open-items');
1410						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1411							$el_transp.addClass('is_mobile_open');
1412						}
1413						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1414							btn.classList.add('close');
1415							$box.animate({
1416								height: elHeight
1417							}, 600, "easeInOutCirc", function() {
1418								animating = false;
1419								if (!stickyMobile) $box.css('height', 'auto');
1420							});
1421						} else {
1422							animating = false;
1423						}
1424					}
1425				};
1426
1427				var close = function() {
1428					clearTimeout(offCanvasAnim);
1429					if (!animating) {
1430						window.dispatchEvent(menuClose);
1431						animating = true;
1432						UNCODE.menuOpened = false;
1433						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1434							btn.classList.remove('close');
1435							btn.classList.add('closing');
1436						}
1437						$box.addClass('close');
1438						requestTimeout(function() {
1439							$box.removeClass('close');
1440							$box.removeClass('open-items');
1441							btn.classList.remove('closing');
1442							if ($el_transp.length) {
1443								$el_transp.removeClass('is_mobile_open');
1444							}
1445						}, 500);
1446						$body.removeClass('opening-overlay-menu');
1447						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1448							$box.animate({
1449								height: 0
1450							}, {
1451								duration: 600,
1452								easing: "easeInOutCirc",
1453								complete: function(elements) {
1454									$(elements).css('height', '');
1455									animating = false;
1456									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1457										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1458									}
1459									$body.removeClass('open-overlay-menu');
1460								}
1461							});
1462						} else {
1463							animating = false;
1464							offCanvasAnim = setTimeout(function(){
1465								$body.removeClass('open-overlay-menu');
1466							}, 1000);
1467						}
1468					}
1469				};
1470				check = (!UNCODE.menuOpened) ? open() : close();
1471			}
1472		});
1473
1474		$('html').on('click', function(event){
1475			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1476				$('.uncode-close-offcanvas-mobile').trigger('click');
1477			}
1478		});
1479
1480		window.addEventListener('menuMobileTrigged', function(e) {
1481			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1482		});
1483		window.addEventListener('orientationchange', function(e) {
1484			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1485		});
1486		window.addEventListener("resize", function() {
1487			if ($(window).width() < UNCODE.mediaQuery) {
1488				if (UNCODE.isMobile) {
1489					var $box = $('.box-container .main-menu-container'),
1490						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
1491					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1492						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1493							elHeight = 0;
1494							$.each($el, function(index, val) {
1495								elHeight += $(val).outerHeight();
1496							});
1497							elHeight = window.innerHeight - $('.menu-wrapper.menu-sticky .menu-container .row-menu-inner, .menu-wrapper.menu-hide-only .menu-container .row-menu-inner').height() - (UNCODE.bodyBorder * 2) + 1;
1498							$($box).css('height', elHeight + 'px');
1499						}
1500					}
1501				}
1502			} else {
1503				$('.menu-hide-vertical').removeAttr('style');
1504				$('.menu-container-mobile').removeAttr('style');
1505				$('.vmenu-container.menu-container').removeAttr('style');
1506			}
1507		});
1508
1509		$(window).on('scroll', function(){
1510			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1511				$(window).scrollTop(scrolltop);
1512				return false;
1513			}
1514		});
1515
1516	};
1517
1518	function menuOffCanvas() {
1519		var menuClose = new CustomEvent('menuCanvasClose'),
1520			menuOpen = new CustomEvent('menuCanvasOpen');
1521		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1522			if ($(window).width() > UNCODE.mediaQuery) {
1523				if ( $('body.vmenu-offcanvas-overlay').length ) {
1524					if ($(event.currentTarget).hasClass('off-close')) {
1525						$(event.currentTarget).removeClass('off-close');
1526						requestTimeout(function() {
1527							window.dispatchEvent(menuClose);
1528						}, 500);
1529
1530					} else {
1531						$(event.currentTarget).addClass('off-close');
1532						window.dispatchEvent(menuOpen);
1533					}
1534				} else {
1535					if ($(event.currentTarget).hasClass('close')) {
1536						$(event.currentTarget).removeClass('close');
1537						$(event.currentTarget).addClass('closing');
1538						requestTimeout(function() {
1539							$(event.currentTarget).removeClass('closing');
1540							window.dispatchEvent(menuClose);
1541						}, 500);
1542
1543					} else {
1544						$(event.currentTarget).addClass('close');
1545						window.dispatchEvent(menuOpen);
1546					}
1547				}
1548			}
1549
1550			$('body').toggleClass('off-opened');
1551		});
1552
1553		$('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){
1554			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1555				var $vMenuCont = $('#masthead .vmenu-container'),
1556					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1557
1558					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1559					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1560					vmenu_off = $vMenuCont.offset(),
1561					vmenu_l = parseFloat(vmenu_off.left),
1562					vmenu_t = parseFloat(vmenu_off.top),
1563					vmenu_r = vmenu_l + vmenu_w,
1564					vmenu_b = vmenu_t + vmenu_h,
1565
1566					close_h = parseFloat( $close_menu.outerHeight() ),
1567					close_w = parseFloat( $close_menu.outerWidth() ),
1568					close_off = $close_menu.offset(),
1569					close_l = parseFloat(close_off.left),
1570					close_t = parseFloat(close_off.top),
1571					close_r = close_l + close_w,
1572					close_b = close_t + close_h;
1573				if (
1574					!(
1575						e.clientX > vmenu_l &&
1576						e.clientX < vmenu_r &&
1577						e.clientY > vmenu_t &&
1578						e.clientY < vmenu_b
1579					)
1580					||
1581					(
1582						e.clientX > close_l &&
1583						e.clientX < close_r &&
1584						e.clientY > close_t &&
1585						e.clientY < close_b
1586					)
1587				) {
1588					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1589				}
1590			}
1591		});
1592	};
1593
1594	function menuOverlay() {
1595		if ( $('.overlay').length ) {
1596			$('.overlay').removeClass('hidden');
1597		}
1598		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1599			$('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li, .uncode-menu-additional-text').each(function(index, el) {
1600				var transDelay = (index / 20) + 0.1;
1601				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1602					transDelay = transDelay + 0.3;
1603				$(this)[0].setAttribute('style', '-webkit-transition-delay:' + transDelay + 's; -moz-transition-delay:' + transDelay + 's; -ms-transition-delay:' + transDelay + 's; -o-transition-delay:' + transDelay + 's; transition-delay:' + transDelay + 's');
1604			});
1605		}
1606
1607	};
1608	var $secondary_parent;
1609	function menuAppend() {
1610		var $body = $('body'),
1611			$menuCont = $('.menu-container:not(.vmenu-container)'),
1612			$vMenuCont = $('.menu-container.vmenu-container'),
1613			$cta = $('.navbar-cta'),
1614			$socials = $('.navbar-social:not(.appended-navbar)'),
1615			$ul = $('.navbar-main ul.menu-primary-inner'),
1616			$ulCta,
1617			$ulSocials,
1618			$navLast,
1619			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1620			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1621			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1622			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1623			$ulFirst = $('> ul', $firstNav),
1624			$ulSecond = $('> ul', $secondNav),
1625			setCTA,
1626			appendCTA = function(){
1627				return true;
1628			},
1629			appendSocials = function(){
1630				return true;
1631			},
1632			appendSplit = function(){
1633				return true;
1634			};
1635
1636		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1637			$ulCta = $('> ul', $cta);
1638			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1639
1640			appendCTA = function(){
1641				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1642					$ul.after($ulCta);
1643				} else {
1644					$cta.append($ulCta);
1645				}
1646			}
1647		}
1648
1649		if ( ! $body.hasClass('cta-not-appended') ) {
1650			appendCTA();
1651		}
1652
1653		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1654		$smartSocial.each(function(){
1655			var $_smartSocial = $(this);
1656			$('> li', $_smartSocial).each(function(){
1657				var $li = $(this);
1658				if ( $li.hasClass('mobile-hidden') ) {
1659					$_smartSocial.addClass('mobile-hidden');
1660				} else {
1661					$_smartSocial.removeClass('mobile-hidden');
1662					return false;
1663				}
1664			});
1665
1666			$('> li', $_smartSocial).each(function(){
1667				var $li = $(this);
1668				if ( $li.hasClass('tablet-hidden') ) {
1669					$_smartSocial.addClass('tablet-hidden');
1670				} else {
1671					$_smartSocial.removeClass('tablet-hidden');
1672					return false;
1673				}
1674			});
1675		});
1676
1677		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1678			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1679			if ( $body.hasClass('hmenu-center-split') ) {
1680				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1681			} else {
1682				$navLast = $('.navbar-nav-last', $vMenuCont);
1683			}
1684
1685			if ( ! $navLast.length ) {
1686				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1687				if ( $body.hasClass('hmenu-center-split') ) {
1688					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1689					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1690				} else {
1691					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1692					$navLast = $('.navbar-nav-last', $vMenuCont);
1693				}
1694			}
1695
1696			appendSocials = function(){
1697				if ( !$body.hasClass('menu-overlay-center') ) {
1698				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1699				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1700				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1701				// 		$ulSocials.each(function(){
1702				// 			var $li_social = $(this);
1703				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1704				// 		});
1705				// 	}
1706				// } else {
1707					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1708						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1709						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1710							$('> ul.menu-smart-social li', $socials).remove();
1711						}
1712						$navLast.append($ulSocials);
1713					} else {
1714						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1715							$('> ul.menu-smart-social li', $navLast).remove();
1716						}
1717						$socials.append($ulSocials);
1718					}
1719				}
1720			}
1721			appendSocials();
1722		}
1723
1724		if ( $vMenuCont.length ) {
1725			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1726		} else {
1727			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1728		}
1729		if ( $accordion_secondary.length ) {
1730			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1731			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1732				if ( !$accordion_secondary_ph.length ) {
1733					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1734				}
1735				if ( $vMenuCont.length ) {
1736					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1737				} else {
1738					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1739						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1740					} else {
1741						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1742					}
1743				}
1744			} else {
1745				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1746					$accordion_secondary_ph.before($accordion_secondary);
1747				}
1748			}
1749		}
1750
1751		if ( $vMenuCont.length ) {
1752			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1753		} else {
1754			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1755		}
1756
1757		if ( $extra_icons.length ) {
1758			if ( $vMenuCont.length ) {
1759				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1760					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1761						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1762							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1763						$not_social.each(function(){
1764							if ( ! $primary_after.length ) {
1765								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1766								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1767								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1768							}
1769							var $extra_li = $(this);
1770							$primary_after.find('> ul').append($extra_li);
1771						});
1772					} else {
1773						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1774							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1775						$not_social.each(function(){
1776							var $extra_li = $(this);
1777							$extra_icons.find('> ul').append($extra_li);
1778						});
1779					}
1780				} /*else {
1781					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1782					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1783						if ( !$extra_icons_ph.length ) {
1784							$extra_icons.after('<span class="extra-icons-ph" />');
1785						}
1786						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1787							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1788						} else {
1789							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1790						}
1791					} else {
1792						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1793							$extra_icons_ph.before($extra_icons);
1794						}
1795					}
1796				}*/
1797			} else {
1798				if ( ! $body.hasClass('hmenu-center-double') ) {
1799					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1800						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1801							$primary_after = $('.nav.navbar-main-after', $menuCont);
1802
1803						if ( ! $primary_after.length && $not_social.length ) {
1804							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1805								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1806							} else {
1807								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1808							}
1809							$primary_after = $('.nav.navbar-main-after', $menuCont);
1810							$primary_after.append('<ul class="menu-smart sm menu-smart-social" role="menu" />');
1811						}
1812						var tablet_hidden = true,
1813							mobile_hidden = true;
1814						$not_social.each(function(){
1815							var $extra_li = $(this);
1816							$primary_after.find('> ul').append($extra_li);
1817							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1818								tablet_hidden = false;
1819							}
1820							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1821								mobile_hidden = false;
1822							}
1823						});
1824						if ( tablet_hidden === true && $not_social.length ) {
1825							$primary_after.addClass('tablet-hidden');
1826						}
1827						if ( mobile_hidden === true && $not_social.length ) {
1828							$primary_after.addClass('mobile-hidden');
1829						}
1830					} else {
1831						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1832
1833						if ( $primary_after.length ) {
1834							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1835							$not_social.each(function(){
1836								var $extra_li = $(this);
1837								$extra_icons.find('> ul').append($extra_li);
1838							});
1839							$primary_after.remove();
1840						}
1841					}
1842				}
1843			}
1844		}
1845
1846		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1847			appendSplit = function(){
1848				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1849					if ( $extra_icons.length ) {
1850						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1851							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1852								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1853							$not_social.each(function(){
1854								var $extra_li = $(this);
1855								$append_ul.append($extra_li);
1856							});
1857							if ( $secondNav.length ) {
1858								$secondNav.append($append_ul);
1859							} else {
1860								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1861							}
1862						}
1863					}
1864					if ( $secondNav.length ) {
1865						$secondNav.prepend($ulFirst);
1866					} else {
1867						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1868					}
1869					$firstMenu.hide();
1870				} else {
1871					$firstNav.append($ulFirst);
1872					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1873					if ( $append_ul.length ) {
1874						var $not_social = $('> li:not(.social-icon)', $append_ul);
1875						$not_social.each(function(){
1876							var $extra_li = $(this);
1877							$extra_icons.find('> ul').append($extra_li);
1878						});
1879					}
1880					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1881					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1882					$firstMenu.css({
1883						'display': 'table-cell'
1884					});
1885				}
1886			}
1887		}
1888		appendSplit();
1889
1890		$(window).on( 'wwresize', function(){
1891			clearRequestTimeout(setCTA);
1892			setCTA = requestTimeout( function() {
1893				appendCTA();
1894				appendSocials();
1895				appendSplit();
1896			}, 10 );
1897		});
1898	}
1899	//menuMobileButton();
1900	menuMobile();
1901	menuOffCanvas();
1902	menuAppend();
1903	menuOverlay();
1904
1905	var stickyDropdownSearch = function(){
1906		var $masthead = $('#masthead'),
1907			$ddSearch = $('.overlay.overlay-search', $masthead),
1908			$styles = $('#stickyDropdownSearch').remove();
1909		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1910			var $menuWrapper = $('.menu-wrapper'),
1911				$navbar = $('.menu-container-mobile', $menuWrapper),
1912				navbarH = $navbar.outerHeight(),
1913				//$topbar = $('.top-menu', $menuWrapper),
1914				//topbarH = $topbar.outerHeight(),
1915				_css;
1916
1917			_css = '<style id="stickyDropdownSearch">';
1918			_css += '@media (max-width: 959px) {';
1919			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
1920			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
1921			_css += '}';
1922			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
1923			_css += 'position: fixed;';
1924			_css += 'top: 0;';
1925			_css += '}';
1926			_css += '</style>';
1927
1928			$(_css).appendTo($('head'));
1929		}
1930	}
1931	stickyDropdownSearch();
1932
1933	var setMenuOverlay;
1934	$(window).on( 'wwResize', function(){
1935		if ( $('.overlay').length && $(window).width() > 1024 ) {
1936			$('.overlay').addClass('hidden');
1937		}
1938		clearRequestTimeout(setMenuOverlay);
1939		setMenuOverlay = requestTimeout( function(){
1940			menuOverlay();
1941			menuAppend();
1942			stickyDropdownSearch();
1943		}, 150 );
1944	});
1945	UNCODE.menuSmartInit();
1946};
1947
1948UNCODE.menuSmartInit = function() {
1949	var $menusmart = $('[class*="menu-smart"]'),
1950		$masthead = $('#masthead'),
1951		$hMenu = $('.menu-horizontal-inner', $masthead),
1952		$focus = $('.overlay-menu-focus'),
1953		showTimeout = 50,
1954		hideTimeout = 50,
1955		showTimeoutFunc, hideTimeoutFunc;
1956
1957	$('> li.menu-item-has-children', $menusmart).hover(function(){
1958		$(this).data('hover', true);
1959	}, function(){
1960		$(this).data('hover', false);
1961	});
1962
1963	$('> li.menu-item-has-children', $menusmart).each(function(){
1964		var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
1965	});
1966
1967	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
1968		e.preventDefault();
1969	});
1970
1971	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
1972		var $notLis = $('> .nav > ul > li a', $hMenu),
1973			$menuA = $('a', $masthead).not($notLis),
1974			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
1975			showFuncCond = function() { return true };
1976
1977		if ( $('body').hasClass('focus-megamenu') ) {
1978			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner');
1979			showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') };
1980		} else if ( $('body').hasClass('focus-links') ) {
1981			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
1982		}
1983
1984		$hoverSelector.hover(function(){
1985			clearRequestTimeout(hideTimeoutFunc);
1986			showTimeoutFunc = requestTimeout(function(){
1987				$('body').addClass('navbar-hover');
1988			}, showTimeout*2);
1989		}, function(){
1990			hideTimeoutFunc = requestTimeout(function(){
1991				if ( ! $('.overlay-search.open', $masthead).length ) {
1992					$('body').removeClass('navbar-hover');
1993				}
1994			}, hideTimeout*2);
1995		});
1996	} else {
1997		showFuncCond = function() { return false };
1998	}
1999
2000	if ($menusmart.length > 0) {
2001		$menusmart.smartmenus({
2002			subIndicators: false,
2003			subIndicatorsPos: 'append',
2004			//subMenusMinWidth: '13em',
2005			subIndicatorsText: '',
2006			showTimeout: showTimeout,
2007			hideTimeout: hideTimeout,
2008			scrollStep: 8,
2009			showFunction: function($ul, complete) {
2010				clearRequestTimeout(showTimeoutFunc);
2011				$ul.fadeIn(0, 'linear', function(){
2012					complete();
2013					if ( $ul.hasClass('vc_row') ) {
2014						$ul.css({
2015							'display': 'table'
2016						});
2017					}
2018					if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) {
2019						$('body').addClass('open-megamenu');
2020					}
2021					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
2022						$('body').addClass('navbar-hover');
2023					}
2024				}).addClass('open-animated');
2025			},
2026			hideFunction: function($ul, complete) {
2027				if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) {
2028					$('body').removeClass('open-megamenu');
2029				}
2030				var fixIE = $('html.ie').length;
2031				if (fixIE) {
2032					var $rowParent = $($ul).closest('.main-menu-container');
2033					$rowParent.height('auto');
2034				}
2035				$ul.fadeOut(0, 'linear', function(){
2036					complete();
2037					$ul.removeClass('open-animated');
2038					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
2039						$('body').removeClass('open-submenu');
2040					}
2041				});
2042			},
2043			collapsibleShowFunction: function($ul, complete) {
2044				$ul.slideDown(400, 'easeInOutCirc', complete);
2045			},
2046			collapsibleHideFunction: function($ul, complete) {
2047				$ul.slideUp(200, 'easeInOutCirc', complete);
2048			},
2049			hideOnClick: SiteParameters.menuHideOnClick,
2050		});
2051
2052		if ( $('body').hasClass('menu-accordion-active') ) {
2053			$menusmart.each(function(key, menu){
2054				$(menu).addClass('menu-smart-init');
2055				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2056			});
2057		}
2058		
2059		$(document).on( 'uncode.smartmenu-appended', function(){
2060			requestTimeout(function(){
2061				$menusmart.smartmenus( 'refresh' );
2062			}, 1000);
2063		});
2064	}
2065
2066	$('.main-menu-container').each(function(){
2067		var $main_cont = $(this),
2068			$uls = $('ul', $main_cont);
2069
2070		$uls.each(function(){
2071			var $ul = $(this),
2072				mobile_hidden = true,
2073				tablet_hidden = true;
2074			$('> li:not(.hidden)', $ul).each(function(){
2075				if ( !$(this).hasClass('mobile-hidden') ) {
2076					mobile_hidden = false;
2077					return false;
2078				}
2079			});
2080			$('> li:not(.hidden)', $ul).each(function(){
2081				if ( !$(this).hasClass('tablet-hidden') ) {
2082					tablet_hidden = false;
2083					return false;
2084				}
2085			});
2086			if ( mobile_hidden ) {
2087				$ul.addClass('mobile-hidden');
2088			}
2089			if ( tablet_hidden ) {
2090				$ul.addClass('tablet-hidden');
2091			}
2092		});
2093
2094		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2095
2096		$divUlsMB.each(function(){
2097			var $divUlMB = $(this),
2098				div_mobile_hidden = true,
2099				div_tablet_hidden = true;
2100
2101			$('> ul:not(.hidden)', $divUlMB).each(function(){
2102				if ( !$(this).hasClass('mobile-hidden') ) {
2103					div_mobile_hidden = false;
2104					return false;
2105				}
2106			});
2107			$('> ul:not(.hidden)', $divUlMB).each(function(){
2108				if ( !$(this).hasClass('tablet-hidden') ) {
2109					div_tablet_hidden = false;
2110					return false;
2111				}
2112			});
2113			if ( div_mobile_hidden ) {
2114				$divUlMB.addClass('mobile-hidden');
2115			}
2116			if ( div_tablet_hidden ) {
2117				$divUlMB.addClass('tablet-hidden');
2118			}
2119		});
2120	});
2121
2122	var overlaySearchButton = function(){
2123		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2124
2125		$search_wrap.each(function(){
2126			var $form = $('form', this),
2127				$icon = $('i', $form);
2128
2129			$icon.on('click', function(){
2130				$form.submit();
2131			});
2132		});
2133	};
2134	overlaySearchButton();
2135}
2136
2137UNCODE.okvideo = function(ev) {
2138	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2139	$.okvideo = function(options) {
2140		// if the option var was just a string, turn it into an object
2141		if (typeof options !== 'object') options = {
2142			'video': options
2143		};
2144		var base = this;
2145		// kick things off
2146		base.init = function() {
2147			base.options = $.extend({}, $.okvideo.options, options);
2148			// support older versions of okvideo
2149			if (base.options.video === null) base.options.video = base.options.source;
2150			base.setOptions();
2151			var target = base.options.target || $('body');
2152			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2153			var zIndex = base.options.controls === 3 ? -999 : "auto";
2154			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2155				var mask = '<div id="okplayer-mask-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:-998;height:100%;width:100%;"></div>';
2156				if (OKEvents.utils.isMobile()) {
2157					target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
2158				} else {
2159					if (base.options.controls === 3) {
2160						target.append(mask)
2161					}
2162					if (base.options.adproof === 1) {
2163						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:-10%;top:-10%;overflow:hidden;z-index:' + zIndex + ';height:120%;width:120%;"></div>');
2164					} else {
2165						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
2166					}
2167				}
2168				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2169				if (base.options.playlist.list === null) {
2170					if (base.options.video.provider === 'youtube') {
2171						base.loadYouTubeAPI();
2172					} else if (base.options.video.provider === 'vimeo') {
2173						base.options.volume /= 100;
2174						base.loadVimeoAPI();
2175					}
2176				} else {
2177					base.loadYouTubeAPI();
2178				}
2179			}
2180		};
2181		// clean the options
2182		base.setOptions = function() {
2183			// exchange 'true' for '1' and 'false' for 3
2184			for (var key in this.options) {
2185				if (this.options[key] === true) this.options[key] = 1;
2186				if (this.options[key] === false) this.options[key] = 3;
2187			}
2188			if (base.options.playlist.list === null) {
2189				base.options.video = base.determineProvider();
2190			}
2191			// pass options to the window
2192			$(window).data('okoptions-' + base.options.id, base.options);
2193		};
2194		// insert js into the head and exectue a callback function
2195		base.insertJS = function(src, callback, provider){
2196			var tag;
2197			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2198				delete UNCODE.insertedSripts[src];
2199				var tags = document.getElementsByTagName('script');
2200				for (var i = tags.length; i >= 0; i--){
2201					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2202						tags[i].parentNode.removeChild(tags[i]);
2203					}
2204				}
2205			} else {
2206				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2207					tag = UNCODE.insertedSripts[src];
2208					if (callback){
2209						if (tag.readyState){  //IE
2210							tag.onreadystatechange = function(){
2211								if (tag.readyState === "loaded" ||
2212									tag.readyState === "complete"){
2213									tag.onreadystatechange = null;
2214									callback();
2215								}
2216							};
2217						} else {
2218							$(tag).on('load', callback);
2219						}
2220					}
2221					return;
2222				}
2223			}
2224			tag = document.createElement('script');
2225			if (callback){
2226				if (tag.readyState){  //IE
2227					tag.onreadystatechange = function(){
2228						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2229							tag.onreadystatechange = null;
2230							callback();
2231						}
2232					};
2233				} else {
2234					tag.onload = function() {
2235						callback();
2236					};
2237				}
2238			}
2239			tag.src = src;
2240			var firstScriptTag = document.getElementsByTagName('script')[0];
2241			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2242			if ( ! UNCODE.insertedSripts ) {
2243				UNCODE.insertedSripts = [];
2244			}
2245			UNCODE.insertedSripts[src] = tag;
2246		};
2247		// load the youtube api
2248		base.loadYouTubeAPI = function(callback) {
2249			if ( ev === 'uncode-more-items-loaded' ) {
2250				onYouTubeIframeAPIReady();
2251			} else {
2252				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2253			}
2254		};
2255		base.loadYouTubePlaylist = function() {
2256			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2257		};
2258		// load the vimeo api by replacing the div with an iframe and loading js
2259		base.loadVimeoAPI = function() {
2260			var source = '//player.vimeo.com/video/' + base.options.video.id + '?background=1&api=1&title=0&byline=0&portrait=0&playbar=0&loop=' + base.options.loop + '&autoplay=' + (base.options.autoplay === 1 ? 1 : 0) + '&player_id=okplayer-' + base.options.id + '&autopause=0',
2261			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2262			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2263			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2264			base.insertJS('//player.vimeo.com/api/player.js', function() {
2265				vimeoPlayerReady(base.options.id);
2266			}, 'vimeo');
2267		};
2268		// is it from youtube or vimeo?
2269		base.determineProvider = function() {
2270			var a = document.createElement('a');
2271			a.href = base.options.video;
2272			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2273				var videoid = a.href.split('/')[3].toString();
2274				var query = videoid.substring(videoid.indexOf('?') + 1);
2275				if (query != '') {
2276					var vars = query.split('&');
2277					for (var i = 0; i < vars.length; i++) {
2278						var pair = vars[i].split('=');
2279						if (pair[0] == 'v') {
2280							videoid = pair[1];
2281						}
2282					}
2283				}
2284				return {
2285					"provider": "youtube",
2286					"id": videoid
2287				};
2288			} else if (/vimeo.com/.test(base.options.video)) {
2289				return {
2290					"provider": "vimeo",
2291					"id": (a.href.split('/')[3].toString()).split('#')[0],
2292				};
2293			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2294				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2295				if (id.length == 11) {
2296					return {
2297						"provider": "youtube",
2298						"id": id.toString()
2299					};
2300				} else {
2301					for (var i = 0; i < base.options.video.length; i++) {
2302						if (typeof parseInt(base.options.video[i]) !== "number") {
2303							throw 'not vimeo but thought it was for a sec';
2304						}
2305					}
2306					return {
2307						"provider": "vimeo",
2308						"id": base.options.video
2309					};
2310				}
2311			} else {
2312				throw "OKVideo: Invalid video source";
2313			}
2314		};
2315		base.init();
2316	};
2317
2318	var checkResize,
2319		newW = UNCODE.wwidth;
2320
2321	$.okvideo.options = {
2322		id: null,
2323		source: null, // Deprecate dis l8r
2324		video: null,
2325		playlist: { // eat ur heart out @brokyo
2326			list: null,
2327			index: 0,
2328			startSeconds: 0,
2329			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2330		},
2331		disableKeyControl: 1,
2332		captions: 0,
2333		loop: 1,
2334		hd: 1,
2335		volume: 0,
2336		adproof: false,
2337		unstarted: null,
2338		onFinished: null,
2339		onReady: null,
2340		onPlay: null,
2341		onPause: null,
2342		buffering: null,
2343		controls: false,
2344		autoplay: true,
2345		annotations: true,
2346		cued: null
2347	};
2348	$.fn.okvideo = function(options) {
2349		options.target = this;
2350		return this.each(function() {
2351			(new $.okvideo(options));
2352		});
2353	};
2354
2355	var checkForVideos = function(){
2356		$(".uncode-video-container.video").each(function(index, el) {
2357			var $this = $(this),
2358				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2359				url = $this.attr('data-video'),
2360				id = $this.attr('data-id'),
2361				cloned = $this.closest('.owl-item');
2362
2363			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2364				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2365					$this.okvideo({
2366						id: id,
2367						source: url.split('#')[0],
2368						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2369						autoplay: 1,
2370						controls: 0,
2371						volume: 0,
2372						adproof: 0,
2373						caller: $this,
2374						hd: 1,
2375						onReady: function(player) {
2376							var getPlayer = player.c || player.h || player,
2377							$iframe,
2378							getContainer = $(getPlayer).closest('.background-element');
2379							if (getContainer.length) {
2380								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2381							}
2382
2383							if ( $this.hasClass('drop-move') ) {
2384
2385								var $iframe = $(getPlayer),
2386									w = parseFloat($iframe.attr('width')),
2387									h = parseFloat($iframe.attr('height')),
2388									ratio = h / w,
2389									setResizeiFto,
2390								resizeiFrame = function(){
2391									var dataW = $this.attr('data-w'),
2392										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2393										newH = newW * ratio;
2394									$iframe.css({
2395										width: newW,
2396										height: newH
2397									});
2398								};
2399								resizeiFrame();
2400								$(window).on( 'load', resizeiFrame );
2401								$(window).on( 'resize', function(){
2402									clearRequestTimeout(setResizeiFto);
2403									setResizeiFto = requestTimeout( function() {
2404										resizeiFrame();
2405									}, 10 );
2406								});
2407
2408							}
2409
2410						}
2411					});
2412				}
2413			}
2414		});
2415	};
2416
2417	checkForVideos();
2418
2419	$(window).on('load', function(){
2420		$('.mejs-fullscreen-button button').on('click', function(){
2421			var $button = $(this),
2422				$stuck = $button.closest('.is_stucked');
2423
2424			if ( $stuck.length ) {
2425				$stuck = $(this).trigger("sticky_kit:detach");
2426				window.scrollTo(0, 0);
2427			}
2428		});
2429	});
2430
2431	var checkVideoResize = function(){
2432		clearRequestTimeout(checkResize);
2433		checkResize = requestTimeout(function(){
2434			if ( newW !== UNCODE.wwidth ) {
2435				newW = UNCODE.wwidth;
2436				checkForVideos();
2437			}
2438		}, 1000);
2439	};
2440
2441	$(window).off('resize', checkVideoResize)
2442	.on( 'resize', checkVideoResize);
2443
2444};
2445
2446$(document).on('uncode-ajax-filtered.videos', function(){
2447	UNCODE.okvideo("uncode-more-items-loaded");
2448});
2449UNCODE.backgroundSelfVideos = function( $ctx ) {
2450
2451	var backgroundSelfVideosInit = function( $ctx ) {
2452		if ( SiteParameters.block_mobile_videos === true ) {
2453			return false;
2454		}
2455		if (typeof MediaElement === "function") {
2456			if ( typeof $ctx === 'undefined' ) {
2457				$ctx = document;
2458			}
2459		
2460			$(".background-video-shortcode", $ctx).each(function(index, el) {
2461				if ( $(this).closest('mediaelementwrapper').length ) {
2462					return true;
2463				}
2464				var $video_el = $(this),
2465					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2466					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2467					video_id = $video_el.attr('id');
2468
2469				if ( SiteParameters.is_frontend_editor ) {
2470					video_id = video_id + '_' + index;
2471					$video_el.attr('id', video_id);
2472				}
2473
2474				var media = new MediaElement(video_id, {
2475					startVolume: 0,
2476					loop: true,
2477					success: function(mediaElement, domObject) {
2478						domObject.volume = 0;
2479						$(mediaElement).data('started', false);
2480						mediaElement.addEventListener('timeupdate', function(e) {
2481							if (!$(e.target).data('started')) {
2482								$(mediaElement).data('started', true);
2483							}
2484						});
2485						mediaElement.addEventListener('loadedmetadata', function(e) {
2486							$('body').removeClass('video-not-supported');
2487							mediaElement.play();
2488						});
2489						if (!UNCODE.isMobile) {
2490							requestTimeout(function() {
2491								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2492							}, 100);
2493						}
2494						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2495							mediaElement.play();
2496						}
2497
2498						if ( $parent_drop_move.length ) {
2499							var setResizeMEto,
2500								resizeMediaElement = function(){
2501								var dataW = $parent_drop_move.attr('data-w'),
2502									videoW = domObject.width,
2503									videoH = domObject.height,
2504									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2505									newH = newW / ( videoW / videoH );
2506
2507								$(domObject).css({
2508									'height': newH,
2509									'width': newW
2510								});
2511							};
2512							$(window).on( 'resize load', function(){
2513								clearRequestTimeout(setResizeMEto);
2514								setResizeMEto = requestTimeout( function() {
2515									resizeMediaElement();
2516								}, 10 );
2517							});
2518						}
2519
2520						mediaElement.addEventListener('play', function() {
2521							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2522							$(mediaElement).closest('#page-header').addClass('video-started');
2523							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2524						}, true);
2525
2526					},
2527					// fires when a problem is detected
2528					error: function() {}
2529				});
2530			});
2531		} else {
2532
2533			if ( typeof $ctx === 'undefined' ) {
2534				$ctx = document;
2535			}
2536		
2537			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2538			Array.from(videos).forEach(function(video_el) {
2539				video_el.addEventListener('loadedmetadata', function(e) {
2540					$('body').removeClass('video-not-supported');
2541					video_el.play();
2542				});
2543				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2544					video_el.muted = true;
2545					video_el.loop = true;
2546					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2547					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2548					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2549					$('body').removeClass('video-not-supported');
2550					video_el.play();
2551				} else {
2552					requestTimeout(function(){
2553                         backgroundSelfVideosInit( $ctx );
2554					}, 1000);
2555				}
2556			});
2557		}
2558	};
2559
2560	backgroundSelfVideosInit( $ctx );
2561
2562	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2563		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2564			var $el = model.view.$el,
2565				shortcode = model.attributes.shortcode;
2566
2567			if (typeof MediaElement === "function") {
2568				backgroundSelfVideosInit( $el );
2569			} else {
2570				backgroundSelfVideosInit( $el[0] );
2571			}
2572		});
2573	}
2574};
2575
2576UNCODE.is_scrolling = false;
2577
2578UNCODE.disableHoverScroll = function() {
2579
2580	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2581		var body = document.body,
2582		timer;
2583
2584		window.addEventListener('scroll', function() {
2585			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2586			clearRequestTimeout(timer);
2587			if ( body.classList && !body.classList.contains('disable-hover') ) {
2588				body.classList.add('disable-hover');
2589				window.dispatchEvent(new CustomEvent('disable-hover'));
2590			}
2591			UNCODE.is_scrolling = true;
2592
2593			timer = requestTimeout(function() {
2594				if ( body.classList ) {
2595					body.classList.remove('disable-hover');
2596					window.dispatchEvent(new CustomEvent('enable-hover'));
2597				}
2598				UNCODE.is_scrolling = false;
2599			}, delay);
2600		}, false);
2601	}
2602};
2603
2604UNCODE.isotopeLayout = function() {
2605	if ($('.isotope-layout').length > 0) {
2606		var isotopeContainersArray = [],
2607			typeGridArray = [],
2608			layoutGridArray = [],
2609			screenLgArray = [],
2610			screenMdArray = [],
2611			screenSmArray = [],
2612			transitionDuration = [],
2613			$filterItems = [],
2614			$filters = $('.isotope-system .isotope-filters'),
2615			$itemSelector = '.tmb-iso',
2616			$items,
2617			itemMargin,
2618			correctionFactor = 0,
2619			firstLoad = true,
2620			isOriginLeft = $('body').hasClass('rtl') ? false : true;
2621		$('[class*="isotope-container"]').each(function(index) {
2622			var _this = $(this);
2623			var isoData = _this.data(),
2624			$data_lg,
2625			$data_md,
2626			$data_sm;
2627			_this.children('.tmb').addClass('tmb-iso');
2628			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
2629			else $data_lg = '1000';
2630			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
2631			else $data_md = '600';
2632			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
2633			else $data_sm = '480';
2634			screenLgArray.push($data_lg);
2635			screenMdArray.push($data_md);
2636			screenSmArray.push($data_sm);
2637			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
2638			if (isoData.type == 'metro') typeGridArray.push(true);
2639			else typeGridArray.push(false);
2640			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
2641			else layoutGridArray.push('masonry');
2642			isotopeContainersArray.push(_this);
2643			_this.attr('data-iso-index', index);
2644		});
2645		var colWidth = function(index) {
2646				$(isotopeContainersArray[index]).width('');
2647				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
2648					widthAvailable = $(isotopeContainersArray[index]).width(),
2649					columnNum = 12,
2650					columnWidth = 0,
2651					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
2652					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
2653					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
2654					$rowContainer,
2655					paddingRow,
2656					$colContainer,
2657					paddingCol;
2658
2659				if ( consider_menu )
2660					winHeight = winHeight - UNCODE.menuHeight;
2661
2662				if ( data_vp_height === '1' ) {
2663					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
2664					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
2665					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
2666					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
2667					winHeight = winHeight - ( paddingRow + paddingCol );
2668				}
2669
2670				if (isPx) {
2671					columnWidth = Math.ceil(widthAvailable / columnNum);
2672					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
2673				} else {
2674					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
2675				}
2676				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
2677				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
2678				for (var i = 0, len = $items.length; i < len; i++) {
2679					var $item = $($items[i]),
2680						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
2681						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
2682						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
2683
2684
2685					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
2686						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
2687					}
2688
2689					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
2690						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
2691					}
2692
2693					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
2694						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2695							switch (parseInt(multiplier_w[1])) {
2696								case (5):
2697								case (4):
2698								case (3):
2699									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2700									multiplier_w[1] = 6;
2701									break;
2702								case (2):
2703								case (1):
2704									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
2705									multiplier_w[1] = 3;
2706									break;
2707								default:
2708									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2709									multiplier_w[1] = 12;
2710									break;
2711							}
2712
2713							if (multiplier_w[1] == 2.4) { // 5 columns
2714								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2715								multiplier_w[1] = 6;
2716							}
2717						}
2718					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
2719						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2720							switch (parseInt(multiplier_w[1])) {
2721								case (5):
2722								case (4):
2723								case (3):
2724								case (2):
2725								case (1):
2726									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2727									multiplier_w[1] = 6;
2728									break;
2729								default:
2730									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2731									multiplier_w[1] = 12;
2732									break;
2733							}
2734
2735							if (multiplier_w[1] == 2.4) { // 5 columns
2736								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2737								multiplier_w[1] = 6;
2738							}
2739						}
2740					} else if (widthAvailable < screenSmArray[index]) {
2741						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2742							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2743							multiplier_w[1] = 12;
2744							if (typeGridArray[index]) multiplier_h[1] = 12;
2745						}
2746					}
2747					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
2748						height;
2749
2750					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
2751						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
2752						if ( widthAvailable < screenSmArray[index] ) {
2753							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
2754						}
2755					} else {
2756						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
2757					}
2758
2759					if (width >= widthAvailable) {
2760						$item.css({
2761							width: widthAvailable
2762						});
2763						if (typeGridArray[index]) {
2764							$item.children().add($item.find('.backimg')).css({
2765								height: height
2766							});
2767						}
2768					} else {
2769						$item.css({
2770							width: width
2771						});
2772						if (typeGridArray[index]) {
2773							$item.children().add($item.find('.backimg')).css({
2774								height: height
2775							});
2776						}
2777					}
2778				}
2779				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
2780					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
2781				} else {
2782					return columnWidth;
2783				}
2784			},
2785			init_isotope = function() {
2786				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
2787					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
2788						isotopeId = isotopeSystem.attr('id'),
2789						$layoutMode = layoutGridArray[i],
2790						setIsotopeFirstRowTimeOut,
2791					setIsotopeFirstRow = function(items){
2792						var firstRow = true;
2793						$(items).each(function(index, val){
2794							var el = items[index].element,
2795								el_top = items[index].position.y,
2796								$el = $(el);
2797							if ( index > 0 && el_top > 0 && firstRow ) {
2798								firstRow = false;
2799							} else if ( index == 0 && el_top == 0 ) {
2800								firstRow = true;
2801							}
2802							if ( firstRow ) {
2803								$el.removeClass('tmb-isotope-further-row');
2804							} else {
2805								$el.addClass('tmb-isotope-further-row');
2806							}
2807						});
2808					};
2809					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
2810						//resizable: true,
2811						itemSelector: $itemSelector,
2812						layoutMode: $layoutMode,
2813						transitionDuration: transitionDuration[i],
2814						masonry: {
2815							columnWidth: colWidth(i)
2816						},
2817						vertical: {
2818							horizontalAlignment: 0.5,
2819						},
2820						sortBy: 'original-order',
2821						isOriginLeft: isOriginLeft
2822					})
2823					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
2824					.on('layoutComplete', function( event, items ){
2825						if ( typeof items[0] !== 'undefined' ) {
2826							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2827								setIsotopeFirstRow(items);
2828							}
2829						}
2830					})
2831					.on('arrangeComplete', function( event, items ){
2832						if ( typeof items[0] !== 'undefined' ) {
2833							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2834								clearRequestTimeout(setIsotopeFirstRowTimeOut);
2835								setIsotopeFirstRowTimeOut = requestTimeout(function(){
2836									setIsotopeFirstRow(items);
2837								}, 100);
2838							}
2839						}
2840					});
2841					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
2842						$(isotopeContainersArray[i]).infinitescroll({
2843								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
2844								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
2845								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
2846								animate: false,
2847								behavior: 'local',
2848								debug: false,
2849								loading: {
2850									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
2851									speed: 0,
2852									finished: undefined,
2853									msg: $('#' + isotopeId + ' .loadmore-button'),
2854								},
2855								errorCallback: function() {
2856									var isotope_system = $(this).closest('.isotope-system');
2857									$('.loading-button', isotope_system).hide();
2858									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
2859								}
2860							},
2861							// append the new items to isotope on the infinitescroll callback function.
2862							function(newElements, opts) {
2863								var $isotope = $(this),
2864									isotope_system = $isotope.closest('.isotope-system'),
2865									isotopeId = isotope_system.attr('id'),
2866									filters = new Array(),
2867									$loading_button = isotope_system.find('.loading-button'),
2868									$infinite_button = isotope_system.find('.loadmore-button'),
2869									$numPages = $('a', $infinite_button).data('pages'),
2870									$woo_results,
2871									delay = 300;
2872								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
2873								$infinite_button.show();
2874								$loading_button.hide();
2875								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
2876								$('> li', $isotope).remove();
2877								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
2878								$.each($(newElements), function (index, val) {
2879									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
2880										$woo_results = $(val);
2881										delete newElements[index];
2882									} else {
2883										$(val).addClass('tmb-iso');
2884										if ($(val).is("li")) {
2885											filters.push($(val)[0]);
2886										}
2887									}
2888									$(val).addClass('uncode-appended');
2889								});
2890								newElements = newElements.filter(function(x) {
2891									return filters.indexOf(x) < 0
2892								});
2893								$.each($(filters), function(index, val) {
2894									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
2895								});
2896								if ($woo_results && $woo_results.length > 0) {
2897									var old_count = isotope_system.find('.woocommerce-result-count').text();
2898									var new_count = $woo_results.find('.woocommerce-result-count').text();
2899									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
2900									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
2901									function replaceMatch(match, p1, p2) {
2902        								return old_start + '–' + new_end;
2903									}
2904									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
2905									isotope_system.find('.woocommerce-result-count').text(new_count_text);
2906								}
2907								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
2908								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2909									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
2910									if (typeof getLightbox === 'object') {
2911										getLightbox.refresh();
2912									} else {
2913										UNCODE.lightbox();
2914									}
2915								}
2916								if ( typeof twttr !== 'undefined' )
2917									twttr.widgets.load(isotopeContainersArray[i]);
2918
2919								requestTimeout(function() {
2920									Waypoint.refreshAll();
2921									$isotope.trigger('more-items-loaded');
2922									$(window).trigger('more-items-loaded');
2923									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
2924									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
2925										$(document).trigger('uncode-scrolltrigger-refresh');
2926									}
2927								}, 1000);
2928
2929							});
2930						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
2931							var $infinite_isotope = $(isotopeContainersArray[i]),
2932								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
2933							$infinite_isotope.infinitescroll('pause');
2934							$infinite_button.on('click', function(event) {
2935								event.preventDefault();
2936								var $infinite_system = $(event.target).closest('.isotope-system'),
2937								$infinite_isotope = $infinite_system.find('.isotope-container'),
2938								isotopeId = $infinite_system.attr('id');
2939								$(event.currentTarget).html(SiteParameters.loading);
2940								$infinite_isotope.infinitescroll('resume');
2941								$infinite_isotope.infinitescroll('retrieve');
2942								$infinite_isotope.infinitescroll('pause');
2943							});
2944						}
2945					}
2946				}
2947			},
2948			onLayout = function(isotopeObj, startIndex, needsReload) {
2949				var needsReload = needsReload ? true : false;
2950
2951				if (typeof UNCODE.bigText !== 'undefined') {
2952					UNCODE.bigText();
2953				}
2954				isotopeObj.css('opacity', 1);
2955				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
2956
2957				requestTimeout(function() {
2958					if (startIndex > 0) {
2959						reloadIsotope(isotopeObj);
2960						if (SiteParameters.dynamic_srcset_active === '1') {
2961							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2962							UNCODE.adaptive_srcset(isotopeObj);
2963						}
2964						// window.dispatchEvent(UNCODE.boxEvent);
2965					} else if (needsReload) {
2966						reloadIsotope(isotopeObj);
2967					}
2968
2969					UNCODE.adaptive();
2970					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
2971						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2972					}
2973					if (typeof MediaElement === "function") {
2974						$(isotopeObj).find('audio,video').each(function() {
2975							$(this).mediaelementplayer({
2976	 							pauseOtherPlayers: false,
2977							});
2978						});
2979					}
2980					if ($(isotopeObj).find('.nested-carousel').length) {
2981						if (typeof UNCODE.carousel !== 'undefined') {
2982							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
2983						}
2984						requestTimeout(function() {
2985							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2986						}, 200);
2987					} else {
2988						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2989					}
2990					isotopeObj.trigger('isotope-layout-complete');
2991
2992				}, 100);
2993
2994			},
2995			boxAnimation = function(items, startIndex, sequential, container) {
2996				var $allItems = items.length - startIndex,
2997					showed = 0,
2998					index = 0;
2999				if (container.closest('.owl-item').length == 1) return false;
3000				$.each(items, function(index, val) {
3001					var $this = $(val),
3002						elInner = $('> .t-inside', val);
3003					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3004						return;
3005					}
3006					if (val[0]) val = val[0];
3007					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
3008						new Waypoint({
3009							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3010							element: val,
3011							handler: function() {
3012								var element = $('> .t-inside', this.element),
3013									parent = $(this.element),
3014									currentIndex = parent.index();
3015								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
3016									delayAttr = parseInt(element.attr('data-delay'));
3017								if (isNaN(delayAttr)) delayAttr = 100;
3018								delay -= showed;
3019								var objTimeout = requestTimeout(function() {
3020									element.removeClass('zoom-reverse').addClass('start_animation');
3021									showed = parent.index();
3022									if ( container.data('isotope') ) {
3023										container.isotope('layout');
3024									}
3025								}, delay * delayAttr)
3026								parent.data('objTimeout', objTimeout);
3027								if (!UNCODE.isUnmodalOpen) {
3028									this.destroy();
3029								}
3030							},
3031							offset: '100%'
3032						})
3033					} else {
3034						if (elInner.hasClass('force-anim')) {
3035							elInner.addClass('start_animation');
3036						} else {
3037							elInner.css('opacity', 1);
3038						}
3039						container.isotope('layout');
3040					}
3041
3042					index++;
3043				});
3044			},
3045			reloadIsotope = function(isotopeObj) {
3046				var isoIndex = $(isotopeObj).attr('data-iso-index');
3047				var $layoutMode = ($(isotopeObj).data('layout'));
3048				if ($layoutMode === undefined) {
3049					$layoutMode = 'masonry';
3050				}
3051				if (isotopeObj.data('isotope')) {
3052					isotopeObj.isotope({
3053						itemSelector: $itemSelector,
3054						layoutMode: $layoutMode,
3055						transitionDuration: transitionDuration[isoIndex],
3056						masonry: {
3057							columnWidth: colWidth(isoIndex)
3058						},
3059						vertical: {
3060							horizontalAlignment: 0.5,
3061						},
3062						sortBy: 'original-order',
3063						isOriginLeft: isOriginLeft
3064					});
3065				}
3066			}
3067			;
3068		if ($('.isotope-pagination').length > 0) {
3069			$('.isotope-system').on('click', '.pagination a', function(evt) {
3070				evt.preventDefault();
3071
3072				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3073					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3074						container = $(this).closest('.isotope-system'),
3075						pagination_disable_scroll = container.attr('data-pagination-scroll'),
3076						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3077					calc_scroll -= UNCODE.get_scroll_offset();
3078
3079					if ( pagination_disable_scroll !== 'disabled' ) {
3080						var menu_container = $('.menu-sticky');
3081						var menu = menu_container.find('.menu-container');
3082
3083						if (menu_container.length > 0 && menu.length > 0) {
3084							calc_scroll = calc_scroll - menu.outerHeight();
3085						}
3086
3087						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3088							delta = bodyTop - calc_scroll,
3089							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3090						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3091
3092						if (!UNCODE.isFullPage) {
3093							if (scrollSpeed == 0) {
3094								$('html, body').scrollTop(calc_scroll);
3095							} else {
3096								$('html, body').animate({
3097									scrollTop: calc_scroll
3098								}, {
3099									easing: 'easeInOutQuad',
3100									duration: scrollSpeed,
3101									complete: function () {
3102										UNCODE.scrolling = false;
3103									}
3104								});
3105							}
3106						}
3107					}
3108				}
3109
3110				loadIsotope($(this), true);
3111			});
3112		}
3113		$filters.on('click', 'a.isotope-nav-link', function(evt) {
3114			if ($(this).hasClass('no-isotope-filter')) {
3115				return;
3116			}
3117			var $filter = $(this),
3118				filterContainer = $filter.closest('.isotope-filters'),
3119				filterValue = $filter.attr('data-filter'),
3120				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
3121				transitionDuration = container.data().isotope.options.transitionDuration,
3122				delay = 300,
3123				filterItems = [];
3124
3125			var filter_items = function(){
3126				if (filterValue !== undefined) {
3127					container.addClass('grid-filtering');
3128					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3129						var parent = $(val).parent(),
3130							objTimeout = parent.data('objTimeout');
3131						if (objTimeout) {
3132							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3133							clearRequestTimeout(objTimeout);
3134						}
3135						if (transitionDuration == 0) {
3136							if ($(val).hasClass('animate_when_almost_visible')) {
3137								$(val).addClass('zoom-reverse').removeClass('start_animation');
3138							} else {
3139								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3140							}
3141						}
3142					});
3143					requestTimeout(function(){
3144						if ( filterValue == '*' ) {
3145							container.removeClass('isotope-filtered');
3146						} else {
3147							container.addClass('isotope-filtered');
3148						}
3149						container.isotope({
3150							filter: function() {
3151								var block = $(this),
3152								filterable = (filterValue == '*') || block.hasClass(filterValue),
3153								lightboxElements = $('[data-lbox^=ilightbox]', block);
3154								if (filterable) {
3155									if (lightboxElements.length) {
3156										lightboxElements.removeClass('lb-disabled');
3157										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3158									}
3159									filterItems.push(block);
3160								} else {
3161									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3162								}
3163								container.trigger('more-items-loaded');
3164								$(window).trigger('more-items-loaded');
3165								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3166								return filterable;
3167							}
3168						});
3169						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3170
3171					}, delay);
3172
3173					/** once filtered - start **/
3174					container.isotope('once', 'arrangeComplete', function() {
3175						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3176							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3177							if (typeof getLightbox === 'object') {
3178								getLightbox.refresh();
3179							} else {
3180								UNCODE.lightbox();
3181							}
3182						}
3183						if (transitionDuration == 0) {
3184							requestTimeout(function() {
3185								boxAnimation(filterItems, 0, false, container);
3186							}, 100);
3187						}
3188						requestTimeout(function() {
3189							Waypoint.refreshAll();
3190							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3191								$(document).trigger('uncode-scrolltrigger-refresh');
3192							}
3193							container.removeClass('grid-filtering');
3194						}, 2000);
3195					});
3196					/** once filtered - end **/
3197				} else {
3198					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3199						$.each(UNCODE.lightboxArray, function(index, val) {
3200							UNCODE.lightboxArray[index].destroy();
3201						});
3202					}
3203					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3204						var parent = $(val).parent(),
3205							objTimeout = parent.data('objTimeout');
3206						if (objTimeout) {
3207							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3208							clearRequestTimeout(objTimeout);
3209						}
3210						if (transitionDuration == 0) {
3211							if ($(val).hasClass('animate_when_almost_visible')) {
3212								$(val).addClass('zoom-reverse').removeClass('start_animation');
3213							} else {
3214								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3215							}
3216						}
3217					});
3218					container.parent().addClass('grid-loading');
3219					loadIsotope($filter);
3220				}
3221			};
3222
3223			if (!$filter.hasClass('active')) {
3224				/** Scroll top with filtering */
3225				if (filterContainer.hasClass('filter-scroll')) {
3226                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3227                    calc_scroll -= UNCODE.get_scroll_offset();
3228
3229					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3230						delta = bodyTop - calc_scroll,
3231						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3232						filterTolerance = false,
3233						filter_timeout;
3234					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3235
3236					if ( !UNCODE.isFullPage ) {
3237						if (scrollSpeed == 0) {
3238							$('html, body').scrollTop(calc_scroll);
3239							UNCODE.scrolling = false;
3240							filter_items();
3241						} else {
3242
3243							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3244								filter_items();
3245								filterTolerance = true;
3246							}
3247
3248							$('html, body').animate({
3249								scrollTop: calc_scroll
3250							},{
3251								easing: 'easeInOutQuad',
3252								duration: scrollSpeed,
3253								complete: function(){
3254									UNCODE.scrolling = false;
3255									if ( !filterTolerance ) {
3256										filter_timeout = setTimeout(function(){
3257											clearTimeout(filter_timeout);
3258											filter_items();
3259										}, 200);
3260									}
3261								}
3262							});
3263						}
3264					}
3265				} else {
3266					filter_items();
3267				}
3268			}
3269			evt.preventDefault();
3270		});
3271
3272		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3273			var params = UNCODE.getURLParams(window.location);
3274			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3275
3276			UNCODE.lastURL = window.location.href;
3277
3278			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
3279				return;
3280			}
3281
3282			if (params.id === undefined) {
3283				$.each($('.isotope-system'), function(index, val) {
3284					loadIsotope($(val));
3285				});
3286			} else {
3287				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3288					loadIsotope($('#' + params.id));
3289				}
3290			}
3291		});
3292
3293		var loadIsotope = function($href, $paginating) {
3294			var is_paginating = false;
3295
3296			if (undefined !== $paginating && $paginating) {
3297				var is_paginating = $paginating;
3298			}
3299
3300			var href = ($href.is("a") ? $href.attr('href') : location),
3301				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3302				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3303				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3304				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3305				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3306				isotopeId = isotopeSystem.attr('id');
3307			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3308				UNCODE.lastURL = href;
3309				history.pushState({
3310					myIsotope: true
3311				}, document.title, href);
3312			}
3313			if (is_paginating) {
3314				isotopeWrapper.addClass('grid-filtering');
3315			}
3316			$.ajax({
3317				url: href
3318			}).done(function(data) {
3319				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3320					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3321					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3322				isotopeWrapper.addClass('isotope-reloaded');
3323				requestTimeout(function() {
3324					isotopeWrapper.removeClass('grid-loading');
3325					isotopeWrapper.removeClass('isotope-reloaded');
3326					isotopeWrapper.removeClass('grid-filtering');
3327				}, 500);
3328				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3329					var parent = $(val).parent(),
3330						objTimeout = parent.data('objTimeout');
3331					if (objTimeout) {
3332						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3333						clearRequestTimeout(objTimeout);
3334					}
3335					if ($(val).hasClass('animate_when_almost_visible')) {
3336						$(val).addClass('zoom-reverse').removeClass('start_animation');
3337					} else {
3338						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3339					}
3340				});
3341				requestTimeout(function() {
3342					if (isotopeContainer.data('isotope')) {
3343						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3344						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3345						UNCODE.adaptive();
3346						if (SiteParameters.dynamic_srcset_active === '1') {
3347							UNCODE.adaptive_srcset(isotopeContainer);
3348						}
3349						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3350							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3351							if (typeof getLightbox === 'object') {
3352								getLightbox.refresh();
3353							} else {
3354								UNCODE.lightbox();
3355							}
3356						}
3357					}
3358					isotopeContainer.trigger('more-items-loaded');
3359					$(window).trigger('more-items-loaded');
3360					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3361				}, 300);
3362				$('.pagination', isotopeFooter).remove();
3363				isotopeFooter.append($resultPagination);
3364
3365				if (isotopeResultCount.length > 0) {
3366					$('.woocommerce-result-count', isotopeResultCount).remove();
3367					isotopeResultCount.append($resultCount);
3368				}
3369			});
3370		};
3371		$filters.each(function(i, buttonGroup) {
3372			var $buttonGroup = $(buttonGroup);
3373			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3374				$buttonGroup.find('.active').removeClass('active');
3375				$(this).addClass('active');
3376
3377			});
3378
3379			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3380				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3381				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3382			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3383				e.preventDefault();
3384				$cats_filters.slideToggle(400, 'easeInOutCirc');
3385			});
3386
3387		});
3388		window.addEventListener('boxResized', function(e) {
3389			if (UNCODE.printDialogOpen !== false) {
3390				return false;
3391			}
3392			$.each($('.isotope-layout'), function(index, val) {
3393				var $layoutMode = ($(this).data('layout'));
3394				if ($layoutMode === undefined) $layoutMode = 'masonry';
3395				if ($(this).data('isotope')) {
3396					$(this).isotope({
3397						itemSelector: $itemSelector,
3398						layoutMode: $layoutMode,
3399						transitionDuration: transitionDuration[index],
3400						masonry: {
3401							columnWidth: colWidth(index)
3402						},
3403						vertical: {
3404							horizontalAlignment: 0.5,
3405						},
3406						sortBy: 'original-order',
3407						isOriginLeft: isOriginLeft
3408					});
3409					$(this).isotope('unbindResize');
3410					if (SiteParameters.dynamic_srcset_active === '1') {
3411						UNCODE.refresh_dynamic_srcset_size($(this));
3412					}
3413				}
3414				$(this).find('.mejs-video,.mejs-audio').each(function() {
3415					$(this).trigger('resize');
3416				});
3417			});
3418		}, false);
3419
3420		init_isotope();
3421	};
3422}
3423
3424UNCODE.lightbox = function() {
3425	if ( SiteParameters.lbox_enhanced ) {
3426		return true;
3427	}
3428	UNCODE.lightboxArray = {};
3429	requestTimeout(function() {
3430		var groupsArr = {};
3431		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3432			var group = this.getAttribute("data-lbox"),
3433				values = $(this).data();
3434			$(this).attr('data-lbox-init','true')
3435			groupsArr[group] = values;
3436		});
3437		for (var i in groupsArr) {
3438			var skin = groupsArr[i].skin || 'black',
3439				path = groupsArr[i].dir || 'horizontal',
3440				thumbs = !groupsArr[i].notmb || false,
3441				arrows = !groupsArr[i].noarr || false,
3442				social = groupsArr[i].social || false,
3443				deeplink = groupsArr[i].deep || false,
3444				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3445				counter = $els.length,
3446				dataAlbum = $els.attr('data-album');
3447			if (social) social = {
3448				facebook: true,
3449				twitter: true,
3450				reddit: true,
3451				digg: true
3452			};
3453			UNCODE.lightboxArray[i] = $els.iLightBox({
3454				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3455				skin: skin,
3456				path: path,
3457				linkId: deeplink,
3458				infinite: false,
3459				//fullViewPort: 'fit',
3460				smartRecognition: false,
3461				fullAlone: true,
3462				maxScale: 1,
3463				minScale: .02,
3464				//fullStretchTypes: 'flash, video',
3465				overlay: {
3466					opacity: .94
3467				},
3468				controls: {
3469					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3470					fullscreen: true,
3471					thumbnail: thumbs,
3472					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3473				},
3474				show: {
3475					speed: 200
3476				},
3477				hide: {
3478					speed: 200
3479				},
3480				social: {
3481					start: false,
3482					buttons: social
3483				},
3484				caption: {
3485					start: false
3486				},
3487				styles: {
3488					nextOpacity: 1,
3489					nextScale: 1,
3490					prevOpacity: 1,
3491					prevScale: 1
3492				},
3493				effects: {
3494					switchSpeed: 400
3495				},
3496				slideshow: {
3497					pauseTime: 5000
3498				},
3499				thumbnails: {
3500					maxWidth: 60,
3501					maxHeight: 60,
3502					activeOpacity: .2
3503				},
3504				html5video: {
3505					preload: true
3506				},
3507				callback: {
3508					onOpen: function(){
3509						$(window).trigger('uncode-custom-cursor');
3510						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3511							iNoBounce.enable();
3512						}
3513					},
3514					onHide: function(){
3515						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3516							iNoBounce.disable()
3517						}
3518					},
3519				}
3520			});
3521
3522			$(document).on('infinite-loaded', function(){
3523				UNCODE.lightboxArray[i].refresh();
3524			});
3525
3526			$(window).on('gdprOpen', function(){
3527				UNCODE.lightboxArray[i].close();
3528			});
3529		};
3530	}, 100);
3531
3532	$(document).on('click', '.lb-disabled', function(e){
3533		e.preventDefault();
3534	});
3535};
3536
3537UNCODE.lightgallery = function( $el ) {
3538	var createSelectors = function(){
3539		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
3540			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3541				$(this).addClass('lbox-trigger-item');
3542			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3543				$(this).addClass('lbox-nested-item');
3544			} else {
3545				$(this).removeClass('lbox-trigger-item');
3546				$(this).removeClass('lbox-nested-item');
3547			}
3548		});
3549	};
3550
3551	createSelectors();
3552
3553	var galleries = [],
3554		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3555			return !$(this).closest('.nested-carousel').length;
3556		}),
3557		$_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 *'), 
3558		$galleries = $_galleries.filter(function( index ) {
3559			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3560		}),
3561		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3562
3563	if ( typeof $el === 'undefined' ) {
3564		$el = $galleries.add( $nested );
3565	}
3566
3567	var $disabled = $('a.lb-disabled');
3568	$disabled.on('click', function(e){
3569		e.preventDefault();
3570	});
3571
3572	var beforeSlide = function(event) {
3573		var detail = event.detail,
3574			info = detail.info,
3575			item = detail.item,
3576			$slide = $(detail.currentSlide.selector),
3577			$video = $('video', $slide),
3578			$previous = $(detail.previousSlide.selector),
3579			$prevVideo = $('video', $previous),
3580			isAudio = false;
3581
3582		if ( typeof info.src !== 'undefined' ) {
3583			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3584		}
3585
3586		if ( ! $video.length && ( info.video || isAudio ) ) {
3587			if ( info.video ) {
3588				if ( typeof info.video === 'object' ) {
3589					var infoJson = info.video;
3590				} else {
3591					var infoJson = JSON.parse(info.video);
3592				}
3593				var src = infoJson.source[0].src,
3594					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3595					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3596					loop = $(item).attr('data-loop');
3597
3598			} else if ( isAudio ) {
3599				var src = info.src,
3600					autoplay = true,
3601					loop = false;
3602			}
3603			if ( typeof src !== 'undefined' ) {
3604				$slide.addClass('has-html5');
3605				var video = document.createElement('video');
3606				video.src = src;
3607				video.preload = 'auto';
3608				video.controls = 'controls';
3609				video.controlsList = 'nodownload';
3610				if ( autoplay ) {
3611					video.autoplay = 'autoplay';
3612				}
3613				if ( muted ) {
3614					video.muted = 'muted';
3615				}
3616				if ( loop ) {
3617					video.loop = 'loop';
3618				}
3619				$(video).appendTo($slide);
3620			}
3621		} else {
3622			var $video = $('video', $slide);
3623			if ( $video.length ) {
3624				$video[0].currentTime = 0;
3625				if ( $video[0].autoplay ) {
3626					$video[0].play();
3627				}
3628			}
3629		}
3630		if ( $prevVideo.length ) {
3631			$prevVideo[0].currentTime = 0;
3632			$prevVideo[0].pause();
3633		}
3634	};
3635
3636	var beforeOpen = function(event) {
3637		var detail = event.detail,
3638			items = detail.items,
3639			galleryItems = detail.galleryItems,
3640			outer = detail.outer.selector,
3641			i, ii;
3642		for ( i = 0; i < galleryItems.length; i++ ) {
3643			var item = galleryItems[i];
3644			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
3645				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
3646			}
3647		}
3648		for ( ii = 0; ii < items.length; ii++ ) {
3649			var item = items[ii];
3650			if ( $(item).attr('data-icon') === 'video' ) {
3651				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
3652			}
3653		}
3654
3655	};
3656
3657	//caption builder
3658	var captionBuilder = function($el){
3659		$el.each( function( index, val ) {
3660			var $gallery = $(this).attr('data-lbox-init','true'),
3661				$_a = '.lbox-trigger-item',
3662				$_nested_a = '.lbox-nested-item';
3663
3664			$gallery.find($_a).add($_nested_a).each(function(){
3665				var $a = $(this),
3666					$img = $('img', $a).first(),
3667					imgw = $img.attr('data-width'),
3668					imgh = $img.attr('data-height'),
3669					caption = $a.attr('data-caption'),
3670					title = $a.attr('data-title');
3671
3672				if ( $img.length && $img.attr('data-crop') != true ) {
3673					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
3674						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
3675					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
3676						$a.attr('data-external-thumb-image', $img[0].src);
3677					}
3678				}
3679
3680				if ( typeof title !== 'undefined' && title !== '' ) {
3681					title = '<h6>' + title + '</h6>';
3682				} else {
3683					title = '';
3684				}
3685
3686				if ( typeof caption !== 'undefined' && caption !== '' ) {
3687					caption = '<p>' + caption + '</p>';
3688					title += caption;
3689				}
3690
3691				if ( title !== '' ) {
3692					$a.attr( 'title', title );
3693				}
3694
3695				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') ) ) {
3696					$a.attr('data-lg-size', imgw + '-' + imgh);
3697				}
3698			});
3699		});
3700	};
3701	captionBuilder($el);
3702
3703	//regular galleries
3704	$el.each( function( index, val ) {
3705		var $gallery = $(this),
3706			$_a = '.lbox-trigger-item',
3707			$_nested_a = '.lbox-nested-item',
3708			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
3709			galleryID = $_first.attr('data-lbox'),
3710			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
3711			tmb = $_first.attr('data-notmb'),
3712			social = $_first.attr('data-social'),
3713			deep = $_first.attr('data-deep'),
3714			zoom = $_first.attr('data-zoom-origin'),
3715			actual = $_first.attr('data-actual-size'),
3716			download = $_first.attr('data-download'),
3717			controls = $_first.attr('data-arrows') !== 'no',
3718			fullScreen = $_first.attr('data-full'),
3719			counter = $_first.attr('data-counter'),
3720			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
3721			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3722			connect = $_first.attr('data-connect'),
3723			lgPlugins = [lgVideo],
3724			itemsLoadedTimeOut;
3725
3726		if ( typeof galleryID === 'undefined' ) {
3727			galleryID = $gallery.attr('id');
3728		}
3729
3730		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3731		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3732
3733		if ( typeof tmb == 'undefined' || !tmb ) {
3734			lgPlugins.push(lgThumbnail);
3735		}
3736		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
3737			lgPlugins.push(lgZoom);
3738		}
3739		if ( typeof deep != 'undefined' && deep != '' ) {
3740			lgPlugins.push(lgHash);
3741		}
3742		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3743			lgPlugins.push(lgFullscreen);
3744		}
3745		if ( social ) {
3746			lgPlugins.push(lgShare);
3747		}
3748
3749		if ( galleries.indexOf( galleryID ) !== -1 ) {
3750			return true;
3751		}
3752
3753		galleries.push( galleryID );
3754		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
3755			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
3756		var gallery = lightGallery( $triggerGal[0], {
3757			addClass: containerClass,
3758			plugins: lgPlugins,
3759			mode: transition,
3760			selector: $selector,
3761			galleryId: galleryID,
3762			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3763			iframeWidth: '848px',
3764			iframeMaxWidth: '90%',
3765			iframeMaxHeight: '90%',
3766			exThumbImage: 'data-external-thumb-image',
3767			loadYouTubeThumbnail: false,
3768			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ),
3769			// autoplayFirstVideo: false,
3770			pager: false,
3771			startClass: 'lg-start-opacity',
3772			zoomFromOrigin: zoom,
3773			controls: controls,
3774			download: ( typeof download != 'undefined' && download != '' ),
3775			thumbWidth: 50,
3776			thumbHeight: '50px',
3777			counter: $triggerGal.find($selector).length > 1 ? counter : false,
3778			loadYouTubePoster: false,
3779			enableDrag: $triggerGal.find($selector).length > 1,
3780			mobileSettings: {
3781				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3782			},
3783		});
3784
3785		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
3786			e.preventDefault();
3787			var index = $(this).closest('.owl-item.cloned').attr('data-index');
3788			gallery.openGallery(index-1);
3789		});
3790
3791		$gallery.on('uncode-gallery-trigger', function(){
3792			gallery.openGallery(0);
3793		});
3794
3795		$triggerGal.on('more-items-loaded', function(e, items) {
3796			clearRequestTimeout(itemsLoadedTimeOut);
3797			itemsLoadedTimeOut = requestTimeout(function(){
3798				createSelectors();
3799				captionBuilder($triggerGal);
3800				gallery.refresh();
3801			}, 100);
3802		});
3803
3804		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3805			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3806				$el = model.view.$el;
3807				if ( $el.find($triggerGal).length ) {
3808					gallery.destroy();
3809				}
3810			});
3811		}
3812
3813		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
3814		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
3815		$triggerGal[0].addEventListener('lgAfterOpen', function(){
3816			$(window).trigger('uncode-custom-cursor');
3817		});
3818
3819	});
3820
3821	if ( typeof $el !== 'undefined' ) {
3822
3823		//album galleries
3824		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
3825			var album = val,
3826				galleryID = index,
3827				$album = $(album),
3828				params = $album.attr('data-album'),
3829				tmb = $(val).attr('data-notmb'),
3830				social = $(val).attr('data-social'),
3831				deep = $(val).attr('data-deep'),
3832				actual = $(val).attr('data-actual-size'),
3833				download = $(val).attr('data-download'),
3834				controls = $(val).attr('data-arrows') !== 'no',
3835				fullScreen = $(val).attr('data-full'),
3836				counter = $(val).attr('data-counter'),
3837				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
3838				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3839				lgPlugins = [lgVideo];
3840
3841			$(val).attr('data-lbox-init','true');
3842
3843			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3844			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3845
3846			if ( typeof tmb == 'undefined' || !tmb ) {
3847				lgPlugins.push(lgThumbnail);
3848			}
3849			if ( typeof actual != 'undefined' && actual != '' ) {
3850				lgPlugins.push(lgZoom);
3851			}
3852			if ( typeof deep != 'undefined' && deep != '' ) {
3853				lgPlugins.push(lgHash);
3854			}
3855			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3856				lgPlugins.push(lgFullscreen);
3857			}
3858			if ( social ) {
3859				lgPlugins.push(lgShare);
3860			}
3861
3862			var gallery = window.lightGallery(album, {
3863				dynamic: true,
3864				plugins: lgPlugins,
3865				dynamicEl: JSON.parse(params),
3866				galleryId: galleryID,
3867				addClass: containerClass,
3868				mode: transition,
3869				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3870				iframeWidth: '848px',
3871				iframeMaxWidth: '90%',
3872				iframeMaxHeight: '90%',
3873				loadYouTubeThumbnail: false,
3874				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
3875				// autoplayFirstVideo: false,
3876				pager: false,
3877				startClass: 'lg-start-opacity',
3878				zoomFromOrigin: false,
3879				controls: controls,
3880				download: ( typeof download != 'undefined' && download != '' ),
3881				thumbWidth: 50,
3882				thumbHeight: '50px',
3883				loadYouTubePoster: false,
3884				counter: counter,
3885				exThumbImage: 'data-external-thumb-image',
3886				loadYouTubePoster: false,
3887				mobileSettings: {
3888					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3889				},
3890			});
3891
3892			$album.on('click', function(){
3893				gallery.openGallery(0);
3894			});
3895
3896			album.addEventListener('lgBeforeSlide', beforeSlide);
3897			album.addEventListener('lgBeforeOpen', beforeOpen);
3898			album.addEventListener('lgAfterOpen', function(){
3899				$(window).trigger('uncode-custom-cursor');
3900			});
3901
3902			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3903				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3904					$el = model.view.$el;
3905					if ( $el.find($album).length ) {
3906						gallery.destroy();
3907					}
3908				});
3909			}
3910
3911		});
3912
3913		//single images
3914		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
3915			var gallery = lightGallery( $('.page-wrapper')[0], {
3916				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
3917				iframeWidth: '848px',
3918				iframeMaxWidth: '90%',
3919				iframeMaxHeight: '90%',
3920				loadYouTubeThumbnail: false,
3921				// autoplayFirstVideo: false,
3922				startClass: 'lg-start-opacity',
3923				thumbWidth: 50,
3924				thumbHeight: '50px',
3925				download: false,
3926				loadYouTubePoster: false,
3927				counter: false
3928			});
3929
3930			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
3931			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
3932		});
3933	}
3934
3935	var galleryButtons = function(){
3936		var $buttons = $('.btn-gallery-trigger');
3937		$buttons.each(function(key, val){
3938			var $button = $(val),
3939				target = $button.attr('data-target'),
3940				$gallery = $('.un-media-gallery').first(),
3941				$row = $button.closest('.vc_row[data-parent]');
3942			if ( typeof target !== 'undefined' && target !== '' && $('.un-media-gallery#' + target).length  ) {
3943				$gallery = $('.un-media-gallery#' + target);
3944			} else if ( $('.un-media-gallery', $row).length ) {
3945				$gallery = $('.un-media-gallery', $row).first();
3946			}
3947			
3948			$button.on('click', 'a', function(e){
3949				e.preventDefault();
3950				$gallery.find('[data-lbox-init]').first().trigger('uncode-gallery-trigger');
3951			});
3952		});
3953	};
3954	galleryButtons();
3955};
3956
3957UNCODE.carousel = function(container) {
3958	var $owlContainers = $('.owl-carousel-container', container);
3959	$owlContainers.each(function() {
3960		var $owlContainer = $(this),
3961			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
3962			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
3963			values = {},
3964			tempTimeStamp,
3965			newWidth = UNCODE.wwidth,
3966			$owlInsideEqual = [];
3967		$owlSelector.each(function() {
3968			var itemID = $(this).attr('id'),
3969				$elSelector = $(('#' + itemID).toString());
3970			values['id'] = itemID;
3971			values['items'] = 1;
3972			values['columns'] = 3;
3973			values['fade'] = false;
3974			values['nav'] = false;
3975			values['navmobile'] = false;
3976			values['navskin'] = 'light';
3977			values['navspeed'] = 400;
3978			values['dots'] = false;
3979			values['dotsmobile'] = false;
3980			values['loop'] = false;
3981			values['autoplay'] = false;
3982			values['timeout'] = 3000;
3983			values['autoheight'] = false;
3984			values['stagepadding'] = 0;
3985			values['margin'] = 0;
3986			values['lg'] = 1;
3987			values['md'] = 1;
3988			values['sm'] = 1;
3989			$.each($(this).data(), function(i, v) {
3990				values[i] = v;
3991			});
3992
3993			if ($(this).closest('.uncode-slider').length) {
3994				values['navskin'] = '';
3995				values['navmobile'] = false;
3996				//values['dotsmobile'] = true;
3997			} else {
3998				values['navskin'] = ' style-'+values['navskin']+' style-override';
3999			}
4000
4001			var setIndexActive = function(event, init){
4002				var init = typeof init === 'undefined' ? false : init,
4003					thiis = $(event.currentTarget);
4004				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
4005					var scrolltop = $(document).scrollTop(),
4006						size = event.page.size,
4007						i;
4008					var setIndex = requestTimeout(function() {
4009						for ( i = 0; i < size; i++ ) {
4010							var itemCont = event.item.index != null ? (event.item.index + i) : i;
4011							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
4012							if (thiis.closest('.row-slider').length) {
4013								if (currentItem == undefined) {
4014									currentItem = thiis.children()[i];
4015								}
4016								if ($(currentItem).closest('#page-header').length) {
4017									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4018										UNCODE.switchColorsMenu(scrolltop, 'dark');
4019									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4020										UNCODE.switchColorsMenu(scrolltop, 'light');
4021									}
4022								}
4023								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
4024								if (owlCustomNav.length) {
4025									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
4026										owlCustomNav.addClass('style-dark').removeClass('style-light');
4027									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
4028										owlCustomNav.addClass('style-light').removeClass('style-dark');
4029									}
4030								}
4031							}
4032							var itendIndex = $(currentItem).attr('data-index');
4033							if ( isNaN(itendIndex) ) {
4034								itendIndex = 1;
4035							}
4036							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
4037							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
4038							if ($.fn.counterUp) {
4039								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
4040									var $counter = $(this);
4041									$counter.addClass('started').counterUp({
4042										delay: 10,
4043										time: 1500
4044									});
4045								});
4046							}
4047						}
4048						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
4049					}, 200);
4050				}
4051				tempTimeStamp = event.timeStamp;
4052			}
4053
4054			/** Initialize */
4055			$elSelector.on('initialize.owl.carousel', function(event) {
4056				if (typeof UNCODE.owlNav !== 'undefined') {
4057					UNCODE.owlNav(itemID, event);
4058				}
4059
4060				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4061					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
4062						var shortcode = model.attributes.shortcode,
4063							$el = model.view.$el,
4064							$row_wrap = $el.closest('.row');
4065						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4066							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
4067						}
4068					});
4069					window.parent.vc.events.on('shortcodeView:updated', function(model) {
4070						var shortcode = model.attributes.shortcode;
4071						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4072							tempTimeStamp = Math.floor(Date.now() / 1000);
4073						}
4074					});
4075					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
4076						var shortcode = model.attributes.shortcode;
4077						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4078							UNCODE.owlNav(itemID, event);
4079							$elSelector.trigger('refresh.owl.carousel');
4080						}
4081					});
4082				}
4083			});
4084
4085			/** Initialized */
4086			$elSelector.on('initialized.owl.navigation', function(event) {
4087				$('.owl-dot', event.currentTarget).each(function(key, val){
4088					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4089				});
4090			});
4091
4092			$elSelector.on('initialized.owl.carousel', function(event) {
4093
4094				if ( $('.isotope-container', event.currentTarget).length ) {
4095					window.dispatchEvent(UNCODE.boxEvent);
4096				}
4097
4098				$('.owl-dot.active', $elSelector).on('click', function(){
4099					return false;
4100				});
4101
4102				var thiis = $(event.currentTarget),
4103					// get the time from the data method
4104					time = thiis.data("timer-id"),
4105					rowParent = thiis.closest('.row-parent');
4106
4107				if ( typeof rowParent[0] !== 'undefined' ) {
4108					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4109				}
4110
4111				if (time) {
4112					clearRequestTimeout(time);
4113				}
4114
4115				thiis.addClass('showControls');
4116				var new_time = requestTimeout(function() {
4117					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4118					if (thiis.hasClass('owl-height-viewport'))
4119						setItemsRelHeight(thiis);
4120					if (thiis.hasClass('owl-height-equal'))
4121						setItemsHeight(thiis);
4122					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4123					if (thiis.closest('.unequal, .unexpand').length) {
4124						UNCODE.setRowHeight(rowParent[0], true);
4125					}
4126					if (SiteParameters.dynamic_srcset_active === '1') {
4127						UNCODE.refresh_dynamic_srcset_size(thiis);
4128					}
4129				}, 350);
4130				// save the new time
4131				thiis.data("timer-id", new_time);
4132
4133				var scrolltop = $(document).scrollTop();
4134				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4135
4136				//if (!UNCODE.isMobile) {
4137					/** fix autoplay when visible **/
4138				$(window).on('load', function(){
4139					if (thiis.data('autoplay')) {
4140						if ( !thiis.closest('.sticky-element').length ) {
4141							thiis.trigger('stop.autoplay.owl');
4142						} else {
4143							thiis.trigger('play.owl.autoplay');
4144						}
4145					}
4146					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4147						return;
4148					}
4149					if ( ! thiis.closest('.sticky-element').length ) {
4150						var carouselInView = new Waypoint.Inview({
4151							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4152							element: thiis[0],
4153							exited: function() {
4154								var el = $(this.element);
4155								if (el.data('autoplay') ) {
4156									el.trigger('stop.owl.autoplay');
4157									el.data('stopped','true');
4158								}
4159							},
4160							enter: function(direction) {
4161								var el = $(this.element);
4162								requestTimeout(function() {
4163									if (el.data('autoplay')) {
4164										el.trigger('play.owl.autoplay');
4165										el.data('stopped','false');
4166									}
4167								}, 100);
4168							}
4169						});
4170					}
4171					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4172						setTimeout(function(){
4173							window.lenis.resize();
4174						}, 1000);
4175					}
4176			  	
4177				});
4178				//}
4179
4180				// $(window).on('frontend:carousel_updated', function(){
4181				// 	Waypoint.refreshAll();
4182				// });
4183
4184				if (!thiis.closest('.isotope-system').length) {
4185					requestTimeout(function() {
4186						animate_thumb($('.t-inside', el), event);
4187					}, 400);
4188				} else {
4189					requestTimeout(function() {
4190						thiis.closest('.isotope-container').isotope('layout');
4191					}, 400);
4192				}
4193
4194				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4195				currentIndex = $(currentItem).attr('data-index');
4196
4197				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4198					if ($(val).closest('.uncode-slider').length) {
4199						$(val).removeClass('start_animation');
4200					}
4201				});
4202				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4203					if ($(val).closest('.uncode-slider').length) {
4204						$(val).removeClass('already-animated');
4205					}
4206				});
4207
4208				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4209					if ($(val).closest('.uncode-slider').length) {
4210						$(val).removeAttr('data-animated');
4211					}
4212				});
4213
4214				$.each($('.owl-item.cloned', thiis), function(index, val) {
4215					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4216				});
4217
4218				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4219					if ($(val).attr('data-index') != currentIndex) {
4220						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4221						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4222					}
4223					if ($(val).attr('data-index') != currentIndex) {
4224						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4225					}
4226					if ($(val).attr('data-index') == currentIndex) {
4227						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4228					}
4229				});
4230
4231				if (thiis.closest('.uncode-slider').length) {
4232					var el = thiis.closest('.row-parent')[0],
4233						section = thiis.closest('.vc_section');
4234					if ( section.length ) {
4235						el = $('> .row-parent', section)[0];
4236					}
4237					if ($(el).data('imgready')) {
4238						firstLoaded(el, event);
4239					} else {
4240						el.addEventListener("imgLoaded", function(el) {
4241							firstLoaded(el.target, event);
4242						}, false);
4243					}
4244					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4245					if (transHeight != null) {
4246						requestTimeout(function() {
4247							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4248						}, 100);
4249					}
4250				} else {
4251					var el = thiis;
4252					el.closest('.uncode-slider').addClass('slider-loaded');
4253				}
4254
4255				requestTimeout(function() {
4256					if (typeof UNCODE.bigText !== 'undefined') {
4257						UNCODE.bigText(thiis);
4258					}
4259					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4260						if (thiis.data('autoplay')) pauseOnHover(thiis);
4261					}
4262				}, 500);
4263
4264				if (thiis.closest('.unequal').length) {
4265					$owlInsideEqual.push(thiis.closest('.row-parent'));
4266				}
4267
4268				var containerClasses = '',
4269					containerStyle = '';
4270				if ( $('.owl-dots-classes', $owlContainer).length ) {
4271					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4272					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4273					$('.owl-dots-classes', $owlContainer).remove();
4274				}
4275
4276				if ( containerClasses !== '' ) {
4277					requestTimeout(function() {
4278						if ( containerClasses !== '' )
4279							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4280						if ( containerStyle !== '' )
4281							$('.owl-dots', $owlContainer).addClass(containerClasses);
4282					}, 100);
4283				}
4284
4285				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4286					$(val).closest('.row-inner').css({
4287						'margin-top': '-1px'
4288					});
4289				});
4290
4291				if ($.fn.isotope) {
4292					if ( thiis.closest('.isotope-container').length ) {
4293						if (thiis.closest('.isotope-container').data('isotope')) {
4294							requestTimeout(function(){
4295								thiis.closest('.isotope-container').isotope('layout');
4296							}, 300);
4297						}
4298						$(window).on('load', function(){
4299							if (thiis.closest('.isotope-container').data('isotope')) {
4300								thiis.closest('.isotope-container').isotope('layout');
4301							}
4302						});
4303					}
4304				}
4305
4306				if (thiis.data('autoplay')) {
4307					$(window).on('menuOpen', function(){
4308						thiis.trigger('stop.owl.autoplay');
4309						thiis.data('stopped','true');
4310					}).on('menuClose', function(){
4311
4312					});
4313				}
4314				$(window).on('menuClose', function(){
4315					if (thiis.data('autoplay')) {
4316						thiis.trigger('play.owl.autoplay');
4317						thiis.data('stopped','false');
4318					}
4319				});
4320
4321				setIndexActive(event, true);
4322
4323				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4324						return !$(this).closest('.nested-carousel').length;
4325					}),
4326					$_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),
4327					$galleries = $_galleries.filter(function( index ) {
4328						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4329					});
4330
4331				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4332					UNCODE.lightgallery( $galleries );
4333				}
4334
4335				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4336					$(document).trigger('uncode-scrolltrigger-refresh');
4337				}
4338			});
4339
4340			$elSelector.on('resized.owl.carousel', function(event) {
4341				$('.owl-dot', event.currentTarget).each(function(key, val){
4342					$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4343				});
4344			});
4345
4346			$elSelector.on('resized.owl.carousel', function(event) {
4347				var thiis = $(event.currentTarget);
4348				// if ($(this).closest('.nested-carousel').length) {
4349				// 	requestTimeout(function() {
4350				// 		window.dispatchEvent(UNCODE.boxEvent);
4351				// 	}, 200);
4352				// }
4353				if ( thiis.hasClass('owl-height-equal') )
4354					setItemsHeight(thiis);
4355
4356				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4357					newWidth = UNCODE.wwidth;
4358					setItemsRelHeight($elSelector);
4359				}
4360
4361				setIndexActive(event);
4362
4363				if (SiteParameters.dynamic_srcset_active === '1') {
4364					UNCODE.refresh_dynamic_srcset_size(thiis);
4365				}
4366
4367				if ($.fn.isotope) {
4368					$(window).on('load', function(){
4369						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4370							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4371						}
4372					});
4373				}
4374
4375				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4376					setTimeout(function(){
4377						window.lenis.resize();
4378					}, 1000);
4379				}
4380				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4381					$(document).trigger('uncode-scrolltrigger-refresh');
4382				}
4383			});
4384
4385			$elSelector.on('refreshed.owl.carousel', function(event) {
4386				setIndexActive(event);
4387			});
4388
4389			/** detect resize window for fluid height layout */
4390			var setFluidResize;
4391			function manageFluidCarouseHeight() {
4392				clearRequestTimeout(setFluidResize);
4393				setFluidResize = requestTimeout(function(){
4394					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4395						newWidth = UNCODE.wwidth;
4396						setItemsRelHeight($elSelector);
4397					}
4398				}, 100);
4399			}
4400			window.addEventListener('resize', manageFluidCarouseHeight);
4401
4402			/** Change */
4403			$elSelector.on('change.owl.carousel', function(event) {
4404				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4405			});
4406
4407			/** Changed */
4408			$elSelector.on('changed.owl.carousel', function(event) {
4409				var $row = $elSelector.parents('.row')[0];
4410				if ( typeof $row !== 'undefined' ) {
4411					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4412				}
4413				setIndexActive(event);
4414			});
4415
4416			var checkDrag = function(e) {
4417				$elSelector.addClass('owl-dragging');
4418			};
4419			$elSelector.on('drag.owl.carousel', function(event) {
4420				document.addEventListener("mousemove", checkDrag);
4421			});
4422
4423			$elSelector.on('dragged.owl.carousel', function(event) {
4424				$elSelector.removeClass('owl-dragging');
4425				document.removeEventListener("mousemove", checkDrag);
4426			});
4427
4428			$elSelector.on('translate.owl.carousel', function(event) {
4429				if (UNCODE.isMobile) {
4430					$(event.currentTarget).addClass('owl-translating');
4431				}
4432			});
4433
4434			/** Translated */
4435			$elSelector.on('translated.owl.carousel', function(event) {
4436
4437				var thiis = $(event.currentTarget),
4438					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4439					currentIndex = $(currentItem).attr('data-index'),
4440					stagePadding = thiis.data('stagepadding');
4441
4442				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4443
4444				if (!UNCODE.isMobile) {
4445					UNCODE.owlPlayVideo(thiis);
4446				}
4447
4448				requestTimeout(function(){
4449					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4450					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4451					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4452						if (lastDelayElems == undefined) lastDelayElems = 0;
4453						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4454						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4455						thiis.trigger('stop.owl.autoplay');
4456						requestTimeout(function() {
4457							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4458						}, maxDelay);
4459					}
4460				}, 200);
4461
4462				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4463					if ($(val).closest('.uncode-slider').length) {
4464						$(val).removeClass('start_animation');
4465					}
4466				});
4467
4468				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4469					if ($(val).closest('.uncode-slider').length) {
4470						$(val).removeClass('already-animated');
4471					}
4472				});
4473
4474				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4475					if ($(val).closest('.uncode-slider').length) {
4476						$(val).removeAttr('data-animated');
4477					}
4478				});
4479
4480				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4481					if ($(val).attr('data-index') != currentIndex) {
4482						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4483						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4484					}
4485					if ($(val).attr('data-index') != currentIndex) {
4486						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4487					}
4488					if ($(val).attr('data-index') == currentIndex) {
4489						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4490					}
4491				});
4492
4493				if (UNCODE.isMobile) {
4494					thiis.removeClass('owl-translating');
4495				}
4496
4497				setIndexActive(event);
4498			});
4499
4500			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4501
4502			/** Init carousel */
4503			$elSelector.not('.showControls').owlCarousel({
4504				items: values['items'],
4505				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4506				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4507				nav: values['nav'],
4508				dots: values['dots'],
4509				loop: values['loop'],
4510				stagePadding: values['stagepadding'],
4511				margin: 0,
4512				video: true,
4513				autoWidth: false,
4514				autoplay: false,
4515				autoplayTimeout: values['timeout'],
4516				autoplaySpeed: values['navspeed'],
4517				autoplayHoverPause: $(this).closest('.uncode-slider').length || $(this).closest('.carousel-no-hover').length ? false : true,
4518				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4519				itemSelector: SiteParameters.uncode_carousel_itemSelector,
4520				rtl: $('body').hasClass('rtl') ? true : false,
4521				fluidSpeed: true,
4522				navSpeed: values['navspeed'],
4523				dotsSpeed: values['navspeed'] / values['items'],
4524				navElement: ['button type="button" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" aria-label="' + SiteParameters.uncode_next_label + '"'],
4525				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4526				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>'],
4527				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4528				responsiveClass: true,
4529				responsiveBaseElement: '.box-container',
4530				responsive: {
4531					0: {
4532						items: values['sm'],
4533						nav: values['navmobile'],
4534						dots: values['dotsmobile'],
4535						dotsSpeed: values['navspeed'] / values['sm'],
4536					},
4537					480: {
4538						items: values['sm'],
4539						nav: values['navmobile'],
4540						dots: values['dotsmobile'],
4541						dotsSpeed: values['navspeed'] / values['sm'],
4542					},
4543					570: {
4544						items: values['md'],
4545						nav: values['navmobile'],
4546						dots: values['dotsmobile'],
4547						dotsSpeed: values['navspeed'] / values['md'],
4548					},
4549					960: {
4550						items: values['lg'],
4551						dotsSpeed: values['navspeed'] / values['lg'],
4552					}
4553				}
4554			});
4555
4556			var transDuration = parseFloat(values['navspeed']) * 0.3;
4557			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
4558
4559			$('.owl-item .tmb', $elSelector).css({
4560				'-webkit-transition-delay': transDuration + 'ms',
4561				'-moz-transition-delay': transDuration + 'ms',
4562				'-o-transition-delay': transDuration + 'ms',
4563				'transition-delay': transDuration + 'ms',
4564				'-webkit-transition-duration': transDuration2 + 'ms',
4565				'-moz-transition-duration': transDuration2 + 'ms',
4566				'-o-transition-duration': transDuration2 + 'ms',
4567				'transition-duration': transDuration2 + 'ms',
4568			});
4569
4570			requestTimeout(function() {
4571				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4572					UNCODE.setRowHeight($owlInsideEqual[i]);
4573				};
4574			}, 300);
4575
4576			$(window).on('load', function(){
4577				var $elCarousel = $elSelector.data('owl.carousel');
4578				if ( typeof $elCarousel !== 'undefined' ) {
4579					$elCarousel.trigger('refreshed');
4580					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4581						UNCODE.setRowHeight($owlInsideEqual[i]);
4582					};
4583				}
4584			});
4585
4586			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
4587				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4588					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
4589					$('#' + carousel_id).find('.owl-item').each( function() {
4590						var $item = $(this),
4591							index = ( $item.index() + 1 );
4592						$item.attr('data-index', index);
4593					});
4594				}
4595			});
4596
4597			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4598				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
4599					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4600						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
4601						$('#' + carousel_id).find('.owl-item').each( function() {
4602							var $item = $(this),
4603								index = ( $item.index() + 1 );
4604							$item.attr('data-index', index);
4605						});
4606					}
4607				});
4608			}
4609
4610		});
4611
4612		function firstLoaded(el, event) {
4613			var el = $(el),
4614			uncode_slider = el.find('.uncode-slider');
4615			el.find('.owl-carousel').css('opacity', 1);
4616			uncode_slider.addClass('slider-loaded');
4617			if (typeof UNCODE.bigText !== 'undefined') {
4618				UNCODE.bigText(el.find('.owl-item.active'));
4619			}
4620			//if (!UNCODE.isMobile) {
4621				requestTimeout(function() {
4622					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
4623					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
4624					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
4625						if (lastDelayElems == undefined) lastDelayElems = 0;
4626						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4627						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4628						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
4629						requestTimeout(function() {
4630							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
4631						}, maxDelay);
4632					}
4633				}, 500);
4634
4635			//}
4636		}
4637
4638		function navHover(el) {
4639			var $owlCont = el,
4640				$owlPrev = $owlCont.find('.owl-prev'),
4641				$owlNext = $owlCont.find('.owl-next'),
4642				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
4643				$owlPagination = $owlCont.next(),
4644				owlPrevW = $owlPrev.outerWidth(),
4645				owlNextW = $owlNext.outerWidth(),
4646				owlDotsH = $owlDots.innerHeight(),
4647				owlTime = 400,
4648				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4649			if ( $('body').hasClass('rtl') ) {
4650				$owlPrev.css("margin-right", -owlPrevW);
4651				$owlNext.css("margin-left", -owlNextW);
4652			} else {
4653				$owlPrev.css("margin-left", -owlPrevW);
4654				$owlNext.css("margin-right", -owlNextW);
4655			}
4656			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
4657			$owlCont.mouseenter(function() {
4658				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4659				$owlPrev.add($owlNext).css({
4660					marginLeft: 0,
4661					marginRight: 0
4662				});
4663				if (!owlNested) {
4664					$owlDots.css({
4665						opacity: 1,
4666						bottom: 0
4667					});
4668				}
4669			}).mouseleave(function() {
4670				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4671				if ( $('body').hasClass('rtl') ) {
4672					$owlPrev.css("margin-right", -owlPrevW);
4673					$owlNext.css("margin-left", -owlNextW);
4674				} else {
4675					$owlPrev.css("margin-left", -owlPrevW);
4676					$owlNext.css("margin-right", -owlNextW);
4677				}
4678				if (!owlNested) {
4679					$owlDots.css({
4680						opacity: 1,
4681						bottom: -owlDotsH
4682					});
4683				}
4684			});
4685		};
4686
4687		function animate_elems($this) {
4688			var lastDelay;
4689			$.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) {
4690				var element = $(val),
4691					delayAttr = element.attr('data-delay'),
4692					$first_item = element.closest('.owl-item[data-index="1"]');
4693
4694				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
4695					return false;
4696				}
4697
4698				if (delayAttr == undefined) delayAttr = 0;
4699				requestTimeout(function() {
4700					element.addClass('start_animation');
4701				}, delayAttr);
4702				lastDelay = delayAttr;
4703			});
4704			return lastDelay;
4705		}
4706
4707		function animate_thumb(items, event) {
4708			var lastDelay,
4709				itemIndex,
4710				thiis = $(event.currentTarget),
4711				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
4712				numActives = $('.owl-item.active', thiis).length,
4713				stagePadding = thiis.data('stagepadding');
4714
4715			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4716
4717			thiis.data('tempIndex', event.item.index);
4718				$.each(items, function(index, val) {
4719					var parent = $(val).closest('.owl-item');
4720					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4721						return;
4722					}
4723					if (!$(val).hasClass('start_animation')) {
4724						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
4725							var thumbInView = new Waypoint.Inview({
4726							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4727							  element: val,
4728							  enter: function(direction) {
4729								var element = $(this.element),
4730										delayAttr = parseInt(element.attr('data-delay')),
4731										itemIndex = element.closest('.owl-item').index() + 1,
4732										diffItem = Math.abs(itemIndex - tempIndex) - 1;
4733									if (itemIndex > tempIndex) {
4734										thiis.data('tempIndex', itemIndex);
4735									}
4736									if (isNaN(delayAttr)) delayAttr = 100;
4737									if (stagePadding) {
4738										var objTimeout = requestTimeout(function() {
4739											element.addClass('start_animation');
4740										}, index * delayAttr);
4741										lastDelay = index * delayAttr;
4742									} else {
4743										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
4744										var objTimeout = requestTimeout(function() {
4745											element.addClass('start_animation');
4746										}, diffItem * delayAttr);
4747										lastDelay = diffItem * delayAttr;
4748									}
4749									parent.data('objTimeout', objTimeout);
4750									if (!UNCODE.isUnmodalOpen) {
4751										this.destroy();
4752									}
4753								}
4754							});
4755						}
4756					}
4757				});
4758				return lastDelay;
4759			}
4760
4761		function setItemsHeight(item) {
4762			$.each($('.owl-item', item), function(index, val) {
4763				var availableThumbHeight = $('.t-inside', $(val)).height(),
4764				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
4765				difference = availableThumbHeight - innerThumbHeight;
4766				if ($('.tmb-content-under', val).length) {
4767					var visualPart = $('.t-entry-visual', val);
4768					if (visualPart.length) {
4769						difference -= $('.t-entry-visual', val).height();
4770					}
4771				}
4772				if (! $('.tmb-content-lateral', val).length)
4773					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
4774			});
4775		}
4776
4777		function setItemsRelHeight(item) {
4778			$.each($('.owl-item', item), function(index, val) {
4779				var $rowContainer = $(item).parents('.row-parent').eq(0),
4780					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
4781					$colContainer = $(item).parents('.uncell').eq(0),
4782					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
4783					winHeight = UNCODE.wheight,
4784					multiplier_h = parseInt($(item).attr('data-vp-height')),
4785					data_viewport_h,
4786					consider_menu = $(item).data('vp-menu');
4787
4788				if ( consider_menu ) {
4789					winHeight = winHeight - UNCODE.menuHeight;
4790				}
4791
4792				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
4793				$('.t-inside', val).css( 'height', data_viewport_h );
4794			});
4795		}
4796
4797		function pauseOnHover(slider) {
4798			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
4799			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
4800				mouseenter: function () {
4801					$(slider).addClass('owl-mouseenter');
4802					$(slider).trigger('stop.owl.autoplay');
4803				},
4804				mouseleave: function () {
4805					$(slider).removeClass('owl-mouseenter');
4806					$(slider).trigger('play.owl.autoplay');
4807				}
4808			});
4809		}
4810	});
4811};
4812
4813UNCODE.owlPlayVideo = function(carousel) {
4814	var player, iframe;
4815	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
4816		var content = $(val).html();
4817		if (content == '') {
4818			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
4819			$(val).append(getCloned);
4820		}
4821		if ($(this).attr('data-provider') == 'vimeo') {
4822			iframe = $(this).find('iframe');
4823			player = new Vimeo.Player(iframe[0]);
4824			player.play();
4825		} else if ($(this).attr('data-provider') == 'youtube') {
4826			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
4827		} else {
4828			var player = $(this).find('video');
4829			if (player.length) {
4830				$(this).find('video')[0].volume = 0;
4831				$(this).find('video')[0].play();
4832				$(val).css('opacity', 1);
4833			}
4834		}
4835	});
4836};
4837
4838UNCODE.owlStopVideo = function(carousel) {
4839	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
4840		var player, iframe;
4841		if ($(this).attr('data-provider') == 'vimeo') {
4842			iframe = $(this).find('iframe');
4843			player = new Vimeo.Player(iframe[0]);
4844			player.pause();
4845		} else if ($(this).attr('data-provider') == 'youtube') {
4846			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
4847		} else {
4848			var player = $(this).find('video');
4849			if (player.length) {
4850				$(this).find('video')[0].volume = 0;
4851				$(this).find('video')[0].play();
4852			}
4853		}
4854	});
4855};
4856
4857UNCODE.animations = function() {
4858
4859	var runWaypoints_TO,
4860		runWaypoints_carousel_TO,
4861		runWaypoints_delay = 0,
4862	highlightComplexFunc = function($wrap, ev){
4863
4864		var $lines = $('.heading-line-wrap', $wrap),
4865			not_animate = false;
4866
4867		if ( $wrap.data('animate') === true ) {
4868			not_animate = true;
4869		}
4870
4871		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
4872		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
4873			return;
4874		}
4875
4876		$lines.each(function(_key, _value){
4877			var $line = $(_value),
4878				$inners = $('.split-word-inner', $line),
4879				$highlights = $('.heading-text-highlight-inner', $line);
4880
4881			var highlitInnerFunc = function(ev){
4882				var delay = 0;
4883				$highlights.each(function(h_key, high){
4884					var $highlight = $(high),
4885						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
4886						$nextSplit = $split.nextUntil(),
4887						$next = $('.heading-text-highlight-inner', $nextSplit),
4888						countCh = $split.text().length;
4889
4890					$highlight.css({
4891						'-webkit-transition-duration': (30 * countCh) + 'ms',
4892						'-moz-transition-duration': (30 * countCh) + 'ms',
4893						'-o-transition-duration': (30 * countCh) + 'ms',
4894						'transition-duration': (30 * countCh) + 'ms',
4895					});
4896
4897					delay += (30 * countCh);
4898
4899					$next.css({
4900						'-webkit-transition-delay': delay + 'ms',
4901						'-moz-transition-delay': delay + 'ms',
4902						'-o-transition-delay': delay + 'ms',
4903						'transition-delay': delay + 'ms',
4904					});
4905				});
4906				$highlights.removeAttr('data-animated');
4907				if ( _key+1 === $lines.length ) {
4908					$wrap.data('animate', true);
4909				}
4910			};
4911
4912			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
4913				if ( not_animate ) {
4914					$highlights.each(function(h_key, high){
4915						var $highlight = $(high);
4916						$highlight.css({
4917							'-webkit-transition-duration': '0ms',
4918							'-moz-transition-duration': '0ms',
4919							'-o-transition-duration': '0ms',
4920							'transition-duration': '0ms',
4921						});
4922					});
4923					$highlights.removeAttr('data-animated');
4924				} else {
4925					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
4926						highlitInnerFunc();
4927					} else {
4928						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
4929					}
4930				}
4931			}
4932		});
4933	};
4934
4935	$.each($('.header-content-inner'), function(index, val) {
4936		var element = $(val),
4937			transition = '';
4938		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
4939		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
4940		if (element.hasClass('left-t-right')) transition = 'left-t-right';
4941		if (element.hasClass('right-t-left')) transition = 'right-t-left';
4942		if (element.hasClass('zoom-in')) transition = 'zoom-in';
4943		if (element.hasClass('zoom-out')) transition = 'zoom-out';
4944		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
4945		if (transition != '') {
4946			$(val).removeClass(transition);
4947			var container = element,
4948				containerDelay = container.attr('data-delay'),
4949				containerSpeed = container.attr('data-speed'),
4950				items = $('.header-title > *, .post-info', container);
4951			$.each(items, function(index, val) {
4952				var element = $(val),
4953					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
4954					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
4955				if (!element.hasClass('animate_when_almost_visible')) {
4956					delayAttr = Number(delayAttr) + (400 * index);
4957					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
4958					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
4959				}
4960			});
4961			container.css('opacity', 1);
4962		}
4963	});
4964
4965	function animate_css_grids_on_load() {
4966		$('.cssgrid-system').each(function() {
4967			var grid = $(this);
4968			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
4969			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
4970		});
4971	}
4972
4973	var delayAdd = 0;
4974
4975	window.waypoint_animation = function(ev) {
4976		$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-linear .animate_when_almost_visible:not(.start_animation), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
4977			if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length || $(val).closest('.tab-pane:not(.active)').length || $(val).closest('.panel:not(.active-group)').length ) && !SiteParameters.is_frontend_editor ) ) {
4978				return true;
4979			}
4980			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4981				return;
4982			}
4983			var run = true,
4984				$carousel = $(val).closest('.owl-carousel'),
4985				marquee = $(val).closest('.tmb-linear').length;
4986			if ( $carousel.length ) {
4987				run = false;
4988			}
4989			if (run) {
4990				new Waypoint({
4991					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4992					element: val,
4993					handler: function() {
4994						var element = $(this.element),
4995							index = element.index(),
4996							delayAttr = element.attr('data-delay');
4997						if (delayAttr == undefined) delayAttr = 0;
4998						// delayAttr = parseFloat(delayAttr) + delayAdd;
4999						// if ( marquee ) {
5000						// 	delayAdd += 50;
5001						// } else {
5002						// 	delayAdd = 0;
5003						// }
5004						requestTimeout(function() {
5005							element.addClass('start_animation');
5006						}, delayAttr);
5007						if (!UNCODE.isUnmodalOpen) {
5008							this.destroy();
5009						}
5010					},
5011					offset: UNCODE.isFullPage ? '100%' : '90%'
5012				});
5013			}
5014		});
5015		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
5016			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5017				return;
5018			}
5019			var run = true,
5020				$carousel = $(val).closest('.owl-carousel');
5021			if ( $carousel.length ) {
5022				run = false;
5023			}
5024			if (run) {
5025				new Waypoint({
5026					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5027					element: val,
5028					handler: function() {
5029						var $element = $(this.element),
5030							$childs = $('.animate_when_parent_almost_visible', $element);
5031						$childs.each(function(key,el){
5032							var $child = $(el),
5033								delaySpeed = $child.attr('data-speed'),
5034								delayAttr = $child.attr('data-delay'),
5035								intervalAttr = $child.attr('data-interval');
5036							if (delayAttr == undefined) {
5037								delayAttr = 50*key;
5038							}
5039							requestTimeout(function() {
5040								$child.addClass('start_animation');
5041								if ( $child.hasClass('anim-line-checker') ) {
5042									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5043										var $line = $child.closest('.heading-line-wrap');
5044									});
5045								}
5046								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5047								highlightComplexFunc($wrapText, ev);
5048								if ( $child.hasClass('anim-tot-checker') ) {
5049									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5050										if ( $child.hasClass('anim-tot-checker') ) {
5051											$wrapText.addClass('already-animated');
5052											$element.trigger('already-animated');
5053										}
5054									});
5055								}
5056							}, delayAttr );
5057						});
5058						$element.addClass('start_animation');
5059						if (!UNCODE.isUnmodalOpen) {
5060							this.destroy();
5061						}
5062					},
5063					offset: UNCODE.isFullPage ? '100%' : '90%'
5064				});
5065			}
5066		});
5067	}
5068	window.waypoint_carousel_animation = function(ev) {
5069		$.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) {
5070			if ( $(val).hasClass('el-text-split') ) {
5071				return true;
5072			}
5073			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5074				return;
5075			}
5076			var run = true,
5077				$carousel = $(val).closest('.owl-carousel'),
5078				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5079				$all_first = $('.owl-item[data-index="1"]', $carousel);
5080			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5081				run = false;
5082			}
5083			if (run) {
5084				new Waypoint({
5085					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5086					element: val,
5087					handler: function() {
5088						var element = $(this.element),
5089							index = element.index(),
5090							delayAttr = element.attr('data-delay');
5091						if (delayAttr == undefined) delayAttr = 0;
5092						requestTimeout(function() {
5093							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5094								$all_first.attr('data-already-reached', 'true');
5095							}
5096							element.addClass('start_animation');
5097						}, delayAttr);
5098						if (!UNCODE.isUnmodalOpen) {
5099							this.destroy();
5100						}
5101					},
5102					offset: UNCODE.isFullPage ? '100%' : '90%'
5103				});
5104			}
5105		});
5106		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
5107			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5108				return;
5109			}
5110			var run = true,
5111				$carousel = $(val).closest('.owl-carousel'),
5112				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5113				$all_first = $('.owl-item[data-index="1"]', $carousel);
5114			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5115				run = false;
5116			}
5117			if (run) {
5118				new Waypoint({
5119					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5120					element: val,
5121					handler: function() {
5122						var $element = $(this.element),
5123							$childs = $('.animate_when_parent_almost_visible', $element);
5124						$childs.each(function(key,el){
5125							var $child = $(el),
5126								delaySpeed = $child.attr('data-speed'),
5127								delayAttr = $child.attr('data-delay'),
5128								intervalAttr = $child.attr('data-interval');
5129							if (delayAttr == undefined) {
5130								delayAttr = 50*key;
5131							}
5132							requestTimeout(function() {
5133								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5134									$all_first.attr('data-already-reached', 'true');
5135								}
5136								$child.addClass('start_animation');
5137								if ( $child.hasClass('anim-line-checker') ) {
5138									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5139										var $line = $child.closest('.heading-line-wrap');
5140									});
5141								}
5142								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5143								highlightComplexFunc($wrapText, ev);
5144								if ( $child.hasClass('anim-tot-checker') ) {
5145									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5146										if ( $child.hasClass('anim-tot-checker') ) {
5147											$wrapText.addClass('already-animated');
5148										}
5149									});
5150								}
5151							}, delayAttr );
5152						});
5153						$element.addClass('start_animation');
5154						if (!UNCODE.isUnmodalOpen) {
5155							this.destroy();
5156						}
5157					},
5158					offset: UNCODE.isFullPage ? '100%' : '90%'
5159				});
5160			}
5161		});
5162	}
5163
5164	var runWaypoints = function(ev){
5165		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5166			runWaypoints_delay = 400;
5167		}
5168		clearRequestTimeout(runWaypoints_TO);
5169		runWaypoints_TO = requestTimeout(function() {
5170			window.waypoint_animation(ev);
5171		}, runWaypoints_delay);
5172
5173		clearRequestTimeout(runWaypoints_carousel_TO);
5174		runWaypoints_carousel_TO = requestTimeout(function() {
5175			window.waypoint_carousel_animation(ev);
5176		}, 400);
5177	};
5178	runWaypoints();
5179	animate_css_grids_on_load();
5180
5181	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5182		runWaypoints(ev);
5183	});
5184	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5185		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5186		window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints );
5187	}
5188};
5189
5190UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5191	var $allItems = elements.length - startIndex,
5192		showed = 0,
5193		index = 0,
5194		use_index = false
5195		;
5196
5197	if (filtering) {
5198		if (sequential) {
5199			use_index = true;
5200		}
5201		sequential = false;
5202	}
5203
5204	$.each(elements, function(index, val) {
5205		var $this = $(val),
5206			elInner = $('> .t-inside', val);
5207
5208		if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5209			return;
5210		}
5211		if (val[0]) val = val[0];
5212
5213		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5214			new Waypoint({
5215				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5216				element: val,
5217				handler: function() {
5218					var element = $('> .t-inside', this.element),
5219						parent = $(this.element);
5220					var _index = use_index? index : 0;
5221
5222					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5223						delayAttr = parseInt(element.attr('data-delay'));
5224					if (isNaN(delayAttr)) delayAttr = 100;
5225					if (sequential || use_index) {
5226						delay -= showed;
5227					}
5228					var objTimeout = requestTimeout(function() {
5229						element.removeClass('zoom-reverse').addClass('start_animation');
5230						showed = index;
5231					}, delay * delayAttr);
5232					parent.data('objTimeout', objTimeout);
5233					if (!UNCODE.isUnmodalOpen) {
5234						this.destroy();
5235					}
5236				},
5237				offset: UNCODE.isFullPage ? '100%' : '90%'
5238			});
5239		}
5240
5241		index++;
5242	});
5243};
5244
5245UNCODE.tapHover = function() {
5246
5247	var isTouch = (
5248		'ontouchstart' in window ||
5249		navigator.maxTouchPoints > 0 ||
5250		navigator.msMaxTouchPoints > 0
5251	);
5252
5253	if (isTouch) {
5254		var $el = $('.tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), 
5255			elClass = "hover";
5256
5257		$(window).on('click', function() {
5258			$el.removeClass(elClass);
5259		});
5260
5261		$el.on('click', function(e) {
5262			e.stopPropagation();
5263			var link = $(this);
5264			if ( ! link.hasClass(elClass)) {
5265				e.preventDefault();
5266				link.addClass("hover");
5267				$el.not(this).removeClass(elClass);
5268				return false;
5269			}
5270		});
5271	}
5272};
5273
5274UNCODE.onePage = function(isMobile) {
5275	var current = 0,
5276		last = 0,
5277		lastScrollTop = 0,
5278		forceScroll = false,
5279		lastScrolled = 0,
5280		isSectionscroller = ($('.main-onepage').length) ? true : false,
5281		isOnePage = false,
5282		getOffset = function () {
5283			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);
5284			return calculateOffset;
5285		}
5286
5287	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5288
5289	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5290	// 	return false;
5291
5292	function init_onepage() {
5293		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5294			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5295		}
5296		last = $('.onepage-pagination li').last().find('a').data('index');
5297		$.each($('div[data-parent="true"]'), function(index, val) {
5298			$(this).attr('data-section', index);
5299			if (isMobile) return;
5300			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5301				return;
5302			}
5303			var sectionDown = new Waypoint({
5304				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5305				element: val,
5306				handler: function(direction) {
5307					if (direction == 'down') {
5308						changeMenuActive(this.element, index);
5309					}
5310				},
5311				offset: function() {
5312					return 5 + getOffset()
5313				}
5314			});
5315			var sectionUp = new Waypoint({
5316				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5317				element: val,
5318				handler: function(direction) {
5319					if (direction == 'up') {
5320						changeMenuActive(this.element, index);
5321					}
5322				},
5323				offset: function() {
5324					return -5 - getOffset()
5325				}
5326			});
5327
5328			if (isSectionscroller) {
5329				var label;
5330				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5331				else label = '';
5332				var getName = $(this).attr('data-name');
5333				if (getName == undefined) getName = index;
5334				if (label != '') {
5335					isOnePage = true;
5336					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5337					$('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>");
5338				}
5339			}
5340		});
5341
5342		if (isSectionscroller) {
5343			$.each($('ul.onepage-pagination li'), function(index, val) {
5344				var $this = $(val),
5345					$a = ('a', $this);
5346				$a.on('click', function(evt) {
5347					if ( $('.is-selected', $this).length || UNCODE.scrolling ) {
5348						return false;
5349					}
5350					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5351						evt.preventDefault();
5352					}
5353					Waypoint.refreshAll();
5354					var el = $('a', evt.currentTarget);
5355					current = lastScrolled = parseInt(el.attr('data-index'));
5356					lastScrolled += 1;
5357					scrollBody(current);
5358				});
5359			});
5360		}
5361
5362		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5363		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5364			goToSection = String(window.location.hash).replace(/^#/, "");
5365			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5366		}
5367
5368		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5369			current = lastScrolled = goToSection;
5370			$(window).on('load', function(){
5371				if ( $('.owl-carousel').length ) {
5372					requestTimeout(function(){
5373						scrollBody(goToSection);
5374					}, 400);
5375				} else {
5376					scrollBody(goToSection);
5377				}
5378			});
5379		}
5380
5381	}
5382
5383	function changeMenuActive(section, index) {
5384		current = lastScrolled = parseInt($(section).attr('data-section'));
5385		if (isOnePage) {
5386			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5387			if (newSection.length) {
5388				$('ul.onepage-pagination li a').removeClass('is-selected');
5389				newSection.addClass('is-selected');
5390			}
5391			var getName = $('[data-section="' + index + '"]').attr('data-name');
5392			if (getName != undefined && getName !== '') {
5393				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5394					var get_href = $(val).attr('href');
5395					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5396						$(val).closest('.menu-smart').find('.active').removeClass('active');
5397						$(val).parent().addClass('active');
5398					}
5399				});
5400			}
5401		}
5402	}
5403
5404	if (isOnePage) {
5405		$(window).on('scroll', function() {
5406			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5407			if (bodyTop == 0) {
5408				$('ul.onepage-pagination li a').removeClass('is-selected');
5409				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5410				var getName = $('[data-section=0]').attr('data-name');
5411				if (getName != undefined && getName !== '') {
5412					$.each($('.menu-container .menu-item > a'), function(i, val) {
5413						var get_href = $(val).attr('href');
5414						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5415							$(val).closest('ul').find('.active').removeClass('active');
5416							$(val).parent().addClass('active');
5417						}
5418					});
5419				}
5420			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5421				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5422				if (lastSection.length) {
5423					$('ul.onepage-pagination li a').removeClass('is-selected');
5424					lastSection.addClass('is-selected');
5425				}
5426			}
5427		});
5428	}
5429
5430	var scrollBody = function(index) {
5431		$('ul.onepage-pagination li a').removeClass('is-selected');
5432		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5433
5434		var getSection = $('[data-section=' + index + ']'),
5435			scrollTo;
5436
5437		if (getSection == undefined) return;
5438
5439		var body = $("html, body"),
5440			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5441			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5442			getOffset = UNCODE.get_scroll_offset(index);
5443		if ( typeof getSection.offset() === 'undefined' )
5444			return;
5445		scrollTo = getSection.offset().top;
5446
5447		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5448		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5449			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5450			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5451				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5452			}
5453
5454			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5455				if ( index === 0 ) {
5456					scrollTo = 0;
5457				} else {
5458					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5459				}
5460			} else {
5461				scrollTo -= getOffset;
5462			}
5463		}
5464
5465		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5466		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5467
5468		if (index != 0) {
5469			UNCODE.scrolling = true;
5470		}
5471
5472		if (scrollSpeed == 0) {
5473			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5474			UNCODE.scrolling = false;
5475		} else {
5476			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5477				$(this).stop();
5478			}).animate({
5479				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5480			}, scrollSpeed, 'easeInOutCubic', function() {
5481				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5482				UNCODE.scrolling = false;
5483				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5484				||
5485				$('.menu-hided').length ) {
5486					scrollTo = getSection.offset().top;
5487					getOffset = UNCODE.get_scroll_offset(index);
5488					scrollTo -= getOffset;
5489					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5490						$(this).stop();
5491					}).animate({
5492						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5493						}, scrollSpeed, 'easeInOutCubic', function() {
5494							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5495							UNCODE.scrolling = false;
5496						}
5497					);
5498				}
5499			});
5500		}
5501
5502	};
5503
5504	init_onepage();
5505};
5506
5507UNCODE.stickyElements = function() {
5508	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5509	if (!isMobile_wide ) {
5510
5511		var $pageHeader = $('#page-header'),
5512			$headerRow = $('.vc_row', $pageHeader),
5513			$headerSection = $headerRow.closest('section[data-parent]'),
5514			startSticky = false;
5515
5516		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
5517			$headerRow.removeClass('sticky-element');
5518			$pageHeader.addClass('sticky-element');
5519			startSticky = true;
5520		}
5521
5522		var calculateOffset = function(el) {
5523			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5524				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5525				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5526				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5527
5528			sideOffset += UNCODE.bodyBorder;
5529
5530			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5531			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5532				if ($('.menu-shrink').length) {
5533					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5534				} else {
5535					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5536				}
5537			}
5538
5539			return sideOffset;
5540
5541		},
5542
5543		initStickyElement = function($els) {
5544			if ( $('body').hasClass('vc-safe-mode') ) {
5545				return true;
5546			}
5547			if ( typeof $els === 'undefined' ) {
5548				$els = $('.sticky-element');
5549			}
5550			$.each($els, function(index, element) {
5551				if ($(element).closest('.tab-pane').length) {
5552					var $paneParent = $(element).closest('.tab-pane');
5553					if ( !$paneParent.hasClass('active') ) {
5554						return true;
5555					}
5556				}
5557				$(element).stick_in_parent({
5558					sticky_class: 'is_stucked',
5559					offset_top: calculateOffset(element),
5560					bottoming: true,
5561					inner_scrolling: SiteParameters.sticky_elements === 'on'
5562				});
5563			});
5564		};
5565
5566		var oldW = UNCODE.wwidth,
5567			oldH = UNCODE.wHeight;
5568
5569		requestTimeout(function() {
5570			if ($('.sticky-element').length) {
5571
5572				if ($(window).width() > UNCODE.mediaQuery) {
5573					initStickyElement();
5574
5575					if ( startSticky === true ) {
5576						$('#page-header').trigger('sticky_kit:recalc');
5577					}
5578				}
5579
5580				$(window).on('resize lateral_resize', function(event) {
5581					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
5582						$(".sticky-element").trigger("sticky_kit:detach");
5583						if ($(window).width() > UNCODE.mediaQuery) {
5584							initStickyElement();
5585						}
5586						oldW = UNCODE.wwidth;
5587						oldH = UNCODE.wHeight;
5588					}
5589				});
5590			}
5591		}, 1000);
5592
5593		if ($('.sticky-element').length) {
5594			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
5595				requestTimeout(function() {
5596					$(document.body).trigger("sticky_kit:recalc");
5597				}, 100);
5598			});
5599		}
5600
5601		var $panels = $('.panel-collapse');
5602		if ( $panels.length ) {
5603			$panels.each(function(){
5604				var $panel = $(this);
5605				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
5606					$(document.body).trigger("sticky_kit:recalc");
5607				});
5608			});
5609		}
5610
5611		$('.nav-tabs a').on('shown.bs.tab', function(e){
5612			var $tabs = $(e.target).closest('.tab-container'),
5613				$panel = $('.tab-pane.active', $tabs),
5614				$els = $(e.target).nextAll(".sticky-element");
5615
5616			$els.trigger("sticky_kit:detach");
5617			initStickyElement($els);
5618		});
5619
5620		$(window).on('vc-safe-mode-on', function(){
5621			$(".sticky-element").trigger("sticky_kit:detach");
5622		});
5623
5624		$(window).on('vc-safe-mode-off', function(){
5625			initStickyElement();
5626		});
5627	}
5628};
5629
5630UNCODE.twentytwenty = function() {
5631
5632  if (!$('.twentytwenty-container').length) return;
5633
5634// DOM.event.move
5635//
5636// 2.0.0
5637//
5638// Stephen Band
5639//
5640// Triggers 'movestart', 'move' and 'moveend' events after
5641// mousemoves following a mousedown cross a distance threshold,
5642// similar to the native 'dragstart', 'drag' and 'dragend' events.
5643// Move events are throttled to animation frames. Move event objects
5644// have the properties:
5645//
5646// pageX:
5647// pageY:     Page coordinates of pointer.
5648// startX:
5649// startY:    Page coordinates of pointer at movestart.
5650// distX:
5651// distY:     Distance the pointer has moved since movestart.
5652// deltaX:
5653// deltaY:    Distance the finger has moved since last event.
5654// velocityX:
5655// velocityY: Average velocity over last few events.
5656
5657
5658(function(fn) {
5659	if (typeof define === 'function' && define.amd) {
5660        define([], fn);
5661    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
5662        module.exports = fn;
5663	} else {
5664		fn();
5665	}
5666})(function(){
5667	var assign = Object.assign || window.jQuery && jQuery.extend;
5668
5669	// Number of pixels a pressed pointer travels before movestart
5670	// event is fired.
5671	var threshold = 8;
5672
5673	// Shim for requestAnimationFrame, falling back to timer. See:
5674	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
5675	var requestFrame = (function(){
5676		return (
5677			window.requestAnimationFrame ||
5678			window.webkitRequestAnimationFrame ||
5679			window.mozRequestAnimationFrame ||
5680			window.oRequestAnimationFrame ||
5681			window.msRequestAnimationFrame ||
5682			function(fn, element){
5683				return window.setTimeout(function(){
5684					fn();
5685				}, 25);
5686			}
5687		);
5688	})();
5689
5690	// Shim for customEvent
5691	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
5692	(function () {
5693		if ( typeof window.CustomEvent === "function" ) return false;
5694		function CustomEvent ( event, params ) {
5695			params = params || { bubbles: false, cancelable: false, detail: undefined };
5696			var evt = document.createEvent( 'CustomEvent' );
5697			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
5698			return evt;
5699		}
5700
5701		CustomEvent.prototype = window.Event.prototype;
5702		window.CustomEvent = CustomEvent;
5703	})();
5704
5705	var ignoreTags = {
5706			textarea: true,
5707			input: true,
5708			select: true,
5709			button: true
5710		};
5711
5712	var mouseevents = {
5713		move:   'mousemove',
5714		cancel: 'mouseup dragstart',
5715		end:    'mouseup'
5716	};
5717
5718	var touchevents = {
5719		move:   'touchmove',
5720		cancel: 'touchend',
5721		end:    'touchend'
5722	};
5723
5724	var rspaces = /\s+/;
5725
5726
5727	// DOM Events
5728
5729	var eventOptions = { bubbles: true, cancelable: true };
5730
5731	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
5732
5733	function createEvent(type) {
5734		return new CustomEvent(type, eventOptions);
5735	}
5736
5737	function getEvents(node) {
5738		return node[eventsSymbol] || (node[eventsSymbol] = {});
5739	}
5740
5741	function on(node, types, fn, data, selector) {
5742		types = types.split(rspaces);
5743
5744		var events = getEvents(node);
5745		var i = types.length;
5746		var handlers, type;
5747
5748		function handler(e) { fn(e, data); }
5749
5750		while (i--) {
5751			type = types[i];
5752			handlers = events[type] || (events[type] = []);
5753			handlers.push([fn, handler]);
5754			node.addEventListener(type, handler);
5755		}
5756	}
5757
5758	function off(node, types, fn, selector) {
5759		types = types.split(rspaces);
5760
5761		var events = getEvents(node);
5762		var i = types.length;
5763		var type, handlers, k;
5764
5765		if (!events) { return; }
5766
5767		while (i--) {
5768			type = types[i];
5769			handlers = events[type];
5770			if (!handlers) { continue; }
5771			k = handlers.length;
5772			while (k--) {
5773				if (handlers[k][0] === fn) {
5774					node.removeEventListener(type, handlers[k][1]);
5775					handlers.splice(k, 1);
5776				}
5777			}
5778		}
5779	}
5780
5781	function trigger(node, type, properties) {
5782		// Don't cache events. It prevents you from triggering an event of a
5783		// given type from inside the handler of another event of that type.
5784		var event = createEvent(type);
5785		if (properties) { assign(event, properties); }
5786		node.dispatchEvent(event);
5787	}
5788
5789
5790	// Constructors
5791
5792	function Timer(fn){
5793		var callback = fn,
5794		    active = false,
5795		    running = false;
5796
5797		function trigger(time) {
5798			if (active){
5799				callback();
5800				requestFrame(trigger);
5801				running = true;
5802				active = false;
5803			}
5804			else {
5805				running = false;
5806			}
5807		}
5808
5809		this.kick = function(fn) {
5810			active = true;
5811			if (!running) { trigger(); }
5812		};
5813
5814		this.end = function(fn) {
5815			var cb = callback;
5816
5817			if (!fn) { return; }
5818
5819			// If the timer is not running, simply call the end callback.
5820			if (!running) {
5821				fn();
5822			}
5823			// If the timer is running, and has been kicked lately, then
5824			// queue up the current callback and the end callback, otherwise
5825			// just the end callback.
5826			else {
5827				callback = active ?
5828					function(){ cb(); fn(); } :
5829					fn ;
5830
5831				active = true;
5832			}
5833		};
5834	}
5835
5836
5837	// Functions
5838
5839	function noop() {}
5840
5841	function preventDefault(e) {
5842		e.preventDefault();
5843	}
5844
5845	function isIgnoreTag(e) {
5846		return !!ignoreTags[e.target.tagName.toLowerCase()];
5847	}
5848
5849	function isPrimaryButton(e) {
5850		// Ignore mousedowns on any button other than the left (or primary)
5851		// mouse button, or when a modifier key is pressed.
5852		return (e.which === 1 && !e.ctrlKey && !e.altKey);
5853	}
5854
5855	function identifiedTouch(touchList, id) {
5856		var i, l;
5857
5858		if (touchList.identifiedTouch) {
5859			return touchList.identifiedTouch(id);
5860		}
5861
5862		// touchList.identifiedTouch() does not exist in
5863		// webkit yet… we must do the search ourselves...
5864
5865		i = -1;
5866		l = touchList.length;
5867
5868		while (++i < l) {
5869			if (touchList[i].identifier === id) {
5870				return touchList[i];
5871			}
5872		}
5873	}
5874
5875	function changedTouch(e, data) {
5876		var touch = identifiedTouch(e.changedTouches, data.identifier);
5877
5878		// This isn't the touch you're looking for.
5879		if (!touch) { return; }
5880
5881		// Chrome Android (at least) includes touches that have not
5882		// changed in e.changedTouches. That's a bit annoying. Check
5883		// that this touch has changed.
5884		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
5885
5886		return touch;
5887	}
5888
5889
5890	// Handlers that decide when the first movestart is triggered
5891
5892	function mousedown(e){
5893		// Ignore non-primary buttons
5894		if (!isPrimaryButton(e)) { return; }
5895
5896		// Ignore form and interactive elements
5897		if (isIgnoreTag(e)) { return; }
5898
5899		on(document, mouseevents.move, mousemove, e);
5900		on(document, mouseevents.cancel, mouseend, e);
5901	}
5902
5903	function mousemove(e, data){
5904		checkThreshold(e, data, e, removeMouse);
5905	}
5906
5907	function mouseend(e, data) {
5908		removeMouse();
5909	}
5910
5911	function removeMouse() {
5912		off(document, mouseevents.move, mousemove);
5913		off(document, mouseevents.cancel, mouseend);
5914	}
5915
5916	function touchstart(e) {
5917		// Don't get in the way of interaction with form elements
5918		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
5919
5920		var touch = e.changedTouches[0];
5921
5922		// iOS live updates the touch objects whereas Android gives us copies.
5923		// That means we can't trust the touchstart object to stay the same,
5924		// so we must copy the data. This object acts as a template for
5925		// movestart, move and moveend event objects.
5926		var data = {
5927			target:     touch.target,
5928			pageX:      touch.pageX,
5929			pageY:      touch.pageY,
5930			identifier: touch.identifier,
5931
5932			// The only way to make handlers individually unbindable is by
5933			// making them unique.
5934			touchmove:  function(e, data) { touchmove(e, data); },
5935			touchend:   function(e, data) { touchend(e, data); }
5936		};
5937
5938		on(document, touchevents.move, data.touchmove, data);
5939		on(document, touchevents.cancel, data.touchend, data);
5940	}
5941
5942	function touchmove(e, data) {
5943		var touch = changedTouch(e, data);
5944		if (!touch) { return; }
5945		checkThreshold(e, data, touch, removeTouch);
5946	}
5947
5948	function touchend(e, data) {
5949		var touch = identifiedTouch(e.changedTouches, data.identifier);
5950		if (!touch) { return; }
5951		removeTouch(data);
5952	}
5953
5954	function removeTouch(data) {
5955		off(document, touchevents.move, data.touchmove);
5956		off(document, touchevents.cancel, data.touchend);
5957	}
5958
5959	function checkThreshold(e, data, touch, fn) {
5960		var distX = touch.pageX - data.pageX;
5961		var distY = touch.pageY - data.pageY;
5962
5963		// Do nothing if the threshold has not been crossed.
5964		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
5965
5966		triggerStart(e, data, touch, distX, distY, fn);
5967	}
5968
5969	function triggerStart(e, data, touch, distX, distY, fn) {
5970		var touches = e.targetTouches;
5971		var time = e.timeStamp - data.timeStamp;
5972
5973		// Create a movestart object with some special properties that
5974		// are passed only to the movestart handlers.
5975		var template = {
5976			altKey:     e.altKey,
5977			ctrlKey:    e.ctrlKey,
5978			shiftKey:   e.shiftKey,
5979			startX:     data.pageX,
5980			startY:     data.pageY,
5981			distX:      distX,
5982			distY:      distY,
5983			deltaX:     distX,
5984			deltaY:     distY,
5985			pageX:      touch.pageX,
5986			pageY:      touch.pageY,
5987			velocityX:  distX / time,
5988			velocityY:  distY / time,
5989			identifier: data.identifier,
5990			targetTouches: touches,
5991			finger: touches ? touches.length : 1,
5992			enableMove: function() {
5993				this.moveEnabled = true;
5994				this.enableMove = noop;
5995				e.preventDefault();
5996			}
5997		};
5998
5999		// Trigger the movestart event.
6000		trigger(data.target, 'movestart', template);
6001
6002		// Unbind handlers that tracked the touch or mouse up till now.
6003		fn(data);
6004	}
6005
6006
6007	// Handlers that control what happens following a movestart
6008
6009	function activeMousemove(e, data) {
6010		var timer  = data.timer;
6011
6012		data.touch = e;
6013		data.timeStamp = e.timeStamp;
6014		timer.kick();
6015	}
6016
6017	function activeMouseend(e, data) {
6018		var target = data.target;
6019		var event  = data.event;
6020		var timer  = data.timer;
6021
6022		removeActiveMouse();
6023
6024		endEvent(target, event, timer, function() {
6025			// Unbind the click suppressor, waiting until after mouseup
6026			// has been handled.
6027			setTimeout(function(){
6028				off(target, 'click', preventDefault);
6029			}, 0);
6030		});
6031	}
6032
6033	function removeActiveMouse() {
6034		off(document, mouseevents.move, activeMousemove);
6035		off(document, mouseevents.end, activeMouseend);
6036	}
6037
6038	function activeTouchmove(e, data) {
6039		var event = data.event;
6040		var timer = data.timer;
6041		var touch = changedTouch(e, event);
6042
6043		if (!touch) { return; }
6044
6045		// Stop the interface from gesturing
6046		e.preventDefault();
6047
6048		event.targetTouches = e.targetTouches;
6049		data.touch = touch;
6050		data.timeStamp = e.timeStamp;
6051
6052		timer.kick();
6053	}
6054
6055	function activeTouchend(e, data) {
6056		var target = data.target;
6057		var event  = data.event;
6058		var timer  = data.timer;
6059		var touch  = identifiedTouch(e.changedTouches, event.identifier);
6060
6061		// This isn't the touch you're looking for.
6062		if (!touch) { return; }
6063
6064		removeActiveTouch(data);
6065		endEvent(target, event, timer);
6066	}
6067
6068	function removeActiveTouch(data) {
6069		off(document, touchevents.move, data.activeTouchmove);
6070		off(document, touchevents.end, data.activeTouchend);
6071	}
6072
6073
6074	// Logic for triggering move and moveend events
6075
6076	function updateEvent(event, touch, timeStamp) {
6077		var time = timeStamp - event.timeStamp;
6078
6079		event.distX =  touch.pageX - event.startX;
6080		event.distY =  touch.pageY - event.startY;
6081		event.deltaX = touch.pageX - event.pageX;
6082		event.deltaY = touch.pageY - event.pageY;
6083
6084		// Average the velocity of the last few events using a decay
6085		// curve to even out spurious jumps in values.
6086		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
6087		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
6088		event.pageX =  touch.pageX;
6089		event.pageY =  touch.pageY;
6090	}
6091
6092	function endEvent(target, event, timer, fn) {
6093		timer.end(function(){
6094			trigger(target, 'moveend', event);
6095			return fn && fn();
6096		});
6097	}
6098
6099
6100	// Set up the DOM
6101
6102	function movestart(e) {
6103		if (e.defaultPrevented) { return; }
6104		if (!e.moveEnabled) { return; }
6105
6106		var event = {
6107			startX:        e.startX,
6108			startY:        e.startY,
6109			pageX:         e.pageX,
6110			pageY:         e.pageY,
6111			distX:         e.distX,
6112			distY:         e.distY,
6113			deltaX:        e.deltaX,
6114			deltaY:        e.deltaY,
6115			velocityX:     e.velocityX,
6116			velocityY:     e.velocityY,
6117			identifier:    e.identifier,
6118			targetTouches: e.targetTouches,
6119			finger:        e.finger
6120		};
6121
6122		var data = {
6123			target:    e.target,
6124			event:     event,
6125			timer:     new Timer(update),
6126			touch:     undefined,
6127			timeStamp: e.timeStamp
6128		};
6129
6130		function update(time) {
6131			updateEvent(event, data.touch, data.timeStamp);
6132			trigger(data.target, 'move', event);
6133		}
6134
6135		if (e.identifier === undefined) {
6136			// We're dealing with a mouse event.
6137			// Stop clicks from propagating during a move
6138			on(e.target, 'click', preventDefault);
6139			on(document, mouseevents.move, activeMousemove, data);
6140			on(document, mouseevents.end, activeMouseend, data);
6141		}
6142		else {
6143			// In order to unbind correct handlers they have to be unique
6144			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6145			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6146
6147			// We're dealing with a touch.
6148			on(document, touchevents.move, data.activeTouchmove, data);
6149			on(document, touchevents.end, data.activeTouchend, data);
6150		}
6151	}
6152
6153	on(document, 'mousedown', mousedown);
6154	on(document, 'touchstart', touchstart);
6155	on(document, 'movestart', movestart);
6156
6157
6158	// jQuery special events
6159	//
6160	// jQuery event objects are copies of DOM event objects. They need
6161	// a little help copying the move properties across.
6162
6163	if (!window.jQuery) { return; }
6164
6165	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6166
6167	function enableMove1(e) { e.enableMove(); }
6168	function enableMove2(e) { e.enableMove(); }
6169	function enableMove3(e) { e.enableMove(); }
6170
6171	function add(handleObj) {
6172		var handler = handleObj.handler;
6173
6174		handleObj.handler = function(e) {
6175			// Copy move properties across from originalEvent
6176			var i = properties.length;
6177			var property;
6178
6179			while(i--) {
6180				property = properties[i];
6181				e[property] = e.originalEvent[property];
6182			}
6183
6184			handler.apply(this, arguments);
6185		};
6186	}
6187
6188	jQuery.event.special.movestart = {
6189		setup: function() {
6190			// Movestart must be enabled to allow other move events
6191			on(this, 'movestart', enableMove1);
6192
6193			// Do listen to DOM events
6194			return false;
6195		},
6196
6197		teardown: function() {
6198			off(this, 'movestart', enableMove1);
6199			return false;
6200		},
6201
6202		add: add
6203	};
6204
6205	jQuery.event.special.move = {
6206		setup: function() {
6207			on(this, 'movestart', enableMove2);
6208			return false;
6209		},
6210
6211		teardown: function() {
6212			off(this, 'movestart', enableMove2);
6213			return false;
6214		},
6215
6216		add: add
6217	};
6218
6219	jQuery.event.special.moveend = {
6220		setup: function() {
6221			on(this, 'movestart', enableMove3);
6222			return false;
6223		},
6224
6225		teardown: function() {
6226			off(this, 'movestart', enableMove3);
6227			return false;
6228		},
6229
6230		add: add
6231	};
6232});
6233
6234  $.fn.twentytwenty = function(options) {
6235    var options = $.extend({
6236      default_offset_pct: 0.5,
6237      orientation: 'horizontal',
6238      before_label: 'Before',
6239      after_label: 'After',
6240      no_overlay: false,
6241      move_slider_on_hover: false,
6242      move_with_handle_only: true,
6243      click_to_move: false
6244    }, options);
6245
6246    return this.each(function() {
6247
6248      var sliderPct = options.default_offset_pct;
6249      var container = $(this);
6250      var sliderOrientation = options.orientation;
6251      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6252      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6253
6254
6255      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6256      if(!options.no_overlay) {
6257        container.append("<div class='twentytwenty-overlay'></div>");
6258        var overlay = container.find(".twentytwenty-overlay");
6259        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6260        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6261      }
6262      var beforeImg = container.find("img:first");
6263      var afterImg = container.find("img:last");
6264      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6265      var slider = container.find(".twentytwenty-handle");
6266      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6267      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6268      container.addClass("twentytwenty-container");
6269      beforeImg.addClass("twentytwenty-before");
6270      afterImg.addClass("twentytwenty-after");
6271
6272      var calcOffset = function(dimensionPct) {
6273        var w = beforeImg.width();
6274        var h = beforeImg.height();
6275        return {
6276          w: w+"px",
6277          h: h+"px",
6278          cw: (dimensionPct*w)+"px",
6279          ch: (dimensionPct*h)+"px"
6280        };
6281      };
6282
6283      var adjustContainer = function(offset) {
6284      	if (sliderOrientation === 'vertical') {
6285          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6286          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6287      	}
6288      	else {
6289          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6290          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6291    	}
6292        container.css("height", offset.h);
6293      };
6294
6295      var adjustSlider = function(pct) {
6296        var offset = calcOffset(pct);
6297        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6298        adjustContainer(offset);
6299      };
6300
6301      // Return the number specified or the min/max number if it outside the range given.
6302      var minMaxNumber = function(num, min, max) {
6303        return Math.max(min, Math.min(max, num));
6304      };
6305
6306      // Calculate the slider percentage based on the position.
6307      var getSliderPercentage = function(positionX, positionY) {
6308        var sliderPercentage = (sliderOrientation === 'vertical') ?
6309          (positionY-offsetY)/imgHeight :
6310          (positionX-offsetX)/imgWidth;
6311
6312        return minMaxNumber(sliderPercentage, 0, 1);
6313      };
6314
6315
6316      $(window).on("resize.twentytwenty", function(e) {
6317        adjustSlider(sliderPct);
6318      });
6319
6320      var offsetX = 0;
6321      var offsetY = 0;
6322      var imgWidth = 0;
6323      var imgHeight = 0;
6324      var onMoveStart = function(e) {
6325        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6326          e.preventDefault();
6327        }
6328        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6329          e.preventDefault();
6330        }
6331        container.addClass("active");
6332        offsetX = container.offset().left;
6333        offsetY = container.offset().top;
6334        imgWidth = beforeImg.width();
6335        imgHeight = beforeImg.height();
6336      };
6337      var onMove = function(e) {
6338        if (container.hasClass("active")) {
6339          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6340          adjustSlider(sliderPct);
6341        }
6342      };
6343      var onMoveEnd = function() {
6344          container.removeClass("active");
6345      };
6346
6347      var moveTarget = options.move_with_handle_only ? slider : container;
6348      moveTarget.on("movestart",onMoveStart);
6349      moveTarget.on("move",onMove);
6350      moveTarget.on("moveend",onMoveEnd);
6351
6352      if (options.move_slider_on_hover) {
6353        container.on("mouseenter", onMoveStart);
6354        container.on("mousemove", onMove);
6355        container.on("mouseleave", onMoveEnd);
6356      }
6357
6358      slider.on("touchmove", function(e) {
6359        e.preventDefault();
6360      });
6361
6362      container.find("img").on("mousedown", function(event) {
6363        event.preventDefault();
6364      });
6365
6366      if (options.click_to_move) {
6367        container.on('click', function(e) {
6368          offsetX = container.offset().left;
6369          offsetY = container.offset().top;
6370          imgWidth = beforeImg.width();
6371          imgHeight = beforeImg.height();
6372
6373          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6374          adjustSlider(sliderPct);
6375        });
6376      }
6377
6378      $(window).trigger("resize.twentytwenty");
6379    });
6380  };
6381
6382
6383  $(window).on("load", function(e) {
6384  	$('.twentytwenty-container').each(function(){
6385  		var $container = $(this);
6386  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6387  			$container.twentytwenty();
6388  		}
6389  		$('img', $container).on('async-done', function(){
6390	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6391	  			$container.twentytwenty();
6392	  		}
6393	    });
6394  	});
6395  });
6396}
6397
6398UNCODE.justifiedGallery = function() {
6399
6400	var breakPointMe = function( val ) {
6401		val = parseInt( val );
6402		if ( isNaN(val) ) {
6403			return false;
6404		}
6405		if ( val >= 1500 ) {
6406			return 1;
6407		} else if ( val < 1500 && val >= 960 ) {
6408			return 2;
6409		} else if ( val < 960 && val >= 570 ) {
6410			return 3;
6411		} else if ( val < 570 ) {
6412			return 4;
6413		}
6414	}
6415
6416	var gutterByBreakpoint = function( bp, gutter ) {
6417		var ret;
6418		switch(gutter) {
6419		    case 'no-gutter':
6420		    	ret = 0;
6421		        break;
6422		    case 'px-gutter':
6423		    	ret = 1;
6424		        break;
6425		    case 'half-gutter':
6426		    	ret = 18;
6427		        break;
6428		    case 'double-gutter':
6429				switch(bp) {
6430				    case 3:
6431				    case 4:
6432				    	ret = 36;
6433				        break;
6434				    default:
6435				    	ret = 72;
6436				        break;
6437				}
6438		        break;
6439		    case 'triple-gutter':
6440				switch(bp) {
6441				    case 3:
6442				    case 4:
6443				    	ret = 36;
6444				        break;
6445				    default:
6446				    	ret = 108;
6447				        break;
6448				}
6449		        break;
6450		    case 'quad-gutter':
6451				switch(bp) {
6452				    case 2:
6453				    	ret = 108;
6454				        break;
6455				    case 3:
6456				    	ret = 72;
6457				        break;
6458				    case 4:
6459				    	ret = 36;
6460				        break;
6461				    default:
6462				    	ret = 144;
6463				        break;
6464				}
6465		        break;
6466		    default:
6467		    	ret = 36;//single-gutter
6468		}
6469		return ret;
6470	}
6471
6472	if ($('.justified-layout').length > 0) {
6473		var justifiedContainersArray = [],
6474			typeGridArray = [],
6475			layoutGridArray = [],
6476			transitionDuration = [],
6477			$filterItems = [],
6478			$filters = $('.justified-system .isotope-filters'),
6479			$itemSelector = '.tmb',
6480			$items,
6481			itemMargin,
6482			correctionFactor = 0,
6483			firstLoad = true,
6484			isOriginLeft = $('body').hasClass('rtl') ? false : true,
6485			prevW = breakPointMe(UNCODE.wwidth);
6486		$('[class*="justified-container"]').each(function() {
6487			var isoData = $(this).data();
6488			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6489			if (isoData.type == 'metro') typeGridArray.push(true);
6490			else typeGridArray.push(false);
6491			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
6492			else layoutGridArray.push('justified');
6493			justifiedContainersArray.push($(this));
6494		});
6495		var init_justifiedGallery = function() {
6496			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
6497				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
6498					justifiedId = justifiedSystem.attr('id'),
6499					$layoutMode = layoutGridArray[i],
6500					gutter = $(justifiedContainersArray[i]).data('gutter'),
6501					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
6502					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
6503					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6504					margins;
6505
6506				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6507				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6508				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6509
6510				margins = gutterByBreakpoint(prevW, gutter);
6511
6512				$(justifiedContainersArray[i]).justifiedGallery({
6513					rowHeight: rowHeight,
6514					maxRowHeight: maxRowHeight,
6515					margins: margins,
6516					cssAnimation: true,
6517					lastRow: lastRow,
6518					waitThumbnailsLoad: false
6519				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6520
6521				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6522					$(justifiedContainersArray[i]).infinitescroll({
6523							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6524							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6525							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6526							animate: false,
6527							behavior: 'local',
6528							debug: false,
6529							loading: {
6530								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6531								speed: 0,
6532								finished: undefined,
6533								msg: $('#' + justifiedId + ' .loadmore-button'),
6534							},
6535							errorCallback: function() {
6536								var justified_system = $(this).closest('.justified-system');
6537								$('.loading-button', justified_system).hide();
6538								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
6539							}
6540						},
6541						// append the new items to galleryJustified on the infinitescroll callback function.
6542						function(newElements, opts) {
6543							var $galleryJustified = $(this),
6544								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
6545								filters = new Array(),
6546								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
6547								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
6548								$numPages = $('a', $infinite_button).data('pages'),
6549								delay = 300;
6550							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6551							$infinite_button.show();
6552							$loading_button.hide();
6553							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6554							$('> li', $galleryJustified).remove();
6555							$.each($(newElements), function(index, val) {
6556								$(val).addClass('tmb-iso');
6557								if ($(val).is("li")) {
6558									filters.push($(val)[0]);
6559								}
6560								$(val).addClass('uncode-appended');
6561							});
6562							newElements = newElements.filter(function(x) {
6563								return filters.indexOf(x) < 0
6564							});
6565							$.each($(filters), function(index, val) {
6566								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
6567							});
6568							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
6569							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6570								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
6571								if (typeof getLightbox === 'object') {
6572									getLightbox.refresh();
6573								} else {
6574									UNCODE.lightbox();
6575								}
6576							}
6577							if ( typeof twttr !== 'undefined' )
6578								twttr.widgets.load(justifiedContainersArray[i]);
6579
6580							requestTimeout(function() {
6581								$galleryJustified.trigger('more-items-loaded');
6582								$(window).trigger('more-items-loaded');
6583								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6584							}, 1000);
6585						});
6586					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
6587						var $infinite_justified = $(justifiedContainersArray[i]),
6588							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
6589						$infinite_justified.infinitescroll('pause');
6590						$infinite_button.on('click', function(event) {
6591							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6592								$.each(UNCODE.lightboxArray, function(index, val) {
6593									UNCODE.lightboxArray[index].destroy();
6594								});
6595							}
6596							event.preventDefault();
6597							var $justified_system = $(event.target).closest('.justified-system'),
6598							$infinite_justified = $justified_system.find('.justified-container'),
6599							justifiedId = $justified_system.attr('id');
6600							$(event.currentTarget).html(SiteParameters.loading);
6601							$infinite_justified.infinitescroll('resume');
6602							$infinite_justified.infinitescroll('retrieve');
6603							$infinite_justified.infinitescroll('pause');
6604							$infinite_justified.trigger('more-items-loaded');
6605							$(window).trigger('more-items-loaded');
6606							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6607						});
6608					}
6609				}
6610			}
6611		},
6612		onLayout = function(justifiedObj, startIndex) {
6613			justifiedObj.css('opacity', 1);
6614			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
6615			$('.tmb', justifiedObj).addClass('justified-object-loaded');
6616
6617			requestTimeout(function() {
6618				// window.dispatchEvent(UNCODE.boxEvent);
6619				UNCODE.adaptive();
6620				if (SiteParameters.dynamic_srcset_active === '1') {
6621					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
6622				}
6623				if (typeof MediaElement === "function") {
6624					$(justifiedObj).find('audio,video').each(function() {
6625						$(this).mediaelementplayer({
6626								pauseOtherPlayers: false,
6627						});
6628					});
6629				}
6630				if ($(justifiedObj).find('.nested-carousel').length) {
6631					if (typeof UNCODE.carousel !== 'undefined') {
6632						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
6633					}
6634					requestTimeout(function() {
6635						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6636						justifiedObj.addClass('justified-gallery-finished')
6637						Waypoint.refreshAll();
6638					}, 200);
6639				} else {
6640					requestTimeout(function() {
6641						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6642						justifiedObj.addClass('justified-gallery-finished')
6643						Waypoint.refreshAll();
6644					}, 300);
6645				}
6646			}, 100);
6647
6648		},
6649		boxAnimation = function(items, startIndex, sequential, container) {
6650			var $allItems = items.length - startIndex,
6651				showed = 0,
6652				index = 0;
6653			if (container.closest('.owl-item').length == 1) return false;
6654			$.each(items, function(index, val) {
6655				var elInner = $('> .t-inside', val);
6656				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
6657					return;
6658				}
6659				if (val[0]) val = val[0];
6660				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
6661					new Waypoint({
6662						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
6663						element: val,
6664						handler: function() {
6665							var element = $('> .t-inside', this.element),
6666								parent = $(this.element),
6667								currentIndex = parent.index();
6668							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
6669								delayAttr = parseInt(element.attr('data-delay'));
6670							if (isNaN(delayAttr)) delayAttr = 100;
6671							delay -= showed;
6672							var objTimeout = requestTimeout(function() {
6673								element.removeClass('zoom-reverse').addClass('start_animation');
6674								showed = parent.index();
6675							}, delay * delayAttr);
6676							parent.data('objTimeout', objTimeout);
6677							if (!UNCODE.isUnmodalOpen) {
6678								this.destroy();
6679							}
6680						},
6681						offset: '100%'
6682					})
6683				} else {
6684					elInner.removeClass('animate_when_almost_visible');
6685					$(val).addClass('no-waypoint-animation');
6686					/*if (elInner.hasClass('force-anim')) {
6687						elInner.addClass('start_animation');
6688					} else {
6689						elInner.css('opacity', 1);
6690					}*/
6691				}
6692				index++;
6693			});
6694		};
6695		$filters.on('click', 'a[data-filter]', function(evt) {
6696			var $filter = $(this),
6697				filterContainer = $filter.closest('.isotope-filters'),
6698				filterValue = $filter.attr('data-filter'),
6699				container = $filter.closest('.justified-system').find($('.justified-layout')),
6700				lastRow = container.data('last-row'),
6701				transitionDuration = 0,
6702				delay = 300,
6703				filterItems = [];
6704
6705			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6706
6707			var filter_items = function(){
6708				if (filterValue !== undefined) {
6709					$.each($('> .tmb > .t-inside', container), function(index, val) {
6710						var parent = $(val).parent(),
6711							objTimeout = parent.data('objTimeout');
6712						if (objTimeout) {
6713							$(val).removeClass('zoom-reverse');
6714							clearRequestTimeout(objTimeout);
6715						}
6716						if (transitionDuration == 0) {
6717							if ($(val).hasClass('animate_when_almost_visible')) {
6718								$(val).addClass('zoom-reverse').removeClass('start_animation');
6719							} else {
6720								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6721							}
6722						}
6723					});
6724
6725					requestTimeout(function() {
6726						var $block,
6727							selector,
6728							lightboxElements,
6729							$boxes;
6730
6731						if ( filterValue !== '' && filterValue !== '*' ) {
6732							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
6733							selector = '.' + filterValue;
6734							$.each($(selector, container), function(index, block) {
6735								lightboxElements = $('[data-lbox^=ilightbox]', block);
6736								if (lightboxElements.length) {
6737									lightboxElements.removeClass('lb-disabled');
6738									container.data('lbox', $(lightboxElements[0]).data('lbox'));
6739								}
6740								filterItems.push(block);
6741							});
6742							container.justifiedGallery({
6743								filter: selector,
6744								lastRow: 'nojustify'
6745							});
6746						} else {
6747							container.justifiedGallery({
6748								filter: false,
6749								lastRow: lastRow
6750							});
6751							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
6752							filterItems = $('> .tmb', container);
6753						}
6754						container.trigger('more-items-loaded');
6755						$(window).trigger('more-items-loaded');
6756						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6757
6758						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6759						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6760							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
6761							if (typeof getLightbox === 'object') {
6762								getLightbox.refresh();
6763							} else {
6764								UNCODE.lightbox();
6765							}
6766						}
6767
6768						if (transitionDuration == 0) {
6769							requestTimeout(function() {
6770								boxAnimation(filterItems, 0, false, container);
6771							}, 100);
6772						}
6773						requestTimeout(function() {
6774							Waypoint.refreshAll();
6775							container.trigger('more-items-loaded');
6776							$(window).trigger('more-items-loaded');
6777							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6778							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
6779								$(document).trigger('uncode-scrolltrigger-refresh');
6780							}
6781						}, 2000);
6782
6783					}, delay);
6784				} else {
6785					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6786						$.each(UNCODE.lightboxArray, function(index, val) {
6787							UNCODE.lightboxArray[index].destroy();
6788						});
6789					}
6790					$.each($('> .tmb > .t-inside', container), function(index, val) {
6791						var parent = $(val).parent(),
6792							objTimeout = parent.data('objTimeout');
6793						if (objTimeout) {
6794							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6795							clearRequestTimeout(objTimeout);
6796						}
6797						if (transitionDuration == 0) {
6798							if ($(val).hasClass('animate_when_almost_visible')) {
6799								$(val).addClass('zoom-reverse').removeClass('start_animation');
6800							} else {
6801								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6802							}
6803						}
6804					});
6805					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6806						UNCODE.lightbox();
6807					}
6808					container.parent().addClass('justified-loading');
6809					container.trigger('more-items-loaded');
6810					$(window).trigger('more-items-loaded');
6811					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6812				}
6813			};
6814
6815			if (!$filter.hasClass('active')) {
6816				/** Scroll top with filtering */
6817				if (filterContainer.hasClass('filter-scroll')) {
6818                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6819                    calc_scroll -= UNCODE.get_scroll_offset();
6820
6821					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6822						delta = bodyTop - calc_scroll,
6823						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6824						filterTolerance = false,
6825						filter_timeout;
6826					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6827
6828					if ( !UNCODE.isFullPage ) {
6829						if (scrollSpeed == 0) {
6830							$('html, body').scrollTop(calc_scroll);
6831							UNCODE.scrolling = false;
6832							filter_items();
6833						} else {
6834
6835							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6836								filter_items();
6837								filterTolerance = true;
6838							}
6839
6840							$('html, body').animate({
6841								scrollTop: calc_scroll
6842							},{
6843								easing: 'easeInOutQuad',
6844								duration: scrollSpeed,
6845								complete: function(){
6846									UNCODE.scrolling = false;
6847									if ( !filterTolerance ) {
6848										filter_timeout = setTimeout(function(){
6849											clearTimeout(filter_timeout);
6850											filter_items();
6851										}, 200);
6852									}
6853								}
6854							});
6855						}
6856					}
6857				} else {
6858					filter_items();
6859				}
6860			}
6861			evt.preventDefault();
6862		});
6863
6864		$filters.each(function(i, buttonGroup) {
6865			var $buttonGroup = $(buttonGroup);
6866			$buttonGroup.on('click', 'a', function() {
6867				$buttonGroup.find('.active').removeClass('active');
6868				$(this).addClass('active');
6869			});
6870
6871			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6872				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6873				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6874			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6875				e.preventDefault();
6876				$cats_filters.slideToggle(400, 'easeInOutCirc');
6877			});
6878		});
6879		window.addEventListener('boxResized', function(e) {
6880			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
6881				prevW = breakPointMe(UNCODE.wwidth);
6882				$.each($('.justified-layout'), function(index, val) {
6883					var gutter = $(this).data('gutter'),
6884						margins = gutterByBreakpoint( prevW, gutter);
6885					$(this).justifiedGallery({
6886						margins: margins
6887					});
6888					$(this).find('.mejs-video,.mejs-audio').each(function() {
6889						$(this).trigger('resize');
6890					});
6891				});
6892			}
6893		}, false);
6894
6895		init_justifiedGallery();
6896	};
6897};
6898
6899UNCODE.cssGrid = function() {
6900	if ($('.cssgrid-layout').length > 0) {
6901		var cssGridContainersArray = [];
6902		var transitionDuration = [];
6903		var $filters = $('.cssgrid-system .cssgrid-filters');
6904
6905		$('[class*="cssgrid-container"]').each(function() {
6906			cssGridContainersArray.push($(this));
6907			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6908		});
6909
6910		var init_cssGridAjax = function() {
6911			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
6912				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
6913					cssGridId = cssGridSystem.attr('id');
6914
6915				cssGridSystem.data('transitionDuration', transitionDuration[i]);
6916
6917				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
6918					$(cssGridContainersArray[i]).infinitescroll({
6919						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
6920						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6921						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
6922						animate: false,
6923						behavior: 'local',
6924						debug: false,
6925						loading: {
6926							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
6927							speed: 0,
6928							finished: undefined,
6929							msg: $('#' + cssGridId + ' .loadmore-button'),
6930						},
6931						errorCallback: function() {
6932							var cssgrid_system = $(this).closest('.cssgrid-system');
6933							$('.loading-button', cssgrid_system).hide();
6934							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
6935						}
6936					},
6937					// append the new items to cssGrid on the infinitescroll callback function.
6938					function(newElements, opts) {
6939						var $cssGrid = $(this),
6940							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
6941							cssGridId = cssGridSystemCont.attr('id'),
6942							filters = new Array(),
6943							$loading_button = cssGridSystemCont.find('.loading-button'),
6944							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
6945							$numPages = $('a', $infinite_button).data('pages'),
6946							$woo_results,
6947							delay = 300;
6948						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6949						$infinite_button.show();
6950						$loading_button.hide();
6951						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6952						$('> li', $cssGrid).remove();
6953						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
6954						$.each($(newElements), function (index, val) {
6955							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
6956								$woo_results = $(val);
6957								delete newElements[index];
6958							} else {
6959								$(val).addClass('tmb-grid');
6960								if ($(val).is("li")) {
6961									filters.push($(val)[0]);
6962								}
6963							}
6964							$(val).addClass('uncode-appended');
6965						});
6966						newElements = newElements.filter(function(x) {
6967							return filters.indexOf(x) < 0
6968						});
6969						$.each($(filters), function(index, val) {
6970							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
6971						});
6972						if ($woo_results && $woo_results.length > 0) {
6973							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
6974							var new_count = $woo_results.find('.woocommerce-result-count').text();
6975							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
6976							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
6977							function replaceMatch(match, p1, p2) {
6978        						return old_start + '–' + new_end;
6979							}
6980							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
6981							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
6982						}
6983
6984						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6985						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
6986						if (filterValue !== undefined && filterValue != '*') {
6987							$(newElements).hide();
6988							var els_to_show = $();
6989							$(newElements).each(function() {
6990								var el = $(this);
6991								if (el.hasClass(filterValue)) {
6992									els_to_show = els_to_show.add(el);
6993									el.show();
6994								}
6995							});
6996							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
6997						} else {
6998							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
6999						}
7000
7001						UNCODE.adaptive();
7002						if (SiteParameters.dynamic_srcset_active === '1') {
7003							UNCODE.refresh_dynamic_srcset_size($cssGrid);
7004						}
7005						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7006							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
7007							if (typeof getLightbox === 'object') {
7008								getLightbox.refresh();
7009							} else {
7010								UNCODE.lightbox();
7011							}
7012						}
7013						if ( typeof twttr !== 'undefined' ) {
7014							twttr.widgets.load(cssGridContainersArray[i]);
7015						}
7016
7017						UNCODE.carousel($(newElements));
7018						requestTimeout(function() {
7019							$cssGrid.trigger('more-items-loaded');
7020							$(window).trigger('more-items-loaded');
7021							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7022						}, 1000);
7023
7024					});
7025					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
7026						var $cssgrid_el = $(cssGridContainersArray[i]),
7027							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
7028						$cssgrid_el.infinitescroll('pause');
7029						$infinite_button.on('click', function(event) {
7030							event.preventDefault();
7031							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
7032							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
7033							cssGridId = $cssgrid_system.attr('id');
7034							$(event.currentTarget).html(SiteParameters.loading);
7035							$cssgrid_el.infinitescroll('resume');
7036							$cssgrid_el.infinitescroll('retrieve');
7037							$cssgrid_el.infinitescroll('pause');
7038						});
7039					}
7040				}
7041			}
7042		};
7043
7044		init_cssGridAjax();
7045
7046		if ($('.cssgrid-pagination').length > 0) {
7047			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
7048				evt.preventDefault();
7049
7050				if (SiteParameters.index_pagination_disable_scroll !== '1') {
7051					var container = $(this).closest('.cssgrid-system'),
7052						pagination_disable_scroll = container.attr('data-pagination-scroll'),
7053						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7054
7055					if ( pagination_disable_scroll !== 'disabled' ) {
7056						calc_scroll -= UNCODE.get_scroll_offset();
7057
7058						var menu_container = $('.menu-sticky');
7059						var menu = menu_container.find('.menu-container');
7060
7061						if (menu_container.length > 0 && menu.length > 0) {
7062							calc_scroll = calc_scroll - menu.outerHeight();
7063						}
7064
7065						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7066							delta = bodyTop - calc_scroll,
7067							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7068						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7069
7070						if ( !UNCODE.isFullPage ) {
7071							if (scrollSpeed == 0) {
7072								$('html, body').scrollTop(calc_scroll);
7073							} else {
7074								$('html, body').animate({
7075									scrollTop: calc_scroll
7076								},{
7077									easing: 'easeInOutQuad',
7078									duration: scrollSpeed,
7079									complete: function(){
7080										UNCODE.scrolling = false;
7081									}
7082								});
7083							}
7084						}
7085					}
7086				}
7087
7088				loadCssGrid($(this), true);
7089			});
7090		}
7091
7092		$filters.on('click', 'a.grid-nav-link', function(evt) {
7093			if ($(this).hasClass('no-grid-filter')) {
7094				return;
7095			}
7096			var $filter = $(this),
7097				filterContainer = $filter.closest('.cssgrid-filters'),
7098				filterValue = $filter.attr('data-filter'),
7099				containerSystem = $filter.closest('.cssgrid-system'),
7100				container = containerSystem.find($('.cssgrid-layout')),
7101				transitionDuration = containerSystem.data('transitionDuration'),
7102				delay = 300,
7103				filterItems = [],
7104				all_thumbs = container.find('.tmb-grid');
7105
7106			var filter_items = function(){
7107				if (filterValue !== undefined) {
7108					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7109						var parent = $(val).parent(),
7110							objTimeout = parent.data('objTimeout');
7111						if (objTimeout) {
7112							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7113							clearRequestTimeout(objTimeout);
7114						}
7115						if (transitionDuration == 0) {
7116							if ($(val).hasClass('animate_when_almost_visible')) {
7117								$(val).addClass('zoom-reverse').removeClass('start_animation');
7118							} else {
7119								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7120							}
7121						}
7122					});
7123					requestTimeout(function(){
7124						if ( filterValue == '*' ) {
7125							all_thumbs.show();
7126							all_thumbs.each(function(index, val) {
7127								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7128								filterItems.push($(this));
7129							});
7130						} else {
7131							all_thumbs.each(function() {
7132								var _tmb = $(this);
7133								if (_tmb.hasClass(filterValue)) {
7134									_tmb.show();
7135									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7136									filterItems.push(_tmb);
7137								} else {
7138									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7139									_tmb.hide();
7140								}
7141							});
7142						}
7143
7144						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7145
7146						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7147						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7148						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7149						if (lightboxElements.length) {
7150							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7151							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7152								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7153								if (typeof getLightbox === 'object') {
7154									getLightbox.refresh();
7155								} else {
7156									UNCODE.lightbox();
7157								}
7158							}
7159						}
7160						container.trigger('more-items-loaded');
7161						$(window).trigger('more-items-loaded');
7162						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7163					}, delay);
7164				} else {
7165					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7166						var parent = $(val).parent(),
7167							objTimeout = parent.data('objTimeout');
7168						if (objTimeout) {
7169							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7170							clearRequestTimeout(objTimeout);
7171						}
7172						if (transitionDuration == 0) {
7173							if ($(val).hasClass('animate_when_almost_visible')) {
7174								$(val).addClass('zoom-reverse').removeClass('start_animation');
7175							} else {
7176								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7177							}
7178						}
7179					});
7180					loadCssGrid($filter);
7181				}
7182			};
7183
7184			if (!$filter.hasClass('active')) {
7185				/** Scroll top with filtering */
7186				if (filterContainer.hasClass('filter-scroll')) {
7187                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7188                    calc_scroll -= UNCODE.get_scroll_offset();
7189
7190					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7191						delta = bodyTop - calc_scroll,
7192						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7193						filterTolerance = false,
7194						filter_timeout;
7195					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7196
7197					if ( !UNCODE.isFullPage ) {
7198						if (scrollSpeed == 0) {
7199							$('html, body').scrollTop(calc_scroll);
7200							UNCODE.scrolling = false;
7201							filter_items();
7202						} else {
7203
7204							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7205								filter_items();
7206								filterTolerance = true;
7207							}
7208
7209							$('html, body').animate({
7210								scrollTop: calc_scroll
7211							},{
7212								easing: 'easeInOutQuad',
7213								duration: scrollSpeed,
7214								complete: function(){
7215									UNCODE.scrolling = false;
7216									if ( !filterTolerance ) {
7217										filter_timeout = setTimeout(function(){
7218											clearTimeout(filter_timeout);
7219											filter_items();
7220										}, 200);
7221									}
7222								}
7223							});
7224						}
7225					}
7226				} else {
7227					filter_items();
7228				}
7229			}
7230			evt.preventDefault();
7231		});
7232
7233		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7234			var params = UNCODE.getURLParams(window.location);
7235			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7236
7237			UNCODE.lastURL = window.location.href;
7238
7239			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
7240				return;
7241			}
7242
7243			if (params.id === undefined) {
7244				$.each($('.cssgrid-system'), function(index, val) {
7245					loadCssGrid($(val));
7246				});
7247			} else {
7248				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7249					loadCssGrid($('#' + params.id));
7250				}
7251			}
7252		});
7253
7254		var loadCssGrid = function($href, $paginating) {
7255			var is_paginating = false;
7256
7257			if (undefined !== $paginating && $paginating) {
7258				var is_paginating = $paginating;
7259			}
7260
7261			var href = ($href.is("a") ? $href.attr('href') : location),
7262				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7263				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7264				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7265				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7266				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7267				cssgridId = cssgridSystem.attr('id');
7268			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7269				UNCODE.lastURL = href;
7270				history.pushState({
7271					myCSSgrid: true
7272				}, document.title, href);
7273			}
7274			cssgridWrapper.addClass('cssgrid-loading');
7275			if (is_paginating) {
7276				cssgridWrapper.addClass('grid-filtering');
7277			}
7278			$.ajax({
7279				url: href
7280			}).done(function(data) {
7281				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7282					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7283					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7284				requestTimeout(function() {
7285					cssgridContainer.html($resultItems);
7286					cssgridWrapper.removeClass('cssgrid-loading');
7287					cssgridWrapper.removeClass('grid-filtering');
7288					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7289					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7290					UNCODE.adaptive();
7291					if (SiteParameters.dynamic_srcset_active === '1') {
7292						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7293					}
7294					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7295						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7296						if (typeof getLightbox === 'object') {
7297							getLightbox.refresh();
7298						} else {
7299							UNCODE.lightbox();
7300						}
7301					}
7302					cssgridContainer.trigger('more-items-loaded');
7303					$(window).trigger('more-items-loaded');
7304					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7305				}, 300);
7306
7307				$('.pagination', cssgridFooter).remove();
7308				cssgridFooter.append($resultPagination);
7309
7310				if (cssgridResultCount.length > 0) {
7311					$('.woocommerce-result-count', cssgridResultCount).remove();
7312					cssgridResultCount.append($resultCount);
7313				}
7314			});
7315		};
7316
7317		$filters.each(function(i, buttonGroup) {
7318			var $buttonGroup = $(buttonGroup);
7319			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7320				$buttonGroup.find('.active').removeClass('active');
7321				$(this).addClass('active');
7322
7323			});
7324
7325			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7326				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7327				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7328			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7329				e.preventDefault();
7330				$cats_filters.slideToggle(400, 'easeInOutCirc');
7331			});
7332
7333		});
7334	};
7335};
7336
7337UNCODE.linearGrid = function(){
7338	$('.linear-wrapper').each(function(){
7339		var $wrap = $(this),
7340			$system = $wrap.closest('.linear-system'),
7341			$dragger = $('[data-dragger]', $system),
7342			$row = $wrap.closest('.vc_row[data-parent]'),
7343			_row = $row[0],
7344			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7345			vertical = $cont.hasClass('linear-or-vertical'),
7346			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7347			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7348			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7349			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7350			isInViewport = false,
7351			isHover = false,
7352			init = false,
7353			stableHeight = UNCODE.wheight,
7354			wCont, hCont, docH, marqueeTL;
7355
7356		if ( ! $('.tmb', $cont).length ) {
7357			return;
7358		}
7359
7360		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7361		var dataX = dataSpeed;
7362
7363		dataSpeed += 5;
7364
7365		var checkLinearGridSize = function(){
7366			if ( !$wrap.is(':visible') )  {
7367				return;
7368			}
7369			$wrap.find('.cont-appended').remove();
7370
7371			if ( vertical ) {
7372				if ( ! SiteParameters.is_frontend_editor ) {
7373					hCont = $cont.outerHeight();
7374					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7375					if ( hCont < docH ) {
7376						var res = docH - hCont * 3,
7377							times = 2 * Math.round((res/hCont+1) / 2);
7378					}
7379					for ( var i = 0; i < times; i++ ) {
7380						var $cloneCont = $cont.clone(),
7381							$cloneCont2 = $cont.clone(),
7382							trans = ( (i+2) ) * 100;
7383						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7384						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7385						$cloneCont.find('a[data-lbox]').each(function(){
7386							var dataLbox = $(this).attr('data-lbox');
7387							$(this).attr('data-lbox', dataLbox + '_' + i);
7388						});
7389						$cloneCont.find('.wp-video-shortcode').each(function(){
7390							var thisID = $(this).attr('id');
7391							$(this).attr('id', thisID + '_' + i);
7392						});
7393						$cloneCont2.find('a[data-lbox]').each(function(){
7394							var dataLbox = $(this).attr('data-lbox');
7395							$(this).attr('data-lbox', dataLbox + '_2' + i);
7396						});
7397						$cloneCont2.find('.wp-video-shortcode').each(function(){
7398							var thisID = $(this).attr('id');
7399							$(this).attr('id', thisID + '__' + i);
7400						});
7401						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7402							UNCODE.lightgallery($cloneCont);
7403							UNCODE.lightgallery($cloneCont2);
7404						}
7405					}
7406                }
7407			} else {
7408				wCont = $cont.outerWidth();
7409				if ( (wCont) < UNCODE.wwidth*2 ) {
7410					var res = UNCODE.wwidth*2 - (wCont),
7411						times = 2 * Math.round((res/wCont+1) / 2);
7412				}
7413				for ( var i = 0; i < times; i++ ) {
7414					var $cloneCont = $cont.clone(),
7415						$cloneCont2 = $cont.clone(),
7416						trans = ( (i+2) ) * 100;
7417					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7418					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7419					$cloneCont.find('a[data-lbox]').each(function(){
7420						var dataLbox = $(this).attr('data-lbox');
7421						$(this).attr('data-lbox', dataLbox + '_' + i);
7422					});
7423					$cloneCont.find('[id]').each(function(){
7424						var thisID = $(this).attr('id');
7425						$(this).attr('id', thisID + '_' + i);
7426					});
7427					$cloneCont2.find('a[data-lbox]').each(function(){
7428						var dataLbox = $(this).attr('data-lbox');
7429						$(this).attr('data-lbox', dataLbox + '_2' + i);
7430					});
7431					$cloneCont2.find('[id]').each(function(){
7432						var thisID = $(this).attr('id');
7433						$(this).attr('id', thisID + '__' + i);
7434					});
7435                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
7436                        UNCODE.lightgallery($cloneCont);
7437                        UNCODE.lightgallery($cloneCont2);
7438                    }
7439                }
7440			}
7441		};
7442		if ( clone ) {
7443			checkLinearGridSize();
7444			$(window).on('resize.linearGrid', function(){
7445				checkLinearGridSize();
7446			});
7447		}
7448
7449		var continuousLinearMarquee = function(_xStrt){
7450			if ( !$wrap.is(':visible') )  {
7451				return;
7452			}
7453			var ease = 'none';
7454			wCont = $cont.outerWidth();
7455			hCont = $cont.outerHeight();
7456
7457			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
7458				xEnd = vertical ? hCont : wCont,
7459				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7460				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
7461				speedSlow = (xEnd + xStrt) / 45,
7462				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7463
7464			marqueeTL = new TimelineMax({paused:true, reversed:true});
7465
7466			if ( isInViewport && !isHover && !freezed ) {
7467				marqueeTL.play();
7468
7469				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
7470					var $column = $wrap.closest('.wpb_column'),
7471						$col_link = $('.col-link', $column),
7472						$hover_sel = $wrap;
7473
7474					if ( $col_link.length ) {
7475						$hover_sel = $wrap.add($column);
7476					}
7477
7478					$hover_sel.on('mouseover', function(){
7479						if ( $wrap.attr('data-hover') === 'yes' ) {
7480							//speed = ( 10 - dataSpeed ) * 5;
7481							ease = 'power2.out';
7482							marqueeTL.duration( speedSlow );
7483						} else {
7484							marqueeTL.pause();
7485						}
7486						isHover = true;
7487					}).on('mouseout', function(){
7488						if ( $wrap.attr('data-hover') === 'yes' ) {
7489							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
7490							ease = 'power2.in';
7491							marqueeTL.duration( speed );
7492						} else {
7493							marqueeTL.play();
7494						}
7495						isHover = false;
7496					});
7497				}
7498
7499			}
7500	
7501			gsap.killTweensOf($wrap);
7502			if ( vertical ) {
7503				marqueeTL.fromTo( $wrap, {
7504					y: xStrt * direction
7505				},
7506				{
7507					duration: speed,
7508					y: xEnd * direction * -1,
7509					onComplete: function(){
7510						continuousLinearMarquee();
7511					},
7512					ease: ease,
7513					paused: freezed
7514				});
7515			} else {
7516				marqueeTL.fromTo( $wrap, {
7517					x: xStrt * direction
7518				},
7519				{
7520					duration: speed,
7521					x: xEnd * direction * -1,
7522					onComplete: function(){
7523						continuousLinearMarquee();
7524					},
7525					ease: ease,
7526					paused: freezed
7527				});
7528			}
7529		};
7530
7531		var dragLinearContinuous = function(){
7532			if ( !$wrap.is(':visible') )  {
7533				return;
7534			}
7535			var matrix, _x, _y,
7536				dragAction = false;
7537			Draggable.create($wrap[0], {
7538				type: vertical ? "y" : "x",
7539				bounds: document.getElementById("container"),
7540				inertia: false,
7541				onPress: function (e) {
7542				},
7543				onRelease: function (e) {
7544					if ( dragAction === true ) {
7545						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7546						_x = matrix[12] || matrix[4];
7547						_y = matrix[13] || matrix[5];
7548						if ( vertical ) {
7549							continuousLinearMarquee(_y * -1);
7550						} else {
7551							continuousLinearMarquee(_x * -1);
7552						}
7553						$wrap.removeClass('linear-dragging');
7554					}
7555				},
7556				onDrag: function (e) {
7557					dragAction = true;
7558					$wrap.addClass('linear-dragging');
7559				},
7560				onDragEnd: function (e) {
7561					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7562					_x = matrix[12] || matrix[4];
7563					_y = matrix[13] || matrix[5];
7564					wCont = $cont.outerWidth();
7565					hCont = $cont.outerHeight();
7566					if ( vertical ) {
7567						if ( Math.abs(_y) > hCont ) {
7568							if ( _y < 0 ) {
7569								_y = hCont + parseFloat( _y );
7570							} else {
7571								_y = parseFloat( _y ) - hCont;
7572							}
7573						}
7574						continuousLinearMarquee(_y * -1);
7575					} else {
7576						if ( Math.abs(_x) > wCont ) {
7577							if ( _x < 0 ) {
7578								_x = wCont + parseFloat( _x );
7579							} else {
7580								_x = parseFloat( _x ) - wCont;
7581							}
7582						}
7583						continuousLinearMarquee(_x * -1);
7584					}
7585					$wrap.removeClass('linear-dragging');
7586					dragAction = false;
7587				},
7588			});
7589		};
7590
7591		var runScrollLinear = function(){
7592			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7593			if ( !$wrap.is(':visible') || freezed )  {
7594				return;
7595			}
7596			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7597				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
7598			
7599			var linearGridScroll = function(){
7600				if ( isInViewport ) {
7601					var bound = _row.getBoundingClientRect();
7602
7603					var bound_top = bound.top,
7604						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
7605
7606					if ( vertical ) {
7607						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7608					} else {
7609						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7610					}
7611					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7612						requestAnimationFrame(linearGridScroll);
7613					}
7614				}
7615				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
7616					window.addEventListener("scroll", linearGridScroll);
7617				}
7618			};
7619
7620			$(window).on( 'load wwResize', function(e) {
7621				stableHeight = UNCODE.wheight;
7622				linearGridScroll();
7623			});
7624			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7625				requestAnimationFrame(linearGridScroll);
7626			}
7627		};
7628		
7629		var dragLinear = function(){
7630			if ( !$wrap.is(':visible') )  {
7631				return;
7632			}
7633			var matrix, _x, _y;
7634			Draggable.create($dragger[0], {
7635				type: vertical ? "y" : "x",
7636				bounds: document.getElementById("container"),
7637				inertia: false,
7638				onPress: function (e) {
7639				},
7640				onRelease: function (e) {
7641				},
7642				onDrag: function (e) {
7643					$wrap.addClass('linear-dragging');
7644				},
7645				onDragEnd: function (e) {
7646					matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7647					_x = matrix[12] || matrix[4];
7648					_y = matrix[13] || matrix[5];
7649					wCont = $cont.outerWidth();
7650					hCont = $cont.outerHeight();
7651					if ( vertical ) {
7652						if ( Math.abs(_y) > hCont ) {
7653							if ( _y < 0 ) {
7654								_y = hCont + parseFloat( _y );
7655							} else {
7656								_y = parseFloat( _y ) - hCont;
7657							}
7658							gsap.to( $dragger[0], {
7659								duration: 0,
7660								y: _y,
7661							});
7662						}
7663					} else {
7664						if ( Math.abs(_x) > wCont ) {
7665							if ( _x < 0 ) {
7666								_x = wCont + parseFloat( _x );
7667							} else {
7668								_x = parseFloat( _x ) - wCont;
7669							}
7670							gsap.to( $dragger[0], {
7671								duration: 0,
7672								x: _x,
7673							});
7674						}
7675					}
7676					$wrap.removeClass('linear-dragging');
7677				},
7678			});
7679		};
7680
7681		if ( ! $('body').hasClass('compose-mode') ) {
7682			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
7683				continuousLinearMarquee();
7684				$(window).on( 'wwResize', function(e) {
7685					continuousLinearMarquee();
7686				});	
7687				if ( $wrap.attr('data-draggable') === 'yes' ) {
7688					dragLinearContinuous();
7689				}
7690			}
7691
7692			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7693				runScrollLinear();
7694				if ( $wrap.attr('data-draggable') === 'yes' ) {
7695					dragLinear();
7696				}
7697			}
7698
7699			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7700				var observer = new IntersectionObserver(function(entries) {
7701						
7702					entries.forEach(function(entry){
7703						if ( entry.isIntersecting ) {
7704							isInViewport = true;
7705							if ( !init ) {
7706								init = true;
7707								continuousLinearMarquee();
7708							} else {
7709								if ( typeof marqueeTL !== 'undefined' ) {
7710									marqueeTL.play();
7711								}
7712							}
7713							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7714								requestAnimFrame(runScrollLinear);
7715							}
7716						} else {
7717							isInViewport = false;
7718							if ( typeof marqueeTL !== 'undefined' ) {
7719								marqueeTL.pause();
7720							}
7721						}
7722					});
7723				}, { 
7724					root: document,
7725				});
7726
7727				observer.observe(_row);
7728
7729			} else {
7730
7731				var checkVisible = function( el, off ) {
7732					if (typeof jQuery === "function" && el instanceof jQuery) {
7733						el = el[0];
7734					}
7735			
7736					off = typeof off=='undefined' ? 50 : off;
7737			
7738					var rect = el.getBoundingClientRect();
7739			
7740					return (
7741						(
7742							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7743							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7744							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7745						)
7746					);
7747				};
7748				
7749				var checkVisibility = function(){
7750
7751					if ( checkVisible($row) ) {
7752						isInViewport = true;
7753						if ( typeof marqueeTL !== 'undefined' ) {
7754							marqueeTL.play();
7755						}
7756					} else {
7757						isInViewport = false;
7758						if ( typeof marqueeTL !== 'undefined' ) {
7759							marqueeTL.pause();
7760						}
7761					}
7762				}
7763
7764				window.addEventListener("scroll", checkVisibility);
7765				checkVisibility();
7766
7767			}
7768		}
7769	});
7770};
7771UNCODE.preventDoubleTransition = function() {
7772	$('.sticky-element .animate_when_almost_visible').each(function(){
7773		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
7774			$el.addClass('do_not_reanimate');
7775		});
7776	});
7777};
7778
7779UNCODE.checkScrollForTabs = function(){
7780	var goToSection = window.location.hash.replace('#', ''),
7781		$index;
7782
7783	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
7784	goToSection = encodeURIComponent(goToSection);
7785	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
7786
7787	$index.attr('data-parent', 'parent-' + goToSection);
7788
7789	if (window.location.hash != undefined && window.location.hash != '') {
7790		requestTimeout(function() {
7791			scrollBody('parent-' + goToSection);
7792		}, 500);
7793	}
7794
7795	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
7796		var hash = (e.currentTarget).hash,
7797			index = (e.currentTarget).closest('.uncode-tabs');
7798		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
7799			$('a[href="' + hash + '"][data-tab-history]').click();
7800			scrollBody(index);
7801		}
7802	});
7803
7804	var scrollBody = function(index) {
7805
7806		var getSection = $('a[href="' + index + '"][data-tab-history]'),
7807			scrollTo,
7808			safeGap = 27;
7809
7810		if ( ! getSection.length ) {
7811			getSection = $('div[data-parent="' + index + '"]');
7812
7813			if ( getSection.attr('data-target') == 'row' ) {
7814				getSection = getSection.closest('.vc_row');
7815				safeGap = 0;
7816			}
7817		}
7818
7819		if (typeof getSection === 'undefined' || ! getSection.length ) {
7820			return;
7821		}
7822
7823		var body = $("html, body"),
7824		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7825		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
7826		getOffset = UNCODE.get_scroll_offset();
7827		if ( typeof getSection.offset() === 'undefined' )
7828			return;
7829		scrollTo = getSection.offset().top - safeGap;
7830		scrollTo -= getOffset;
7831
7832		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7833		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7834
7835		if (index != 0) {
7836			UNCODE.scrolling = true;
7837		}
7838
7839		if (scrollSpeed == 0) {
7840			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
7841			UNCODE.scrolling = false;
7842		} else {
7843			body.animate({
7844				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
7845			}, scrollSpeed, 'easeInOutQuad', function() {
7846				requestTimeout(function() {
7847					UNCODE.scrolling = false;
7848					if (getOffset != UNCODE.get_scroll_offset()) {
7849						scrollBody(index);
7850					}
7851				}, 100);
7852			});
7853		}
7854
7855	};
7856};
7857
7858UNCODE.printScreen = function() {
7859	var inlineMediaStyle = null,
7860		setResize;
7861
7862    function changeMediaStyle() {
7863		clearRequestTimeout(setResize);
7864		setResize = requestTimeout(function(){
7865	        var $head = document.getElementsByTagName('head')[0],
7866	        	$newStyle = document.createElement('style'),
7867	        	winW = window.innerWidth,
7868	        	printH = window.innerHeight;
7869
7870	        $newStyle.setAttribute('type', 'text/css');
7871	        $newStyle.setAttribute('media', 'print');
7872	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
7873
7874	        if (inlineMediaStyle != null) {
7875	            $head.replaceChild($newStyle, inlineMediaStyle)
7876	        } else {
7877	            $head.appendChild($newStyle);
7878	        }
7879	        inlineMediaStyle = $newStyle;
7880	    }, 1000);
7881    }
7882
7883    changeMediaStyle();
7884    window.addEventListener('resize', changeMediaStyle);
7885};
7886
7887UNCODE.fullPage = function() {
7888	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
7889		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
7890		return false;
7891	} else {
7892		requestTimeout(function() {
7893			window.scrollTo(0, 0);
7894		}, 10);
7895	}
7896
7897	var $masthead = $('#masthead'),
7898		$logo = $('#logo-container-mobile'),
7899		$logolink = $('[data-minheight]', $logo),
7900		logoMinScale = $logolink.data('minheight'),
7901		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
7902		$container = $('.main-container .post-content'),
7903		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
7904		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
7905		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
7906		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
7907		headerWithOpacity = $('.header-scroll-opacity', $header).length,
7908		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
7909		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
7910		scrollBar = true,
7911		effect,
7912		animationEndTimeOut,
7913		fp_anim_time = 900,
7914		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
7915		is_scrolling = false,
7916		dataNames = [],
7917		is_first = true,
7918		no_history = $('body').hasClass('uncode-scroll-no-history'),
7919		theres_footer = true;
7920
7921	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
7922		$('> div', $footer).each(function(index, el){
7923			if ( $(el).outerHeight() < 2 )
7924				theres_footer = false;
7925			else
7926				theres_footer = true;
7927		});
7928	}
7929
7930	if ( !$footer.length )
7931		theres_footer = false;
7932
7933	if ( !UNCODE.isFullPageSnap ) {
7934
7935		if ( $('body').hasClass('uncode-fullpage-zoom') )
7936			effect = 'scaleDown';
7937		else if ( $('body').hasClass('uncode-fullpage-parallax') )
7938			effect = 'moveparallax';
7939		else
7940			effect = 'movecurtain';
7941	}
7942
7943	if ( $('body').hasClass('uncode-fullpage-trid') )
7944		fp_anim_time = fp_anim_time*2;
7945
7946	if ( $header.length ) {
7947		if ( headerName !== '' )
7948			$header.attr('data-name', headerName);
7949		if ( headerLabel !== '' )
7950			$header.attr('data-label', headerLabel);
7951		$container.prepend($header);
7952	}
7953	if ( theres_footer ) {
7954		$container.append($footer);
7955		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
7956		$('aside.widget ul', $footer).addClass('no-list');
7957	}
7958
7959	var $all = $rows.add($header);
7960
7961	if ( theres_footer )
7962		$all = $all.add($footer);
7963
7964	$all.each(function(index, row) {
7965		if( index === 0 )
7966			$(row).addClass('uncode-scroll-active');
7967	});
7968
7969    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
7970
7971	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
7972		$("<ul class='onepage-pagination'></ul>").prependTo("body");
7973	}
7974
7975	$all.each(function(index, val) {
7976		var getName = $(val).data('name'),
7977			label;
7978
7979		if (typeof getName == 'undefined' || getName == 'undefined')
7980			getName = SiteParameters.slide_name + '-' + index;
7981
7982		//if ( dataNames.includes(getName) ) {
7983		if ( dataNames.indexOf(getName) > 0 ) {
7984			getName += '_' + index;
7985			$(val).data('name', getName);
7986		}
7987
7988		dataNames.push(getName);
7989
7990		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
7991
7992		if (typeof $(val).attr('data-label') !== 'undefined')
7993			label = $(val).attr('data-label');
7994		else label = '';
7995
7996		if ( $(val).is($footer) )
7997			return;
7998
7999		if (label != '' ) {
8000			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
8001			$('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>");
8002		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
8003			$('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>");
8004		}
8005	});
8006
8007	var checkVisible = function( el, off ) {
8008		if (typeof jQuery === "function" && el instanceof jQuery) {
8009			el = el[0];
8010		}
8011
8012		off = typeof off=='undefined' ? 50 : off;
8013
8014		var rect = el.getBoundingClientRect();
8015
8016		return (
8017			(
8018				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8019				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8020				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8021			)
8022		);
8023	};
8024
8025	var animationEndAction = function( index, nextIndex ) {
8026		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8027			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8028			player, iframe;
8029
8030		if ( !$nextSlide.is($footer) ) {
8031			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
8032		}
8033
8034		if ( !UNCODE.isFullPageSnap ) {
8035			activateKBurns( nextIndex );
8036		}
8037
8038		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8039			if ($(this).attr('data-provider') == 'vimeo') {
8040				iframe = $(this).find('iframe');
8041				player = new Vimeo.Player(iframe[0]);
8042				player.pause();
8043			} else if ($(this).attr('data-provider') == 'youtube') {
8044				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8045			} else {
8046				if ($(this).is('video')) {
8047					$(this)[0].volume = 0;
8048					$(this)[0].pause();
8049				}
8050			}
8051		});
8052
8053		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8054			if ( $nextSlide.is($header) )
8055				$header.removeClass('header-scrolled');
8056		}
8057
8058		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
8059		$otherEl.each(function(){
8060			var $otherThis = $(this),
8061				$bgwrapperOther = $('.background-inner', $otherThis);
8062			if ( !checkVisible($otherThis) )
8063				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
8064
8065		});
8066
8067		if ( !checkVisible($currentSlide) ) {
8068			$currentSlide.removeClass('uncode-scroll-visible');
8069			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
8070			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
8071				currentScroll.scrollTo(0, 0, 0);
8072		}
8073
8074		clearRequestTimeout(animationEndTimeOut);
8075		animationEndTimeOut = requestTimeout(function(){
8076			Waypoint.refreshAll();
8077			$( document.body ).trigger('uncode_waypoints');
8078			var eventFP = new CustomEvent('fp-slide-changed');
8079			window.dispatchEvent(eventFP);
8080			is_scrolling = false;
8081
8082			if ( is_first ) {
8083				$('ul.onepage-pagination a').removeClass('is-selected');
8084				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8085				is_first = false;
8086			}
8087
8088		}, 500);
8089	};
8090
8091	var postLeaveActions = function( nextIndex ){
8092		if ( menuHidden && ! UNCODE.isMobile )
8093			return false;
8094
8095		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8096			$cols = $('.uncol', $el),
8097			anchor = $el.data('anchor');
8098
8099		if ( ! UNCODE.isFullPageSnap ) {
8100			$.each($cols, function(index, val){
8101				if ( $(val).hasClass('style-light') ){
8102					$masthead.removeClass('style-dark-override').addClass('style-light-override');
8103					return false;
8104				} else if ( $(val).hasClass('style-dark') ) {
8105					$masthead.removeClass('style-light-override').addClass('style-dark-override');
8106					return false;
8107				}
8108			});
8109		}
8110
8111		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
8112			$('.menu-item' ).removeClass('active');
8113			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8114		}
8115
8116		if ( !UNCODE.isFullPageSnap ) {
8117			activateBackWash( nextIndex );
8118		}
8119	};
8120
8121	var activateBackWash = function( nextIndex ){
8122		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8123			$bgwrapper;
8124
8125		if ( $el.length ) {
8126			if ( $el.hasClass('with-zoomout') ) {
8127				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8128			} else if ( $('.with-zoomout', $el).length ) {
8129				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
8130			} else {
8131				return false;
8132			}
8133		} else {
8134			return false;
8135		}
8136
8137		$bgwrapper.addClass('uncode-zoomout');
8138
8139	};
8140
8141	var activateKBurns = function( nextIndex ){
8142		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8143			$bgwrapper;
8144
8145		if ( $el.length ) {
8146			if ( $el.hasClass('with-kburns') ) {
8147				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8148			} else if ( $('.with-kburns', $el).length ) {
8149				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
8150			} else {
8151				return false;
8152			}
8153		} else {
8154			return false;
8155		}
8156
8157		$bgwrapper.addClass('uncode-kburns');
8158
8159	};
8160
8161	var activateParallax = function( nextIndex, direction ){
8162
8163		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8164			$cell = $('.fp-tableCell', $el),
8165			animationEnd = 'webkitAnimationEnd animationend',
8166			cellAnim;
8167
8168		switch( direction ) {
8169			case 'up':
8170				cellAnim = 'moveFromTopInner';
8171				break;
8172			default:
8173				cellAnim = 'moveFromBottomInner';
8174		}
8175
8176		$cell.css({
8177			'animation-name': cellAnim,
8178			'animation-duration': fp_anim_time + 'ms',
8179			'animation-delay': '',
8180			'animation-timing-function': fp_easing,
8181			'animation-fill-mode': 'both',
8182		}).off(animationEnd)
8183		.on(animationEnd, function(event) {
8184			if ( event.originalEvent.animationName === cellAnim ) {
8185				$cell
8186					.css({
8187						'animation-name': '',
8188						'animation-duration': '',
8189						'animation-delay': '',
8190						'animation-timing-function': '',
8191						'animation-fill-mode': '',
8192					});
8193			}
8194		});
8195	};
8196
8197	var scrollHashes = function(){
8198		var hash = window.location.hash.replace('#', '').split('/'),
8199			hashInd;
8200		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
8201			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
8202				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
8203				$.fn.fullpage.moveTo(hashInd+1);
8204			}
8205		} else if( hash[0] === '' ) {
8206			$.fn.fullpage.moveTo(1);
8207		}
8208	};
8209
8210	var hideMenu = function( index, nextIndex ){
8211		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
8212			return false;
8213
8214		var hMenu = UNCODE.menuHeight,
8215			transTime = hMenu * 2;
8216
8217		if ( index === 1 && nextIndex > 1 ) {
8218			hMenu = hMenu * -1;
8219		} else if  ( index !== 1 && nextIndex === 1 ) {
8220			hMenu = 0;
8221		} else {
8222			return false;
8223		}
8224
8225		$masthead.css({
8226			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8227			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8228			'-webkit-transition': 'transform 0.5s ease-in-out',
8229			'transition': 'transform 0.5s ease-in-out'
8230		});
8231	};
8232
8233	var shrinkMenu = function( index, nextIndex ){
8234		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
8235			return false;
8236
8237		if ( index === 1 && nextIndex > 1 ) {
8238			$logo.addClass('shrinked');
8239			$('div', $logo).each(function(index, val){
8240				$(val).css({
8241					'height': logoMinScale,
8242					'line-height': logoMinScale
8243				});
8244				if ($(val).hasClass('text-logo')) {
8245					$(val).css({
8246						'font-size': logoMinScale + 'px'
8247					});
8248				}
8249			});
8250			requestTimeout(function() {
8251				UNCODE.menuMobileHeight = $masthead.outerHeight();
8252			}, 300);
8253		} else if ( index !== 1 && nextIndex === 1 ) {
8254			$logo.removeClass('shrinked');
8255			$('div', $logo).each(function(index, val){
8256				$(val).css({
8257					'height': logoMaxScale,
8258					'line-height': logoMaxScale
8259				});
8260				if ($(val).hasClass('text-logo')) {
8261					$(val).css({
8262						'font-size': logoMaxScale + 'px'
8263					});
8264				}
8265			});
8266			requestTimeout(function() {
8267				UNCODE.menuMobileHeight = $masthead.outerHeight();
8268			}, 300);
8269		} else {
8270			return false;
8271		}
8272
8273	};
8274
8275	var anchorLink = function(){
8276
8277		$container.add('.menu-item').find('a[href*="#"]').on('click', function(e) {
8278			var $this = $(e.currentTarget),
8279				hash = e.currentTarget.href.split('#'),
8280				current = window.location.href.split('#'),
8281				ind,
8282				currentMenuOpened = UNCODE.menuOpened,
8283				go = false;
8284
8285			var hash_url = hash[0].replace(/\/?$/, '/'),
8286				current_url = current[0].replace(/\/?$/, '/');
8287
8288			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
8289				hash = '#'+hash[1];
8290				e.preventDefault();
8291				go = true;
8292			}
8293
8294			if ( go ) {
8295
8296				if ( $(hash).length ) {
8297					ind = $(hash).closest('.fp-section').index();
8298				} else {
8299					hash = hash.slice(1);
8300					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
8301				}
8302
8303				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
8304					ind = $this.closest('.fp-section').index();
8305
8306				UNCODE.menuOpened = false;
8307
8308				$.fn.fullpage.moveTo(ind+1);
8309
8310				UNCODE.menuOpened = currentMenuOpened;
8311				if (UNCODE.menuOpened) {
8312					if (UNCODE.wwidth < UNCODE.mediaQuery) {
8313						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
8314					} else {
8315						$('.mmb-container-overlay .overlay-close').trigger('click');
8316						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
8317					}
8318				}
8319
8320			}
8321
8322		});
8323
8324		$('.header-scrolldown').on('click', function(event) {
8325			event.preventDefault();
8326			var scrollDown = $(this),
8327				ind = scrollDown.closest('.fp-section').index();
8328
8329			$.fn.fullpage.moveTo(ind+2);
8330		});
8331
8332		var anchor = $('.fp-section.active').data('anchor');
8333
8334		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
8335			$('.menu-item').removeClass('active');
8336			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8337		}
8338
8339	};
8340
8341	var slideLeave = function( index, nextIndex, direction ) {
8342		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8343			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8344			animationEnd = 'webkitAnimationEnd animationend',
8345			transitionEnd = 'webkitTransitionEnd transitionend',
8346			animOut = effect != 'scaleDown' ? effect + direction : effect,
8347			animIn,
8348			isFooter = false,
8349			isFooterNext = false,
8350			footerH = $footer.outerHeight(),
8351			timeout,
8352			player, iframe,
8353			footerCoeff;
8354		switch( direction ) {
8355			case 'up':
8356				animIn = 'moveFromTop';
8357				break;
8358			default:
8359				animIn = 'moveFromBottom';
8360		}
8361
8362		if ( $('body').hasClass('uncode-fullpage-trid') ) {
8363			animOut = animIn + 'trid';
8364			animIn = animOut + 'In';
8365		} else if ( UNCODE.isFullPageSnap ) {
8366			animIn = animOut = 'none';
8367		}
8368
8369		hideMenu(index, nextIndex);
8370		shrinkMenu(index, nextIndex);
8371
8372		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8373			if ($(this).attr('data-provider') == 'vimeo') {
8374				iframe = $(this).find('iframe');
8375				player = new Vimeo.Player(iframe[0]);
8376				player.pause();
8377			} else if ($(this).attr('data-provider') == 'youtube') {
8378				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8379			} else {
8380				if ($(this).is('video')) {
8381					$(this)[0].volume = 0;
8382					$(this)[0].pause();
8383				}
8384			}
8385		});
8386
8387		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
8388			if ($(this).attr('data-provider') == 'vimeo') {
8389				iframe = $(this).find('iframe');
8390				iframe.on('load', function(){
8391					player = new Vimeo.Player(iframe);
8392					player.setVolume(0);
8393					player.play();
8394				});
8395				player = new Vimeo.Player(iframe);
8396				player.setVolume(0);
8397				player.play();
8398			} else if ($(this).attr('data-provider') == 'youtube') {
8399				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
8400			} else {
8401				if ($(this).is('video')) {
8402					$(this)[0].volume = 0;
8403					$(this)[0].play();
8404				}
8405			}
8406		});
8407
8408		if ( $currentSlide.is($footer) )
8409			isFooter = true;
8410
8411		if ( $nextSlide.is($footer) )
8412			isFooterNext = true;
8413
8414		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8415			if ( $currentSlide.is($header) )
8416				$header.addClass('header-scrolled');
8417		}
8418
8419		footerCoeff = footerH;
8420
8421		if ( UNCODE.isFullPageSnap ) {
8422			postLeaveActions( nextIndex );
8423			activateBackWash( nextIndex );
8424			activateKBurns( nextIndex );
8425			requestTimeout(function(){
8426				animationEndAction( index, nextIndex );
8427			}, fp_anim_time+150);
8428		} else {
8429			if ( isFooterNext ) {
8430
8431				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
8432				$iscrollWrapper.addClass('no-scrolloverflow');
8433
8434				$nextSlide
8435				.add($currentSlide)
8436				.addClass('uncode-scroll-front')
8437				.addClass('uncode-scroll-active')
8438				.addClass('uncode-scroll-visible');
8439				$container.css({
8440					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8441					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8442					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8443					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8444				}).off(transitionEnd)
8445				.one(transitionEnd, function(){
8446					animationEndAction( index, nextIndex );
8447				});
8448
8449			} else if ( isFooter ) {
8450
8451				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
8452				.add($currentSlide)
8453				.addClass('uncode-scroll-front')
8454				.addClass('uncode-scroll-active')
8455				.addClass('uncode-scroll-visible');
8456				$container.css({
8457					'-webkit-transform': 'translate3d(0, 0, 0)',
8458					'transform': 'translate3d(0, 0, 0)',
8459					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8460					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8461				})
8462				.one(transitionEnd, function(){
8463					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
8464						clearRequestTimeout(timeout);
8465						timeout = requestTimeout(function(){
8466							$.fn.fullpage.moveTo(nextIndex);
8467							slideLeave( index-1, nextIndex, 'up' );
8468							$container.off(transitionEnd);
8469						}, 50);
8470					}
8471					animationEndAction( index, nextIndex );
8472				});
8473
8474			} else {
8475
8476				postLeaveActions( nextIndex );
8477
8478				if ( !$('body').hasClass('uncode-fullpage-trid') )
8479					activateParallax( nextIndex, direction );
8480
8481				var $outBg = $('.background-wrapper', $currentSlide);
8482
8483				$nextSlide
8484				.addClass('uncode-scroll-front')
8485				.addClass('uncode-scroll-active')
8486				.addClass('uncode-scroll-visible')
8487				.addClass('uncode-scroll-animating-in')
8488				.css({
8489					'z-index':4,
8490					'animation-name': animIn,
8491					'animation-duration': fp_anim_time + 'ms',
8492					'animation-delay': '',
8493					'animation-timing-function': fp_easing,
8494					'animation-fill-mode': 'both',
8495					'transition': 'initial',
8496				}).off(animationEnd)
8497				.on(animationEnd, function(event) {
8498					if ( event.originalEvent.animationName === animIn ) {
8499						$(this)
8500							.addClass('uncode-scroll-already')
8501							.removeClass('uncode-scroll-front')
8502							.removeClass('uncode-scroll-animating-in')
8503							.css({
8504								'animation-name': '',
8505								'animation-duration': '',
8506								'animation-delay': '',
8507								'animation-timing-function': '',
8508								'animation-fill-mode': '',
8509								'transition': 'initial',
8510							});
8511
8512						$currentSlide
8513							.removeClass('uncode-scroll-active')
8514							.add($outBg)
8515							.css({
8516								'animation-name': '',
8517								'animation-duration': '',
8518								'animation-delay': '',
8519								'animation-timing-function': '',
8520								'animation-fill-mode': '',
8521								'transition': 'initial',
8522							});
8523
8524						animationEndAction( index, nextIndex );
8525
8526					}
8527
8528					if ( nextIndex > 1 )
8529						$('body').addClass('window-scrolled');
8530					else
8531						$('body').removeClass('window-scrolled');
8532				});
8533
8534				$currentSlide
8535					.addClass('uncode-scroll-animating-out')
8536					.removeClass('uncode-scroll-front')
8537					.css({
8538						'z-index':'1',
8539						'animation-name': animOut,
8540						'animation-duration': fp_anim_time + 'ms',
8541						'animation-delay': '',
8542						'animation-timing-function': fp_easing,
8543						'animation-fill-mode': 'both',
8544						'transition': 'initial',
8545						'will-change': 'auto'
8546					}).off(animationEnd)
8547					.on(animationEnd, function(event) {
8548						if ( event.originalEvent.animationName === animOut ) {
8549							$currentSlide.removeClass('uncode-scroll-animating-out');
8550						}
8551					});
8552
8553				if ( $('body').hasClass('uncode-fp-opacity') ) {
8554					$currentSlide.find('> div').css({
8555						'animation-name': 'opacityout',
8556						'animation-duration': fp_anim_time + 'ms',
8557						'animation-delay': '',
8558						'animation-timing-function': fp_easing,
8559						'animation-fill-mode': 'both',
8560						'transition': 'initial',
8561					}).off(animationEnd)
8562					.on(animationEnd, function(event) {
8563						if ( event.originalEvent.animationName === 'opacityout' ) {
8564							$(event.currentTarget).css({
8565								'animation-name': '',
8566								'animation-duration': '',
8567								'animation-delay': '',
8568								'animation-timing-function': '',
8569								'animation-fill-mode': '',
8570								'transition': '',
8571							});
8572						}
8573					});
8574				}
8575			}
8576		}
8577
8578		$('.scroll-top').on('click', function(e){
8579			$.fn.fullpage.moveTo(1);
8580			return false;
8581		});
8582
8583	};
8584
8585	var init_fullPage = function(mode){
8586
8587		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
8588		// 	scrollBar = false;
8589		// }
8590
8591		var checkFPeffects;
8592
8593		$container.fullpage({
8594			sectionSelector: '.uncode-scroll-lock',
8595			scrollOverflow: true,
8596			scrollOverflowOptions: {
8597				click: false,
8598				preventDefaultException: { tagName:/.*/ }
8599			},
8600			navigation: false,
8601			scrollBar: scrollBar,
8602			scrollingSpeed: fp_anim_time,
8603			verticalCentered: true,
8604			anchors: no_history ? false : dataNames,
8605			recordHistory: !no_history,
8606			afterRender: function(){
8607				$('body').removeClass('fp-waiting');
8608				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
8609					var $invisible = $(this).addClass('hidden-scroll');//,
8610				});
8611				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
8612					var $visible = $(this).addClass('uncode-scroll-visible'),
8613						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
8614					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
8615				});
8616
8617				$('ul.onepage-pagination a').on('click', function(e){
8618					e.preventDefault();
8619					var $a = $(this),
8620						toIndex = $a.data('index');
8621
8622					$.fn.fullpage.moveTo(toIndex+1);
8623				});
8624
8625				requestTimeout(function(){
8626					scrollHashes();
8627				}, 1000);
8628
8629				$(window).on('hashchange', function(e){
8630					requestTimeout(function(){
8631						scrollHashes();
8632					}, 500);
8633				});
8634
8635				anchorLink();
8636
8637				if ( $('body').hasClass('uncode-fp-opacity') ) {
8638					$all.each(function(index, row) {
8639						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
8640							classBg;
8641
8642						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
8643							classBg = testmatch[0];
8644							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
8645						}
8646					});
8647				}
8648
8649				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
8650					$(window).on('menuOpen gdprOpen', function(){
8651						$.fn.fullpage.setAutoScrolling(false);
8652					}).on('menuClose gdprClose', function(){
8653						$.fn.fullpage.setAutoScrolling(true);
8654					});
8655				}
8656
8657				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
8658					requestTimeout(function(){
8659						$.fn.fullpage.setAutoScrolling(false);
8660					}, 1000);
8661				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
8662					$.fn.fullpage.setAutoScrolling(true);
8663				});
8664
8665				if ( !UNCODE.isFullPageSnap ) {
8666					clearRequestTimeout(checkFPeffects);
8667					checkFPeffects = requestTimeout(function(){
8668						activateBackWash( 1 );
8669						activateKBurns( 1 );
8670					}, 100);
8671				}
8672
8673			},
8674			onLeave: function( index, nextIndex, direction ){
8675
8676				if ( UNCODE.menuOpened || is_scrolling )
8677					return false;
8678
8679				is_scrolling = true;
8680
8681				var event = new CustomEvent('fp-slide-leave');
8682				window.dispatchEvent(event);
8683
8684				slideLeave( index, nextIndex, direction );
8685
8686				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
8687					if ( direction === 'up' ) {
8688						$.fn.fullpage.moveTo(nextIndex-1);
8689					} else {
8690						$.fn.fullpage.moveTo(nextIndex+1);
8691					}
8692					return false;
8693				}
8694
8695				$('ul.onepage-pagination a').removeClass('is-selected');
8696				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8697
8698			}
8699		});
8700	};
8701
8702	init_fullPage();
8703	$(window).on('load', function(){
8704		requestTimeout(function(){
8705			$.fn.fullpage.reBuild();
8706		}, 3000);
8707	});
8708
8709	var addScrollingClass,
8710		removeScrollingClass;
8711
8712	window.addEventListener("fp-slide-scroll", function(){
8713		addScrollingClass = requestTimeout( function(){
8714			$('body').addClass('fp-slide-scrolling');
8715		}, 10 );
8716
8717		clearRequestTimeout(removeScrollingClass);
8718		removeScrollingClass = requestTimeout( function(){
8719			$('body').removeClass('fp-slide-scrolling');
8720		}, 150 );
8721
8722		Waypoint.refreshAll();
8723	}, false);
8724
8725	var setFPheight = function(){
8726		var $body = document.body,
8727			$footer = document.getElementById('colophon'),
8728			$maincontainer = document.querySelector('.main-wrapper'),
8729			$boxcontainer = document.querySelector('.box-container'),
8730			$sections = document.querySelectorAll('.fp-section'),
8731			rect = $maincontainer.getBoundingClientRect(),
8732			rect2 = $boxcontainer.getBoundingClientRect(),
8733			$masthead = document.getElementById('masthead'),
8734			_hideMenu = false,
8735			menuHeight = UNCODE.menuHeight;
8736		$body.style.height = UNCODE.wheight + 'px';
8737
8738		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
8739			_hideMenu = true;
8740		}
8741		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
8742			menuHeight = 0
8743		}
8744
8745
8746		if ( theres_footer )
8747			$footer.style.top = (rect.height || rect2.height) + 'px';
8748
8749		for (var i = 0; i < $sections.length; i++) {
8750			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
8751		}
8752	};
8753
8754	setFPheight();
8755
8756	window.addEventListener('resize', setFPheight, false);
8757	window.addEventListener('orientationchange', setFPheight, false);
8758
8759};
8760
8761UNCODE.particles = function() {
8762	$(".vc-particles-background").each(function() {
8763		var $particle = $(this);
8764		var $parent = $particle.closest('[data-parent]');
8765
8766		$parent.prepend($particle);
8767		// $(window).trigger('resize');
8768	})
8769};
8770
8771
8772UNCODE.readMoreCol = function( $el ){
8773	if ( typeof $el === 'undefined' || $el === null ) {
8774		$el = $('body');
8775	}
8776	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
8777	$readMoreCols.each(function(){
8778		var $uncont = $(this),
8779			$row = $uncont.closest('.row-container'),
8780			max_h = $uncont.attr('data-ov-height'),
8781			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
8782			actual_max_h = $uncont.outerHeight(),
8783			inner_h,
8784			$read_more = $('+ .btn-more-wrap', $uncont),
8785			read_more_resize = $read_more.hasClass('trigger-resize'),
8786			marginClosedBtn = $uncont.attr('data-margin-closed'),
8787			marginClosed = 0,
8788			marginOpenBtn = $uncont.attr('data-margin-open'),
8789			marginOpen = 0,
8790			anim_t = 250,
8791			resized = false;
8792
8793		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
8794
8795		switch (marginClosedBtn) {
8796			case 'sm':
8797				marginClosed = 18
8798				break;
8799				
8800			case 'std':
8801				marginClosed = 36
8802				break;
8803				
8804			case 'lg':
8805				marginClosed = 72
8806				break;
8807				
8808			case '':
8809			default:
8810				marginClosed = 0
8811				break;
8812				
8813		}
8814
8815		switch (marginOpenBtn) {
8816			case 'sm':
8817				marginOpen = 18
8818				break;
8819				
8820			case 'std':
8821				marginOpen = 36
8822				break;
8823				
8824			case 'lg':
8825				marginOpen = 72
8826				break;
8827				
8828			case 'no':
8829				marginOpen = 0
8830				break;
8831				
8832		}
8833
8834		var checkToggleMobile = function(){
8835			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
8836				resized = true;
8837				if ( $read_more.hasClass('state-closed') ) {
8838					$uncont[0].style.height = '';
8839					$uncont[0].style.maxHeight = max_h_mobile;
8840				}
8841			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
8842				if ( $read_more.hasClass('state-closed') ) {
8843					$uncont[0].style.height = '';
8844					$uncont[0].style.maxHeight = max_h;
8845				}
8846				resized = false;
8847			}
8848		}
8849		checkToggleMobile();
8850		$(window).on('resize', function() {
8851			checkToggleMobile();
8852		});
8853
8854		$('a', $read_more).on('click', function(e){
8855			e.preventDefault();
8856
8857			var $a = $(this);
8858
8859			if ( $read_more.hasClass('state-closed') ) {
8860
8861				$read_more
8862					.removeClass('state-closed')
8863					.addClass('state-open');
8864
8865				$uncont.css({
8866					'max-height': 'none',
8867					'height': 'auto',
8868				});
8869	
8870				inner_h = parseFloat( $uncont.outerHeight() );
8871
8872				$uncont.css({
8873					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8874				});
8875		
8876				anim_t = inner_h - actual_max_h;
8877				if ( anim_t < 250 ) {
8878					anim_t = 250;
8879				} else if ( anim_t > 1000 ) {
8880					anim_t = 1000;
8881				}
8882
8883				$uncont.css({
8884					'transition-duration' : anim_t + 'ms'
8885				}).addClass('overflow-mask-animation').animate({
8886					'height': inner_h
8887				}, anim_t, 'easeInOutCubic', function(){
8888					$uncont.css({
8889						'height' : 'auto'
8890					}).removeClass('overflow-mask');
8891					if ( read_more_resize === true ) {
8892						window.dispatchEvent(new Event('resize'));
8893						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8894							ScrollTrigger.refresh(true);
8895						}
8896					}
8897				});
8898
8899				if ( marginOpen != '' ) {
8900					$read_more.animate({
8901						'margin-top' : marginOpen
8902					}, anim_t, 'easeInOutCubic');
8903				}
8904
8905			} else {
8906				$read_more
8907					.removeClass('state-open')
8908					.addClass('state-closed');
8909
8910				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
8911					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8912				}, anim_t, 'easeInOutCubic', function(){
8913					if ( read_more_resize === true ) {
8914						window.dispatchEvent(new Event('resize'));
8915						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8916							ScrollTrigger.refresh(true);
8917						}
8918					}
8919				});
8920
8921				if ( marginClosed !== '' ) {
8922					$read_more.animate({
8923						'margin-top' : marginClosed
8924					}, anim_t, 'easeInOutCubic');
8925				}
8926
8927				if ( $a.hasClass('toggle-scroll') ) {
8928                    var $masthead = $('#masthead > div:first-child'),
8929                        headH = $masthead.outerHeight(),
8930						rectTop = $row[0].getBoundingClientRect().top,
8931						checkNavBar = $a.hasClass('toggle-navbar'),
8932						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
8933                        offCont = ( $row.offset().top );
8934
8935					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
8936						checkNavBar = checkNavBarMobile;
8937					}
8938
8939					if ( checkNavBar ) {
8940						offCont = offCont - headH;
8941					}
8942			
8943					if ( rectTop < headH ) {
8944						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
8945							$(this).stop();
8946						}).animate({
8947							scrollTop: offCont
8948						}, anim_t, 'easeInOutCubic');
8949					}
8950				}
8951
8952			}
8953		});
8954	});
8955}
8956UNCODE.filters = function() {
8957	var $systems = $('.isotope-system, .cssgrid-system');
8958
8959	$systems.each(function(index, val){
8960		var $system = $(this),
8961			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
8962			$widgets = $('.widgetized-cb-wrapper', $system),
8963			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
8964			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
8965			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
8966			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
8967
8968		if ($system.hasClass('isotope-processed')) {
8969			return;
8970		}
8971
8972		$cats_trigger.on('click', function(e) {
8973			if ( ! $('html').hasClass('screen-sm') ) {
8974				// $widgets.add($sorting_dd).slideUp(400);
8975				e.preventDefault();
8976				$widgets.slideUp(400, 'easeInOutCirc');
8977			}
8978		});
8979
8980		$('.filters-toggle-trigger', $system).on('click', function(e) {
8981			e.preventDefault();
8982			var $filters = $('.isotope-filters .menu-horizontal', $system);
8983			$filters.slideToggle(400, 'easeInOutCirc');
8984			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8985		});
8986
8987		$widget_trgr.on('click', function(e) {
8988			e.preventDefault();
8989			$widgets.slideToggle(400, 'easeInOutCirc');
8990			if (!$('html').hasClass('screen-sm')) {
8991				$cats_filters.slideUp(400, 'easeInOutCirc');
8992			}
8993			window.dispatchEvent(new CustomEvent('boxResized'));
8994		});
8995
8996		$sorting_trgr.on('click', function(e) {
8997			e.preventDefault();
8998			if (!$('html').hasClass('screen-sm')) {
8999				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
9000			}
9001		});
9002
9003		$system.addClass('isotope-processed');
9004	});
9005
9006};
9007
9008UNCODE.widgets = function() {
9009	var widget_collapses = $('.widget-collapse');
9010
9011	widget_collapses.each(function(){
9012		var widget_collapse = $(this),
9013			widget_title = widget_collapse.find('.widget-title'),
9014			widget = widget_title.closest('.widget'),
9015			content = widget.children().not('.widget-title'),
9016			setCTA;
9017
9018		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
9019			widget_title.toggleClass('open');
9020		}
9021
9022		widget_title.each(function() {
9023			var _this = $(this);
9024			var content = _this.closest('.widget').find('.widget-collapse-content');
9025
9026			$(window).on('load resize', function(){
9027				clearRequestTimeout(setCTA);
9028				setCTA = requestTimeout( function() {
9029					if ( content.is(':visible') ) {
9030						_this.addClass( 'open' );
9031					} else {
9032						_this.removeClass( 'open' );
9033					}
9034				}, 10 );
9035			})
9036
9037			_this.on( 'click', function(){
9038
9039				// Get content of :after element (+ icon) to check the visibility
9040				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
9041
9042				if (icon_content === 'none' || !icon_content) {
9043					return false;
9044				}
9045
9046				_this.toggleClass('open');
9047				var isOpen = _this.hasClass('open'),
9048					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
9049				content.animate({
9050					height: 'toggle',
9051					padding: 'toggle',
9052					opacity: 'toggle',
9053					top: isOpen ? 0 : hasBorder
9054				}, {
9055					duration: 400,
9056					easing: "easeInOutCirc",
9057				});
9058
9059				return false;
9060
9061			});
9062		});
9063	});
9064
9065	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
9066};
9067
9068UNCODE.unmodal = function() {
9069	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
9070		$('.unmodal-overlay').fadeIn();
9071		$('.unmodal-overlay').addClass('loading');
9072		$('body').addClass('uncode-unmodal-overlay-visible');
9073		$(window).trigger('unmodal-open');
9074	});
9075
9076	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
9077		$('.unmodal-overlay').fadeOut();
9078		$('.unmodal').fadeOut();
9079		$('body').removeClass('uncode-unmodal-overlay-visible');
9080		$('body').removeClass('uncode-unmodal-open');
9081		$('html').removeClass('uncode-unmodal-body-disable-scroll');
9082		$(document).trigger('unmodal-close');
9083		UNCODE.isUnmodalOpen = false;
9084	});
9085
9086	$(document).on('uncode-unmodal-show-content', function() {
9087		$('.unmodal-overlay').removeClass('loading');
9088		$('.unmodal').show();
9089		$('.unmodal').addClass('show-unmodal-with-animation');
9090		$('.unmodal-content')[0].scrollTop = 0;
9091		$('body').addClass('uncode-unmodal-open');
9092		UNCODE.isUnmodalOpen = true;
9093
9094		if ($('body').hasClass('qw-body-scroll-disabled')) {
9095			$('html').addClass('uncode-unmodal-body-disable-scroll');
9096		}
9097
9098		if ($('.unmodal').hasClass('auto-height')) {
9099			set_modal_height();
9100		}
9101	});
9102
9103	var set_modal_height = function() {
9104		var modal = $('.unmodal').css({height: 'auto'});
9105		var window_height = $(window).outerHeight();
9106		var modal_height = modal.outerHeight();
9107
9108		modal.css('height', 'auto');
9109
9110		if (modal_height > window_height) {
9111			modal.outerHeight(window_height);
9112		}
9113	}
9114
9115	if ($('.unmodal').hasClass('auto-height')) {
9116		var setCTA;
9117
9118		$(window).on('resize', function() {
9119			clearRequestTimeout(setCTA);
9120			setCTA = requestTimeout(function() {
9121				set_modal_height();
9122			}, 100);
9123		});
9124	}
9125};
9126
9127UNCODE.bgChanger = function() {
9128	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
9129		$bg_first = $('.vc_row[data-bg-remove]'),
9130		bg_remove = $bg_first.attr('data-bg-remove'),
9131		$first = $bg_changers.first(),
9132		$last = $bg_changers.last(),
9133		$bg_wrapper = $('#changer-back-color'),
9134		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
9135		setCTA, localH = UNCODE.wheight,
9136		isScrolling;
9137
9138	$bg_first.removeClass(bg_remove);
9139
9140	var bgChange = function($col, bgColor, skin, tmbskin){
9141		$bg_wrapper.attr( 'class', bgColor );
9142		var menuskin;
9143		if ( typeof skin !== 'undefined' ) {
9144			menuskin = skin.replace('style', 'menu')
9145		}
9146
9147		if ( $col.length ) {
9148			$('.uncol[data-skin-change]').each(function(){
9149				var $isoFooter = $('.isotope-footer', this);
9150				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
9151				if ( menuskin !== '' ) {
9152					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
9153				}
9154			});
9155
9156			$('.tmb[data-skin-change]').each(function(){
9157				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
9158			});
9159		}
9160	};
9161
9162	var $masthead = $('#masthead'),
9163		transDesktop,
9164		transMobile,
9165		changeSkin,
9166
9167	checkTransparencyAndChange = function( skin ){
9168		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
9169		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
9170		changeSkin = $masthead.hasClass('menu-change-skin');
9171
9172		if ( ! transDesktop && ! transMobile ) {
9173			return false;
9174		}
9175
9176		if ( ! changeSkin ) {
9177			return false;
9178		}
9179
9180		if ( skin === 'style-light' ){
9181			$masthead.removeClass('style-dark-override').addClass('style-light-override');
9182			return false;
9183		} else if ( skin === 'style-dark' ) {
9184			$masthead.removeClass('style-light-override').addClass('style-dark-override');
9185			return false;
9186		}
9187	};
9188
9189	var bg_waypoints = function(){
9190		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
9191
9192			$.each($bg_changers, function(index, row) {
9193
9194				var $row = $(row),
9195					$col = $('.uncol[data-skin-change]', $row).eq(0),
9196					skin,
9197					$tmbs,
9198					tmbskin,
9199					bgColor = $row.attr('data-bg-color');
9200
9201				if ( ! $row.is(':visible') ) {
9202					return false;
9203				}
9204
9205				if ( $col.length ) {
9206					skin = $col.attr('data-skin-change');
9207					$tmbs = $('.tmb[data-skin-change]', $row);
9208					tmbskin = skin.replace('style', 'tmb');
9209				}
9210
9211				if ( ! $row.hasClass('unscroll-horizontal') ) {
9212					$row.waypoint(function( dir ) {
9213						if ( dir === 'down' ) {
9214							bgChange($col, bgColor, skin, tmbskin);
9215							checkTransparencyAndChange(skin);
9216						} else {
9217							return;
9218						}
9219					}, {
9220						offset: '50%'
9221		  			});
9222
9223					$row.waypoint(function( dir ) {
9224						if ( dir === 'up' ) {
9225							bgChange($col, bgColor, skin, tmbskin);
9226							checkTransparencyAndChange(skin);
9227						} else {
9228							return;
9229						}
9230					}, {
9231						offset: function() {
9232							var clH = this.element.clientHeight,
9233								wH = window.innerHeight,
9234								ret = clH > 200 ? -100 : clH * -0.5;
9235							return ( wH / 2 ) - clH;
9236						}
9237					});
9238				}
9239
9240			});
9241
9242			$('body').addClass('bg-changer-init');
9243
9244		}
9245	};
9246
9247	var body = document.body,
9248	edges = false;
9249
9250	var throttle = function(fn, wait) {
9251		var time = Date.now();
9252		return function() {
9253			if ((time + wait - Date.now()) < 0) {
9254				fn();
9255				time = Date.now();
9256			}
9257		}
9258	}
9259
9260	var $wrapper = document.querySelector(".main-wrapper"),
9261		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
9262
9263	var $title = document.querySelector('#rotating');
9264	if ( $title !== null ) {
9265		$title.style.whiteSpace = 'nowrap';
9266		$title.style.transition = 'transform 200ms linear';
9267	}
9268
9269	window.addEventListener( 'scroll', throttle( function() {
9270		window.clearRequestTimeout( isScrolling );
9271
9272		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
9273
9274			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
9275				body = document.body,
9276				html = document.documentElement,
9277				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9278				$row = false,
9279				firstOff,
9280				lastOff;
9281
9282			if ( scrolled < 100 && $first.length ) {
9283				firstOff = $first.offset().top;
9284				if ( firstOff < 100 ) {
9285					var $row = $first;
9286				}
9287			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
9288				lastOff = $last.offset().top + $last.outerHeight();
9289				if ( lastOff > ( docH - 100 ) ) {
9290					var $row = $last;
9291				}
9292			}
9293
9294			if ( $row.length ) {
9295				var $col = $('.uncol[data-skin-change]', $row).eq(0),
9296					skin,
9297					$tmbs,
9298					tmbskin,
9299					bgColor = $row.attr('data-bg-color');
9300
9301				if ( $col.length ) {
9302					skin = $col.attr('data-skin-change');
9303					$tmbs = $('.tmb[data-skin-change]', $row);
9304					tmbskin = skin.replace('style', 'tmb');
9305				}
9306
9307				bgChange($col, bgColor, skin, tmbskin);
9308				checkTransparencyAndChange(skin);
9309				edges = true;
9310			}
9311
9312		}, 150);
9313
9314		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
9315			bg_waypoints();
9316			Waypoint.refreshAll();
9317			edges = false;
9318		}
9319
9320	}, 100), false);
9321
9322	$(window).on('resize', function() {
9323		clearRequestTimeout(setCTA);
9324		setCTA = requestTimeout(function() {
9325			if ( localH != UNCODE.wheight ) {
9326				localH = UNCODE.wheight;
9327				bg_waypoints();
9328				Waypoint.refreshAll();
9329			}
9330		}, 100);
9331	});
9332
9333	bg_waypoints();
9334
9335};
9336
9337UNCODE.skewIt = function() {
9338
9339	if ( $('body').hasClass('compose-mode') ) {
9340		return;
9341	}
9342
9343	var justscrolled = false;
9344
9345	var loadSkewIt = function(){
9346
9347		var $pageHeader = $('#page-header'),
9348			$page_body = $('.page-body'),
9349			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
9350
9351		if ( $header_skew.length ) {
9352			$pageHeader.addClass('uncode-skew').css({
9353				position: 'relative',
9354				zIndex: 1
9355			});
9356			$header_skew.removeClass('uncode-skew');
9357			$page_body.css({
9358				position: 'relative',
9359				zIndex: 0
9360			});
9361		}
9362
9363		var $skew = $('.uncode-skew'),
9364			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
9365			horizontal = $horizontal.length,
9366			stopSkewing,
9367			lastOffset = 0,
9368			lastDate = Date.now();
9369
9370		if ( ! $skew.length ) {
9371			return;
9372		}
9373
9374		var dropSkew = function(){
9375			if ( UNCODE.wwidth < UNCODE.mediaQuery )
9376				return;
9377
9378			$skew.each(function(){
9379				var $this = $(this),
9380					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9381
9382				if ( $drop.length ) {
9383					$this.css({
9384						'transform': 'skew(0)'
9385					});
9386					var bound = $this[0].getBoundingClientRect();
9387					$drop.css({
9388						left: bound.x * -1,
9389						top: bound.y * -1,
9390					});
9391				}
9392			});
9393		};
9394		dropSkew();
9395
9396		$(window).on('resize', dropSkew);
9397
9398		window.addEventListener( 'scroll', function() {
9399
9400			if ( justscrolled !== true ) {
9401				justscrolled = true;
9402				return;
9403			}
9404
9405			window.clearRequestTimeout( stopSkewing );
9406
9407			var now = Date.now(),
9408				delayInMs = now - lastDate,
9409				offset = window.pageYOffset || window.document.documentElement.scrollTop,
9410				newOffset = offset - lastOffset,
9411				speed = Math.pow((newOffset / delayInMs), 3) * -1,
9412				body = document.body,
9413				html = document.documentElement,
9414				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9415				wait = 50,
9416				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
9417
9418			if ((lastDate + wait - now) < 0) {
9419
9420				lastDate = now;
9421				lastOffset = offset;
9422
9423				if ( speed > 6 ) {
9424					speed = 6;
9425				} else if ( speed < -6 ) {
9426					speed = -6;
9427				}
9428
9429				if ( speed > 2 && offset < UNCODE.wheight ) {
9430					speed = 2;
9431				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
9432					speed = -2;
9433				}
9434
9435				var speedY = speed,
9436					speedX = speed * 1.25;
9437
9438				if ( horizontal ) {
9439					speedY = 0;
9440					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9441						speedX = 0;
9442						return;
9443					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
9444						speedX = 0;
9445						return;
9446					}
9447				} else {
9448					speedX = 0;
9449				}
9450
9451				if ( ! $skew.closest('.enter-st').length ) {
9452					speedX = 0;
9453				}
9454
9455				gsap.killTweensOf($skew);
9456				gsap.to( $skew, {
9457					duration: 0.2,
9458					skewY: (speedY * maxSpeed) + "deg",
9459					skewX: (speedX * maxSpeed) + "deg",
9460					ease: Power0.easeNone,
9461					transformOrigin: 'center',
9462				});
9463
9464			}
9465
9466			stopSkewing = requestTimeout(function() {
9467				gsap.killTweensOf($skew);
9468				gsap.to( $skew, {
9469					duration: 0.5,
9470					skewY: "0deg",
9471					skewX: "0deg",
9472					transformOrigin: 'center',
9473					ease: Expo.easeOut,
9474				});
9475
9476				$skew.each(function(){
9477					var $this = $(this),
9478						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9479
9480					if ( $drop.length ) {
9481						var bound = $this[0].getBoundingClientRect()
9482						$drop.css({
9483							left: bound.x * -1,
9484							top: bound.y * -1,
9485						});
9486					}
9487				});
9488
9489			}, 200);
9490
9491		}, false);
9492
9493	};
9494
9495	$(window).on('load', loadSkewIt);
9496
9497};
9498
9499UNCODE.rotateIt = function() {
9500
9501	if ( $('body').hasClass('compose-mode') ) {
9502		return;
9503	}
9504
9505	var frameRotate = false;
9506	var loadRotateIt = function(){
9507
9508		var $toRotate = $('.uncode-rotate');
9509
9510		$toRotate.each(function(){
9511			var $rotate = $(this),
9512				deg = 0,
9513				dir = true,
9514				coeff = 1,
9515				lastOffset = 0,
9516				lastDate = Date.now();
9517
9518			var checkScroll = function($rotate){
9519				// if ( ! $rotate.length ) {
9520				// 	return;
9521				// }
9522
9523				var now = Date.now(),
9524					delayInMs = now - lastDate,
9525					offset = window.pageYOffset || window.document.documentElement.scrollTop,
9526					newOffset = offset - lastOffset,
9527					speed = (newOffset / delayInMs) * 5,
9528					body = document.body,
9529					html = document.documentElement,
9530					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
9531
9532				lastDate = now;
9533				lastOffset = offset;
9534
9535				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
9536					deg = 0;
9537				}
9538
9539				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
9540					deg = parseFloat(deg) + parseFloat(speed);
9541				}
9542
9543				if ( $rotate.hasClass('uncode-rotate-hover') ) {
9544					$rotate.hover(function(){
9545						coeff = 1.75;
9546					}, function(){
9547						coeff = 1;
9548					});
9549				}
9550
9551				// if ( speed > 0 ) {
9552				// 	dir = true
9553				// } else if ( speed < 0 ) {
9554				// 	dir = false
9555				// }
9556
9557				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
9558					deg = deg+coeff;
9559					// if ( dir ) {
9560					// 	deg = deg+coeff;
9561					// } else {
9562					// 	deg = deg-coeff;
9563					// }
9564				}
9565
9566				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9567					return false;
9568				}
9569				
9570				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
9571					var undeg = deg*-1;
9572					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
9573				} else {
9574					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
9575				}
9576
9577				requestAnimationFrame(function() {
9578					if ( frameRotate === true ) {
9579						frameRotate = false;
9580						return;
9581					}
9582					checkScroll($rotate);
9583				});
9584			};
9585
9586			checkScroll($rotate);
9587
9588		});
9589
9590	};
9591
9592	$(window).on('load', loadRotateIt);
9593
9594	var checkRotate;
9595	var resizeRotate = function(){
9596		var $inlineRotates = $('.inline-rotate');
9597		$inlineRotates.each(function(){
9598			$(this).addClass('inline-rotate-standby');
9599		});
9600		clearTimeout(checkRotate);
9601		checkRotate = setTimeout(function(){
9602			$('.inline-rotate').each(function(){
9603				$(this).removeClass('inline-rotate-standby');
9604				frameRotate = true;
9605			});
9606			loadRotateIt();
9607		}, 500);
9608	};
9609
9610	$(window).off('resize.inline-rotate', resizeRotate)
9611	.on('resize.inline-rotate', resizeRotate);
9612
9613};
9614
9615var marqueeAttempts = 0,
9616	marqueeTO,
9617	marqueeCheckResize,
9618	initMarquee;
9619
9620UNCODE.textMarquee = function( $titles ) {
9621
9622	var isInitMarque = false;
9623
9624	var initTextMarquee = function( $titles ){
9625
9626		if ( typeof $titles == 'undefined' ) {
9627			$titles = $('.un-text-marquee');
9628		}
9629
9630		if ( ! $titles.length ) {
9631			return;
9632		}
9633
9634		isInitMarque = true;
9635
9636		var stableHeight = UNCODE.wheight;
9637
9638		$titles.each(function(){
9639			var $title = $(this),
9640				$span = $('> span, > i > span', $title),
9641				txt,
9642				first = true,
9643				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
9644				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
9645				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
9646				hasSticky = false,
9647				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
9648				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
9649				newW = UNCODE.wwidth,
9650				marqueeTL, inview;
9651
9652			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
9653				hasSticky = true;
9654				dataTrigger = 'row';
9655			}
9656
9657			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
9658				dataNavBar = dataNavBarMobile;
9659			}
9660
9661			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
9662			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
9663			var dataX = dataSpeed;
9664
9665			dataSpeed += 5;
9666
9667			$('.marquee-clone-wrap', $title).remove();
9668
9669			txt = $span.html();
9670
9671			if ( ! $('.marquee-original-core', $span).length ) {
9672				txt = $span.html();
9673				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
9674			} else {
9675				txt = $('.marquee-original-core', $span).html();
9676			}
9677
9678			var spanW,
9679				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
9680				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
9681				speed = 10 - dataSpeed;
9682
9683			$span.prepend($prepended);
9684			$span.append($appended);
9685
9686			var continuousTextMarquee = function () {
9687				var bound = $title
9688						.css({
9689							transform: "none",
9690							opacity: 0,
9691						})
9692						.offset(),
9693					ease = "none";
9694
9695				var xStrt =
9696						first || $title.hasClass("un-marquee-infinite")
9697							? 0
9698							: UNCODE.wwidth - bound.left,
9699					xEnd = $title.hasClass("un-marquee-infinite")
9700						? spanW
9701						: spanW + bound.left,
9702					xSpeed =
9703						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
9704						dataSpeed,
9705					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
9706					speedSlow = (xEnd + xStrt) / 45,
9707					transFormVal,
9708					translX;
9709
9710				marqueeTL = new TimelineMax({ paused: true, reversed: true });
9711				marqueeTL.play();
9712
9713				var inViewElement =
9714						dataTrigger === "row" ? ( hasSticky ? $title.closest('.sticky-trigger, .sticky-element').parent()[0] : $title.closest(".vc_row")[0] ) : $title[0],
9715					wayOff =
9716						dataTrigger === "row" && dataNavBar === "yes"
9717							? UNCODE.menuHeight
9718							: 0;
9719
9720				inview = new Waypoint.Inview({
9721					element: inViewElement,
9722					offset: wayOff,
9723					enter: function (direction) {
9724						marqueeTL.play();
9725					},
9726					exited: function (direction) {
9727						if (!$title.closest(".pin-spacer").length) {
9728							marqueeTL.pause();
9729						}
9730					},
9731				});
9732
9733				if ($title.hasClass("un-marquee-hover")) {
9734					var $column = $title.closest(".wpb_column"),
9735						$col_link = $(".col-link", $column),
9736						$hover_sel = $title;
9737
9738					if ($col_link.length) {
9739						$hover_sel = $title.add($column);
9740					}
9741					$hover_sel
9742						.on("mouseover", function () {
9743							ease = "power2.out";
9744							transFormVal = $title.css("transform").split(/[()]/)[1];
9745							translX = transFormVal.split(",")[4];
9746							speedSlow = (xEnd + (xStrt - translX)) / 45;
9747							marqueeTL.duration(speedSlow);
9748						})
9749						.on("mouseout", function () {
9750							ease = "power2.in";
9751							transFormVal = $title.css("transform").split(/[()]/)[1];
9752							translX = transFormVal.split(",")[4];
9753							speedSlow =
9754								((xEnd + (xStrt - translX)) /
9755									(dataSpeed * dataSpeed * dataSpeed) /
9756									5) *
9757								dataSpeed;
9758							marqueeTL.duration(speedSlow);
9759						});
9760				}
9761		
9762				gsap.killTweensOf($title);
9763				marqueeTL.fromTo( $title, {
9764					opacity: 1,
9765					x: xStrt * direction * -1
9766				},
9767				{
9768					duration: xSpeed,
9769					x: xEnd * direction,
9770					onComplete: function(){
9771						first = false;
9772						continuousTextMarquee();
9773					},
9774					onUpdate: function(){
9775						if ( ! $title[0].isConnected ) {
9776							marqueeTL.kill();
9777							initTextMarquee();
9778						}
9779					},
9780					ease: ease
9781				});
9782		
9783			};
9784			
9785			var runTextMarquee = function(){
9786				var time = Date.now();
9787
9788				var textMarqueeScroll = function(){
9789					var $row = $title.closest('.vc_row');
9790					if ( hasSticky ) {
9791						$row = $title.closest('.sticky-trigger, .sticky-element').parent();
9792					}					
9793					var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
9794
9795					if ( !$bound.length ) {
9796						return;
9797					}
9798
9799					var bound = $bound[0].getBoundingClientRect(),
9800						wait = 100,
9801						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
9802						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
9803
9804					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
9805						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
9806						marqueeAttempts < 2 ) {
9807
9808						clearRequestTimeout(marqueeTO);
9809
9810						marqueeTO = requestTimeout(function(){
9811							marqueeAttempts++;
9812							initTextMarquee();
9813						}, 100);
9814					}
9815
9816
9817					var bound_top = bound.top,
9818						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
9819
9820					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
9821						if ( dataTrigger === 'row-middle' ) {
9822							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5)
9823						}
9824						if ( dataNavBar === 'yes' ) {
9825							bound_top = bound_top - UNCODE.menuHeight;
9826						}
9827						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
9828					}
9829
9830					gsap.killTweensOf($title);
9831					gsap.to( $title, {
9832						duration: 0.24,
9833						x: gsap_calc,
9834					});
9835				};
9836
9837				textMarqueeScroll();
9838				$(window).on( 'load scroll', function(e) {
9839					textMarqueeScroll();
9840				});
9841
9842			};
9843
9844			var cloneSpan = function($_title, cntnt){
9845
9846				if ( $_title.hasClass('un-marquee-infinite') ) {
9847					$('> span.marquee-clone-wrap', $_title).text('');
9848				}
9849
9850				gsap.to( $_title, {
9851					duration: 0,
9852					x: 0
9853				});
9854				spanW = $span.outerWidth();
9855
9856				if ( !spanW ) {
9857					return;
9858				}
9859
9860				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
9861					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
9862
9863				if ( $_title.hasClass('un-marquee-infinite') ) {
9864
9865					for ( var i = 0; i < part; i++ ) {
9866						$prepended.append(cntnt + spaceSpan);
9867						$appended.append(cntnt + spaceSpan);
9868					}
9869				}
9870
9871				if ( $('body').hasClass('compose-mode') ) {
9872					$('.uncode_fe_safe').remove();
9873					return;
9874				}
9875
9876				if ( $title.closest('.marquee-freezed').length ) {
9877					return;
9878				}
9879
9880				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
9881					continuousTextMarquee();
9882				}
9883
9884				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
9885					runTextMarquee();
9886				}
9887
9888			};
9889
9890			var marqueeResize = function(e){
9891				clearRequestTimeout(marqueeCheckResize);
9892				marqueeCheckResize = requestTimeout(function(){
9893					if ( newW !== UNCODE.wwidth ) {
9894						gsap.killTweensOf($title);
9895						if ( typeof inview !== 'undefined' && inview !== null ) {
9896							inview.destroy();
9897						}
9898						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
9899							marqueeTL.kill();
9900						}
9901						first = true;
9902						initTextMarquee();
9903						newW = UNCODE.wwidth;
9904					}
9905				}, 1000);
9906			};
9907
9908			$(window).off('resize', marqueeResize)
9909			.on( 'resize', marqueeResize);
9910			$(window).off('uncode.re-layout', marqueeResize)
9911			.on( 'uncode.re-layout', marqueeResize);
9912
9913			cloneSpan($title, txt);
9914
9915			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9916				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
9917					var $_titles = $('.un-text-marquee',e.view.$el);
9918					clearRequestTimeout(marqueeCheckResize);
9919					marqueeCheckResize = requestTimeout(function(){
9920						initTextMarquee($_titles);
9921					}, 1000);
9922				});
9923			}
9924		});
9925
9926		$(window).on( 'load wwResize', function(e) {
9927			stableHeight = UNCODE.wheight;
9928		});
9929
9930	};
9931
9932	document.addEventListener("DOMContentLoaded", function() {
9933		if ( isInitMarque !== true ) {
9934			initTextMarquee();
9935		}
9936	});
9937
9938	$(window).on('focus load resize',function(){
9939		clearTimeout(initMarquee);
9940		initMarquee = setTimeout(function(){
9941			if ( isInitMarque !== true ) {
9942				initTextMarquee();
9943			}
9944		}, 500);
9945	});
9946	
9947	$(document).on('pumAfterOpen pumAfterClose uncode-scrolltrigger-refresh', function(args){
9948			initTextMarquee();
9949	});
9950
9951};
9952	
9953UNCODE.parallax = function() {
9954	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
9955		if ($('.parallax-el').length > 0) {
9956			var parallax_elements = new Rellax('.parallax-el');
9957			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
9958			window.addEventListener('boxResized', function(e) {
9959				parallax_elements.refresh();
9960			}, false);
9961			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
9962				requestTimeout(function() {
9963					parallax_elements.refresh();
9964				}, 100);
9965			});
9966
9967			if ( typeof UNCODE.hDoc === 'undefined' ) {
9968				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
9969					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
9970			}
9971		
9972			function paralraf(time) {
9973				requestAnimationFrame(paralraf)
9974		
9975				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
9976					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
9977				
9978				if ( UNCODE.hDoc !== newHdoc ) {
9979					UNCODE.hDoc = newHdoc;
9980					parallax_elements.refresh();
9981				}
9982			}
9983		
9984			requestAnimationFrame(paralraf)
9985		
9986		}
9987	}
9988};
9989
9990UNCODE.magicCursor = function(){
9991	var $customCursor = $('#uncode-custom-cursor'),
9992		$customPilot = $('#uncode-custom-cursor-pilot'),
9993		$tooltip = $('.title-tooltip', $customCursor),
9994		$cursorSpan = $('> span', $tooltip),
9995		currentBg = false,
9996		fromTitle = false,
9997		setTime,
9998		mouseEvent;
9999
10000		var spanW, spanH,
10001		maxW = false;
10002
10003	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
10004		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
10005			$tooltip.css({opacity: 0});
10006			delayt_time += 400;
10007		}
10008		clearRequestTimeout(setTime);
10009		setTime = requestTimeout(function() {
10010
10011			$tooltip.css({opacity: ''});
10012
10013			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
10014
10015			if ( cursorTitle !== '' ) {
10016				if ( fromTitle && dataTitle === 'boing' ) {
10017					setTimeout(function(){
10018						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
10019					}, 5);
10020				}
10021				$cursorSpan.attr('class', fontClass).html( cursorTitle );
10022			} else {
10023				if ( cursorType !== 'auto' ) {
10024					$cursorSpan.html('');
10025				}
10026			}
10027
10028			$cursorSpan.addClass('in-tooltip');
10029
10030			$customCursor.attr('data-cursor', cursorType);
10031
10032			if ( fromTitle ) {
10033				$customCursor.addClass('from-tooltip-title');
10034			} else {
10035				$customCursor.removeClass('from-tooltip-title');
10036			}
10037
10038			if ( cursorBg !== false ) {
10039				$customCursor.attr('data-bg', 'transparent');
10040			} else {
10041				$customCursor.removeAttr('data-bg');
10042			}
10043
10044			currentBg = cursorBg;
10045
10046			if ( cursorTitle !== '' ) {
10047				fromTitle = true;
10048				$customCursor.attr('data-cursor', cursorType);
10049				$customCursor.attr('data-title', 'true');
10050				$cursorSpan.css({width: ''});
10051			} else {
10052				fromTitle = false;
10053				$customCursor.removeAttr('data-title');
10054			}
10055			spanW = $cursorSpan.outerWidth();
10056			
10057			if ( spanW >= maxW && maxW !== false ) {
10058				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
10059				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
10060					width: maxW
10061				});
10062				spanW = maxW;
10063			} else {
10064				$customCursor.find('> span:first-child').removeClass('max-width');
10065			}
10066			spanH = $cursorSpan.outerHeight();
10067			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
10068				$customCursor.find('> span:first-child').add($tooltip).css({
10069					width: spanW,
10070					height: spanH
10071				});
10072			} else {
10073				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
10074			}
10075			if ( $customPilot.length ) {
10076				$customPilot.attr('data-cursor', cursorType);
10077			}
10078		}, delayt_time);
10079	}
10080
10081	function changeCursor($wrap){
10082		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10083		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
10084			$href = $wrap.find(href),
10085			cursorType,
10086			cursorTitle = '',
10087			tooltip_class = '',
10088			cursorBg = false;
10089
10090		$wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) {
10091			var $this = $(this).addClass("cursor-init"),
10092				$tmb = $this.closest('.tmb'),
10093				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
10094				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
10095				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
10096				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
10097				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
10098				$title = $('.t-entry-title', $tmb),
10099				is_frontend_editor = $this.closest('.vc_controls').length,
10100				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
10101				$parent_cursor = $this.closest('[class*="custom-cursor"]');
10102
10103			if ( is_frontend_editor ) {
10104				cursorType = 'auto';
10105			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
10106				cursorType = data_cursor;
10107			} else if ( $parent_cursor.length ) {
10108				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
10109					cursorType = 'icon-light';
10110				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
10111					cursorType = 'icon-diff';
10112				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
10113					cursorType = 'icon-accent';
10114				} else {
10115					cursorType = 'icon-dark';
10116				}
10117			} else {
10118				cursorType = 'pointer';
10119			}
10120
10121			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
10122				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
10123					cursorTitle = custom_text;
10124				} else {
10125					cursorTitle = $title.clone();
10126					$('a', cursorTitle).replaceWith(function() {
10127						return this.childNodes;
10128					});
10129					$('*', cursorTitle).replaceWith(function(){
10130						return $(this).removeAttr('class');
10131					});
10132					cursorTitle = cursorTitle.html();
10133				}
10134			} else {
10135				cursorTitle = '';
10136			}
10137
10138			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
10139				tooltip_class = data_class;
10140			} else {
10141				tooltip_class = '';
10142			}
10143
10144			if ( cursor_bg == 'true' ) {
10145				cursorBg = true;
10146			} else {
10147				cursorBg = false;
10148			}
10149
10150			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
10151		}).on("mouseleave.cursor", href, function(e) {
10152			var outTime = 150;
10153			if ( currentBg !== false && cursorBg === false ) {
10154				outTime = 0;
10155			}
10156			delayChangeCursor('auto', '', false, outTime, false, '');
10157		});
10158
10159		$(window).on('disable-hover', function(event) {
10160			document.addEventListener("mousemove", function(e) {
10161				mouseEvent = e;
10162			});
10163			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
10164		});
10165
10166		$(window).on('enable-hover', function(event) {
10167			if ( typeof mouseEvent !== 'undefined' ) {
10168				var x = mouseEvent.clientX,
10169					y = mouseEvent.clientY;
10170
10171				var elements = document.elementsFromPoint(x, y),
10172					$element = $(elements[0]);
10173
10174				$element.closest(href).trigger('mouseenter');
10175			}
10176		});
10177
10178	}
10179
10180	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10181		changeCursor();
10182	});
10183
10184	$(document).ajaxComplete(function( event, xhr, settings ) {
10185		changeCursor();
10186	});
10187
10188	$('.isotope-container').on('isotope-layout-complete', function() {
10189		var $this = $(this);
10190		changeCursor($this);
10191	});
10192
10193};
10194
10195UNCODE.magneticCursor = function(){
10196	function magneticCursor($wrap){
10197		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10198		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'));
10199
10200		$magnetics.on('mousemove', function(e){
10201			var $this = $(this),
10202				$el,
10203				bound = e.currentTarget.getBoundingClientRect(),
10204				coeff = 30,
10205				hor = (bound.width / 2) - (e.clientX - bound.left),
10206				ver = (bound.height / 2) - (e.clientY - bound.top),
10207				toX = hor / bound.width * coeff,
10208				toY = ver / bound.height * coeff,
10209				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
10210				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
10211				toScale = Math.max(scaleX, scaleY);
10212
10213			if ( $this.hasClass('magnetic') ) {
10214				$el = $('.background-inner, .header-bg', $this);
10215			} else {
10216				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10217			}
10218
10219			gsap.killTweensOf($el);
10220			gsap.to( $el, {
10221				duration: 0.75,
10222				x: toX,
10223				y: toY,
10224				scale: toScale,
10225				ease: Power1.easeOut,
10226				transformPerspective: 900,
10227				transformOrigin: 'center',
10228				force3D: true
10229			});
10230		}).on('mouseout', function(e){
10231			var $this = $(this),
10232				$el
10233			if ( $this.hasClass('magnetic') ) {
10234				$el = $('.background-inner, .header-bg', $this);
10235			} else {
10236				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10237			}
10238			gsap.killTweensOf($el);
10239			gsap.to( $el, {
10240				duration: 0.6,
10241				y: 0,
10242				x: 0,
10243				scale: 1,
10244				ease: Power1.easeOut,
10245				transformPerspective: 900,
10246				transformOrigin: 'center',
10247				force3D: true
10248			});
10249		});
10250	};
10251
10252	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10253		magneticCursor();
10254	});
10255
10256	$(document).ajaxComplete(function( event, xhr, settings ) {
10257		magneticCursor();
10258	});
10259
10260	$('.isotope-container').on('isotope-layout-complete', function() {
10261		var $this = $(this);
10262		magneticCursor($this);
10263	});
10264
10265};
10266
10267UNCODE.dropImage = function() {
10268
10269	/****************************
10270	 * Image hover *
10271	****************************/
10272	function imageHover(){
10273		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10274			return;
10275		}
10276
10277		var $postLists = $('.uncode-post-titles');
10278		$postLists.each(function(){
10279			var $list = $(this),
10280				timing = parseFloat( $list.attr('data-timing') ),
10281				default_image = $list.hasClass('uncode-post-titles-default-image'),
10282				default_title = $list.hasClass('uncode-post-titles-default-title'),
10283				$tmbs = $('.tmb', $list),
10284				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
10285				clientX,
10286				clientY,
10287				$row_parent = $list.closest('.vc_row'),
10288				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
10289				$col_parent = $list.closest('.uncell'),
10290				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
10291				stoppedScrolling = true,
10292				setCTA;
10293
10294			timing *= 0.001;
10295
10296			var drop_bgs = function(){
10297				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
10298					var $drop = $(this),
10299						srcset = $drop.attr('data-bgset'),
10300						setArr = srcset.split(","),
10301						setArrOrder = [],
10302						biggest = 0,
10303						checkBg = false,
10304						desktopBG = $drop.data('[data-background-image]'),
10305						mobileBG = $drop.data('[data-mobile-background-image]');
10306
10307					if ( $drop.hasClass('srcset-bg-async') ) {
10308
10309						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
10310							return;
10311						}
10312						
10313					}
10314
10315					if ( SiteParameters.uncode_adaptive == true ) {
10316						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
10317							$drop.css({
10318								'background-image' : 'url(' + setArr[0] + ')'
10319							});
10320						}
10321					} else {
10322						for ( var i = 0; i < setArr.length; i++ ) {
10323							var setLoop = setArr[i].trim().split(" ");
10324							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
10325								var parseSet = parseFloat(setLoop[1]);
10326								if ( biggest < parseSet ) {
10327									biggest = parseSet;
10328								}
10329								setArrOrder[parseSet] = setLoop[0];
10330								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
10331									checkBg = true;
10332									$drop.css({
10333										'background-image' : 'url(' + setLoop[0] + ')'
10334									});
10335								}
10336							}
10337						}
10338
10339						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
10340							$drop.css({
10341								'background-image' : 'url(' + setArrOrder[biggest] + ')'
10342							});
10343						}
10344					}
10345
10346				});
10347			};
10348
10349			drop_bgs();
10350
10351			var dropMovesSize = function(){
10352				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
10353					return;
10354				}
10355				$drop_moves.each(function(){
10356					var $drop_move = $(this),
10357						dataW = $drop_move.attr('data-w'),
10358						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
10359					if ( typeof dataW !== 'undefined' && dataW !== null ) {
10360						dataW = screenInfo.width / 12 * parseFloat( dataW );
10361					}
10362					$drop_moves.css({
10363						width: dataW
10364					});
10365
10366					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10367						$anim_parent.on('animationend', function(){
10368							var bound = $anim_parent[0].getBoundingClientRect();
10369							$drop_move.css({
10370								left: bound.x * -1,
10371								top: bound.y * -1,
10372							});
10373						});
10374					}
10375				});
10376
10377
10378			};
10379
10380			dropMovesSize();
10381
10382			$(window).on( 'resize', function(){
10383				clearRequestTimeout(setCTA);
10384				setCTA = requestTimeout( function() {
10385					drop_bgs();
10386					dropMovesSize();
10387				}, 100 );
10388			});
10389
10390			if ( $drop_row_parents.length ) {
10391				$row_parent.addClass( 'drop-added' );
10392			}
10393
10394			$drop_row_parents.each(function(index, val){
10395				var $drop = $(val);
10396				$row_parent.prepend($drop);
10397				manageVideos($drop, false);
10398				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10399					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10400				}
10401				if ( default_image && index == 0 ) {
10402					manageVideos($drop, true);
10403					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10404						image_ph = new Image();
10405					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10406						image_ph.onload = function() {
10407							$drop.addClass('active');
10408							if ( default_title ) {
10409								$list.addClass('drop-hover');
10410								$tmbs.first().addClass('drop-active');
10411							}
10412						};
10413						image_ph.src = bg_img;
10414					}
10415				}
10416			});
10417
10418			if ( $drop_col_parents.length ) {
10419				$col_parent.addClass( 'drop-added' );
10420			}
10421
10422			$drop_col_parents.each(function(index, val){
10423				var $drop = $(this);
10424				$col_parent.prepend($drop);
10425				manageVideos($drop, false);
10426				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10427					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10428				}
10429				if ( default_image && index == 0 ) {
10430					manageVideos($drop, true);
10431					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10432						image_ph = new Image();
10433					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10434						image_ph.onload = function() {
10435							$drop.addClass('active');
10436							if ( default_title ) {
10437								$list.addClass('drop-hover');
10438								$tmbs.first().addClass('drop-active');
10439							}
10440						};
10441						image_ph.src = bg_img;
10442					}
10443				}
10444			});
10445
10446			function manageVideos( $el, start ) {
10447				var videoElem = $('video', $el),
10448					$iframe = $('iframe', $el),
10449					iframeID = $iframe.attr('id');
10450				if ( videoElem.length ) {
10451					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
10452						if ( start ) {
10453							videoElem[0].setCurrentTime(0);
10454							videoElem[0].play();
10455						} else {
10456							videoElem[0].pause();
10457							videoElem[0].setCurrentTime(0);
10458						}
10459					} else {
10460						if ( start ) {
10461							videoElem[0].currentTime = 0;
10462							videoElem[0].play();
10463						} else {
10464							videoElem[0].pause();
10465							videoElem[0].currentTime = 0;
10466						}
10467					}
10468				}
10469
10470				$el.data('active', start);
10471
10472				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
10473					var iframeIDv = iframeID.replace('okplayer-', ''),
10474						optionsV = $(window).data('okoptions-' + iframeIDv),
10475						vimeo = $iframe[0],
10476						playerV = new Vimeo.Player(vimeo),
10477						timeV = 0;
10478
10479					if (optionsV.time != null) {
10480						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
10481						for ( var i = 0; i < timeArr.length; i++ ) {
10482							if ( timeArr[i] === 'h' ) {
10483								timeV += parseFloat(timeArr[i-1]) * 3600;
10484							} else if ( timeArr[i] === 'm' ) {
10485								timeV += parseFloat(timeArr[i-1]) * 60;
10486							} else if ( timeArr[i] === 's' ) {
10487								timeV += parseFloat(timeArr[i-1]);
10488							}
10489						}
10490					}
10491					playerV.setCurrentTime(timeV);
10492					if ( start ) {
10493						playerV.setVolume(0);
10494						playerV.play();
10495					} else {
10496						playerV.pause();
10497					}
10498				} else if ( $el.attr('data-provider') === 'youtube' ) {
10499					if ( start ) {
10500						$el.trigger('uncode-resume');
10501					} else {
10502						$el.trigger('uncode-pause');
10503					}
10504				}
10505
10506			}
10507
10508			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
10509
10510				document.addEventListener("mousemove", function(e) {
10511					$drop_moves.each(function(){
10512						var $drop_move = $(this),
10513							duration = 0.4;
10514
10515						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
10516							duration = 0.8;
10517						}
10518
10519						clientX = e.clientX;
10520						clientY = e.clientY;
10521
10522						gsap.to( $drop_move, {
10523							duration: duration,
10524							x: clientX,
10525							y: clientY,
10526							ease: Power1.easeOut,
10527						});
10528					});
10529				});
10530
10531			} else {
10532
10533				$(window).on("touchend scroll", function(e) {
10534					$list.removeClass('drop-hover');
10535					$drop_moves.removeClass('active');
10536					$tmbs.removeClass('drop-active');
10537				});
10538
10539				$drop_moves.each(function(){
10540					var $drop_move = $(this),
10541						$tmb = $drop_move.closest('.tmb'),
10542						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
10543
10544					if ( $anim_parent.hasClass('uncode-skew') ) {
10545						$anim_parent.css({
10546							'transform': 'skew(0)'
10547						});
10548					}
10549
10550					$tmb.on('touchend', function(e){
10551						e.stopPropagation();
10552
10553						$drop_moves.removeClass('active');
10554						$tmbs.removeClass('drop-active');
10555
10556						$list.addClass('drop-hover');
10557						$tmb.addClass('drop-active');
10558						$drop_move.addClass('active');
10559						manageVideos($drop_move, true);
10560						clientX = e.changedTouches[0].clientX;
10561						clientY = e.changedTouches[0].clientY;
10562
10563						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10564							var bound = $anim_parent[0].getBoundingClientRect();
10565							clientX = clientX - bound.x;
10566							clientY = clientY - bound.y;
10567						}
10568
10569						$drop_move.css({
10570							left: clientX,
10571							top: clientY
10572						});
10573					});
10574				});
10575
10576			}
10577
10578			$tmbs.each(function(e){
10579				var $tmb = $(this),
10580					// $trgr = $('a', $tmb),
10581					$trgr = $tmb,
10582					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
10583					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
10583(.t-inside), .parallax-el'),
10584					$video = $('video', $tmb),
10585					$iframe = $('iframe', $tmb),
10586					$entryTxt = $('.t-entry-text', $tmb),
10587					stopBounding;
10588
10589				$entryTxt.add($drop_move).css({
10590					'transition-duration': timing + 's'
10591				});
10592
10593				if ( $video.length ) {
10594					var vidH = $video[0].videoHeight,
10595						vidW = $video[0].videoWidth;
10596					$video.css({
10597						'height': vidH,
10598						'width': vidW
10599					});
10600				}
10601
10602				if ( $iframe.length ) {
10603					var vidH = $drop_move.attr('data-height'),
10604						vidW = $drop_move.attr('data-width');
10605					$iframe.css({
10606						'height': vidH,
10607						'width': vidW
10608					});
10609				}
10610
10611				$iframe.each(function(){
10612					var $video = $(this),
10613						vidH = $video[0].videoHeight,
10614						vidW = $video[0].videoWidth;
10615					$video.css({
10616						'height': vidH,
10617						'width': vidW
10618					});
10619				});
10620
10621				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10622					$trgr.on('mouseenter',function(e){
10623
10624						$list.addClass('drop-hover');
10625						$tmbs.removeClass('drop-active');
10626						$tmb.addClass('drop-active');
10627						$drop_move.addClass('active');
10628						manageVideos($drop_move, true);
10629
10630						var clientX = e.clientX,
10631							clientY = e.clientY;
10632						$drop_move.css({
10633							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
10634						});
10635
10636					})
10637					.on('mouseleave', function(e){
10638						$list.removeClass('drop-hover');
10639						$drop_move.css({
10640							'transition-duration': ( timing*1.25 ) + 's'
10641						});
10642						$drop_move.removeClass('active');
10643						$tmb.removeClass('drop-active');
10644						$drop_move.on('transitionend', function(e){
10645							$drop_move.off('transitionend');
10646							$drop_move.css({
10647								'transition-duration': timing + 's'
10648							});
10649							manageVideos($drop_move,false);
10650						});
10651					});
10652
10653					document.addEventListener('visibilitychange', function(){
10654						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
10655							$drop_move.css({
10656								'transition-duration': '0s'
10657							});
10658							$drop_move.removeClass('active');
10659							manageVideos($drop_move, false);
10660						}
10661					});
10662
10663					document.addEventListener('scroll', function(){
10664						window.clearRequestTimeout( stopBounding );
10665						if ( stoppedScrolling ) {
10666							stoppedScrolling = false;
10667							if ( $drop_move.hasClass('active') ) {
10668								$list.removeClass('drop-hover');
10669								$tmbs.removeClass('drop-active');
10670								$drop_move.removeClass('active');
10671								$drop_move.on('transitionend', function(e){
10672									$drop_move.off('transitionend');
10673									$drop_move.css({
10674										'transition-duration': timing + 's'
10675									});
10676									manageVideos($drop_move,false);
10677								});
10678							}
10679						}
10680
10681						stopBounding = requestTimeout(function() {
10682							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10683								var bound = $anim_parent[0].getBoundingClientRect();
10684								$drop_move.css({
10685									left: bound.x * -1,
10686									top: bound.y * -1,
10687								});
10688							}
10689							stoppedScrolling = true;
10690						}, 500);
10691					});
10692				}
10693
10694				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
10695					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
10696
10697				$drop.css({
10698					'transition-duration': timing + 's'
10699				});
10700
10701				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
10702					$trgr.on('mouseenter',function(e){
10703						$row_parent.add($col_parent).addClass('drop-list-loaded');
10704						$list.addClass('drop-hover');
10705
10706						if ( !$tmb.hasClass('drop-active') ) {
10707							$tmbs.removeClass('drop-active');
10708							$tmb.addClass('drop-active');
10709							if ( default_image && !$drop.hasClass('active') ) {
10710								var $prev = $('[data-drop].active', $row_parent);
10711								$prev.css({
10712									'transition-duration': (timing*1.5) + 's'
10713								});
10714								$prev.removeClass('active');
10715								$prev.on('transitionend', function(e){
10716									$prev.off('transitionend');
10717									manageVideos($prev,false);
10718								});
10719							}
10720							$drop.css({
10721								'transition-duration': timing + 's'
10722							});
10723							$drop.off('transitionend');
10724							$drop.addClass('active');
10725							manageVideos($drop, true);
10726						}
10727					})
10728					.on('mouseleave', function(e){
10729						if ( ( default_image && !default_title ) || !default_image ) {
10730							$list.removeClass('drop-hover');
10731							$tmb.removeClass('drop-active');
10732						}
10733						if ( ! default_image ) {
10734							$drop.css({
10735								'transition-duration': (timing*1.5) + 's'
10736							});
10737							$drop.removeClass('active');
10738
10739							$drop.on('transitionend', function(e){
10740								$drop.off('transitionend');
10741								manageVideos($drop,false);
10742							});
10743						}
10744					});
10745
10746					document.addEventListener('visibilitychange', function(){
10747						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
10748							$drop.css({
10749								'transition-duration': '0s'
10750							});
10751							$drop.removeClass('active');
10752							manageVideos($drop, false);
10753						}
10754					});
10755				}
10756			});
10757
10758		});
10759	};
10760
10761	$(window).on('load', function(event) {
10762		imageHover();
10763	});
10764
10765	var drop_wp_animation = function() {
10766		var $postLists = $('.uncode-post-titles');
10767		$postLists.each(function(){
10768			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10769				new Waypoint({
10770					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10771					element: val,
10772					handler: function() {
10773						var element = $(this.element),
10774							parent = element.closest('.tmb'),
10775							currentIndex = parent.index(),
10776							delay = currentIndex,
10777							delayAttr = parseInt(element.attr('data-delay'));
10778						if (isNaN(delayAttr)) delayAttr = 100;
10779						var objTimeout = requestTimeout(function() {
10780							element.addClass('start_animation');
10781
10782							var nextTimeout = requestTimeout(function() {
10783								$('.drop-image-separator', parent).addClass('start_animation');
10784							}, 50);
10785
10786						}, delay * delayAttr);
10787						if (!UNCODE.isUnmodalOpen) {
10788							this.destroy();
10789						}
10790					},
10791					offset: UNCODE.isFullPage ? '100%' : '90%'
10792				})
10793			});
10794		});
10795	}
10796
10797	var runWaypoints_TO,
10798		runWaypoints_delay = 0;
10799
10800	var runWaypoints = function(){
10801		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10802			runWaypoints_delay = 400;
10803		}
10804		clearRequestTimeout(runWaypoints_TO);
10805		runWaypoints_TO = requestTimeout(function() {
10806			drop_wp_animation();
10807		}, runWaypoints_delay);
10808	};
10809	runWaypoints();
10810	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10811	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10812		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10813			// imageHover();
10814			runWaypoints();
10815		});
10816	}
10817};
10818
10819UNCODE.postTable = function() {
10820
10821	var clickRow = function(){
10822		var $postLists = $('.uncode-post-table');
10823
10824		$postLists.each(function(){
10825			var $postList = $(this),
10826				$tmbClicks = $('.tmb.tmb-click-row', $postList);
10827
10828			$tmbClicks.each(function(){
10829				var $tmb = $(this),
10830					$click = $('.table-click-row', $tmb);
10831				$('*:not(.table-click-row)', $tmb).on('click', function(e){
10832					e.preventDefault();
10833					e.stopPropagation();
10834					$click[0].click();
10835					return false;
10836				});
10837			});
10838
10839		})
10840	};
10841
10842	clickRow();
10843
10844	var hoverRow = function(){
10845		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
10846
10847		$postLists.on('mouseenter', function(){
10848			$(this).addClass('post-table-hover');
10849		});
10850		$postLists.on('mouseleave', function(){
10851			$(this).removeClass('post-table-hover');
10852		});
10853	}
10854
10855	hoverRow();
10856
10857	var drop_wp_animation = function() {
10858		var $postLists = $('.uncode-post-table');
10859		$postLists.each(function(){
10860			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10861				new Waypoint({
10862					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10863					element: val,
10864					handler: function() {
10865						var element = $(this.element),
10866							parent = element.closest('.tmb'),
10867							currentIndex = parent.index(),
10868							delay = currentIndex,
10869							delayAttr = parseInt(element.attr('data-delay'));
10870						if (isNaN(delayAttr)) delayAttr = 100;
10871						var objTimeout = requestTimeout(function() {
10872							element.addClass('start_animation');
10873						}, delay * delayAttr);
10874						if (!UNCODE.isUnmodalOpen) {
10875							this.destroy();
10876						}
10877					},
10878					offset: UNCODE.isFullPage ? '100%' : '90%'
10879				})
10880			});
10881		});
10882	}
10883
10884	var runWaypoints_TO,
10885		runWaypoints_delay = 0;
10886
10887	var runWaypoints = function(){
10888		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10889			runWaypoints_delay = 400;
10890		}
10891		clearRequestTimeout(runWaypoints_TO);
10892		runWaypoints_TO = requestTimeout(function() {
10893			drop_wp_animation();
10894		}, runWaypoints_delay);
10895	};
10896	runWaypoints();
10897	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10898	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10899		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10900			runWaypoints();
10901			// clickRow();
10902		});
10903	}
10904};
10905
10906UNCODE.rotatingTxt = function($ctxt) {
10907
10908	if ( $('body').hasClass('compose-mode') ) {
10909		return;
10910	}
10911
10912	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
10913	var setCTA;
10914
10915	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
10916		var $heading = $(this),
10917			// debug = 0,
10918			cycle = 0,
10919			$trgt,
10920			$toMove,
10921			$highl,
10922			$col = $heading.closest('.uncont'),
10923			txt,
10924			arrTxt,
10925			textFadeIn, textFadeOut,
10926			removeWraps;
10927
10928		var defineObjs = function() {
10929			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
10930				var $rtx = $(this),
10931					fx = $rtx.attr('data-fx'),
10932					wait = $rtx.attr('data-wait'),
10933					$prev = $(this).prev().addClass('prev-rotating-start'),
10934					splitToMove = [],
10935					splitArray = [],
10936					lineArray = [],
10937					lineIndex = 0,
10938					lineStart = true,
10939					lineEnd = false,
10940					startSplit = false,
10941					$line_wrap = $rtx.closest('.heading-line-wrap'),
10942					same_line = true,
10943					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
10944					indexRtx = $splits.index($rtx);
10945
10946				fx = typeof fx === 'undefined' ? '' : fx;
10947				wait = typeof wait === 'undefined' ? '' : wait;
10948
10949				$splits.each(function(key, val){
10950					var $split = $(this),
10951						$new_line_wrap = $split.closest('.heading-line-wrap');
10952
10953					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
10954						splitArray.push( $split );
10955					}
10956
10957					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10958						startSplit = false;
10959					}
10960
10961					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10962						splitArray.push( $split );
10963
10964						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
10965							same_line = true;
10966						} else {
10967							same_line = false;
10968						}
10969					}
10970
10971					if ( key == indexRtx ) {
10972						if ( /\S/.test($split.text()) ) {
10973							startSplit = true;
10974							$line_wrap = $split.closest('.heading-line-wrap');
10975							splitArray.push( $split );
10976						} else {
10977							indexRtx++;
10978						}
10979					}
10980
10981					$line_wrap = $new_line_wrap;
10982				});
10983
10984				$toMove = $($.map(splitToMove, function(el){return el.get();}));
10985				$trgt = $($.map(splitArray, function(el){return el.get();}));
10986
10987				if ( same_line ) {
10988					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
10989					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
10990				}
10991
10992				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
10993					$prev.addClass('empty-span-hidden');
10994				}
10995
10996				$highl = $('.heading-text-highlight-inner', $trgt);
10997
10998				$rtx.attr('data-animated', 'true');
10999				if ( cycle == 0 ) {
11000					$( document.body ).trigger('defer-highlights');
11001					cycle++;
11002					defineObjs();
11003					return;
11004				}
11005				cycle++;
11006
11007				txt = $rtx.attr('data-text');
11008				arrTxt = txt.split("|");
11009
11010				textFadeOut($trgt);
11011
11012			});
11013		};
11014
11015		removeWraps = function(){
11016
11017			// if ( debug == 1 ) return;
11018			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
11019			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
11020
11021
11022				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
11023					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
11024
11025				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
11026
11027				$splitFlow.each(function(){
11028					$(this).append($temp_highl);
11029				});
11030
11031				var $line_wrap = $wraps[wrap_k];
11032				var $parent_wrap = $line_wrap.parentNode;
11033				if ( $parent_wrap !== null ) {
11034					while ( $line_wrap.firstChild ) {
11035						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
11036					}
11037					$parent_wrap.removeChild($line_wrap);
11038				}
11039			}
11040			// debug++;
11041			defineObjs();
11042		};
11043
11044		var loop = 0;
11045		textFadeIn = function($trgt){
11046			var word = arrTxt[loop].split(" "),
11047				worsSpan = '',
11048				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11049				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11050				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
11051
11052			for (var w = 0; w < word.length; w++) {
11053				var highl;
11054				if ( $highl.length ) {
11055					highl = $highl[0].outerHTML;
11056				} else {
11057					highl = '';
11058				}
11059
11060				if ( w > 0 ) {
11061					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
11062				}
11063				var charachters = word[w].split('');
11064				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
11065				if ( ! SiteParameters.uncode_has_ligatures ) {
11066					for (var c = 0; c < charachters.length; c++) {
11067						worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
11068					}
11069				} else {
11070					worsSpan += word[w];
11071				}
11072				worsSpan += '</span>' + highl + '</span></span>';
11073			}
11074
11075			if ( $wrap.length && $wrap_inner.length ) {
11076				var words_w = $wrap_inner.outerWidth();
11077				$wrap.css({
11078					width: words_w
11079				});
11080
11081				$highl = $('.heading-text-highlight-inner', $wrap);
11082				$highl.prependTo($wrap);
11083
11084				$wrap_inner.css({
11085					opacity: 0
11086				});
11087
11088				$wrap_inner.html(worsSpan);
11089				$('.heading-text-highlight-inner', $wrap_inner).remove();
11090				words_w = $wrap_inner.innerWidth();
11091
11092				var duration = 0.45;
11093
11094				$heading.removeClass('auto-width');
11095				if ( words_w > $col.width() ) {
11096					$heading.addClass('auto-width');
11097					words_w = 'auto';
11098					duration = 0;
11099				}
11100
11101				$wrap.css({
11102					'width': words_w,
11103					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
11104				});
11105
11106				var $word_inner = $('.split-word-inner', $wrap_inner),
11107					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
11108
11109				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11110
11111				if ( !$target_fx.length ) {
11112					return;
11113				}
11114
11115				gsap.killTweensOf($target_fx);
11116
11117				if ( fx !== 'zoom' ) {
11118					gsap.fromTo( $target_fx, {
11119						y: fx === 'opacity' ? '0%' : '-10%'
11120					},{
11121						delay: duration,
11122						duration: 0.25,
11123						y: '0%',
11124						ease: Circ.easeOut,
11125					});
11126
11127					if ( !$wrap_inner.length ) {
11128						return;
11129					}
11130
11131					gsap.fromTo( $wrap_inner, {
11132						opacity: 0,
11133					},{
11134						delay: duration,
11135						duration: 0.25,
11136						opacity: 1,
11137						ease: Circ.easeOut,
11138						onComplete: function(){
11139							$('> .heading-text-highlight-inner', $wrap).remove();
11140							$wrap_inner.html(worsSpan);
11141							removeWraps();
11142						}
11143					})
11144
11145				} else {
11146					gsap.fromTo( $target_fx, {
11147						transformOrigin: '50%',
11148						opacity: 0,
11149						scale: 0.875,
11150					},{
11151						opacity: 1,
11152						delay: duration,
11153						duration: 0.25,
11154						scale: 1,
11155						ease: Circ.easeOut,
11156						onComplete: function(){
11157							$('> .heading-text-highlight-inner', $wrap).remove();
11158							$wrap_inner.html(worsSpan);
11159							removeWraps();
11160						}
11161					});
11162				}
11163
11164			} else {
11165
11166				if ( !$wrap_inner.length ) {
11167					return;
11168				}
11169
11170				gsap.to( $wrap_inner, {
11171					duration: 0.4,
11172					opacity: 0,
11173					ease: Power1.easeOut,
11174					onComplete: function(){
11175						$wrap_inner.html(worsSpan);
11176						words_w = $wrap_inner.innerWidth();
11177
11178						gsap.to( $wrap_inner, {
11179							duration: 0.2,
11180							opacity: 1,
11181							ease: Power1.easeOut,
11182							onComplete: function(){
11183								$('> .heading-text-highlight-inner', $wrap).remove();
11184								$wrap_inner.html(worsSpan);
11185								removeWraps();
11186							}
11187						})
11188					}
11189				});
11190			}
11191
11192			if ( loop < arrTxt.length-1 ) {
11193				loop++;
11194			} else {
11195				loop = 0;
11196			}
11197
11198		};
11199
11200		textFadeOut = function($trgt){
11201			var $word_inner = $('.split-word-inner', $trgt),
11202				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11203				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11204				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
11205				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
11206
11207			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
11208
11209			var gsap_param = {
11210					delay: wait,
11211					duration: 0.25,
11212					y: fx === '' ? '10%' : '0%',
11213					opacity: 0,
11214					ease: Circ.easeOut,
11215					onStart: function(){
11216						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
11217							$highl = $('.heading-text-highlight-inner', $wrap);
11218							$highl.prependTo($wrap);
11219						}
11220					},
11221					onComplete: textFadeIn,
11222					onCompleteParams: [$trgt]
11223				};
11224
11225			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11226
11227			if ( fx === '' ) {
11228				gsap_param.y = '10%';
11229			} else if ( fx === 'zoom' ) {
11230				gsap_param.scale = '1.045';
11231			}
11232
11233			if ( !$target_fx.length ) {
11234				return;
11235			}
11236
11237			if ( $heading.data('waypoint') !== true ) {
11238				var textInView = new Waypoint.Inview({
11239					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11240					element: $heading[0],
11241					enter: function(direction) {
11242						$heading.data('waypoint',true);
11243						gsap.fromTo( $target_fx, {
11244							transformOrigin: '50%'
11245						}, gsap_param );
11246					}
11247				});
11248			} else {
11249				gsap.fromTo( $target_fx, {
11250					transformOrigin: '50%'
11251				}, gsap_param );
11252			}
11253		};
11254
11255		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11256			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
11257				var $el = model.view.$el,
11258					shortcode = model.attributes.shortcode;
11259
11260				UNCODE.rotatingTxt($el);
11261			});
11262		} else {
11263			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
11264				$heading.on('already-animated', function(){
11265					removeWraps();
11266					window.addEventListener('removeOldLines', function(){
11267						clearRequestTimeout(setCTA);
11268						setCTA = requestTimeout( removeWraps, 150 );
11269					});
11270				});
11271			} else {
11272				$(window).on('load', function(){
11273					removeWraps();
11274					window.addEventListener('removeOldLines', function(){
11275						clearRequestTimeout(setCTA);
11276						setCTA = requestTimeout( removeWraps, 150 );
11277					});
11278				});
11279			}
11280		}
11281	});
11282
11283};
11284
11285UNCODE.verticalText = function() {
11286	$(window).on('menuCanvasOpen', function(){
11287		$('.vertical-text--fixed').fadeOut(500);
11288		$('.horizontal-text--fixed').fadeOut(500);
11289	}).on('menuCanvasClose', function(){
11290		$('.vertical-text--fixed').fadeIn(500);
11291		$('.horizontal-text--fixed').fadeIn(500);
11292	});
11293
11294	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
11295	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
11296	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
11297	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
11298
11299	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
11300		window.addEventListener('scroll', function(e) {
11301			var totalPageHeight = document.body.scrollHeight;
11302			var scrollPoint = window.scrollY + window.innerHeight;
11303
11304			if (window.scrollY > 0) {
11305				showOnTopVerticalTexts.fadeOut();
11306				showOnTopHorizontalTexts.fadeOut();
11307			} else {
11308				showOnTopVerticalTexts.fadeIn();
11309				showOnTopHorizontalTexts.fadeIn();
11310			}
11311
11312			if (scrollPoint >= totalPageHeight) {
11313				hideOnBottomVerticalTexts.fadeOut();
11314				hideOnBottomHorizontalTexts.fadeOut();
11315			} else {
11316				hideOnBottomVerticalTexts.fadeIn();
11317				hideOnBottomHorizontalTexts.fadeIn();
11318			}
11319		}, false);
11320	}
11321};
11322
11323UNCODE.stickyScroll = function( $el ) {
11324	if ( typeof $el === 'undefined' || $el === null ) {
11325		$el = $('body');
11326	}
11327	var checkVisible = function( el, dir ) {
11328		if (typeof jQuery === "function" && el instanceof jQuery) {
11329			el = el[0];
11330		}
11331
11332		var off = 50;
11333		dir = typeof dir=='undefined' ? 'right' : dir;
11334		var rect = el.getBoundingClientRect();
11335
11336		return (
11337			(
11338				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11339				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11340				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
11341			) &&
11342			(
11343				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11344				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11345				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
11346				( rect.right <= window.innerWidth && rect.left >= 0 )
11347			)
11348		);
11349	};
11350
11351	var setItemsRelHeight = function(reset) {
11352		var $_el = $el;
11353		if ( $el.is('.index-scroll') ) {
11354			var $_el = $el.closest('.uncont');
11355		}
11356		// $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
11357		// 	$.each($('.tmb', item), function(index, val) {
11358		// 		if ( reset === true ) {
11359		// 			$(val).css( 'visibility', 'hidden' );
11360		// 		} else {
11361		// 			$(val).css( 'visibility', 'visible' );
11362		// 		}
11363		// 	});
11364		// });
11365		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
11366			$.each($('.tmb', item), function(index, val) {
11367				if ( reset === true ) {
11368					$(val).css( 'visibility', 'hidden' );
11369					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
11370				} else {
11371					var $rowParent = $(item).closest('.row-parent'),
11372						rowRatio = $rowParent.attr('data-height-ratio'),
11373						$rowInner = $(item).closest('.row-child'),
11374						rowRatioInner = $rowInner.attr('data-height'),
11375						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11376						$colContainer = $(item).closest('.uncell'),
11377						$uncont = $(item).closest('.uncont'),
11378						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
11379						safe_heigth = $(item).data('safe-height'),
11380						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
11381						offSet = $(item).offset().top - $uncont.offset().top,
11382						multiplier_h,
11383						data_viewport_h,
11384						body_border = $('.body-borders .top-border').outerHeight() * 2,
11385						remove_menu = $(item).data('vp-menu');
11386
11387					if ( rowRatio === 'full' || rowRatio === '' ) {
11388						rowRatio = 1;
11389					} else {
11390						rowRatio = rowRatio / 100;
11391					}
11392
11393					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
11394						rowRatio = rowRatio;
11395					} else {
11396						rowRatio = rowRatio * rowRatioInner / 100;
11397					}
11398
11399					winHeight = winHeight * rowRatio;
11400
11401					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11402						multiplier_h = parseInt($(item).attr('data-vp-height'));
11403					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
11404						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
11405					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
11406						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
11407					}
11408
11409					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
11410						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
11411						if ( remove_menu === true ) {
11412							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
11413						}
11414						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
11415					} else {
11416						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
11417					}
11418
11419				}
11420			});
11421		});
11422		$('.index-scroll', $_el).each(function(i, item){
11423			var $uncoltable = $(item).closest('.uncoltable'),
11424				$rowParent = $(item).closest('.row-parent'),
11425				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11426				body_border = $('.body-borders .top-border').outerHeight() * 2,
11427				$index_row = $('.index-row', item),
11428				safe_heigth = $index_row.data('safe-height'),
11429				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
11430			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
11431				var data_viewport_h = winHeight - ( paddingRow + body_border );
11432				$uncoltable.css({
11433					'min-height': data_viewport_h
11434				});
11435			} else {
11436				$uncoltable.css({
11437					'min-height': 'auto'
11438				});
11439			}
11440		});
11441
11442	}
11443	setItemsRelHeight();
11444
11445	var $index_scrolls = $('.index-scroll', $el);
11446
11447	$index_scrolls.each(function(key, value){
11448		var $index = $(this),
11449			$parent_row = $index.closest('.vc_row[data-parent]'),
11450			$index_row = $('.index-row', $index),
11451			dir = $index_row.attr('data-direction');
11452		dir = typeof dir === 'undefined' ? 'right' : dir;
11453
11454		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
11455
11456		if ( $('.animate_when_almost_visible', $index).length ) {
11457			$index.addClass('opacity_0').addClass('scroll-refresh-hidden');
11458		}
11459
11460	});
11461
11462	var $horScrolls = $('.unscroll-horizontal', $el);
11463
11464	if ( $horScrolls.length ) {
11465
11466		$('body').addClass('scrolling-trigger');
11467
11468		$horScrolls.each(function(key, value){
11469			var $section = $(this),
11470				$index_scroll = $('.index-scroll', $section),
11471				$index_row = $('.index-row', $index_scroll),
11472				dir = $section.attr('data-direction'),
11473				wrap = $index_row.attr('data-wrap'),
11474				$pinWrap,
11475				$pinTrigger;
11476
11477			dir = typeof dir === 'undefined' ? 'right' : dir;
11478			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
11479			$pinWrap = $('<div class="pin-wrap" />');
11480			if ( SiteParameters.is_frontend_editor ) {
11481				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
11482				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
11483			} else {
11484				if ( wrap === 'column' ) {
11485					$index_scroll.wrapInner( $pinWrap );
11486				} else {
11487					$('> .row', $section).wrap( $pinWrap );
11488				}
11489				$section.wrapInner( $pinTrigger );
11490			}
11491
11492		});
11493
11494		var $pinWraps = $('.pin-wrap', $el);
11495
11496		var horScrollSizes = function(){
11497
11498			$pinWraps.each(function(key, val){
11499				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
11500					$pinTrigger = $pinWrap.closest('.pin-trigger'),
11501					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
11502					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
11503					$boxContainer = $('.box-container'),
11504					box_m = $boxContainer.css('margin-left'),
11505					st_active = true;
11506
11507				var setHorW,
11508				horWidth = function(){
11509					$index_scroll.each(function(){
11510						var $this = $(this),
11511							$index_row = $('.index-row', $this),
11512							$rowContainer = $index_row.closest('.vc_row'),
11513							$rowInner = $index_row.closest('.wpb_row'),
11514							$rowParent = $index_row.closest('.row-parent'),
11515							$tmbs = $('.tmb', $index_row),
11516							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
11517							$uncont = $index_row.closest('.uncont'),
11518							$parent_col = $index_row.closest('.wpb_column'),
11519							col_w = $uncont.width(),
11520							data_lg = parseFloat( $index_row.attr('data-lg') ),
11521							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
11522							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
11523							tmb_w;
11524
11525						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
11526						tmb_w = ( col_w + padding_tmb ) / data_lg;
11527
11528						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
11529							tmb_w = ( col_w + padding_tmb ) / data_sm;
11530						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
11531							tmb_w = ( col_w + padding_tmb ) / data_md;
11532						}
11533
11534						if ( !isNaN(tmb_w) ) {
11535							$tmbs.css({
11536								'width': tmb_w
11537							});
11538						}
11539
11540						$tmbs.css({
11541							'visibility': 'visible'
11542						});
11543
11544					});
11545				};
11546
11547				horWidth();
11548				clearRequestTimeout(setHorW);
11549				setHorW = requestTimeout( function(){
11550					setItemsRelHeight();
11551					horWidth();
11552				}, 100 );
11553
11554				if ( SiteParameters.is_frontend_editor ) {
11555					return;
11556				}
11557
11558				var $vmenu = $('body.vmenu .vmenu-container'),
11559					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
11560					winWidth = window.innerWidth - vmenuW,
11561					$tmb = $('.tmb', $index_scroll).eq(0),
11562					paddingRight = parseFloat( $tmb.css('padding-right') ),
11563					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_
11563scroll.width() + paddingRight ) ),
11564					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
11565					scroll_anim;
11566
11567				if ( $('body').hasClass('rtl') ) {
11568					if ( dir === 'left' ) {
11569						scroll_anim = gsap.fromTo( $pinWrap, {
11570							x: stickyScrollLength
11571						},{
11572							x: 0,
11573							ease: "none"
11574						});
11575					} else {
11576						scroll_anim = gsap.fromTo( $pinWrap, {
11577							x: 0
11578						},{
11579							x: stickyScrollLength,
11580							ease: "none"
11581						});
11582					}
11583				} else {
11584					if ( dir === 'left' ) {
11585						scroll_anim = gsap.fromTo( $pinWrap, {
11586							x: -stickyScrollLength
11587						},{
11588							x: 0,
11589							ease: "none"
11590						});
11591					} else {
11592						scroll_anim = gsap.fromTo( $pinWrap, {
11593							x: 0
11594						},{
11595							x: -stickyScrollLength,
11596							ease: "none"
11597						});
11598					}
11599				}
11600
11601				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
11602					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
11603				}
11604
11605				var animationIncrease;
11606
11607				var checkForAnimations = function(){
11608					animationIncrease = 0
11609					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11610						var _this = this;
11611						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
11612							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11613							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11614							requestTimeout(function() {
11615								$(_this).addClass('start_animation');
11616							}, delayAttr + animationIncrease);
11617							animationIncrease += 150;
11618						}
11619						$(_this).on([
11620							'webkitAnimationEnd',
11621							'mozAnimationEnd',
11622							'MSAnimationEnd',
11623							'oanimationend',
11624							'animationend'
11625						].join(' '), function(e) {
11626							$(e.currentTarget).removeClass('animate_when_almost_visible');
11627						});
11628					});
11629
11630					var batchTime = 0;
11631
11632					var resetBatch = function(){
11633						batchTime = 0;
11634					}
11635
11636					if (ScrollTrigger.isScrolling()) {
11637						resetBatch();
11638					}
11639					
11640					$('.tmb-mask-reveal', $pinTrigger).each(function(){
11641						var _this = this,
11642							$this = $(_this),
11643							$inside = $('.t-inside', $this),
11644							delay = parseFloat( $inside.attr('data-delay') ),
11645							speed = parseFloat( $inside.attr('data-speed') ),
11646							easing = $inside.attr('data-easing'),
11647							bgDelay = parseFloat( $inside.attr('data-bg-delay') );
11648
11649						delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
11650						speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
11651						easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
11652						bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
11653
11654						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) {
11655							$this.addClass('tmb-mask-init');
11656							if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) {
11657								gsap.to($('.t-entry-visual-tc', $this), speed, {
11658									clipPath: 'inset(0% 0% 0% 0%)',
11659									delay: delay + batchTime,
11660									ease: easing,
11661								});
11662								gsap.to($('.t-entry-visual-cont', $this), speed, {
11663									clipPath: 'inset(0% 0% 0% 0%)',
11664									scale: 1,
11665									delay: delay + batchTime + (speed*bgDelay),
11666									ease: easing,
11667									onComplete: resetBatch,
11668								});
11669							} else {
11670								gsap.to($('.t-entry-visual-cont', $this), speed, {
11671									clipPath: 'inset(0% 0% 0% 0%)',
11672									scale: 1,
11673									delay: delay + batchTime,
11674									ease: easing,
11675									onComplete: resetBatch,
11676								});
11677							}
11678							batchTime += 0.1;
11679						}
11680					});
11681				
11682				};
11683				checkForAnimations();
11684
11685				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
11686				var start = 0;
11687
11688				var horST = ScrollTrigger.create({
11689					id: "stickySectionScrolling" + key,
11690					scrub: true,
11691					trigger: $pinTrigger[0],
11692					pin: true,
11693					anticipatePin: 1,
11694					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
11695					end: function() { return "+="+stickyScrollLength; },
11696					animation: scroll_anim,
11697					ease: Sine.easeOut,
11698					onUpdate: checkForAnimations,
11699					invalidateOnRefresh: true,
11700					onEnter: function(){
11701						$pinTrigger.addClass('enter-st');
11702					},
11703					onEnterBack: function(){
11704						$pinTrigger.addClass('enter-st');
11705					},
11706					onLeave: function(){
11707						$pinTrigger.removeClass('enter-st');
11708					},
11709					onLeaveBack: function(){
11710						$pinTrigger.removeClass('enter-st');
11711					}
11712				});
11713
11714				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
11715				window.dispatchEvent(new CustomEvent('boxResized'));
11716
11717				var testSecondTrigger = function(){
11718					animationIncrease = 0
11719					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11720						var _this = this;
11721						if ( checkVisible(_this) ) {
11722							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11723							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11724							requestTimeout(function() {
11725								$(_this).addClass('start_animation');
11726							}, delayAttr + animationIncrease);
11727							animationIncrease += 150;
11728						}
11729					});
11730
11731				};
11732
11733				var verST = ScrollTrigger.create({
11734					id: "verticalSectionScrolling" + key,
11735					trigger: $pinTrigger[0],
11736					start: "top center",
11737					end: function() { return "+="+UNCODE.wheight; },
11738					onUpdate: testSecondTrigger,
11739					invalidateOnRefresh: true
11740				});
11741
11742				var setCTA,
11743
11744				dis_enable_ST = function(){
11745					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
11746						horST.kill();
11747						verST.kill();
11748						$pinTrigger.addClass('disabled');
11749						st_active = false;
11750					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
11751						horST.kill();
11752						verST.kill();
11753						$pinTrigger.addClass('disabled');
11754						st_active = false;
11755					}
11756				};
11757
11758				$(window).on('resize load', function() {
11759					clearRequestTimeout(setCTA);
11760					setCTA = requestTimeout(function() {
11761						dis_enable_ST();
11762						checkForAnimations();
11763					}, 500);
11764				});
11765
11766			});
11767		};
11768
11769		$(window).on( 'load', function(){
11770			horScrollSizes();
11771		});
11772		var setResize,
11773			setReLayout,
11774			doubleResize = true;
11775		$(window).on( 'load', function(){
11776			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
11777				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11778				Array.prototype.forEach.call($row_inners, function(el) {
11779					el.style.height = '';
11780					el.style.marginBottom = '';
11781				});
11782				setItemsRelHeight();
11783				horScrollSizes();
11784				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11785					$(document).trigger('uncode-scrolltrigger-refresh');
11786				}
11787			}
11788			var carousel = document.querySelector(".owl-carousel"),
11789				grid = document.querySelector(".isotope-container"),
11790				stickyAll = document.querySelectorAll(".index-scroll");
11791
11792			if ( stickyAll.length ) {
11793				var sticky = stickyAll[(stickyAll.length-1)];
11794			}
11795
11796			if ( typeof sticky !== "undefined" ) {
11797
11798				if ( typeof carousel !== "undefined" && carousel !== null ) {
11799					var carousel_position = sticky.compareDocumentPosition(carousel);
11800				}
11801				if ( typeof grid !== "undefined" && grid !== null ) {
11802					var grid_position = sticky.compareDocumentPosition(grid);
11803				}
11804
11805				if ( carousel_position === 2 || grid_position === 2 ) {
11806					setTimeout(function(){
11807						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11808							$(document).trigger('uncode-scrolltrigger-refresh');
11809						}
11810					}, 500);
11811				}
11812
11813			}
11814			
11815		});
11816        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
11817            android = /Android/.test(navigator.userAgent) && !window.MSStream;
11818		$(window).on( 'resize orientationchange', function(e){
11819			if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
11820				return;
11821			}
11822			setItemsRelHeight(true);
11823			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11824			Array.prototype.forEach.call($row_inners, function(el) {
11825				el.style.height = '';
11826				el.style.marginBottom = '';
11827			});
11828			clearRequestTimeout(setResize);
11829			setResize = requestTimeout( function(){
11830				setItemsRelHeight();
11831				horScrollSizes();
11832				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11833					$(document).trigger('uncode-scrolltrigger-refresh');
11834				}
11835				if ( doubleResize === true ) {
11836					window.dispatchEvent(new Event('resize'));
11837					doubleResize = false;
11838				} else {
11839					doubleResize = true;
11840				}
11841				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
11842			}, 100 );
11843		});
11844
11845		var show_pins = function(){
11846			$('.index-scroll').css({'opacity':'1'});
11847		};
11848		ScrollTrigger.addEventListener("refresh", show_pins);
11849		$(window).on( 'uncode.re-layout', function(){
11850			//$('.index-scroll').css({'opacity':'0'});
11851			$('.pin-spacer').each(function(){
11852				var space_h = $(this).outerHeight(),
11853					$row = $(this).closest('.row-container');
11854				$row.css({
11855					'height': space_h,
11856					'overflow': 'hidden'
11857				});
11858			});
11859			if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11860				ScrollTrigger.refresh(true);
11861			}
11862			clearRequestTimeout(setReLayout);
11863			setReLayout = requestTimeout( function(){
11864				$('.row-container').each(function(){
11865					$(this).css({
11866						'height': '',
11867						'overflow': ''
11868					});
11869				});
11870			}, 1000);
11871		});
11872	}
11873
11874};
11875
11876UNCODE.stickyTrigger = function( $el ) {
11877    if ( SiteParameters.is_frontend_editor ) {
11878        return false;
11879    }
11880
11881    var stickyTrigger = function(){
11882        var stickyTrick = $('.sticky-trigger').each(function(){
11883            var $sticky = $(this),
11884                $inside = $('> div', $sticky),
11885                insideH = $inside.outerHeight(),
11886                $row = $sticky.closest('.vc_row'),
11887                $uncont = $sticky.closest('.uncont'),
11888                rowBottom,
11889                uncontBottom,
11890                diffBottom;
11891
11892            ScrollTrigger.create({
11893                trigger: $sticky,
11894                start: function(){ return "top center-=" + insideH/2; },
11895                endTrigger: $row,
11896                end:  function(){
11897                    rowBottom = $row.offset().top + $row.outerHeight();
11898                    uncontBottom = $uncont.offset().top + $uncont.outerHeight();
11899                    diffBottom = rowBottom - uncontBottom;
11900                    return "bottom center+=" + ( insideH/2 + diffBottom );
11901                },
11902                anticipatePin: true,
11903                pin: true,
11904                pinSpacing: false,
11905                scrub: true,
11906                invalidateOnRefresh: true,
11907            });
11908
11909        });
11910    },
11911    setResizeSticky;
11912
11913    $(window).on( 'load', function(){
11914        stickyTrigger();
11915        var carousel = document.querySelector(".owl-carousel"),
11916            grid = document.querySelector(".isotope-container"),
11917            stickyAll = document.querySelectorAll(".sticky-trigger");
11918
11919        if ( stickyAll.length ) {
11920            var sticky = stickyAll[(stickyAll.length-1)];
11921        }
11922
11923        if ( typeof sticky !== "undefined" ) {
11924
11925            if ( typeof carousel !== "undefined" && carousel !== null ) {
11926                var carousel_position = sticky.compareDocumentPosition(carousel);
11927            }
11928            if ( typeof grid !== "undefined" && grid !== null ) {
11929                var grid_position = sticky.compareDocumentPosition(grid);
11930            }
11931
11932            if ( carousel_position === 2 || grid_position === 2 ) {
11933                setTimeout(function(){
11934                    $(document).trigger('uncode-scrolltrigger-refresh');
11935                }, 500);
11936            }
11937
11938        }
11939    });
11940
11941    var oldW = UNCODE.wwidth;
11942    $(window).on( 'resize uncode.re-layout', function(e){
11943        clearRequestTimeout(setResizeSticky);
11944        if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
11945            return;
11946        } else {
11947            oldW = UNCODE.wwidth;
11948        }
11949        setResizeSticky = requestTimeout( function(){
11950            stickyTrigger();
11951            $(document).trigger('uncode-scrolltrigger-refresh');
11952        }, 1000 );
11953    });
11954
11955    
11956};
11957
11958UNCODE.areaTextReveal = function() {
11959    if ( ! $('.text-reveal, .scroll-trigger-el').length ) {
11960        return;
11961    }
11962	if ( ! SiteParameters.is_frontend_editor ) {
11963        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
11964            android = /Android/.test(navigator.userAgent) && !window.MSStream,
11965            prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
11966            prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
11967                document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
11968            firstObs = true,
11969            isMobileUsing = false;
11970
11971        var observer = new ResizeObserver(function(){
11972            var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
11973                newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
11974                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
11975                set = false;
11976            if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
11977                set = true;
11978                prevW = newW;
11979            } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
11980                set = true;
11981                prevH = newH;
11982            }
11983            if ( set || firstObs ) {
11984                window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe'));
11985                firstObs = false;
11986            }
11987        }).observe(document.body);
11988
11989        if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
11990            window.scrollTo = function() {
11991                return;
11992            };
11993            isMobileUsing = true;
11994
11995            $('html, body').css({
11996                'overscroll-behavior': 'none'
11997            });
11998        }
11999
12000        var setTriggerObserve;
12001
12002        ScrollTrigger.observe({
12003            trigger: 'body',
12004            type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
12005            onUp: function() { ScrollTrigger.update(); },
12006        });
12007    }
12008
12009    var textReveal = function(){
12010
12011        if ( SiteParameters.is_frontend_editor ) {
12012            return;
12013        }
12014
12015        var setTxtReveal,
12016            txtTrggrStart = false;
12017
12018        function headingReveal($sel){
12019            txtTrggrStart = true;
12020            $('.text-reveal', $sel).each(function(val, key){
12021                var $txtReveal = $(this).attr('data-init-reveal', true),
12022                    $trigger = $txtReveal,
12023                    $rowParent = $txtReveal.closest('.row-container[data-parent]'),
12024                    hReveal = $txtReveal.outerHeight(),
12025                    $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'),
12026                    $sticky = $txtReveal.closest('.sticky-element'),
12027                    dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
12028                    dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
12029                    dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')),
12030                    $lines = $('.heading-line-wrap', $txtReveal),
12031                    $words = $('.split-word-inner', $txtReveal),
12032                    $chars = $('.split-char', $txtReveal),
12033                    $elToReveal = $words;
12034
12035                if ( $pin.length ) {
12036                    return;
12037                } else if ( $sticky.length ) {
12038                    hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop);
12039                    $trigger = $sticky.parent();
12040                }
12041
12042                if ( dataReveal === 'chars' ) {
12043                    $elToReveal = $chars;
12044                } else if ( dataReveal === 'lines' ) {
12045                    $elToReveal = $lines;
12046                }
12047                
12048                var tl = gsap.timeline({
12049                    scrollTrigger: {
12050                        trigger: $trigger,
12051                        start: "top +=" + (window.innerHeight/100*dataTop) + "px",
12052                        end: "+=" + hReveal + "px",
12053                        id: "txt_reveal_" + key,
12054                        scrub: true,
12055                    }
12056                });
12057                gsap.set(
12058                    $elToReveal, {
12059                        opacity: dataRevealOpacity,
12060                    }
12061                )
12062                tl.fromTo($elToReveal, {
12063                    opacity: dataRevealOpacity,
12064                    duration: 1,
12065                }, {
12066                    opacity: 1,
12067                    stagger: 0.05,
12068                    duration: 1,
12069
12070                });
12071                $(window).on('uncode.tl-refresh', function(){
12072                    if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
12073                        tl.scrollTrigger.refresh();
12074                    }
12075                });
12076
12077                $rowParent.one( 'uncodeWordLines', function(){
12078                    clearRequestTimeout(setTxtReveal);
12079                    setTxtReveal = requestTimeout( function(){
12080                        gsap.set($elToReveal, {clearProps: true});
12081                        tl.kill(true);
12082                        if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) {
12083                            ScrollTrigger.getById("txt_reveal_" + key).kill(true);
12084                        }
12085                        headingReveal($sel)
12086                    }, 100);
12087                });
12088
12089            });
12090        };
12091
12092        window.addEventListener("load", function (e) {
12093            if (!txtTrggrStart) {
12094                headingReveal($("body"));
12095                $(window).trigger("resize");
12096            }
12097        });
12098
12099        $('.row-container[data-parent]').each(function(){
12100            if (!txtTrggrStart) {
12101                var $this = $(this);
12102                $this.on('uncodeWordLines', function(){
12103                    headingReveal($this);
12104                });
12105            }
12106        });
12107
12108        $(window).on('uncode-sticky-trigger-observe', function(e){
12109            clearRequestTimeout(setTriggerObserve);
12110            setTriggerObserve = requestTimeout( function(){
12111                $(window).trigger('uncode.tl-refresh');
12112            }, 2000 );
12113        });
12114    
12115    };
12116    textReveal();
12117
12118    var areaReveal = function(){
12119        if ( SiteParameters.is_frontend_editor ) {
12120            return;
12121        }
12122
12123        $('.scroll-trigger-el').each(function(){
12124            var $scrollTrgrEl = $(this),
12125                $row = $('> .row', $scrollTrgrEl),
12126                $row_in = $('> .row-inner', $row),
12127                cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length,
12128                stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows',
12129                animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes',
12130                stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false,
12131                $animateTrgrEl = $scrollTrgrEl,
12132                noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes',
12133                noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'),
12134                els = $scrollTrgrEl.attr('data-anim-els'),
12135                sticky = $scrollTrgrEl.attr('data-anim-sticky'),
12136                noSpace = $scrollTrgrEl.attr('data-anim-no-space'),
12137                state = $scrollTrgrEl.attr('data-anim-state'),
12138                target = $scrollTrgrEl.attr('data-anim-target'),
12139                origin = $scrollTrgrEl.attr('data-anim-origin'),
12140                mask = $scrollTrgrEl.attr('data-anim-mask'),
12141                _scale = $scrollTrgrEl.attr('data-anim-scale'),
12142                stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes',
12143                opacity = $scrollTrgrEl.attr('data-anim-opacity'),
12144                radius = $scrollTrgrEl.attr('data-anim-radius'),
12145                radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'),
12146                clip_path = $scrollTrgrEl.attr('data-clip-path'),
12147                animation_x = $scrollTrgrEl.attr('data-anim-x'),
12148                animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'),
12149                animation_y = $scrollTrgrEl.attr('data-anim-y'),
12150                blur = $scrollTrgrEl.attr('data-anim-blur'),
12151                perspective = $scrollTrgrEl.attr('data-anim-perspective'),			
12152                rotate = $scrollTrgrEl.attr('data-anim-rotate'),	
12153                rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'),
12154                topBottom = $scrollTrgrEl.attr('data-anim-start'),	
12155                offTop = $scrollTrgrEl.attr('data-anim-top'),
12156                offBottom = $scrollTrgrEl.attr('data-anim-bottom'),
12157                safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0,
12158                animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'),
12159                easeOut = $scrollTrgrEl.attr('data-anim-ease'),
12160                offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'),
12161                stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards,
12162                $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(),
12163                setTxtReveal,
12164                txtTrggrStart = false,
12165                alreadyareaAnimateScrollTl = false;
12166    
12167            _scale = _scale === '' ? 0 : parseFloat( _scale );
12168            perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001;	
12169            offTop = offTop === '' ? 0 : parseFloat( offTop );
12170            offBottom = offBottom === '' ? 0 : parseFloat( offBottom );
12171            offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard );
12172
12173            function areaAnimateScrollTl($el, id, last) {
12174                alreadyareaAnimateScrollTl = true;
12175
12176                var pTop = parseFloat( $row.css('padding-top') ),
12177                    innerGap = pTop + offSetCard * id,
12178                    scale = _scale;
12179
12180                if ( isMobileUsing ) {
12181                    innerGap = 0;
12182                }
12183
12184                if ( stepScale ) {
12185                    if ( _scale < 100 ) {
12186                        scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) );
12187                    }
12188                }
12189
12190                if ( els === 'content' ) {
12191                    $animateTrgrEl = $('> .row', $scrollTrgrEl);
12192                } else if ( els === 'bg' ) {
12193                    $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl);
12194                } else {
12195                    $animateTrgrEl = $el;
12196                }
12197
12198                if ( rotate_alt === 'yes') {
12199                    rotate *= -1;
12200                    perspective *= -1;
12201                }
12202                
12203                if ( animation_x_alt === 'yes') {
12204                    animation_x *= -1;
12205                }
12206
12207                var $parentDiv = $el.closest('div[data-sticky]');
12208
12209                var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px";
12210
12211                var scrllTrggr = {
12212                    trigger: $parentDiv,
12213                    end: function(){
12214                        return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom)))
12215                    },
12216                    start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
12217                    pin: sticky === 'yes' || stickyCards ? true : false,
12218                    pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0),
12219                    scrub: true,
12220                    id: 'sticky_' + id,
12221                    anticipatePin: 1,
12222                    invalidateOnRefresh: true,
12223                    // markers: {
12224                    //     indent: 150 * id
12225                    // },
12226                    onToggle: function(){
12227                        $scrollTrgrEl.attr('data-revealed', true);
12228                    },
12229                };
12230
12231                if ( !stickyLast && state === 'end' ) {
12232                    last = false;
12233                } 
12234
12235                if ( stickyCards ) {
12236                    if ( state !== 'end' ) {
12237                        if ( animation_rows_start === 'center' ) {
12238                            scrllTrggr.start = "center center";
12239                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight);
12240                        } else if ( animation_rows_start === 'bottom' ) {
12241                            if ( stickyOpts !== 'no' ) {
12242                                scrllTrggr.start = "bottom bottom";
12243                                scrllTrggr.end = "bottom bottom";
12244                            }
12245                        } else {
12246                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2);
12247                        } 
12248                        if ( stickyOpts === 'no' ) {
12249                            scrllTrggr.endTrigger = $el;
12250                            scrllTrggr.end = "+=100%";
12251                        } else {
12252                            scrllTrggr.endTrigger = $row;
12253                        }
12254                    } else {
12255                        if ( animation_rows_start === 'center' ) {
12256                            scrllTrggr.start = "center center";
12257                        } else if ( animation_rows_start === 'bottom' ) {
12258                            scrllTrggr.start = "bottom bottom";
12259                        } 
12260                        if ( stickyOpts !== 'no' ) {
12261                            scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1));
12262                            scrllTrggr.endTrigger = $lastEl;
12263                        } else {
12264                            scrllTrggr.end = "bottom bottom";
12265                        }
12266                    }
12267                }
12268                
12269                var tl = gsap.timeline({
12270                    scrollTrigger: scrllTrggr
12271                });
12272
12273                // var mark = last ? {
12274                //         startColor:"blue",
12275                //         endColor:"orange",
12276                //     } : false;
12277
12278                if ( !stickyCards ) {
12279                    var tlConds = tl;
12280                } else {
12281                    var scrllTrggrConds = {
12282                        trigger: $parentDiv,
12283                        end: function(){
12284                            return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom)))
12285                        }, 
12286                        pin: (state === 'end' && last),
12287                        pinSpacing: false,
12288                        scrub: true,
12289                        id: 'card_' + id,
12290                        invalidateOnRefresh: true,
12291                        // markers: true,
12292                    };
12293                    if ( stickyCards ) {
12294                        if ( state !== 'end' ) {
12295                            if ( stickyOpts === '' ) {
12296                                scrllTrggrConds.end = "bottom bottom-=100%";
12297                                scrllTrggrConds.endTrigger = $row_in;
12298                            }
12299
12300                            if ( animation_rows_start === 'bottom' ) {
12301                                if ( stickyOpts !== 'no') {
12302                                    scrllTrggrConds.start = "top top+=" + window.innerHeight;
12303                                    scrllTrggrConds.end = "bottom bottom";
12304                                }
12305                            } else if ( animation_rows_start === 'center' ) {
12306                                scrllTrggrConds.start =  "center center";
12307                            } else {
12308                                scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12309                            }
12310                            
12311                        } else {
12312                            if ( stickyOpts === '' ) {
12313                                if ( animLast ) {
12314                                    scrllTrggrConds.end = "bottom bottom-=100%";
12315                                } else {
12316                                    scrllTrggrConds.end = "bottom bottom";
12317                                }
12318                                scrllTrggrConds.endTrigger = $lastEl;
12319                            }
12320
12321                            if ( animation_rows_start === 'bottom' && stickyOpts !== 'no' ) {
12322                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12323                                    scrllTrggrConds.start = "bottom bottom";
12324                                } else {
12325                                    scrllTrggrConds.start = "top top+=" + $el.outerHeight();
12326                                }
12327                            } else if ( animation_rows_start === 'center' ) {
12328                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12329                                    scrllTrggrConds.start =  "center center";
12330                                } else {
12331                                scrllTrggrConds.start =  "top+=" + ($el.outerHeight()/2) + " top+=" 
12331+ window.innerHeight/2;
12332                                }
12333                            } else {
12334                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12335                                    scrllTrggrConds.start = "top top";
12336                                } else {
12337                                    scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12338                                }
12339                            }
12340
12341                        }
12342
12343                    } else {
12344                        scrllTrggrConds.start =  start_topBottom;
12345                    }
12346
12347                    var tlConds = gsap.timeline({
12348                        scrollTrigger: scrllTrggrConds
12349                    });
12350                }
12351
12352                if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) {
12353                    if ( target === 'mask' ) {
12354                        if ( state !== 'end' ) {
12355                            if ( mask === 'auto' ) {
12356                                gsap.set(
12357                                    $animateTrgrEl, {
12358                                        clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12359                                        opacity: parseFloat(opacity)/100,
12360                                        filter: 'blur(' + blur + 'px)',
12361                                        visibility: 'visible',
12362                                    }
12363                                )
12364                                tlConds.fromTo($animateTrgrEl, {
12365                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12366                                    opacity: parseFloat(opacity)/100,
12367                                    filter: 'blur(' + blur + 'px)',
12368                                    duration: 1,
12369                                }, {
12370                                    opacity: 1,
12371                                    clipPath: 'inset(0% 0px round 0' + radiu
12371s_unit + ')',
12372                                    filter: 'blur(0px)',
12373                                    duration: 1,
12374                                    ease: easeOut,
12375                                    //delay: 0.1
12376                                });	
12377                            } else {
12378                                tlConds.fromTo($animateTrgrEl, {
12379                                    opacity: parseFloat(opacity)/100,
12380                                    clipPath: clip_path,
12381                                    filter: 'blur(' + blur + 'px)',
12382                                    duration: 1,
12383                                }, {
12384                                    opacity: 1,
12385                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12386                                    filter: 'blur(0px)',
12387                                    duration: 1,
12388                                    ease: easeOut,
12389                                    //delay: 0.1
12390                                });	
12391                            }
12392                        } else {
12393                            if ( mask === 'auto' ) {
12394                                tlConds.fromTo($animateTrgrEl, {
12395                                    opacity: 1,
12396                                    clipPath: 'inset(0% 0px round 0' + radiu
12396s_unit + ')',
12397                                    filter: 'blur(0px)',
12398                                    duration: 1,
12399                                },{
12400                                    opacity: parseFloat(opacity)/100,
12401                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12402                                    filter: 'blur(' + blur + 'px)',
12403                                    ease: easeOut,
12404                                    duration: 1,
12405                                    //delay: 0.1
12406                                });	
12407                            } else {
12408                                tlConds.fromTo($animateTrgrEl, {
12409                                    opacity: 1,
12410                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12411                                    filter: 'blur(0px)',
12412                                    duration: 1,
12413                                },{
12414                                    opacity: parseFloat(opacity)/100,
12415                                    clipPath: clip_path,
12416                                    filter: 'blur(' + blur + 'px)',
12417                                    duration: 1,
12418                                    ease: easeOut,
12419                                    //delay: 0.1
12420                                });	
12421                            }
12422                        }
12423                    } else {
12424                        if ( state !== 'end' ) {
12425                            if ( scale === 'auto' ) {
12426                                if ( radius ) {
12427                                    gsap.set(
12428                                        $animateTrgrEl, {
12429                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12430                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12431                                            x: animation_x + 'vw',
12432                                            y: animation_y + 'vh',
12433                                            filter: 'blur(' + blur + 'px)',
12434                                            rotation: rotate,
12435                                            rotationX: rotate == 0 ? perspective : 0,
12436                                            transformPerspective: '100vw',
12437                                            opacity: parseFloat(opacity)/100,
12438                                            transformOrigin: origin,
12439                                            borderRadius: radius + radius_unit,
12440                                            visibility: 'visible',
12441                                        }
12442                                    )
12443                                    tlConds.fromTo($animateTrgrEl, {
12444                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12445                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12446                                        x: animation_x + 'vw',
12447                                        y: animation_y + 'vh',
12448                                        filter: 'blur(' + blur + 'px)',
12449                                        rotation: rotate,
12450                                        rotationX: rotate == 0 ? perspective : 0,
12451                                        transformPerspective: '100vw',
12452                                        opacity: parseFloat(opacity)/100,
12453                                        borderRadius: radius + radius_unit,
12454                                        transformOrigin: origin,
12455                                        duration: 1,
12456                                    }, {
12457                                        scaleX: 1,
12458                                        scaleY: 1,
12459                                        x: 0,
12460                                        y: 0,
12461                                        filter: 'blur(0px)',
12462                                        rotation: 0,
12463                                        rotationX: 0,
12464                                        opacity: 1,
12465                                        borderRadius: 0 + radius_unit,
12466                                        transformOrigin: origin,
12467                                        duration: 1,
12468                                        ease: easeOut,
12469                                        //delay: 0.1
12470                                    });	
12471                                } else {
12472                                    gsap.set(
12473                                        $animateTrgrEl, {
12474                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12475                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12476                                            x: animation_x + 'vw',
12477                                            y: animation_y + 'vh',
12478                                            filter: 'blur(' + blur + 'px)',
12479                                            rotation: rotate,
12480                                            rotationX: rotate == 0 ? perspective : 0,
12481                                            transformPerspective: '100vw',
12482                                            opacity: parseFloat(opacity)/100,
12483                                            transformOrigin: origin,
12484                                            visibility: 'visible',
12485                                        }
12486                                    )
12487                                    tlConds.fromTo($animateTrgrEl, {
12488                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12489                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12490                                        x: animation_x + 'vw',
12491                                        y: animation_y + 'vh',
12492                                        filter: 'blur(' + blur + 'px)',
12493                                        rotation: rotate,
12494                                        rotationX: rotate == 0 ? perspective : 0,
12495                                        transformPerspective: '100vw',
12496                                        opacity: parseFloat(opacity)/100,
12497                                        transformOrigin: origin,
12498                                        duration: 1,
12499                                    }, {
12500                                        scaleX: 1,
12501                                        scaleY: 1,
12502                                        x: 0,
12503                                        y: 0,
12504                                        filter: 'blur(0px)',
12505                                        rotation: 0,
12506                                        rotationX: 0,
12507                                        opacity: 1,
12508                                        transformOrigin: origin,
12509                                        duration: 1,
12510                                        ease: easeOut,
12511                                        //delay: 0.1
12512                                    });	
12513                                }
12514                            } else {
12515                                if ( radius ) {
12516                                    gsap.set(
12517                                        $animateTrgrEl, {
12518                                            scaleX: parseFloat( scale ) / 100,
12519                                            scaleY: parseFloat( scale ) / 100,
12520                                            opacity: parseFloat(opacity)/100,
12521                                            x: animation_x + 'vw',
12522                                            y: animation_y + 'vh',
12523                                            filter: 'blur(' + blur + 'px)',
12524                                            rotation: rotate,
12525                                            rotationX: rotate == 0 ? perspective : 0,
12526                                            transformPerspective: '100vw',
12527                                            transformOrigin: origin,
12528                                            borderRadius: radius + radius_unit,
12529                                            visibility: 'visible',
12530                                        }
12531                                    )
12532                                    tlConds.fromTo($animateTrgrEl, {
12533                                        scaleX: parseFloat( scale ) / 100,
12534                                        scaleY: parseFloat( scale ) / 100,
12535                                        opacity: parseFloat(opacity)/100,
12536                                        x: animation_x + 'vw',
12537                                        y: animation_y + 'vh',
12538                                        filter: 'blur(' + blur + 'px)',
12539                                        rotation: rotate,
12540                                        rotationX: rotate == 0 ? perspective : 0,
12541                                        transformPerspective: '100vw',
12542                                        borderRadius: radius + radius_unit,
12543                                        transformOrigin: origin,
12544                                        duration: 1,
12545                                    }, {
12546                                        scaleX: 1,
12547                                        scaleY: 1,
12548                                        opacity: 1,
12549                                        x: 0,
12550                                        y: 0,
12551                                        filter: 'blur(0px)',
12552                                        rotation: 0,
12553                                        rotationX: 0,
12554                                        transformOrigin: origin,
12555                                        ease: easeOut,
12556                                        duration: 1,
12557                                        borderRadius: 0 + radius_unit,
12558                                        //delay: 0.1
12559                                    });	
12560                                } else {
12561                                    gsap.set(
12562                                        $animateTrgrEl, {
12563                                            scaleX: parseFloat( scale ) / 100,
12564                                            scaleY: parseFloat( scale ) / 100,
12565                                            opacity: parseFloat(opacity)/100,
12566                                            x: animation_x + 'vw',
12567                                            y: animation_y + 'vh',
12568                                            filter: 'blur(' + blur + 'px)',
12569                                            rotation: rotate,
12570                                            rotationX: rotate == 0 ? perspective : 0,
12571                                            transformPerspective: '100vw',
12572                                            transformOrigin: origin,
12573                                            visibility: 'visible',
12574                                        }
12575                                    )
12576                                    tlConds.fromTo($animateTrgrEl, {
12577                                        scaleX: parseFloat( scale ) / 100,
12578                                        scaleY: parseFloat( scale ) / 100,
12579                                        opacity: parseFloat(opacity)/100,
12580                                        x: animation_x + 'vw',
12581                                        y: animation_y + 'vh',
12582                                        filter: 'blur(' + blur + 'px)',
12583                                        rotation: rotate,
12584                                        rotationX: rotate == 0 ? perspective : 0,
12585                                        transformPerspective: '100vw',
12586                                        transformOrigin: origin,
12587                                        duration: 1,
12588                                    }, {
12589                                        scaleX: 1,
12590                                        scaleY: 1,
12591                                        opacity: 1,
12592                                        x: 0,
12593                                        y: 0,
12594                                        filter: 'blur(0px)',
12595                                        rotation: 0,
12596                                        rotationX: 0,
12597                                        transformOrigin: origin,
12598                                        duration: 1,
12599                                        ease: easeOut,
12600                                        //delay: 0.1
12601                                    });
12602                                }
12603                            }
12604                        } else {
12605                            if ( scale === 'auto' ) {
12606                                tlConds.fromTo($animateTrgrEl, {
12607                                    scaleX: 1,
12608                                    scaleY: 1,
12609                                    opacity: 1,
12610                                    x: 0,
12611                                    y: 0,
12612                                    filter: 'blur(0px)',
12613                                    rotation: 0,
12614                                    rotationX: 0,
12615                                    transformOrigin: origin,
12616                                    duration: 1,
12617                                }, {
12618                                    scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12619                                    scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12620                                    opacity: parseFloat(opacity)/100,
12621                                    x: animation_x + 'vw',
12622                                    y: animation_y + 'vh',
12623                                    filter: 'blur(' + blur + 'px)',
12624                                    rotation: rotate,
12625                                    rotationX: rotate == 0 ? perspective : 0,
12626                                    transformPerspective: '100vw',
12627                                    transformOrigin: origin,
12628                                    duration: 1,
12629                                    ease: easeOut,
12630                                    //delay: 0.1
12631                                })
12632                            } else {
12633                                tlConds.fromTo($animateTrgrEl, {
12634                                    scaleX: 1,
12635                                    scaleY: 1,
12636                                    opacity: 1,
12637                                    x: 0,
12638                                    y: 0,
12639                                    filter: 'blur(0px)',
12640                                    rotation: 0,
12641                                    rotationX: 0,
12642                                    transformPerspective: '100vw',
12643                                    transformOrigin: origin,
12644                                    borderRadius: 0 + radius_unit,
12645                                    duration: 1,
12646                                }, {
12647                                    scaleX: parseFloat( scale ) / 100,
12648                                    scaleY: parseFloat( scale ) / 100,
12649                                    opacity: parseFloat(opacity)/100,
12650                                    x: animation_x + 'vw',
12651                                    y: animation_y + 'vh',
12652                                    filter: 'blur(' + blur + 'px)',
12653                                    rotation: rotate,
12654                                    rotationX: rotate == 0 ? perspective : 0,
12655                                    transformPerspective: '100vw',
12656                                    transformOrigin: origin,
12657                                    borderRadius: radius + radius_unit,
12658                                    duration: 1,
12659                                    ease: easeOut,
12660                                    //delay: 0.1
12661                                })
12662                            }
12663                        }
12664                    }
12665                }
12666
12667                function headingReveal($el){
12668                    txtTrggrStart = true;
12669                    $('.text-reveal', $el).each(function(_key, _val){
12670                        var $txtReveal = $(_val),
12671                            dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
12672                            dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
12673                            $lines = $('.heading-line-wrap', $txtReveal),
12674                            $words = $('.split-word-inner', $txtReveal),
12675                            $chars = $('.split-char', $txtReveal),
12676                            _setTxtReveal,
12677                            $elToReveal = $words;
12678
12679                        if ( !(sticky === 'yes' || stickyCards) ) {
12680                            return;
12681                        }
12682            
12683                        easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut;
12684
12685                        if ( dataReveal === 'chars' ) {
12686                            $elToReveal = $chars;
12687                        } else if ( dataReveal === 'lines' ) {
12688                            $elToReveal = $lines;
12689                        }
12690
12691                        var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr;
12692                        scrllTrggrTxt.id = "txt_reveal_" + _key; 
12693                        scrllTrggrTxt.pin = false;
12694
12695                        gsap.set($elToReveal, {opacity: dataRevealOpacity});
12696                        var _tl = gsap.timeline({
12697                            scrollTrigger: scrllTrggrTxt
12698                        });
12699                        _tl.fromTo($elToReveal, {
12700                            opacity: dataRevealOpacity,
12701                        }, {
12702                            opacity: 1,
12703                            stagger: 0.05
12704                        });
12705
12706                        $scrollTrgrEl.one( 'uncodeWordLines', function(){
12707                            clearRequestTimeout(_setTxtReveal);
12708                            _setTxtReveal = requestTimeout( function(){
12709                                gsap.set($elToReveal, {clearProps: true});
12710                                _tl.kill(true);
12711                                if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) {
12712                                    ScrollTrigger.getById("txt_reveal_" + _key).kill(true);
12713                                }
12714                                headingReveal($el)
12715                            }, 100);
12716                        });
12717
12718                    });
12719                };
12720
12721                if (!txtTrggrStart) {
12722                    headingReveal($el);
12723                }
12724
12725                $scrollTrgrEl.one( 'uncodeWordLines', function(){
12726                    if (!txtTrggrStart) {
12727                        headingReveal($el);
12728                    }
12729                });
12730                
12731                var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
12732                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight );
12733                var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 
12734                    document.documentElement.clientWidth,  document.documentElement.scrollWidth,  document.documentElement.offsetWidth );
12735                    
12736                $(window).on('uncode-sticky-trigger-observe', function(e){
12737                    var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
12738                    var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );
12739                    $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false});
12740                    //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style');
12741                    if ( stickyCards ) {
12742                        $('.tmb', $scrollTrgrEl).removeAttr('style');
12743                    }
12744                    var scrollnow = document.body.scrollTop || document.documentElement.scrollTop;
12745                    clearRequestTimeout(setTxtReveal);
12746                    setTxtReveal = requestTimeout( function(){
12747                        $(document).trigger('uncode-scrolltrigger-refresh');
12748                        if ( isMobileUsing ) {
12749                            if ( typeof tl !== 'undefined' ) {
12750                                tl.scrollTrigger.refresh();
12751                            }
12752                            if ( typeof tlConds !== 'undefined' ) {
12753                                tlConds.scrollTrigger.refresh();
12754                            }
12755                            $(window).trigger('scroll');
12756                            _width = __width;
12757                        } else if ( _width !== __width && ( isMobileUsing ) ) {
12758                            window.dispatchEvent(new CustomEvent('vc-resize'));
12759                            if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
12760                                window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){
12761                                    if ( typeof tl !== 'undefined' ) {
12762                                        tl.scrollTrigger.refresh();
12763                                    }
12764                                    if ( typeof tlConds !== 'undefined' ) {
12765                                        tlConds.scrollTrigger.refresh();
12766                                    }
12767                                    window.lenis.scrollTo(scrollnow, {duration: 0.01});
12768                                }});
12769                            } else {
12770                                if ( typeof tl !== 'undefined' ) {
12771                                    tl.scrollTrigger.refresh();
12772                                }
12773                                if ( typeof tlConds !== 'undefined' ) {
12774                                    tlConds.scrollTrigger.refresh();
12775                                }
12776                                $(window).trigger('scroll');
12777                            }
12778                            _height = __height;
12779                        }
12780                    }, 500);
12781                });
12782
12783
12784                $(window).on('load ', function(e){
12785                    var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
12786                    if ( _height !== ___height ) {
12787                        $scrollTrgrEl.attr('data-toggled', true);
12788                        $(window).trigger('resize');
12789                        if ( typeof tl !== 'undefined' ) {
12790                            tl.scrollTrigger.refresh();
12791                        }
12792                        if ( typeof tlConds !== 'undefined' ) {
12793                            tlConds.scrollTrigger.refresh();
12794                        }
12795                        _height = ___height;
12796                    }
12797
12798                    
12799                    
12800                    $(document).trigger('uncode-scrolltrigger-refresh');
12801
12802                });
12803
12804            };
12805
12806            var callAreaAnimateScrollTl = function() {
12807                if ( stickyCards ) {
12808                    $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){
12809                        if ( key+1 < cardL || animLast || state !== 'end' ) {
12810                            var $this = $(val),
12811                                last = key+1===cardL;
12812                            areaAnimateScrollTl($this, key, last);
12813                        }
12814                    });
12815                } else {
12816                    areaAnimateScrollTl($scrollTrgrEl, 0, false);
12817                }    
12818            };
12819
12820            $(window).on('wwResize', function(){
12821                if ( !alreadyareaAnimateScrollTl ) {
12822                    if ( noMobile ) {
12823                        if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
12824                            return;
12825                        } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12826                            return;
12827                        }
12828                    }
12829                    
12830                    callAreaAnimateScrollTl();
12831                }
12832            })
12833
12834            if ( noMobile ) {
12835                if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
12836                    return;
12837                } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12838                    return;
12839                }
12840            }
12841
12842            callAreaAnimateScrollTl();
12843
12844        });
12845
12846    };
12847
12848    areaReveal();
12849
12850};
12851
12852UNCODE.thumbsReveal = function() {
12853    var recalc = false,
12854    revealThumbs = function( $el ){
12855        if ( typeof $el === 'undefined' || $el === null || !$el.length ) {
12856            $el = $('body');
12857        }
12858        $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){
12859            var $container = $(this),
12860                $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container),
12861                isContainer = false;
12862
12863            if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) {
12864                $stickys.each(function(){
12865                    var $sticky = $(this).addClass('tmb-mask-init'),
12866                        $rellax = $sticky.closest('.parallax-el'),
12867                        $inside = $('.t-inside', $sticky),
12868                        $media = $('img, video, .fluid-object', $sticky).attr('loading', ''),
12869                        val = parseFloat( $inside.attr('data-scroll-val') );
12870
12871                    if ( $rellax.length ) {
12872                        recalc = true;
12873                    }
12874
12875                    val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val;
12876                    
12877                    if ( $sticky.hasClass('tmb-mask-scroll') ) {
12878
12879                        var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both'))
12880                        ? val*0.05 : 0;
12881                        var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
12882                            ? val*4 : 0;
12883                        var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) ? parax*0.01 : 0;
12884
12885                        var tl = gsap.timeline({
12886                            scrollTrigger: {
12887                                trigger: $sticky,
12888                                scrub: true,
12889                            }
12890                        });
12891
12892                        tl.fromTo($media, {
12893                            yPercent: -(parax),
12894                            scale: 1 + zoom + extra,
12895                        }, {
12896                            yPercent: parax,
12897                            scale: 1 + extra,
12898                            ease: "none",
12899                        });
12900
12901                        if ( recalc ) {
12902                            $(window).on('uncode-thumbsreveal-refresh', function(){
12903                                if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
12904                                    tl.scrollTrigger.refresh();
12905                                }
12906                            });
12907                        }
12908                    }
12909                });
12910            }
12911
12912            if ( $container.has('.tmb-mask-reveal') ) {
12913                var $markTrigger = ".tmb-mask-reveal .t-entry-visual",
12914                staggerTime = 0.1;
12915
12916                $('.t-inside', $container).each(function(){
12917                    var checkEasing = $(this).attr('data-easing');
12918                    if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') {
12919                        gsap.registerPlugin(CustomEase);
12920                        return false;
12921                    }
12922                });
12923
12924                if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) {
12925                    $markTrigger = $container;
12926                    isContainer = true;
12927                    staggerTime = 0;
12928                }
12929
12930                ScrollTrigger.batch( $markTrigger, {
12931                    start: function( el ){
12932                        /*if ( el.trigger.offsetHeight < (window.innerHeight/2) ) {
12933                            return "bottom bottom";
12934                        } else {*/
12935                            return  "top 96%";
12936                        //}
12937                    },
12938                    onEnter: function(batch){
12939                        var $inside = $(batch).closest('.t-inside');
12940
12941                        if ( isContainer ) {
12942                            var $inside = $(batch).find('.t-inside').first();
12943                        }
12944
12945                        var delay = parseFloat( $inside.attr('data-delay') ),
12946                            speed = parseFloat( $inside.attr('data-speed') ),
12947                            easing = $inside.attr('data-easing'),
12948                            bgDelay = parseFloat( $inside.attr('data-bg-delay') );
12949
12950                        delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
12951                        speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
12952                        easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
12953                        bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
12954
12955                        if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) {
12956                            gsap.to($('.t-entry-visual-tc', batch), speed, {
12957                                clipPath: 'inset(0% 0% 0% 0%)',
12958                                stagger: staggerTime,
12959                                delay: delay,
12960                                ease: easing,
12961                            });
12962                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
12963                                clipPath: 'inset(0% 0% 0% 0%)',
12964                                stagger: staggerTime,
12965                                scale: 1,
12966                                delay: delay + (speed*bgDelay),
12967                                ease: easing,
12968                            });
12969                        } else {
12970                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
12971                                clipPath: 'inset(0% 0% 0% 0%)',
12972                                stagger: staggerTime,
12973                                scale: 1,
12974                                delay: delay,
12975                                ease: easing,
12976                            });
12977                        }
12978                                                    
12979                    }
12980                });
12981            }
12982
12983        });
12984
12985        function raf(time) {
12986            requestAnimationFrame(raf)
12987            $(window).trigger('uncode-thumbsreveal-refresh');
12988        }
12989
12990        if ( recalc ) {
12991            requestAnimationFrame(raf)
12992        }
12993
12994    };
12995    $(window).on( 'load more-items-loaded', function(){
12996        revealThumbs();
12997    });
12998
12999    $(document).on('uncode-ajax-filtered', function(){
13000        revealThumbs();
13001    });
13002
13003    if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
13004        window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
13005            var $el = model.view.$el,
13006                shortcode = model.attributes.shortcode;
13007
13008            if ( $el.is('.custom-grid-container') ) {
13009                $el = $el.parent();
13010            }
13011
13012            if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') {
13013                revealThumbs($el);
13014            }
13015        });
13016    }
13017
13018};
13019
13020UNCODE.revslider = function() {
13021	var revSlider6In = function(){
13022		$('rs-module').each(function(){
13023			var $slider = $(this);
13024
13025			$slider.on('revolution.slide.onloaded', function(e, data){
13026				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13027					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
13028						scrolltop = $(document).scrollTop();
13029					if ( style != undefined ) {
13030						UNCODE.switchColorsMenu(scrolltop, style);
13031					}
13032				}
13033			});
13034
13035			$slider.on('revolution.slide.onchange', function(e, data){
13036				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13037					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
13038						scrolltop = $(document).scrollTop();
13039					if ( style != undefined ) {
13040						UNCODE.switchColorsMenu(scrolltop, style);
13041					}
13042				}
13043			});
13044
13045		});
13046
13047	};
13048	revSlider6In();
13049	$(window).on("load", revSlider6In );
13050
13051	document.addEventListener("sr.module.ready", function(e) { 
13052		var $slider = $('#'+e.id),
13053			settings = SR7.JSON[e.id];
13054
13055		if ( typeof settings !== 'undefined' && settings !== null ) {
13056			if ( $slider.closest(".header-revslider").length ) {
13057				var style = settings.slides[1].slide.attr.data,
13058					scrolltop = $(document).scrollTop();
13059				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13060				style = style[1];
13061				if ( style[1] != undefined ) {
13062					UNCODE.switchColorsMenu(scrolltop, style);
13063				}
13064			}
13065		}
13066	});
13067
13068	document.addEventListener("sr.slide.afterChange", function(e) {
13069		var $slider = $('#'+e.id),
13070			settings = SR7.JSON[e.id];
13071
13072		if ( typeof settings !== 'undefined' && settings !== null ) {
13073			if ( $slider.closest(".header-revslider").length ) {
13074				var style = settings.slides[e.current.id].slide.attr.data,
13075					scrolltop = $(document).scrollTop();
13076				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13077				style = style[1];
13078				if ( style != undefined ) {
13079					UNCODE.switchColorsMenu(scrolltop, style);
13080				}
13081			}
13082		}
13083	});
13084
13085};
13086UNCODE.layerslider = function() {
13087	$(window).on("load", function() {
13088
13089		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
13090
13091			var slideData = slider.slides.current.data,
13092				scrolltop = $(document).scrollTop();
13093			if( slideData && slideData.skin ) {
13094
13095				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
13096
13097			}
13098		});
13099
13100	});
13101};
13102
13103UNCODE.ajax_filters = function () {
13104	var isAjaxing = false;
13105
13106/*************************
13107 *
13108 * Filters Menu and Widgets Area
13109 *
13110 ************************/
13111
13112 	var clear_clicked = false;
13113
13114 	var init_ajax_grid = function(){
13115
13116		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
13117		$grids.each(function(index, val){
13118			var $body = $('body'),
13119				$grid = $(val).addClass('init-ajax-grid'),
13120				starting_point = $grid.attr('data-toggle'),
13121				$trigger = $('.uncode-toggle-ajax-filters', $grid),
13122				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
13123				$isotope_wrapper = $('.isotope-wrapper', $grid),
13124				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
13125				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
13126				$footprint = $('.ajax-filter-footprint', $grid),
13127				sidebar_w,
13128				data_w = parseFloat( $sidebar.attr('data-max-width') ),
13129				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
13130				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
13131				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
13132				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13133				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
13134				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0).attr('data-lenis-prevent', true),
13135				sidew,
13136				$inside_row = $('> .row-parent', $vc_row),
13137				bg_row,
13138				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
13139				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
13140				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
13141				sidebar_overlay = false,
13142				sidebar_hover = false,
13143				switchMobile = false,
13144				scrollTop;
13145
13146			if ( $vc_row.attr('class') ) {
13147				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
13148			}
13149
13150			if ( bg_row != null ) {
13151				$side_header.add($side_footer).addClass(bg_row[0]);
13152			}
13153
13154			$trigger.add($apply_filters).on('click', function(e){
13155				e.preventDefault();
13156				e.stopPropagation();
13157				$grid = $('.ajax-grid-system').eq(0);
13158				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13159				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13160				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13161				sidebar_w = $sidebar_wrapper.width();
13162				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13163				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
13164					$(this).trigger('uncode-ajax-clear-filters');
13165				}
13166				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13167					$grid.toggleClass('ajax-hide-filters-blanks');
13168					$sidebar.slideToggle({
13169						duration: 400,
13170						easing: 'easeOutQuad',
13171					});
13172				} else {
13173					$grid.removeClass('ajax-hide-filters-blanks');
13174					$grid.toggleClass('ajax-hide-filters');
13175					if ( $grid.hasClass('ajax-hide-filters') ) {
13176						$body.addClass('ajax-hide-filters');
13177					} else {
13178						scrollTop = $('html, body').scrollTop();
13179						$body.removeClass('ajax-hide-filters');
13180					}
13181				}
13182				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13183					$('html, body').scrollTop(scrollTop);
13184				}
13185				return false;
13186			});
13187
13188			$close_btn.on('click', function(e){
13189				e.preventDefault();
13190				$grid = $('.ajax-grid-system').eq(0);
13191				$grid.addClass('ajax-hide-filters');
13192				if ( $grid.hasClass('ajax-hide-filters') ) {
13193					$body.addClass('ajax-hide-filters');
13194				} else {
13195					scrollTop = $('html, body').scrollTop();
13196					$body.removeClass('ajax-hide-filters');
13197				}
13198				$('html, body').scrollTop(scrollTop);
13199			});
13200
13201			$sidebar_wrapper.on('mouseover',function(){
13202				sidebar_hover = true;
13203			}).on('mouseout', function(){
13204				sidebar_hover = false;
13205			});
13206
13207			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
13208				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
13209					return;
13210				}
13211				if (undefined !== from && from === 'select_active_attributes') {
13212					return;
13213				}
13214				if ($(e.target).closest('.select2-container--open').length ) {
13215					return;
13216				}
13217				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
13218					$grid.add($body).addClass('ajax-hide-filters');
13219				}
13220			});
13221
13222			$sorting_trgr.on('click', function(e) {
13223				e.preventDefault();
13224			});
13225
13226			var inside_width = function(){
13227				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13228				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13229				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13230				$inside_row = $('> .row-parent', $vc_row);
13231				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
13232					sidew = $sidebar.width();
13233					$inside_row.css({
13234						width: sidew
13235					});
13236				} else {
13237					$inside_row.css({
13238						width: ''
13239					});
13240				}
13241			};
13242			inside_width();
13243
13244			var ajax_sidebar_position = function(e, f_editor){
13245				$grid = $('.ajax-grid-system').eq(0);
13246				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13247				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13248				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13249				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13250				$inside_row = $('> .row-parent', $vc_row);
13251				scrollTop = $('html, body').scrollTop();
13252				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
13253					$grid.add($body).addClass('ajax-hide-filters');
13254					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
13255					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
13256					sidebar_overlay = true;
13257					$body.addClass('ajax-filter-sidebar-overlay');
13258					$sidebar_wrapper.addClass(skin);
13259					var sideHeadH = $side_header.outerHeight(),
13260						sideFooterH = $side_footer.outerHeight();
13261					if ( data_w !== '' && data_w > 0 ) {
13262						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
13263							$sidebar.css({
13264								'max-width': data_w
13265							});
13266						} else {
13267							$sidebar.css({
13268								'max-width':'none'
13269							});
13270						}
13271					}
13272					$vc_row.css({
13273						'padding-top':sideHeadH,
13274						'padding-bottom':sideFooterH
13275					});
13276					var sidew = $sidebar.width();
13277					$inside_row.css({
13278						width: sidew
13279					});
13280					switchMobile = true;
13281				} else {
13282					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
13283						scrollTop = $('html, body').scrollTop();
13284						$grid.add($body).removeClass('ajax-hide-filters');
13285					}
13286					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
13287						$grid.addClass('ajax-hide-filters-blanks');
13288						$sidebar.hide();
13289					}
13290					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
13291					$('.ajax-sidebar-placeholder', $grid).remove();
13292					sidebar_overlay = false;
13293					$body.removeClass('ajax-filter-sidebar-overlay');
13294					$sidebar_wrapper.removeClass(skin);
13295					if ( data_w !== '' && data_w > 0 ) {
13296						$sidebar.css({
13297							'max-width':'none'
13298						});
13299					}
13300					$vc_row.css({
13301						'padding-top':0,
13302						'padding-bottom':0,
13303					});
13304
13305					$inside_row.css({
13306						width: ''
13307					});
13308
13309					if ( f_editor === true ) {
13310						UNCODE.ajax_filters();
13311					}
13312
13313					switchMobile = false;
13314				}
13315				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13316					$('html, body').scrollTop(scrollTop);
13317				}
13318			};
13319
13320			var sidebar_width = function(){
13321				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13322					sidebar_w = $footprint.width();
13323					$sidebar.css({ width: sidebar_w });
13324				} else {
13325					$sidebar.css({ width: '' });
13326				}
13327			};
13328			sidebar_width();
13329
13330			if ( SiteParameters.is_frontend_editor ) {
13331				ajax_sidebar_position();
13332			}
13333
13334			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
13335				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
13336					ajax_sidebar_position(e);
13337				}
13338				sidebar_width();
13339			});
13340
13341			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
13342				ajax_sidebar_position(e, true);
13343			});
13344
13345			$isotope_wrapper.on('transitionend', function(e){
13346				if ( $(e.target).hasClass('isotope-wrapper') ) {
13347					window.dispatchEvent(new CustomEvent('boxResized'));
13348				}
13349				return false;
13350			});
13351
13352			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
13353				var $grid = $('.ajax-grid-system').eq(0);
13354				$grid.addClass('ajax-hide-filters');
13355			}
13356
13357		});
13358	};
13359
13360	init_ajax_grid();
13361	$(document).on('uncode-ajax-filtered', init_ajax_grid);
13362
13363/*************************
13364 *
13365 * Hover hack
13366 *
13367 ************************/
13368 	var widget_hover_hack = function() {
13369 		$('.widget, .uncode_widget').each(function(){
13370			var $widget = $(this),
13371				class_w = $widget.attr('class'),
13372				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
13373				$footer = $widget.closest('#colophon');
13374
13375			if ( class_w.indexOf('widget_yith') > 0 ) {
13376				return true;
13377			}
13378
13379			$lis.each(function(){
13380 				var $li = $(this),
13381 					$a = $('a', $li),
13382 					$label = $a.closest('label');
13383
13384				if ( !$footer.length ) {
13385					$li.addClass('no-evts');
13386				}
13387
13388				if ( ! $('span', $a).length ) {
13389 					$li.addClass( 'li-hover' );
13390 				}
13391
13392 				$('li', $li).hover(function(e){
13393 					$(e.target).parents('li').each(function(){
13394 						$(this).addClass( 'parent-li-hover' );
13395 					});
13396					}, function (e) {
13397 					$(e.target).parents('li').each(function(key, val){
13398 						if ( key === 0) {
13399	 						$(val).removeClass( 'parent-li-hover' );
13400	 					}
13401 					});
13402 				});
13403
13404				$li.off('mouseup').on('mouseup', function (e) {
13405					if (e.which !== 3) {
13406						e.stopPropagation();
13407						var $a = $('a', this).first();
13408						$a[0].click();
13409					}
13410	 			});
13411 			});
13412 		});
13413	  }
13414
13415	var ajax_filters_button_mode = $('body').hasClass('ajax-filters-button-mode');
13416
13417	if (!ajax_filters_button_mode && SiteParameters.disable_hover_hack !== '1') {
13418		widget_hover_hack();
13419		$(document).on('uncode-ajax-filtered', widget_hover_hack);
13420	}
13421
13422/*************************
13423 *
13424 * Init Filters
13425 *
13426 ************************/
13427
13428	function init_filters() {
13429		$(document).on('click', '.term-filter-link', function(e) {
13430			var _this = $(this);
13431			var widget = _this.closest('.uncode_widget');
13432			var container = get_filters_container();
13433
13434			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13435				return true;
13436			}
13437
13438			e.preventDefault();
13439
13440			if (widget.hasClass('widget-ajax-filters--checkbox')) {
13441				_this.parent().find('input[type="checkbox"]').trigger('click');
13442			} else {
13443				if (_this.hasClass('term-filter-link--active')) {
13444					_this.removeClass('term-filter-link--active');
13445				} else {
13446					_this.addClass('term-filter-link--active');
13447
13448					if (widget.hasClass('widget-ajax-filters--single')) {
13449						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
13450					}
13451				}
13452
13453				if (!ajax_filters_button_mode) {
13454					var url = _this.attr('href');
13455
13456					reload_items(container, url, true);
13457				}
13458			}
13459		});
13460
13461		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
13462			var _this = $(this);
13463			var widget = _this.closest('.uncode_widget');
13464			var link = _this.closest('.term-filter').find('.term-filter-link');
13465			var url = link.attr('href');
13466			var container = get_filters_container();
13467
13468			if (!ajax_filters_button_mode && widget.hasClass('widget-ajax-filters--no-ajax')) {
13469				window.location = url;
13470				return;
13471			}
13472
13473			if (widget.hasClass('widget-ajax-filters--single')) {
13474				widget.find('input[type="checkbox"]').each(function() {
13475					if (_this.attr('id') !== $(this).attr('id')) {
13476						$(this).prop('checked', false);
13477						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
13478					}
13479				});
13480			}
13481
13482			if (_this.prop('checked')) {
13483				link.addClass('term-filter-link--active');
13484			} else {
13485				link.removeClass('term-filter-link--active');
13486			}
13487
13488			if (!ajax_filters_button_mode) {
13489				reload_items(container, url, true);
13490			}
13491		});
13492
13493		$(document).on('change', 'select.select--term-filters', function(e) {
13494			var _this = $(this);
13495			var selected = _this.find('option:selected');
13496			var option = $(selected);
13497			var url = option.attr('data-term-filter-url');
13498			var container = get_filters_container();
13499			var widget = _this.closest('.uncode_widget');
13500
13501			if (!ajax_filters_button_mode) {
13502				if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13503					window.location = url;
13504				} else {
13505					reload_items(container, url, true);
13506				}
13507			}
13508		});
13509
13510		$(document).on('click', '.filter-list__link', function(e) {
13511			if (SiteParameters.is_frontend_editor) {
13512				return false;
13513			}
13514
13515			e.preventDefault();
13516
13517			var _this = $(this);
13518			var container = get_filters_container();
13519			var url = _this.attr('href');
13520			reload_items(container, url, true);
13521		});
13522
13523		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
13524			var _this = $(this);
13525			var container = get_filters_container();
13526			var url = _this.attr('href');
13527			reload_items(container, url, true);
13528		});
13529
13530		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
13531
13532			var _this = $(this);
13533			var container = get_filters_container();
13534			var url = _this.attr('href');
13535
13536			if ( container.length ) {
13537				e.preventDefault();
13538				reload_items(container, url, true);
13539			}
13540		});
13541
13542		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
13543			var _this = $(this);
13544			var container = get_filters_container();
13545
13546			if (container.length > 0) {
13547				e.preventDefault();
13548
13549				var min_price = $('#min_price').val();
13550				var max_price = $('#max_price').val();
13551				var location = window.location;
13552				var url = location.href;
13553				var page_uri = location.origin + location.pathname;
13554				var is_filtered = page_uri !== url;
13555
13556				if (is_filtered) {
13557					url = remove_parameter_from_url(url, 'min_price');
13558					url = remove_parameter_from_url(url, 'max_price');
13559				}
13560
13561				var concat = page_uri === url ? '?' : '&';
13562				var params = {'min_price': min_price, 'max_price': max_price};
13563
13564				url = url + concat + $.param(params);
13565
13566				reload_items(container, url, true);
13567			}
13568		});
13569
13570		var search_timer;
13571
13572		if (!ajax_filters_button_mode) {
13573			$(document).on('keyup', '.term-filters-search-input', function (e) {
13574				var _this = $(this);
13575				var container = get_filters_container();
13576				var value = _this.val();
13577
13578				if (search_timer) {
13579					clearTimeout(search_timer);
13580				}
13581
13582				search_timer = setTimeout(function () {
13583					update_search_url(container, value);
13584				}, 500);
13585			});
13586		}
13587
13588		$(document).on('click', '.btn-ajax-filters-trigger', function (e) {
13589			var container = get_filters_container();
13590
13591			if (container.length) {
13592				e.preventDefault();
13593				var paramMap = {};
13594
13595				$('.term-filter-link--active').each(function () {
13596					collect_from_query(paramMap, this.href.split('?')[1] || '');
13597				});
13598
13599				$('.select--term-filters').each(function () {
13600					var select = $(this);
13601					var val = select.val();
13602
13603					if (!val) {
13604						return
13605					};
13606
13607					var selected_option = select.find('option:selected');
13608					var qUrl = selected_option.data('term-filter-url') || '';
13609
13610					collect_from_query(paramMap, qUrl.split('?')[1] || '');
13611				});
13612
13613				var search = $('.term-filters-search-input');
13614
13615				if (search.length > 0) {
13616					var search_value = search.val().trim();
13617					if (search_value) {
13618						paramMap[SiteParameters.ajax_filter_key_search] = {};
13619						paramMap[SiteParameters.ajax_filter_key_search][search_value] = 1;
13620					}
13621				}
13622
13623				var qsParts = [];
13624				$.each(paramMap, function (key, valSet) {
13625					var vals = Object.keys(valSet);
13626					qsParts.push(key + '=' + vals.join(','));
13627				});
13628
13629				var final_url = window.location.origin + window.location.pathname;
13630
13631				if (qsParts.length > 0) {
13632					qsParts.push('unfilter=1');
13633
13634					var qs = qsParts.join('&');
13635					final_url = '?' + qs;
13636				}
13637
13638				reload_items(container, final_url, true);
13639			}
13640		});
13641	}
13642
13643	function collect_from_query(paramMap, query) {
13644		$.each(query.split('&'), function (_, pair) {
13645			if (!pair) {
13646				return
13647			};
13648
13649			var kv  = pair.split('=');
13650			var key = kv[0];
13651			var val = kv[1] || '';
13652
13653			if (key === 'unfilter') {
13654				return;
13655			}
13656			if (!paramMap[key]) {
13657				paramMap[key] = {}
13658			};
13659
13660			paramMap[key][val] = 1;
13661		});
13662	}
13663
13664	function update_search_url(container, search_value) {
13665		var location = window.location;
13666		var url = location.href;
13667		var page_uri = location.origin + location.pathname;
13668		var is_filtered = page_uri !== url;
13669		var key_search = SiteParameters.ajax_filter_key_search;
13670		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
13671
13672		if (is_filtered) {
13673			url = remove_parameter_from_url(url, key_search);
13674			url = remove_parameter_from_url(url, key_unfilter);
13675		}
13676
13677		if (search_value) {
13678			var concat = page_uri === url ? '?' : '&';
13679			var params = {};
13680
13681			params[key_search] = search_value;
13682			params[key_unfilter] = 1;
13683			url = url + concat + $.param(params);
13684		} else {
13685			url = remove_parameter_from_url(url, key_search);
13686		}
13687
13688		reload_items(container, url, true);
13689	}
13690
13691	function remove_parameter_from_url(url, parameter) {
13692		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
13693	}
13694
13695	function get_filters_container() {
13696		var container = $('.ajax-grid-system');
13697
13698		if (container.length == 0) {
13699			container = $('.ajax-filters');
13700		}
13701
13702		if (container.length == 0) {
13703			container = $('.ajax-filters-target');
13704		}
13705
13706		return container;
13707	}
13708
13709	function update_widgets_state(widgets_states, container) {
13710		for (var i = widgets_states.length - 1; i >= 0; i--) {
13711			var state = widgets_states[i];
13712
13713			if (!state.collapse) {
13714				continue;
13715			}
13716
13717			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
13718
13719			if (state.open) {
13720				new_widget.find('.widget-title').addClass('open');
13721				if (state.css) {
13722					new_widget.find('.widget-collapse-content').attr('style', state.css);
13723				}
13724			} else {
13725				new_widget.find('.widget-title').removeClass('open');
13726				if (state.css) {
13727					new_widget.find('.widget-collapse-content').attr('style', state.css);
13728				}
13729			}
13730		}
13731	}
13732
13733	// Find filters container
13734	function find_filters_container(context) {
13735		return context.find('.widget-ajax-filters').closest('.row-parent').find('.uncol').first();
13736	}
13737
13738	// Reload items via AJAX
13739	function reload_items(container, url, push) {
13740		if (isAjaxing) {
13741			return
13742		};
13743
13744		isAjaxing = true;
13745
13746		container.addClass('grid-filtering');
13747
13748		$.ajax({
13749			url     : url,
13750			success : function(response) {
13751				if (!response) {
13752					return;
13753				}
13754
13755				$(document).trigger('uncode-ajax-pre-filtered');
13756
13757				var container_id = container.attr('id');
13758				var pagination = $('.row-navigation');
13759				var filters_container;
13760
13761				var isTargetFilterMode = container.hasClass('ajax-filters-target');
13762
13763				if (isTargetFilterMode) {
13764					filters_container = find_filters_container($(document));
13765				}
13766
13767				if (container_id) {
13768					var container_to_append = $(response).find('#' + container_id);
13769					var pagination_to_append = $(response).find('.row-navigation');
13770					var filters_to_append;
13771					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
13772
13773					if (isTargetFilterMode) {
13774						filters_to_append = find_filters_container($(response));
13775					}
13776
13777					// Remember open/closed widgets
13778					var widgets = $('.uncode_widget');
13779					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
13780					var widgets_states = [];
13781
13782					widgets.each(function() {
13783						var widget = $(this);
13784						var id = widget.attr('data-id');
13785						var state = {
13786							'id': id,
13787							'collapse': false,
13788							'open': false,
13789							'css': false,
13790						};
13791
13792						var collapse_wrapper = widget.find('.widget-collapse-content');
13793
13794						if (collapse_wrapper.length > 0) {
13795							state.collapse = true;
13796
13797							var collapse_wrapper_css = collapse_wrapper.attr('style');
13798							var title = widget.find('.widget-title');
13799
13800							state.css = collapse_wrapper_css;
13801
13802							if (title.hasClass('open')) {
13803								state.open = true;
13804							} else {
13805								state.open = false;
13806							}
13807						}
13808
13809						widgets_states.push(state);
13810					});
13811
13812					// Update widgets state when it is not in target mode
13813					if (! isTargetFilterMode && offcanvas_sidebar_wrapper.length === 0) {
13814						update_widgets_state(widgets_states, container_to_append);
13815					}
13816
13817					// Update default sidebar state
13818					if (!container.hasClass('ajax-hide-filters')) {
13819						container_to_append.removeClass('ajax-hide-filters');
13820					}
13821
13822					// Update horizontal sidebar
13823					if (!container.hasClass('ajax-hide-filters-blanks')) {
13824						container_to_append.removeClass('ajax-hide-filters-blanks');
13825					}
13826					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
13827					if (horizontal_sidebar_wrapper.length > 0) {
13828						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
13829						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
13830						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
13831						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
13832
13833						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
13834						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
13835					}
13836
13837					// Append container
13838					container.replaceWith(container_to_append);
13839
13840					// Hide first thumbnail until the new srcset is loaded
13841					if (SiteParameters.dynamic_srcset_active === '1') {
13842						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
13843					}
13844
13845					// Remove loading attribute to images
13846					container_to_append.find('img').attr('loading', '');
13847
13848					// Append pagination
13849					if (pagination.length > 0) {
13850						if (pagination_to_append.length > 0) {
13851							pagination.html(pagination_to_append.html());
13852						} else {
13853							pagination.html('');
13854						}
13855					} else {
13856						if (pagination_to_append.length > 0) {
13857							$('.post-wrapper').append(pagination_to_append);
13858						}
13859					}
13860
13861					// Append filters
13862					if (isTargetFilterMode && filters_container.length > 0) {
13863						filters_container.html(filters_to_append.html());
13864					}
13865
13866					// Update widgets state when it is in target mode
13867					if (isTargetFilterMode && filters_container.length > 0) {
13868						update_widgets_state(widgets_states, filters_container);
13869					}
13870
13871					// Update off canvas sidebar (mobile and overlay)
13872					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
13873
13874					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
13875						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
13876						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
13877						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
13878						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
13879
13880						// Update widgets state
13881						update_widgets_state(widgets_states, sidebar_to_append);
13882
13883						// Update sidebar
13884						sidebar_container.html(sidebar_to_append.html());
13885					}
13886
13887					if (push) {
13888						UNCODE.lastURL = url;
13889						window.history.pushState(
13890							{ pageTitle: document.title },
13891							'',
13892							url
13893						);
13894					}
13895
13896					if (typeof UNCODE.isotopeLayout !== 'undefined') {
13897						UNCODE.isotopeLayout();
13898					}
13899					if (typeof UNCODE.justifiedGallery !== 'undefined') {
13900						UNCODE.justifiedGallery();
13901					}
13902					if (typeof UNCODE.cssGrid !== 'undefined') {
13903						UNCODE.cssGrid();
13904					}
13905					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
13906						UNCODE.lightbox();
13907					}
13908					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
13909						UNCODE.lightgallery();
13910					}
13911					if (typeof UNCODE.carousel !== 'undefined') {
13912						UNCODE.carousel($('body'));
13913					}
13914					UNCODE.animations();
13915					if (typeof UNCODE.filters !== 'undefined') {
13916						UNCODE.filters();
13917					}
13918					if (typeof UNCODE.widgets !== 'undefined') {
13919						UNCODE.widgets();
13920					}
13921
13922					if (SiteParameters.dynamic_srcset_active === '1') {
13923						UNCODE.refresh_dynamic_srcset_size();
13924					}
13925
13926					if (typeof UNCODE.menuSmartInit !== 'undefined') {
13927						UNCODE.menuSmartInit();
13928					}
13929
13930					if (typeof UNCODE.parallax !== 'undefined') {
13931						UNCODE.parallax();
13932					}
13933
13934					maybe_scroll_to_top();
13935
13936					var woo_select2_cats = $('.dropdown_product_cat');
13937
13938					if (woo_select2_cats.length > 0) {
13939						woo_select2_cats.on( 'change', function() {
13940							if ( $(this).val() != '' ) {
13941								var this_page = '';
13942								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
13943								if ( home_url.indexOf( '?' ) > 0 ) {
13944									this_page = home_url + '&product_cat=' + $(this).val();
13945								} else {
13946									this_page = home_url + '?product_cat=' + $(this).val();
13947								}
13948								location.href = this_page;
13949							} else {
13950								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
13951							}
13952						});
13953
13954						if ( $().selectWoo ) {
13955							var wc_product_cat_select = function() {
13956								woo_select2_cats.selectWoo( {
13957									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
13958									minimumResultsForSearch: 5,
13959									width: '100%',
13960									allowClear: true,
13961									language: {
13962										noResults: function() {
13963											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
13964										}
13965									}
13966								} );
13967							};
13968							wc_product_cat_select();
13969						}
13970					}
13971
13972					$(document).trigger('uncode-ajax-filtered');
13973					$(document.body).trigger('init_price_filter');
13974					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
13975					window.document.dispatchEvent(new Event("DOMContentLoaded", {
13976						bubbles: true,
13977						cancelable: true
13978					}));
13979
13980					isAjaxing = false;
13981				}
13982			},
13983			error: function() {
13984				container.removeClass('grid-filtering');
13985
13986				isAjaxing = false;
13987
13988				if (SiteParameters.enable_debug == true) {
13989					// This console log is disabled by default
13990					// So nothing is printed in a typical installation
13991					//
13992					// It can be enabled for debugging purposes setting
13993					// the 'uncode_enable_debug_on_js_scripts' filter to true
13994					console.log('There was an error retrieving the products');
13995				}
13996			}
13997		});
13998	}
13999
14000	// Scroll to top after filtering
14001	function maybe_scroll_to_top() {
14002		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
14003
14004		if (offcanvas_sidebar_wrapper.length > 0) {
14005			return;
14006		}
14007
14008		var container = get_filters_container();
14009		var bound = container[0].getBoundingClientRect();
14010
14011		if (bound.y < 0) {
14012			$(window).scrollTop(container.offset().top);
14013		}
14014	}
14015
14016	// Back/forward browser buttons
14017	$(window).on("popstate.ajaxfilters", function(e) {
14018		var location = window.location;
14019		var url = location.href;
14020		var params = UNCODE.getURLParams(window.location);
14021		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
14022
14023		UNCODE.lastURL = url;
14024
14025		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
14026			return;
14027		}
14028
14029		var container = get_filters_container();
14030
14031		reload_items(container, url, false);
14032	});
14033
14034	// Destroy load more before to init a new one
14035	$(window).on('uncode-ajax-pre-filtered', function() {
14036		if ($.fn.infinitescroll) {
14037			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
14038		}
14039	});
14040
14041	init_filters();
14042};
14043
14044UNCODE.videoThumbs = function() {
14045	var checkResize,
14046		newW = UNCODE.wwidth;
14047	var checkForVideos = function(){
14048
14049		$(window).on('okevents.y.change', function(e, y){
14050			var $video = $(y.target.g),
14051				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14052				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14053				restart = !$video_wrap.hasClass('play-pause'),
14054				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14055				setTime;
14056			if ( newW >= UNCODE.mediaQuery ) {
14057
14058				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
14059					$video_wrap.data('hovered', true);
14060					$video_wrap.addClass('played-on');
14061					y.target.pauseVideo();
14062					$tmb.on('mouseenter', function(){
14063						if ( restart ) {
14064							y.target.seekTo(0);
14065						}
14066						y.target.playVideo();
14067					}).on('mouseleave', function(){
14068						clearTimeout(setTime);
14069						setTime = setTimeout(function(){
14070							y.target.pauseVideo();
14071						}, 300);
14072					});
14073				}
14074
14075			} else {
14076				if( $mobile_video_wrap.length ) {
14077					$video_wrap.addClass('played-on');
14078					y.target.playVideo();
14079				}
14080			}
14081
14082		});
14083
14084		$(window).on('okevents.v.loaded', function(e, playerV){
14085			var $video = $(playerV.element),
14086				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14087				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14088				restart = !$video_wrap.hasClass('play-pause'),
14089				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
14089: $video.closest('.t-entry-visual, .un-inline-image'),
14090				setTime;
14091
14092			if ( newW >= UNCODE.mediaQuery ) {
14093				
14094				if( $video_wrap.length ) {
14095
14096					var playPromise = playerV.play();
14097					if (playPromise !== undefined) {
14098						playPromise.then(function( value ) {
14099							playerV.pause();
14100						});
14101					}
14102					$video_wrap.addClass('played-on');
14103					$tmb.on('mouseenter', function(){
14104						if ( restart ) {
14105							playerV.setCurrentTime(0)
14106						}
14107						playerV.play();
14108					}).on('mouseleave', function(){
14109						clearTimeout(setTime);
14110						setTime = setTimeout(function(){
14111							playerV.pause();
14112						}, 300);
14113					});
14114				}
14115
14116			} else {
14117
14118				if( $mobile_video_wrap.length ) {
14119					var playPromise = playerV.play();
14120					if (playPromise !== undefined) {
14121						playPromise.then(function( value ) {
14122							playerV.play();
14123						});
14124					}
14125					$video_wrap.addClass('played-on');
14126				}
14127			}
14128		});
14129
14130		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
14131			var $video = $(video),
14132				$noscript = $('noscript', $video),
14133				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14134				restart = !$video_wrap.hasClass('play-pause'),
14135				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14136				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14137				setTime,
14138			manageVideo = function(){
14139				video.currentTime = 0;
14140				video.pause();
14141				if ( newW >= UNCODE.mediaQuery ) {
14142					if ( $video_wrap.length ) {
14143						$video_wrap.addClass('played-on');
14144						$tmb.on('mouseenter', function(){
14145							if ( restart ) {
14146								video.currentTime = 0;
14147							}
14148							video.play();
14149						}).on('mouseleave', function(){
14150							clearTimeout(setTime);
14151							setTime = setTimeout(function(){
14152								video.pause();
14153							}, 300);
14154						});
14155					} else {
14156						video.play();
14157					}
14158				} else {
14159					if ( $mobile_video_wrap.length ) {
14160						$mobile_video_wrap.addClass('played-on');
14161						video.play();
14162					}
14163				}
14164
14165			};
14166			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
14167				$noscript.each(function(key, val){
14168					$noscript.after(val.textContent || val.innerText || val.innerHTML);
14169					$noscript.remove();
14170				});
14171			}
14172
14173			if (typeof MediaElement === "function") {
14174				$video.has('source[src]').mediaelementplayer({
14175					pauseOtherPlayers: false,
14176				});
14177			}
14178			if (video.readyState > 0) {
14179				manageVideo();
14180			} else {
14181				window.addEventListener("pageshow", function (event) {
14182					if (event.persisted) {
14183						manageVideo();
14184					}
14185				});				
14186				$video.on("loadedmetadata", function(_event) {
14187					manageVideo();
14188				});
14189			};
14190		});
14191	
14192	};
14193	
14194	checkForVideos();
14195
14196	var checkVideoResize = function(){
14197		clearRequestTimeout(checkResize);
14198		checkResize = requestTimeout(function(){
14199			if ( newW !== UNCODE.wwidth ) {
14200				checkForVideos();
14201				newW = UNCODE.wwidth;
14202			}
14203		}, 1000);
14204	};
14205
14206	$(window).off('resize.videos', checkVideoResize)
14207	.on( 'resize.videos', checkVideoResize);
14208
14209	$(window).off('more-items-loaded.videos', checkForVideos)
14210	.on('more-items-loaded.videos', checkForVideos);
14211
14212	$(document).off('uncode-ajax-filtered.videos', checkForVideos)
14213	.on('uncode-ajax-filtered.videos', checkForVideos);
14214
14215};
14216UNCODE.inlineImgs = function() {
14217    var linkInlineImgs = function(){
14218        $('.un-inline-image').each(function(){
14219            var $img = $(this),
14220                href = $(this).attr('data-link-href'),
14221                dataImg = $img.data();
14222			if ( dataImg != '' && href != null && href !== '' ) {
14223                var class_stra_a = 'unline-image-link';
14224                if ( $(this).hasClass('un-inline-space-over') ) {
14225                    class_stra_a += ' un-inline-space-over';
14226                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
14227                    class_stra_a += ' un-inline-space-gutter';
14228                }
14229                var str_a = '<a class="' + class_stra_a + '" ';
14230                for (var key in dataImg) {
14231                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
14232                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
14233                    }
14234                }
14235                str_a += ' />';
14236                $img.wrap(str_a);
14237			}
14238        });
14239    };
14240    $(window).on('load', linkInlineImgs );
14241};
14242UNCODE.lottie = function() {
14243    if ( SiteParameters.is_frontend_editor ) {
14244        var $lottie_wraps = $('div.uncode-lottie-wrap');
14245        $lottie_wraps.each(function(){
14246            var $lottie_wrap = $(this),
14247                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
14248                $player_clone = $div_player.clone(),
14249                player_id = $div_player.attr('data-id'),
14250                $lottie_players = $('lottie-player', $lottie_wrap).remove();
14251            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
14252                if ( $('#'+player_id).length ) {
14253                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
14254                }
14255                $player_clone.attr('id', player_id);
14256                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
14257                $div_player.after($player_clone);
14258                $div_player.attr('data-init',true);
14259            }
14260        });
14261    }
14262    var $players = $('.uncode-lottie-wrap lottie-player');
14263    $players.each(function(){
14264        var player = this,
14265            this_id = $(player).attr('id'),
14266            _player = document.getElementById(this_id),
14267            trigger = $(player).attr('data-trigger'),
14268            pFrames = $(player).attr('data-frames').split(','),
14269            srcPlayer = $(player).attr('src');
14270
14271        _player.load(srcPlayer);
14272
14273        _player.addEventListener("ready", function() {
14274
14275            var $_shadow = _player.shadowRoot;
14276            $($_shadow).find('.error').remove();
14277
14278            var tFrames = _player.getLottie().totalFrames / 100,
14279                pFrame_from = Math.round(tFrames * pFrames[0]),
14280                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
14281                loop = $(player).attr('loop'),
14282                mode,
14283                actions;
14284
14285            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
14286                if ( trigger === 'scroll' ) {
14287                    mode = 'scroll';
14288                    actions = [
14289                        {
14290                            visibility:[0, 1.0],
14291                            type: "seek",
14292                            frames: [pFrame_from, pFrame_to],
14293                        }
14294                    ];
14295                } else if ( trigger === 'viewport') {
14296                    mode = 'scroll';
14297                    actions = [
14298                        {
14299                            visibility: [0.20, 1.0],
14300                            frames: [pFrame_from, pFrame_to],
14301                            type: loop ? "loop" : "play"
14302                        }
14303                    ];
14304                } else if ( trigger === 'hover') {
14305                    $(player).on('mouseenter', function(){
14306                        _player.play();
14307                    }).on('mouseleave', function(){
14308                        _player.pause();
14309                    });
14310                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
14311                        _player.seek(pFrame_from);
14312                        _player.addEventListener("frame", function(){
14313                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
14314                                _player.seek(pFrame_from);
14315                            }
14316                        });
14317                    }
14318                }
14319                LottieInteractivity.create({
14320                    player: '#' + this_id,
14321                    mode: mode,
14322                    actions: actions
14323                });
14324            } else {
14325                if ( pFrame_from > 0 && pFrame_from < 99 ) {
14326                    _player.seek(pFrame_from);
14327                    _player.addEventListener("frame", function(){
14328                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
14329                            _player.seek(pFrame_from);
14330                        }
14331                    });
14332                }
14333            }
14334        });
14335
14336        $(window).on('unlottie-destroy', function(){
14337            _player.destroy();
14338        });
14339    });
14340};
14341
14342UNCODE.animatedBgGradient = function( _el ) {
14343
14344    var ev;
14345
14346	if ( typeof _el === 'undefined' || _el === null ) {
14347        _el = document;
14348        ev = false;
14349	} else {
14350        _el = _el[0];
14351        ev = 'shortcode:update';
14352    }
14353
14354    var simplex = new SimplexNoise();
14355
14356    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
14357		this.block = blockOverlay;
14358		this.wrap = canvasWrap;
14359		this.config();
14360		this.checker();
14361		this.loopRAF();
14362        this.animLoader();
14363    };
14364
14365    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
14366
14367    AnimGradient.config = function() {
14368        this.canvas = document.createElement('canvas');
14369        this.wrap.appendChild(this.canvas);
14370        this.ctx = this.canvas.getContext('2d');
14371        this.count = 0;        
14372        this.isOrientationChanged = false;
14373        this.res = UNCODE.isMobile ? 90 : 110;
14374        this.resPercent = 100/this.res;
14375        this.resAround = this.resPercent/100;
14376        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;
14377
14378        this.canvas.classList.add('uncode-bg-animated-gradient');
14379        this.canvas.setAttribute('height', this.res);
14380        this.canvas.setAttribute('width', this.res);
14381        this.canvas.style = 'height: 100%; position: relative; width:100%;';
14382
14383        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
14384
14385        this.cx = this.canvas.width/2;
14386        this.cy = this.canvas.height/2;
14387        this.data = this.imgdata.data;
14388
14389        this.opts = {
14390            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,
14391            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,
14392            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
14393        };
14394
14395        this.lavaTime = 1;
14396        this.bg_colors = [];
14397
14398        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
14399            return;
14400        }
14401
14402        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
14403            this.singleColor = true;
14404        }
14405
14406        if( this.opts.col_1st ) {
14407
14408            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
14409
14410            this.bg_colors.push({
14411                r: rgbColor1.r,
14412                g: rgbColor1.g,
14413                b: rgbColor1.b
14414            });
14415        }
14416
14417        if( this.opts.col_2nd ) {
14418
14419            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
14420
14421            this.bg_colors.push({
14422                r: rgbColor2.r,
14423                g: rgbColor2.g,
14424                b: rgbColor2.b
14425            });
14426        }
14427
14428    };
14429
14430    AnimGradient.checker = function() {
14431        var scope = this;
14432        this.checkInViewPort();
14433      
14434        window.addEventListener('resize', function() {
14435            if(UNCODE.isMobile && !scope.isOrientationChanged) {
14436                return;
14437            }
14438            scope.ratioCalc();
14439        });
14440
14441        window.addEventListener("orientationchange", function() {
14442            scope.isOrientationChanged = true;
14443        });
14444
14445        this.ratioCalc();
14446    }; 
14447
14448    AnimGradient.ratioCalc = function() {
14449      
14450        var blockW = this.block.clientWidth,
14451            blockH = this.block.clientHeight;
14452
14453        var blockRatio = blockH/blockW;
14454
14455        if(blockRatio < 1) {
14456            this.ratioParam = {
14457                x: 1.4,
14458                y: blockRatio*1.4
14459            }
14460        } else {
14461            this.ratioParam = {
14462                x: blockRatio/3,
14463                y: 1
14464            }
14465        }
14466         
14467    };
14468
14469    AnimGradient.checkInViewPort = function() {
14470		if( 'IntersectionObserver' in window ) {
14471		    var scope = this,
14472                observer = new IntersectionObserver(function(entries) {
14473  
14474                entries.forEach(function(entry){
14475                    if ( entry.isIntersecting ) {
14476                        scope.isInViewport = true;
14477                    } else {
14478                        scope.isInViewport = false;
14479                    }
14480                });
14481  
14482		    }, { 
14483			root: document,
14484		  });
14485  
14486		  observer.observe(this.block);
14487		}
14488	};
14489	
14490    AnimGradient.hexToRGB = function(hexval) {
14491        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
14492        if (!hexecuted) {
14493            return false;
14494        }
14495        return {
14496            r: parseInt(hexecuted[1], 16),
14497            g: parseInt(hexecuted[2], 16),
14498            b: parseInt(hexecuted[3], 16)
14499        }
14500    };
14501
14502    AnimGradient.factor = function(val_1, val_2, lava) { 
14503        return val_1 * (1 - lava) + val_2 * lava;
14504    };
14505
14506    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
14507        if (this.singleColor) {
14508            return this.bg_colors[0][wave_l];
14509        }
14510        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 );
14511        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
14512    };
14513
14514    AnimGradient.lava = function(x, y, grade) {
14515        var radians = (Math.PI / 180) * grade,
14516        cos = Math.cos(radians),
14517        sin = Math.sin(radians),
14518        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
14519        return nx;
14520    };
14521    
14522    AnimGradient.loopRAF = function() {
14523
14524      var scope = this;
14525
14526        if( this.isInViewport ) {
14527            for (var x = 0; x < this.res; x++) {
14528                for (var y = 0; y < this.res; y++) {
14529                    
14530                    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
14531        
14532                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
14533                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
14534                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
14535                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
14536                  
14537                }
14538            }
14539   
14540            this.count++;
14541          
14542            this.ctx.putImageData(this.imgdata, 0, 0);
14543         
14544        }
14545
14546        requestAnimationFrame(function() {
14547            scope.loopRAF();
14548        });
14549    };
14550
14551    AnimGradient.animLoader = function() {
14552        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
14553    };
14554
14555    var anim_init = function() {
14556        var bgs = _el.querySelectorAll('.block-bg-overlay');
14557      
14558        bgs.forEach(function(blockOverlay) {
14559            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
14560            if( !blockOverlay || !canvasWrap ) {
14561                return;
14562            }
14563            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
14564        });
14565    }
14566
14567    $(window).on('load', function(){
14568        anim_init();
14569    });
14570
14571    if ( ev === 'shortcode:update' ) {
14572        anim_init();
14573    }
14574
14575};
14576UNCODE.multibg = function(){
14577	var $bgsWraps = $('.uncode-multi-bgs'),
14578		$body = $('body');
14579	$bgsWraps.each(function(){
14580		var $bgWrap = $(this),
14581			transition = $bgWrap.attr('data-transition'),
14582			transitionTime = $bgWrap.attr('data-transition-time'),
14583			dataPace = $bgWrap.attr('data-transition-pace'),
14584			dataThreshold = $bgWrap.attr('data-transition-threshold'),
14585			dataTime = $bgWrap.attr('data-carousel-time'),
14586			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
14587			random = $bgWrap.attr('data-multi-random'),
14588			_bgWrap = $bgWrap[0],
14589			$multiBgs = $('.multi-background', $bgWrap),
14590			imgFirst,
14591			bgAmount = $multiBgs.length,
14592			isInViewport = false,
14593			lastScrollTop = 0,
14594			counter = 0,
14595			totMove = 0,
14596			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
14597			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
14598			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
14599			offX, offY,
14600			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
14601			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
14602			requestCarousel,
14603			is_header = $bgWrap.closest('#page-header').length,
14604			startTime = new Date();
14605
14606		transition = typeof transition === 'undefined' ? '' : transition;
14607
14608		if ( random === 'true' ) {
14609			UNCODE.shuffle($multiBgs);
14610		}
14611
14612		$multiBgs.find('.background-inner').attr('data-active','false');
14613
14614		imgFirst = $multiBgs.first().find('.background-inner').attr('data-active','true').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
14615
14616		var loadFirst = function(){
14617			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
14618				opacity: 1
14619			}, 250, 'easeInQuad').css({
14620				zIndex: 1
14621			});	
14622		}
14623
14624		var loadError = function(){
14625			console.log('Multi BG loading error');
14626		}
14627
14628		if ( imgFirst && imgFirst !== 'none' ) {
14629			UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
14630		} else {
14631			loadFirst();
14632		}
14633
14634		var loadSlides = function( $thisBg ){
14635			$thisBg.attr('data-load', 'loaded');	
14636		}
14637
14638		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
14639			var $thisBg = $(val);
14640
14641			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
14642
14643				var _imgBg = $(val).find('.background-inner').css('background-image');
14644
14645				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
14646					$thisBg.attr('data-load', 'loaded');
14647				} else {
14648					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
14649					if ( typeof _imgBg !== 'undefined' ) {
14650						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
14651					}
14652				}
14653			}
14654		});
14655					
14656		var multiCarousel = function(e) {
14657
14658			clearRequestTimeout(requestCarousel);
14659
14660			var checkTime = new Date();
14661			if ( checkTime - startTime >= carouselTime && isInViewport ) {
14662				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
14663
14664				if ( $checkEl.attr('data-load') !== 'loaded' ) {
14665					requestTimeout(function(){
14666						multiCarousel();
14667					}, 100);
14668					return;
14669				}
14670
14671				counter++;
14672
14673				$multiBgs.each(function(ind, val){
14674					if ( ind === counter%bgAmount ) {
14675						$(val).stop(true,false).animate({
14676							opacity: 1
14677						}, wait, 'easeInQuad').css({
14678							zIndex: 1
14679						}).find('.background-inner').attr('data-active','true');
14680					} else {
14681						$(val).stop(true,false).animate({
14682							opacity: 0
14683						}, wait, 'easeInQuad', function(){
14684							$(val).find('.background-inner').attr('data-active','false');
14685						}).css({
14686							zIndex: 0
14687						});
14688					}
14689				});
14690
14691			}
14692
14693			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
14694				requestCarousel = requestTimeout(multiCarousel, carouselTime);
14695			}
14696	
14697		};
14698
14699		var multiMove = function(e) {
14700			if ( $body.hasClass('navbar-hover') ) {
14701				return;
14702			}
14703			var checkTime = new Date(),
14704                bound = $bgWrap[0].getBoundingClientRect(),
14705                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
14706			if (offX) {
14707				totMove += Math.sqrt(
14708					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
14709				);
14710			}
14711			if (
14712                totMove >= pace && 
14713                checkTime - startTime >= wait &&
14714                e.clientX <= (bound.left + bound.width) &&
14715                e.clientX >= bound.left &&
14716                e.clientY <= (bound.top + bound.height) &&
14717                e.clientY >= bound.top
14718            ) {
14719				counter++;
14720				startTime = checkTime;
14721				$multiBgs.each(function(ind, val){
14722					if ( ind === counter%bgAmount ) {
14723						$(val).stop(true,false).animate({
14724							opacity: 1
14725						}, wait, 'easeInQuad').css({
14726							zIndex: 1
14727						}).find('.background-inner').attr('data-active','true');
14728					} else {
14729						$(val).stop(true,false).animate({
14730							opacity: 0
14731						}, wait, 'easeInQuad', function(){
14732							$(val).find('.background-inner').attr('data-active','false');
14733						}).css({
14734							zIndex: 0
14735						});
14736					}
14737				});
14738
14739				totMove = 0;
14740			}
14741			
14742			offX = e.clientX;
14743			offY = e.clientY;
14744			
14745		};
14746
14747		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
14748			document.addEventListener("mousemove", multiMove);
14749		}
14750
14751		window.addEventListener('resize', function() {
14752			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
14753				document.removeEventListener("mousemove", multiMove);
14754				document.addEventListener("mousemove", multiMove);
14755			}
14756		});
14757
14758		var lightLoopRAF = function() {
14759
14760			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
14761				checkTime = new Date(),
14762				bound = $bgWrap[0].getBoundingClientRect(),
14763				thresholdHeader = is_header ? 100 : threshold,
14764				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
14765			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
14766				counter++;
14767				lastScrollTop = scrollTop;
14768				startTime = checkTime;
14769
14770				$multiBgs.each(function(ind, val){
14771					if ( ind === counter%bgAmount ) {
14772						$(val).stop(true,false).animate({
14773							opacity: 1
14774						}, wait, 'easeInQuad').css({
14775							zIndex: 1
14776						}).find('.background-inner').attr('data-active','true');
14777					} else {
14778						$(val).stop(true,false).animate({
14779							opacity: 0
14780						}, wait, 'easeInQuad', function(){
14781							$(val).find('.background-inner').attr('data-active','false');
14782						}).css({
14783							zIndex: 0
14784						});
14785					}
14786				});
14787
14788			}
14789
14790			requestAnimationFrame(function() {
14791				if ( isInViewport ) {
14792					lightLoopRAF();
14793				}
14794			});
14795		};
14796
14797		var currentInd = 0;
14798
14799		var loopRAF = function() {
14800
14801			var multiBgRotate = function(slideInd){
14802				currentInd = slideInd;
14803				$multiBgs.each(function(ind, val){
14804					if ( ind === slideInd ) {
14805						$(val).stop(true,false).animate({
14806							opacity: 1
14807						}, wait, 'easeInQuad').css({
14808							zIndex: 1
14809						}).find('.background-inner').attr('data-active','true');
14810					} else {
14811						$(val).stop(true,false).animate({
14812							opacity: 0
14813						}, wait, 'easeInQuad', function(){
14814							$(val).find('.background-inner').attr('data-active','false');
14815						}).css({
14816							zIndex: 0
14817						});
14818					}
14819				});
14820			};
14821			var bound = $bgWrap[0].getBoundingClientRect(),
14822				thresholdPX = UNCODE.wheight * threshold / 100,
14823				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
14824				movePX = totMove / bgAmount,
14825				moving = UNCODE.wheight - (bound.top + thresholdPX),
14826				slideInd = 0;
14827
14828			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
14829				multiBgRotate(0);
14830			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
14831				multiBgRotate(bgAmount-1);
14832			} else {
14833				slideInd = Math.ceil(moving/movePX) - 1;
14834				if ( slideInd < 0 ) {
14835					slideInd = 0;
14836				} else if ( slideInd >= bgAmount ) {
14837					slideInd = bgAmount-1;
14838				}
14839				if ( slideInd !== currentInd ) {
14840					multiBgRotate(slideInd);
14841				}
14842			}
14843
14844			requestAnimationFrame(function() {
14845				if ( isInViewport ) {
14846					loopRAF();
14847				}
14848			});
14849		};
14850
14851		if( 'IntersectionObserver' in window ) {
14852		    var observer = new IntersectionObserver(function(entries) {
14853  
14854                entries.forEach(function(entry){
14855                    if ( entry.isIntersecting ) {
14856                        isInViewport = true;
14857						if ( transition === 'scroll' ) {
14858							if ( autoScroll ) {
14859								loopRAF();
14860							} else {
14861								lightLoopRAF();
14862							}
14863						} else {
14864							multiCarousel();
14865						}
14866                    } else {
14867                        isInViewport = false;
14868                   }
14869                });
14870  
14871		    }, { 
14872				root: document,
14873				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
14874		  	});
14875
14876			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
14877		  		observer.observe(_bgWrap);
14878			}
14879
14880			window.addEventListener('resize', function() {
14881				observer.unobserve(_bgWrap);
14882				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
14883					observer.observe(_bgWrap);
14884				}
14885			});
14886	
14887		}
14888
14889	});
14890}
14891
14892UNCODE.owlNav = function(target, ev) {
14893    target = target.replace(/#\S+/g, '');
14894    var $carousel = $('#'+target),
14895        $slider = $carousel.closest('.uncode-slider'),
14896        $checkNavs = $('.uncode-owl-nav');
14897    if ( !$checkNavs.length ) {
14898        return;
14899    }
14900
14901    if ( $slider.length ){
14902        target = $slider.attr('id');
14903    }
14904
14905    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
14906        $row;
14907
14908    if ( ! $navs.length ) {
14909        $row = $carousel.closest('.vc_row.row-container');
14910        $navs = $('.uncode-owl-nav:not([data-target])', $row);
14911    }
14912        
14913    if ( ! $navs.length ) {
14914        return;
14915    }
14916
14917    $navs.each(function(){
14918        var $nav = $(this),
14919            $outer = $nav.closest('.uncode-owl-nav-out'),
14920            $inner = $nav.find('.uncode-owl-nav-in'),
14921            $navDots = $('.uncode-nav-dots', $nav),
14922            $navCounter = $('.uncode-nav-counter', $nav),
14923            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
14924            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
14925            skinInherit = $nav.hasClass('skin-inherit'),
14926            digit = parseFloat($nav.attr('data-digit')),
14927            counterDigit = parseFloat($nav.attr('data-counter-digit')),
14928            navSpeed = parseFloat($carousel.attr('data-navspeed'));
14929        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
14930
14931        if ( $nav.hasClass('pos-abs') ){
14932            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
14933                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
14934            }
14935            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
14936        } 
14937
14938        $carousel.on('refreshed.owl.carousel', counter);
14939        $carousel.on('resized.owl.carousel', counter);
14940        $carousel.on('changed.owl.carousel', counter);
14941
14942        var totalSlides = 0;
14943
14944        function counter(event) {
14945            if (!event.namespace) {
14946                return;
14947            }
14948            var slides = event.relatedTarget,
14949                current = slides._current,
14950                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
14951                item = event.item,
14952                page = event.page,
14953                countPages = Math.ceil(item.count / page.size),
14954                $currentSlide = $carousel.find('.owl-item').eq(current),
14955                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
14956                activeSlide = Math.ceil(itemIndex / page.size),
14957                $prev = $nav.find('.uncode-nav-prev'),
14958                $next = $nav.find('.uncode-nav-next'),
14959                $col = $currentSlide.find('.uncol').first();
14960
14961            if ( totalSlides != countPages ) {
14962                totalSlides = countPages;
14963                $navDots.html('');
14964                var nav_html = '';
14965                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
14966                    var padN = sl_ind+1;
14967                    if ( digit && digit > 1 ) {
14968                        padN = String(padN).padStart(digit, '0');
14969                    }
14970                    nav_html += '<button class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '" tabindex="0"><span>' + padN + '</span></button>';
14971                }
14972                $navDots.html(nav_html);
14973
14974                var totalSlidesDigit = totalSlides;
14975
14976                if ( counterDigit && counterDigit > 1 ) {
14977                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
14978                }
14979                $counterTotal.html(totalSlidesDigit);
14980            }
14981
14982            if ( loop !== true ) {
14983                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
14984                if ( itemIndex === 1 ) {
14985                    $prev.addClass('uncode-nav-disabled');
14986                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
14987                    $next.addClass('uncode-nav-disabled');
14988                    activeSlide = Math.ceil(item.count / page.size);
14989                }
14990            }
14991
14992            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
14993            var activeSlideDigit = activeSlide;
14994
14995            if ( counterDigit && counterDigit > 1 ) {
14996                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
14997            }
14998            $counterIndex.html(activeSlideDigit);
14999
15000            if ( skinInherit ) {
15001                if ( $col.hasClass('style-light') ){
15002                    $nav.removeClass('style-dark').addClass('style-light');
15003                } else if ( $col.hasClass('style-dark') ) {
15004                    $nav.removeClass('style-light').addClass('style-dark');
15005                }
15006            }
15007
15008            $inner.removeClass('uncode-owl-nav-waiting');
15009
15010            if ( $nav.hasClass('outer-width') ) {
15011                var navW = $nav.outerWidth(),
15012                    nexW = $next.outerWidth(),
15013                    prevW = $prev.outerWidth(),
15014                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
15015
15016                if ( $nav.hasClass('h-align-justify') ) {
15017                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
15018                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
15019                        $inner.css({'margin': 'auto'});
15020                    } else {
15021                        $inner.css({'margin': ''});
15022                    }
15023                } else {
15024                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
15025                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
15026                        $inner.css({'margin': 'auto'});
15027                    } else {
15028                        $inner.css({'margin': ''});
15029                    }
15030                }
15031            }
15032        }
15033
15034        $nav.on('click', '.uncode-nav-index', function(){
15035            var $bullet = $(this),
15036                slide_index = parseFloat( $bullet.attr('data-key') );
15037            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
15038        });
15039        $nav.on('click', '.uncode-nav-prev', function(){
15040            $carousel.trigger('prev.owl.carousel', [navSpeed]);
15041        });
15042        $nav.on('click', '.uncode-nav-next', function(){
15043            $carousel.trigger('next.owl.carousel', [navSpeed]);
15044        });
15045
15046        if ( $nav.hasClass('animated-arrows') ) {
15047            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
15048                $(this).addClass("hover"); 
15049            }).on('animationend', function(){
15050                $(this).removeClass("hover");  
15051            });
15052        }
15053
15054        var positionNav = function(){
15055            if ( $nav.hasClass('window-width') ) {
15056                var navOff = parseFloat( $nav.offset().left ) * -1;
15057                if ( navOff > 0 ) {
15058                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
15059                } else {
15060                    $inner.css({ transform: 'none' });
15061                }
15062            }
15063        }
15064        positionNav();
15065        $(window).on('resize', positionNav);
15066    });
15067
15068    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
15069};
15070
15071	UNCODE.init = function() {
15072		var wfl_check = false, wfl_request, waypoint_request;
15073		UNCODE.preventDoubleTransition();
15074		UNCODE.betterResize();
15075		UNCODE.utils();
15076		UNCODE.magnetic();
15077		if (typeof UNCODE.accessibility !== 'undefined') {
15078			UNCODE.accessibility();
15079		}
15080		if (typeof UNCODE.rowParallax !== 'undefined') {
15081			UNCODE.rowParallax();
15082		}
15083		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
15084			UNCODE.changeSkinOnScroll();
15085		}
15086		if (typeof UNCODE.share !== 'undefined') {
15087			UNCODE.share();
15088		}
15089		if (typeof UNCODE.tooltip !== 'undefined') {
15090			UNCODE.tooltip();
15091		}
15092		if (typeof UNCODE.counters !== 'undefined') {
15093			UNCODE.counters();
15094		}
15095		if (typeof UNCODE.countdowns !== 'undefined') {
15096			UNCODE.countdowns();
15097		}
15098		if (typeof UNCODE.tabs !== 'undefined') {
15099			UNCODE.tabs();
15100		}
15101		if (typeof UNCODE.collapse !== 'undefined') {
15102			UNCODE.collapse();
15103		}
15104		if (typeof UNCODE.bigText !== 'undefined') {
15105			UNCODE.bigText();
15106		}
15107		UNCODE.menuSystem();
15108		if (typeof UNCODE.bgChanger !== 'undefined') {
15109			UNCODE.bgChanger();
15110		}
15111		if (typeof UNCODE.magicCursor !== 'undefined') {
15112			UNCODE.magicCursor();
15113		}
15114		if (typeof UNCODE.magneticCursor !== 'undefined') {
15115			UNCODE.magneticCursor();
15116		}
15117		if (typeof UNCODE.dropImage !== 'undefined') {
15118			UNCODE.dropImage();
15119		}
15120		if (typeof UNCODE.postTable !== 'undefined') {
15121			UNCODE.postTable();
15122		}
15123		if (typeof UNCODE.rotatingTxt !== 'undefined') {
15124			UNCODE.rotatingTxt();
15125		}
15126		if (typeof UNCODE.okvideo !== 'undefined') {
15127			UNCODE.okvideo();
15128			window.addEventListener( "uncode-more-items-loaded", function() {
15129				UNCODE.okvideo("uncode-more-items-loaded");
15130			});
15131		}
15132		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
15133			UNCODE.backgroundSelfVideos();
15134		}
15135		UNCODE.tapHover();
15136		if (typeof UNCODE.isotopeLayout !== 'undefined') {
15137			UNCODE.isotopeLayout();
15138		}
15139		if (typeof UNCODE.justifiedGallery !== 'undefined') {
15140			UNCODE.justifiedGallery();
15141		}
15142		if (typeof UNCODE.cssGrid !== 'undefined') {
15143			UNCODE.cssGrid();
15144		}
15145		if (typeof UNCODE.linearGrid !== 'undefined') {
15146			UNCODE.linearGrid();
15147		}
15148		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
15149			UNCODE.lightbox();
15150		}
15151		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
15152			$(window).on('load more-items-loaded',function(){
15153				UNCODE.lightgallery();
15154			});
15155		}
15156		if (typeof UNCODE.carousel !== 'undefined') {
15157			UNCODE.carousel($('body'));
15158		}
15159		if (typeof UNCODE.lettering !== 'undefined') {
15160			UNCODE.lettering();
15161		}
15162		UNCODE.animations();
15163		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
15164			UNCODE.stickyElements();
15165		}
15166		if (typeof UNCODE.twentytwenty !== 'undefined') {
15167			UNCODE.twentytwenty();
15168		}
15169		UNCODE.disableHoverScroll();
15170		UNCODE.printScreen();
15171		if (typeof UNCODE.particles !== 'undefined') {
15172			UNCODE.particles();
15173		}
15174		if (typeof UNCODE.filters !== 'undefined') {
15175			UNCODE.filters();
15176		}
15177		if (typeof UNCODE.ajax_filters !== 'undefined') {
15178			UNCODE.ajax_filters();
15179		}
15180		if (typeof UNCODE.widgets !== 'undefined') {
15181			UNCODE.widgets();
15182		}
15183		if (typeof UNCODE.unmodal !== 'undefined') {
15184			UNCODE.unmodal();
15185		}
15186		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
15187			if ( !UNCODE.isFullPage ) {
15188				UNCODE.checkScrollForTabs();
15189			}
15190		}
15191		if (typeof UNCODE.onePage !== 'undefined') {
15192			UNCODE.onePage(UNCODE.isMobile);
15193		}
15194		if (typeof UNCODE.fullPage !== 'undefined') {
15195			$(document).ready(function(){
15196				UNCODE.fullPage();
15197			});
15198		}
15199		if (typeof UNCODE.skewIt !== 'undefined') {
15200			UNCODE.skewIt();
15201		}
15202		if (typeof UNCODE.rotateIt !== 'undefined') {
15203			UNCODE.rotateIt();
15204		}
15205		if (typeof UNCODE.textMarquee !== 'undefined') {
15206			UNCODE.textMarquee();
15207		}
15208		if (typeof UNCODE.stickyScroll !== 'undefined') {
15209			UNCODE.stickyScroll();
15210		}
15211		if (typeof UNCODE.stickyTrigger !== 'undefined') {
15212			UNCODE.stickyTrigger();
15213		}
15214		if (typeof UNCODE.areaTextReveal !== 'undefined') {
15215			UNCODE.areaTextReveal();
15216		}
15217		if (typeof UNCODE.thumbsReveal !== 'undefined') {
15218			UNCODE.thumbsReveal();
15219		}
15220		if (typeof UNCODE.verticalText !== 'undefined') {
15221			UNCODE.verticalText();
15222		}
15223		if (typeof UNCODE.videoThumbs !== 'undefined') {
15224			UNCODE.videoThumbs();
15225		}
15226		if (typeof UNCODE.revslider !== 'undefined') {
15227			UNCODE.revslider();
15228		}
15229		if (typeof UNCODE.layerslider !== 'undefined') {
15230			UNCODE.layerslider();
15231		}
15232		if (typeof UNCODE.lottie !== 'undefined') {
15233			UNCODE.lottie();
15234		}
15235		if (typeof UNCODE.inlineImgs !== 'undefined') {
15236			UNCODE.inlineImgs();
15237		}
15238		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
15239			UNCODE.animatedBgGradient();
15240		}
15241		if (typeof UNCODE.readMoreCol !== 'undefined') {
15242			UNCODE.readMoreCol();
15243		}
15244		if (typeof UNCODE.multibg !== 'undefined') {
15245			UNCODE.multibg();
15246		}
15247		if (typeof UNCODE.flexEqual !== 'undefined') {
15248			UNCODE.flexEqual();
15249		}
15250		$(window).on('load',function(){
15251			clearRequestTimeout(waypoint_request);
15252			waypoint_request = requestTimeout( function(){
15253				Waypoint.refreshAll();
15254			}, 1000);
15255		});
15256		$(window).one('load',function(){
15257			if (typeof UNCODE.parallax !== 'undefined') {
15258				UNCODE.parallax();
15259			}
15260		});
15261	}
15262
15263	if ( ! SiteParameters.is_frontend_editor ) {
15264		UNCODE.init();
15265	}
15266
15267
15268})(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.