PageSourceSearch

https://innovationspreis-mobilitaet.de/wp-content/themes/uncode/library/js/app.js?ver=1608006170

js innovationspreis-mobilitaet.de collected 2026-10-05 06:08:26 UTC 507,376 bytes, 15,243 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$(function(){
107	$(document).on('uncode-scrolltrigger-refresh', function(){
108		clearRequestTimeout(checkScrollTriggerRefresh);
109		checkScrollTriggerRefresh = requestTimeout(function(){
110			ScrollTrigger.refresh();
111		}, 500);
112	});
113});
114
115UNCODE.checkImgLoad = function( src, cb, err, el ) {
116	var img = new Image();
117	img.onload = function () {
118		var result = (img.width > 0) && (img.height > 0);
119		cb(el);
120	};
121	img.onerror = function () {
122		err();
123	};
124	img.src = src
125};
126
127UNCODE.betterResize = function() {
128	var setResize,
129		doubleResize = true,
130		oldW = UNCODE.wwidth,
131		oldH = UNCODE.wheight,
132		setCTA;
133	$(window).on( 'resize orientationchange', function(){
134		if ( oldW === UNCODE.wwidth ) {
135			return;
136		} else {
137			oldW = UNCODE.wwidth;
138			$(window).trigger('wwResize');
139		}
140
141		if ( oldH === UNCODE.wheight ) {
142			return;
143		} else {
144			oldH = UNCODE.wheight;
145			$(window).trigger('whResize');
146		}
147	});
148
149	$(window).on( 'resize orientationchange', function(){
150		clearRequestTimeout(setCTA);
151		setCTA = requestTimeout( function(){ $(window).trigger('resize-int'); }, 100 );
152	});
153};
154
155UNCODE.shuffle = function(array) {
156	var currentIndex = array.length,
157		randomIndex;
158  
159	while (currentIndex > 0) {
160		randomIndex = Math.floor(Math.random() * currentIndex);
161		currentIndex--;
162		[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
163	}
164  
165	return array;
166};
167
168Number.isInteger = Number.isInteger || function(value) {
169    return typeof value === "number" &&
170           isFinite(value) &&
171           Math.floor(value) === value;
172};
173
174UNCODE.utils = function() {
175	$(document).on('mouseover', 'a', function () {
176		if (!$(this).hasClass('star')) {
177			$(this).attr('data-title', $(this).attr('title'));
178			$(this).removeAttr('title');
179		}
180	});
181	$(document).on('mouseout', 'a', function () {
182		if (!$(this).hasClass('star')) {
183			$(this).attr('title', $(this).attr('data-title'));
184			$(this).removeAttr('data-title');
185		}
186	});
187
188	this.get_scroll_offset = function(e) {
189
190		var scroll_offset = 0,
191			target,
192			trigger;
193
194		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
195			target = e.target;
196			trigger = e.currentTarget;
197		}
198
199		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
200			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
201				UNCODE.hideMenu(100);
202			}
203		}
204
205		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) {
206			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
207			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
208				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) {
209					if ( !$('.menu-hided').length ) {
210						if ( $('body').hasClass('hmenu-center') ) {
211							scroll_offset += ~~$('.menu-sticky .menu-container').outerHeight();
212						} else {
213							scroll_offset += ~~$('.logo-container:visible').outerHeight();
214						}
215					}
216				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
217					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
218					scroll_offset += (~~$('.menu-sticky .menu-container').outerHeight()) - ( $('.navbar-brand').data('minheight') + shrink );
219				} else {
220					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
221						scroll_offset += UNCODE.menuMobileHeight;
222					} else {
223						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 ) {
224							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
225						} else {
226							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
227								scroll_offset += UNCODE.menuMobileHeight;
228							}
229						}
230					}
231				}
232			}
233
234		}
235
236		scroll_offset += UNCODE.bodyBorder;
237
238		return scroll_offset;
239	}
240
241	if ( !UNCODE.isFullPage ) {
242		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
243
244			var hash = (e.currentTarget).hash,
245			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
246			anchor = '';
247			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
248			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
249				e.preventDefault();
250				if (!$('#tab-reviews').is(':visible')) {
251					$('a[href="#tab-reviews"]').trigger('click');
252				}
253				var calc_scroll = $('.wootabs .tab-content').offset().top;
254				calc_scroll -= UNCODE.get_scroll_offset(e);
255
256				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
257					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
258
259					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
260						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
261					}
262				}
263
264				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
265					delta = bodyTop - calc_scroll,
266					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
267				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
268
269				requestTimeout(function(){
270					if (scrollSpeed == 0) {
271						$('html, body').scrollTop(calc_scroll);
272						UNCODE.scrolling = false;
273					} else {
274   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
275							$(this).stop();
276						}).animate({
277								scrollTop: calc_scroll
278							}, scrollSpeed, 'easeInOutCubic', function() {
279								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
280								UNCODE.scrolling = false;
281							}
282						);
283					}
284				}, 200);
285				return;
286			}
287			if (hash != undefined) {
288				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
289				var anchor = this.hash.slice(1);
290				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
291			  		if ( !specialFormat.test(hash) ) {
292			  			if ( $(hash).length )
293			  				anchor = $(hash);
294			  		}
295				}
296			}
297
298			if (is_scrolltop || anchor != '') {
299				if (is_scrolltop) {
300					e.preventDefault();
301					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
302					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
303					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
304
305					if (scrollSpeed == 0) {
306						$('html, body').scrollTop(0);
307						UNCODE.scrolling = false;
308					} else {
309   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
310							$(this).stop();
311						}).animate({
312							scrollTop: 0
313						}, scrollSpeed, 'easeInOutCubic', function() {
314							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
315							UNCODE.scrolling = false;
316						});
317					}
318				} else {
319					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
320					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
321						var get_href = $(val).attr('href');
322						if (get_href != undefined) {
323							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
324							else $(val).parent().removeClass('active');
325						}
326					});
327					if (scrollSection.length) {
328						if ( $('body').hasClass('uncode-scroll-no-history') ) {
329							e.preventDefault();
330						}
331
332						if (UNCODE.menuOpened) {
333							if (UNCODE.wwidth < UNCODE.mediaQuery) {
334								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
335							} else {
336								$('.mmb-container-overlay .overlay-close').trigger('click');
337								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
338							}
339						}
340
341						var calc_scroll = scrollSection.offset().top,
342							getOffset = UNCODE.get_scroll_offset(e),
343							$logo = $('.logo-container:visible'),
344							logoH,
345							$menu = $('#masthead .menu-container'),
346							menuH;
347
348						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
349
350						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
351							delta = bodyTop - calc_scroll,
352							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
353						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
354
355						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
356							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
357								logoH = $logo.outerHeight(),
358								menuH = $menu.outerHeight();
359								if ( calc_scroll < ( logoH + menuH ) ) {
360									calc_scroll = 0;
361								}
362							}
363						}
364
365						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
366							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
367						}
368
369						if (scrollSpeed == 0) {
370							$('html, body').scrollTop(calc_scroll);
371							UNCODE.scrolling = false;
372						} else {
373	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
374								$(this).stop();
375							}).animate({
376								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
377							}, scrollSpeed, 'easeInOutCubic', function() {
378								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
379								UNCODE.scrolling = false;
380								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
381								||
382								$('.menu-hided').length ) {
383									calc_scroll = scrollSection.offset().top;
384									getOffset = UNCODE.get_scroll_offset(e);
385									calc_scroll -= getOffset;
386									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
387										$(this).stop();
388									}).animate({
389										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
390										}, scrollSpeed, 'easeInOutCubic', function() {
391											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
392											UNCODE.scrolling = false;
393										}
394									);
395								}
396							});
397						}
398					}
399				}
400			}
401		});
402		$('.header-scrolldown').on('click', function(event) {
403
404			event.preventDefault();
405
406			var pageHeader = $(event.target).closest('#page-header'),
407				pageHeaderTop = pageHeader.offset().top,
408				pageHeaderHeight = pageHeader.outerHeight(),
409				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
410			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
411
412			var calc_scroll = pageHeaderTop + pageHeaderHeight,
413			getOffset = UNCODE.get_scroll_offset(event);
414			calc_scroll -= getOffset;
415
416			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
417				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
418
419				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
420					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
421				}
422			}
423
424			if (scrollSpeed == 0) {
425				$('html, body').scrollTop(calc_scroll);
426				UNCODE.scrolling = false;
427			} else {
428					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
429						$(this).stop();
430					}).animate({
431						scrollTop: calc_scroll
432					}, scrollSpeed, 'easeInOutCubic', function() {
433						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
434						UNCODE.scrolling = false;
435						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
436							calc_scroll = pageHeaderTop + pageHeaderHeight;
437							getOffset = UNCODE.get_scroll_offset(event);
438							calc_scroll -= getOffset;
439								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
440									$(this).stop();
441								}).animate({
442									scrollTop: calc_scroll
443								}, scrollSpeed, 'easeInOutCubic', function() {
444									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
445									UNCODE.scrolling = false;
446								}
447							);
448						}
449					}
450				);
451			}
452		});
453	}
454
455	// Colomun hover effect
456	// =================
457	$(document).on('mouseenter', '.col-link', function(e) {
458		var uncol = $(e.target).prev('.uncol'),
459		el = uncol.find('.column-background');
460		if (el) {
461			$('.btn-container .btn', uncol).addClass('active');
462			var elOverlay = $(el[0]).find('.block-bg-overlay');
463			if (elOverlay.length) {
464				var getOpacity = $(elOverlay).css('opacity');
465				if (getOpacity != 1) {
466					getOpacity = Math.round(getOpacity * 100) / 100;
467					var newOpacity = getOpacity + .1;
468					$(elOverlay).data('data-opacity', getOpacity);
469					$(elOverlay).css('opacity', newOpacity);
470				}
471			}
472		}
473	}).on('mouseleave', '.col-link', function(e) {
474		var uncol = $(e.target).prev('.uncol'),
475		el = uncol.find('.column-background');
476		$('.btn-container .btn', uncol).removeClass('active');
477		if (el) {
478			var elOverlay = $(el[0]).find('.block-bg-overlay');
479			if (elOverlay.length) {
480				var getOpacity = $(elOverlay).data('data-opacity');
481				$(elOverlay).css('opacity', getOpacity);
482			}
483		}
484	});
485
486	// Admin bar
487	// ============
488	var fixAdminBar = function() {
489		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
490			var getAdminBar = $('#wpadminbar');
491			if (getAdminBar.length) {
492				if (getAdminBar.css('position') !== 'hidden') {
493					var getAdminBarHeight = getAdminBar.height();
494					if (getAdminBar.css('position') === 'fixed') {
495						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
496						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
497					} else {
498						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
499						$('.body-borders .top-border').css({'margin-top':'0px'});
500					}
501				}
502			}
503		}
504	};
505	window.addEventListener('load', fixAdminBar);
506	window.addEventListener('resize', fixAdminBar);
507	// Print
508	// ===========
509	var beforePrint = function() {
510		window.dispatchEvent(new CustomEvent('resize'));
511		window.dispatchEvent(UNCODE.boxEvent);
512	};
513
514	if (window.matchMedia) {
515		var mediaQueryList = window.matchMedia('print');
516		mediaQueryList.addListener(function(mql) {
517			if (mql.matches) {
518				beforePrint();
519			}
520		});
521	}
522
523	window.onbeforeprint = beforePrint;
524
525	// Safari srcset
526	var safariSrcSet = function(){
527		if ( !SiteParameters.is_frontend_editor ) {
528			$('html.safari img[sizes]').each(function(){
529				var $img = $(this),
530					sizeImg = parseInt($img.attr('sizes'));
531				if ( typeof(sizeImg) === 'number' ) {
532					$img.attr('sizes', (sizeImg) + 'px');
533				}
534			});
535		}
536	};
537	window.addEventListener('load', safariSrcSet);
538}
539
540UNCODE.lettering = function() {
541
542	var setCTA;
543	var highlightStill = function(){
544
545		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
546
547		$.each($heading_texts, function(key, el) {
548			var $heading = $(el);
549
550			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
551				return;
552			}
553
554			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
555				return;
556			}
557
558			var waypoint = new Waypoint({
559				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
560				element: el,
561				handler: function() {
562					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
563						anims_l = $anims.length;
564					$anims.each(function(_key_, _el_){
565						var $anim = $(_el_);
566
567						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
568							$anim.addClass('heading-text-highlight-animated');
569
570							if ( $heading.data('animate') === true ) {
571								$anim.css({
572									'-webkit-transition-duration': '0ms',
573									'-moz-transition-duration': '0ms',
574									'-o-transition-duration': '0ms',
575									'transition-duration': '0ms',
576								});
577							} else {
578								$anim.css({
579									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
580									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
581									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
582									'transition-delay': ((_key_ + 2) * 200) + 'ms',
583								});
584							}
585						}
586
587					});
588					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
589						$heading.data('animate', true);
590					});
591					$anims.removeAttr('data-animated');
592				},
593				offset: '100%'
594			});
595
596		});
597
598		Waypoint.refreshAll();
599		$( document.body ).trigger('uncode_waypoints');
600		if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
601			$(document).trigger('uncode-scrolltrigger-refresh');
602		}
603
604	}
605
606	requestTimeout(function(){
607		highlightStill();
608		$(window).on( 'wwResize', function(){
609			clearRequestTimeout(setCTA);
610			setCTA = requestTimeout( highlightStill, 100 );
611		});
612	}, 400);
613
614};
615
616UNCODE.isUnmodalOpen = false;
617
618var manageVideoSize = function(){
619
620	var setVideoFit;
621	$('.wp-block-embed').each(function(){
622
623		var $this = $(this);
624
625		if ( $('iframe', $this).length ) {
626
627			var $iframe = $('> iframe, > a > iframe', $this),
628				w = parseFloat($iframe.attr('width')),
629				h = parseFloat($iframe.attr('height')),
630				url = $iframe.attr('src'),
631				ratio, frW;
632
633			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
634
635				ratio = h / w;
636				var setResizeiFto,
637					resizeiFrame = function(){
638					frW = $iframe.width();
639					$iframe.css({
640						height: frW * ratio
641					});
642				};
643				resizeiFrame();
644				$(window).on( 'wwResize load', function(){
645					clearRequestTimeout(setResizeiFto);
646					setResizeiFto = requestTimeout( function() {
647						resizeiFrame();
648					}, 10 );
649				});
650
651			}
652
653		}
654
655	});
656
657};
658
659manageVideoSize();
660
661UNCODE.vivus = function(icon, time, delay, file) {
662	if (typeof Vivus !== 'undefined') {
663		var icon_options = {
664			type: 'delayed',
665			pathTimingFunction: Vivus.EASE_OUT,
666			animTimingFunction: Vivus.LINEAR,
667			duration: time,
668		}
669
670		if (delay) {
671			icon_options.delayStart = delay;
672		}
673
674		if (file) {
675			icon_options.file = file;
676		}
677
678		new Vivus(icon, icon_options);
679	}
680};
681
682UNCODE.lastURL = '';
683
684UNCODE.getURLParams = function(current_location, is_string) {
685	var params = {};
686	if (is_string) {
687		var url = current_location.split('?')[1];
688	} else {
689		var url = current_location.search;
690		url = url.substring(1);
691	}
692	if (url) {
693		var parts = url.split('&');
694		for (var i = 0; i < parts.length; i++) {
695			var nv = parts[i].split('=');
696			if (!nv[0]) {
697				continue;
698			}
699			params[nv[0]] = nv[1] || true;
700		}
701	}
702	return params;
703}
704
705UNCODE.hasEqualURLParams = function(obj1, obj2) {
706	for (var i in obj1) {
707		if (obj1.hasOwnProperty(i)) {
708			if (!obj2.hasOwnProperty(i)) {
709				return false;
710			}
711			if (obj1[i] != obj2[i]) {
712				return false;
713			}
714		}
715	}
716	for (var i in obj2) {
717		if (obj2.hasOwnProperty(i)) {
718			if (!obj1.hasOwnProperty(i)) {
719				return false;
720			}
721			if (obj1[i] != obj2[i]) {
722				return false;
723			}
724		}
725	}
726    return true;
727}
728
729UNCODE.magnetic = function(){
730	
731	$(document).on('mousemove', '.un-magnetic-zone', function(e){
732
733		var $zone = $(this),
734			zoneOff = $zone.offset(),
735			$mgntcEl = $('.un-magnetic-el', this),
736			elBound = this.getBoundingClientRect(),
737			maxSize = Math.max($zone.outerWidth(), $zone.outerHeight());
738
739		var Xvalue = e.pageX - (zoneOff.left + maxSize / 2),
740	  		Yvalue = e.pageY - (zoneOff.top + maxSize / 2);
741	  
742		$mgntcEl.each(function(key, val){
743			var magneticValue = $(val).attr('data-mgntc') || 0.5;
744		
745			val.animate({
746				transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)',
747			},{
748				duration: 500,
749				fill: 'forwards',
750			})
751	  	});
752	})
753	
754	$(document).on('mouseleave', '.un-magnetic-zone', function(e){
755		var $mgntcEl = $('.un-magnetic-el', this);
756
757		$mgntcEl.each(function(key, val){
758			val.animate({
759		  		transform: 'translate(0)',
760			},{
761		  		duration: 500,
762		  		fill: 'forwards',
763			})
764	  	});
765	})
766};
767
768UNCODE.rowParallax = function(){
769
770	if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) {
771		return;
772	}
773
774	var $rows = $('.parallax-move'),
775		stableHeight = UNCODE.wheight;
776	$rows.each(function(){
777		var $row = $(this),
778			_row = $row[0],
779			dataMove = $row.attr('data-parallax-move'),
780			dataSafe = $row.attr('data-parallax-safe'),
781            rowInViewport = false,
782			trans;
783
784		if ( $row.find('.parallax-move').length ) {
785			return;
786		}
787
788		dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe;
789		dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove;           
790        dataMove = dataMove / 10;
791
792        if ( 'IntersectionObserver' in window ) {
793			var observer = new IntersectionObserver(function(entries) {
794	
795				entries.forEach(function(entry){
796					if ( entry.isIntersecting ) {
797						rowInViewport = true;
798					} else {
799						rowInViewport = false;
800					}
801				});
802	
803			}, { 
804				root: document,
805			});
806	
807			observer.observe(_row);
808		} else {
809            rowInViewport = true;
810		}
811
812		var loopRAF = function() {
813			if( rowInViewport ) {
814				var bound = _row.getBoundingClientRect(),
815					bound_top = bound.top,
816					bound_height = bound.height,
817					move = true,
818					scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
819					docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
820						document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ),
821					fromBottom = docH - (scrolled + bound_top + bound_height);
822
823                if ( bound_height > stableHeight && dataSafe === 'yes' ) {
824                    $row.find('>div').css({
825                        'transform':'none'
826                    });
827                    move = false;
828				}
829
830				if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) {
831					$row.find('>div').css({
832						'transform':'none'
833					});
834					move = false;
835				}
836
837				if ( move ) {
838
839					if ( fromBottom < stableHeight ) {
840						//maybe Footer
841						trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove);
842                    } else if ( scrolled + bound_top < stableHeight ) {
843						//maybe Header
844						trans = scrolled*(dataMove);
845					} else {
846						trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove);
847					}
848
849                    $row.find('>div').css({
850                        'transform':'translateY(' + (trans) + 'px) translateZ(0)',
851                    });
852                }
853			}
854	
855			requestAnimationFrame(loopRAF);
856		};
857		
858		requestAnimationFrame(loopRAF);
859
860	});
861
862	$(window).on( 'load resize', function(e) {
863		if ( ! UNCODE.isMobile ) {
864			stableHeight = UNCODE.wheight;
865		}
866	});
867
868	$(window).on( 'load wwResize', function(e) {
869		if ( UNCODE.isMobile ) {
870			stableHeight = UNCODE.wheight;
871		}
872	});
873
874}
875
876UNCODE.changeSkinOnScroll = function(){
877	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
878		return;
879	}
880	var $masthead = $('#masthead'),
881		transDesktop,
882		transMobile,
883		changeSkin,
884
885	checkTransparencyAndChange = function( $col ){
886		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
887		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
888		changeSkin = $masthead.hasClass('menu-change-skin');
889
890		if ( ! transDesktop && ! transMobile ) {
891			return false;
892		}
893
894		if ( ! changeSkin ) {
895			return false;
896		}
897
898		if ( $col.hasClass('style-light') ){
899			$masthead.removeClass('style-dark-override').addClass('style-light-override');
900			return false;
901		} else if ( $col.hasClass('style-dark') ) {
902			$masthead.removeClass('style-light-override').addClass('style-dark-override');
903			return false;
904		}
905	};
906
907	var prev_row = 'normal',
908		odd = true,
909		$rows = $('.vc_row[data-parent]:visible');
910	$.each($rows, function(index, row){
911		var $row = $(row),
912			$col = $('.uncol', $row).first(),
913			$slider = $('.uncode-slider', $row);
914
915		var wayDown = new Waypoint({
916			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
917			element: row,
918			handler: function(direction) {
919				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
920					if ( $slider.length ) {
921						$col = $('.owl-item.index-active .uncol', $slider).first();
922					}
923					checkTransparencyAndChange($col);
924				}
925				if ( odd === false ) {
926					if ( row.hasAttribute('data-bg-changer') ) {
927						prev_row = 'bg-changer';
928					} else {
929						prev_row = 'normal';
930					}
931					odd = true;
932				} else {
933					odd = false;
934				}
935			},
936			offset: function() {
937				return UNCODE.menuHeight / 2
938			}
939		});
940		var wayUp = new Waypoint({
941			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
942			element: row,
943			handler: function(direction) {
944				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
945					if ( $slider.length ) {
946						$col = $('.owl-item.index-active .uncol', $slider).first();
947					}
948					checkTransparencyAndChange($col);
949				}
950				if ( odd === false ) {
951					if ( row.hasAttribute('data-bg-changer') ) {
952						prev_row = 'bg-changer';
953					} else {
954						prev_row = 'normal';
955					}
956					odd = true;
957				} else {
958					odd = false;
959				}
960			},
961			offset: function() {
962				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
963			}
964		});
965	});
966
967};
968
969UNCODE.share = function() {
970	if (typeof Share !== 'undefined') {
971		var share_button_element = $('.share-button');
972		var share_button_url = share_button_element.data('url');
973
974		var share_button_config = {
975			ui: {
976				flyout: "top center",
977				button_font: false,
978				button_text: '',
979				icon_font: false
980			}
981		};
982
983		if (share_button_url) {
984			share_button_config.url = share_button_url.replace("&", "%26");
985		}
986
987		var share_button_top = new Share('.share-button', share_button_config);
988
989		$('li[data-network]', share_button_element).each(function(){
990			var label = SiteParameters.uncode_share_label,
991				network = $(this).attr('data-network');
992			label = label.replace("%", network);
993			$(this).attr('aria-label', label);
994		});
995	}
996};
997
998UNCODE.tooltip = function() {
999	if (typeof jQuery.fn.tooltip !== 'undefined') {
1000		$('.btn-tooltip').tooltip();
1001	}
1002};
1003
1004UNCODE.counters = function() {
1005	var $counters = $('.uncode-counter:not(.counter-init)');
1006	$counters.each(function(){
1007		var $counter = $(this).addClass('counter-init');
1008		if ( SiteParameters.is_frontend_editor ) {
1009			$counter.addClass('started');
1010		}
1011		if ( $counter.closest( '.owl-carousel' ).length ) {
1012			return;
1013		}
1014		$counter.addClass('started').counterUp({
1015			delay: 10,
1016			time: 1500
1017		});
1018	});
1019};
1020
1021UNCODE.countdowns = function() {
1022	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
1023	$countdowns.each(function() {
1024		var $this = $(this).addClass('counter-init'),
1025			finalDate = $(this).data('uncode-countdown');
1026		$this.countdown(finalDate, function(event) {
1027			$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>'));
1028		});
1029	});
1030};
1031
1032UNCODE.tabs = function() {
1033
1034	var tabSwitcher = function($el){
1035		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1035ical):not(.tab-switch)', $el).each(function(key, value){
1036			var $navs = $(value),
1037				$active = $('li.active', $navs),
1038				$active_a = $('> a', $active),
1039				$active_span = $('> span', $active_a),
1040				vertical = $navs.closest('.vertical-tab-menu').length;
1041			
1042			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
1043				$navs.append('<span class="switcher-cursor" aria-hidden="true" tabindex="-1" />');
1044			}
1045
1046			var $cursor = $('.switcher-cursor', $navs),
1047				active_w = $('a', $active).outerWidth(),
1048				span_w = $active_span.outerWidth(),
1049				active_pos = $active.position(),
1050				active_a_pos = $active_a.position(),
1051				span_pos = $active_span.position(),
1052				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
1053				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
1054
1055			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
1056
1057			if ( ! vertical ) {
1058				$cursor.css({
1059					left: cursor_left,
1060					width: cursor_w
1061				});
1062			}
1063
1064			$navs.addClass('switch-init');
1065		});
1066	};
1067
1068	var $body = $('body');
1069	tabSwitcher($body);
1070
1071	var tabHoverIntent = function(){
1072		var setHover;
1073		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
1074			.on('mouseover', function(e){
1075				var $this = $(e.target);
1076				setHover = requestTimeout(function() {
1077					$this.trigger('hover-int');
1078				}, 50);
1079			})
1080			.on('mouseout', function(){
1081				clearRequestTimeout(setHover);
1082			});
1083	};
1084	tabHoverIntent();
1085
1086	var tabInit = function(){
1087		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
1088			e.preventDefault()
1089			var $el = $(this);
1090			$el.tab('show');
1091			var $container = $el.closest('.uncode-tabs');
1092			tabSwitcher($container);
1093			requestTimeout(function() {
1094				window.dispatchEvent(UNCODE.boxEvent);
1095				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
1096
1097				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
1098					window.dispatchEvent(new CustomEvent('boxResized'));
1099				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
1100					window.dispatchEvent(new Event('resize'));
1101					$(window).trigger('uncode.re-layout');
1102				} 
1103
1104				var $active_panel = $('.tab-pane.active', $tabs);
1105
1106				$.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) {
1107					var element = $(val),
1108						delayAttr = element.attr('data-delay');
1109					if (delayAttr == undefined) delayAttr = 0;
1110					requestTimeout(function() {
1111						element.addClass('start_animation');
1112					}, delayAttr);
1113				});
1114
1115			}, 300);
1116
1117			var $li = $el.closest('li'),
1118				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1119			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1120			$('.tab-pane', $li).slideDown(250);
1121			var completeSlideDown = requestTimeout(function(){
1122				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1123					var pos = $el.offset(),
1124						rect = $el[0].getBoundingClientRect(),
1125						$masthead = $('#masthead > .menu-container'),
1126						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1127
1128					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1129						$('html, body').animate({
1130							scrollTop: ( pos.top ) - considerMenu
1131						},{
1132							easing: 'easeInOutQuad',
1133							duration: 250
1134						});
1135					}
1136				}
1137			}, 260);
1138		});
1139	}
1140	tabInit();
1141
1142	var tabResponsive = function(){
1143		if ( SiteParameters.is_frontend_editor ) {
1144			return true;
1145		}
1146		var $tabContainers = $('.tab-container.tabs-breakpoint');
1147		$tabContainers.each(function(){
1148			var $tabContainer = $(this),
1149				$tabContent = $('.tab-content', $tabContainer),
1150				$nav = $('.nav-tabs', $tabContainer),
1151				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1152
1153			$('> li', $nav).each(function(){
1154				var $li = $(this),
1155					dataID = $li.attr('data-tab-id');
1156
1157				if ( UNCODE.wwidth <= mQuery ) {
1158					if ( ! $('.tab-pane', $li ).length ) {
1159						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1160						$tabContainer.addClass('tabs-appended');
1161						$li.append($append_pane);
1162					}
1163
1164					if ( $li.hasClass('active') ) {
1165						$('> a', $li).click();
1166					}
1167				} else {
1168					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1169						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1170						$tabContainer.removeClass('tabs-appended');
1171						$tabContent.prepend($append_pane.removeAttr('style'));
1172					}
1173				}
1174			});
1175		});
1176
1177	}
1178	tabResponsive();
1179
1180	$(window).on('wwResize', function(){
1181		tabHoverIntent();
1182		tabSwitcher($body);
1183	});
1184
1185	var setCTA;
1186	$(window).on( 'resize', function(){
1187		clearRequestTimeout(setCTA);
1188		setCTA = requestTimeout( tabResponsive, 100 );
1189	});
1190
1191	$('.nav-tabs').each(function(){
1192		var $nav = $(this),
1193			$lis = $('> li:not(.active)', $nav),
1194			$links = $('.tab-excerpt-link', $nav);
1195		$('.tab-excerpt', $lis).slideUp(400, function(){
1196			$(this).addClass('init');
1197		});
1198
1199		$links.each(function(){
1200			var $link = $(this),
1201				$par_a = $link.closest('a'),
1202				href = $link.attr('data-href'),
1203				target = $link.attr('data-target');
1204			$par_a.addClass('inner-link');
1205			$link.on('click', function(){
1206				var _link = document.createElement('a');
1207				_link.href = href;
1208				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1209				_link.click();
1210			});
1211		});
1212		$nav.addClass('tab-init');
1213	});
1214
1215	$('.uncode-tabs.tabs-no-lazy').each(function(){
1216		var $tabs = $(this),
1217			$panes = $('.tab-pane:not(.active)', $tabs);
1218		$panes.each(function(){
1219			var $pane = $(this),
1220				$imgs = $('img[loading="lazy"]', $pane);
1221			$imgs.removeAttr('loading');
1222			$imgs.removeAttr('decoding');
1223		});
1224	});
1225
1226};
1227UNCODE.collapse = function() {
1228	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1229		var $this = $(this),
1230			href
1231		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1232		var $target = $(target)
1233		var parent = $this.attr('data-parent')
1234		var $parent = parent && $(parent)
1235		var $title = $(this).parent()
1236		var $accordion = $(e.target).closest('.uncode-accordion')
1237		var $group = $this.closest('.group')
1238		var $panel_group = $this.closest('.panel-group')
1239		if ($parent) {
1240			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1241			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1242				$title.removeClass('active');
1243				$group.removeClass('active-group');
1244			} else {
1245				if ( $panel_group.attr('data-no-toggle') != true ) {
1246					$parent.find('.panel-title').removeClass('active')
1247					$parent.find('.group').removeClass('active-group')
1248				}
1249				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1250				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1251			}
1252		}
1253		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1254		requestTimeout(function() {
1255			var $accordion = $(e.target).closest('.uncode-accordion');
1256			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1257			  window.dispatchEvent(new CustomEvent('boxResized'));
1258			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1259				window.dispatchEvent(new Event('resize'));
1260				$(window).trigger('uncode.re-layout');
1261			} 
1262
1263			var $active_panel = $('.panel.active-group', $parent);
1264
1265			$.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) {
1266				var element = $(val),
1267					delayAttr = element.attr('data-delay');
1268				if (delayAttr == undefined) delayAttr = 0;
1269				requestTimeout(function() {
1270					element.addClass('start_animation');
1271				}, delayAttr);
1272			});
1273
1274		}, 500);
1275
1276		$group.find('.panel-title:not(.active) > a').trigger('blur');
1277
1278	});
1279
1280	$('.uncode-accordion.tabs-no-lazy').each(function(){
1281		var $accordion = $(this),
1282			$panes = $('.panel:not(.active-group)', $accordion);
1283		$panes.each(function(){
1284			var $pane = $(this),
1285				$imgs = $('img[loading="lazy"]', $pane);
1286			$imgs.removeAttr('loading');
1287			$imgs.removeAttr('decoding');
1288		});
1289	});
1290};
1291
1292UNCODE.accessibility = function() {
1293    if ( ! SiteParameters.uncode_is_accessible ) {
1294        return;
1295    }
1296
1297    //
1298
1299};
1300UNCODE.bigText = function(el) {
1301	var bigTextLaunch = function(){
1302		if (el == undefined) {
1303			el = $('body');
1304		}
1305		$.each($('.bigtext', el), function(index, val) {
1306			$(val).bigtext({
1307				minfontsize: 24
1308			});
1309			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1310				opacity: 1
1311			});
1312			requestTimeout(function() {
1313				if ($(val).find('.animate_when_almost_visible').length != 0) {
1314					$(val).css({opacity: 1});
1315				}
1316			}, 400);
1317		});
1318	};
1319
1320	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1321		bigTextLaunch();
1322	}
1323	$(window).on( 'load', bigTextLaunch );
1324};
1325
1326UNCODE.process_shortpixel_image = function(image) {
1327	var data = {
1328		action: 'shortpixel_manual_optimization',
1329		image_id: image,
1330		cleanup: true
1331	};
1332
1333	$.get(SiteParameters.ajax_url, data);
1334};
1335
1336UNCODE.menuSystem = function() {
1337
1338	function menuMobile() {
1339		var $body = $('body'),
1340			scrolltop,
1341			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'),
1342			$masthead = $('#masthead'),
1343			$box,
1344			$el,
1345			$el_transp,
1346			elHeight,
1347			offCanvasAnim,
1348			check,
1349			animating = false,
1350			stickyMobile = false,
1351			menuClose = new CustomEvent('menuMobileClose'),
1352			menuOpen = new CustomEvent('menuMobileOpen');
1353		UNCODE.menuOpened = false;
1354		$mobileToggleButton.on('click', function(event) {
1355			event.stopPropagation();
1356			var btn = this;
1357			if ($(btn).hasClass('overlay-close')) return;
1358			event.preventDefault();
1359			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1360			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1361				$box = $(this).closest('.box-container').find('.main-menu-container');
1362				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
1363				$el_transp = $('.menu-absolute.menu-transparent');
1364				if (UNCODE.isMobile) {
1365					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 ) {
1366						stickyMobile = true;
1367						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1368					} else {
1369						elHeight = 0;
1370						$.each($box.find('> div'), function(index, val) {
1371							elHeight += $(val).outerHeight();
1372						});
1373					}
1374				} else {
1375					elHeight = 0;
1376					$.each($el, function(index, val) {
1377						elHeight += $(val).outerHeight();
1378					});
1379				}
1380				var open = function() {
1381					clearTimeout(offCanvasAnim);
1382					if (!animating) {
1383						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1384						scrolltop = $(window).scrollTop();
1385						window.dispatchEvent(menuOpen);
1386						animating = true;
1387						UNCODE.menuOpened = true;
1388						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1389							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1390								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1391							}
1392							if ($('body.menu-offcanvas').length) {
1393								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1394								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1395							} else {
1396								if ( $('.menu-hide, .menu-sticky').length ) {
1397									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1398										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1399									}
1400								}
1401							}
1402						}
1403						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1404							//$("#masthead")[0].scrollIntoView();
1405							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1406						}
1407						$box.addClass('open-items');
1408						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1409							$el_transp.addClass('is_mobile_open');
1410						}
1411						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1412							btn.classList.add('close');
1413							$box.animate({
1414								height: elHeight
1415							}, 600, "easeInOutCirc", function() {
1416								animating = false;
1417								if (!stickyMobile) $box.css('height', 'auto');
1418							});
1419						} else {
1420							animating = false;
1421						}
1422					}
1423				};
1424
1425				var close = function() {
1426					clearTimeout(offCanvasAnim);
1427					if (!animating) {
1428						window.dispatchEvent(menuClose);
1429						animating = true;
1430						UNCODE.menuOpened = false;
1431						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1432							btn.classList.remove('close');
1433							btn.classList.add('closing');
1434						}
1435						$box.addClass('close');
1436						requestTimeout(function() {
1437							$box.removeClass('close');
1438							$box.removeClass('open-items');
1439							btn.classList.remove('closing');
1440							if ($el_transp.length) {
1441								$el_transp.removeClass('is_mobile_open');
1442							}
1443						}, 500);
1444						$body.removeClass('opening-overlay-menu');
1445						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1446							$box.animate({
1447								height: 0
1448							}, {
1449								duration: 600,
1450								easing: "easeInOutCirc",
1451								complete: function(elements) {
1452									$(elements).css('height', '');
1453									animating = false;
1454									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1455										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1456									}
1457									$body.removeClass('open-overlay-menu');
1458								}
1459							});
1460						} else {
1461							animating = false;
1462							offCanvasAnim = setTimeout(function(){
1463								$body.removeClass('open-overlay-menu');
1464							}, 1000);
1465						}
1466					}
1467				};
1468				check = (!UNCODE.menuOpened) ? open() : close();
1469			}
1470		});
1471
1472		$('html').on('click', function(event){
1473			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1474				$('.uncode-close-offcanvas-mobile').trigger('click');
1475			}
1476		});
1477
1478		window.addEventListener('menuMobileTrigged', function(e) {
1479			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1480		});
1481		window.addEventListener('orientationchange', function(e) {
1482			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1483		});
1484		window.addEventListener("resize", function() {
1485			if ($(window).width() < UNCODE.mediaQuery) {
1486				if (UNCODE.isMobile) {
1487					var $box = $('.box-container .main-menu-container'),
1488						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
1489					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1490						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1491							elHeight = 0;
1492							$.each($el, function(index, val) {
1493								elHeight += $(val).outerHeight();
1494							});
1495							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;
1496							$($box).css('height', elHeight + 'px');
1497						}
1498					}
1499				}
1500			} else {
1501				$('.menu-hide-vertical').removeAttr('style');
1502				$('.menu-container-mobile').removeAttr('style');
1503				$('.vmenu-container.menu-container').removeAttr('style');
1504			}
1505		});
1506
1507		$(window).on('scroll', function(){
1508			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1509				$(window).scrollTop(scrolltop);
1510				return false;
1511			}
1512		});
1513
1514	};
1515
1516	function menuOffCanvas() {
1517		var menuClose = new CustomEvent('menuCanvasClose'),
1518			menuOpen = new CustomEvent('menuCanvasOpen');
1519		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1520			if ($(window).width() > UNCODE.mediaQuery) {
1521				if ( $('body.vmenu-offcanvas-overlay').length ) {
1522					if ($(event.currentTarget).hasClass('off-close')) {
1523						$(event.currentTarget).removeClass('off-close');
1524						requestTimeout(function() {
1525							window.dispatchEvent(menuClose);
1526						}, 500);
1527
1528					} else {
1529						$(event.currentTarget).addClass('off-close');
1530						window.dispatchEvent(menuOpen);
1531					}
1532				} else {
1533					if ($(event.currentTarget).hasClass('close')) {
1534						$(event.currentTarget).removeClass('close');
1535						$(event.currentTarget).addClass('closing');
1536						requestTimeout(function() {
1537							$(event.currentTarget).removeClass('closing');
1538							window.dispatchEvent(menuClose);
1539						}, 500);
1540
1541					} else {
1542						$(event.currentTarget).addClass('close');
1543						window.dispatchEvent(menuOpen);
1544					}
1545				}
1546			}
1547
1548			$('body').toggleClass('off-opened');
1549		});
1550
1551		$('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){
1552			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1553				var $vMenuCont = $('#masthead .vmenu-container'),
1554					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1555
1556					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1557					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1558					vmenu_off = $vMenuCont.offset(),
1559					vmenu_l = parseFloat(vmenu_off.left),
1560					vmenu_t = parseFloat(vmenu_off.top),
1561					vmenu_r = vmenu_l + vmenu_w,
1562					vmenu_b = vmenu_t + vmenu_h,
1563
1564					close_h = parseFloat( $close_menu.outerHeight() ),
1565					close_w = parseFloat( $close_menu.outerWidth() ),
1566					close_off = $close_menu.offset(),
1567					close_l = parseFloat(close_off.left),
1568					close_t = parseFloat(close_off.top),
1569					close_r = close_l + close_w,
1570					close_b = close_t + close_h;
1571				if (
1572					!(
1573						e.clientX > vmenu_l &&
1574						e.clientX < vmenu_r &&
1575						e.clientY > vmenu_t &&
1576						e.clientY < vmenu_b
1577					)
1578					||
1579					(
1580						e.clientX > close_l &&
1581						e.clientX < close_r &&
1582						e.clientY > close_t &&
1583						e.clientY < close_b
1584					)
1585				) {
1586					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1587				}
1588			}
1589		});
1590	};
1591
1592	function menuOverlay() {
1593		if ( $('.overlay').length ) {
1594			$('.overlay').removeClass('hidden');
1595		}
1596		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1597			$('.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) {
1598				var transDelay = (index / 20) + 0.1;
1599				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1600					transDelay = transDelay + 0.3;
1601				$(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');
1602			});
1603		}
1604
1605	};
1606	var $secondary_parent;
1607	function menuAppend() {
1608		var $body = $('body'),
1609			$menuCont = $('.menu-container:not(.vmenu-container)'),
1610			$vMenuCont = $('.menu-container.vmenu-container'),
1611			$cta = $('.navbar-cta'),
1612			$socials = $('.navbar-social:not(.appended-navbar)'),
1613			$ul = $('.navbar-main ul.menu-primary-inner'),
1614			$ulCta,
1615			$ulSocials,
1616			$navLast,
1617			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1618			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1619			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1620			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1621			$ulFirst = $('> ul', $firstNav),
1622			$ulSecond = $('> ul', $secondNav),
1623			setCTA,
1624			appendCTA = function(){
1625				return true;
1626			},
1627			appendSocials = function(){
1628				return true;
1629			},
1630			appendSplit = function(){
1631				return true;
1632			};
1633
1634		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1635			$ulCta = $('> ul', $cta);
1636			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1637
1638			appendCTA = function(){
1639				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1640					$ul.after($ulCta);
1641				} else {
1642					$cta.append($ulCta);
1643				}
1644			}
1645		}
1646
1647		if ( ! $body.hasClass('cta-not-appended') ) {
1648			appendCTA();
1649		}
1650
1651		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1652		$smartSocial.each(function(){
1653			var $_smartSocial = $(this);
1654			$('> li', $_smartSocial).each(function(){
1655				var $li = $(this);
1656				if ( $li.hasClass('mobile-hidden') ) {
1657					$_smartSocial.addClass('mobile-hidden');
1658				} else {
1659					$_smartSocial.removeClass('mobile-hidden');
1660					return false;
1661				}
1662			});
1663
1664			$('> li', $_smartSocial).each(function(){
1665				var $li = $(this);
1666				if ( $li.hasClass('tablet-hidden') ) {
1667					$_smartSocial.addClass('tablet-hidden');
1668				} else {
1669					$_smartSocial.removeClass('tablet-hidden');
1670					return false;
1671				}
1672			});
1673		});
1674
1675		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1676			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1677			if ( $body.hasClass('hmenu-center-split') ) {
1678				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1679			} else {
1680				$navLast = $('.navbar-nav-last', $vMenuCont);
1681			}
1682
1683			if ( ! $navLast.length ) {
1684				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1685				if ( $body.hasClass('hmenu-center-split') ) {
1686					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1687					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1688				} else {
1689					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1690					$navLast = $('.navbar-nav-last', $vMenuCont);
1691				}
1692			}
1693
1694			appendSocials = function(){
1695				if ( !$body.hasClass('menu-overlay-center') ) {
1696				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1697				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1698				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1699				// 		$ulSocials.each(function(){
1700				// 			var $li_social = $(this);
1701				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1702				// 		});
1703				// 	}
1704				// } else {
1705					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1706						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1707						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1708							$('> ul.menu-smart-social li', $socials).remove();
1709						}
1710						$navLast.append($ulSocials);
1711					} else {
1712						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1713							$('> ul.menu-smart-social li', $navLast).remove();
1714						}
1715						$socials.append($ulSocials);
1716					}
1717				}
1718			}
1719			appendSocials();
1720		}
1721
1722		if ( $vMenuCont.length ) {
1723			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1724		} else {
1725			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1726		}
1727		if ( $accordion_secondary.length ) {
1728			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1729			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1730				if ( !$accordion_secondary_ph.length ) {
1731					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1732				}
1733				if ( $vMenuCont.length ) {
1734					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1735				} else {
1736					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1737						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1738					} else {
1739						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1740					}
1741				}
1742			} else {
1743				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1744					$accordion_secondary_ph.before($accordion_secondary);
1745				}
1746			}
1747		}
1748
1749		if ( $vMenuCont.length ) {
1750			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1751		} else {
1752			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1753		}
1754
1755		if ( $extra_icons.length ) {
1756			if ( $vMenuCont.length ) {
1757				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1758					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1759						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1760							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1761						$not_social.each(function(){
1762							if ( ! $primary_after.length ) {
1763								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1764								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1765								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1766							}
1767							var $extra_li = $(this);
1768							$primary_after.find('> ul').append($extra_li);
1769						});
1770					} else {
1771						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1772							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1773						$not_social.each(function(){
1774							var $extra_li = $(this);
1775							$extra_icons.find('> ul').append($extra_li);
1776						});
1777					}
1778				} /*else {
1779					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1780					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1781						if ( !$extra_icons_ph.length ) {
1782							$extra_icons.after('<span class="extra-icons-ph" />');
1783						}
1784						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1785							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1786						} else {
1787							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1788						}
1789					} else {
1790						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1791							$extra_icons_ph.before($extra_icons);
1792						}
1793					}
1794				}*/
1795			} else {
1796				if ( ! $body.hasClass('hmenu-center-double') ) {
1797					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1798						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1799							$primary_after = $('.nav.navbar-main-after', $menuCont);
1800
1801						if ( ! $primary_after.length && $not_social.length ) {
1802							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1803								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1804							} else {
1805								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1806							}
1807							$primary_after = $('.nav.navbar-main-after', $menuCont);
1808							$primary_after.append('<ul class="menu-smart sm menu-smart-social" role="menu" />');
1809						}
1810						var tablet_hidden = true,
1811							mobile_hidden = true;
1812						$not_social.each(function(){
1813							var $extra_li = $(this);
1814							$primary_after.find('> ul').append($extra_li);
1815							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1816								tablet_hidden = false;
1817							}
1818							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1819								mobile_hidden = false;
1820							}
1821						});
1822						if ( tablet_hidden === true && $not_social.length ) {
1823							$primary_after.addClass('tablet-hidden');
1824						}
1825						if ( mobile_hidden === true && $not_social.length ) {
1826							$primary_after.addClass('mobile-hidden');
1827						}
1828					} else {
1829						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1830
1831						if ( $primary_after.length ) {
1832							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1833							$not_social.each(function(){
1834								var $extra_li = $(this);
1835								$extra_icons.find('> ul').append($extra_li);
1836							});
1837							$primary_after.remove();
1838						}
1839					}
1840				}
1841			}
1842		}
1843
1844		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1845			appendSplit = function(){
1846				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1847					if ( $extra_icons.length ) {
1848						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1849							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1850								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1851							$not_social.each(function(){
1852								var $extra_li = $(this);
1853								$append_ul.append($extra_li);
1854							});
1855							if ( $secondNav.length ) {
1856								$secondNav.append($append_ul);
1857							} else {
1858								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1859							}
1860						}
1861					}
1862					if ( $secondNav.length ) {
1863						$secondNav.prepend($ulFirst);
1864					} else {
1865						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1866					}
1867					$firstMenu.hide();
1868				} else {
1869					$firstNav.append($ulFirst);
1870					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1871					if ( $append_ul.length ) {
1872						var $not_social = $('> li:not(.social-icon)', $append_ul);
1873						$not_social.each(function(){
1874							var $extra_li = $(this);
1875							$extra_icons.find('> ul').append($extra_li);
1876						});
1877					}
1878					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1879					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1880					$firstMenu.css({
1881						'display': 'table-cell'
1882					});
1883				}
1884			}
1885		}
1886		appendSplit();
1887
1888		$(window).on( 'wwresize', function(){
1889			clearRequestTimeout(setCTA);
1890			setCTA = requestTimeout( function() {
1891				appendCTA();
1892				appendSocials();
1893				appendSplit();
1894			}, 10 );
1895		});
1896	}
1897	//menuMobileButton();
1898	menuMobile();
1899	menuOffCanvas();
1900	menuAppend();
1901	menuOverlay();
1902
1903	var stickyDropdownSearch = function(){
1904		var $masthead = $('#masthead'),
1905			$ddSearch = $('.overlay.overlay-search', $masthead),
1906			$styles = $('#stickyDropdownSearch').remove();
1907		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1908			var $menuWrapper = $('.menu-wrapper'),
1909				$navbar = $('.menu-container-mobile', $menuWrapper),
1910				navbarH = $navbar.outerHeight(),
1911				//$topbar = $('.top-menu', $menuWrapper),
1912				//topbarH = $topbar.outerHeight(),
1913				_css;
1914
1915			_css = '<style id="stickyDropdownSearch">';
1916			_css += '@media (max-width: 959px) {';
1917			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
1918			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
1919			_css += '}';
1920			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
1921			_css += 'position: fixed;';
1922			_css += 'top: 0;';
1923			_css += '}';
1924			_css += '</style>';
1925
1926			$(_css).appendTo($('head'));
1927		}
1928	}
1929	stickyDropdownSearch();
1930
1931	var setMenuOverlay;
1932	$(window).on( 'wwResize', function(){
1933		if ( $('.overlay').length && $(window).width() > 1024 ) {
1934			$('.overlay').addClass('hidden');
1935		}
1936		clearRequestTimeout(setMenuOverlay);
1937		setMenuOverlay = requestTimeout( function(){
1938			menuOverlay();
1939			menuAppend();
1940			stickyDropdownSearch();
1941		}, 150 );
1942	});
1943	UNCODE.menuSmartInit();
1944};
1945
1946UNCODE.menuSmartInit = function() {
1947	var $menusmart = $('[class*="menu-smart"]'),
1948		$masthead = $('#masthead'),
1949		$hMenu = $('.menu-horizontal-inner', $masthead),
1950		$focus = $('.overlay-menu-focus'),
1951		showTimeout = 50,
1952		hideTimeout = 50,
1953		showTimeoutFunc, hideTimeoutFunc;
1954
1955	$('> li.menu-item-has-children', $menusmart).hover(function(){
1956		$(this).data('hover', true);
1957	}, function(){
1958		$(this).data('hover', false);
1959	});
1960
1961	$('> li.menu-item-has-children', $menusmart).each(function(){
1962		var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
1963	});
1964
1965	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
1966		e.preventDefault();
1967	});
1968
1969	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
1970		var $notLis = $('> .nav > ul > li a', $hMenu),
1971			$menuA = $('a', $masthead).not($notLis),
1972			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
1973			showFuncCond = function() { return true };
1974
1975		if ( $('body').hasClass('focus-megamenu') ) {
1976			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner');
1977			showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') };
1978		} else if ( $('body').hasClass('focus-links') ) {
1979			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
1980		}
1981
1982		$hoverSelector.hover(function(){
1983			clearRequestTimeout(hideTimeoutFunc);
1984			showTimeoutFunc = requestTimeout(function(){
1985				$('body').addClass('navbar-hover');
1986			}, showTimeout*2);
1987		}, function(){
1988			hideTimeoutFunc = requestTimeout(function(){
1989				if ( ! $('.overlay-search.open', $masthead).length ) {
1990					$('body').removeClass('navbar-hover');
1991				}
1992			}, hideTimeout*2);
1993		});
1994	} else {
1995		showFuncCond = function() { return false };
1996	}
1997
1998	if ($menusmart.length > 0) {
1999		$menusmart.smartmenus({
2000			subIndicators: false,
2001			subIndicatorsPos: 'append',
2002			//subMenusMinWidth: '13em',
2003			subIndicatorsText: '',
2004			showTimeout: showTimeout,
2005			hideTimeout: hideTimeout,
2006			scrollStep: 8,
2007			showFunction: function($ul, complete) {
2008				clearRequestTimeout(showTimeoutFunc);
2009				$ul.fadeIn(0, 'linear', function(){
2010					complete();
2011					if ( $ul.hasClass('vc_row') ) {
2012						$ul.css({
2013							'display': 'table'
2014						});
2015					}
2016					if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) {
2017						$('body').addClass('open-megamenu');
2018					}
2019					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
2020						$('body').addClass('navbar-hover');
2021					}
2022				}).addClass('open-animated');
2023			},
2024			hideFunction: function($ul, complete) {
2025				if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) {
2026					$('body').removeClass('open-megamenu');
2027				}
2028				var fixIE = $('html.ie').length;
2029				if (fixIE) {
2030					var $rowParent = $($ul).closest('.main-menu-container');
2031					$rowParent.height('auto');
2032				}
2033				$ul.fadeOut(0, 'linear', function(){
2034					complete();
2035					$ul.removeClass('open-animated');
2036					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
2037						$('body').removeClass('open-submenu');
2038					}
2039				});
2040			},
2041			collapsibleShowFunction: function($ul, complete) {
2042				$ul.slideDown(400, 'easeInOutCirc', complete);
2043			},
2044			collapsibleHideFunction: function($ul, complete) {
2045				$ul.slideUp(200, 'easeInOutCirc', complete);
2046			},
2047			hideOnClick: SiteParameters.menuHideOnClick,
2048		});
2049
2050		if ( $('body').hasClass('menu-accordion-active') ) {
2051			$menusmart.each(function(key, menu){
2052				$(menu).addClass('menu-smart-init');
2053				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2054			});
2055		}
2056		
2057		$(document).on( 'uncode.smartmenu-appended', function(){
2058			requestTimeout(function(){
2059				$menusmart.smartmenus( 'refresh' );
2060			}, 1000);
2061		});
2062	}
2063
2064	$('.main-menu-container').each(function(){
2065		var $main_cont = $(this),
2066			$uls = $('ul', $main_cont);
2067
2068		$uls.each(function(){
2069			var $ul = $(this),
2070				mobile_hidden = true,
2071				tablet_hidden = true;
2072			$('> li:not(.hidden)', $ul).each(function(){
2073				if ( !$(this).hasClass('mobile-hidden') ) {
2074					mobile_hidden = false;
2075					return false;
2076				}
2077			});
2078			$('> li:not(.hidden)', $ul).each(function(){
2079				if ( !$(this).hasClass('tablet-hidden') ) {
2080					tablet_hidden = false;
2081					return false;
2082				}
2083			});
2084			if ( mobile_hidden ) {
2085				$ul.addClass('mobile-hidden');
2086			}
2087			if ( tablet_hidden ) {
2088				$ul.addClass('tablet-hidden');
2089			}
2090		});
2091
2092		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2093
2094		$divUlsMB.each(function(){
2095			var $divUlMB = $(this),
2096				div_mobile_hidden = true,
2097				div_tablet_hidden = true;
2098
2099			$('> ul:not(.hidden)', $divUlMB).each(function(){
2100				if ( !$(this).hasClass('mobile-hidden') ) {
2101					div_mobile_hidden = false;
2102					return false;
2103				}
2104			});
2105			$('> ul:not(.hidden)', $divUlMB).each(function(){
2106				if ( !$(this).hasClass('tablet-hidden') ) {
2107					div_tablet_hidden = false;
2108					return false;
2109				}
2110			});
2111			if ( div_mobile_hidden ) {
2112				$divUlMB.addClass('mobile-hidden');
2113			}
2114			if ( div_tablet_hidden ) {
2115				$divUlMB.addClass('tablet-hidden');
2116			}
2117		});
2118	});
2119
2120	var overlaySearchButton = function(){
2121		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2122
2123		$search_wrap.each(function(){
2124			var $form = $('form', this),
2125				$icon = $('i', $form);
2126
2127			$icon.on('click', function(){
2128				$form.submit();
2129			});
2130		});
2131	};
2132	overlaySearchButton();
2133}
2134
2135UNCODE.okvideo = function(ev) {
2136	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2137	$.okvideo = function(options) {
2138		// if the option var was just a string, turn it into an object
2139		if (typeof options !== 'object') options = {
2140			'video': options
2141		};
2142		var base = this;
2143		// kick things off
2144		base.init = function() {
2145			base.options = $.extend({}, $.okvideo.options, options);
2146			// support older versions of okvideo
2147			if (base.options.video === null) base.options.video = base.options.source;
2148			base.setOptions();
2149			var target = base.options.target || $('body');
2150			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2151			var zIndex = base.options.controls === 3 ? -999 : "auto";
2152			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2153				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>';
2154				if (OKEvents.utils.isMobile()) {
2155					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>');
2156				} else {
2157					if (base.options.controls === 3) {
2158						target.append(mask)
2159					}
2160					if (base.options.adproof === 1) {
2161						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>');
2162					} else {
2163						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>');
2164					}
2165				}
2166				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2167				if (base.options.playlist.list === null) {
2168					if (base.options.video.provider === 'youtube') {
2169						base.loadYouTubeAPI();
2170					} else if (base.options.video.provider === 'vimeo') {
2171						base.options.volume /= 100;
2172						base.loadVimeoAPI();
2173					}
2174				} else {
2175					base.loadYouTubeAPI();
2176				}
2177			}
2178		};
2179		// clean the options
2180		base.setOptions = function() {
2181			// exchange 'true' for '1' and 'false' for 3
2182			for (var key in this.options) {
2183				if (this.options[key] === true) this.options[key] = 1;
2184				if (this.options[key] === false) this.options[key] = 3;
2185			}
2186			if (base.options.playlist.list === null) {
2187				base.options.video = base.determineProvider();
2188			}
2189			// pass options to the window
2190			$(window).data('okoptions-' + base.options.id, base.options);
2191		};
2192		// insert js into the head and exectue a callback function
2193		base.insertJS = function(src, callback, provider){
2194			var tag;
2195			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2196				delete UNCODE.insertedSripts[src];
2197				var tags = document.getElementsByTagName('script');
2198				for (var i = tags.length; i >= 0; i--){
2199					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2200						tags[i].parentNode.removeChild(tags[i]);
2201					}
2202				}
2203			} else {
2204				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2205					tag = UNCODE.insertedSripts[src];
2206					if (callback){
2207						if (tag.readyState){  //IE
2208							tag.onreadystatechange = function(){
2209								if (tag.readyState === "loaded" ||
2210									tag.readyState === "complete"){
2211									tag.onreadystatechange = null;
2212									callback();
2213								}
2214							};
2215						} else {
2216							$(tag).on('load', callback);
2217						}
2218					}
2219					return;
2220				}
2221			}
2222			tag = document.createElement('script');
2223			if (callback){
2224				if (tag.readyState){  //IE
2225					tag.onreadystatechange = function(){
2226						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2227							tag.onreadystatechange = null;
2228							callback();
2229						}
2230					};
2231				} else {
2232					tag.onload = function() {
2233						callback();
2234					};
2235				}
2236			}
2237			tag.src = src;
2238			var firstScriptTag = document.getElementsByTagName('script')[0];
2239			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2240			if ( ! UNCODE.insertedSripts ) {
2241				UNCODE.insertedSripts = [];
2242			}
2243			UNCODE.insertedSripts[src] = tag;
2244		};
2245		// load the youtube api
2246		base.loadYouTubeAPI = function(callback) {
2247			if ( ev === 'uncode-more-items-loaded' ) {
2248				onYouTubeIframeAPIReady();
2249			} else {
2250				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2251			}
2252		};
2253		base.loadYouTubePlaylist = function() {
2254			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2255		};
2256		// load the vimeo api by replacing the div with an iframe and loading js
2257		base.loadVimeoAPI = function() {
2258			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',
2259			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2260			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2261			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2262			base.insertJS('//player.vimeo.com/api/player.js', function() {
2263				vimeoPlayerReady(base.options.id);
2264			}, 'vimeo');
2265		};
2266		// is it from youtube or vimeo?
2267		base.determineProvider = function() {
2268			var a = document.createElement('a');
2269			a.href = base.options.video;
2270			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2271				var videoid = a.href.split('/')[3].toString();
2272				var query = videoid.substring(videoid.indexOf('?') + 1);
2273				if (query != '') {
2274					var vars = query.split('&');
2275					for (var i = 0; i < vars.length; i++) {
2276						var pair = vars[i].split('=');
2277						if (pair[0] == 'v') {
2278							videoid = pair[1];
2279						}
2280					}
2281				}
2282				return {
2283					"provider": "youtube",
2284					"id": videoid
2285				};
2286			} else if (/vimeo.com/.test(base.options.video)) {
2287				return {
2288					"provider": "vimeo",
2289					"id": (a.href.split('/')[3].toString()).split('#')[0],
2290				};
2291			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2292				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2293				if (id.length == 11) {
2294					return {
2295						"provider": "youtube",
2296						"id": id.toString()
2297					};
2298				} else {
2299					for (var i = 0; i < base.options.video.length; i++) {
2300						if (typeof parseInt(base.options.video[i]) !== "number") {
2301							throw 'not vimeo but thought it was for a sec';
2302						}
2303					}
2304					return {
2305						"provider": "vimeo",
2306						"id": base.options.video
2307					};
2308				}
2309			} else {
2310				throw "OKVideo: Invalid video source";
2311			}
2312		};
2313		base.init();
2314	};
2315
2316	var checkResize,
2317		newW = UNCODE.wwidth;
2318
2319	$.okvideo.options = {
2320		id: null,
2321		source: null, // Deprecate dis l8r
2322		video: null,
2323		playlist: { // eat ur heart out @brokyo
2324			list: null,
2325			index: 0,
2326			startSeconds: 0,
2327			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2328		},
2329		disableKeyControl: 1,
2330		captions: 0,
2331		loop: 1,
2332		hd: 1,
2333		volume: 0,
2334		adproof: false,
2335		unstarted: null,
2336		onFinished: null,
2337		onReady: null,
2338		onPlay: null,
2339		onPause: null,
2340		buffering: null,
2341		controls: false,
2342		autoplay: true,
2343		annotations: true,
2344		cued: null
2345	};
2346	$.fn.okvideo = function(options) {
2347		options.target = this;
2348		return this.each(function() {
2349			(new $.okvideo(options));
2350		});
2351	};
2352
2353	var checkForVideos = function(){
2354		$(".uncode-video-container.video").each(function(index, el) {
2355			var $this = $(this),
2356				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2357				url = $this.attr('data-video'),
2358				id = $this.attr('data-id'),
2359				cloned = $this.closest('.owl-item');
2360
2361			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2362				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2363					$this.okvideo({
2364						id: id,
2365						source: url.split('#')[0],
2366						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2367						autoplay: 1,
2368						controls: 0,
2369						volume: 0,
2370						adproof: 0,
2371						caller: $this,
2372						hd: 1,
2373						onReady: function(player) {
2374							var getPlayer = player.c || player.h || player,
2375							$iframe,
2376							getContainer = $(getPlayer).closest('.background-element');
2377							if (getContainer.length) {
2378								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2379							}
2380
2381							if ( $this.hasClass('drop-move') ) {
2382
2383								var $iframe = $(getPlayer),
2384									w = parseFloat($iframe.attr('width')),
2385									h = parseFloat($iframe.attr('height')),
2386									ratio = h / w,
2387									setResizeiFto,
2388								resizeiFrame = function(){
2389									var dataW = $this.attr('data-w'),
2390										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2391										newH = newW * ratio;
2392									$iframe.css({
2393										width: newW,
2394										height: newH
2395									});
2396								};
2397								resizeiFrame();
2398								$(window).on( 'load', resizeiFrame );
2399								$(window).on( 'resize', function(){
2400									clearRequestTimeout(setResizeiFto);
2401									setResizeiFto = requestTimeout( function() {
2402										resizeiFrame();
2403									}, 10 );
2404								});
2405
2406							}
2407
2408						}
2409					});
2410				}
2411			}
2412		});
2413	};
2414
2415	checkForVideos();
2416
2417	$(window).on('load', function(){
2418		$('.mejs-fullscreen-button button').on('click', function(){
2419			var $button = $(this),
2420				$stuck = $button.closest('.is_stucked');
2421
2422			if ( $stuck.length ) {
2423				$stuck = $(this).trigger("sticky_kit:detach");
2424				window.scrollTo(0, 0);
2425			}
2426		});
2427	});
2428
2429	var checkVideoResize = function(){
2430		clearRequestTimeout(checkResize);
2431		checkResize = requestTimeout(function(){
2432			if ( newW !== UNCODE.wwidth ) {
2433				newW = UNCODE.wwidth;
2434				checkForVideos();
2435			}
2436		}, 1000);
2437	};
2438
2439	$(window).off('resize', checkVideoResize)
2440	.on( 'resize', checkVideoResize);
2441
2442};
2443
2444$(document).on('uncode-ajax-filtered.videos', function(){
2445	UNCODE.okvideo("uncode-more-items-loaded");
2446});
2447UNCODE.backgroundSelfVideos = function( $ctx ) {
2448
2449	var backgroundSelfVideosInit = function( $ctx ) {
2450		if ( SiteParameters.block_mobile_videos === true ) {
2451			return false;
2452		}
2453		if (typeof MediaElement === "function") {
2454			if ( typeof $ctx === 'undefined' ) {
2455				$ctx = document;
2456			}
2457		
2458			$(".background-video-shortcode", $ctx).each(function(index, el) {
2459				if ( $(this).closest('mediaelementwrapper').length ) {
2460					return true;
2461				}
2462				var $video_el = $(this),
2463					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2464					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2465					video_id = $video_el.attr('id');
2466
2467				if ( SiteParameters.is_frontend_editor ) {
2468					video_id = video_id + '_' + index;
2469					$video_el.attr('id', video_id);
2470				}
2471
2472				var media = new MediaElement(video_id, {
2473					startVolume: 0,
2474					loop: true,
2475					success: function(mediaElement, domObject) {
2476						domObject.volume = 0;
2477						$(mediaElement).data('started', false);
2478						mediaElement.addEventListener('timeupdate', function(e) {
2479							if (!$(e.target).data('started')) {
2480								$(mediaElement).data('started', true);
2481							}
2482						});
2483						mediaElement.addEventListener('loadedmetadata', function(e) {
2484							$('body').removeClass('video-not-supported');
2485							mediaElement.play();
2486						});
2487						if (!UNCODE.isMobile) {
2488							requestTimeout(function() {
2489								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2490							}, 100);
2491						}
2492						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2493							mediaElement.play();
2494						}
2495
2496						if ( $parent_drop_move.length ) {
2497							var setResizeMEto,
2498								resizeMediaElement = function(){
2499								var dataW = $parent_drop_move.attr('data-w'),
2500									videoW = domObject.width,
2501									videoH = domObject.height,
2502									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2503									newH = newW / ( videoW / videoH );
2504
2505								$(domObject).css({
2506									'height': newH,
2507									'width': newW
2508								});
2509							};
2510							$(window).on( 'resize load', function(){
2511								clearRequestTimeout(setResizeMEto);
2512								setResizeMEto = requestTimeout( function() {
2513									resizeMediaElement();
2514								}, 10 );
2515							});
2516						}
2517
2518						mediaElement.addEventListener('play', function() {
2519							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2520							$(mediaElement).closest('#page-header').addClass('video-started');
2521							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2522						}, true);
2523
2524					},
2525					// fires when a problem is detected
2526					error: function() {}
2527				});
2528			});
2529		} else {
2530
2531			if ( typeof $ctx === 'undefined' ) {
2532				$ctx = document;
2533			}
2534		
2535			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2536			Array.from(videos).forEach(function(video_el) {
2537				video_el.addEventListener('loadedmetadata', function(e) {
2538					$('body').removeClass('video-not-supported');
2539					video_el.play();
2540				});
2541				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2542					video_el.muted = true;
2543					video_el.loop = true;
2544					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2545					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2546					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2547					$('body').removeClass('video-not-supported');
2548					video_el.play();
2549				} else {
2550					requestTimeout(function(){
2551                         backgroundSelfVideosInit( $ctx );
2552					}, 1000);
2553				}
2554			});
2555		}
2556	};
2557
2558	backgroundSelfVideosInit( $ctx );
2559
2560	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2561		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2562			var $el = model.view.$el,
2563				shortcode = model.attributes.shortcode;
2564
2565			if (typeof MediaElement === "function") {
2566				backgroundSelfVideosInit( $el );
2567			} else {
2568				backgroundSelfVideosInit( $el[0] );
2569			}
2570		});
2571	}
2572};
2573
2574UNCODE.is_scrolling = false;
2575
2576UNCODE.disableHoverScroll = function() {
2577
2578	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2579		var body = document.body,
2580		timer;
2581
2582		window.addEventListener('scroll', function() {
2583			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2584			clearRequestTimeout(timer);
2585			if ( body.classList && !body.classList.contains('disable-hover') ) {
2586				body.classList.add('disable-hover');
2587				window.dispatchEvent(new CustomEvent('disable-hover'));
2588			}
2589			UNCODE.is_scrolling = true;
2590
2591			timer = requestTimeout(function() {
2592				if ( body.classList ) {
2593					body.classList.remove('disable-hover');
2594					window.dispatchEvent(new CustomEvent('enable-hover'));
2595				}
2596				UNCODE.is_scrolling = false;
2597			}, delay);
2598		}, false);
2599	}
2600};
2601
2602UNCODE.isotopeLayout = function() {
2603	if ($('.isotope-layout').length > 0) {
2604		var isotopeContainersArray = [],
2605			typeGridArray = [],
2606			layoutGridArray = [],
2607			screenLgArray = [],
2608			screenMdArray = [],
2609			screenSmArray = [],
2610			transitionDuration = [],
2611			$filterItems = [],
2612			$filters = $('.isotope-system .isotope-filters'),
2613			$itemSelector = '.tmb-iso',
2614			$items,
2615			itemMargin,
2616			correctionFactor = 0,
2617			firstLoad = true,
2618			isOriginLeft = $('body').hasClass('rtl') ? false : true;
2619		$('[class*="isotope-container"]').each(function(index) {
2620			var _this = $(this);
2621			var isoData = _this.data(),
2622			$data_lg,
2623			$data_md,
2624			$data_sm;
2625			_this.children('.tmb').addClass('tmb-iso');
2626			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
2627			else $data_lg = '1000';
2628			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
2629			else $data_md = '600';
2630			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
2631			else $data_sm = '480';
2632			screenLgArray.push($data_lg);
2633			screenMdArray.push($data_md);
2634			screenSmArray.push($data_sm);
2635			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
2636			if (isoData.type == 'metro') typeGridArray.push(true);
2637			else typeGridArray.push(false);
2638			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
2639			else layoutGridArray.push('masonry');
2640			isotopeContainersArray.push(_this);
2641			_this.attr('data-iso-index', index);
2642		});
2643		var colWidth = function(index) {
2644				$(isotopeContainersArray[index]).width('');
2645				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
2646					widthAvailable = $(isotopeContainersArray[index]).width(),
2647					columnNum = 12,
2648					columnWidth = 0,
2649					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
2650					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
2651					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
2652					$rowContainer,
2653					paddingRow,
2654					$colContainer,
2655					paddingCol;
2656
2657				if ( consider_menu )
2658					winHeight = winHeight - UNCODE.menuHeight;
2659
2660				if ( data_vp_height === '1' ) {
2661					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
2662					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
2663					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
2664					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
2665					winHeight = winHeight - ( paddingRow + paddingCol );
2666				}
2667
2668				if (isPx) {
2669					columnWidth = Math.ceil(widthAvailable / columnNum);
2670					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
2671				} else {
2672					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
2673				}
2674				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
2675				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
2676				for (var i = 0, len = $items.length; i < len; i++) {
2677					var $item = $($items[i]),
2678						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
2679						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
2680						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
2681
2682
2683					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
2684						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
2685					}
2686
2687					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
2688						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
2689					}
2690
2691					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
2692						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2693							switch (parseInt(multiplier_w[1])) {
2694								case (5):
2695								case (4):
2696								case (3):
2697									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2698									multiplier_w[1] = 6;
2699									break;
2700								case (2):
2701								case (1):
2702									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
2703									multiplier_w[1] = 3;
2704									break;
2705								default:
2706									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2707									multiplier_w[1] = 12;
2708									break;
2709							}
2710
2711							if (multiplier_w[1] == 2.4) { // 5 columns
2712								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2713								multiplier_w[1] = 6;
2714							}
2715						}
2716					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
2717						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2718							switch (parseInt(multiplier_w[1])) {
2719								case (5):
2720								case (4):
2721								case (3):
2722								case (2):
2723								case (1):
2724									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2725									multiplier_w[1] = 6;
2726									break;
2727								default:
2728									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2729									multiplier_w[1] = 12;
2730									break;
2731							}
2732
2733							if (multiplier_w[1] == 2.4) { // 5 columns
2734								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2735								multiplier_w[1] = 6;
2736							}
2737						}
2738					} else if (widthAvailable < screenSmArray[index]) {
2739						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2740							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2741							multiplier_w[1] = 12;
2742							if (typeGridArray[index]) multiplier_h[1] = 12;
2743						}
2744					}
2745					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
2746						height;
2747
2748					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
2749						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
2750						if ( widthAvailable < screenSmArray[index] ) {
2751							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
2752						}
2753					} else {
2754						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
2755					}
2756
2757					if (width >= widthAvailable) {
2758						$item.css({
2759							width: widthAvailable
2760						});
2761						if (typeGridArray[index]) {
2762							$item.children().add($item.find('.backimg')).css({
2763								height: height
2764							});
2765						}
2766					} else {
2767						$item.css({
2768							width: width
2769						});
2770						if (typeGridArray[index]) {
2771							$item.children().add($item.find('.backimg')).css({
2772								height: height
2773							});
2774						}
2775					}
2776				}
2777				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
2778					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
2779				} else {
2780					return columnWidth;
2781				}
2782			},
2783			init_isotope = function() {
2784				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
2785					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
2786						isotopeId = isotopeSystem.attr('id'),
2787						$layoutMode = layoutGridArray[i],
2788						setIsotopeFirstRowTimeOut,
2789					setIsotopeFirstRow = function(items){
2790						var firstRow = true;
2791						$(items).each(function(index, val){
2792							var el = items[index].element,
2793								el_top = items[index].position.y,
2794								$el = $(el);
2795							if ( index > 0 && el_top > 0 && firstRow ) {
2796								firstRow = false;
2797							} else if ( index == 0 && el_top == 0 ) {
2798								firstRow = true;
2799							}
2800							if ( firstRow ) {
2801								$el.removeClass('tmb-isotope-further-row');
2802							} else {
2803								$el.addClass('tmb-isotope-further-row');
2804							}
2805						});
2806					};
2807					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
2808						//resizable: true,
2809						itemSelector: $itemSelector,
2810						layoutMode: $layoutMode,
2811						transitionDuration: transitionDuration[i],
2812						masonry: {
2813							columnWidth: colWidth(i)
2814						},
2815						vertical: {
2816							horizontalAlignment: 0.5,
2817						},
2818						sortBy: 'original-order',
2819						isOriginLeft: isOriginLeft
2820					})
2821					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
2822					.on('layoutComplete', function( event, items ){
2823						if ( typeof items[0] !== 'undefined' ) {
2824							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2825								setIsotopeFirstRow(items);
2826							}
2827						}
2828					})
2829					.on('arrangeComplete', function( event, items ){
2830						if ( typeof items[0] !== 'undefined' ) {
2831							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2832								clearRequestTimeout(setIsotopeFirstRowTimeOut);
2833								setIsotopeFirstRowTimeOut = requestTimeout(function(){
2834									setIsotopeFirstRow(items);
2835								}, 100);
2836							}
2837						}
2838					});
2839					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
2840						$(isotopeContainersArray[i]).infinitescroll({
2841								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
2842								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
2843								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
2844								animate: false,
2845								behavior: 'local',
2846								debug: false,
2847								loading: {
2848									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
2849									speed: 0,
2850									finished: undefined,
2851									msg: $('#' + isotopeId + ' .loadmore-button'),
2852								},
2853								errorCallback: function() {
2854									var isotope_system = $(this).closest('.isotope-system');
2855									$('.loading-button', isotope_system).hide();
2856									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
2857								}
2858							},
2859							// append the new items to isotope on the infinitescroll callback function.
2860							function(newElements, opts) {
2861								var $isotope = $(this),
2862									isotope_system = $isotope.closest('.isotope-system'),
2863									isotopeId = isotope_system.attr('id'),
2864									filters = new Array(),
2865									$loading_button = isotope_system.find('.loading-button'),
2866									$infinite_button = isotope_system.find('.loadmore-button'),
2867									$numPages = $('a', $infinite_button).data('pages'),
2868									$woo_results,
2869									delay = 300;
2870								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
2871								$infinite_button.show();
2872								$loading_button.hide();
2873								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
2874								$('> li', $isotope).remove();
2875								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
2876								$.each($(newElements), function (index, val) {
2877									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
2878										$woo_results = $(val);
2879										delete newElements[index];
2880									} else {
2881										$(val).addClass('tmb-iso');
2882										if ($(val).is("li")) {
2883											filters.push($(val)[0]);
2884										}
2885									}
2886									$(val).addClass('uncode-appended');
2887								});
2888								newElements = newElements.filter(function(x) {
2889									return filters.indexOf(x) < 0
2890								});
2891								$.each($(filters), function(index, val) {
2892									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
2893								});
2894								if ($woo_results && $woo_results.length > 0) {
2895									var old_count = isotope_system.find('.woocommerce-result-count').text();
2896									var new_count = $woo_results.find('.woocommerce-result-count').text();
2897									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
2898									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
2899									function replaceMatch(match, p1, p2) {
2900        								return old_start + '–' + new_end;
2901									}
2902									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
2903									isotope_system.find('.woocommerce-result-count').text(new_count_text);
2904								}
2905								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
2906								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2907									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
2908									if (typeof getLightbox === 'object') {
2909										getLightbox.refresh();
2910									} else {
2911										UNCODE.lightbox();
2912									}
2913								}
2914								if ( typeof twttr !== 'undefined' )
2915									twttr.widgets.load(isotopeContainersArray[i]);
2916
2917								requestTimeout(function() {
2918									Waypoint.refreshAll();
2919									$isotope.trigger('more-items-loaded');
2920									$(window).trigger('more-items-loaded');
2921									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
2922									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
2923										$(document).trigger('uncode-scrolltrigger-refresh');
2924									}
2925								}, 1000);
2926
2927							});
2928						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
2929							var $infinite_isotope = $(isotopeContainersArray[i]),
2930								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
2931							$infinite_isotope.infinitescroll('pause');
2932							$infinite_button.on('click', function(event) {
2933								event.preventDefault();
2934								var $infinite_system = $(event.target).closest('.isotope-system'),
2935								$infinite_isotope = $infinite_system.find('.isotope-container'),
2936								isotopeId = $infinite_system.attr('id');
2937								$(event.currentTarget).html(SiteParameters.loading);
2938								$infinite_isotope.infinitescroll('resume');
2939								$infinite_isotope.infinitescroll('retrieve');
2940								$infinite_isotope.infinitescroll('pause');
2941							});
2942						}
2943					}
2944				}
2945			},
2946			onLayout = function(isotopeObj, startIndex, needsReload) {
2947				var needsReload = needsReload ? true : false;
2948
2949				if (typeof UNCODE.bigText !== 'undefined') {
2950					UNCODE.bigText();
2951				}
2952				isotopeObj.css('opacity', 1);
2953				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
2954
2955				requestTimeout(function() {
2956					if (startIndex > 0) {
2957						reloadIsotope(isotopeObj);
2958						if (SiteParameters.dynamic_srcset_active === '1') {
2959							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2960							UNCODE.adaptive_srcset(isotopeObj);
2961						}
2962						// window.dispatchEvent(UNCODE.boxEvent);
2963					} else if (needsReload) {
2964						reloadIsotope(isotopeObj);
2965					}
2966
2967					UNCODE.adaptive();
2968					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
2969						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2970					}
2971					if (typeof MediaElement === "function") {
2972						$(isotopeObj).find('audio,video').each(function() {
2973							$(this).mediaelementplayer({
2974	 							pauseOtherPlayers: false,
2975							});
2976						});
2977					}
2978					if ($(isotopeObj).find('.nested-carousel').length) {
2979						if (typeof UNCODE.carousel !== 'undefined') {
2980							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
2981						}
2982						requestTimeout(function() {
2983							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2984						}, 200);
2985					} else {
2986						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2987					}
2988					isotopeObj.trigger('isotope-layout-complete');
2989
2990				}, 100);
2991
2992			},
2993			boxAnimation = function(items, startIndex, sequential, container) {
2994				var $allItems = items.length - startIndex,
2995					showed = 0,
2996					index = 0;
2997				if (container.closest('.owl-item').length == 1) return false;
2998				$.each(items, function(index, val) {
2999					var $this = $(val),
3000						elInner = $('> .t-inside', val);
3001					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
3002						return;
3003					}
3004					if (val[0]) val = val[0];
3005					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
3006						new Waypoint({
3007							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3008							element: val,
3009							handler: function() {
3010								var element = $('> .t-inside', this.element),
3011									parent = $(this.element),
3012									currentIndex = parent.index();
3013								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
3014									delayAttr = parseInt(element.attr('data-delay'));
3015								if (isNaN(delayAttr)) delayAttr = 100;
3016								delay -= showed;
3017								var objTimeout = requestTimeout(function() {
3018									element.removeClass('zoom-reverse').addClass('start_animation');
3019									showed = parent.index();
3020									if ( container.data('isotope') ) {
3021										container.isotope('layout');
3022									}
3023								}, delay * delayAttr)
3024								parent.data('objTimeout', objTimeout);
3025								if (!UNCODE.isUnmodalOpen) {
3026									this.destroy();
3027								}
3028							},
3029							offset: '100%'
3030						})
3031					} else {
3032						if (elInner.hasClass('force-anim')) {
3033							elInner.addClass('start_animation');
3034						} else {
3035							elInner.css('opacity', 1);
3036						}
3037						container.isotope('layout');
3038					}
3039
3040					index++;
3041				});
3042			},
3043			reloadIsotope = function(isotopeObj) {
3044				var isoIndex = $(isotopeObj).attr('data-iso-index');
3045				var $layoutMode = ($(isotopeObj).data('layout'));
3046				if ($layoutMode === undefined) {
3047					$layoutMode = 'masonry';
3048				}
3049				if (isotopeObj.data('isotope')) {
3050					isotopeObj.isotope({
3051						itemSelector: $itemSelector,
3052						layoutMode: $layoutMode,
3053						transitionDuration: transitionDuration[isoIndex],
3054						masonry: {
3055							columnWidth: colWidth(isoIndex)
3056						},
3057						vertical: {
3058							horizontalAlignment: 0.5,
3059						},
3060						sortBy: 'original-order',
3061						isOriginLeft: isOriginLeft
3062					});
3063				}
3064			}
3065			;
3066		if ($('.isotope-pagination').length > 0) {
3067			$('.isotope-system').on('click', '.pagination a', function(evt) {
3068				evt.preventDefault();
3069
3070				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3071					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3072						container = $(this).closest('.isotope-system'),
3073						pagination_disable_scroll = container.attr('data-pagination-scroll'),
3074						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3075					calc_scroll -= UNCODE.get_scroll_offset();
3076
3077					if ( pagination_disable_scroll === 'disabled' ) {
3078						return;
3079					}
3080
3081					var menu_container = $('.menu-sticky');
3082					var menu = menu_container.find('.menu-container');
3083
3084					if (menu_container.length > 0 && menu.length > 0) {
3085						calc_scroll = calc_scroll - menu.outerHeight();
3086					}
3087
3088					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3089						delta = bodyTop - calc_scroll,
3090						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3091					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3092
3093					if (!UNCODE.isFullPage) {
3094						if (scrollSpeed == 0) {
3095							$('html, body').scrollTop(calc_scroll);
3096						} else {
3097							$('html, body').animate({
3098								scrollTop: calc_scroll
3099							}, {
3100								easing: 'easeInOutQuad',
3101								duration: scrollSpeed,
3102								complete: function () {
3103									UNCODE.scrolling = false;
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, $_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 $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-v
5247isual-cont > a, .drop-hover-link'), //.length //html.touch a.btn
5248		elClass = "hover";
5249
5250	$(window).on('click', function() {
5251		$el.removeClass(elClass);
5252	});
5253
5254	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
5255		e.stopPropagation();
5256		var link = $(this);
5257		if ( ! link.hasClass(elClass)) {
5258			e.preventDefault();
5259			link.addClass("hover");
5260			$el.not(this).removeClass(elClass);
5261			return false;
5262		}
5263	});
5264};
5265
5266UNCODE.onePage = function(isMobile) {
5267	var current = 0,
5268		last = 0,
5269		lastScrollTop = 0,
5270		forceScroll = false,
5271		lastScrolled = 0,
5272		isSectionscroller = ($('.main-onepage').length) ? true : false,
5273		isOnePage = false,
5274		getOffset = function () {
5275			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);
5276			return calculateOffset;
5277		}
5278
5279	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5280
5281	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5282	// 	return false;
5283
5284	function init_onepage() {
5285		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5286			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5287		}
5288		last = $('.onepage-pagination li').last().find('a').data('index');
5289		$.each($('div[data-parent="true"]'), function(index, val) {
5290			$(this).attr('data-section', index);
5291			if (isMobile) return;
5292			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5293				return;
5294			}
5295			var sectionDown = new Waypoint({
5296				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5297				element: val,
5298				handler: function(direction) {
5299					if (direction == 'down') {
5300						changeMenuActive(this.element, index);
5301					}
5302				},
5303				offset: function() {
5304					return 5 + getOffset()
5305				}
5306			});
5307			var sectionUp = new Waypoint({
5308				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5309				element: val,
5310				handler: function(direction) {
5311					if (direction == 'up') {
5312						changeMenuActive(this.element, index);
5313					}
5314				},
5315				offset: function() {
5316					return -5 - getOffset()
5317				}
5318			});
5319
5320			if (isSectionscroller) {
5321				var label;
5322				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5323				else label = '';
5324				var getName = $(this).attr('data-name');
5325				if (getName == undefined) getName = index;
5326				if (label != '') {
5327					isOnePage = true;
5328					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5329					$('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>");
5330				}
5331			}
5332		});
5333
5334		if (isSectionscroller) {
5335			$.each($('ul.onepage-pagination li'), function(index, val) {
5336				var $this = $(val),
5337					$a = ('a', $this);
5338				$a.on('click', function(evt) {
5339					if ( $('.is-selected', $this).length || UNCODE.scrolling ) {
5340						return false;
5341					}
5342					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5343						evt.preventDefault();
5344					}
5345					Waypoint.refreshAll();
5346					var el = $('a', evt.currentTarget);
5347					current = lastScrolled = parseInt(el.attr('data-index'));
5348					lastScrolled += 1;
5349					scrollBody(current);
5350				});
5351			});
5352		}
5353
5354		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5355		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5356			goToSection = String(window.location.hash).replace(/^#/, "");
5357			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5358		}
5359
5360		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5361			current = lastScrolled = goToSection;
5362			$(window).on('load', function(){
5363				if ( $('.owl-carousel').length ) {
5364					requestTimeout(function(){
5365						scrollBody(goToSection);
5366					}, 400);
5367				} else {
5368					scrollBody(goToSection);
5369				}
5370			});
5371		}
5372
5373	}
5374
5375	function changeMenuActive(section, index) {
5376		current = lastScrolled = parseInt($(section).attr('data-section'));
5377		if (isOnePage) {
5378			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5379			if (newSection.length) {
5380				$('ul.onepage-pagination li a').removeClass('is-selected');
5381				newSection.addClass('is-selected');
5382			}
5383			var getName = $('[data-section="' + index + '"]').attr('data-name');
5384			if (getName != undefined && getName !== '') {
5385				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5386					var get_href = $(val).attr('href');
5387					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5388						$(val).closest('.menu-smart').find('.active').removeClass('active');
5389						$(val).parent().addClass('active');
5390					}
5391				});
5392			}
5393		}
5394	}
5395
5396	if (isOnePage) {
5397		$(window).on('scroll', function() {
5398			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5399			if (bodyTop == 0) {
5400				$('ul.onepage-pagination li a').removeClass('is-selected');
5401				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5402				var getName = $('[data-section=0]').attr('data-name');
5403				if (getName != undefined && getName !== '') {
5404					$.each($('.menu-container .menu-item > a'), function(i, val) {
5405						var get_href = $(val).attr('href');
5406						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5407							$(val).closest('ul').find('.active').removeClass('active');
5408							$(val).parent().addClass('active');
5409						}
5410					});
5411				}
5412			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5413				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5414				if (lastSection.length) {
5415					$('ul.onepage-pagination li a').removeClass('is-selected');
5416					lastSection.addClass('is-selected');
5417				}
5418			}
5419		});
5420	}
5421
5422	var scrollBody = function(index) {
5423		$('ul.onepage-pagination li a').removeClass('is-selected');
5424		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5425
5426		var getSection = $('[data-section=' + index + ']'),
5427			scrollTo;
5428
5429		if (getSection == undefined) return;
5430
5431		var body = $("html, body"),
5432			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5433			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5434			getOffset = UNCODE.get_scroll_offset(index);
5435		if ( typeof getSection.offset() === 'undefined' )
5436			return;
5437		scrollTo = getSection.offset().top;
5438
5439		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5440		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5441			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5442			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5443				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5444			}
5445
5446			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5447				if ( index === 0 ) {
5448					scrollTo = 0;
5449				} else {
5450					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5451				}
5452			} else {
5453				scrollTo -= getOffset;
5454			}
5455		}
5456
5457		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5458		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5459
5460		if (index != 0) {
5461			UNCODE.scrolling = true;
5462		}
5463
5464		if (scrollSpeed == 0) {
5465			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5466			UNCODE.scrolling = false;
5467		} else {
5468			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5469				$(this).stop();
5470			}).animate({
5471				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5472			}, scrollSpeed, 'easeInOutCubic', function() {
5473				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5474				UNCODE.scrolling = false;
5475				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5476				||
5477				$('.menu-hided').length ) {
5478					scrollTo = getSection.offset().top;
5479					getOffset = UNCODE.get_scroll_offset(index);
5480					scrollTo -= getOffset;
5481					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5482						$(this).stop();
5483					}).animate({
5484						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5485						}, scrollSpeed, 'easeInOutCubic', function() {
5486							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5487							UNCODE.scrolling = false;
5488						}
5489					);
5490				}
5491			});
5492		}
5493
5494	};
5495
5496	init_onepage();
5497};
5498
5499UNCODE.stickyElements = function() {
5500	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5501	if (!isMobile_wide ) {
5502
5503		var $pageHeader = $('#page-header'),
5504			$headerRow = $('.vc_row', $pageHeader),
5505			$headerSection = $headerRow.closest('section[data-parent]'),
5506			startSticky = false;
5507
5508		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
5509			$headerRow.removeClass('sticky-element');
5510			$pageHeader.addClass('sticky-element');
5511			startSticky = true;
5512		}
5513
5514		var calculateOffset = function(el) {
5515			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5516				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5517				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5518				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5519
5520			sideOffset += UNCODE.bodyBorder;
5521
5522			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5523			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5524				if ($('.menu-shrink').length) {
5525					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5526				} else {
5527					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5528				}
5529			}
5530
5531			return sideOffset;
5532
5533		},
5534
5535		initStickyElement = function($els) {
5536			if ( $('body').hasClass('vc-safe-mode') ) {
5537				return true;
5538			}
5539			if ( typeof $els === 'undefined' ) {
5540				$els = $('.sticky-element');
5541			}
5542			$.each($els, function(index, element) {
5543				if ($(element).closest('.tab-pane').length) {
5544					var $paneParent = $(element).closest('.tab-pane');
5545					if ( !$paneParent.hasClass('active') ) {
5546						return true;
5547					}
5548				}
5549				$(element).stick_in_parent({
5550					sticky_class: 'is_stucked',
5551					offset_top: calculateOffset(element),
5552					bottoming: true,
5553					inner_scrolling: SiteParameters.sticky_elements === 'on'
5554				});
5555			});
5556		};
5557
5558		var oldW = UNCODE.wwidth,
5559			oldH = UNCODE.wHeight;
5560
5561		requestTimeout(function() {
5562			if ($('.sticky-element').length) {
5563
5564				if ($(window).width() > UNCODE.mediaQuery) {
5565					initStickyElement();
5566
5567					if ( startSticky === true ) {
5568						$('#page-header').trigger('sticky_kit:recalc');
5569					}
5570				}
5571
5572				$(window).on('resize lateral_resize', function(event) {
5573					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
5574						$(".sticky-element").trigger("sticky_kit:detach");
5575						if ($(window).width() > UNCODE.mediaQuery) {
5576							initStickyElement();
5577						}
5578						oldW = UNCODE.wwidth;
5579						oldH = UNCODE.wHeight;
5580					}
5581				});
5582			}
5583		}, 1000);
5584
5585		if ($('.sticky-element').length) {
5586			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
5587				requestTimeout(function() {
5588					$(document.body).trigger("sticky_kit:recalc");
5589				}, 100);
5590			});
5591		}
5592
5593		var $panels = $('.panel-collapse');
5594		if ( $panels.length ) {
5595			$panels.each(function(){
5596				var $panel = $(this);
5597				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
5598					$(document.body).trigger("sticky_kit:recalc");
5599				});
5600			});
5601		}
5602
5603		$('.nav-tabs a').on('shown.bs.tab', function(e){
5604			var $tabs = $(e.target).closest('.tab-container'),
5605				$panel = $('.tab-pane.active', $tabs),
5606				$els = $(e.target).nextAll(".sticky-element");
5607
5608			$els.trigger("sticky_kit:detach");
5609			initStickyElement($els);
5610		});
5611
5612		$(window).on('vc-safe-mode-on', function(){
5613			$(".sticky-element").trigger("sticky_kit:detach");
5614		});
5615
5616		$(window).on('vc-safe-mode-off', function(){
5617			initStickyElement();
5618		});
5619	}
5620};
5621
5622UNCODE.twentytwenty = function() {
5623
5624  if (!$('.twentytwenty-container').length) return;
5625
5626// DOM.event.move
5627//
5628// 2.0.0
5629//
5630// Stephen Band
5631//
5632// Triggers 'movestart', 'move' and 'moveend' events after
5633// mousemoves following a mousedown cross a distance threshold,
5634// similar to the native 'dragstart', 'drag' and 'dragend' events.
5635// Move events are throttled to animation frames. Move event objects
5636// have the properties:
5637//
5638// pageX:
5639// pageY:     Page coordinates of pointer.
5640// startX:
5641// startY:    Page coordinates of pointer at movestart.
5642// distX:
5643// distY:     Distance the pointer has moved since movestart.
5644// deltaX:
5645// deltaY:    Distance the finger has moved since last event.
5646// velocityX:
5647// velocityY: Average velocity over last few events.
5648
5649
5650(function(fn) {
5651	if (typeof define === 'function' && define.amd) {
5652        define([], fn);
5653    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
5654        module.exports = fn;
5655	} else {
5656		fn();
5657	}
5658})(function(){
5659	var assign = Object.assign || window.jQuery && jQuery.extend;
5660
5661	// Number of pixels a pressed pointer travels before movestart
5662	// event is fired.
5663	var threshold = 8;
5664
5665	// Shim for requestAnimationFrame, falling back to timer. See:
5666	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
5667	var requestFrame = (function(){
5668		return (
5669			window.requestAnimationFrame ||
5670			window.webkitRequestAnimationFrame ||
5671			window.mozRequestAnimationFrame ||
5672			window.oRequestAnimationFrame ||
5673			window.msRequestAnimationFrame ||
5674			function(fn, element){
5675				return window.setTimeout(function(){
5676					fn();
5677				}, 25);
5678			}
5679		);
5680	})();
5681
5682	// Shim for customEvent
5683	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
5684	(function () {
5685		if ( typeof window.CustomEvent === "function" ) return false;
5686		function CustomEvent ( event, params ) {
5687			params = params || { bubbles: false, cancelable: false, detail: undefined };
5688			var evt = document.createEvent( 'CustomEvent' );
5689			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
5690			return evt;
5691		}
5692
5693		CustomEvent.prototype = window.Event.prototype;
5694		window.CustomEvent = CustomEvent;
5695	})();
5696
5697	var ignoreTags = {
5698			textarea: true,
5699			input: true,
5700			select: true,
5701			button: true
5702		};
5703
5704	var mouseevents = {
5705		move:   'mousemove',
5706		cancel: 'mouseup dragstart',
5707		end:    'mouseup'
5708	};
5709
5710	var touchevents = {
5711		move:   'touchmove',
5712		cancel: 'touchend',
5713		end:    'touchend'
5714	};
5715
5716	var rspaces = /\s+/;
5717
5718
5719	// DOM Events
5720
5721	var eventOptions = { bubbles: true, cancelable: true };
5722
5723	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
5724
5725	function createEvent(type) {
5726		return new CustomEvent(type, eventOptions);
5727	}
5728
5729	function getEvents(node) {
5730		return node[eventsSymbol] || (node[eventsSymbol] = {});
5731	}
5732
5733	function on(node, types, fn, data, selector) {
5734		types = types.split(rspaces);
5735
5736		var events = getEvents(node);
5737		var i = types.length;
5738		var handlers, type;
5739
5740		function handler(e) { fn(e, data); }
5741
5742		while (i--) {
5743			type = types[i];
5744			handlers = events[type] || (events[type] = []);
5745			handlers.push([fn, handler]);
5746			node.addEventListener(type, handler);
5747		}
5748	}
5749
5750	function off(node, types, fn, selector) {
5751		types = types.split(rspaces);
5752
5753		var events = getEvents(node);
5754		var i = types.length;
5755		var type, handlers, k;
5756
5757		if (!events) { return; }
5758
5759		while (i--) {
5760			type = types[i];
5761			handlers = events[type];
5762			if (!handlers) { continue; }
5763			k = handlers.length;
5764			while (k--) {
5765				if (handlers[k][0] === fn) {
5766					node.removeEventListener(type, handlers[k][1]);
5767					handlers.splice(k, 1);
5768				}
5769			}
5770		}
5771	}
5772
5773	function trigger(node, type, properties) {
5774		// Don't cache events. It prevents you from triggering an event of a
5775		// given type from inside the handler of another event of that type.
5776		var event = createEvent(type);
5777		if (properties) { assign(event, properties); }
5778		node.dispatchEvent(event);
5779	}
5780
5781
5782	// Constructors
5783
5784	function Timer(fn){
5785		var callback = fn,
5786		    active = false,
5787		    running = false;
5788
5789		function trigger(time) {
5790			if (active){
5791				callback();
5792				requestFrame(trigger);
5793				running = true;
5794				active = false;
5795			}
5796			else {
5797				running = false;
5798			}
5799		}
5800
5801		this.kick = function(fn) {
5802			active = true;
5803			if (!running) { trigger(); }
5804		};
5805
5806		this.end = function(fn) {
5807			var cb = callback;
5808
5809			if (!fn) { return; }
5810
5811			// If the timer is not running, simply call the end callback.
5812			if (!running) {
5813				fn();
5814			}
5815			// If the timer is running, and has been kicked lately, then
5816			// queue up the current callback and the end callback, otherwise
5817			// just the end callback.
5818			else {
5819				callback = active ?
5820					function(){ cb(); fn(); } :
5821					fn ;
5822
5823				active = true;
5824			}
5825		};
5826	}
5827
5828
5829	// Functions
5830
5831	function noop() {}
5832
5833	function preventDefault(e) {
5834		e.preventDefault();
5835	}
5836
5837	function isIgnoreTag(e) {
5838		return !!ignoreTags[e.target.tagName.toLowerCase()];
5839	}
5840
5841	function isPrimaryButton(e) {
5842		// Ignore mousedowns on any button other than the left (or primary)
5843		// mouse button, or when a modifier key is pressed.
5844		return (e.which === 1 && !e.ctrlKey && !e.altKey);
5845	}
5846
5847	function identifiedTouch(touchList, id) {
5848		var i, l;
5849
5850		if (touchList.identifiedTouch) {
5851			return touchList.identifiedTouch(id);
5852		}
5853
5854		// touchList.identifiedTouch() does not exist in
5855		// webkit yet… we must do the search ourselves...
5856
5857		i = -1;
5858		l = touchList.length;
5859
5860		while (++i < l) {
5861			if (touchList[i].identifier === id) {
5862				return touchList[i];
5863			}
5864		}
5865	}
5866
5867	function changedTouch(e, data) {
5868		var touch = identifiedTouch(e.changedTouches, data.identifier);
5869
5870		// This isn't the touch you're looking for.
5871		if (!touch) { return; }
5872
5873		// Chrome Android (at least) includes touches that have not
5874		// changed in e.changedTouches. That's a bit annoying. Check
5875		// that this touch has changed.
5876		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
5877
5878		return touch;
5879	}
5880
5881
5882	// Handlers that decide when the first movestart is triggered
5883
5884	function mousedown(e){
5885		// Ignore non-primary buttons
5886		if (!isPrimaryButton(e)) { return; }
5887
5888		// Ignore form and interactive elements
5889		if (isIgnoreTag(e)) { return; }
5890
5891		on(document, mouseevents.move, mousemove, e);
5892		on(document, mouseevents.cancel, mouseend, e);
5893	}
5894
5895	function mousemove(e, data){
5896		checkThreshold(e, data, e, removeMouse);
5897	}
5898
5899	function mouseend(e, data) {
5900		removeMouse();
5901	}
5902
5903	function removeMouse() {
5904		off(document, mouseevents.move, mousemove);
5905		off(document, mouseevents.cancel, mouseend);
5906	}
5907
5908	function touchstart(e) {
5909		// Don't get in the way of interaction with form elements
5910		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
5911
5912		var touch = e.changedTouches[0];
5913
5914		// iOS live updates the touch objects whereas Android gives us copies.
5915		// That means we can't trust the touchstart object to stay the same,
5916		// so we must copy the data. This object acts as a template for
5917		// movestart, move and moveend event objects.
5918		var data = {
5919			target:     touch.target,
5920			pageX:      touch.pageX,
5921			pageY:      touch.pageY,
5922			identifier: touch.identifier,
5923
5924			// The only way to make handlers individually unbindable is by
5925			// making them unique.
5926			touchmove:  function(e, data) { touchmove(e, data); },
5927			touchend:   function(e, data) { touchend(e, data); }
5928		};
5929
5930		on(document, touchevents.move, data.touchmove, data);
5931		on(document, touchevents.cancel, data.touchend, data);
5932	}
5933
5934	function touchmove(e, data) {
5935		var touch = changedTouch(e, data);
5936		if (!touch) { return; }
5937		checkThreshold(e, data, touch, removeTouch);
5938	}
5939
5940	function touchend(e, data) {
5941		var touch = identifiedTouch(e.changedTouches, data.identifier);
5942		if (!touch) { return; }
5943		removeTouch(data);
5944	}
5945
5946	function removeTouch(data) {
5947		off(document, touchevents.move, data.touchmove);
5948		off(document, touchevents.cancel, data.touchend);
5949	}
5950
5951	function checkThreshold(e, data, touch, fn) {
5952		var distX = touch.pageX - data.pageX;
5953		var distY = touch.pageY - data.pageY;
5954
5955		// Do nothing if the threshold has not been crossed.
5956		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
5957
5958		triggerStart(e, data, touch, distX, distY, fn);
5959	}
5960
5961	function triggerStart(e, data, touch, distX, distY, fn) {
5962		var touches = e.targetTouches;
5963		var time = e.timeStamp - data.timeStamp;
5964
5965		// Create a movestart object with some special properties that
5966		// are passed only to the movestart handlers.
5967		var template = {
5968			altKey:     e.altKey,
5969			ctrlKey:    e.ctrlKey,
5970			shiftKey:   e.shiftKey,
5971			startX:     data.pageX,
5972			startY:     data.pageY,
5973			distX:      distX,
5974			distY:      distY,
5975			deltaX:     distX,
5976			deltaY:     distY,
5977			pageX:      touch.pageX,
5978			pageY:      touch.pageY,
5979			velocityX:  distX / time,
5980			velocityY:  distY / time,
5981			identifier: data.identifier,
5982			targetTouches: touches,
5983			finger: touches ? touches.length : 1,
5984			enableMove: function() {
5985				this.moveEnabled = true;
5986				this.enableMove = noop;
5987				e.preventDefault();
5988			}
5989		};
5990
5991		// Trigger the movestart event.
5992		trigger(data.target, 'movestart', template);
5993
5994		// Unbind handlers that tracked the touch or mouse up till now.
5995		fn(data);
5996	}
5997
5998
5999	// Handlers that control what happens following a movestart
6000
6001	function activeMousemove(e, data) {
6002		var timer  = data.timer;
6003
6004		data.touch = e;
6005		data.timeStamp = e.timeStamp;
6006		timer.kick();
6007	}
6008
6009	function activeMouseend(e, data) {
6010		var target = data.target;
6011		var event  = data.event;
6012		var timer  = data.timer;
6013
6014		removeActiveMouse();
6015
6016		endEvent(target, event, timer, function() {
6017			// Unbind the click suppressor, waiting until after mouseup
6018			// has been handled.
6019			setTimeout(function(){
6020				off(target, 'click', preventDefault);
6021			}, 0);
6022		});
6023	}
6024
6025	function removeActiveMouse() {
6026		off(document, mouseevents.move, activeMousemove);
6027		off(document, mouseevents.end, activeMouseend);
6028	}
6029
6030	function activeTouchmove(e, data) {
6031		var event = data.event;
6032		var timer = data.timer;
6033		var touch = changedTouch(e, event);
6034
6035		if (!touch) { return; }
6036
6037		// Stop the interface from gesturing
6038		e.preventDefault();
6039
6040		event.targetTouches = e.targetTouches;
6041		data.touch = touch;
6042		data.timeStamp = e.timeStamp;
6043
6044		timer.kick();
6045	}
6046
6047	function activeTouchend(e, data) {
6048		var target = data.target;
6049		var event  = data.event;
6050		var timer  = data.timer;
6051		var touch  = identifiedTouch(e.changedTouches, event.identifier);
6052
6053		// This isn't the touch you're looking for.
6054		if (!touch) { return; }
6055
6056		removeActiveTouch(data);
6057		endEvent(target, event, timer);
6058	}
6059
6060	function removeActiveTouch(data) {
6061		off(document, touchevents.move, data.activeTouchmove);
6062		off(document, touchevents.end, data.activeTouchend);
6063	}
6064
6065
6066	// Logic for triggering move and moveend events
6067
6068	function updateEvent(event, touch, timeStamp) {
6069		var time = timeStamp - event.timeStamp;
6070
6071		event.distX =  touch.pageX - event.startX;
6072		event.distY =  touch.pageY - event.startY;
6073		event.deltaX = touch.pageX - event.pageX;
6074		event.deltaY = touch.pageY - event.pageY;
6075
6076		// Average the velocity of the last few events using a decay
6077		// curve to even out spurious jumps in values.
6078		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
6079		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
6080		event.pageX =  touch.pageX;
6081		event.pageY =  touch.pageY;
6082	}
6083
6084	function endEvent(target, event, timer, fn) {
6085		timer.end(function(){
6086			trigger(target, 'moveend', event);
6087			return fn && fn();
6088		});
6089	}
6090
6091
6092	// Set up the DOM
6093
6094	function movestart(e) {
6095		if (e.defaultPrevented) { return; }
6096		if (!e.moveEnabled) { return; }
6097
6098		var event = {
6099			startX:        e.startX,
6100			startY:        e.startY,
6101			pageX:         e.pageX,
6102			pageY:         e.pageY,
6103			distX:         e.distX,
6104			distY:         e.distY,
6105			deltaX:        e.deltaX,
6106			deltaY:        e.deltaY,
6107			velocityX:     e.velocityX,
6108			velocityY:     e.velocityY,
6109			identifier:    e.identifier,
6110			targetTouches: e.targetTouches,
6111			finger:        e.finger
6112		};
6113
6114		var data = {
6115			target:    e.target,
6116			event:     event,
6117			timer:     new Timer(update),
6118			touch:     undefined,
6119			timeStamp: e.timeStamp
6120		};
6121
6122		function update(time) {
6123			updateEvent(event, data.touch, data.timeStamp);
6124			trigger(data.target, 'move', event);
6125		}
6126
6127		if (e.identifier === undefined) {
6128			// We're dealing with a mouse event.
6129			// Stop clicks from propagating during a move
6130			on(e.target, 'click', preventDefault);
6131			on(document, mouseevents.move, activeMousemove, data);
6132			on(document, mouseevents.end, activeMouseend, data);
6133		}
6134		else {
6135			// In order to unbind correct handlers they have to be unique
6136			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6137			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6138
6139			// We're dealing with a touch.
6140			on(document, touchevents.move, data.activeTouchmove, data);
6141			on(document, touchevents.end, data.activeTouchend, data);
6142		}
6143	}
6144
6145	on(document, 'mousedown', mousedown);
6146	on(document, 'touchstart', touchstart);
6147	on(document, 'movestart', movestart);
6148
6149
6150	// jQuery special events
6151	//
6152	// jQuery event objects are copies of DOM event objects. They need
6153	// a little help copying the move properties across.
6154
6155	if (!window.jQuery) { return; }
6156
6157	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6158
6159	function enableMove1(e) { e.enableMove(); }
6160	function enableMove2(e) { e.enableMove(); }
6161	function enableMove3(e) { e.enableMove(); }
6162
6163	function add(handleObj) {
6164		var handler = handleObj.handler;
6165
6166		handleObj.handler = function(e) {
6167			// Copy move properties across from originalEvent
6168			var i = properties.length;
6169			var property;
6170
6171			while(i--) {
6172				property = properties[i];
6173				e[property] = e.originalEvent[property];
6174			}
6175
6176			handler.apply(this, arguments);
6177		};
6178	}
6179
6180	jQuery.event.special.movestart = {
6181		setup: function() {
6182			// Movestart must be enabled to allow other move events
6183			on(this, 'movestart', enableMove1);
6184
6185			// Do listen to DOM events
6186			return false;
6187		},
6188
6189		teardown: function() {
6190			off(this, 'movestart', enableMove1);
6191			return false;
6192		},
6193
6194		add: add
6195	};
6196
6197	jQuery.event.special.move = {
6198		setup: function() {
6199			on(this, 'movestart', enableMove2);
6200			return false;
6201		},
6202
6203		teardown: function() {
6204			off(this, 'movestart', enableMove2);
6205			return false;
6206		},
6207
6208		add: add
6209	};
6210
6211	jQuery.event.special.moveend = {
6212		setup: function() {
6213			on(this, 'movestart', enableMove3);
6214			return false;
6215		},
6216
6217		teardown: function() {
6218			off(this, 'movestart', enableMove3);
6219			return false;
6220		},
6221
6222		add: add
6223	};
6224});
6225
6226  $.fn.twentytwenty = function(options) {
6227    var options = $.extend({
6228      default_offset_pct: 0.5,
6229      orientation: 'horizontal',
6230      before_label: 'Before',
6231      after_label: 'After',
6232      no_overlay: false,
6233      move_slider_on_hover: false,
6234      move_with_handle_only: true,
6235      click_to_move: false
6236    }, options);
6237
6238    return this.each(function() {
6239
6240      var sliderPct = options.default_offset_pct;
6241      var container = $(this);
6242      var sliderOrientation = options.orientation;
6243      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6244      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6245
6246
6247      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6248      if(!options.no_overlay) {
6249        container.append("<div class='twentytwenty-overlay'></div>");
6250        var overlay = container.find(".twentytwenty-overlay");
6251        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6252        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6253      }
6254      var beforeImg = container.find("img:first");
6255      var afterImg = container.find("img:last");
6256      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6257      var slider = container.find(".twentytwenty-handle");
6258      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6259      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6260      container.addClass("twentytwenty-container");
6261      beforeImg.addClass("twentytwenty-before");
6262      afterImg.addClass("twentytwenty-after");
6263
6264      var calcOffset = function(dimensionPct) {
6265        var w = beforeImg.width();
6266        var h = beforeImg.height();
6267        return {
6268          w: w+"px",
6269          h: h+"px",
6270          cw: (dimensionPct*w)+"px",
6271          ch: (dimensionPct*h)+"px"
6272        };
6273      };
6274
6275      var adjustContainer = function(offset) {
6276      	if (sliderOrientation === 'vertical') {
6277          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6278          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6279      	}
6280      	else {
6281          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6282          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6283    	}
6284        container.css("height", offset.h);
6285      };
6286
6287      var adjustSlider = function(pct) {
6288        var offset = calcOffset(pct);
6289        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6290        adjustContainer(offset);
6291      };
6292
6293      // Return the number specified or the min/max number if it outside the range given.
6294      var minMaxNumber = function(num, min, max) {
6295        return Math.max(min, Math.min(max, num));
6296      };
6297
6298      // Calculate the slider percentage based on the position.
6299      var getSliderPercentage = function(positionX, positionY) {
6300        var sliderPercentage = (sliderOrientation === 'vertical') ?
6301          (positionY-offsetY)/imgHeight :
6302          (positionX-offsetX)/imgWidth;
6303
6304        return minMaxNumber(sliderPercentage, 0, 1);
6305      };
6306
6307
6308      $(window).on("resize.twentytwenty", function(e) {
6309        adjustSlider(sliderPct);
6310      });
6311
6312      var offsetX = 0;
6313      var offsetY = 0;
6314      var imgWidth = 0;
6315      var imgHeight = 0;
6316      var onMoveStart = function(e) {
6317        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6318          e.preventDefault();
6319        }
6320        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6321          e.preventDefault();
6322        }
6323        container.addClass("active");
6324        offsetX = container.offset().left;
6325        offsetY = container.offset().top;
6326        imgWidth = beforeImg.width();
6327        imgHeight = beforeImg.height();
6328      };
6329      var onMove = function(e) {
6330        if (container.hasClass("active")) {
6331          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6332          adjustSlider(sliderPct);
6333        }
6334      };
6335      var onMoveEnd = function() {
6336          container.removeClass("active");
6337      };
6338
6339      var moveTarget = options.move_with_handle_only ? slider : container;
6340      moveTarget.on("movestart",onMoveStart);
6341      moveTarget.on("move",onMove);
6342      moveTarget.on("moveend",onMoveEnd);
6343
6344      if (options.move_slider_on_hover) {
6345        container.on("mouseenter", onMoveStart);
6346        container.on("mousemove", onMove);
6347        container.on("mouseleave", onMoveEnd);
6348      }
6349
6350      slider.on("touchmove", function(e) {
6351        e.preventDefault();
6352      });
6353
6354      container.find("img").on("mousedown", function(event) {
6355        event.preventDefault();
6356      });
6357
6358      if (options.click_to_move) {
6359        container.on('click', function(e) {
6360          offsetX = container.offset().left;
6361          offsetY = container.offset().top;
6362          imgWidth = beforeImg.width();
6363          imgHeight = beforeImg.height();
6364
6365          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6366          adjustSlider(sliderPct);
6367        });
6368      }
6369
6370      $(window).trigger("resize.twentytwenty");
6371    });
6372  };
6373
6374
6375  $(window).on("load", function(e) {
6376  	$('.twentytwenty-container').each(function(){
6377  		var $container = $(this);
6378  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6379  			$container.twentytwenty();
6380  		}
6381  		$('img', $container).on('async-done', function(){
6382	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6383	  			$container.twentytwenty();
6384	  		}
6385	    });
6386  	});
6387  });
6388}
6389
6390UNCODE.justifiedGallery = function() {
6391
6392	var breakPointMe = function( val ) {
6393		val = parseInt( val );
6394		if ( isNaN(val) ) {
6395			return false;
6396		}
6397		if ( val >= 1500 ) {
6398			return 1;
6399		} else if ( val < 1500 && val >= 960 ) {
6400			return 2;
6401		} else if ( val < 960 && val >= 570 ) {
6402			return 3;
6403		} else if ( val < 570 ) {
6404			return 4;
6405		}
6406	}
6407
6408	var gutterByBreakpoint = function( bp, gutter ) {
6409		var ret;
6410		switch(gutter) {
6411		    case 'no-gutter':
6412		    	ret = 0;
6413		        break;
6414		    case 'px-gutter':
6415		    	ret = 1;
6416		        break;
6417		    case 'half-gutter':
6418		    	ret = 18;
6419		        break;
6420		    case 'double-gutter':
6421				switch(bp) {
6422				    case 3:
6423				    case 4:
6424				    	ret = 36;
6425				        break;
6426				    default:
6427				    	ret = 72;
6428				        break;
6429				}
6430		        break;
6431		    case 'triple-gutter':
6432				switch(bp) {
6433				    case 3:
6434				    case 4:
6435				    	ret = 36;
6436				        break;
6437				    default:
6438				    	ret = 108;
6439				        break;
6440				}
6441		        break;
6442		    case 'quad-gutter':
6443				switch(bp) {
6444				    case 2:
6445				    	ret = 108;
6446				        break;
6447				    case 3:
6448				    	ret = 72;
6449				        break;
6450				    case 4:
6451				    	ret = 36;
6452				        break;
6453				    default:
6454				    	ret = 144;
6455				        break;
6456				}
6457		        break;
6458		    default:
6459		    	ret = 36;//single-gutter
6460		}
6461		return ret;
6462	}
6463
6464	if ($('.justified-layout').length > 0) {
6465		var justifiedContainersArray = [],
6466			typeGridArray = [],
6467			layoutGridArray = [],
6468			transitionDuration = [],
6469			$filterItems = [],
6470			$filters = $('.justified-system .isotope-filters'),
6471			$itemSelector = '.tmb',
6472			$items,
6473			itemMargin,
6474			correctionFactor = 0,
6475			firstLoad = true,
6476			isOriginLeft = $('body').hasClass('rtl') ? false : true,
6477			prevW = breakPointMe(UNCODE.wwidth);
6478		$('[class*="justified-container"]').each(function() {
6479			var isoData = $(this).data();
6480			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6481			if (isoData.type == 'metro') typeGridArray.push(true);
6482			else typeGridArray.push(false);
6483			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
6484			else layoutGridArray.push('justified');
6485			justifiedContainersArray.push($(this));
6486		});
6487		var init_justifiedGallery = function() {
6488			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
6489				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
6490					justifiedId = justifiedSystem.attr('id'),
6491					$layoutMode = layoutGridArray[i],
6492					gutter = $(justifiedContainersArray[i]).data('gutter'),
6493					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
6494					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
6495					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6496					margins;
6497
6498				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6499				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6500				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6501
6502				margins = gutterByBreakpoint(prevW, gutter);
6503
6504				$(justifiedContainersArray[i]).justifiedGallery({
6505					rowHeight: rowHeight,
6506					maxRowHeight: maxRowHeight,
6507					margins: margins,
6508					cssAnimation: true,
6509					lastRow: lastRow,
6510					waitThumbnailsLoad: false
6511				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6512
6513				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6514					$(justifiedContainersArray[i]).infinitescroll({
6515							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6516							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6517							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6518							animate: false,
6519							behavior: 'local',
6520							debug: false,
6521							loading: {
6522								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6523								speed: 0,
6524								finished: undefined,
6525								msg: $('#' + justifiedId + ' .loadmore-button'),
6526							},
6527							errorCallback: function() {
6528								var justified_system = $(this).closest('.justified-system');
6529								$('.loading-button', justified_system).hide();
6530								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
6531							}
6532						},
6533						// append the new items to galleryJustified on the infinitescroll callback function.
6534						function(newElements, opts) {
6535							var $galleryJustified = $(this),
6536								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
6537								filters = new Array(),
6538								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
6539								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
6540								$numPages = $('a', $infinite_button).data('pages'),
6541								delay = 300;
6542							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6543							$infinite_button.show();
6544							$loading_button.hide();
6545							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6546							$('> li', $galleryJustified).remove();
6547							$.each($(newElements), function(index, val) {
6548								$(val).addClass('tmb-iso');
6549								if ($(val).is("li")) {
6550									filters.push($(val)[0]);
6551								}
6552								$(val).addClass('uncode-appended');
6553							});
6554							newElements = newElements.filter(function(x) {
6555								return filters.indexOf(x) < 0
6556							});
6557							$.each($(filters), function(index, val) {
6558								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
6559							});
6560							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
6561							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6562								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
6563								if (typeof getLightbox === 'object') {
6564									getLightbox.refresh();
6565								} else {
6566									UNCODE.lightbox();
6567								}
6568							}
6569							if ( typeof twttr !== 'undefined' )
6570								twttr.widgets.load(justifiedContainersArray[i]);
6571
6572							requestTimeout(function() {
6573								$galleryJustified.trigger('more-items-loaded');
6574								$(window).trigger('more-items-loaded');
6575								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6576							}, 1000);
6577						});
6578					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
6579						var $infinite_justified = $(justifiedContainersArray[i]),
6580							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
6581						$infinite_justified.infinitescroll('pause');
6582						$infinite_button.on('click', function(event) {
6583							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6584								$.each(UNCODE.lightboxArray, function(index, val) {
6585									UNCODE.lightboxArray[index].destroy();
6586								});
6587							}
6588							event.preventDefault();
6589							var $justified_system = $(event.target).closest('.justified-system'),
6590							$infinite_justified = $justified_system.find('.justified-container'),
6591							justifiedId = $justified_system.attr('id');
6592							$(event.currentTarget).html(SiteParameters.loading);
6593							$infinite_justified.infinitescroll('resume');
6594							$infinite_justified.infinitescroll('retrieve');
6595							$infinite_justified.infinitescroll('pause');
6596							$infinite_justified.trigger('more-items-loaded');
6597							$(window).trigger('more-items-loaded');
6598							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6599						});
6600					}
6601				}
6602			}
6603		},
6604		onLayout = function(justifiedObj, startIndex) {
6605			justifiedObj.css('opacity', 1);
6606			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
6607			$('.tmb', justifiedObj).addClass('justified-object-loaded');
6608
6609			requestTimeout(function() {
6610				// window.dispatchEvent(UNCODE.boxEvent);
6611				UNCODE.adaptive();
6612				if (SiteParameters.dynamic_srcset_active === '1') {
6613					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
6614				}
6615				if (typeof MediaElement === "function") {
6616					$(justifiedObj).find('audio,video').each(function() {
6617						$(this).mediaelementplayer({
6618								pauseOtherPlayers: false,
6619						});
6620					});
6621				}
6622				if ($(justifiedObj).find('.nested-carousel').length) {
6623					if (typeof UNCODE.carousel !== 'undefined') {
6624						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
6625					}
6626					requestTimeout(function() {
6627						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6628						justifiedObj.addClass('justified-gallery-finished')
6629						Waypoint.refreshAll();
6630					}, 200);
6631				} else {
6632					requestTimeout(function() {
6633						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6634						justifiedObj.addClass('justified-gallery-finished')
6635						Waypoint.refreshAll();
6636					}, 300);
6637				}
6638			}, 100);
6639
6640		},
6641		boxAnimation = function(items, startIndex, sequential, container) {
6642			var $allItems = items.length - startIndex,
6643				showed = 0,
6644				index = 0;
6645			if (container.closest('.owl-item').length == 1) return false;
6646			$.each(items, function(index, val) {
6647				var elInner = $('> .t-inside', val);
6648				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
6649					return;
6650				}
6651				if (val[0]) val = val[0];
6652				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
6653					new Waypoint({
6654						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
6655						element: val,
6656						handler: function() {
6657							var element = $('> .t-inside', this.element),
6658								parent = $(this.element),
6659								currentIndex = parent.index();
6660							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
6661								delayAttr = parseInt(element.attr('data-delay'));
6662							if (isNaN(delayAttr)) delayAttr = 100;
6663							delay -= showed;
6664							var objTimeout = requestTimeout(function() {
6665								element.removeClass('zoom-reverse').addClass('start_animation');
6666								showed = parent.index();
6667							}, delay * delayAttr);
6668							parent.data('objTimeout', objTimeout);
6669							if (!UNCODE.isUnmodalOpen) {
6670								this.destroy();
6671							}
6672						},
6673						offset: '100%'
6674					})
6675				} else {
6676					elInner.removeClass('animate_when_almost_visible');
6677					$(val).addClass('no-waypoint-animation');
6678					/*if (elInner.hasClass('force-anim')) {
6679						elInner.addClass('start_animation');
6680					} else {
6681						elInner.css('opacity', 1);
6682					}*/
6683				}
6684				index++;
6685			});
6686		};
6687		$filters.on('click', 'a[data-filter]', function(evt) {
6688			var $filter = $(this),
6689				filterContainer = $filter.closest('.isotope-filters'),
6690				filterValue = $filter.attr('data-filter'),
6691				container = $filter.closest('.justified-system').find($('.justified-layout')),
6692				lastRow = container.data('last-row'),
6693				transitionDuration = 0,
6694				delay = 300,
6695				filterItems = [];
6696
6697			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6698
6699			var filter_items = function(){
6700				if (filterValue !== undefined) {
6701					$.each($('> .tmb > .t-inside', container), function(index, val) {
6702						var parent = $(val).parent(),
6703							objTimeout = parent.data('objTimeout');
6704						if (objTimeout) {
6705							$(val).removeClass('zoom-reverse');
6706							clearRequestTimeout(objTimeout);
6707						}
6708						if (transitionDuration == 0) {
6709							if ($(val).hasClass('animate_when_almost_visible')) {
6710								$(val).addClass('zoom-reverse').removeClass('start_animation');
6711							} else {
6712								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6713							}
6714						}
6715					});
6716
6717					requestTimeout(function() {
6718						var $block,
6719							selector,
6720							lightboxElements,
6721							$boxes;
6722
6723						if ( filterValue !== '' && filterValue !== '*' ) {
6724							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
6725							selector = '.' + filterValue;
6726							$.each($(selector, container), function(index, block) {
6727								lightboxElements = $('[data-lbox^=ilightbox]', block);
6728								if (lightboxElements.length) {
6729									lightboxElements.removeClass('lb-disabled');
6730									container.data('lbox', $(lightboxElements[0]).data('lbox'));
6731								}
6732								filterItems.push(block);
6733							});
6734							container.justifiedGallery({
6735								filter: selector,
6736								lastRow: 'nojustify'
6737							});
6738						} else {
6739							container.justifiedGallery({
6740								filter: false,
6741								lastRow: lastRow
6742							});
6743							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
6744							filterItems = $('> .tmb', container);
6745						}
6746						container.trigger('more-items-loaded');
6747						$(window).trigger('more-items-loaded');
6748						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6749
6750						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6751						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6752							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
6753							if (typeof getLightbox === 'object') {
6754								getLightbox.refresh();
6755							} else {
6756								UNCODE.lightbox();
6757							}
6758						}
6759
6760						if (transitionDuration == 0) {
6761							requestTimeout(function() {
6762								boxAnimation(filterItems, 0, false, container);
6763							}, 100);
6764						}
6765						requestTimeout(function() {
6766							Waypoint.refreshAll();
6767							container.trigger('more-items-loaded');
6768							$(window).trigger('more-items-loaded');
6769							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6770							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
6771								$(document).trigger('uncode-scrolltrigger-refresh');
6772							}
6773						}, 2000);
6774
6775					}, delay);
6776				} else {
6777					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6778						$.each(UNCODE.lightboxArray, function(index, val) {
6779							UNCODE.lightboxArray[index].destroy();
6780						});
6781					}
6782					$.each($('> .tmb > .t-inside', container), function(index, val) {
6783						var parent = $(val).parent(),
6784							objTimeout = parent.data('objTimeout');
6785						if (objTimeout) {
6786							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6787							clearRequestTimeout(objTimeout);
6788						}
6789						if (transitionDuration == 0) {
6790							if ($(val).hasClass('animate_when_almost_visible')) {
6791								$(val).addClass('zoom-reverse').removeClass('start_animation');
6792							} else {
6793								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6794							}
6795						}
6796					});
6797					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6798						UNCODE.lightbox();
6799					}
6800					container.parent().addClass('justified-loading');
6801					container.trigger('more-items-loaded');
6802					$(window).trigger('more-items-loaded');
6803					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6804				}
6805			};
6806
6807			if (!$filter.hasClass('active')) {
6808				/** Scroll top with filtering */
6809				if (filterContainer.hasClass('filter-scroll')) {
6810                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6811                    calc_scroll -= UNCODE.get_scroll_offset();
6812
6813					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6814						delta = bodyTop - calc_scroll,
6815						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6816						filterTolerance = false,
6817						filter_timeout;
6818					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6819
6820					if ( !UNCODE.isFullPage ) {
6821						if (scrollSpeed == 0) {
6822							$('html, body').scrollTop(calc_scroll);
6823							UNCODE.scrolling = false;
6824							filter_items();
6825						} else {
6826
6827							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6828								filter_items();
6829								filterTolerance = true;
6830							}
6831
6832							$('html, body').animate({
6833								scrollTop: calc_scroll
6834							},{
6835								easing: 'easeInOutQuad',
6836								duration: scrollSpeed,
6837								complete: function(){
6838									UNCODE.scrolling = false;
6839									if ( !filterTolerance ) {
6840										filter_timeout = setTimeout(function(){
6841											clearTimeout(filter_timeout);
6842											filter_items();
6843										}, 200);
6844									}
6845								}
6846							});
6847						}
6848					}
6849				} else {
6850					filter_items();
6851				}
6852			}
6853			evt.preventDefault();
6854		});
6855
6856		$filters.each(function(i, buttonGroup) {
6857			var $buttonGroup = $(buttonGroup);
6858			$buttonGroup.on('click', 'a', function() {
6859				$buttonGroup.find('.active').removeClass('active');
6860				$(this).addClass('active');
6861			});
6862
6863			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6864				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6865				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6866			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6867				e.preventDefault();
6868				$cats_filters.slideToggle(400, 'easeInOutCirc');
6869			});
6870		});
6871		window.addEventListener('boxResized', function(e) {
6872			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
6873				prevW = breakPointMe(UNCODE.wwidth);
6874				$.each($('.justified-layout'), function(index, val) {
6875					var gutter = $(this).data('gutter'),
6876						margins = gutterByBreakpoint( prevW, gutter);
6877					$(this).justifiedGallery({
6878						margins: margins
6879					});
6880					$(this).find('.mejs-video,.mejs-audio').each(function() {
6881						$(this).trigger('resize');
6882					});
6883				});
6884			}
6885		}, false);
6886
6887		init_justifiedGallery();
6888	};
6889};
6890
6891UNCODE.cssGrid = function() {
6892	if ($('.cssgrid-layout').length > 0) {
6893		var cssGridContainersArray = [];
6894		var transitionDuration = [];
6895		var $filters = $('.cssgrid-system .cssgrid-filters');
6896
6897		$('[class*="cssgrid-container"]').each(function() {
6898			cssGridContainersArray.push($(this));
6899			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6900		});
6901
6902		var init_cssGridAjax = function() {
6903			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
6904				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
6905					cssGridId = cssGridSystem.attr('id');
6906
6907				cssGridSystem.data('transitionDuration', transitionDuration[i]);
6908
6909				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
6910					$(cssGridContainersArray[i]).infinitescroll({
6911						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
6912						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6913						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
6914						animate: false,
6915						behavior: 'local',
6916						debug: false,
6917						loading: {
6918							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
6919							speed: 0,
6920							finished: undefined,
6921							msg: $('#' + cssGridId + ' .loadmore-button'),
6922						},
6923						errorCallback: function() {
6924							var cssgrid_system = $(this).closest('.cssgrid-system');
6925							$('.loading-button', cssgrid_system).hide();
6926							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
6927						}
6928					},
6929					// append the new items to cssGrid on the infinitescroll callback function.
6930					function(newElements, opts) {
6931						var $cssGrid = $(this),
6932							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
6933							cssGridId = cssGridSystemCont.attr('id'),
6934							filters = new Array(),
6935							$loading_button = cssGridSystemCont.find('.loading-button'),
6936							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
6937							$numPages = $('a', $infinite_button).data('pages'),
6938							$woo_results,
6939							delay = 300;
6940						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6941						$infinite_button.show();
6942						$loading_button.hide();
6943						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6944						$('> li', $cssGrid).remove();
6945						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
6946						$.each($(newElements), function (index, val) {
6947							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
6948								$woo_results = $(val);
6949								delete newElements[index];
6950							} else {
6951								$(val).addClass('tmb-grid');
6952								if ($(val).is("li")) {
6953									filters.push($(val)[0]);
6954								}
6955							}
6956							$(val).addClass('uncode-appended');
6957						});
6958						newElements = newElements.filter(function(x) {
6959							return filters.indexOf(x) < 0
6960						});
6961						$.each($(filters), function(index, val) {
6962							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
6963						});
6964						if ($woo_results && $woo_results.length > 0) {
6965							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
6966							var new_count = $woo_results.find('.woocommerce-result-count').text();
6967							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
6968							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
6969							function replaceMatch(match, p1, p2) {
6970        						return old_start + '–' + new_end;
6971							}
6972							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
6973							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
6974						}
6975
6976						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6977						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
6978						if (filterValue !== undefined && filterValue != '*') {
6979							$(newElements).hide();
6980							var els_to_show = $();
6981							$(newElements).each(function() {
6982								var el = $(this);
6983								if (el.hasClass(filterValue)) {
6984									els_to_show = els_to_show.add(el);
6985									el.show();
6986								}
6987							});
6988							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
6989						} else {
6990							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
6991						}
6992
6993						UNCODE.adaptive();
6994						if (SiteParameters.dynamic_srcset_active === '1') {
6995							UNCODE.refresh_dynamic_srcset_size($cssGrid);
6996						}
6997						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6998							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
6999							if (typeof getLightbox === 'object') {
7000								getLightbox.refresh();
7001							} else {
7002								UNCODE.lightbox();
7003							}
7004						}
7005						if ( typeof twttr !== 'undefined' ) {
7006							twttr.widgets.load(cssGridContainersArray[i]);
7007						}
7008
7009						UNCODE.carousel($(newElements));
7010						requestTimeout(function() {
7011							$cssGrid.trigger('more-items-loaded');
7012							$(window).trigger('more-items-loaded');
7013							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7014						}, 1000);
7015
7016					});
7017					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
7018						var $cssgrid_el = $(cssGridContainersArray[i]),
7019							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
7020						$cssgrid_el.infinitescroll('pause');
7021						$infinite_button.on('click', function(event) {
7022							event.preventDefault();
7023							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
7024							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
7025							cssGridId = $cssgrid_system.attr('id');
7026							$(event.currentTarget).html(SiteParameters.loading);
7027							$cssgrid_el.infinitescroll('resume');
7028							$cssgrid_el.infinitescroll('retrieve');
7029							$cssgrid_el.infinitescroll('pause');
7030						});
7031					}
7032				}
7033			}
7034		};
7035
7036		init_cssGridAjax();
7037
7038		if ($('.cssgrid-pagination').length > 0) {
7039			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
7040				evt.preventDefault();
7041
7042				if (SiteParameters.index_pagination_disable_scroll !== '1') {
7043					var container = $(this).closest('.cssgrid-system'),
7044						pagination_disable_scroll = container.attr('data-pagination-scroll'),
7045						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7046
7047					if ( pagination_disable_scroll === 'disabled' ) {
7048						return;
7049					}
7050
7051					calc_scroll -= UNCODE.get_scroll_offset();
7052
7053					var menu_container = $('.menu-sticky');
7054					var menu = menu_container.find('.menu-container');
7055
7056					if (menu_container.length > 0 && menu.length > 0) {
7057						calc_scroll = calc_scroll - menu.outerHeight();
7058					}
7059
7060					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7061						delta = bodyTop - calc_scroll,
7062						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7063					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7064
7065					if ( !UNCODE.isFullPage ) {
7066						if (scrollSpeed == 0) {
7067							$('html, body').scrollTop(calc_scroll);
7068						} else {
7069							$('html, body').animate({
7070								scrollTop: calc_scroll
7071							},{
7072								easing: 'easeInOutQuad',
7073								duration: scrollSpeed,
7074								complete: function(){
7075									UNCODE.scrolling = false;
7076								}
7077							});
7078						}
7079					}
7080				}
7081
7082				loadCssGrid($(this), true);
7083			});
7084		}
7085
7086		$filters.on('click', 'a.grid-nav-link', function(evt) {
7087			if ($(this).hasClass('no-grid-filter')) {
7088				return;
7089			}
7090			var $filter = $(this),
7091				filterContainer = $filter.closest('.cssgrid-filters'),
7092				filterValue = $filter.attr('data-filter'),
7093				containerSystem = $filter.closest('.cssgrid-system'),
7094				container = containerSystem.find($('.cssgrid-layout')),
7095				transitionDuration = containerSystem.data('transitionDuration'),
7096				delay = 300,
7097				filterItems = [],
7098				all_thumbs = container.find('.tmb-grid');
7099
7100			var filter_items = function(){
7101				if (filterValue !== undefined) {
7102					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7103						var parent = $(val).parent(),
7104							objTimeout = parent.data('objTimeout');
7105						if (objTimeout) {
7106							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7107							clearRequestTimeout(objTimeout);
7108						}
7109						if (transitionDuration == 0) {
7110							if ($(val).hasClass('animate_when_almost_visible')) {
7111								$(val).addClass('zoom-reverse').removeClass('start_animation');
7112							} else {
7113								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7114							}
7115						}
7116					});
7117					requestTimeout(function(){
7118						if ( filterValue == '*' ) {
7119							all_thumbs.show();
7120							all_thumbs.each(function(index, val) {
7121								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7122								filterItems.push($(this));
7123							});
7124						} else {
7125							all_thumbs.each(function() {
7126								var _tmb = $(this);
7127								if (_tmb.hasClass(filterValue)) {
7128									_tmb.show();
7129									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7130									filterItems.push(_tmb);
7131								} else {
7132									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7133									_tmb.hide();
7134								}
7135							});
7136						}
7137
7138						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7139
7140						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7141						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7142						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7143						if (lightboxElements.length) {
7144							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7145							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7146								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7147								if (typeof getLightbox === 'object') {
7148									getLightbox.refresh();
7149								} else {
7150									UNCODE.lightbox();
7151								}
7152							}
7153						}
7154						container.trigger('more-items-loaded');
7155						$(window).trigger('more-items-loaded');
7156						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7157					}, delay);
7158				} else {
7159					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7160						var parent = $(val).parent(),
7161							objTimeout = parent.data('objTimeout');
7162						if (objTimeout) {
7163							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7164							clearRequestTimeout(objTimeout);
7165						}
7166						if (transitionDuration == 0) {
7167							if ($(val).hasClass('animate_when_almost_visible')) {
7168								$(val).addClass('zoom-reverse').removeClass('start_animation');
7169							} else {
7170								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7171							}
7172						}
7173					});
7174					loadCssGrid($filter);
7175				}
7176			};
7177
7178			if (!$filter.hasClass('active')) {
7179				/** Scroll top with filtering */
7180				if (filterContainer.hasClass('filter-scroll')) {
7181                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7182                    calc_scroll -= UNCODE.get_scroll_offset();
7183
7184					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7185						delta = bodyTop - calc_scroll,
7186						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7187						filterTolerance = false,
7188						filter_timeout;
7189					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7190
7191					if ( !UNCODE.isFullPage ) {
7192						if (scrollSpeed == 0) {
7193							$('html, body').scrollTop(calc_scroll);
7194							UNCODE.scrolling = false;
7195							filter_items();
7196						} else {
7197
7198							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7199								filter_items();
7200								filterTolerance = true;
7201							}
7202
7203							$('html, body').animate({
7204								scrollTop: calc_scroll
7205							},{
7206								easing: 'easeInOutQuad',
7207								duration: scrollSpeed,
7208								complete: function(){
7209									UNCODE.scrolling = false;
7210									if ( !filterTolerance ) {
7211										filter_timeout = setTimeout(function(){
7212											clearTimeout(filter_timeout);
7213											filter_items();
7214										}, 200);
7215									}
7216								}
7217							});
7218						}
7219					}
7220				} else {
7221					filter_items();
7222				}
7223			}
7224			evt.preventDefault();
7225		});
7226
7227		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7228			var params = UNCODE.getURLParams(window.location);
7229			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7230
7231			UNCODE.lastURL = window.location.href;
7232
7233			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
7234				return;
7235			}
7236
7237			if (params.id === undefined) {
7238				$.each($('.cssgrid-system'), function(index, val) {
7239					loadCssGrid($(val));
7240				});
7241			} else {
7242				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7243					loadCssGrid($('#' + params.id));
7244				}
7245			}
7246		});
7247
7248		var loadCssGrid = function($href, $paginating) {
7249			var is_paginating = false;
7250
7251			if (undefined !== $paginating && $paginating) {
7252				var is_paginating = $paginating;
7253			}
7254
7255			var href = ($href.is("a") ? $href.attr('href') : location),
7256				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7257				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7258				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7259				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7260				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7261				cssgridId = cssgridSystem.attr('id');
7262			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7263				UNCODE.lastURL = href;
7264				history.pushState({
7265					myCSSgrid: true
7266				}, document.title, href);
7267			}
7268			cssgridWrapper.addClass('cssgrid-loading');
7269			if (is_paginating) {
7270				cssgridWrapper.addClass('grid-filtering');
7271			}
7272			$.ajax({
7273				url: href
7274			}).done(function(data) {
7275				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7276					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7277					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7278				requestTimeout(function() {
7279					cssgridContainer.html($resultItems);
7280					cssgridWrapper.removeClass('cssgrid-loading');
7281					cssgridWrapper.removeClass('grid-filtering');
7282					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7283					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7284					UNCODE.adaptive();
7285					if (SiteParameters.dynamic_srcset_active === '1') {
7286						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7287					}
7288					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7289						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7290						if (typeof getLightbox === 'object') {
7291							getLightbox.refresh();
7292						} else {
7293							UNCODE.lightbox();
7294						}
7295					}
7296					cssgridContainer.trigger('more-items-loaded');
7297					$(window).trigger('more-items-loaded');
7298					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7299				}, 300);
7300
7301				$('.pagination', cssgridFooter).remove();
7302				cssgridFooter.append($resultPagination);
7303
7304				if (cssgridResultCount.length > 0) {
7305					$('.woocommerce-result-count', cssgridResultCount).remove();
7306					cssgridResultCount.append($resultCount);
7307				}
7308			});
7309		};
7310
7311		$filters.each(function(i, buttonGroup) {
7312			var $buttonGroup = $(buttonGroup);
7313			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7314				$buttonGroup.find('.active').removeClass('active');
7315				$(this).addClass('active');
7316
7317			});
7318
7319			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7320				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7321				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7322			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7323				e.preventDefault();
7324				$cats_filters.slideToggle(400, 'easeInOutCirc');
7325			});
7326
7327		});
7328	};
7329};
7330
7331UNCODE.linearGrid = function(){
7332	$('.linear-wrapper').each(function(){
7333		var $wrap = $(this),
7334			$system = $wrap.closest('.linear-system'),
7335			$dragger = $('[data-dragger]', $system),
7336			$row = $wrap.closest('.vc_row[data-parent]'),
7337			_row = $row[0],
7338			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7339			vertical = $cont.hasClass('linear-or-vertical'),
7340			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7341			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7342			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7343			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7344			isInViewport = false,
7345			isHover = false,
7346			init = false,
7347			stableHeight = UNCODE.wheight,
7348			wCont, hCont, docH, marqueeTL;
7349
7350		if ( ! $('.tmb', $cont).length ) {
7351			return;
7352		}
7353
7354		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7355		var dataX = dataSpeed;
7356
7357		dataSpeed += 5;
7358
7359		var checkLinearGridSize = function(){
7360			if ( !$wrap.is(':visible') )  {
7361				return;
7362			}
7363			$wrap.find('.cont-appended').remove();
7364
7365			if ( vertical ) {
7366				if ( ! SiteParameters.is_frontend_editor ) {
7367					hCont = $cont.outerHeight();
7368					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7369					if ( hCont < docH ) {
7370						var res = docH - hCont * 3,
7371							times = 2 * Math.round((res/hCont+1) / 2);
7372					}
7373					for ( var i = 0; i < times; i++ ) {
7374						var $cloneCont = $cont.clone(),
7375							$cloneCont2 = $cont.clone(),
7376							trans = ( (i+2) ) * 100;
7377						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7378						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7379						$cloneCont.find('a[data-lbox]').each(function(){
7380							var dataLbox = $(this).attr('data-lbox');
7381							$(this).attr('data-lbox', dataLbox + '_' + i);
7382						});
7383						$cloneCont.find('.wp-video-shortcode').each(function(){
7384							var thisID = $(this).attr('id');
7385							$(this).attr('id', thisID + '_' + i);
7386						});
7387						$cloneCont2.find('a[data-lbox]').each(function(){
7388							var dataLbox = $(this).attr('data-lbox');
7389							$(this).attr('data-lbox', dataLbox + '_2' + i);
7390						});
7391						$cloneCont2.find('.wp-video-shortcode').each(function(){
7392							var thisID = $(this).attr('id');
7393							$(this).attr('id', thisID + '__' + i);
7394						});
7395						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7396							UNCODE.lightgallery($cloneCont);
7397							UNCODE.lightgallery($cloneCont2);
7398						}
7399					}
7400                }
7401			} else {
7402				wCont = $cont.outerWidth();
7403				if ( (wCont) < UNCODE.wwidth*2 ) {
7404					var res = UNCODE.wwidth*2 - (wCont),
7405						times = 2 * Math.round((res/wCont+1) / 2);
7406				}
7407				for ( var i = 0; i < times; i++ ) {
7408					var $cloneCont = $cont.clone(),
7409						$cloneCont2 = $cont.clone(),
7410						trans = ( (i+2) ) * 100;
7411					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7412					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7413					$cloneCont.find('a[data-lbox]').each(function(){
7414						var dataLbox = $(this).attr('data-lbox');
7415						$(this).attr('data-lbox', dataLbox + '_' + i);
7416					});
7417					$cloneCont.find('[id]').each(function(){
7418						var thisID = $(this).attr('id');
7419						$(this).attr('id', thisID + '_' + i);
7420					});
7421					$cloneCont2.find('a[data-lbox]').each(function(){
7422						var dataLbox = $(this).attr('data-lbox');
7423						$(this).attr('data-lbox', dataLbox + '_2' + i);
7424					});
7425					$cloneCont2.find('[id]').each(function(){
7426						var thisID = $(this).attr('id');
7427						$(this).attr('id', thisID + '__' + i);
7428					});
7429                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
7430                        UNCODE.lightgallery($cloneCont);
7431                        UNCODE.lightgallery($cloneCont2);
7432                    }
7433                }
7434			}
7435		};
7436		if ( clone ) {
7437			checkLinearGridSize();
7438			$(window).on('resize.linearGrid', function(){
7439				checkLinearGridSize();
7440			});
7441		}
7442
7443		var continuousLinearMarquee = function(_xStrt){
7444			if ( !$wrap.is(':visible') )  {
7445				return;
7446			}
7447			var ease = 'none';
7448			wCont = $cont.outerWidth();
7449			hCont = $cont.outerHeight();
7450
7451			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
7452				xEnd = vertical ? hCont : wCont,
7453				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7454				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
7455				speedSlow = (xEnd + xStrt) / 45,
7456				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7457
7458			marqueeTL = new TimelineMax({paused:true, reversed:true});
7459
7460			if ( isInViewport && !isHover && !freezed ) {
7461				marqueeTL.play();
7462
7463				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
7464					var $column = $wrap.closest('.wpb_column'),
7465						$col_link = $('.col-link', $column),
7466						$hover_sel = $wrap;
7467
7468					if ( $col_link.length ) {
7469						$hover_sel = $wrap.add($column);
7470					}
7471
7472					$hover_sel.on('mouseover', function(){
7473						if ( $wrap.attr('data-hover') === 'yes' ) {
7474							//speed = ( 10 - dataSpeed ) * 5;
7475							ease = 'power2.out';
7476							marqueeTL.duration( speedSlow );
7477						} else {
7478							marqueeTL.pause();
7479						}
7480						isHover = true;
7481					}).on('mouseout', function(){
7482						if ( $wrap.attr('data-hover') === 'yes' ) {
7483							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
7484							ease = 'power2.in';
7485							marqueeTL.duration( speed );
7486						} else {
7487							marqueeTL.play();
7488						}
7489						isHover = false;
7490					});
7491				}
7492
7493			}
7494	
7495			gsap.killTweensOf($wrap);
7496			if ( vertical ) {
7497				marqueeTL.fromTo( $wrap, {
7498					y: xStrt * direction
7499				},
7500				{
7501					duration: speed,
7502					y: xEnd * direction * -1,
7503					onComplete: function(){
7504						continuousLinearMarquee();
7505					},
7506					ease: ease,
7507					paused: freezed
7508				});
7509			} else {
7510				marqueeTL.fromTo( $wrap, {
7511					x: xStrt * direction
7512				},
7513				{
7514					duration: speed,
7515					x: xEnd * direction * -1,
7516					onComplete: function(){
7517						continuousLinearMarquee();
7518					},
7519					ease: ease,
7520					paused: freezed
7521				});
7522			}
7523		};
7524
7525		var dragLinearContinuous = function(){
7526			if ( !$wrap.is(':visible') )  {
7527				return;
7528			}
7529			var matrix, _x, _y,
7530				dragAction = false;
7531			Draggable.create($wrap[0], {
7532				type: vertical ? "y" : "x",
7533				bounds: document.getElementById("container"),
7534				inertia: false,
7535				onPress: function (e) {
7536				},
7537				onRelease: function (e) {
7538					if ( dragAction === true ) {
7539						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7540						_x = matrix[12] || matrix[4];
7541						_y = matrix[13] || matrix[5];
7542						if ( vertical ) {
7543							continuousLinearMarquee(_y * -1);
7544						} else {
7545							continuousLinearMarquee(_x * -1);
7546						}
7547						$wrap.removeClass('linear-dragging');
7548					}
7549				},
7550				onDrag: function (e) {
7551					dragAction = true;
7552					$wrap.addClass('linear-dragging');
7553				},
7554				onDragEnd: function (e) {
7555					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7556					_x = matrix[12] || matrix[4];
7557					_y = matrix[13] || matrix[5];
7558					wCont = $cont.outerWidth();
7559					hCont = $cont.outerHeight();
7560					if ( vertical ) {
7561						if ( Math.abs(_y) > hCont ) {
7562							if ( _y < 0 ) {
7563								_y = hCont + parseFloat( _y );
7564							} else {
7565								_y = parseFloat( _y ) - hCont;
7566							}
7567						}
7568						continuousLinearMarquee(_y * -1);
7569					} else {
7570						if ( Math.abs(_x) > wCont ) {
7571							if ( _x < 0 ) {
7572								_x = wCont + parseFloat( _x );
7573							} else {
7574								_x = parseFloat( _x ) - wCont;
7575							}
7576						}
7577						continuousLinearMarquee(_x * -1);
7578					}
7579					$wrap.removeClass('linear-dragging');
7580					dragAction = false;
7581				},
7582			});
7583		};
7584
7585		var runScrollLinear = function(){
7586			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7587			if ( !$wrap.is(':visible') || freezed )  {
7588				return;
7589			}
7590			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7591				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
7592			
7593			var linearGridScroll = function(){
7594				if ( isInViewport ) {
7595					var bound = _row.getBoundingClientRect();
7596
7597					var bound_top = bound.top,
7598						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
7599
7600					if ( vertical ) {
7601						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7602					} else {
7603						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7604					}
7605					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7606						requestAnimationFrame(linearGridScroll);
7607					}
7608				}
7609				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
7610					window.addEventListener("scroll", linearGridScroll);
7611				}
7612			};
7613
7614			$(window).on( 'load wwResize', function(e) {
7615				stableHeight = UNCODE.wheight;
7616				linearGridScroll();
7617			});
7618			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7619				requestAnimationFrame(linearGridScroll);
7620			}
7621		};
7622		
7623		var dragLinear = function(){
7624			if ( !$wrap.is(':visible') )  {
7625				return;
7626			}
7627			var matrix, _x, _y;
7628			Draggable.create($dragger[0], {
7629				type: vertical ? "y" : "x",
7630				bounds: document.getElementById("container"),
7631				inertia: false,
7632				onPress: function (e) {
7633				},
7634				onRelease: function (e) {
7635				},
7636				onDrag: function (e) {
7637					$wrap.addClass('linear-dragging');
7638				},
7639				onDragEnd: function (e) {
7640					matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7641					_x = matrix[12] || matrix[4];
7642					_y = matrix[13] || matrix[5];
7643					wCont = $cont.outerWidth();
7644					hCont = $cont.outerHeight();
7645					if ( vertical ) {
7646						if ( Math.abs(_y) > hCont ) {
7647							if ( _y < 0 ) {
7648								_y = hCont + parseFloat( _y );
7649							} else {
7650								_y = parseFloat( _y ) - hCont;
7651							}
7652							gsap.to( $dragger[0], {
7653								duration: 0,
7654								y: _y,
7655							});
7656						}
7657					} else {
7658						if ( Math.abs(_x) > wCont ) {
7659							if ( _x < 0 ) {
7660								_x = wCont + parseFloat( _x );
7661							} else {
7662								_x = parseFloat( _x ) - wCont;
7663							}
7664							gsap.to( $dragger[0], {
7665								duration: 0,
7666								x: _x,
7667							});
7668						}
7669					}
7670					$wrap.removeClass('linear-dragging');
7671				},
7672			});
7673		};
7674
7675		if ( ! $('body').hasClass('compose-mode') ) {
7676			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
7677				continuousLinearMarquee();
7678				$(window).on( 'wwResize', function(e) {
7679					continuousLinearMarquee();
7680				});	
7681				if ( $wrap.attr('data-draggable') === 'yes' ) {
7682					dragLinearContinuous();
7683				}
7684			}
7685
7686			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7687				runScrollLinear();
7688				if ( $wrap.attr('data-draggable') === 'yes' ) {
7689					dragLinear();
7690				}
7691			}
7692
7693			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7694				var observer = new IntersectionObserver(function(entries) {
7695						
7696					entries.forEach(function(entry){
7697						if ( entry.isIntersecting ) {
7698							isInViewport = true;
7699							if ( !init ) {
7700								init = true;
7701								continuousLinearMarquee();
7702							} else {
7703								if ( typeof marqueeTL !== 'undefined' ) {
7704									marqueeTL.play();
7705								}
7706							}
7707							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7708								requestAnimFrame(runScrollLinear);
7709							}
7710						} else {
7711							isInViewport = false;
7712							if ( typeof marqueeTL !== 'undefined' ) {
7713								marqueeTL.pause();
7714							}
7715						}
7716					});
7717				}, { 
7718					root: document,
7719				});
7720
7721				observer.observe(_row);
7722
7723			} else {
7724
7725				var checkVisible = function( el, off ) {
7726					if (typeof jQuery === "function" && el instanceof jQuery) {
7727						el = el[0];
7728					}
7729			
7730					off = typeof off=='undefined' ? 50 : off;
7731			
7732					var rect = el.getBoundingClientRect();
7733			
7734					return (
7735						(
7736							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7737							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7738							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7739						)
7740					);
7741				};
7742				
7743				var checkVisibility = function(){
7744
7745					if ( checkVisible($row) ) {
7746						isInViewport = true;
7747						if ( typeof marqueeTL !== 'undefined' ) {
7748							marqueeTL.play();
7749						}
7750					} else {
7751						isInViewport = false;
7752						if ( typeof marqueeTL !== 'undefined' ) {
7753							marqueeTL.pause();
7754						}
7755					}
7756				}
7757
7758				window.addEventListener("scroll", checkVisibility);
7759				checkVisibility();
7760
7761			}
7762		}
7763	});
7764};
7765UNCODE.preventDoubleTransition = function() {
7766	$('.sticky-element .animate_when_almost_visible').each(function(){
7767		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
7768			$el.addClass('do_not_reanimate');
7769		});
7770	});
7771};
7772
7773UNCODE.checkScrollForTabs = function(){
7774	var goToSection = window.location.hash.replace('#', ''),
7775		$index;
7776
7777	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
7778	goToSection = encodeURIComponent(goToSection);
7779	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
7780
7781	$index.attr('data-parent', 'parent-' + goToSection);
7782
7783	if (window.location.hash != undefined && window.location.hash != '') {
7784		requestTimeout(function() {
7785			scrollBody('parent-' + goToSection);
7786		}, 500);
7787	}
7788
7789	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
7790		var hash = (e.currentTarget).hash,
7791			index = (e.currentTarget).closest('.uncode-tabs');
7792		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
7793			$('a[href="' + hash + '"][data-tab-history]').click();
7794			scrollBody(index);
7795		}
7796	});
7797
7798	var scrollBody = function(index) {
7799
7800		var getSection = $('a[href="' + index + '"][data-tab-history]'),
7801			scrollTo,
7802			safeGap = 27;
7803
7804		if ( ! getSection.length ) {
7805			getSection = $('div[data-parent="' + index + '"]');
7806
7807			if ( getSection.attr('data-target') == 'row' ) {
7808				getSection = getSection.closest('.vc_row');
7809				safeGap = 0;
7810			}
7811		}
7812
7813		if (typeof getSection === 'undefined' || ! getSection.length ) {
7814			return;
7815		}
7816
7817		var body = $("html, body"),
7818		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7819		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
7820		getOffset = UNCODE.get_scroll_offset();
7821		if ( typeof getSection.offset() === 'undefined' )
7822			return;
7823		scrollTo = getSection.offset().top - safeGap;
7824		scrollTo -= getOffset;
7825
7826		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7827		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7828
7829		if (index != 0) {
7830			UNCODE.scrolling = true;
7831		}
7832
7833		if (scrollSpeed == 0) {
7834			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
7835			UNCODE.scrolling = false;
7836		} else {
7837			body.animate({
7838				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
7839			}, scrollSpeed, 'easeInOutQuad', function() {
7840				requestTimeout(function() {
7841					UNCODE.scrolling = false;
7842					if (getOffset != UNCODE.get_scroll_offset()) {
7843						scrollBody(index);
7844					}
7845				}, 100);
7846			});
7847		}
7848
7849	};
7850};
7851
7852UNCODE.printScreen = function() {
7853	var inlineMediaStyle = null,
7854		setResize;
7855
7856    function changeMediaStyle() {
7857		clearRequestTimeout(setResize);
7858		setResize = requestTimeout(function(){
7859	        var $head = document.getElementsByTagName('head')[0],
7860	        	$newStyle = document.createElement('style'),
7861	        	winW = window.innerWidth,
7862	        	printH = window.innerHeight;
7863
7864	        $newStyle.setAttribute('type', 'text/css');
7865	        $newStyle.setAttribute('media', 'print');
7866	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
7867
7868	        if (inlineMediaStyle != null) {
7869	            $head.replaceChild($newStyle, inlineMediaStyle)
7870	        } else {
7871	            $head.appendChild($newStyle);
7872	        }
7873	        inlineMediaStyle = $newStyle;
7874	    }, 1000);
7875    }
7876
7877    changeMediaStyle();
7878    window.addEventListener('resize', changeMediaStyle);
7879};
7880
7881UNCODE.fullPage = function() {
7882	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
7883		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
7884		return false;
7885	} else {
7886		requestTimeout(function() {
7887			window.scrollTo(0, 0);
7888		}, 10);
7889	}
7890
7891	var $masthead = $('#masthead'),
7892		$logo = $('#logo-container-mobile'),
7893		$logolink = $('[data-minheight]', $logo),
7894		logoMinScale = $logolink.data('minheight'),
7895		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
7896		$container = $('.main-container .post-content'),
7897		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
7898		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
7899		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
7900		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
7901		headerWithOpacity = $('.header-scroll-opacity', $header).length,
7902		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
7903		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
7904		scrollBar = true,
7905		effect,
7906		animationEndTimeOut,
7907		fp_anim_time = 900,
7908		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
7909		is_scrolling = false,
7910		dataNames = [],
7911		is_first = true,
7912		no_history = $('body').hasClass('uncode-scroll-no-history'),
7913		theres_footer = true;
7914
7915	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
7916		$('> div', $footer).each(function(index, el){
7917			if ( $(el).outerHeight() < 2 )
7918				theres_footer = false;
7919			else
7920				theres_footer = true;
7921		});
7922	}
7923
7924	if ( !$footer.length )
7925		theres_footer = false;
7926
7927	if ( !UNCODE.isFullPageSnap ) {
7928
7929		if ( $('body').hasClass('uncode-fullpage-zoom') )
7930			effect = 'scaleDown';
7931		else if ( $('body').hasClass('uncode-fullpage-parallax') )
7932			effect = 'moveparallax';
7933		else
7934			effect = 'movecurtain';
7935	}
7936
7937	if ( $('body').hasClass('uncode-fullpage-trid') )
7938		fp_anim_time = fp_anim_time*2;
7939
7940	if ( $header.length ) {
7941		if ( headerName !== '' )
7942			$header.attr('data-name', headerName);
7943		if ( headerLabel !== '' )
7944			$header.attr('data-label', headerLabel);
7945		$container.prepend($header);
7946	}
7947	if ( theres_footer ) {
7948		$container.append($footer);
7949		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
7950		$('aside.widget ul', $footer).addClass('no-list');
7951	}
7952
7953	var $all = $rows.add($header);
7954
7955	if ( theres_footer )
7956		$all = $all.add($footer);
7957
7958	$all.each(function(index, row) {
7959		if( index === 0 )
7960			$(row).addClass('uncode-scroll-active');
7961	});
7962
7963    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
7964
7965	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
7966		$("<ul class='onepage-pagination'></ul>").prependTo("body");
7967	}
7968
7969	$all.each(function(index, val) {
7970		var getName = $(val).data('name'),
7971			label;
7972
7973		if (typeof getName == 'undefined' || getName == 'undefined')
7974			getName = SiteParameters.slide_name + '-' + index;
7975
7976		//if ( dataNames.includes(getName) ) {
7977		if ( dataNames.indexOf(getName) > 0 ) {
7978			getName += '_' + index;
7979			$(val).data('name', getName);
7980		}
7981
7982		dataNames.push(getName);
7983
7984		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
7985
7986		if (typeof $(val).attr('data-label') !== 'undefined')
7987			label = $(val).attr('data-label');
7988		else label = '';
7989
7990		if ( $(val).is($footer) )
7991			return;
7992
7993		if (label != '' ) {
7994			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
7995			$('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>");
7996		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
7997			$('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>");
7998		}
7999	});
8000
8001	var checkVisible = function( el, off ) {
8002		if (typeof jQuery === "function" && el instanceof jQuery) {
8003			el = el[0];
8004		}
8005
8006		off = typeof off=='undefined' ? 50 : off;
8007
8008		var rect = el.getBoundingClientRect();
8009
8010		return (
8011			(
8012				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8013				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
8014				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
8015			)
8016		);
8017	};
8018
8019	var animationEndAction = function( index, nextIndex ) {
8020		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8021			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8022			player, iframe;
8023
8024		if ( !$nextSlide.is($footer) ) {
8025			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
8026		}
8027
8028		if ( !UNCODE.isFullPageSnap ) {
8029			activateKBurns( nextIndex );
8030		}
8031
8032		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8033			if ($(this).attr('data-provider') == 'vimeo') {
8034				iframe = $(this).find('iframe');
8035				player = new Vimeo.Player(iframe[0]);
8036				player.pause();
8037			} else if ($(this).attr('data-provider') == 'youtube') {
8038				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8039			} else {
8040				if ($(this).is('video')) {
8041					$(this)[0].volume = 0;
8042					$(this)[0].pause();
8043				}
8044			}
8045		});
8046
8047		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8048			if ( $nextSlide.is($header) )
8049				$header.removeClass('header-scrolled');
8050		}
8051
8052		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
8053		$otherEl.each(function(){
8054			var $otherThis = $(this),
8055				$bgwrapperOther = $('.background-inner', $otherThis);
8056			if ( !checkVisible($otherThis) )
8057				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
8058
8059		});
8060
8061		if ( !checkVisible($currentSlide) ) {
8062			$currentSlide.removeClass('uncode-scroll-visible');
8063			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
8064			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
8065				currentScroll.scrollTo(0, 0, 0);
8066		}
8067
8068		clearRequestTimeout(animationEndTimeOut);
8069		animationEndTimeOut = requestTimeout(function(){
8070			Waypoint.refreshAll();
8071			$( document.body ).trigger('uncode_waypoints');
8072			var eventFP = new CustomEvent('fp-slide-changed');
8073			window.dispatchEvent(eventFP);
8074			is_scrolling = false;
8075
8076			if ( is_first ) {
8077				$('ul.onepage-pagination a').removeClass('is-selected');
8078				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8079				is_first = false;
8080			}
8081
8082		}, 500);
8083	};
8084
8085	var postLeaveActions = function( nextIndex ){
8086		if ( menuHidden && ! UNCODE.isMobile )
8087			return false;
8088
8089		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8090			$cols = $('.uncol', $el),
8091			anchor = $el.data('anchor');
8092
8093		if ( ! UNCODE.isFullPageSnap ) {
8094			$.each($cols, function(index, val){
8095				if ( $(val).hasClass('style-light') ){
8096					$masthead.removeClass('style-dark-override').addClass('style-light-override');
8097					return false;
8098				} else if ( $(val).hasClass('style-dark') ) {
8099					$masthead.removeClass('style-light-override').addClass('style-dark-override');
8100					return false;
8101				}
8102			});
8103		}
8104
8105		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
8106			$('.menu-item' ).removeClass('active');
8107			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8108		}
8109
8110		if ( !UNCODE.isFullPageSnap ) {
8111			activateBackWash( nextIndex );
8112		}
8113	};
8114
8115	var activateBackWash = function( nextIndex ){
8116		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8117			$bgwrapper;
8118
8119		if ( $el.length ) {
8120			if ( $el.hasClass('with-zoomout') ) {
8121				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8122			} else if ( $('.with-zoomout', $el).length ) {
8123				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
8124			} else {
8125				return false;
8126			}
8127		} else {
8128			return false;
8129		}
8130
8131		$bgwrapper.addClass('uncode-zoomout');
8132
8133	};
8134
8135	var activateKBurns = function( nextIndex ){
8136		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8137			$bgwrapper;
8138
8139		if ( $el.length ) {
8140			if ( $el.hasClass('with-kburns') ) {
8141				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8142			} else if ( $('.with-kburns', $el).length ) {
8143				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
8144			} else {
8145				return false;
8146			}
8147		} else {
8148			return false;
8149		}
8150
8151		$bgwrapper.addClass('uncode-kburns');
8152
8153	};
8154
8155	var activateParallax = function( nextIndex, direction ){
8156
8157		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8158			$cell = $('.fp-tableCell', $el),
8159			animationEnd = 'webkitAnimationEnd animationend',
8160			cellAnim;
8161
8162		switch( direction ) {
8163			case 'up':
8164				cellAnim = 'moveFromTopInner';
8165				break;
8166			default:
8167				cellAnim = 'moveFromBottomInner';
8168		}
8169
8170		$cell.css({
8171			'animation-name': cellAnim,
8172			'animation-duration': fp_anim_time + 'ms',
8173			'animation-delay': '',
8174			'animation-timing-function': fp_easing,
8175			'animation-fill-mode': 'both',
8176		}).off(animationEnd)
8177		.on(animationEnd, function(event) {
8178			if ( event.originalEvent.animationName === cellAnim ) {
8179				$cell
8180					.css({
8181						'animation-name': '',
8182						'animation-duration': '',
8183						'animation-delay': '',
8184						'animation-timing-function': '',
8185						'animation-fill-mode': '',
8186					});
8187			}
8188		});
8189	};
8190
8191	var scrollHashes = function(){
8192		var hash = window.location.hash.replace('#', '').split('/'),
8193			hashInd;
8194		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
8195			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
8196				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
8197				$.fn.fullpage.moveTo(hashInd+1);
8198			}
8199		} else if( hash[0] === '' ) {
8200			$.fn.fullpage.moveTo(1);
8201		}
8202	};
8203
8204	var hideMenu = function( index, nextIndex ){
8205		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
8206			return false;
8207
8208		var hMenu = UNCODE.menuHeight,
8209			transTime = hMenu * 2;
8210
8211		if ( index === 1 && nextIndex > 1 ) {
8212			hMenu = hMenu * -1;
8213		} else if  ( index !== 1 && nextIndex === 1 ) {
8214			hMenu = 0;
8215		} else {
8216			return false;
8217		}
8218
8219		$masthead.css({
8220			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8221			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8222			'-webkit-transition': 'transform 0.5s ease-in-out',
8223			'transition': 'transform 0.5s ease-in-out'
8224		});
8225	};
8226
8227	var shrinkMenu = function( index, nextIndex ){
8228		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
8229			return false;
8230
8231		if ( index === 1 && nextIndex > 1 ) {
8232			$logo.addClass('shrinked');
8233			$('div', $logo).each(function(index, val){
8234				$(val).css({
8235					'height': logoMinScale,
8236					'line-height': logoMinScale
8237				});
8238				if ($(val).hasClass('text-logo')) {
8239					$(val).css({
8240						'font-size': logoMinScale + 'px'
8241					});
8242				}
8243			});
8244			requestTimeout(function() {
8245				UNCODE.menuMobileHeight = $masthead.outerHeight();
8246			}, 300);
8247		} else if ( index !== 1 && nextIndex === 1 ) {
8248			$logo.removeClass('shrinked');
8249			$('div', $logo).each(function(index, val){
8250				$(val).css({
8251					'height': logoMaxScale,
8252					'line-height': logoMaxScale
8253				});
8254				if ($(val).hasClass('text-logo')) {
8255					$(val).css({
8256						'font-size': logoMaxScale + 'px'
8257					});
8258				}
8259			});
8260			requestTimeout(function() {
8261				UNCODE.menuMobileHeight = $masthead.outerHeight();
8262			}, 300);
8263		} else {
8264			return false;
8265		}
8266
8267	};
8268
8269	var anchorLink = function(){
8270
8271		$container.add('.menu-item').find('a[href*="#"]').on('click', function(e) {
8272			var $this = $(e.currentTarget),
8273				hash = e.currentTarget.href.split('#'),
8274				current = window.location.href.split('#'),
8275				ind,
8276				currentMenuOpened = UNCODE.menuOpened,
8277				go = false;
8278
8279			var hash_url = hash[0].replace(/\/?$/, '/'),
8280				current_url = current[0].replace(/\/?$/, '/');
8281
8282			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
8283				hash = '#'+hash[1];
8284				e.preventDefault();
8285				go = true;
8286			}
8287
8288			if ( go ) {
8289
8290				if ( $(hash).length ) {
8291					ind = $(hash).closest('.fp-section').index();
8292				} else {
8293					hash = hash.slice(1);
8294					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
8295				}
8296
8297				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
8298					ind = $this.closest('.fp-section').index();
8299
8300				UNCODE.menuOpened = false;
8301
8302				$.fn.fullpage.moveTo(ind+1);
8303
8304				UNCODE.menuOpened = currentMenuOpened;
8305				if (UNCODE.menuOpened) {
8306					if (UNCODE.wwidth < UNCODE.mediaQuery) {
8307						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
8308					} else {
8309						$('.mmb-container-overlay .overlay-close').trigger('click');
8310						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
8311					}
8312				}
8313
8314			}
8315
8316		});
8317
8318		$('.header-scrolldown').on('click', function(event) {
8319			event.preventDefault();
8320			var scrollDown = $(this),
8321				ind = scrollDown.closest('.fp-section').index();
8322
8323			$.fn.fullpage.moveTo(ind+2);
8324		});
8325
8326		var anchor = $('.fp-section.active').data('anchor');
8327
8328		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
8329			$('.menu-item').removeClass('active');
8330			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8331		}
8332
8333	};
8334
8335	var slideLeave = function( index, nextIndex, direction ) {
8336		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8337			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8338			animationEnd = 'webkitAnimationEnd animationend',
8339			transitionEnd = 'webkitTransitionEnd transitionend',
8340			animOut = effect != 'scaleDown' ? effect + direction : effect,
8341			animIn,
8342			isFooter = false,
8343			isFooterNext = false,
8344			footerH = $footer.outerHeight(),
8345			timeout,
8346			player, iframe,
8347			footerCoeff;
8348		switch( direction ) {
8349			case 'up':
8350				animIn = 'moveFromTop';
8351				break;
8352			default:
8353				animIn = 'moveFromBottom';
8354		}
8355
8356		if ( $('body').hasClass('uncode-fullpage-trid') ) {
8357			animOut = animIn + 'trid';
8358			animIn = animOut + 'In';
8359		} else if ( UNCODE.isFullPageSnap ) {
8360			animIn = animOut = 'none';
8361		}
8362
8363		hideMenu(index, nextIndex);
8364		shrinkMenu(index, nextIndex);
8365
8366		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8367			if ($(this).attr('data-provider') == 'vimeo') {
8368				iframe = $(this).find('iframe');
8369				player = new Vimeo.Player(iframe[0]);
8370				player.pause();
8371			} else if ($(this).attr('data-provider') == 'youtube') {
8372				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8373			} else {
8374				if ($(this).is('video')) {
8375					$(this)[0].volume = 0;
8376					$(this)[0].pause();
8377				}
8378			}
8379		});
8380
8381		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
8382			if ($(this).attr('data-provider') == 'vimeo') {
8383				iframe = $(this).find('iframe');
8384				iframe.on('load', function(){
8385					player = new Vimeo.Player(iframe);
8386					player.setVolume(0);
8387					player.play();
8388				});
8389				player = new Vimeo.Player(iframe);
8390				player.setVolume(0);
8391				player.play();
8392			} else if ($(this).attr('data-provider') == 'youtube') {
8393				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
8394			} else {
8395				if ($(this).is('video')) {
8396					$(this)[0].volume = 0;
8397					$(this)[0].play();
8398				}
8399			}
8400		});
8401
8402		if ( $currentSlide.is($footer) )
8403			isFooter = true;
8404
8405		if ( $nextSlide.is($footer) )
8406			isFooterNext = true;
8407
8408		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8409			if ( $currentSlide.is($header) )
8410				$header.addClass('header-scrolled');
8411		}
8412
8413		footerCoeff = footerH;
8414
8415		if ( UNCODE.isFullPageSnap ) {
8416			postLeaveActions( nextIndex );
8417			activateBackWash( nextIndex );
8418			activateKBurns( nextIndex );
8419			requestTimeout(function(){
8420				animationEndAction( index, nextIndex );
8421			}, fp_anim_time+150);
8422		} else {
8423			if ( isFooterNext ) {
8424
8425				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
8426				$iscrollWrapper.addClass('no-scrolloverflow');
8427
8428				$nextSlide
8429				.add($currentSlide)
8430				.addClass('uncode-scroll-front')
8431				.addClass('uncode-scroll-active')
8432				.addClass('uncode-scroll-visible');
8433				$container.css({
8434					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8435					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8436					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8437					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8438				}).off(transitionEnd)
8439				.one(transitionEnd, function(){
8440					animationEndAction( index, nextIndex );
8441				});
8442
8443			} else if ( isFooter ) {
8444
8445				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
8446				.add($currentSlide)
8447				.addClass('uncode-scroll-front')
8448				.addClass('uncode-scroll-active')
8449				.addClass('uncode-scroll-visible');
8450				$container.css({
8451					'-webkit-transform': 'translate3d(0, 0, 0)',
8452					'transform': 'translate3d(0, 0, 0)',
8453					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8454					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8455				})
8456				.one(transitionEnd, function(){
8457					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
8458						clearRequestTimeout(timeout);
8459						timeout = requestTimeout(function(){
8460							$.fn.fullpage.moveTo(nextIndex);
8461							slideLeave( index-1, nextIndex, 'up' );
8462							$container.off(transitionEnd);
8463						}, 50);
8464					}
8465					animationEndAction( index, nextIndex );
8466				});
8467
8468			} else {
8469
8470				postLeaveActions( nextIndex );
8471
8472				if ( !$('body').hasClass('uncode-fullpage-trid') )
8473					activateParallax( nextIndex, direction );
8474
8475				var $outBg = $('.background-wrapper', $currentSlide);
8476
8477				$nextSlide
8478				.addClass('uncode-scroll-front')
8479				.addClass('uncode-scroll-active')
8480				.addClass('uncode-scroll-visible')
8481				.addClass('uncode-scroll-animating-in')
8482				.css({
8483					'z-index':4,
8484					'animation-name': animIn,
8485					'animation-duration': fp_anim_time + 'ms',
8486					'animation-delay': '',
8487					'animation-timing-function': fp_easing,
8488					'animation-fill-mode': 'both',
8489					'transition': 'initial',
8490				}).off(animationEnd)
8491				.on(animationEnd, function(event) {
8492					if ( event.originalEvent.animationName === animIn ) {
8493						$(this)
8494							.addClass('uncode-scroll-already')
8495							.removeClass('uncode-scroll-front')
8496							.removeClass('uncode-scroll-animating-in')
8497							.css({
8498								'animation-name': '',
8499								'animation-duration': '',
8500								'animation-delay': '',
8501								'animation-timing-function': '',
8502								'animation-fill-mode': '',
8503								'transition': 'initial',
8504							});
8505
8506						$currentSlide
8507							.removeClass('uncode-scroll-active')
8508							.add($outBg)
8509							.css({
8510								'animation-name': '',
8511								'animation-duration': '',
8512								'animation-delay': '',
8513								'animation-timing-function': '',
8514								'animation-fill-mode': '',
8515								'transition': 'initial',
8516							});
8517
8518						animationEndAction( index, nextIndex );
8519
8520					}
8521
8522					if ( nextIndex > 1 )
8523						$('body').addClass('window-scrolled');
8524					else
8525						$('body').removeClass('window-scrolled');
8526				});
8527
8528				$currentSlide
8529					.addClass('uncode-scroll-animating-out')
8530					.removeClass('uncode-scroll-front')
8531					.css({
8532						'z-index':'1',
8533						'animation-name': animOut,
8534						'animation-duration': fp_anim_time + 'ms',
8535						'animation-delay': '',
8536						'animation-timing-function': fp_easing,
8537						'animation-fill-mode': 'both',
8538						'transition': 'initial',
8539						'will-change': 'auto'
8540					}).off(animationEnd)
8541					.on(animationEnd, function(event) {
8542						if ( event.originalEvent.animationName === animOut ) {
8543							$currentSlide.removeClass('uncode-scroll-animating-out');
8544						}
8545					});
8546
8547				if ( $('body').hasClass('uncode-fp-opacity') ) {
8548					$currentSlide.find('> div').css({
8549						'animation-name': 'opacityout',
8550						'animation-duration': fp_anim_time + 'ms',
8551						'animation-delay': '',
8552						'animation-timing-function': fp_easing,
8553						'animation-fill-mode': 'both',
8554						'transition': 'initial',
8555					}).off(animationEnd)
8556					.on(animationEnd, function(event) {
8557						if ( event.originalEvent.animationName === 'opacityout' ) {
8558							$(event.currentTarget).css({
8559								'animation-name': '',
8560								'animation-duration': '',
8561								'animation-delay': '',
8562								'animation-timing-function': '',
8563								'animation-fill-mode': '',
8564								'transition': '',
8565							});
8566						}
8567					});
8568				}
8569			}
8570		}
8571
8572		$('.scroll-top').on('click', function(e){
8573			$.fn.fullpage.moveTo(1);
8574			return false;
8575		});
8576
8577	};
8578
8579	var init_fullPage = function(mode){
8580
8581		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
8582		// 	scrollBar = false;
8583		// }
8584
8585		var checkFPeffects;
8586
8587		$container.fullpage({
8588			sectionSelector: '.uncode-scroll-lock',
8589			scrollOverflow: true,
8590			scrollOverflowOptions: {
8591				click: false,
8592				preventDefaultException: { tagName:/.*/ }
8593			},
8594			navigation: false,
8595			scrollBar: scrollBar,
8596			scrollingSpeed: fp_anim_time,
8597			verticalCentered: true,
8598			anchors: no_history ? false : dataNames,
8599			recordHistory: !no_history,
8600			afterRender: function(){
8601				$('body').removeClass('fp-waiting');
8602				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
8603					var $invisible = $(this).addClass('hidden-scroll');//,
8604				});
8605				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
8606					var $visible = $(this).addClass('uncode-scroll-visible'),
8607						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
8608					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
8609				});
8610
8611				$('ul.onepage-pagination a').on('click', function(e){
8612					e.preventDefault();
8613					var $a = $(this),
8614						toIndex = $a.data('index');
8615
8616					$.fn.fullpage.moveTo(toIndex+1);
8617				});
8618
8619				requestTimeout(function(){
8620					scrollHashes();
8621				}, 1000);
8622
8623				$(window).on('hashchange', function(e){
8624					requestTimeout(function(){
8625						scrollHashes();
8626					}, 500);
8627				});
8628
8629				anchorLink();
8630
8631				if ( $('body').hasClass('uncode-fp-opacity') ) {
8632					$all.each(function(index, row) {
8633						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
8634							classBg;
8635
8636						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
8637							classBg = testmatch[0];
8638							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
8639						}
8640					});
8641				}
8642
8643				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
8644					$(window).on('menuOpen gdprOpen', function(){
8645						$.fn.fullpage.setAutoScrolling(false);
8646					}).on('menuClose gdprClose', function(){
8647						$.fn.fullpage.setAutoScrolling(true);
8648					});
8649				}
8650
8651				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
8652					requestTimeout(function(){
8653						$.fn.fullpage.setAutoScrolling(false);
8654					}, 1000);
8655				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
8656					$.fn.fullpage.setAutoScrolling(true);
8657				});
8658
8659				if ( !UNCODE.isFullPageSnap ) {
8660					clearRequestTimeout(checkFPeffects);
8661					checkFPeffects = requestTimeout(function(){
8662						activateBackWash( 1 );
8663						activateKBurns( 1 );
8664					}, 100);
8665				}
8666
8667			},
8668			onLeave: function( index, nextIndex, direction ){
8669
8670				if ( UNCODE.menuOpened || is_scrolling )
8671					return false;
8672
8673				is_scrolling = true;
8674
8675				var event = new CustomEvent('fp-slide-leave');
8676				window.dispatchEvent(event);
8677
8678				slideLeave( index, nextIndex, direction );
8679
8680				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
8681					if ( direction === 'up' ) {
8682						$.fn.fullpage.moveTo(nextIndex-1);
8683					} else {
8684						$.fn.fullpage.moveTo(nextIndex+1);
8685					}
8686					return false;
8687				}
8688
8689				$('ul.onepage-pagination a').removeClass('is-selected');
8690				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8691
8692			}
8693		});
8694	};
8695
8696	init_fullPage();
8697	$(window).on('load', function(){
8698		requestTimeout(function(){
8699			$.fn.fullpage.reBuild();
8700		}, 3000);
8701	});
8702
8703	var addScrollingClass,
8704		removeScrollingClass;
8705
8706	window.addEventListener("fp-slide-scroll", function(){
8707		addScrollingClass = requestTimeout( function(){
8708			$('body').addClass('fp-slide-scrolling');
8709		}, 10 );
8710
8711		clearRequestTimeout(removeScrollingClass);
8712		removeScrollingClass = requestTimeout( function(){
8713			$('body').removeClass('fp-slide-scrolling');
8714		}, 150 );
8715
8716		Waypoint.refreshAll();
8717	}, false);
8718
8719	var setFPheight = function(){
8720		var $body = document.body,
8721			$footer = document.getElementById('colophon'),
8722			$maincontainer = document.querySelector('.main-wrapper'),
8723			$boxcontainer = document.querySelector('.box-container'),
8724			$sections = document.querySelectorAll('.fp-section'),
8725			rect = $maincontainer.getBoundingClientRect(),
8726			rect2 = $boxcontainer.getBoundingClientRect(),
8727			$masthead = document.getElementById('masthead'),
8728			_hideMenu = false,
8729			menuHeight = UNCODE.menuHeight;
8730		$body.style.height = UNCODE.wheight + 'px';
8731
8732		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
8733			_hideMenu = true;
8734		}
8735		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
8736			menuHeight = 0
8737		}
8738
8739
8740		if ( theres_footer )
8741			$footer.style.top = (rect.height || rect2.height) + 'px';
8742
8743		for (var i = 0; i < $sections.length; i++) {
8744			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
8745		}
8746	};
8747
8748	setFPheight();
8749
8750	window.addEventListener('resize', setFPheight, false);
8751	window.addEventListener('orientationchange', setFPheight, false);
8752
8753};
8754
8755UNCODE.particles = function() {
8756	$(".vc-particles-background").each(function() {
8757		var $particle = $(this);
8758		var $parent = $particle.closest('[data-parent]');
8759
8760		$parent.prepend($particle);
8761		// $(window).trigger('resize');
8762	})
8763};
8764
8765
8766UNCODE.readMoreCol = function( $el ){
8767	if ( typeof $el === 'undefined' || $el === null ) {
8768		$el = $('body');
8769	}
8770	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
8771	$readMoreCols.each(function(){
8772		var $uncont = $(this),
8773			$row = $uncont.closest('.row-container'),
8774			max_h = $uncont.attr('data-ov-height'),
8775			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
8776			actual_max_h = $uncont.outerHeight(),
8777			inner_h,
8778			$read_more = $('+ .btn-more-wrap', $uncont),
8779			read_more_resize = $read_more.hasClass('trigger-resize'),
8780			marginClosedBtn = $uncont.attr('data-margin-closed'),
8781			marginClosed = 0,
8782			marginOpenBtn = $uncont.attr('data-margin-open'),
8783			marginOpen = 0,
8784			anim_t = 250,
8785			resized = false;
8786
8787		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
8788
8789		switch (marginClosedBtn) {
8790			case 'sm':
8791				marginClosed = 18
8792				break;
8793				
8794			case 'std':
8795				marginClosed = 36
8796				break;
8797				
8798			case 'lg':
8799				marginClosed = 72
8800				break;
8801				
8802			case '':
8803			default:
8804				marginClosed = 0
8805				break;
8806				
8807		}
8808
8809		switch (marginOpenBtn) {
8810			case 'sm':
8811				marginOpen = 18
8812				break;
8813				
8814			case 'std':
8815				marginOpen = 36
8816				break;
8817				
8818			case 'lg':
8819				marginOpen = 72
8820				break;
8821				
8822			case 'no':
8823				marginOpen = 0
8824				break;
8825				
8826		}
8827
8828		var checkToggleMobile = function(){
8829			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
8830				resized = true;
8831				if ( $read_more.hasClass('state-closed') ) {
8832					$uncont[0].style.height = '';
8833					$uncont[0].style.maxHeight = max_h_mobile;
8834				}
8835			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
8836				if ( $read_more.hasClass('state-closed') ) {
8837					$uncont[0].style.height = '';
8838					$uncont[0].style.maxHeight = max_h;
8839				}
8840				resized = false;
8841			}
8842		}
8843		checkToggleMobile();
8844		$(window).on('resize', function() {
8845			checkToggleMobile();
8846		});
8847
8848		$('a', $read_more).on('click', function(e){
8849			e.preventDefault();
8850
8851			var $a = $(this);
8852
8853			if ( $read_more.hasClass('state-closed') ) {
8854
8855				$read_more
8856					.removeClass('state-closed')
8857					.addClass('state-open');
8858
8859				$uncont.css({
8860					'max-height': 'none',
8861					'height': 'auto',
8862				});
8863	
8864				inner_h = parseFloat( $uncont.outerHeight() );
8865
8866				$uncont.css({
8867					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8868				});
8869		
8870				anim_t = inner_h - actual_max_h;
8871				if ( anim_t < 250 ) {
8872					anim_t = 250;
8873				} else if ( anim_t > 1000 ) {
8874					anim_t = 1000;
8875				}
8876
8877				$uncont.css({
8878					'transition-duration' : anim_t + 'ms'
8879				}).addClass('overflow-mask-animation').animate({
8880					'height': inner_h
8881				}, anim_t, 'easeInOutCubic', function(){
8882					$uncont.css({
8883						'height' : 'auto'
8884					}).removeClass('overflow-mask');
8885					if ( read_more_resize === true ) {
8886						window.dispatchEvent(new Event('resize'));
8887						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8888							ScrollTrigger.refresh(true);
8889						}
8890					}
8891				});
8892
8893				if ( marginOpen != '' ) {
8894					$read_more.animate({
8895						'margin-top' : marginOpen
8896					}, anim_t, 'easeInOutCubic');
8897				}
8898
8899			} else {
8900				$read_more
8901					.removeClass('state-open')
8902					.addClass('state-closed');
8903
8904				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
8905					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8906				}, anim_t, 'easeInOutCubic', function(){
8907					if ( read_more_resize === true ) {
8908						window.dispatchEvent(new Event('resize'));
8909						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8910							ScrollTrigger.refresh(true);
8911						}
8912					}
8913				});
8914
8915				if ( marginClosed !== '' ) {
8916					$read_more.animate({
8917						'margin-top' : marginClosed
8918					}, anim_t, 'easeInOutCubic');
8919				}
8920
8921				if ( $a.hasClass('toggle-scroll') ) {
8922                    var $masthead = $('#masthead > div:first-child'),
8923                        headH = $masthead.outerHeight(),
8924						rectTop = $row[0].getBoundingClientRect().top,
8925						checkNavBar = $a.hasClass('toggle-navbar'),
8926						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
8927                        offCont = ( $row.offset().top );
8928
8929					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
8930						checkNavBar = checkNavBarMobile;
8931					}
8932
8933					if ( checkNavBar ) {
8934						offCont = offCont - headH;
8935					}
8936			
8937					if ( rectTop < headH ) {
8938						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
8939							$(this).stop();
8940						}).animate({
8941							scrollTop: offCont
8942						}, anim_t, 'easeInOutCubic');
8943					}
8944				}
8945
8946			}
8947		});
8948	});
8949}
8950UNCODE.filters = function() {
8951	var $systems = $('.isotope-system, .cssgrid-system');
8952
8953	$systems.each(function(index, val){
8954		var $system = $(this),
8955			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
8956			$widgets = $('.widgetized-cb-wrapper', $system),
8957			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
8958			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
8959			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
8960			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
8961
8962		if ($system.hasClass('isotope-processed')) {
8963			return;
8964		}
8965
8966		$cats_trigger.on('click', function(e) {
8967			if ( ! $('html').hasClass('screen-sm') ) {
8968				// $widgets.add($sorting_dd).slideUp(400);
8969				e.preventDefault();
8970				$widgets.slideUp(400, 'easeInOutCirc');
8971			}
8972		});
8973
8974		$('.filters-toggle-trigger', $system).on('click', function(e) {
8975			e.preventDefault();
8976			var $filters = $('.isotope-filters .menu-horizontal', $system);
8977			$filters.slideToggle(400, 'easeInOutCirc');
8978			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8979		});
8980
8981		$widget_trgr.on('click', function(e) {
8982			e.preventDefault();
8983			$widgets.slideToggle(400, 'easeInOutCirc');
8984			if (!$('html').hasClass('screen-sm')) {
8985				$cats_filters.slideUp(400, 'easeInOutCirc');
8986			}
8987			window.dispatchEvent(new CustomEvent('boxResized'));
8988		});
8989
8990		$sorting_trgr.on('click', function(e) {
8991			e.preventDefault();
8992			if (!$('html').hasClass('screen-sm')) {
8993				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8994			}
8995		});
8996
8997		$system.addClass('isotope-processed');
8998	});
8999
9000};
9001
9002UNCODE.widgets = function() {
9003	var widget_collapses = $('.widget-collapse');
9004
9005	widget_collapses.each(function(){
9006		var widget_collapse = $(this),
9007			widget_title = widget_collapse.find('.widget-title'),
9008			widget = widget_title.closest('.widget'),
9009			content = widget.children().not('.widget-title'),
9010			setCTA;
9011
9012		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
9013			widget_title.toggleClass('open');
9014		}
9015
9016		widget_title.each(function() {
9017			var _this = $(this);
9018			var content = _this.closest('.widget').find('.widget-collapse-content');
9019
9020			$(window).on('load resize', function(){
9021				clearRequestTimeout(setCTA);
9022				setCTA = requestTimeout( function() {
9023					if ( content.is(':visible') ) {
9024						_this.addClass( 'open' );
9025					} else {
9026						_this.removeClass( 'open' );
9027					}
9028				}, 10 );
9029			})
9030
9031			_this.on( 'click', function(){
9032
9033				// Get content of :after element (+ icon) to check the visibility
9034				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
9035
9036				if (icon_content === 'none' || !icon_content) {
9037					return false;
9038				}
9039
9040				_this.toggleClass('open');
9041				var isOpen = _this.hasClass('open'),
9042					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
9043				content.animate({
9044					height: 'toggle',
9045					padding: 'toggle',
9046					opacity: 'toggle',
9047					top: isOpen ? 0 : hasBorder
9048				}, {
9049					duration: 400,
9050					easing: "easeInOutCirc",
9051				});
9052
9053				return false;
9054
9055			});
9056		});
9057	});
9058
9059	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
9060};
9061
9062UNCODE.unmodal = function() {
9063	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
9064		$('.unmodal-overlay').fadeIn();
9065		$('.unmodal-overlay').addClass('loading');
9066		$('body').addClass('uncode-unmodal-overlay-visible');
9067		$(window).trigger('unmodal-open');
9068	});
9069
9070	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
9071		$('.unmodal-overlay').fadeOut();
9072		$('.unmodal').fadeOut();
9073		$('body').removeClass('uncode-unmodal-overlay-visible');
9074		$('body').removeClass('uncode-unmodal-open');
9075		$('html').removeClass('uncode-unmodal-body-disable-scroll');
9076		$(document).trigger('unmodal-close');
9077		UNCODE.isUnmodalOpen = false;
9078	});
9079
9080	$(document).on('uncode-unmodal-show-content', function() {
9081		$('.unmodal-overlay').removeClass('loading');
9082		$('.unmodal').show();
9083		$('.unmodal').addClass('show-unmodal-with-animation');
9084		$('.unmodal-content')[0].scrollTop = 0;
9085		$('body').addClass('uncode-unmodal-open');
9086		UNCODE.isUnmodalOpen = true;
9087
9088		if ($('body').hasClass('qw-body-scroll-disabled')) {
9089			$('html').addClass('uncode-unmodal-body-disable-scroll');
9090		}
9091
9092		if ($('.unmodal').hasClass('auto-height')) {
9093			set_modal_height();
9094		}
9095	});
9096
9097	var set_modal_height = function() {
9098		var modal = $('.unmodal').css({height: 'auto'});
9099		var window_height = $(window).outerHeight();
9100		var modal_height = modal.outerHeight();
9101
9102		modal.css('height', 'auto');
9103
9104		if (modal_height > window_height) {
9105			modal.outerHeight(window_height);
9106		}
9107	}
9108
9109	if ($('.unmodal').hasClass('auto-height')) {
9110		var setCTA;
9111
9112		$(window).on('resize', function() {
9113			clearRequestTimeout(setCTA);
9114			setCTA = requestTimeout(function() {
9115				set_modal_height();
9116			}, 100);
9117		});
9118	}
9119};
9120
9121UNCODE.bgChanger = function() {
9122	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
9123		$bg_first = $('.vc_row[data-bg-remove]'),
9124		bg_remove = $bg_first.attr('data-bg-remove'),
9125		$first = $bg_changers.first(),
9126		$last = $bg_changers.last(),
9127		$bg_wrapper = $('#changer-back-color'),
9128		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
9129		setCTA, localH = UNCODE.wheight,
9130		isScrolling;
9131
9132	$bg_first.removeClass(bg_remove);
9133
9134	var bgChange = function($col, bgColor, skin, tmbskin){
9135		$bg_wrapper.attr( 'class', bgColor );
9136		var menuskin;
9137		if ( typeof skin !== 'undefined' ) {
9138			menuskin = skin.replace('style', 'menu')
9139		}
9140
9141		if ( $col.length ) {
9142			$('.uncol[data-skin-change]').each(function(){
9143				var $isoFooter = $('.isotope-footer', this);
9144				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
9145				if ( menuskin !== '' ) {
9146					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
9147				}
9148			});
9149
9150			$('.tmb[data-skin-change]').each(function(){
9151				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
9152			});
9153		}
9154	};
9155
9156	var $masthead = $('#masthead'),
9157		transDesktop,
9158		transMobile,
9159		changeSkin,
9160
9161	checkTransparencyAndChange = function( skin ){
9162		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
9163		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
9164		changeSkin = $masthead.hasClass('menu-change-skin');
9165
9166		if ( ! transDesktop && ! transMobile ) {
9167			return false;
9168		}
9169
9170		if ( ! changeSkin ) {
9171			return false;
9172		}
9173
9174		if ( skin === 'style-light' ){
9175			$masthead.removeClass('style-dark-override').addClass('style-light-override');
9176			return false;
9177		} else if ( skin === 'style-dark' ) {
9178			$masthead.removeClass('style-light-override').addClass('style-dark-override');
9179			return false;
9180		}
9181	};
9182
9183	var bg_waypoints = function(){
9184		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
9185
9186			$.each($bg_changers, function(index, row) {
9187
9188				var $row = $(row),
9189					$col = $('.uncol[data-skin-change]', $row).eq(0),
9190					skin,
9191					$tmbs,
9192					tmbskin,
9193					bgColor = $row.attr('data-bg-color');
9194
9195				if ( ! $row.is(':visible') ) {
9196					return false;
9197				}
9198
9199				if ( $col.length ) {
9200					skin = $col.attr('data-skin-change');
9201					$tmbs = $('.tmb[data-skin-change]', $row);
9202					tmbskin = skin.replace('style', 'tmb');
9203				}
9204
9205				if ( ! $row.hasClass('unscroll-horizontal') ) {
9206					$row.waypoint(function( dir ) {
9207						if ( dir === 'down' ) {
9208							bgChange($col, bgColor, skin, tmbskin);
9209							checkTransparencyAndChange(skin);
9210						} else {
9211							return;
9212						}
9213					}, {
9214						offset: '50%'
9215		  			});
9216
9217					$row.waypoint(function( dir ) {
9218						if ( dir === 'up' ) {
9219							bgChange($col, bgColor, skin, tmbskin);
9220							checkTransparencyAndChange(skin);
9221						} else {
9222							return;
9223						}
9224					}, {
9225						offset: function() {
9226							var clH = this.element.clientHeight,
9227								wH = window.innerHeight,
9228								ret = clH > 200 ? -100 : clH * -0.5;
9229							return ( wH / 2 ) - clH;
9230						}
9231					});
9232				}
9233
9234			});
9235
9236			$('body').addClass('bg-changer-init');
9237
9238		}
9239	};
9240
9241	var body = document.body,
9242	edges = false;
9243
9244	var throttle = function(fn, wait) {
9245		var time = Date.now();
9246		return function() {
9247			if ((time + wait - Date.now()) < 0) {
9248				fn();
9249				time = Date.now();
9250			}
9251		}
9252	}
9253
9254	var $wrapper = document.querySelector(".main-wrapper"),
9255		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
9256
9257	var $title = document.querySelector('#rotating');
9258	if ( $title !== null ) {
9259		$title.style.whiteSpace = 'nowrap';
9260		$title.style.transition = 'transform 200ms linear';
9261	}
9262
9263	window.addEventListener( 'scroll', throttle( function() {
9264		window.clearRequestTimeout( isScrolling );
9265
9266		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
9267
9268			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
9269				body = document.body,
9270				html = document.documentElement,
9271				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9272				$row = false,
9273				firstOff,
9274				lastOff;
9275
9276			if ( scrolled < 100 && $first.length ) {
9277				firstOff = $first.offset().top;
9278				if ( firstOff < 100 ) {
9279					var $row = $first;
9280				}
9281			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
9282				lastOff = $last.offset().top + $last.outerHeight();
9283				if ( lastOff > ( docH - 100 ) ) {
9284					var $row = $last;
9285				}
9286			}
9287
9288			if ( $row.length ) {
9289				var $col = $('.uncol[data-skin-change]', $row).eq(0),
9290					skin,
9291					$tmbs,
9292					tmbskin,
9293					bgColor = $row.attr('data-bg-color');
9294
9295				if ( $col.length ) {
9296					skin = $col.attr('data-skin-change');
9297					$tmbs = $('.tmb[data-skin-change]', $row);
9298					tmbskin = skin.replace('style', 'tmb');
9299				}
9300
9301				bgChange($col, bgColor, skin, tmbskin);
9302				checkTransparencyAndChange(skin);
9303				edges = true;
9304			}
9305
9306		}, 150);
9307
9308		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
9309			bg_waypoints();
9310			Waypoint.refreshAll();
9311			edges = false;
9312		}
9313
9314	}, 100), false);
9315
9316	$(window).on('resize', function() {
9317		clearRequestTimeout(setCTA);
9318		setCTA = requestTimeout(function() {
9319			if ( localH != UNCODE.wheight ) {
9320				localH = UNCODE.wheight;
9321				bg_waypoints();
9322				Waypoint.refreshAll();
9323			}
9324		}, 100);
9325	});
9326
9327	bg_waypoints();
9328
9329};
9330
9331UNCODE.skewIt = function() {
9332
9333	if ( $('body').hasClass('compose-mode') ) {
9334		return;
9335	}
9336
9337	var justscrolled = false;
9338
9339	var loadSkewIt = function(){
9340
9341		var $pageHeader = $('#page-header'),
9342			$page_body = $('.page-body'),
9343			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
9344
9345		if ( $header_skew.length ) {
9346			$pageHeader.addClass('uncode-skew').css({
9347				position: 'relative',
9348				zIndex: 1
9349			});
9350			$header_skew.removeClass('uncode-skew');
9351			$page_body.css({
9352				position: 'relative',
9353				zIndex: 0
9354			});
9355		}
9356
9357		var $skew = $('.uncode-skew'),
9358			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
9359			horizontal = $horizontal.length,
9360			stopSkewing,
9361			lastOffset = 0,
9362			lastDate = Date.now();
9363
9364		if ( ! $skew.length ) {
9365			return;
9366		}
9367
9368		var dropSkew = function(){
9369			if ( UNCODE.wwidth < UNCODE.mediaQuery )
9370				return;
9371
9372			$skew.each(function(){
9373				var $this = $(this),
9374					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9375
9376				if ( $drop.length ) {
9377					$this.css({
9378						'transform': 'skew(0)'
9379					});
9380					var bound = $this[0].getBoundingClientRect();
9381					$drop.css({
9382						left: bound.x * -1,
9383						top: bound.y * -1,
9384					});
9385				}
9386			});
9387		};
9388		dropSkew();
9389
9390		$(window).on('resize', dropSkew);
9391
9392		window.addEventListener( 'scroll', function() {
9393
9394			if ( justscrolled !== true ) {
9395				justscrolled = true;
9396				return;
9397			}
9398
9399			window.clearRequestTimeout( stopSkewing );
9400
9401			var now = Date.now(),
9402				delayInMs = now - lastDate,
9403				offset = window.pageYOffset || window.document.documentElement.scrollTop,
9404				newOffset = offset - lastOffset,
9405				speed = Math.pow((newOffset / delayInMs), 3) * -1,
9406				body = document.body,
9407				html = document.documentElement,
9408				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9409				wait = 50,
9410				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
9411
9412			if ((lastDate + wait - now) < 0) {
9413
9414				lastDate = now;
9415				lastOffset = offset;
9416
9417				if ( speed > 6 ) {
9418					speed = 6;
9419				} else if ( speed < -6 ) {
9420					speed = -6;
9421				}
9422
9423				if ( speed > 2 && offset < UNCODE.wheight ) {
9424					speed = 2;
9425				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
9426					speed = -2;
9427				}
9428
9429				var speedY = speed,
9430					speedX = speed * 1.25;
9431
9432				if ( horizontal ) {
9433					speedY = 0;
9434					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9435						speedX = 0;
9436						return;
9437					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
9438						speedX = 0;
9439						return;
9440					}
9441				} else {
9442					speedX = 0;
9443				}
9444
9445				if ( ! $skew.closest('.enter-st').length ) {
9446					speedX = 0;
9447				}
9448
9449				gsap.killTweensOf($skew);
9450				gsap.to( $skew, {
9451					duration: 0.2,
9452					skewY: (speedY * maxSpeed) + "deg",
9453					skewX: (speedX * maxSpeed) + "deg",
9454					ease: Power0.easeNone,
9455					transformOrigin: 'center',
9456				});
9457
9458			}
9459
9460			stopSkewing = requestTimeout(function() {
9461				gsap.killTweensOf($skew);
9462				gsap.to( $skew, {
9463					duration: 0.5,
9464					skewY: "0deg",
9465					skewX: "0deg",
9466					transformOrigin: 'center',
9467					ease: Expo.easeOut,
9468				});
9469
9470				$skew.each(function(){
9471					var $this = $(this),
9472						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9473
9474					if ( $drop.length ) {
9475						var bound = $this[0].getBoundingClientRect()
9476						$drop.css({
9477							left: bound.x * -1,
9478							top: bound.y * -1,
9479						});
9480					}
9481				});
9482
9483			}, 200);
9484
9485		}, false);
9486
9487	};
9488
9489	$(window).on('load', loadSkewIt);
9490
9491};
9492
9493UNCODE.rotateIt = function() {
9494
9495	if ( $('body').hasClass('compose-mode') ) {
9496		return;
9497	}
9498
9499	var frameRotate = false;
9500	var loadRotateIt = function(){
9501
9502		var $toRotate = $('.uncode-rotate');
9503
9504		$toRotate.each(function(){
9505			var $rotate = $(this),
9506				deg = 0,
9507				dir = true,
9508				coeff = 1,
9509				lastOffset = 0,
9510				lastDate = Date.now();
9511
9512			var checkScroll = function($rotate){
9513				// if ( ! $rotate.length ) {
9514				// 	return;
9515				// }
9516
9517				var now = Date.now(),
9518					delayInMs = now - lastDate,
9519					offset = window.pageYOffset || window.document.documentElement.scrollTop,
9520					newOffset = offset - lastOffset,
9521					speed = (newOffset / delayInMs) * 5,
9522					body = document.body,
9523					html = document.documentElement,
9524					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
9525
9526				lastDate = now;
9527				lastOffset = offset;
9528
9529				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
9530					deg = 0;
9531				}
9532
9533				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
9534					deg = parseFloat(deg) + parseFloat(speed);
9535				}
9536
9537				if ( $rotate.hasClass('uncode-rotate-hover') ) {
9538					$rotate.hover(function(){
9539						coeff = 1.75;
9540					}, function(){
9541						coeff = 1;
9542					});
9543				}
9544
9545				// if ( speed > 0 ) {
9546				// 	dir = true
9547				// } else if ( speed < 0 ) {
9548				// 	dir = false
9549				// }
9550
9551				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
9552					deg = deg+coeff;
9553					// if ( dir ) {
9554					// 	deg = deg+coeff;
9555					// } else {
9556					// 	deg = deg-coeff;
9557					// }
9558				}
9559
9560				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9561					return false;
9562				}
9563				
9564				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
9565					var undeg = deg*-1;
9566					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
9567				} else {
9568					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
9569				}
9570
9571				requestAnimationFrame(function() {
9572					if ( frameRotate === true ) {
9573						frameRotate = false;
9574						return;
9575					}
9576					checkScroll($rotate);
9577				});
9578			};
9579
9580			checkScroll($rotate);
9581
9582		});
9583
9584	};
9585
9586	$(window).on('load', loadRotateIt);
9587
9588	var checkRotate;
9589	var resizeRotate = function(){
9590		var $inlineRotates = $('.inline-rotate');
9591		$inlineRotates.each(function(){
9592			$(this).addClass('inline-rotate-standby');
9593		});
9594		clearTimeout(checkRotate);
9595		checkRotate = setTimeout(function(){
9596			$('.inline-rotate').each(function(){
9597				$(this).removeClass('inline-rotate-standby');
9598				frameRotate = true;
9599			});
9600			loadRotateIt();
9601		}, 500);
9602	};
9603
9604	$(window).off('resize.inline-rotate', resizeRotate)
9605	.on('resize.inline-rotate', resizeRotate);
9606
9607};
9608
9609var marqueeAttempts = 0,
9610	marqueeTO,
9611	marqueeCheckResize,
9612	initMarquee;
9613
9614UNCODE.textMarquee = function( $titles ) {
9615
9616	var isInitMarque = false;
9617
9618	var initTextMarquee = function( $titles ){
9619
9620		if ( typeof $titles == 'undefined' ) {
9621			$titles = $('.un-text-marquee');
9622		}
9623
9624		if ( ! $titles.length ) {
9625			return;
9626		}
9627
9628		isInitMarque = true;
9629
9630		var stableHeight = UNCODE.wheight;
9631
9632		$titles.each(function(){
9633			var $title = $(this),
9634				$span = $('> span, > i > span', $title),
9635				txt,
9636				first = true,
9637				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
9638				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
9639				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
9640				hasSticky = false,
9641				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
9642				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
9643				newW = UNCODE.wwidth,
9644				marqueeTL, inview;
9645
9646			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
9647				hasSticky = true;
9648				dataTrigger = 'row';
9649			}
9650
9651			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
9652				dataNavBar = dataNavBarMobile;
9653			}
9654
9655			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
9656			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
9657			var dataX = dataSpeed;
9658
9659			dataSpeed += 5;
9660
9661			$('.marquee-clone-wrap', $title).remove();
9662
9663			txt = $span.html();
9664
9665			if ( ! $('.marquee-original-core', $span).length ) {
9666				txt = $span.html();
9667				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
9668			} else {
9669				txt = $('.marquee-original-core', $span).html();
9670			}
9671
9672			var spanW,
9673				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
9674				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
9675				speed = 10 - dataSpeed;
9676
9677			$span.prepend($prepended);
9678			$span.append($appended);
9679
9680			var continuousTextMarquee = function () {
9681				var bound = $title
9682						.css({
9683							transform: "none",
9684							opacity: 0,
9685						})
9686						.offset(),
9687					ease = "none";
9688
9689				var xStrt =
9690						first || $title.hasClass("un-marquee-infinite")
9691							? 0
9692							: UNCODE.wwidth - bound.left,
9693					xEnd = $title.hasClass("un-marquee-infinite")
9694						? spanW
9695						: spanW + bound.left,
9696					xSpeed =
9697						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
9698						dataSpeed,
9699					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
9700					speedSlow = (xEnd + xStrt) / 45,
9701					transFormVal,
9702					translX;
9703
9704				marqueeTL = new TimelineMax({ paused: true, reversed: true });
9705				marqueeTL.play();
9706
9707				var inViewElement =
9708						dataTrigger === "row" ? ( hasSticky ? $title.closest('.sticky-trigger, .sticky-element').parent()[0] : $title.closest(".vc_row")[0] ) : $title[0],
9709					wayOff =
9710						dataTrigger === "row" && dataNavBar === "yes"
9711							? UNCODE.menuHeight
9712							: 0;
9713
9714				inview = new Waypoint.Inview({
9715					element: inViewElement,
9716					offset: wayOff,
9717					enter: function (direction) {
9718						marqueeTL.play();
9719					},
9720					exited: function (direction) {
9721						if (!$title.closest(".pin-spacer").length) {
9722							marqueeTL.pause();
9723						}
9724					},
9725				});
9726
9727				if ($title.hasClass("un-marquee-hover")) {
9728					var $column = $title.closest(".wpb_column"),
9729						$col_link = $(".col-link", $column),
9730						$hover_sel = $title;
9731
9732					if ($col_link.length) {
9733						$hover_sel = $title.add($column);
9734					}
9735					$hover_sel
9736						.on("mouseover", function () {
9737							ease = "power2.out";
9738							transFormVal = $title.css("transform").split(/[()]/)[1];
9739							translX = transFormVal.split(",")[4];
9740							speedSlow = (xEnd + (xStrt - translX)) / 45;
9741							marqueeTL.duration(speedSlow);
9742						})
9743						.on("mouseout", function () {
9744							ease = "power2.in";
9745							transFormVal = $title.css("transform").split(/[()]/)[1];
9746							translX = transFormVal.split(",")[4];
9747							speedSlow =
9748								((xEnd + (xStrt - translX)) /
9749									(dataSpeed * dataSpeed * dataSpeed) /
9750									5) *
9751								dataSpeed;
9752							marqueeTL.duration(speedSlow);
9753						});
9754				}
9755		
9756				gsap.killTweensOf($title);
9757				marqueeTL.fromTo( $title, {
9758					opacity: 1,
9759					x: xStrt * direction * -1
9760				},
9761				{
9762					duration: xSpeed,
9763					x: xEnd * direction,
9764					onComplete: function(){
9765						first = false;
9766						continuousTextMarquee();
9767					},
9768					onUpdate: function(){
9769						if ( ! $title[0].isConnected ) {
9770							marqueeTL.kill();
9771							initTextMarquee();
9772						}
9773					},
9774					ease: ease
9775				});
9776		
9777			};
9778			
9779			var runTextMarquee = function(){
9780				var time = Date.now();
9781
9782				var textMarqueeScroll = function(){
9783					var $row = $title.closest('.vc_row');
9784					if ( hasSticky ) {
9785						$row = $title.closest('.sticky-trigger, .sticky-element').parent();
9786					}					
9787					var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
9788
9789					if ( !$bound.length ) {
9790						return;
9791					}
9792
9793					var bound = $bound[0].getBoundingClientRect(),
9794						wait = 100,
9795						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
9796						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
9797
9798					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
9799						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
9800						marqueeAttempts < 2 ) {
9801
9802						clearRequestTimeout(marqueeTO);
9803
9804						marqueeTO = requestTimeout(function(){
9805							marqueeAttempts++;
9806							initTextMarquee();
9807						}, 100);
9808					}
9809
9810
9811					var bound_top = bound.top,
9812						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
9813
9814					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
9815						if ( dataTrigger === 'row-middle' ) {
9816							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5)
9817						}
9818						if ( dataNavBar === 'yes' ) {
9819							bound_top = bound_top - UNCODE.menuHeight;
9820						}
9821						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
9822					}
9823
9824					gsap.killTweensOf($title);
9825					gsap.to( $title, {
9826						duration: 0.24,
9827						x: gsap_calc,
9828					});
9829				};
9830
9831				textMarqueeScroll();
9832				$(window).on( 'load scroll', function(e) {
9833					textMarqueeScroll();
9834				});
9835
9836			};
9837
9838			var cloneSpan = function($_title, cntnt){
9839
9840				if ( $_title.hasClass('un-marquee-infinite') ) {
9841					$('> span.marquee-clone-wrap', $_title).text('');
9842				}
9843
9844				gsap.to( $_title, {
9845					duration: 0,
9846					x: 0
9847				});
9848				spanW = $span.outerWidth();
9849
9850				if ( !spanW ) {
9851					return;
9852				}
9853
9854				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
9855					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
9856
9857				if ( $_title.hasClass('un-marquee-infinite') ) {
9858
9859					for ( var i = 0; i < part; i++ ) {
9860						$prepended.append(cntnt + spaceSpan);
9861						$appended.append(cntnt + spaceSpan);
9862					}
9863				}
9864
9865				if ( $('body').hasClass('compose-mode') ) {
9866					$('.uncode_fe_safe').remove();
9867					return;
9868				}
9869
9870				if ( $title.closest('.marquee-freezed').length ) {
9871					return;
9872				}
9873
9874				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
9875					continuousTextMarquee();
9876				}
9877
9878				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
9879					runTextMarquee();
9880				}
9881
9882			};
9883
9884			var marqueeResize = function(e){
9885				clearRequestTimeout(marqueeCheckResize);
9886				marqueeCheckResize = requestTimeout(function(){
9887					if ( newW !== UNCODE.wwidth ) {
9888						gsap.killTweensOf($title);
9889						if ( typeof inview !== 'undefined' && inview !== null ) {
9890							inview.destroy();
9891						}
9892						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
9893							marqueeTL.kill();
9894						}
9895						first = true;
9896						initTextMarquee();
9897						newW = UNCODE.wwidth;
9898					}
9899				}, 1000);
9900			};
9901
9902			$(window).off('resize', marqueeResize)
9903			.on( 'resize', marqueeResize);
9904			$(window).off('uncode.re-layout', marqueeResize)
9905			.on( 'uncode.re-layout', marqueeResize);
9906
9907			cloneSpan($title, txt);
9908
9909			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9910				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
9911					var $_titles = $('.un-text-marquee',e.view.$el);
9912					clearRequestTimeout(marqueeCheckResize);
9913					marqueeCheckResize = requestTimeout(function(){
9914						initTextMarquee($_titles);
9915					}, 1000);
9916				});
9917			}
9918		});
9919
9920		$(window).on( 'load wwResize', function(e) {
9921			stableHeight = UNCODE.wheight;
9922		});
9923
9924	};
9925
9926	document.addEventListener("DOMContentLoaded", function() {
9927		if ( isInitMarque !== true ) {
9928			initTextMarquee();
9929		}
9930	});
9931
9932	$(window).on('focus load resize',function(){
9933		clearTimeout(initMarquee);
9934		initMarquee = setTimeout(function(){
9935			if ( isInitMarque !== true ) {
9936				initTextMarquee();
9937			}
9938		}, 500);
9939	});
9940	
9941	$(document).on('pumAfterOpen pumAfterClose', function(args){
9942		initTextMarquee();
9943	});
9944
9945};
9946	
9947UNCODE.parallax = function() {
9948	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
9949		if ($('.parallax-el').length > 0) {
9950			var parallax_elements = new Rellax('.parallax-el');
9951			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
9952			window.addEventListener('boxResized', function(e) {
9953				parallax_elements.refresh();
9954			}, false);
9955			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
9956				requestTimeout(function() {
9957					parallax_elements.refresh();
9958				}, 100);
9959			});
9960
9961			if ( typeof UNCODE.hDoc === 'undefined' ) {
9962				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
9963					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
9964			}
9965		
9966			function paralraf(time) {
9967				requestAnimationFrame(paralraf)
9968		
9969				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
9970					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
9971				
9972				if ( UNCODE.hDoc !== newHdoc ) {
9973					UNCODE.hDoc = newHdoc;
9974					parallax_elements.refresh();
9975				}
9976			}
9977		
9978			requestAnimationFrame(paralraf)
9979		
9980		}
9981	}
9982};
9983
9984UNCODE.magicCursor = function(){
9985	var $customCursor = $('#uncode-custom-cursor'),
9986		$customPilot = $('#uncode-custom-cursor-pilot'),
9987		$tooltip = $('.title-tooltip', $customCursor),
9988		$cursorSpan = $('> span', $tooltip),
9989		currentBg = false,
9990		fromTitle = false,
9991		setTime,
9992		mouseEvent;
9993
9994		var spanW, spanH,
9995		maxW = false;
9996
9997	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
9998		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
9999			$tooltip.css({opacity: 0});
10000			delayt_time += 400;
10001		}
10002		clearRequestTimeout(setTime);
10003		setTime = requestTimeout(function() {
10004
10005			$tooltip.css({opacity: ''});
10006
10007			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
10008
10009			if ( cursorTitle !== '' ) {
10010				if ( fromTitle && dataTitle === 'boing' ) {
10011					setTimeout(function(){
10012						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
10013					}, 5);
10014				}
10015				$cursorSpan.attr('class', fontClass).html( cursorTitle );
10016			} else {
10017				if ( cursorType !== 'auto' ) {
10018					$cursorSpan.html('');
10019				}
10020			}
10021
10022			$cursorSpan.addClass('in-tooltip');
10023
10024			$customCursor.attr('data-cursor', cursorType);
10025
10026			if ( fromTitle ) {
10027				$customCursor.addClass('from-tooltip-title');
10028			} else {
10029				$customCursor.removeClass('from-tooltip-title');
10030			}
10031
10032			if ( cursorBg !== false ) {
10033				$customCursor.attr('data-bg', 'transparent');
10034			} else {
10035				$customCursor.removeAttr('data-bg');
10036			}
10037
10038			currentBg = cursorBg;
10039
10040			if ( cursorTitle !== '' ) {
10041				fromTitle = true;
10042				$customCursor.attr('data-cursor', cursorType);
10043				$customCursor.attr('data-title', 'true');
10044				$cursorSpan.css({width: ''});
10045			} else {
10046				fromTitle = false;
10047				$customCursor.removeAttr('data-title');
10048			}
10049			spanW = $cursorSpan.outerWidth();
10050			
10051			if ( spanW >= maxW && maxW !== false ) {
10052				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
10053				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
10054					width: maxW
10055				});
10056				spanW = maxW;
10057			} else {
10058				$customCursor.find('> span:first-child').removeClass('max-width');
10059			}
10060			spanH = $cursorSpan.outerHeight();
10061			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
10062				$customCursor.find('> span:first-child').add($tooltip).css({
10063					width: spanW,
10064					height: spanH
10065				});
10066			} else {
10067				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
10068			}
10069			if ( $customPilot.length ) {
10070				$customPilot.attr('data-cursor', cursorType);
10071			}
10072		}, delayt_time);
10073	}
10074
10075	function changeCursor($wrap){
10076		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10077		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
10078			$href = $wrap.find(href),
10079			cursorType,
10080			cursorTitle = '',
10081			tooltip_class = '',
10082			cursorBg = false;
10083
10084		$wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) {
10085			var $this = $(this).addClass("cursor-init"),
10086				$tmb = $this.closest('.tmb'),
10087				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
10088				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
10089				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
10090				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
10091				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
10092				$title = $('.t-entry-title', $tmb),
10093				is_frontend_editor = $this.closest('.vc_controls').length,
10094				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
10095				$parent_cursor = $this.closest('[class*="custom-cursor"]');
10096
10097			if ( is_frontend_editor ) {
10098				cursorType = 'auto';
10099			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
10100				cursorType = data_cursor;
10101			} else if ( $parent_cursor.length ) {
10102				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
10103					cursorType = 'icon-light';
10104				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
10105					cursorType = 'icon-diff';
10106				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
10107					cursorType = 'icon-accent';
10108				} else {
10109					cursorType = 'icon-dark';
10110				}
10111			} else {
10112				cursorType = 'pointer';
10113			}
10114
10115			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
10116				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
10117					cursorTitle = custom_text;
10118				} else {
10119					cursorTitle = $title.clone();
10120					$('a', cursorTitle).replaceWith(function() {
10121						return this.childNodes;
10122					});
10123					$('*', cursorTitle).replaceWith(function(){
10124						return $(this).removeAttr('class');
10125					});
10126					cursorTitle = cursorTitle.html();
10127				}
10128			} else {
10129				cursorTitle = '';
10130			}
10131
10132			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
10133				tooltip_class = data_class;
10134			} else {
10135				tooltip_class = '';
10136			}
10137
10138			if ( cursor_bg == 'true' ) {
10139				cursorBg = true;
10140			} else {
10141				cursorBg = false;
10142			}
10143
10144			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
10145		}).on("mouseleave.cursor", href, function(e) {
10146			var outTime = 150;
10147			if ( currentBg !== false && cursorBg === false ) {
10148				outTime = 0;
10149			}
10150			delayChangeCursor('auto', '', false, outTime, false, '');
10151		});
10152
10153		$(window).on('disable-hover', function(event) {
10154			document.addEventListener("mousemove", function(e) {
10155				mouseEvent = e;
10156			});
10157			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
10158		});
10159
10160		$(window).on('enable-hover', function(event) {
10161			if ( typeof mouseEvent !== 'undefined' ) {
10162				var x = mouseEvent.clientX,
10163					y = mouseEvent.clientY;
10164
10165				var elements = document.elementsFromPoint(x, y),
10166					$element = $(elements[0]);
10167
10168				$element.closest(href).trigger('mouseenter');
10169			}
10170		});
10171
10172	}
10173
10174	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10175		changeCursor();
10176	});
10177
10178	$(document).ajaxComplete(function( event, xhr, settings ) {
10179		changeCursor();
10180	});
10181
10182	$('.isotope-container').on('isotope-layout-complete', function() {
10183		var $this = $(this);
10184		changeCursor($this);
10185	});
10186
10187};
10188
10189UNCODE.magneticCursor = function(){
10190	function magneticCursor($wrap){
10191		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10192		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'));
10193
10194		$magnetics.on('mousemove', function(e){
10195			var $this = $(this),
10196				$el,
10197				bound = e.currentTarget.getBoundingClientRect(),
10198				coeff = 30,
10199				hor = (bound.width / 2) - (e.clientX - bound.left),
10200				ver = (bound.height / 2) - (e.clientY - bound.top),
10201				toX = hor / bound.width * coeff,
10202				toY = ver / bound.height * coeff,
10203				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
10204				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
10205				toScale = Math.max(scaleX, scaleY);
10206
10207			if ( $this.hasClass('magnetic') ) {
10208				$el = $('.background-inner, .header-bg', $this);
10209			} else {
10210				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10211			}
10212
10213			gsap.killTweensOf($el);
10214			gsap.to( $el, {
10215				duration: 0.75,
10216				x: toX,
10217				y: toY,
10218				scale: toScale,
10219				ease: Power1.easeOut,
10220				transformPerspective: 900,
10221				transformOrigin: 'center',
10222				force3D: true
10223			});
10224		}).on('mouseout', function(e){
10225			var $this = $(this),
10226				$el
10227			if ( $this.hasClass('magnetic') ) {
10228				$el = $('.background-inner, .header-bg', $this);
10229			} else {
10230				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10231			}
10232			gsap.killTweensOf($el);
10233			gsap.to( $el, {
10234				duration: 0.6,
10235				y: 0,
10236				x: 0,
10237				scale: 1,
10238				ease: Power1.easeOut,
10239				transformPerspective: 900,
10240				transformOrigin: 'center',
10241				force3D: true
10242			});
10243		});
10244	};
10245
10246	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10247		magneticCursor();
10248	});
10249
10250	$(document).ajaxComplete(function( event, xhr, settings ) {
10251		magneticCursor();
10252	});
10253
10254	$('.isotope-container').on('isotope-layout-complete', function() {
10255		var $this = $(this);
10256		magneticCursor($this);
10257	});
10258
10259};
10260
10261UNCODE.dropImage = function() {
10262
10263	/****************************
10264	 * Image hover *
10265	****************************/
10266	function imageHover(){
10267		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10268			return;
10269		}
10270
10271		var $postLists = $('.uncode-post-titles');
10272		$postLists.each(function(){
10273			var $list = $(this),
10274				timing = parseFloat( $list.attr('data-timing') ),
10275				default_image = $list.hasClass('uncode-post-titles-default-image'),
10276				default_title = $list.hasClass('uncode-post-titles-default-title'),
10277				$tmbs = $('.tmb', $list),
10278				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
10279				clientX,
10280				clientY,
10281				$row_parent = $list.closest('.vc_row'),
10282				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
10283				$col_parent = $list.closest('.uncell'),
10284				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
10285				stoppedScrolling = true,
10286				setCTA;
10287
10288			timing *= 0.001;
10289
10290			var drop_bgs = function(){
10291				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
10292					var $drop = $(this),
10293						srcset = $drop.attr('data-bgset'),
10294						setArr = srcset.split(","),
10295						setArrOrder = [],
10296						biggest = 0,
10297						checkBg = false,
10298						desktopBG = $drop.data('[data-background-image]'),
10299						mobileBG = $drop.data('[data-mobile-background-image]');
10300
10301					if ( $drop.hasClass('srcset-bg-async') ) {
10302
10303						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
10304							return;
10305						}
10306						
10307					}
10308
10309					if ( SiteParameters.uncode_adaptive == true ) {
10310						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
10311							$drop.css({
10312								'background-image' : 'url(' + setArr[0] + ')'
10313							});
10314						}
10315					} else {
10316						for ( var i = 0; i < setArr.length; i++ ) {
10317							var setLoop = setArr[i].trim().split(" ");
10318							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
10319								var parseSet = parseFloat(setLoop[1]);
10320								if ( biggest < parseSet ) {
10321									biggest = parseSet;
10322								}
10323								setArrOrder[parseSet] = setLoop[0];
10324								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
10325									checkBg = true;
10326									$drop.css({
10327										'background-image' : 'url(' + setLoop[0] + ')'
10328									});
10329								}
10330							}
10331						}
10332
10333						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
10334							$drop.css({
10335								'background-image' : 'url(' + setArrOrder[biggest] + ')'
10336							});
10337						}
10338					}
10339
10340				});
10341			};
10342
10343			drop_bgs();
10344
10345			var dropMovesSize = function(){
10346				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
10347					return;
10348				}
10349				$drop_moves.each(function(){
10350					var $drop_move = $(this),
10351						dataW = $drop_move.attr('data-w'),
10352						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
10353					if ( typeof dataW !== 'undefined' && dataW !== null ) {
10354						dataW = screenInfo.width / 12 * parseFloat( dataW );
10355					}
10356					$drop_moves.css({
10357						width: dataW
10358					});
10359
10360					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10361						$anim_parent.on('animationend', function(){
10362							var bound = $anim_parent[0].getBoundingClientRect();
10363							$drop_move.css({
10364								left: bound.x * -1,
10365								top: bound.y * -1,
10366							});
10367						});
10368					}
10369				});
10370
10371
10372			};
10373
10374			dropMovesSize();
10375
10376			$(window).on( 'resize', function(){
10377				clearRequestTimeout(setCTA);
10378				setCTA = requestTimeout( function() {
10379					drop_bgs();
10380					dropMovesSize();
10381				}, 100 );
10382			});
10383
10384			if ( $drop_row_parents.length ) {
10385				$row_parent.addClass( 'drop-added' );
10386			}
10387
10388			$drop_row_parents.each(function(index, val){
10389				var $drop = $(val);
10390				$row_parent.prepend($drop);
10391				manageVideos($drop, false);
10392				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10393					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10394				}
10395				if ( default_image && index == 0 ) {
10396					manageVideos($drop, true);
10397					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10398						image_ph = new Image();
10399					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10400						image_ph.onload = function() {
10401							$drop.addClass('active');
10402							if ( default_title ) {
10403								$list.addClass('drop-hover');
10404								$tmbs.first().addClass('drop-active');
10405							}
10406						};
10407						image_ph.src = bg_img;
10408					}
10409				}
10410			});
10411
10412			if ( $drop_col_parents.length ) {
10413				$col_parent.addClass( 'drop-added' );
10414			}
10415
10416			$drop_col_parents.each(function(index, val){
10417				var $drop = $(this);
10418				$col_parent.prepend($drop);
10419				manageVideos($drop, false);
10420				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10421					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10422				}
10423				if ( default_image && index == 0 ) {
10424					manageVideos($drop, true);
10425					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10426						image_ph = new Image();
10427					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10428						image_ph.onload = function() {
10429							$drop.addClass('active');
10430							if ( default_title ) {
10431								$list.addClass('drop-hover');
10432								$tmbs.first().addClass('drop-active');
10433							}
10434						};
10435						image_ph.src = bg_img;
10436					}
10437				}
10438			});
10439
10440			function manageVideos( $el, start ) {
10441				var videoElem = $('video', $el),
10442					$iframe = $('iframe', $el),
10443					iframeID = $iframe.attr('id');
10444				if ( videoElem.length ) {
10445					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
10446						if ( start ) {
10447							videoElem[0].setCurrentTime(0);
10448							videoElem[0].play();
10449						} else {
10450							videoElem[0].pause();
10451							videoElem[0].setCurrentTime(0);
10452						}
10453					} else {
10454						if ( start ) {
10455							videoElem[0].currentTime = 0;
10456							videoElem[0].play();
10457						} else {
10458							videoElem[0].pause();
10459							videoElem[0].currentTime = 0;
10460						}
10461					}
10462				}
10463
10464				$el.data('active', start);
10465
10466				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
10467					var iframeIDv = iframeID.replace('okplayer-', ''),
10468						optionsV = $(window).data('okoptions-' + iframeIDv),
10469						vimeo = $iframe[0],
10470						playerV = new Vimeo.Player(vimeo),
10471						timeV = 0;
10472
10473					if (optionsV.time != null) {
10474						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
10475						for ( var i = 0; i < timeArr.length; i++ ) {
10476							if ( timeArr[i] === 'h' ) {
10477								timeV += parseFloat(timeArr[i-1]) * 3600;
10478							} else if ( timeArr[i] === 'm' ) {
10479								timeV += parseFloat(timeArr[i-1]) * 60;
10480							} else if ( timeArr[i] === 's' ) {
10481								timeV += parseFloat(timeArr[i-1]);
10482							}
10483						}
10484					}
10485					playerV.setCurrentTime(timeV);
10486					if ( start ) {
10487						playerV.setVolume(0);
10488						playerV.play();
10489					} else {
10490						playerV.pause();
10491					}
10492				} else if ( $el.attr('data-provider') === 'youtube' ) {
10493					if ( start ) {
10494						$el.trigger('uncode-resume');
10495					} else {
10496						$el.trigger('uncode-pause');
10497					}
10498				}
10499
10500			}
10501
10502			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
10503
10504				document.addEventListener("mousemove", function(e) {
10505					$drop_moves.each(function(){
10506						var $drop_move = $(this),
10507							duration = 0.4;
10508
10509						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
10510							duration = 0.8;
10511						}
10512
10513						clientX = e.clientX;
10514						clientY = e.clientY;
10515
10516						gsap.to( $drop_move, {
10517							duration: duration,
10518							x: clientX,
10519							y: clientY,
10520							ease: Power1.easeOut,
10521						});
10522					});
10523				});
10524
10525			} else {
10526
10527				$(window).on("touchend scroll", function(e) {
10528					$list.removeClass('drop-hover');
10529					$drop_moves.removeClass('active');
10530					$tmbs.removeClass('drop-active');
10531				});
10532
10533				$drop_moves.each(function(){
10534					var $drop_move = $(this),
10535						$tmb = $drop_move.closest('.tmb'),
10536						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
10537
10538					if ( $anim_parent.hasClass('uncode-skew') ) {
10539						$anim_parent.css({
10540							'transform': 'skew(0)'
10541						});
10542					}
10543
10544					$tmb.on('touchend', function(e){
10545						e.stopPropagation();
10546
10547						$drop_moves.removeClass('active');
10548						$tmbs.removeClass('drop-active');
10549
10550						$list.addClass('drop-hover');
10551						$tmb.addClass('drop-active');
10552						$drop_move.addClass('active');
10553						manageVideos($drop_move, true);
10554						clientX = e.changedTouches[0].clientX;
10555						clientY = e.changedTouches[0].clientY;
10556
10557						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10558							var bound = $anim_parent[0].getBoundingClientRect();
10559							clientX = clientX - bound.x;
10560							clientY = clientY - bound.y;
10561						}
10562
10563						$drop_move.css({
10564							left: clientX,
10565							top: clientY
10566						});
10567					});
10568				});
10569
10570			}
10571
10572			$tmbs.each(function(e){
10573				var $tmb = $(this),
10574					// $trgr = $('a', $tmb),
10575					$trgr = $tmb,
10576					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
10577					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
10577(.t-inside), .parallax-el'),
10578					$video = $('video', $tmb),
10579					$iframe = $('iframe', $tmb),
10580					$entryTxt = $('.t-entry-text', $tmb),
10581					stopBounding;
10582
10583				$entryTxt.add($drop_move).css({
10584					'transition-duration': timing + 's'
10585				});
10586
10587				if ( $video.length ) {
10588					var vidH = $video[0].videoHeight,
10589						vidW = $video[0].videoWidth;
10590					$video.css({
10591						'height': vidH,
10592						'width': vidW
10593					});
10594				}
10595
10596				if ( $iframe.length ) {
10597					var vidH = $drop_move.attr('data-height'),
10598						vidW = $drop_move.attr('data-width');
10599					$iframe.css({
10600						'height': vidH,
10601						'width': vidW
10602					});
10603				}
10604
10605				$iframe.each(function(){
10606					var $video = $(this),
10607						vidH = $video[0].videoHeight,
10608						vidW = $video[0].videoWidth;
10609					$video.css({
10610						'height': vidH,
10611						'width': vidW
10612					});
10613				});
10614
10615				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10616					$trgr.on('mouseenter',function(e){
10617
10618						$list.addClass('drop-hover');
10619						$tmbs.removeClass('drop-active');
10620						$tmb.addClass('drop-active');
10621						$drop_move.addClass('active');
10622						manageVideos($drop_move, true);
10623
10624						var clientX = e.clientX,
10625							clientY = e.clientY;
10626						$drop_move.css({
10627							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
10628						});
10629
10630					})
10631					.on('mouseleave', function(e){
10632						$list.removeClass('drop-hover');
10633						$drop_move.css({
10634							'transition-duration': ( timing*1.25 ) + 's'
10635						});
10636						$drop_move.removeClass('active');
10637						$tmb.removeClass('drop-active');
10638						$drop_move.on('transitionend', function(e){
10639							$drop_move.off('transitionend');
10640							$drop_move.css({
10641								'transition-duration': timing + 's'
10642							});
10643							manageVideos($drop_move,false);
10644						});
10645					});
10646
10647					document.addEventListener('visibilitychange', function(){
10648						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
10649							$drop_move.css({
10650								'transition-duration': '0s'
10651							});
10652							$drop_move.removeClass('active');
10653							manageVideos($drop_move, false);
10654						}
10655					});
10656
10657					document.addEventListener('scroll', function(){
10658						window.clearRequestTimeout( stopBounding );
10659						if ( stoppedScrolling ) {
10660							stoppedScrolling = false;
10661							if ( $drop_move.hasClass('active') ) {
10662								$list.removeClass('drop-hover');
10663								$tmbs.removeClass('drop-active');
10664								$drop_move.removeClass('active');
10665								$drop_move.on('transitionend', function(e){
10666									$drop_move.off('transitionend');
10667									$drop_move.css({
10668										'transition-duration': timing + 's'
10669									});
10670									manageVideos($drop_move,false);
10671								});
10672							}
10673						}
10674
10675						stopBounding = requestTimeout(function() {
10676							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10677								var bound = $anim_parent[0].getBoundingClientRect();
10678								$drop_move.css({
10679									left: bound.x * -1,
10680									top: bound.y * -1,
10681								});
10682							}
10683							stoppedScrolling = true;
10684						}, 500);
10685					});
10686				}
10687
10688				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
10689					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
10690
10691				$drop.css({
10692					'transition-duration': timing + 's'
10693				});
10694
10695				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
10696					$trgr.on('mouseenter',function(e){
10697						$row_parent.add($col_parent).addClass('drop-list-loaded');
10698						$list.addClass('drop-hover');
10699
10700						if ( !$tmb.hasClass('drop-active') ) {
10701							$tmbs.removeClass('drop-active');
10702							$tmb.addClass('drop-active');
10703							if ( default_image && !$drop.hasClass('active') ) {
10704								var $prev = $('[data-drop].active', $row_parent);
10705								$prev.css({
10706									'transition-duration': (timing*1.5) + 's'
10707								});
10708								$prev.removeClass('active');
10709								$prev.on('transitionend', function(e){
10710									$prev.off('transitionend');
10711									manageVideos($prev,false);
10712								});
10713							}
10714							$drop.css({
10715								'transition-duration': timing + 's'
10716							});
10717							$drop.off('transitionend');
10718							$drop.addClass('active');
10719							manageVideos($drop, true);
10720						}
10721					})
10722					.on('mouseleave', function(e){
10723						if ( ( default_image && !default_title ) || !default_image ) {
10724							$list.removeClass('drop-hover');
10725							$tmb.removeClass('drop-active');
10726						}
10727						if ( ! default_image ) {
10728							$drop.css({
10729								'transition-duration': (timing*1.5) + 's'
10730							});
10731							$drop.removeClass('active');
10732
10733							$drop.on('transitionend', function(e){
10734								$drop.off('transitionend');
10735								manageVideos($drop,false);
10736							});
10737						}
10738					});
10739
10740					document.addEventListener('visibilitychange', function(){
10741						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
10742							$drop.css({
10743								'transition-duration': '0s'
10744							});
10745							$drop.removeClass('active');
10746							manageVideos($drop, false);
10747						}
10748					});
10749				}
10750			});
10751
10752		});
10753	};
10754
10755	$(window).on('load', function(event) {
10756		imageHover();
10757	});
10758
10759	var drop_wp_animation = function() {
10760		var $postLists = $('.uncode-post-titles');
10761		$postLists.each(function(){
10762			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10763				new Waypoint({
10764					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10765					element: val,
10766					handler: function() {
10767						var element = $(this.element),
10768							parent = element.closest('.tmb'),
10769							currentIndex = parent.index(),
10770							delay = currentIndex,
10771							delayAttr = parseInt(element.attr('data-delay'));
10772						if (isNaN(delayAttr)) delayAttr = 100;
10773						var objTimeout = requestTimeout(function() {
10774							element.addClass('start_animation');
10775
10776							var nextTimeout = requestTimeout(function() {
10777								$('.drop-image-separator', parent).addClass('start_animation');
10778							}, 50);
10779
10780						}, delay * delayAttr);
10781						if (!UNCODE.isUnmodalOpen) {
10782							this.destroy();
10783						}
10784					},
10785					offset: UNCODE.isFullPage ? '100%' : '90%'
10786				})
10787			});
10788		});
10789	}
10790
10791	var runWaypoints_TO,
10792		runWaypoints_delay = 0;
10793
10794	var runWaypoints = function(){
10795		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10796			runWaypoints_delay = 400;
10797		}
10798		clearRequestTimeout(runWaypoints_TO);
10799		runWaypoints_TO = requestTimeout(function() {
10800			drop_wp_animation();
10801		}, runWaypoints_delay);
10802	};
10803	runWaypoints();
10804	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10805	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10806		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10807			// imageHover();
10808			runWaypoints();
10809		});
10810	}
10811};
10812
10813UNCODE.postTable = function() {
10814
10815	var clickRow = function(){
10816		var $postLists = $('.uncode-post-table');
10817
10818		$postLists.each(function(){
10819			var $postList = $(this),
10820				$tmbClicks = $('.tmb.tmb-click-row', $postList);
10821
10822			$tmbClicks.each(function(){
10823				var $tmb = $(this),
10824					$click = $('.table-click-row', $tmb);
10825				$('*:not(.table-click-row)', $tmb).on('click', function(e){
10826					e.preventDefault();
10827					e.stopPropagation();
10828					$click[0].click();
10829					return false;
10830				});
10831			});
10832
10833		})
10834	};
10835
10836	clickRow();
10837
10838	var hoverRow = function(){
10839		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
10840
10841		$postLists.on('mouseenter', function(){
10842			$(this).addClass('post-table-hover');
10843		});
10844		$postLists.on('mouseleave', function(){
10845			$(this).removeClass('post-table-hover');
10846		});
10847	}
10848
10849	hoverRow();
10850
10851	var drop_wp_animation = function() {
10852		var $postLists = $('.uncode-post-table');
10853		$postLists.each(function(){
10854			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10855				new Waypoint({
10856					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10857					element: val,
10858					handler: function() {
10859						var element = $(this.element),
10860							parent = element.closest('.tmb'),
10861							currentIndex = parent.index(),
10862							delay = currentIndex,
10863							delayAttr = parseInt(element.attr('data-delay'));
10864						if (isNaN(delayAttr)) delayAttr = 100;
10865						var objTimeout = requestTimeout(function() {
10866							element.addClass('start_animation');
10867						}, delay * delayAttr);
10868						if (!UNCODE.isUnmodalOpen) {
10869							this.destroy();
10870						}
10871					},
10872					offset: UNCODE.isFullPage ? '100%' : '90%'
10873				})
10874			});
10875		});
10876	}
10877
10878	var runWaypoints_TO,
10879		runWaypoints_delay = 0;
10880
10881	var runWaypoints = function(){
10882		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10883			runWaypoints_delay = 400;
10884		}
10885		clearRequestTimeout(runWaypoints_TO);
10886		runWaypoints_TO = requestTimeout(function() {
10887			drop_wp_animation();
10888		}, runWaypoints_delay);
10889	};
10890	runWaypoints();
10891	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10892	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10893		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10894			runWaypoints();
10895			// clickRow();
10896		});
10897	}
10898};
10899
10900UNCODE.rotatingTxt = function($ctxt) {
10901
10902	if ( $('body').hasClass('compose-mode') ) {
10903		return;
10904	}
10905
10906	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
10907	var setCTA;
10908
10909	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
10910		var $heading = $(this),
10911			// debug = 0,
10912			cycle = 0,
10913			$trgt,
10914			$toMove,
10915			$highl,
10916			$col = $heading.closest('.uncont'),
10917			txt,
10918			arrTxt,
10919			textFadeIn, textFadeOut,
10920			removeWraps;
10921
10922		var defineObjs = function() {
10923			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
10924				var $rtx = $(this),
10925					fx = $rtx.attr('data-fx'),
10926					wait = $rtx.attr('data-wait'),
10927					$prev = $(this).prev().addClass('prev-rotating-start'),
10928					splitToMove = [],
10929					splitArray = [],
10930					lineArray = [],
10931					lineIndex = 0,
10932					lineStart = true,
10933					lineEnd = false,
10934					startSplit = false,
10935					$line_wrap = $rtx.closest('.heading-line-wrap'),
10936					same_line = true,
10937					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
10938					indexRtx = $splits.index($rtx);
10939
10940				fx = typeof fx === 'undefined' ? '' : fx;
10941				wait = typeof wait === 'undefined' ? '' : wait;
10942
10943				$splits.each(function(key, val){
10944					var $split = $(this),
10945						$new_line_wrap = $split.closest('.heading-line-wrap');
10946
10947					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
10948						splitArray.push( $split );
10949					}
10950
10951					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10952						startSplit = false;
10953					}
10954
10955					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10956						splitArray.push( $split );
10957
10958						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
10959							same_line = true;
10960						} else {
10961							same_line = false;
10962						}
10963					}
10964
10965					if ( key == indexRtx ) {
10966						if ( /\S/.test($split.text()) ) {
10967							startSplit = true;
10968							$line_wrap = $split.closest('.heading-line-wrap');
10969							splitArray.push( $split );
10970						} else {
10971							indexRtx++;
10972						}
10973					}
10974
10975					$line_wrap = $new_line_wrap;
10976				});
10977
10978				$toMove = $($.map(splitToMove, function(el){return el.get();}));
10979				$trgt = $($.map(splitArray, function(el){return el.get();}));
10980
10981				if ( same_line ) {
10982					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
10983					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
10984				}
10985
10986				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
10987					$prev.addClass('empty-span-hidden');
10988				}
10989
10990				$highl = $('.heading-text-highlight-inner', $trgt);
10991
10992				$rtx.attr('data-animated', 'true');
10993				if ( cycle == 0 ) {
10994					$( document.body ).trigger('defer-highlights');
10995					cycle++;
10996					defineObjs();
10997					return;
10998				}
10999				cycle++;
11000
11001				txt = $rtx.attr('data-text');
11002				arrTxt = txt.split("|");
11003
11004				textFadeOut($trgt);
11005
11006			});
11007		};
11008
11009		removeWraps = function(){
11010
11011			// if ( debug == 1 ) return;
11012			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
11013			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
11014
11015
11016				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
11017					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
11018
11019				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
11020
11021				$splitFlow.each(function(){
11022					$(this).append($temp_highl);
11023				});
11024
11025				var $line_wrap = $wraps[wrap_k];
11026				var $parent_wrap = $line_wrap.parentNode;
11027				if ( $parent_wrap !== null ) {
11028					while ( $line_wrap.firstChild ) {
11029						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
11030					}
11031					$parent_wrap.removeChild($line_wrap);
11032				}
11033			}
11034			// debug++;
11035			defineObjs();
11036		};
11037
11038		var loop = 0;
11039		textFadeIn = function($trgt){
11040			var word = arrTxt[loop].split(" "),
11041				worsSpan = '',
11042				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11043				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11044				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
11045
11046			for (var w = 0; w < word.length; w++) {
11047				var highl;
11048				if ( $highl.length ) {
11049					highl = $highl[0].outerHTML;
11050				} else {
11051					highl = '';
11052				}
11053
11054				if ( w > 0 ) {
11055					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
11056				}
11057				var charachters = word[w].split('');
11058				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
11059				if ( ! SiteParameters.uncode_has_ligatures ) {
11060					for (var c = 0; c < charachters.length; c++) {
11061						worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
11062					}
11063				} else {
11064					worsSpan += word[w];
11065				}
11066				worsSpan += '</span>' + highl + '</span></span>';
11067			}
11068
11069			if ( $wrap.length && $wrap_inner.length ) {
11070				var words_w = $wrap_inner.outerWidth();
11071				$wrap.css({
11072					width: words_w
11073				});
11074
11075				$highl = $('.heading-text-highlight-inner', $wrap);
11076				$highl.prependTo($wrap);
11077
11078				$wrap_inner.css({
11079					opacity: 0
11080				});
11081
11082				$wrap_inner.html(worsSpan);
11083				$('.heading-text-highlight-inner', $wrap_inner).remove();
11084				words_w = $wrap_inner.innerWidth();
11085
11086				var duration = 0.45;
11087
11088				$heading.removeClass('auto-width');
11089				if ( words_w > $col.width() ) {
11090					$heading.addClass('auto-width');
11091					words_w = 'auto';
11092					duration = 0;
11093				}
11094
11095				$wrap.css({
11096					'width': words_w,
11097					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
11098				});
11099
11100				var $word_inner = $('.split-word-inner', $wrap_inner),
11101					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
11102
11103				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11104
11105				if ( !$target_fx.length ) {
11106					return;
11107				}
11108
11109				gsap.killTweensOf($target_fx);
11110
11111				if ( fx !== 'zoom' ) {
11112					gsap.fromTo( $target_fx, {
11113						y: fx === 'opacity' ? '0%' : '-10%'
11114					},{
11115						delay: duration,
11116						duration: 0.25,
11117						y: '0%',
11118						ease: Circ.easeOut,
11119					});
11120
11121					if ( !$wrap_inner.length ) {
11122						return;
11123					}
11124
11125					gsap.fromTo( $wrap_inner, {
11126						opacity: 0,
11127					},{
11128						delay: duration,
11129						duration: 0.25,
11130						opacity: 1,
11131						ease: Circ.easeOut,
11132						onComplete: function(){
11133							$('> .heading-text-highlight-inner', $wrap).remove();
11134							$wrap_inner.html(worsSpan);
11135							removeWraps();
11136						}
11137					})
11138
11139				} else {
11140					gsap.fromTo( $target_fx, {
11141						transformOrigin: '50%',
11142						opacity: 0,
11143						scale: 0.875,
11144					},{
11145						opacity: 1,
11146						delay: duration,
11147						duration: 0.25,
11148						scale: 1,
11149						ease: Circ.easeOut,
11150						onComplete: function(){
11151							$('> .heading-text-highlight-inner', $wrap).remove();
11152							$wrap_inner.html(worsSpan);
11153							removeWraps();
11154						}
11155					});
11156				}
11157
11158			} else {
11159
11160				if ( !$wrap_inner.length ) {
11161					return;
11162				}
11163
11164				gsap.to( $wrap_inner, {
11165					duration: 0.4,
11166					opacity: 0,
11167					ease: Power1.easeOut,
11168					onComplete: function(){
11169						$wrap_inner.html(worsSpan);
11170						words_w = $wrap_inner.innerWidth();
11171
11172						gsap.to( $wrap_inner, {
11173							duration: 0.2,
11174							opacity: 1,
11175							ease: Power1.easeOut,
11176							onComplete: function(){
11177								$('> .heading-text-highlight-inner', $wrap).remove();
11178								$wrap_inner.html(worsSpan);
11179								removeWraps();
11180							}
11181						})
11182					}
11183				});
11184			}
11185
11186			if ( loop < arrTxt.length-1 ) {
11187				loop++;
11188			} else {
11189				loop = 0;
11190			}
11191
11192		};
11193
11194		textFadeOut = function($trgt){
11195			var $word_inner = $('.split-word-inner', $trgt),
11196				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11197				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11198				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
11199				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
11200
11201			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
11202
11203			var gsap_param = {
11204					delay: wait,
11205					duration: 0.25,
11206					y: fx === '' ? '10%' : '0%',
11207					opacity: 0,
11208					ease: Circ.easeOut,
11209					onStart: function(){
11210						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
11211							$highl = $('.heading-text-highlight-inner', $wrap);
11212							$highl.prependTo($wrap);
11213						}
11214					},
11215					onComplete: textFadeIn,
11216					onCompleteParams: [$trgt]
11217				};
11218
11219			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11220
11221			if ( fx === '' ) {
11222				gsap_param.y = '10%';
11223			} else if ( fx === 'zoom' ) {
11224				gsap_param.scale = '1.045';
11225			}
11226
11227			if ( !$target_fx.length ) {
11228				return;
11229			}
11230
11231			if ( $heading.data('waypoint') !== true ) {
11232				var textInView = new Waypoint.Inview({
11233					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11234					element: $heading[0],
11235					enter: function(direction) {
11236						$heading.data('waypoint',true);
11237						gsap.fromTo( $target_fx, {
11238							transformOrigin: '50%'
11239						}, gsap_param );
11240					}
11241				});
11242			} else {
11243				gsap.fromTo( $target_fx, {
11244					transformOrigin: '50%'
11245				}, gsap_param );
11246			}
11247		};
11248
11249		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11250			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
11251				var $el = model.view.$el,
11252					shortcode = model.attributes.shortcode;
11253
11254				UNCODE.rotatingTxt($el);
11255			});
11256		} else {
11257			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
11258				$heading.on('already-animated', function(){
11259					removeWraps();
11260					window.addEventListener('removeOldLines', function(){
11261						clearRequestTimeout(setCTA);
11262						setCTA = requestTimeout( removeWraps, 150 );
11263					});
11264				});
11265			} else {
11266				$(window).on('load', function(){
11267					removeWraps();
11268					window.addEventListener('removeOldLines', function(){
11269						clearRequestTimeout(setCTA);
11270						setCTA = requestTimeout( removeWraps, 150 );
11271					});
11272				});
11273			}
11274		}
11275	});
11276
11277};
11278
11279UNCODE.verticalText = function() {
11280	$(window).on('menuCanvasOpen', function(){
11281		$('.vertical-text--fixed').fadeOut(500);
11282		$('.horizontal-text--fixed').fadeOut(500);
11283	}).on('menuCanvasClose', function(){
11284		$('.vertical-text--fixed').fadeIn(500);
11285		$('.horizontal-text--fixed').fadeIn(500);
11286	});
11287
11288	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
11289	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
11290	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
11291	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
11292
11293	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
11294		window.addEventListener('scroll', function(e) {
11295			var totalPageHeight = document.body.scrollHeight;
11296			var scrollPoint = window.scrollY + window.innerHeight;
11297
11298			if (window.scrollY > 0) {
11299				showOnTopVerticalTexts.fadeOut();
11300				showOnTopHorizontalTexts.fadeOut();
11301			} else {
11302				showOnTopVerticalTexts.fadeIn();
11303				showOnTopHorizontalTexts.fadeIn();
11304			}
11305
11306			if (scrollPoint >= totalPageHeight) {
11307				hideOnBottomVerticalTexts.fadeOut();
11308				hideOnBottomHorizontalTexts.fadeOut();
11309			} else {
11310				hideOnBottomVerticalTexts.fadeIn();
11311				hideOnBottomHorizontalTexts.fadeIn();
11312			}
11313		}, false);
11314	}
11315};
11316
11317UNCODE.stickyScroll = function( $el ) {
11318	if ( typeof $el === 'undefined' || $el === null ) {
11319		$el = $('body');
11320	}
11321	var checkVisible = function( el, dir ) {
11322		if (typeof jQuery === "function" && el instanceof jQuery) {
11323			el = el[0];
11324		}
11325
11326		var off = 50;
11327		dir = typeof dir=='undefined' ? 'right' : dir;
11328		var rect = el.getBoundingClientRect();
11329
11330		return (
11331			(
11332				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11333				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11334				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
11335			) &&
11336			(
11337				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11338				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11339				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
11340				( rect.right <= window.innerWidth && rect.left >= 0 )
11341			)
11342		);
11343	};
11344
11345	var setItemsRelHeight = function(reset) {
11346		var $_el = $el;
11347		if ( $el.is('.index-scroll') ) {
11348			var $_el = $el.closest('.uncont');
11349		}
11350		$('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
11351			$.each($('.tmb', item), function(index, val) {
11352				if ( reset === true ) {
11353					$(val).css( 'visibility', 'hidden' );
11354				} else {
11355					$(val).css( 'visibility', 'visible' );
11356				}
11357			});
11358		});
11359		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
11360			$.each($('.tmb', item), function(index, val) {
11361				if ( reset === true ) {
11362					$(val).css( 'visibility', 'hidden' );
11363					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
11364				} else {
11365					var $rowParent = $(item).closest('.row-parent'),
11366						rowRatio = $rowParent.attr('data-height-ratio'),
11367						$rowInner = $(item).closest('.row-child'),
11368						rowRatioInner = $rowInner.attr('data-height'),
11369						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11370						$colContainer = $(item).closest('.uncell'),
11371						$uncont = $(item).closest('.uncont'),
11372						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
11373						safe_heigth = $(item).data('safe-height'),
11374						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
11375						offSet = $(item).offset().top - $uncont.offset().top,
11376						multiplier_h,
11377						data_viewport_h,
11378						body_border = $('.body-borders .top-border').outerHeight() * 2,
11379						remove_menu = $(item).data('vp-menu');
11380
11381					if ( rowRatio === 'full' || rowRatio === '' ) {
11382						rowRatio = 1;
11383					} else {
11384						rowRatio = rowRatio / 100;
11385					}
11386
11387					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
11388						rowRatio = rowRatio;
11389					} else {
11390						rowRatio = rowRatio * rowRatioInner / 100;
11391					}
11392
11393					winHeight = winHeight * rowRatio;
11394
11395					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11396						multiplier_h = parseInt($(item).attr('data-vp-height'));
11397					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
11398						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
11399					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
11400						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
11401					}
11402
11403					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
11404						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
11405						if ( remove_menu === true ) {
11406							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
11407						}
11408						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
11409					} else {
11410						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
11411					}
11412
11413				}
11414			});
11415		});
11416		$('.index-scroll', $_el).each(function(i, item){
11417			var $uncoltable = $(item).closest('.uncoltable'),
11418				$rowParent = $(item).closest('.row-parent'),
11419				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11420				body_border = $('.body-borders .top-border').outerHeight() * 2,
11421				$index_row = $('.index-row', item),
11422				safe_heigth = $index_row.data('safe-height'),
11423				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
11424			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
11425				var data_viewport_h = winHeight - ( paddingRow + body_border );
11426				$uncoltable.css({
11427					'min-height': data_viewport_h
11428				});
11429			} else {
11430				$uncoltable.css({
11431					'min-height': 'auto'
11432				});
11433			}
11434		});
11435
11436	}
11437	setItemsRelHeight();
11438
11439	var $index_scrolls = $('.index-scroll', $el);
11440
11441	$index_scrolls.each(function(key, value){
11442		var $index = $(this),
11443			$parent_row = $index.closest('.vc_row[data-parent]'),
11444			$index_row = $('.index-row', $index),
11445			dir = $index_row.attr('data-direction');
11446		dir = typeof dir === 'undefined' ? 'right' : dir;
11447
11448		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
11449	});
11450
11451	var $horScrolls = $('.unscroll-horizontal', $el);
11452
11453	if ( $horScrolls.length ) {
11454
11455		$('body').addClass('scrolling-trigger');
11456
11457		$horScrolls.each(function(key, value){
11458			var $section = $(this),
11459				$index_scroll = $('.index-scroll', $section),
11460				$index_row = $('.index-row', $index_scroll),
11461				dir = $section.attr('data-direction'),
11462				wrap = $index_row.attr('data-wrap'),
11463				$pinWrap,
11464				$pinTrigger;
11465
11466			dir = typeof dir === 'undefined' ? 'right' : dir;
11467			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
11468			$pinWrap = $('<div class="pin-wrap" />');
11469			if ( SiteParameters.is_frontend_editor ) {
11470				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
11471				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
11472			} else {
11473				if ( wrap === 'column' ) {
11474					$index_scroll.wrapInner( $pinWrap );
11475				} else {
11476					$('> .row', $section).wrap( $pinWrap );
11477				}
11478				$section.wrapInner( $pinTrigger );
11479			}
11480
11481		});
11482
11483		var $pinWraps = $('.pin-wrap', $el);
11484
11485		var horScrollSizes = function(){
11486
11487			$pinWraps.each(function(key, val){
11488				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
11489					$pinTrigger = $pinWrap.closest('.pin-trigger'),
11490					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
11491					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
11492					$boxContainer = $('.box-container'),
11493					box_m = $boxContainer.css('margin-left'),
11494					st_active = true;
11495
11496				var setHorW,
11497				horWidth = function(){
11498					$index_scroll.each(function(){
11499						var $this = $(this),
11500							$index_row = $('.index-row', $this),
11501							$rowContainer = $index_row.closest('.vc_row'),
11502							$rowInner = $index_row.closest('.wpb_row'),
11503							$rowParent = $index_row.closest('.row-parent'),
11504							$tmbs = $('.tmb', $index_row),
11505							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
11506							$uncont = $index_row.closest('.uncont'),
11507							$parent_col = $index_row.closest('.wpb_column'),
11508							col_w = $uncont.width(),
11509							data_lg = parseFloat( $index_row.attr('data-lg') ),
11510							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
11511							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
11512							tmb_w;
11513
11514						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
11515						tmb_w = ( col_w + padding_tmb ) / data_lg;
11516
11517						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
11518							tmb_w = ( col_w + padding_tmb ) / data_sm;
11519						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
11520							tmb_w = ( col_w + padding_tmb ) / data_md;
11521						}
11522
11523						if ( !isNaN(tmb_w) ) {
11524							$tmbs.css({
11525								'width': tmb_w
11526							});
11527						}
11528
11529						$tmbs.css({
11530							'visibility': 'visible'
11531						});
11532
11533					});
11534				};
11535
11536				horWidth();
11537				clearRequestTimeout(setHorW);
11538				setHorW = requestTimeout( function(){
11539					setItemsRelHeight();
11540					horWidth();
11541				}, 100 );
11542
11543				if ( SiteParameters.is_frontend_editor ) {
11544					return;
11545				}
11546
11547				var $vmenu = $('body.vmenu .vmenu-container'),
11548					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
11549					winWidth = window.innerWidth - vmenuW,
11550					$tmb = $('.tmb', $index_scroll).eq(0),
11551					paddingRight = parseFloat( $tmb.css('padding-right') ),
11552					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ),
11553					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
11554					scroll_anim;
11555
11556				if ( $('body').hasClass('rtl') ) {
11557					if ( dir === 'left' ) {
11558						scroll_anim = gsap.fromTo( $pinWrap, {
11559							x: stickyScrollLength
11560						},{
11561							x: 0,
11562							ease: "none"
11563						});
11564					} else {
11565						scroll_anim = gsap.fromTo( $pinWrap, {
11566							x: 0
11567						},{
11568							x: stickyScrollLength,
11569							ease: "none"
11570						});
11571					}
11572				} else {
11573					if ( dir === 'left' ) {
11574						scroll_anim = gsap.fromTo( $pinWrap, {
11575							x: -stickyScrollLength
11576						},{
11577							x: 0,
11578							ease: "none"
11579						});
11580					} else {
11581						scroll_anim = gsap.fromTo( $pinWrap, {
11582							x: 0
11583						},{
11584							x: -stickyScrollLength,
11585							ease: "none"
11586						});
11587					}
11588				}
11589
11590				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
11591					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
11592				}
11593
11594				var animationIncrease;
11595
11596				var checkForAnimations = function(){
11597					animationIncrease = 0
11598					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11599						var _this = this;
11600						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
11601							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11602							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11603							requestTimeout(function() {
11604								$(_this).addClass('start_animation');
11605							}, delayAttr + animationIncrease);
11606							animationIncrease += 150;
11607						}
11608					});
11609
11610					var batchTime = 0;
11611
11612					var resetBatch = function(){
11613						batchTime = 0;
11614					}
11615
11616					if (ScrollTrigger.isScrolling()) {
11617						resetBatch();
11618					}
11619					
11620					$('.tmb-mask-reveal', $pinTrigger).each(function(){
11621						var _this = this,
11622							$this = $(_this),
11623							$inside = $('.t-inside', $this),
11624							delay = parseFloat( $inside.attr('data-delay') ),
11625							speed = parseFloat( $inside.attr('data-speed') ),
11626							easing = $inside.attr('data-easing'),
11627							bgDelay = parseFloat( $inside.attr('data-bg-delay') );
11628
11629						delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
11630						speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
11631						easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
11632						bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
11633
11634						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) {
11635							$this.addClass('tmb-mask-init');
11636							if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) {
11637								gsap.to($('.t-entry-visual-tc', $this), speed, {
11638									clipPath: 'inset(0% 0% 0% 0%)',
11639									delay: delay + batchTime,
11640									ease: easing,
11641								});
11642								gsap.to($('.t-entry-visual-cont', $this), speed, {
11643									clipPath: 'inset(0% 0% 0% 0%)',
11644									scale: 1,
11645									delay: delay + batchTime + (speed*bgDelay),
11646									ease: easing,
11647									onComplete: resetBatch,
11648								});
11649							} else {
11650								gsap.to($('.t-entry-visual-cont', $this), speed, {
11651									clipPath: 'inset(0% 0% 0% 0%)',
11652									scale: 1,
11653									delay: delay + batchTime,
11654									ease: easing,
11655									onComplete: resetBatch,
11656								});
11657							}
11658							batchTime += 0.1;
11659						}
11660					});
11661				
11662				};
11663				checkForAnimations();
11664
11665				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
11666				var start = 0;
11667
11668				var horST = ScrollTrigger.create({
11669					id: "stickySectionScrolling" + key,
11670					scrub: true,
11671					trigger: $pinTrigger[0],
11672					pin: true,
11673					anticipatePin: 1,
11674					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
11675					end: function() { return "+="+stickyScrollLength; },
11676					animation: scroll_anim,
11677					ease: Sine.easeOut,
11678					onUpdate: checkForAnimations,
11679					invalidateOnRefresh: true,
11680					onEnter: function(){
11681						$pinTrigger.addClass('enter-st');
11682					},
11683					onEnterBack: function(){
11684						$pinTrigger.addClass('enter-st');
11685					},
11686					onLeave: function(){
11687						$pinTrigger.removeClass('enter-st');
11688					},
11689					onLeaveBack: function(){
11690						$pinTrigger.removeClass('enter-st');
11691					}
11692				});
11693
11694				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
11695				window.dispatchEvent(new CustomEvent('boxResized'));
11696
11697				var testSecondTrigger = function(){
11698					animationIncrease = 0
11699					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11700						var _this = this;
11701						if ( checkVisible(_this) ) {
11702							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11703							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11704							requestTimeout(function() {
11705								$(_this).addClass('start_animation');
11706							}, delayAttr + animationIncrease);
11707							animationIncrease += 150;
11708						}
11709					});
11710
11711				};
11712
11713				var verST = ScrollTrigger.create({
11714					id: "verticalSectionScrolling" + key,
11715					trigger: $pinTrigger[0],
11716					start: "top center",
11717					end: function() { return "+="+UNCODE.wheight; },
11718					onUpdate: testSecondTrigger,
11719					invalidateOnRefresh: true
11720				});
11721
11722				var setCTA,
11723
11724				dis_enable_ST = function(){
11725					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
11726						horST.kill();
11727						verST.kill();
11728						$pinTrigger.addClass('disabled');
11729						st_active = false;
11730					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
11731						horST.kill();
11732						verST.kill();
11733						$pinTrigger.addClass('disabled');
11734						st_active = false;
11735					}
11736				};
11737
11738				$(window).on('resize load', function() {
11739					clearRequestTimeout(setCTA);
11740					setCTA = requestTimeout(function() {
11741						dis_enable_ST();
11742						checkForAnimations();
11743					}, 500);
11744				});
11745
11746			});
11747		};
11748
11749		$(window).on( 'load', function(){
11750			horScrollSizes();
11751		});
11752		var setResize,
11753			setReLayout,
11754			doubleResize = true;
11755		$(window).on( 'load', function(){
11756			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
11757				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11758				Array.prototype.forEach.call($row_inners, function(el) {
11759					el.style.height = '';
11760					el.style.marginBottom = '';
11761				});
11762				setItemsRelHeight();
11763				horScrollSizes();
11764				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11765					$(document).trigger('uncode-scrolltrigger-refresh');
11766				}
11767			}
11768			var carousel = document.querySelector(".owl-carousel"),
11769				grid = document.querySelector(".isotope-container"),
11770				stickyAll = document.querySelectorAll(".index-scroll");
11771
11772			if ( stickyAll.length ) {
11773				var sticky = stickyAll[(stickyAll.length-1)];
11774			}
11775
11776			if ( typeof sticky !== "undefined" ) {
11777
11778				if ( typeof carousel !== "undefined" && carousel !== null ) {
11779					var carousel_position = sticky.compareDocumentPosition(carousel);
11780				}
11781				if ( typeof grid !== "undefined" && grid !== null ) {
11782					var grid_position = sticky.compareDocumentPosition(grid);
11783				}
11784
11785				if ( carousel_position === 2 || grid_position === 2 ) {
11786					setTimeout(function(){
11787						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11788							$(document).trigger('uncode-scrolltrigger-refresh');
11789						}
11790					}, 500);
11791				}
11792
11793			}
11794			
11795		});
11796        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
11797            android = /Android/.test(navigator.userAgent) && !window.MSStream;
11798		$(window).on( 'resize orientationchange', function(e){
11799			if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
11800				return;
11801			}
11802			setItemsRelHeight(true);
11803			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11804			Array.prototype.forEach.call($row_inners, function(el) {
11805				el.style.height = '';
11806				el.style.marginBottom = '';
11807			});
11808			clearRequestTimeout(setResize);
11809			setResize = requestTimeout( function(){
11810				setItemsRelHeight();
11811				horScrollSizes();
11812				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11813					$(document).trigger('uncode-scrolltrigger-refresh');
11814				}
11815				if ( doubleResize === true ) {
11816					window.dispatchEvent(new Event('resize'));
11817					doubleResize = false;
11818				} else {
11819					doubleResize = true;
11820				}
11821				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
11822			}, 100 );
11823		});
11824
11825		var show_pins = function(){
11826			$('.index-scroll').css({'opacity':'1'});
11827		};
11828		ScrollTrigger.addEventListener("refresh", show_pins);
11829		$(window).on( 'uncode.re-layout', function(){
11830			//$('.index-scroll').css({'opacity':'0'});
11831			$('.pin-spacer').each(function(){
11832				var space_h = $(this).outerHeight(),
11833					$row = $(this).closest('.row-container');
11834				$row.css({
11835					'height': space_h,
11836					'overflow': 'hidden'
11837				});
11838			});
11839			if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11840				ScrollTrigger.refresh(true);
11841			}
11842			clearRequestTimeout(setReLayout);
11843			setReLayout = requestTimeout( function(){
11844				$('.row-container').each(function(){
11845					$(this).css({
11846						'height': '',
11847						'overflow': ''
11848					});
11849				});
11850			}, 1000);
11851		});
11852	}
11853
11854};
11855
11856UNCODE.stickyTrigger = function( $el ) {
11857    if ( SiteParameters.is_frontend_editor ) {
11858        return false;
11859    }
11860
11861    var stickyTrigger = function(){
11862        var stickyTrick = $('.sticky-trigger').each(function(){
11863            var $sticky = $(this),
11864                $inside = $('> div', $sticky),
11865                insideH = $inside.outerHeight(),
11866                $row = $sticky.closest('.vc_row'),
11867                $uncont = $sticky.closest('.uncont'),
11868                rowBottom,
11869                uncontBottom,
11870                diffBottom;
11871
11872            ScrollTrigger.create({
11873                trigger: $sticky,
11874                start: function(){ return "top center-=" + insideH/2; },
11875                endTrigger: $row,
11876                end:  function(){
11877                    rowBottom = $row.offset().top + $row.outerHeight();
11878                    uncontBottom = $uncont.offset().top + $uncont.outerHeight();
11879                    diffBottom = rowBottom - uncontBottom;
11880                    return "bottom center+=" + ( insideH/2 + diffBottom );
11881                },
11882                anticipatePin: true,
11883                pin: true,
11884                pinSpacing: false,
11885                scrub: true,
11886                invalidateOnRefresh: true,
11887            });
11888
11889        });
11890    },
11891    setResizeSticky;
11892
11893    $(window).on( 'load', function(){
11894        stickyTrigger();
11895        var carousel = document.querySelector(".owl-carousel"),
11896            grid = document.querySelector(".isotope-container"),
11897            stickyAll = document.querySelectorAll(".sticky-trigger");
11898
11899        if ( stickyAll.length ) {
11900            var sticky = stickyAll[(stickyAll.length-1)];
11901        }
11902
11903        if ( typeof sticky !== "undefined" ) {
11904
11905            if ( typeof carousel !== "undefined" && carousel !== null ) {
11906                var carousel_position = sticky.compareDocumentPosition(carousel);
11907            }
11908            if ( typeof grid !== "undefined" && grid !== null ) {
11909                var grid_position = sticky.compareDocumentPosition(grid);
11910            }
11911
11912            if ( carousel_position === 2 || grid_position === 2 ) {
11913                setTimeout(function(){
11914                    $(document).trigger('uncode-scrolltrigger-refresh');
11915                }, 500);
11916            }
11917
11918        }
11919    });
11920
11921    var oldW = UNCODE.wwidth;
11922    $(window).on( 'resize uncode.re-layout', function(e){
11923        clearRequestTimeout(setResizeSticky);
11924        if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
11925            return;
11926        } else {
11927            oldW = UNCODE.wwidth;
11928        }
11929        setResizeSticky = requestTimeout( function(){
11930            stickyTrigger();
11931            $(document).trigger('uncode-scrolltrigger-refresh');
11932        }, 1000 );
11933    });
11934
11935    
11936};
11937
11938UNCODE.areaTextReveal = function() {
11939    if ( ! $('.text-reveal, .scroll-trigger-el').length ) {
11940        return;
11941    }
11942	if ( ! SiteParameters.is_frontend_editor ) {
11943        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
11944            android = /Android/.test(navigator.userAgent) && !window.MSStream,
11945            prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
11946            prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
11947                document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
11948            firstObs = true,
11949            isMobileUsing = false;
11950
11951        var observer = new ResizeObserver(function(){
11952            var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
11953                newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
11954                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
11955                set = false;
11956            if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
11957                set = true;
11958                prevW = newW;
11959            } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
11960                set = true;
11961                prevH = newH;
11962            }
11963            if ( set || firstObs ) {
11964                window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe'));
11965                firstObs = false;
11966            }
11967        }).observe(document.body);
11968
11969        if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
11970            window.scrollTo = function() {
11971                return;
11972            };
11973            isMobileUsing = true;
11974
11975            $('html, body').css({
11976                'overscroll-behavior': 'none'
11977            });
11978        }
11979
11980        var setTriggerObserve;
11981
11982        ScrollTrigger.observe({
11983            trigger: 'body',
11984            type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
11985            onUp: function() { ScrollTrigger.update(); },
11986        });
11987    }
11988
11989    var textReveal = function(){
11990
11991        if ( SiteParameters.is_frontend_editor ) {
11992            return;
11993        }
11994
11995        var setTxtReveal,
11996            txtTrggrStart = false;
11997
11998        function headingReveal($sel){
11999            txtTrggrStart = true;
12000            $('.text-reveal', $sel).each(function(val, key){
12001                var $txtReveal = $(this).attr('data-init-reveal', true),
12002                    $trigger = $txtReveal,
12003                    $rowParent = $txtReveal.closest('.row-container[data-parent]'),
12004                    hReveal = $txtReveal.outerHeight(),
12005                    $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'),
12006                    $sticky = $txtReveal.closest('.sticky-element'),
12007                    dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
12008                    dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
12009                    dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')),
12010                    $lines = $('.heading-line-wrap', $txtReveal),
12011                    $words = $('.split-word-inner', $txtReveal),
12012                    $chars = $('.split-char', $txtReveal),
12013                    $elToReveal = $words;
12014
12015                if ( $pin.length ) {
12016                    return;
12017                } else if ( $sticky.length ) {
12018                    hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop);
12019                    $trigger = $sticky.parent();
12020                }
12021
12022                if ( dataReveal === 'chars' ) {
12023                    $elToReveal = $chars;
12024                } else if ( dataReveal === 'lines' ) {
12025                    $elToReveal = $lines;
12026                }
12027                
12028                var tl = gsap.timeline({
12029                    scrollTrigger: {
12030                        trigger: $trigger,
12031                        start: "top +=" + (window.innerHeight/100*dataTop) + "px",
12032                        end: "+=" + hReveal + "px",
12033                        id: "txt_reveal_" + key,
12034                        scrub: true,
12035                    }
12036                });
12037                gsap.set(
12038                    $elToReveal, {
12039                        opacity: dataRevealOpacity,
12040                    }
12041                )
12042                tl.fromTo($elToReveal, {
12043                    opacity: dataRevealOpacity,
12044                    duration: 1,
12045                }, {
12046                    opacity: 1,
12047                    stagger: 0.05,
12048                    duration: 1,
12049
12050                });
12051                $(window).on('uncode.tl-refresh', function(){
12052                    if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
12053                        tl.scrollTrigger.refresh();
12054                    }
12055                });
12056
12057                $rowParent.one( 'uncodeWordLines', function(){
12058                    clearRequestTimeout(setTxtReveal);
12059                    setTxtReveal = requestTimeout( function(){
12060                        gsap.set($elToReveal, {clearProps: true});
12061                        tl.kill(true);
12062                        if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) {
12063                            ScrollTrigger.getById("txt_reveal_" + key).kill(true);
12064                        }
12065                        headingReveal($sel)
12066                    }, 100);
12067                });
12068
12069            });
12070        };
12071
12072        window.addEventListener("load", function (e) {
12073            if (!txtTrggrStart) {
12074                headingReveal($("body"));
12075                $(window).trigger("resize");
12076            }
12077        });
12078
12079        $('.row-container[data-parent]').each(function(){
12080            if (!txtTrggrStart) {
12081                var $this = $(this);
12082                $this.on('uncodeWordLines', function(){
12083                    headingReveal($this);
12084                });
12085            }
12086        });
12087
12088        $(window).on('uncode-sticky-trigger-observe', function(e){
12089            clearRequestTimeout(setTriggerObserve);
12090            setTriggerObserve = requestTimeout( function(){
12091                $(window).trigger('uncode.tl-refresh');
12092            }, 2000 );
12093        });
12094    
12095    };
12096    textReveal();
12097
12098    var areaReveal = function(){
12099        if ( SiteParameters.is_frontend_editor ) {
12100            return;
12101        }
12102
12103        $('.scroll-trigger-el').each(function(){
12104            var $scrollTrgrEl = $(this),
12105                $row = $('> .row', $scrollTrgrEl),
12106                $row_in = $('> .row-inner', $row),
12107                cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length,
12108                stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows',
12109                animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes',
12110                stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false,
12111                $animateTrgrEl = $scrollTrgrEl,
12112                noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes',
12113                noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'),
12114                els = $scrollTrgrEl.attr('data-anim-els'),
12115                sticky = $scrollTrgrEl.attr('data-anim-sticky'),
12116                noSpace = $scrollTrgrEl.attr('data-anim-no-space'),
12117                state = $scrollTrgrEl.attr('data-anim-state'),
12118                target = $scrollTrgrEl.attr('data-anim-target'),
12119                origin = $scrollTrgrEl.attr('data-anim-origin'),
12120                mask = $scrollTrgrEl.attr('data-anim-mask'),
12121                _scale = $scrollTrgrEl.attr('data-anim-scale'),
12122                stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes',
12123                opacity = $scrollTrgrEl.attr('data-anim-opacity'),
12124                radius = $scrollTrgrEl.attr('data-anim-radius'),
12125                radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'),
12126                clip_path = $scrollTrgrEl.attr('data-clip-path'),
12127                animation_x = $scrollTrgrEl.attr('data-anim-x'),
12128                animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'),
12129                animation_y = $scrollTrgrEl.attr('data-anim-y'),
12130                blur = $scrollTrgrEl.attr('data-anim-blur'),
12131                perspective = $scrollTrgrEl.attr('data-anim-perspective'),			
12132                rotate = $scrollTrgrEl.attr('data-anim-rotate'),	
12133                rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'),
12134                topBottom = $scrollTrgrEl.attr('data-anim-start'),	
12135                offTop = $scrollTrgrEl.attr('data-anim-top'),
12136                offBottom = $scrollTrgrEl.attr('data-anim-bottom'),
12137                safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0,
12138                animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'),
12139                easeOut = $scrollTrgrEl.attr('data-anim-ease'),
12140                offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'),
12141                stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards,
12142                $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(),
12143                setTxtReveal,
12144                txtTrggrStart = false,
12145                alreadyareaAnimateScrollTl = false;
12146    
12147            _scale = _scale === '' ? 0 : parseFloat( _scale );
12148            perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001;	
12149            offTop = offTop === '' ? 0 : parseFloat( offTop );
12150            offBottom = offBottom === '' ? 0 : parseFloat( offBottom );
12151            offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard );
12152
12153            function areaAnimateScrollTl($el, id, last) {
12154                alreadyareaAnimateScrollTl = true;
12155
12156                var pTop = parseFloat( $row.css('padding-top') ),
12157                    innerGap = pTop + offSetCard * id,
12158                    scale = _scale;
12159
12160                if ( isMobileUsing ) {
12161                    innerGap = 0;
12162                }
12163
12164                if ( stepScale ) {
12165                    if ( _scale < 100 ) {
12166                        scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) );
12167                    }
12168                }
12169
12170                if ( els === 'content' ) {
12171                    $animateTrgrEl = $('> .row', $scrollTrgrEl);
12172                } else if ( els === 'bg' ) {
12173                    $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl);
12174                } else {
12175                    $animateTrgrEl = $el;
12176                }
12177
12178                if ( rotate_alt === 'yes') {
12179                    rotate *= -1;
12180                    perspective *= -1;
12181                }
12182                
12183                if ( animation_x_alt === 'yes') {
12184                    animation_x *= -1;
12185                }
12186
12187                var $parentDiv = $el.closest('div[data-sticky]');
12188
12189                var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px";
12190
12191                var scrllTrggr = {
12192                    trigger: $parentDiv,
12193                    end: function(){
12194                        return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom)))
12195                    },
12196                    start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
12197                    pin: sticky === 'yes' || stickyCards ? true : false,
12198                    pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0),
12199                    scrub: true,
12200                    id: 'sticky_' + id,
12201                    anticipatePin: 1,
12202                    invalidateOnRefresh: true,
12203                    // markers: {
12204                    //     indent: 150 * id
12205                    // },
12206                    onToggle: function(){
12207                        $scrollTrgrEl.attr('data-revealed', true);
12208                    },
12209                };
12210
12211                if ( !stickyLast && state === 'end' ) {
12212                    last = false;
12213                } 
12214
12215                if ( stickyCards ) {
12216                    if ( state !== 'end' ) {
12217                        if ( animation_rows_start === 'center' ) {
12218                            scrllTrggr.start = "center center";
12219                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight);
12220                        } else if ( animation_rows_start === 'bottom' ) {
12221                            if ( stickyOpts !== 'no' ) {
12222                                scrllTrggr.start = "bottom bottom";
12223                                scrllTrggr.end = "bottom bottom";
12224                            }
12225                        } else {
12226                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2);
12227                        } 
12228                        if ( stickyOpts === 'no' ) {
12229                            scrllTrggr.endTrigger = $el;
12230                            scrllTrggr.end = "+=100%";
12231                        } else {
12232                            scrllTrggr.endTrigger = $row;
12233                        }
12234                    } else {
12235                        if ( animation_rows_start === 'center' ) {
12236                            scrllTrggr.start = "center center";
12237                        } else if ( animation_rows_start === 'bottom' ) {
12238                            scrllTrggr.start = "bottom bottom";
12239                        } 
12240                        if ( stickyOpts !== 'no' ) {
12241                            scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1));
12242                            scrllTrggr.endTrigger = $lastEl;
12243                        } else {
12244                            scrllTrggr.end = "bottom bottom";
12245                        }
12246                    }
12247                }
12248                
12249                var tl = gsap.timeline({
12250                    scrollTrigger: scrllTrggr
12251                });
12252
12253                // var mark = last ? {
12254                //         startColor:"blue",
12255                //         endColor:"orange",
12256                //     } : false;
12257
12258                if ( !stickyCards ) {
12259                    var tlConds = tl;
12260                } else {
12261                    var scrllTrggrConds = {
12262                        trigger: $parentDiv,
12263                        end: function(){
12264                            return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom)))
12265                        }, 
12266                        pin: (state === 'end' && last),
12267                        pinSpacing: false,
12268                        scrub: true,
12269                        id: 'card_' + id,
12270                        invalidateOnRefresh: true,
12271                        // markers: true,
12272                    };
12273                    if ( stickyCards ) {
12274                        if ( state !== 'end' ) {
12275                            if ( stickyOpts === '' ) {
12276                                scrllTrggrConds.end = "bottom bottom-=100%";
12277                                scrllTrggrConds.endTrigger = $row_in;
12278                            }
12279
12280                            if ( animation_rows_start === 'bottom' ) {
12281                                if ( stickyOpts !== 'no') {
12282                                    scrllTrggrConds.start = "top top+=" + window.innerHeight;
12283                                    scrllTrggrConds.end = "bottom bottom";
12284                                }
12285                            } else if ( animation_rows_start === 'center' ) {
12286                                scrllTrggrConds.start =  "center center";
12287                            } else {
12288                                scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12289                            }
12290                            
12291                        } else {
12292                            if ( stickyOpts === '' ) {
12293                                if ( animLast ) {
12294                                    scrllTrggrConds.end = "bottom bottom-=100%";
12295                                } else {
12296                                    scrllTrggrConds.end = "bottom bottom";
12297                                }
12298                                scrllTrggrConds.endTrigger = $lastEl;
12299                            }
12300
12301                            if ( animation_rows_start === 'bottom' && stickyOpts !== 'no' ) {
12302                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12303                                    scrllTrggrConds.start = "bottom bottom";
12304                                } else {
12305                                    scrllTrggrConds.start = "top top+=" + $el.outerHeight();
12306                                }
12307                            } else if ( animation_rows_start === 'center' ) {
12308                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12309                                    scrllTrggrConds.start =  "center center";
12310                                } else {
12311                                scrllTrggrConds.start =  "top+=" + ($el.outerHeight()/2) + " top+=" 
12311+ window.innerHeight/2;
12312                                }
12313                            } else {
12314                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12315                                    scrllTrggrConds.start = "top top";
12316                                } else {
12317                                    scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12318                                }
12319                            }
12320
12321                        }
12322
12323                    } else {
12324                        scrllTrggrConds.start =  start_topBottom;
12325                    }
12326
12327                    var tlConds = gsap.timeline({
12328                        scrollTrigger: scrllTrggrConds
12329                    });
12330                }
12331
12332                if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) {
12333                    if ( target === 'mask' ) {
12334                        if ( state !== 'end' ) {
12335                            if ( mask === 'auto' ) {
12336                                gsap.set(
12337                                    $animateTrgrEl, {
12338                                        clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12339                                        opacity: parseFloat(opacity)/100,
12340                                        filter: 'blur(' + blur + 'px)',
12341                                        visibility: 'visible',
12342                                    }
12343                                )
12344                                tlConds.fromTo($animateTrgrEl, {
12345                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12346                                    opacity: parseFloat(opacity)/100,
12347                                    filter: 'blur(' + blur + 'px)',
12348                                    duration: 1,
12349                                }, {
12350                                    opacity: 1,
12351                                    clipPath: 'inset(0% 0px round 0' + radiu
12351s_unit + ')',
12352                                    filter: 'blur(0px)',
12353                                    duration: 1,
12354                                    ease: easeOut,
12355                                    //delay: 0.1
12356                                });	
12357                            } else {
12358                                tlConds.fromTo($animateTrgrEl, {
12359                                    opacity: parseFloat(opacity)/100,
12360                                    clipPath: clip_path,
12361                                    filter: 'blur(' + blur + 'px)',
12362                                    duration: 1,
12363                                }, {
12364                                    opacity: 1,
12365                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12366                                    filter: 'blur(0px)',
12367                                    duration: 1,
12368                                    ease: easeOut,
12369                                    //delay: 0.1
12370                                });	
12371                            }
12372                        } else {
12373                            if ( mask === 'auto' ) {
12374                                tlConds.fromTo($animateTrgrEl, {
12375                                    opacity: 1,
12376                                    clipPath: 'inset(0% 0px round 0' + radiu
12376s_unit + ')',
12377                                    filter: 'blur(0px)',
12378                                    duration: 1,
12379                                },{
12380                                    opacity: parseFloat(opacity)/100,
12381                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12382                                    filter: 'blur(' + blur + 'px)',
12383                                    ease: easeOut,
12384                                    duration: 1,
12385                                    //delay: 0.1
12386                                });	
12387                            } else {
12388                                tlConds.fromTo($animateTrgrEl, {
12389                                    opacity: 1,
12390                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12391                                    filter: 'blur(0px)',
12392                                    duration: 1,
12393                                },{
12394                                    opacity: parseFloat(opacity)/100,
12395                                    clipPath: clip_path,
12396                                    filter: 'blur(' + blur + 'px)',
12397                                    duration: 1,
12398                                    ease: easeOut,
12399                                    //delay: 0.1
12400                                });	
12401                            }
12402                        }
12403                    } else {
12404                        if ( state !== 'end' ) {
12405                            if ( scale === 'auto' ) {
12406                                if ( radius ) {
12407                                    gsap.set(
12408                                        $animateTrgrEl, {
12409                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12410                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12411                                            x: animation_x + 'vw',
12412                                            y: animation_y + 'vh',
12413                                            filter: 'blur(' + blur + 'px)',
12414                                            rotation: rotate,
12415                                            rotationX: rotate == 0 ? perspective : 0,
12416                                            transformPerspective: '100vw',
12417                                            opacity: parseFloat(opacity)/100,
12418                                            transformOrigin: origin,
12419                                            borderRadius: radius + radius_unit,
12420                                            visibility: 'visible',
12421                                        }
12422                                    )
12423                                    tlConds.fromTo($animateTrgrEl, {
12424                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12425                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12426                                        x: animation_x + 'vw',
12427                                        y: animation_y + 'vh',
12428                                        filter: 'blur(' + blur + 'px)',
12429                                        rotation: rotate,
12430                                        rotationX: rotate == 0 ? perspective : 0,
12431                                        transformPerspective: '100vw',
12432                                        opacity: parseFloat(opacity)/100,
12433                                        borderRadius: radius + radius_unit,
12434                                        transformOrigin: origin,
12435                                        duration: 1,
12436                                    }, {
12437                                        scaleX: 1,
12438                                        scaleY: 1,
12439                                        x: 0,
12440                                        y: 0,
12441                                        filter: 'blur(0px)',
12442                                        rotation: 0,
12443                                        rotationX: 0,
12444                                        opacity: 1,
12445                                        borderRadius: 0 + radius_unit,
12446                                        transformOrigin: origin,
12447                                        duration: 1,
12448                                        ease: easeOut,
12449                                        //delay: 0.1
12450                                    });	
12451                                } else {
12452                                    gsap.set(
12453                                        $animateTrgrEl, {
12454                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12455                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12456                                            x: animation_x + 'vw',
12457                                            y: animation_y + 'vh',
12458                                            filter: 'blur(' + blur + 'px)',
12459                                            rotation: rotate,
12460                                            rotationX: rotate == 0 ? perspective : 0,
12461                                            transformPerspective: '100vw',
12462                                            opacity: parseFloat(opacity)/100,
12463                                            transformOrigin: origin,
12464                                            visibility: 'visible',
12465                                        }
12466                                    )
12467                                    tlConds.fromTo($animateTrgrEl, {
12468                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12469                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12470                                        x: animation_x + 'vw',
12471                                        y: animation_y + 'vh',
12472                                        filter: 'blur(' + blur + 'px)',
12473                                        rotation: rotate,
12474                                        rotationX: rotate == 0 ? perspective : 0,
12475                                        transformPerspective: '100vw',
12476                                        opacity: parseFloat(opacity)/100,
12477                                        transformOrigin: origin,
12478                                        duration: 1,
12479                                    }, {
12480                                        scaleX: 1,
12481                                        scaleY: 1,
12482                                        x: 0,
12483                                        y: 0,
12484                                        filter: 'blur(0px)',
12485                                        rotation: 0,
12486                                        rotationX: 0,
12487                                        opacity: 1,
12488                                        transformOrigin: origin,
12489                                        duration: 1,
12490                                        ease: easeOut,
12491                                        //delay: 0.1
12492                                    });	
12493                                }
12494                            } else {
12495                                if ( radius ) {
12496                                    gsap.set(
12497                                        $animateTrgrEl, {
12498                                            scaleX: parseFloat( scale ) / 100,
12499                                            scaleY: parseFloat( scale ) / 100,
12500                                            opacity: parseFloat(opacity)/100,
12501                                            x: animation_x + 'vw',
12502                                            y: animation_y + 'vh',
12503                                            filter: 'blur(' + blur + 'px)',
12504                                            rotation: rotate,
12505                                            rotationX: rotate == 0 ? perspective : 0,
12506                                            transformPerspective: '100vw',
12507                                            transformOrigin: origin,
12508                                            borderRadius: radius + radius_unit,
12509                                            visibility: 'visible',
12510                                        }
12511                                    )
12512                                    tlConds.fromTo($animateTrgrEl, {
12513                                        scaleX: parseFloat( scale ) / 100,
12514                                        scaleY: parseFloat( scale ) / 100,
12515                                        opacity: parseFloat(opacity)/100,
12516                                        x: animation_x + 'vw',
12517                                        y: animation_y + 'vh',
12518                                        filter: 'blur(' + blur + 'px)',
12519                                        rotation: rotate,
12520                                        rotationX: rotate == 0 ? perspective : 0,
12521                                        transformPerspective: '100vw',
12522                                        borderRadius: radius + radius_unit,
12523                                        transformOrigin: origin,
12524                                        duration: 1,
12525                                    }, {
12526                                        scaleX: 1,
12527                                        scaleY: 1,
12528                                        opacity: 1,
12529                                        x: 0,
12530                                        y: 0,
12531                                        filter: 'blur(0px)',
12532                                        rotation: 0,
12533                                        rotationX: 0,
12534                                        transformOrigin: origin,
12535                                        ease: easeOut,
12536                                        duration: 1,
12537                                        borderRadius: 0 + radius_unit,
12538                                        //delay: 0.1
12539                                    });	
12540                                } else {
12541                                    gsap.set(
12542                                        $animateTrgrEl, {
12543                                            scaleX: parseFloat( scale ) / 100,
12544                                            scaleY: parseFloat( scale ) / 100,
12545                                            opacity: parseFloat(opacity)/100,
12546                                            x: animation_x + 'vw',
12547                                            y: animation_y + 'vh',
12548                                            filter: 'blur(' + blur + 'px)',
12549                                            rotation: rotate,
12550                                            rotationX: rotate == 0 ? perspective : 0,
12551                                            transformPerspective: '100vw',
12552                                            transformOrigin: origin,
12553                                            visibility: 'visible',
12554                                        }
12555                                    )
12556                                    tlConds.fromTo($animateTrgrEl, {
12557                                        scaleX: parseFloat( scale ) / 100,
12558                                        scaleY: parseFloat( scale ) / 100,
12559                                        opacity: parseFloat(opacity)/100,
12560                                        x: animation_x + 'vw',
12561                                        y: animation_y + 'vh',
12562                                        filter: 'blur(' + blur + 'px)',
12563                                        rotation: rotate,
12564                                        rotationX: rotate == 0 ? perspective : 0,
12565                                        transformPerspective: '100vw',
12566                                        transformOrigin: origin,
12567                                        duration: 1,
12568                                    }, {
12569                                        scaleX: 1,
12570                                        scaleY: 1,
12571                                        opacity: 1,
12572                                        x: 0,
12573                                        y: 0,
12574                                        filter: 'blur(0px)',
12575                                        rotation: 0,
12576                                        rotationX: 0,
12577                                        transformOrigin: origin,
12578                                        duration: 1,
12579                                        ease: easeOut,
12580                                        //delay: 0.1
12581                                    });
12582                                }
12583                            }
12584                        } else {
12585                            if ( scale === 'auto' ) {
12586                                tlConds.fromTo($animateTrgrEl, {
12587                                    scaleX: 1,
12588                                    scaleY: 1,
12589                                    opacity: 1,
12590                                    x: 0,
12591                                    y: 0,
12592                                    filter: 'blur(0px)',
12593                                    rotation: 0,
12594                                    rotationX: 0,
12595                                    transformOrigin: origin,
12596                                    duration: 1,
12597                                }, {
12598                                    scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12599                                    scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12600                                    opacity: parseFloat(opacity)/100,
12601                                    x: animation_x + 'vw',
12602                                    y: animation_y + 'vh',
12603                                    filter: 'blur(' + blur + 'px)',
12604                                    rotation: rotate,
12605                                    rotationX: rotate == 0 ? perspective : 0,
12606                                    transformPerspective: '100vw',
12607                                    transformOrigin: origin,
12608                                    duration: 1,
12609                                    ease: easeOut,
12610                                    //delay: 0.1
12611                                })
12612                            } else {
12613                                tlConds.fromTo($animateTrgrEl, {
12614                                    scaleX: 1,
12615                                    scaleY: 1,
12616                                    opacity: 1,
12617                                    x: 0,
12618                                    y: 0,
12619                                    filter: 'blur(0px)',
12620                                    rotation: 0,
12621                                    rotationX: 0,
12622                                    transformPerspective: '100vw',
12623                                    transformOrigin: origin,
12624                                    borderRadius: 0 + radius_unit,
12625                                    duration: 1,
12626                                }, {
12627                                    scaleX: parseFloat( scale ) / 100,
12628                                    scaleY: parseFloat( scale ) / 100,
12629                                    opacity: parseFloat(opacity)/100,
12630                                    x: animation_x + 'vw',
12631                                    y: animation_y + 'vh',
12632                                    filter: 'blur(' + blur + 'px)',
12633                                    rotation: rotate,
12634                                    rotationX: rotate == 0 ? perspective : 0,
12635                                    transformPerspective: '100vw',
12636                                    transformOrigin: origin,
12637                                    borderRadius: radius + radius_unit,
12638                                    duration: 1,
12639                                    ease: easeOut,
12640                                    //delay: 0.1
12641                                })
12642                            }
12643                        }
12644                    }
12645                }
12646
12647                function headingReveal($el){
12648                    txtTrggrStart = true;
12649                    $('.text-reveal', $el).each(function(_key, _val){
12650                        var $txtReveal = $(_val),
12651                            dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
12652                            dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
12653                            $lines = $('.heading-line-wrap', $txtReveal),
12654                            $words = $('.split-word-inner', $txtReveal),
12655                            $chars = $('.split-char', $txtReveal),
12656                            _setTxtReveal,
12657                            $elToReveal = $words;
12658
12659                        if ( !(sticky === 'yes' || stickyCards) ) {
12660                            return;
12661                        }
12662            
12663                        easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut;
12664
12665                        if ( dataReveal === 'chars' ) {
12666                            $elToReveal = $chars;
12667                        } else if ( dataReveal === 'lines' ) {
12668                            $elToReveal = $lines;
12669                        }
12670
12671                        var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr;
12672                        scrllTrggrTxt.id = "txt_reveal_" + _key; 
12673                        scrllTrggrTxt.pin = false;
12674
12675                        gsap.set($elToReveal, {opacity: dataRevealOpacity});
12676                        var _tl = gsap.timeline({
12677                            scrollTrigger: scrllTrggrTxt
12678                        });
12679                        _tl.fromTo($elToReveal, {
12680                            opacity: dataRevealOpacity,
12681                        }, {
12682                            opacity: 1,
12683                            stagger: 0.05
12684                        });
12685
12686                        $scrollTrgrEl.one( 'uncodeWordLines', function(){
12687                            clearRequestTimeout(_setTxtReveal);
12688                            _setTxtReveal = requestTimeout( function(){
12689                                gsap.set($elToReveal, {clearProps: true});
12690                                _tl.kill(true);
12691                                if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) {
12692                                    ScrollTrigger.getById("txt_reveal_" + _key).kill(true);
12693                                }
12694                                headingReveal($el)
12695                            }, 100);
12696                        });
12697
12698                    });
12699                };
12700
12701                if (!txtTrggrStart) {
12702                    headingReveal($el);
12703                }
12704
12705                $scrollTrgrEl.one( 'uncodeWordLines', function(){
12706                    if (!txtTrggrStart) {
12707                        headingReveal($el);
12708                    }
12709                });
12710                
12711                var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
12712                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight );
12713                var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 
12714                    document.documentElement.clientWidth,  document.documentElement.scrollWidth,  document.documentElement.offsetWidth );
12715                    
12716                $(window).on('uncode-sticky-trigger-observe', function(e){
12717                    var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
12718                    var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );
12719                    $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false});
12720                    //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style');
12721                    if ( stickyCards ) {
12722                        $('.tmb', $scrollTrgrEl).removeAttr('style');
12723                    }
12724                    var scrollnow = document.body.scrollTop || document.documentElement.scrollTop;
12725                    clearRequestTimeout(setTxtReveal);
12726                    setTxtReveal = requestTimeout( function(){
12727                        $(document).trigger('uncode-scrolltrigger-refresh');
12728                        if ( isMobileUsing ) {
12729                            if ( typeof tl !== 'undefined' ) {
12730                                tl.scrollTrigger.refresh();
12731                            }
12732                            if ( typeof tlConds !== 'undefined' ) {
12733                                tlConds.scrollTrigger.refresh();
12734                            }
12735                            $(window).trigger('scroll');
12736                            _width = __width;
12737                        } else if ( _width !== __width && ( isMobileUsing ) ) {
12738                            window.dispatchEvent(new CustomEvent('vc-resize'));
12739                            if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
12740                                window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){
12741                                    if ( typeof tl !== 'undefined' ) {
12742                                        tl.scrollTrigger.refresh();
12743                                    }
12744                                    if ( typeof tlConds !== 'undefined' ) {
12745                                        tlConds.scrollTrigger.refresh();
12746                                    }
12747                                    window.lenis.scrollTo(scrollnow, {duration: 0.01});
12748                                }});
12749                            } else {
12750                                if ( typeof tl !== 'undefined' ) {
12751                                    tl.scrollTrigger.refresh();
12752                                }
12753                                if ( typeof tlConds !== 'undefined' ) {
12754                                    tlConds.scrollTrigger.refresh();
12755                                }
12756                                $(window).trigger('scroll');
12757                            }
12758                            _height = __height;
12759                        }
12760                    }, 500);
12761                });
12762
12763
12764                $(window).on('load ', function(e){
12765                    var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
12766                    if ( _height !== ___height ) {
12767                        $scrollTrgrEl.attr('data-toggled', true);
12768                        $(window).trigger('resize');
12769                        if ( typeof tl !== 'undefined' ) {
12770                            tl.scrollTrigger.refresh();
12771                        }
12772                        if ( typeof tlConds !== 'undefined' ) {
12773                            tlConds.scrollTrigger.refresh();
12774                        }
12775                        _height = ___height;
12776                    }
12777
12778                    
12779                    
12780                    $(document).trigger('uncode-scrolltrigger-refresh');
12781
12782                });
12783
12784            };
12785
12786            var callAreaAnimateScrollTl = function() {
12787                if ( stickyCards ) {
12788                    $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){
12789                        if ( key+1 < cardL || animLast || state !== 'end' ) {
12790                            var $this = $(val),
12791                                last = key+1===cardL;
12792                            areaAnimateScrollTl($this, key, last);
12793                        }
12794                    });
12795                } else {
12796                    areaAnimateScrollTl($scrollTrgrEl, 0, false);
12797                }    
12798            };
12799
12800            $(window).on('wwResize', function(){
12801                if ( !alreadyareaAnimateScrollTl ) {
12802                    if ( noMobile ) {
12803                        if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
12804                            return;
12805                        } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12806                            return;
12807                        }
12808                    }
12809                    
12810                    callAreaAnimateScrollTl();
12811                }
12812            })
12813
12814            if ( noMobile ) {
12815                if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
12816                    return;
12817                } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12818                    return;
12819                }
12820            }
12821
12822            callAreaAnimateScrollTl();
12823
12824        });
12825
12826    };
12827
12828    areaReveal();
12829
12830};
12831
12832UNCODE.thumbsReveal = function() {
12833    var recalc = false,
12834    revealThumbs = function( $el ){
12835        if ( typeof $el === 'undefined' || $el === null || !$el.length ) {
12836            $el = $('body');
12837        }
12838        $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){
12839            var $container = $(this),
12840                $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container),
12841                isContainer = false;
12842
12843            if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) {
12844                $stickys.each(function(){
12845                    var $sticky = $(this).addClass('tmb-mask-init'),
12846                        $rellax = $sticky.closest('.parallax-el'),
12847                        $inside = $('.t-inside', $sticky),
12848                        $media = $('img, video, .fluid-object', $sticky).attr('loading', ''),
12849                        val = parseFloat( $inside.attr('data-scroll-val') );
12850
12851                    if ( $rellax.length ) {
12852                        recalc = true;
12853                    }
12854
12855                    val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val;
12856                    
12857                    if ( $sticky.hasClass('tmb-mask-scroll') ) {
12858
12859                        var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both'))
12860                        ? val*0.05 : 0;
12861                        var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
12862                            ? val*4 : 0;
12863                        var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) ? parax*0.01 : 0;
12864
12865                        var tl = gsap.timeline({
12866                            scrollTrigger: {
12867                                trigger: $sticky,
12868                                scrub: true,
12869                            }
12870                        });
12871
12872                        tl.fromTo($media, {
12873                            yPercent: -(parax),
12874                            scale: 1 + zoom + extra,
12875                        }, {
12876                            yPercent: parax,
12877                            scale: 1 + extra,
12878                            ease: "none",
12879                        });
12880
12881                        if ( recalc ) {
12882                            $(window).on('uncode-thumbsreveal-refresh', function(){
12883                                if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
12884                                    tl.scrollTrigger.refresh();
12885                                }
12886                            });
12887                        }
12888                    }
12889                });
12890            }
12891
12892            if ( $container.has('.tmb-mask-reveal') ) {
12893                var $markTrigger = ".tmb-mask-reveal .t-entry-visual",
12894                staggerTime = 0.1;
12895
12896                $('.t-inside', $container).each(function(){
12897                    var checkEasing = $(this).attr('data-easing');
12898                    if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') {
12899                        gsap.registerPlugin(CustomEase);
12900                        return false;
12901                    }
12902                });
12903
12904                if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) {
12905                    $markTrigger = $container;
12906                    isContainer = true;
12907                    staggerTime = 0;
12908                }
12909
12910                ScrollTrigger.batch( $markTrigger, {
12911                    start: function( el ){
12912                        /*if ( el.trigger.offsetHeight < (window.innerHeight/2) ) {
12913                            return "bottom bottom";
12914                        } else {*/
12915                            return  "top 96%";
12916                        //}
12917                    },
12918                    onEnter: function(batch){
12919                        var $inside = $(batch).closest('.t-inside');
12920
12921                        if ( isContainer ) {
12922                            var $inside = $(batch).find('.t-inside').first();
12923                        }
12924
12925                        var delay = parseFloat( $inside.attr('data-delay') ),
12926                            speed = parseFloat( $inside.attr('data-speed') ),
12927                            easing = $inside.attr('data-easing'),
12928                            bgDelay = parseFloat( $inside.attr('data-bg-delay') );
12929
12930                        delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
12931                        speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
12932                        easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
12933                        bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
12934
12935                        if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) {
12936                            gsap.to($('.t-entry-visual-tc', batch), speed, {
12937                                clipPath: 'inset(0% 0% 0% 0%)',
12938                                stagger: staggerTime,
12939                                delay: delay,
12940                                ease: easing,
12941                            });
12942                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
12943                                clipPath: 'inset(0% 0% 0% 0%)',
12944                                stagger: staggerTime,
12945                                scale: 1,
12946                                delay: delay + (speed*bgDelay),
12947                                ease: easing,
12948                            });
12949                        } else {
12950                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
12951                                clipPath: 'inset(0% 0% 0% 0%)',
12952                                stagger: staggerTime,
12953                                scale: 1,
12954                                delay: delay,
12955                                ease: easing,
12956                            });
12957                        }
12958                                                    
12959                    }
12960                });
12961            }
12962
12963        });
12964
12965        function raf(time) {
12966            requestAnimationFrame(raf)
12967            $(window).trigger('uncode-thumbsreveal-refresh');
12968        }
12969
12970        if ( recalc ) {
12971            requestAnimationFrame(raf)
12972        }
12973
12974    };
12975    $(window).on( 'load more-items-loaded', function(){
12976        revealThumbs();
12977    });
12978
12979    $(document).on('uncode-ajax-filtered', function(){
12980        revealThumbs();
12981    });
12982
12983    if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
12984        window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
12985            var $el = model.view.$el,
12986                shortcode = model.attributes.shortcode;
12987
12988            if ( $el.is('.custom-grid-container') ) {
12989                $el = $el.parent();
12990            }
12991
12992            if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') {
12993                revealThumbs($el);
12994            }
12995        });
12996    }
12997
12998};
12999
13000UNCODE.revslider = function() {
13001	var revSlider6In = function(){
13002		$('rs-module').each(function(){
13003			var $slider = $(this);
13004
13005			$slider.on('revolution.slide.onloaded', function(e, data){
13006				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13007					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
13008						scrolltop = $(document).scrollTop();
13009					if ( style != undefined ) {
13010						UNCODE.switchColorsMenu(scrolltop, style);
13011					}
13012				}
13013			});
13014
13015			$slider.on('revolution.slide.onchange', function(e, data){
13016				if ( $(e.currentTarget).closest(".header-revslider").length ) {
13017					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
13018						scrolltop = $(document).scrollTop();
13019					if ( style != undefined ) {
13020						UNCODE.switchColorsMenu(scrolltop, style);
13021					}
13022				}
13023			});
13024
13025		});
13026
13027	};
13028	revSlider6In();
13029	$(window).on("load", revSlider6In );
13030
13031	document.addEventListener("sr.module.ready", function(e) { 
13032		var $slider = $('#'+e.id),
13033			settings = SR7.JSON[e.id];
13034
13035		if ( typeof settings !== 'undefined' && settings !== null ) {
13036			if ( $slider.closest(".header-revslider").length ) {
13037				var style = settings.slides[1].slide.attr.data,
13038					scrolltop = $(document).scrollTop();
13039				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13040				style = style[1];
13041				if ( style[1] != undefined ) {
13042					UNCODE.switchColorsMenu(scrolltop, style);
13043				}
13044			}
13045		}
13046	});
13047
13048	document.addEventListener("sr.slide.afterChange", function(e) {
13049		var $slider = $('#'+e.id),
13050			settings = SR7.JSON[e.id];
13051
13052		if ( typeof settings !== 'undefined' && settings !== null ) {
13053			if ( $slider.closest(".header-revslider").length ) {
13054				var style = settings.slides[e.current.id].slide.attr.data,
13055					scrolltop = $(document).scrollTop();
13056				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
13057				style = style[1];
13058				if ( style != undefined ) {
13059					UNCODE.switchColorsMenu(scrolltop, style);
13060				}
13061			}
13062		}
13063	});
13064
13065};
13066UNCODE.layerslider = function() {
13067	$(window).on("load", function() {
13068
13069		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
13070
13071			var slideData = slider.slides.current.data,
13072				scrolltop = $(document).scrollTop();
13073			if( slideData && slideData.skin ) {
13074
13075				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
13076
13077			}
13078		});
13079
13080	});
13081};
13082
13083UNCODE.ajax_filters = function () {
13084	var isAjaxing = false;
13085
13086/*************************
13087 *
13088 * Filters Menu and Widgets Area
13089 *
13090 ************************/
13091
13092 	var clear_clicked = false;
13093
13094 	var init_ajax_grid = function(){
13095
13096		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
13097		$grids.each(function(index, val){
13098			var $body = $('body'),
13099				$grid = $(val).addClass('init-ajax-grid'),
13100				starting_point = $grid.attr('data-toggle'),
13101				$trigger = $('.uncode-toggle-ajax-filters', $grid),
13102				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
13103				$isotope_wrapper = $('.isotope-wrapper', $grid),
13104				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
13105				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
13106				$footprint = $('.ajax-filter-footprint', $grid),
13107				sidebar_w,
13108				data_w = parseFloat( $sidebar.attr('data-max-width') ),
13109				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
13110				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
13111				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
13112				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13113				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
13114				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
13115				sidew,
13116				$inside_row = $('> .row-parent', $vc_row),
13117				bg_row,
13118				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
13119				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
13120				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
13121				sidebar_overlay = false,
13122				sidebar_hover = false,
13123				switchMobile = false,
13124				scrollTop;
13125
13126			if ( $vc_row.attr('class') ) {
13127				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
13128			}
13129
13130			if ( bg_row != null ) {
13131				$side_header.add($side_footer).addClass(bg_row[0]);
13132			}
13133
13134			$trigger.add($apply_filters).on('click', function(e){
13135				e.preventDefault();
13136				e.stopPropagation();
13137				$grid = $('.ajax-grid-system').eq(0);
13138				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13139				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13140				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13141				sidebar_w = $sidebar_wrapper.width();
13142				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13143				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
13144					$(this).trigger('uncode-ajax-clear-filters');
13145				}
13146				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13147					$grid.toggleClass('ajax-hide-filters-blanks');
13148					$sidebar.slideToggle({
13149						duration: 400,
13150						easing: 'easeOutQuad',
13151					});
13152				} else {
13153					$grid.removeClass('ajax-hide-filters-blanks');
13154					$grid.toggleClass('ajax-hide-filters');
13155					if ( $grid.hasClass('ajax-hide-filters') ) {
13156						$body.addClass('ajax-hide-filters');
13157					} else {
13158						scrollTop = $('html, body').scrollTop();
13159						$body.removeClass('ajax-hide-filters');
13160					}
13161				}
13162				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13163					$('html, body').scrollTop(scrollTop);
13164				}
13165				return false;
13166			});
13167
13168			$close_btn.on('click', function(e){
13169				e.preventDefault();
13170				$grid = $('.ajax-grid-system').eq(0);
13171				$grid.addClass('ajax-hide-filters');
13172				if ( $grid.hasClass('ajax-hide-filters') ) {
13173					$body.addClass('ajax-hide-filters');
13174				} else {
13175					scrollTop = $('html, body').scrollTop();
13176					$body.removeClass('ajax-hide-filters');
13177				}
13178				$('html, body').scrollTop(scrollTop);
13179			});
13180
13181			$sidebar_wrapper.on('mouseover',function(){
13182				sidebar_hover = true;
13183			}).on('mouseout', function(){
13184				sidebar_hover = false;
13185			});
13186
13187			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
13188				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
13189					return;
13190				}
13191				if (undefined !== from && from === 'select_active_attributes') {
13192					return;
13193				}
13194				if ($(e.target).closest('.select2-container--open').length ) {
13195					return;
13196				}
13197				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
13198					$grid.add($body).addClass('ajax-hide-filters');
13199				}
13200			});
13201
13202			$sorting_trgr.on('click', function(e) {
13203				e.preventDefault();
13204			});
13205
13206			var inside_width = function(){
13207				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13208				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13209				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13210				$inside_row = $('> .row-parent', $vc_row);
13211				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
13212					sidew = $sidebar.width();
13213					$inside_row.css({
13214						width: sidew
13215					});
13216				} else {
13217					$inside_row.css({
13218						width: ''
13219					});
13220				}
13221			};
13222			inside_width();
13223
13224			var ajax_sidebar_position = function(e, f_editor){
13225				$grid = $('.ajax-grid-system').eq(0);
13226				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13227				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13228				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13229				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13230				$inside_row = $('> .row-parent', $vc_row);
13231				scrollTop = $('html, body').scrollTop();
13232				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
13233					$grid.add($body).addClass('ajax-hide-filters');
13234					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
13235					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
13236					sidebar_overlay = true;
13237					$body.addClass('ajax-filter-sidebar-overlay');
13238					$sidebar_wrapper.addClass(skin);
13239					var sideHeadH = $side_header.outerHeight(),
13240						sideFooterH = $side_footer.outerHeight();
13241					if ( data_w !== '' && data_w > 0 ) {
13242						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
13243							$sidebar.css({
13244								'max-width': data_w
13245							});
13246						} else {
13247							$sidebar.css({
13248								'max-width':'none'
13249							});
13250						}
13251					}
13252					$vc_row.css({
13253						'padding-top':sideHeadH,
13254						'padding-bottom':sideFooterH
13255					});
13256					var sidew = $sidebar.width();
13257					$inside_row.css({
13258						width: sidew
13259					});
13260					switchMobile = true;
13261				} else {
13262					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
13263						scrollTop = $('html, body').scrollTop();
13264						$grid.add($body).removeClass('ajax-hide-filters');
13265					}
13266					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
13267						$grid.addClass('ajax-hide-filters-blanks');
13268						$sidebar.hide();
13269					}
13270					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
13271					$('.ajax-sidebar-placeholder', $grid).remove();
13272					sidebar_overlay = false;
13273					$body.removeClass('ajax-filter-sidebar-overlay');
13274					$sidebar_wrapper.removeClass(skin);
13275					if ( data_w !== '' && data_w > 0 ) {
13276						$sidebar.css({
13277							'max-width':'none'
13278						});
13279					}
13280					$vc_row.css({
13281						'padding-top':0,
13282						'padding-bottom':0,
13283					});
13284
13285					$inside_row.css({
13286						width: ''
13287					});
13288
13289					if ( f_editor === true ) {
13290						UNCODE.ajax_filters();
13291					}
13292
13293					switchMobile = false;
13294				}
13295				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13296					$('html, body').scrollTop(scrollTop);
13297				}
13298			};
13299
13300			var sidebar_width = function(){
13301				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13302					sidebar_w = $footprint.width();
13303					$sidebar.css({ width: sidebar_w });
13304				} else {
13305					$sidebar.css({ width: '' });
13306				}
13307			};
13308			sidebar_width();
13309
13310			if ( SiteParameters.is_frontend_editor ) {
13311				ajax_sidebar_position();
13312			}
13313
13314			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
13315				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
13316					ajax_sidebar_position(e);
13317				}
13318				sidebar_width();
13319			});
13320
13321			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
13322				ajax_sidebar_position(e, true);
13323			});
13324
13325			$isotope_wrapper.on('transitionend', function(e){
13326				if ( $(e.target).hasClass('isotope-wrapper') ) {
13327					window.dispatchEvent(new CustomEvent('boxResized'));
13328				}
13329				return false;
13330			});
13331
13332			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
13333				var $grid = $('.ajax-grid-system').eq(0);
13334				$grid.addClass('ajax-hide-filters');
13335			}
13336
13337		});
13338	};
13339
13340	init_ajax_grid();
13341	$(document).on('uncode-ajax-filtered', init_ajax_grid);
13342
13343/*************************
13344 *
13345 * Hover hack
13346 *
13347 ************************/
13348 	var widget_hover_hack = function() {
13349 		$('.widget, .uncode_widget').each(function(){
13350			var $widget = $(this),
13351				class_w = $widget.attr('class'),
13352				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
13353				$footer = $widget.closest('#colophon');
13354
13355			if ( class_w.indexOf('widget_yith') > 0 ) {
13356				return true;
13357			}
13358
13359			$lis.each(function(){
13360 				var $li = $(this),
13361 					$a = $('a', $li),
13362 					$label = $a.closest('label');
13363
13364				if ( !$footer.length ) {
13365					$li.addClass('no-evts');
13366				}
13367
13368				if ( ! $('span', $a).length ) {
13369 					$li.addClass( 'li-hover' );
13370 				}
13371
13372 				$('li', $li).hover(function(e){
13373 					$(e.target).parents('li').each(function(){
13374 						$(this).addClass( 'parent-li-hover' );
13375 					});
13376					}, function (e) {
13377 					$(e.target).parents('li').each(function(key, val){
13378 						if ( key === 0) {
13379	 						$(val).removeClass( 'parent-li-hover' );
13380	 					}
13381 					});
13382 				});
13383
13384				$li.off('mouseup').on('mouseup', function (e) {
13385					if (e.which !== 3) {
13386						e.stopPropagation();
13387						var $a = $('a', this).first();
13388						$a[0].click();
13389					}
13390	 			});
13391 			});
13392 		});
13393	  }
13394
13395	var ajax_filters_button_mode = $('body').hasClass('ajax-filters-button-mode');
13396
13397	if (!ajax_filters_button_mode && SiteParameters.disable_hover_hack !== '1') {
13398		widget_hover_hack();
13399		$(document).on('uncode-ajax-filtered', widget_hover_hack);
13400	}
13401
13402/*************************
13403 *
13404 * Init Filters
13405 *
13406 ************************/
13407
13408	function init_filters() {
13409		$(document).on('click', '.term-filter-link', function(e) {
13410			var _this = $(this);
13411			var widget = _this.closest('.uncode_widget');
13412			var container = get_filters_container();
13413
13414			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13415				return true;
13416			}
13417
13418			e.preventDefault();
13419
13420			if (widget.hasClass('widget-ajax-filters--checkbox')) {
13421				_this.parent().find('input[type="checkbox"]').trigger('click');
13422			} else {
13423				if (_this.hasClass('term-filter-link--active')) {
13424					_this.removeClass('term-filter-link--active');
13425				} else {
13426					_this.addClass('term-filter-link--active');
13427
13428					if (widget.hasClass('widget-ajax-filters--single')) {
13429						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
13430					}
13431				}
13432
13433				if (!ajax_filters_button_mode) {
13434					var url = _this.attr('href');
13435
13436					reload_items(container, url, true);
13437				}
13438			}
13439		});
13440
13441		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
13442			var _this = $(this);
13443			var widget = _this.closest('.uncode_widget');
13444			var link = _this.closest('.term-filter').find('.term-filter-link');
13445			var url = link.attr('href');
13446			var container = get_filters_container();
13447
13448			if (!ajax_filters_button_mode && widget.hasClass('widget-ajax-filters--no-ajax')) {
13449				window.location = url;
13450				return;
13451			}
13452
13453			if (widget.hasClass('widget-ajax-filters--single')) {
13454				widget.find('input[type="checkbox"]').each(function() {
13455					if (_this.attr('id') !== $(this).attr('id')) {
13456						$(this).prop('checked', false);
13457						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
13458					}
13459				});
13460			}
13461
13462			if (_this.prop('checked')) {
13463				link.addClass('term-filter-link--active');
13464			} else {
13465				link.removeClass('term-filter-link--active');
13466			}
13467
13468			if (!ajax_filters_button_mode) {
13469				reload_items(container, url, true);
13470			}
13471		});
13472
13473		$(document).on('change', 'select.select--term-filters', function(e) {
13474			var _this = $(this);
13475			var selected = _this.find('option:selected');
13476			var option = $(selected);
13477			var url = option.attr('data-term-filter-url');
13478			var container = get_filters_container();
13479			var widget = _this.closest('.uncode_widget');
13480
13481			if (!ajax_filters_button_mode) {
13482				if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13483					window.location = url;
13484				} else {
13485					reload_items(container, url, true);
13486				}
13487			}
13488		});
13489
13490		$(document).on('click', '.filter-list__link', function(e) {
13491			if (SiteParameters.is_frontend_editor) {
13492				return false;
13493			}
13494
13495			e.preventDefault();
13496
13497			var _this = $(this);
13498			var container = get_filters_container();
13499			var url = _this.attr('href');
13500			reload_items(container, url, true);
13501		});
13502
13503		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
13504			var _this = $(this);
13505			var container = get_filters_container();
13506			var url = _this.attr('href');
13507			reload_items(container, url, true);
13508		});
13509
13510		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
13511
13512			var _this = $(this);
13513			var container = get_filters_container();
13514			var url = _this.attr('href');
13515
13516			if ( container.length ) {
13517				e.preventDefault();
13518				reload_items(container, url, true);
13519			}
13520		});
13521
13522		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
13523			var _this = $(this);
13524			var container = get_filters_container();
13525
13526			if (container.length > 0) {
13527				e.preventDefault();
13528
13529				var min_price = $('#min_price').val();
13530				var max_price = $('#max_price').val();
13531				var location = window.location;
13532				var url = location.href;
13533				var page_uri = location.origin + location.pathname;
13534				var is_filtered = page_uri !== url;
13535
13536				if (is_filtered) {
13537					url = remove_parameter_from_url(url, 'min_price');
13538					url = remove_parameter_from_url(url, 'max_price');
13539				}
13540
13541				var concat = page_uri === url ? '?' : '&';
13542				var params = {'min_price': min_price, 'max_price': max_price};
13543
13544				url = url + concat + $.param(params);
13545
13546				reload_items(container, url, true);
13547			}
13548		});
13549
13550		var search_timer;
13551
13552		if (!ajax_filters_button_mode) {
13553			$(document).on('keyup', '.term-filters-search-input', function (e) {
13554				var _this = $(this);
13555				var container = get_filters_container();
13556				var value = _this.val();
13557
13558				if (search_timer) {
13559					clearTimeout(search_timer);
13560				}
13561
13562				search_timer = setTimeout(function () {
13563					update_search_url(container, value);
13564				}, 500);
13565			});
13566		}
13567
13568		$(document).on('click', '.btn-ajax-filters-trigger', function (e) {
13569			var container = get_filters_container();
13570
13571			if (container.length) {
13572				e.preventDefault();
13573				var paramMap = {};
13574
13575				$('.term-filter-link--active').each(function () {
13576					collect_from_query(paramMap, this.href.split('?')[1] || '');
13577				});
13578
13579				$('.select--term-filters').each(function () {
13580					var select = $(this);
13581					var val = select.val();
13582
13583					if (!val) {
13584						return
13585					};
13586
13587					var selected_option = select.find('option:selected');
13588					var qUrl = selected_option.data('term-filter-url') || '';
13589
13590					collect_from_query(paramMap, qUrl.split('?')[1] || '');
13591				});
13592
13593				var search = $('.term-filters-search-input');
13594
13595				if (search.length > 0) {
13596					var search_value = search.val().trim();
13597					if (search_value) {
13598						paramMap[SiteParameters.ajax_filter_key_search] = {};
13599						paramMap[SiteParameters.ajax_filter_key_search][search_value] = 1;
13600					}
13601				}
13602
13603				var qsParts = [];
13604				$.each(paramMap, function (key, valSet) {
13605					var vals = Object.keys(valSet);
13606					qsParts.push(key + '=' + vals.join(','));
13607				});
13608
13609				var final_url = window.location.origin + window.location.pathname;
13610
13611				if (qsParts.length > 0) {
13612					qsParts.push('unfilter=1');
13613
13614					var qs = qsParts.join('&');
13615					final_url = '?' + qs;
13616				}
13617
13618				reload_items(container, final_url, true);
13619			}
13620		});
13621	}
13622
13623	function collect_from_query(paramMap, query) {
13624		$.each(query.split('&'), function (_, pair) {
13625			if (!pair) {
13626				return
13627			};
13628
13629			var kv  = pair.split('=');
13630			var key = kv[0];
13631			var val = kv[1] || '';
13632
13633			if (key === 'unfilter') {
13634				return;
13635			}
13636			if (!paramMap[key]) {
13637				paramMap[key] = {}
13638			};
13639
13640			paramMap[key][val] = 1;
13641		});
13642	}
13643
13644	function update_search_url(container, search_value) {
13645		var location = window.location;
13646		var url = location.href;
13647		var page_uri = location.origin + location.pathname;
13648		var is_filtered = page_uri !== url;
13649		var key_search = SiteParameters.ajax_filter_key_search;
13650		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
13651
13652		if (is_filtered) {
13653			url = remove_parameter_from_url(url, key_search);
13654			url = remove_parameter_from_url(url, key_unfilter);
13655		}
13656
13657		if (search_value) {
13658			var concat = page_uri === url ? '?' : '&';
13659			var params = {};
13660
13661			params[key_search] = search_value;
13662			params[key_unfilter] = 1;
13663			url = url + concat + $.param(params);
13664		} else {
13665			url = remove_parameter_from_url(url, key_search);
13666		}
13667
13668		reload_items(container, url, true);
13669	}
13670
13671	function remove_parameter_from_url(url, parameter) {
13672		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
13673	}
13674
13675	function get_filters_container() {
13676		var container = $('.ajax-grid-system');
13677
13678		if (container.length == 0) {
13679			container = $('.ajax-filters');
13680		}
13681
13682		if (container.length == 0) {
13683			container = $('.ajax-filters-target');
13684		}
13685
13686		return container;
13687	}
13688
13689	function update_widgets_state(widgets_states, container) {
13690		for (var i = widgets_states.length - 1; i >= 0; i--) {
13691			var state = widgets_states[i];
13692
13693			if (!state.collapse) {
13694				continue;
13695			}
13696
13697			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
13698
13699			if (state.open) {
13700				new_widget.find('.widget-title').addClass('open');
13701				if (state.css) {
13702					new_widget.find('.widget-collapse-content').attr('style', state.css);
13703				}
13704			} else {
13705				new_widget.find('.widget-title').removeClass('open');
13706				if (state.css) {
13707					new_widget.find('.widget-collapse-content').attr('style', state.css);
13708				}
13709			}
13710		}
13711	}
13712
13713	// Find filters container
13714	function find_filters_container(context) {
13715		return context.find('.widget-ajax-filters').closest('.row-parent').find('.uncol').first();
13716	}
13717
13718	// Reload items via AJAX
13719	function reload_items(container, url, push) {
13720		if (isAjaxing) {
13721			return
13722		};
13723
13724		isAjaxing = true;
13725
13726		container.addClass('grid-filtering');
13727
13728		$.ajax({
13729			url     : url,
13730			success : function(response) {
13731				if (!response) {
13732					return;
13733				}
13734
13735				$(document).trigger('uncode-ajax-pre-filtered');
13736
13737				var container_id = container.attr('id');
13738				var pagination = $('.row-navigation');
13739				var filters_container;
13740
13741				var isTargetFilterMode = container.hasClass('ajax-filters-target');
13742
13743				if (isTargetFilterMode) {
13744					filters_container = find_filters_container($(document));
13745				}
13746
13747				if (container_id) {
13748					var container_to_append = $(response).find('#' + container_id);
13749					var pagination_to_append = $(response).find('.row-navigation');
13750					var filters_to_append;
13751					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
13752
13753					if (isTargetFilterMode) {
13754						filters_to_append = find_filters_container($(response));
13755					}
13756
13757					// Remember open/closed widgets
13758					var widgets = $('.uncode_widget');
13759					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
13760					var widgets_states = [];
13761
13762					widgets.each(function() {
13763						var widget = $(this);
13764						var id = widget.attr('data-id');
13765						var state = {
13766							'id': id,
13767							'collapse': false,
13768							'open': false,
13769							'css': false,
13770						};
13771
13772						var collapse_wrapper = widget.find('.widget-collapse-content');
13773
13774						if (collapse_wrapper.length > 0) {
13775							state.collapse = true;
13776
13777							var collapse_wrapper_css = collapse_wrapper.attr('style');
13778							var title = widget.find('.widget-title');
13779
13780							state.css = collapse_wrapper_css;
13781
13782							if (title.hasClass('open')) {
13783								state.open = true;
13784							} else {
13785								state.open = false;
13786							}
13787						}
13788
13789						widgets_states.push(state);
13790					});
13791
13792					// Update widgets state when it is not in target mode
13793					if (! isTargetFilterMode && offcanvas_sidebar_wrapper.length === 0) {
13794						update_widgets_state(widgets_states, container_to_append);
13795					}
13796
13797					// Update default sidebar state
13798					if (!container.hasClass('ajax-hide-filters')) {
13799						container_to_append.removeClass('ajax-hide-filters');
13800					}
13801
13802					// Update horizontal sidebar
13803					if (!container.hasClass('ajax-hide-filters-blanks')) {
13804						container_to_append.removeClass('ajax-hide-filters-blanks');
13805					}
13806					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
13807					if (horizontal_sidebar_wrapper.length > 0) {
13808						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
13809						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
13810						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
13811						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
13812
13813						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
13814						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
13815					}
13816
13817					// Append container
13818					container.replaceWith(container_to_append);
13819
13820					// Hide first thumbnail until the new srcset is loaded
13821					if (SiteParameters.dynamic_srcset_active === '1') {
13822						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
13823					}
13824
13825					// Remove loading attribute to images
13826					container_to_append.find('img').attr('loading', '');
13827
13828					// Append pagination
13829					if (pagination.length > 0) {
13830						if (pagination_to_append.length > 0) {
13831							pagination.html(pagination_to_append.html());
13832						} else {
13833							pagination.html('');
13834						}
13835					} else {
13836						if (pagination_to_append.length > 0) {
13837							$('.post-wrapper').append(pagination_to_append);
13838						}
13839					}
13840
13841					// Append filters
13842					if (isTargetFilterMode && filters_container.length > 0) {
13843						filters_container.html(filters_to_append.html());
13844					}
13845
13846					// Update widgets state when it is in target mode
13847					if (isTargetFilterMode && filters_container.length > 0) {
13848						update_widgets_state(widgets_states, filters_container);
13849					}
13850
13851					// Update off canvas sidebar (mobile and overlay)
13852					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
13853
13854					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
13855						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
13856						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
13857						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
13858						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
13859
13860						// Update widgets state
13861						update_widgets_state(widgets_states, sidebar_to_append);
13862
13863						// Update sidebar
13864						sidebar_container.html(sidebar_to_append.html());
13865					}
13866
13867					if (push) {
13868						UNCODE.lastURL = url;
13869						window.history.pushState(
13870							{ pageTitle: document.title },
13871							'',
13872							url
13873						);
13874					}
13875
13876					if (typeof UNCODE.isotopeLayout !== 'undefined') {
13877						UNCODE.isotopeLayout();
13878					}
13879					if (typeof UNCODE.justifiedGallery !== 'undefined') {
13880						UNCODE.justifiedGallery();
13881					}
13882					if (typeof UNCODE.cssGrid !== 'undefined') {
13883						UNCODE.cssGrid();
13884					}
13885					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
13886						UNCODE.lightbox();
13887					}
13888					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
13889						UNCODE.lightgallery();
13890					}
13891					if (typeof UNCODE.carousel !== 'undefined') {
13892						UNCODE.carousel($('body'));
13893					}
13894					UNCODE.animations();
13895					if (typeof UNCODE.filters !== 'undefined') {
13896						UNCODE.filters();
13897					}
13898					if (typeof UNCODE.widgets !== 'undefined') {
13899						UNCODE.widgets();
13900					}
13901
13902					if (SiteParameters.dynamic_srcset_active === '1') {
13903						UNCODE.refresh_dynamic_srcset_size();
13904					}
13905
13906					if (typeof UNCODE.menuSmartInit !== 'undefined') {
13907						UNCODE.menuSmartInit();
13908					}
13909
13910					if (typeof UNCODE.parallax !== 'undefined') {
13911						UNCODE.parallax();
13912					}
13913
13914					maybe_scroll_to_top();
13915
13916					var woo_select2_cats = $('.dropdown_product_cat');
13917
13918					if (woo_select2_cats.length > 0) {
13919						woo_select2_cats.on( 'change', function() {
13920							if ( $(this).val() != '' ) {
13921								var this_page = '';
13922								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
13923								if ( home_url.indexOf( '?' ) > 0 ) {
13924									this_page = home_url + '&product_cat=' + $(this).val();
13925								} else {
13926									this_page = home_url + '?product_cat=' + $(this).val();
13927								}
13928								location.href = this_page;
13929							} else {
13930								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
13931							}
13932						});
13933
13934						if ( $().selectWoo ) {
13935							var wc_product_cat_select = function() {
13936								woo_select2_cats.selectWoo( {
13937									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
13938									minimumResultsForSearch: 5,
13939									width: '100%',
13940									allowClear: true,
13941									language: {
13942										noResults: function() {
13943											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
13944										}
13945									}
13946								} );
13947							};
13948							wc_product_cat_select();
13949						}
13950					}
13951
13952					$(document).trigger('uncode-ajax-filtered');
13953					$(document.body).trigger('init_price_filter');
13954					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
13955					window.document.dispatchEvent(new Event("DOMContentLoaded", {
13956						bubbles: true,
13957						cancelable: true
13958					}));
13959
13960					isAjaxing = false;
13961				}
13962			},
13963			error: function() {
13964				container.removeClass('grid-filtering');
13965
13966				isAjaxing = false;
13967
13968				if (SiteParameters.enable_debug == true) {
13969					// This console log is disabled by default
13970					// So nothing is printed in a typical installation
13971					//
13972					// It can be enabled for debugging purposes setting
13973					// the 'uncode_enable_debug_on_js_scripts' filter to true
13974					console.log('There was an error retrieving the products');
13975				}
13976			}
13977		});
13978	}
13979
13980	// Scroll to top after filtering
13981	function maybe_scroll_to_top() {
13982		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
13983
13984		if (offcanvas_sidebar_wrapper.length > 0) {
13985			return;
13986		}
13987
13988		var container = get_filters_container();
13989		var bound = container[0].getBoundingClientRect();
13990
13991		if (bound.y < 0) {
13992			$(window).scrollTop(container.offset().top);
13993		}
13994	}
13995
13996	// Back/forward browser buttons
13997	$(window).on("popstate.ajaxfilters", function(e) {
13998		var location = window.location;
13999		var url = location.href;
14000		var params = UNCODE.getURLParams(window.location);
14001		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
14002
14003		UNCODE.lastURL = url;
14004
14005		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
14006			return;
14007		}
14008
14009		var container = get_filters_container();
14010
14011		reload_items(container, url, false);
14012	});
14013
14014	// Destroy load more before to init a new one
14015	$(window).on('uncode-ajax-pre-filtered', function() {
14016		if ($.fn.infinitescroll) {
14017			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
14018		}
14019	});
14020
14021	init_filters();
14022};
14023
14024UNCODE.videoThumbs = function() {
14025	var checkResize,
14026		newW = UNCODE.wwidth;
14027	var checkForVideos = function(){
14028
14029		$(window).on('okevents.y.change', function(e, y){
14030			var $video = $(y.target.g),
14031				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14032				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14033				restart = !$video_wrap.hasClass('play-pause'),
14034				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14035				setTime;
14036			if ( newW >= UNCODE.mediaQuery ) {
14037
14038				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
14039					$video_wrap.data('hovered', true);
14040					$video_wrap.addClass('played-on');
14041					y.target.pauseVideo();
14042					$tmb.on('mouseenter', function(){
14043						if ( restart ) {
14044							y.target.seekTo(0);
14045						}
14046						y.target.playVideo();
14047					}).on('mouseleave', function(){
14048						clearTimeout(setTime);
14049						setTime = setTimeout(function(){
14050							y.target.pauseVideo();
14051						}, 300);
14052					});
14053				}
14054
14055			} else {
14056				if( $mobile_video_wrap.length ) {
14057					$video_wrap.addClass('played-on');
14058					y.target.playVideo();
14059				}
14060			}
14061
14062		});
14063
14064		$(window).on('okevents.v.loaded', function(e, playerV){
14065			var $video = $(playerV.element),
14066				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14067				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14068				restart = !$video_wrap.hasClass('play-pause'),
14069				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
14069: $video.closest('.t-entry-visual, .un-inline-image'),
14070				setTime;
14071
14072			if ( newW >= UNCODE.mediaQuery ) {
14073				
14074				if( $video_wrap.length ) {
14075
14076					var playPromise = playerV.play();
14077					if (playPromise !== undefined) {
14078						playPromise.then(function( value ) {
14079							playerV.pause();
14080						});
14081					}
14082					$video_wrap.addClass('played-on');
14083					$tmb.on('mouseenter', function(){
14084						if ( restart ) {
14085							playerV.setCurrentTime(0)
14086						}
14087						playerV.play();
14088					}).on('mouseleave', function(){
14089						clearTimeout(setTime);
14090						setTime = setTimeout(function(){
14091							playerV.pause();
14092						}, 300);
14093					});
14094				}
14095
14096			} else {
14097
14098				if( $mobile_video_wrap.length ) {
14099					var playPromise = playerV.play();
14100					if (playPromise !== undefined) {
14101						playPromise.then(function( value ) {
14102							playerV.play();
14103						});
14104					}
14105					$video_wrap.addClass('played-on');
14106				}
14107			}
14108		});
14109
14110		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
14111			var $video = $(video),
14112				$noscript = $('noscript', $video),
14113				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
14114				restart = !$video_wrap.hasClass('play-pause'),
14115				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
14116				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
14117				setTime,
14118			manageVideo = function(){
14119				video.currentTime = 0;
14120				video.pause();
14121				if ( newW >= UNCODE.mediaQuery ) {
14122					if ( $video_wrap.length ) {
14123						$video_wrap.addClass('played-on');
14124						$tmb.on('mouseenter', function(){
14125							if ( restart ) {
14126								video.currentTime = 0;
14127							}
14128							video.play();
14129						}).on('mouseleave', function(){
14130							clearTimeout(setTime);
14131							setTime = setTimeout(function(){
14132								video.pause();
14133							}, 300);
14134						});
14135					} else {
14136						video.play();
14137					}
14138				} else {
14139					if ( $mobile_video_wrap.length ) {
14140						$mobile_video_wrap.addClass('played-on');
14141						video.play();
14142					}
14143				}
14144
14145			};
14146			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
14147				$noscript.each(function(key, val){
14148					$noscript.after(val.textContent || val.innerText || val.innerHTML);
14149					$noscript.remove();
14150				});
14151			}
14152
14153			if (typeof MediaElement === "function") {
14154				$video.has('source[src]').mediaelementplayer({
14155					pauseOtherPlayers: false,
14156				});
14157			}
14158			if (video.readyState > 0) {
14159				manageVideo();
14160			} else {
14161				$video.on("loadedmetadata", function(_event) {
14162					manageVideo();
14163				});
14164			};
14165		});
14166	
14167	};
14168	
14169	checkForVideos();
14170
14171	var checkVideoResize = function(){
14172		clearRequestTimeout(checkResize);
14173		checkResize = requestTimeout(function(){
14174			if ( newW !== UNCODE.wwidth ) {
14175				checkForVideos();
14176				newW = UNCODE.wwidth;
14177			}
14178		}, 1000);
14179	};
14180
14181	$(window).off('resize.videos', checkVideoResize)
14182	.on( 'resize.videos', checkVideoResize);
14183
14184	$(window).off('more-items-loaded.videos', checkForVideos)
14185	.on('more-items-loaded.videos', checkForVideos);
14186
14187	$(document).off('uncode-ajax-filtered.videos', checkForVideos)
14188	.on('uncode-ajax-filtered.videos', checkForVideos);
14189
14190};
14191UNCODE.inlineImgs = function() {
14192    var linkInlineImgs = function(){
14193        $('.un-inline-image').each(function(){
14194            var $img = $(this),
14195                href = $(this).attr('data-link-href'),
14196                dataImg = $img.data();
14197			if ( dataImg != '' && href != null && href !== '' ) {
14198                var class_stra_a = 'unline-image-link';
14199                if ( $(this).hasClass('un-inline-space-over') ) {
14200                    class_stra_a += ' un-inline-space-over';
14201                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
14202                    class_stra_a += ' un-inline-space-gutter';
14203                }
14204                var str_a = '<a class="' + class_stra_a + '" ';
14205                for (var key in dataImg) {
14206                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
14207                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
14208                    }
14209                }
14210                str_a += ' />';
14211                $img.wrap(str_a);
14212			}
14213        });
14214    };
14215    $(window).on('load', linkInlineImgs );
14216};
14217UNCODE.lottie = function() {
14218    if ( SiteParameters.is_frontend_editor ) {
14219        var $lottie_wraps = $('div.uncode-lottie-wrap');
14220        $lottie_wraps.each(function(){
14221            var $lottie_wrap = $(this),
14222                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
14223                $player_clone = $div_player.clone(),
14224                player_id = $div_player.attr('data-id'),
14225                $lottie_players = $('lottie-player', $lottie_wrap).remove();
14226            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
14227                if ( $('#'+player_id).length ) {
14228                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
14229                }
14230                $player_clone.attr('id', player_id);
14231                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
14232                $div_player.after($player_clone);
14233                $div_player.attr('data-init',true);
14234            }
14235        });
14236    }
14237    var $players = $('.uncode-lottie-wrap lottie-player');
14238    $players.each(function(){
14239        var player = this,
14240            this_id = $(player).attr('id'),
14241            _player = document.getElementById(this_id),
14242            trigger = $(player).attr('data-trigger'),
14243            pFrames = $(player).attr('data-frames').split(','),
14244            srcPlayer = $(player).attr('src');
14245
14246        _player.load(srcPlayer);
14247
14248        _player.addEventListener("ready", function() {
14249
14250            var $_shadow = _player.shadowRoot;
14251            $($_shadow).find('.error').remove();
14252
14253            var tFrames = _player.getLottie().totalFrames / 100,
14254                pFrame_from = Math.round(tFrames * pFrames[0]),
14255                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
14256                loop = $(player).attr('loop'),
14257                mode,
14258                actions;
14259
14260            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
14261                if ( trigger === 'scroll' ) {
14262                    mode = 'scroll';
14263                    actions = [
14264                        {
14265                            visibility:[0, 1.0],
14266                            type: "seek",
14267                            frames: [pFrame_from, pFrame_to],
14268                        }
14269                    ];
14270                } else if ( trigger === 'viewport') {
14271                    mode = 'scroll';
14272                    actions = [
14273                        {
14274                            visibility: [0.20, 1.0],
14275                            frames: [pFrame_from, pFrame_to],
14276                            type: loop ? "loop" : "play"
14277                        }
14278                    ];
14279                } else if ( trigger === 'hover') {
14280                    $(player).on('mouseenter', function(){
14281                        _player.play();
14282                    }).on('mouseleave', function(){
14283                        _player.pause();
14284                    });
14285                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
14286                        _player.seek(pFrame_from);
14287                        _player.addEventListener("frame", function(){
14288                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
14289                                _player.seek(pFrame_from);
14290                            }
14291                        });
14292                    }
14293                }
14294                LottieInteractivity.create({
14295                    player: '#' + this_id,
14296                    mode: mode,
14297                    actions: actions
14298                });
14299            } else {
14300                if ( pFrame_from > 0 && pFrame_from < 99 ) {
14301                    _player.seek(pFrame_from);
14302                    _player.addEventListener("frame", function(){
14303                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
14304                            _player.seek(pFrame_from);
14305                        }
14306                    });
14307                }
14308            }
14309        });
14310
14311        $(window).on('unlottie-destroy', function(){
14312            _player.destroy();
14313        });
14314    });
14315};
14316
14317UNCODE.animatedBgGradient = function( _el ) {
14318
14319    var ev;
14320
14321	if ( typeof _el === 'undefined' || _el === null ) {
14322        _el = document;
14323        ev = false;
14324	} else {
14325        _el = _el[0];
14326        ev = 'shortcode:update';
14327    }
14328
14329    var simplex = new SimplexNoise();
14330
14331    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
14332		this.block = blockOverlay;
14333		this.wrap = canvasWrap;
14334		this.config();
14335		this.checker();
14336		this.loopRAF();
14337        this.animLoader();
14338    };
14339
14340    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
14341
14342    AnimGradient.config = function() {
14343        this.canvas = document.createElement('canvas');
14344        this.wrap.appendChild(this.canvas);
14345        this.ctx = this.canvas.getContext('2d');
14346        this.count = 0;        
14347        this.isOrientationChanged = false;
14348        this.res = UNCODE.isMobile ? 90 : 110;
14349        this.resPercent = 100/this.res;
14350        this.resAround = this.resPercent/100;
14351        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;
14352
14353        this.canvas.classList.add('uncode-bg-animated-gradient');
14354        this.canvas.setAttribute('height', this.res);
14355        this.canvas.setAttribute('width', this.res);
14356        this.canvas.style = 'height: 100%; position: relative; width:100%;';
14357
14358        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
14359
14360        this.cx = this.canvas.width/2;
14361        this.cy = this.canvas.height/2;
14362        this.data = this.imgdata.data;
14363
14364        this.opts = {
14365            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,
14366            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,
14367            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
14368        };
14369
14370        this.lavaTime = 1;
14371        this.bg_colors = [];
14372
14373        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
14374            return;
14375        }
14376
14377        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
14378            this.singleColor = true;
14379        }
14380
14381        if( this.opts.col_1st ) {
14382
14383            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
14384
14385            this.bg_colors.push({
14386                r: rgbColor1.r,
14387                g: rgbColor1.g,
14388                b: rgbColor1.b
14389            });
14390        }
14391
14392        if( this.opts.col_2nd ) {
14393
14394            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
14395
14396            this.bg_colors.push({
14397                r: rgbColor2.r,
14398                g: rgbColor2.g,
14399                b: rgbColor2.b
14400            });
14401        }
14402
14403    };
14404
14405    AnimGradient.checker = function() {
14406        var scope = this;
14407        this.checkInViewPort();
14408      
14409        window.addEventListener('resize', function() {
14410            if(UNCODE.isMobile && !scope.isOrientationChanged) {
14411                return;
14412            }
14413            scope.ratioCalc();
14414        });
14415
14416        window.addEventListener("orientationchange", function() {
14417            scope.isOrientationChanged = true;
14418        });
14419
14420        this.ratioCalc();
14421    }; 
14422
14423    AnimGradient.ratioCalc = function() {
14424      
14425        var blockW = this.block.clientWidth,
14426            blockH = this.block.clientHeight;
14427
14428        var blockRatio = blockH/blockW;
14429
14430        if(blockRatio < 1) {
14431            this.ratioParam = {
14432                x: 1.4,
14433                y: blockRatio*1.4
14434            }
14435        } else {
14436            this.ratioParam = {
14437                x: blockRatio/3,
14438                y: 1
14439            }
14440        }
14441         
14442    };
14443
14444    AnimGradient.checkInViewPort = function() {
14445		if( 'IntersectionObserver' in window ) {
14446		    var scope = this,
14447                observer = new IntersectionObserver(function(entries) {
14448  
14449                entries.forEach(function(entry){
14450                    if ( entry.isIntersecting ) {
14451                        scope.isInViewport = true;
14452                    } else {
14453                        scope.isInViewport = false;
14454                    }
14455                });
14456  
14457		    }, { 
14458			root: document,
14459		  });
14460  
14461		  observer.observe(this.block);
14462		}
14463	};
14464	
14465    AnimGradient.hexToRGB = function(hexval) {
14466        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
14467        if (!hexecuted) {
14468            return false;
14469        }
14470        return {
14471            r: parseInt(hexecuted[1], 16),
14472            g: parseInt(hexecuted[2], 16),
14473            b: parseInt(hexecuted[3], 16)
14474        }
14475    };
14476
14477    AnimGradient.factor = function(val_1, val_2, lava) { 
14478        return val_1 * (1 - lava) + val_2 * lava;
14479    };
14480
14481    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
14482        if (this.singleColor) {
14483            return this.bg_colors[0][wave_l];
14484        }
14485        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 );
14486        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
14487    };
14488
14489    AnimGradient.lava = function(x, y, grade) {
14490        var radians = (Math.PI / 180) * grade,
14491        cos = Math.cos(radians),
14492        sin = Math.sin(radians),
14493        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
14494        return nx;
14495    };
14496    
14497    AnimGradient.loopRAF = function() {
14498
14499      var scope = this;
14500
14501        if( this.isInViewport ) {
14502            for (var x = 0; x < this.res; x++) {
14503                for (var y = 0; y < this.res; y++) {
14504                    
14505                    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
14506        
14507                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
14508                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
14509                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
14510                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
14511                  
14512                }
14513            }
14514   
14515            this.count++;
14516          
14517            this.ctx.putImageData(this.imgdata, 0, 0);
14518         
14519        }
14520
14521        requestAnimationFrame(function() {
14522            scope.loopRAF();
14523        });
14524    };
14525
14526    AnimGradient.animLoader = function() {
14527        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
14528    };
14529
14530    var anim_init = function() {
14531        var bgs = _el.querySelectorAll('.block-bg-overlay');
14532      
14533        bgs.forEach(function(blockOverlay) {
14534            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
14535            if( !blockOverlay || !canvasWrap ) {
14536                return;
14537            }
14538            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
14539        });
14540    }
14541
14542    $(window).on('load', function(){
14543        anim_init();
14544    });
14545
14546    if ( ev === 'shortcode:update' ) {
14547        anim_init();
14548    }
14549
14550};
14551UNCODE.multibg = function(){
14552	var $bgsWraps = $('.uncode-multi-bgs'),
14553		$body = $('body');
14554	$bgsWraps.each(function(){
14555		var $bgWrap = $(this),
14556			transition = $bgWrap.attr('data-transition'),
14557			transitionTime = $bgWrap.attr('data-transition-time'),
14558			dataPace = $bgWrap.attr('data-transition-pace'),
14559			dataThreshold = $bgWrap.attr('data-transition-threshold'),
14560			dataTime = $bgWrap.attr('data-carousel-time'),
14561			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
14562			random = $bgWrap.attr('data-multi-random'),
14563			_bgWrap = $bgWrap[0],
14564			$multiBgs = $('.multi-background', $bgWrap),
14565			imgFirst,
14566			bgAmount = $multiBgs.length,
14567			isInViewport = false,
14568			lastScrollTop = 0,
14569			counter = 0,
14570			totMove = 0,
14571			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
14572			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
14573			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
14574			offX, offY,
14575			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
14576			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
14577			requestCarousel,
14578			is_header = $bgWrap.closest('#page-header').length,
14579			startTime = new Date();
14580
14581		transition = typeof transition === 'undefined' ? '' : transition;
14582
14583		if ( random === 'true' ) {
14584			UNCODE.shuffle($multiBgs);
14585		}
14586
14587		$multiBgs.find('.background-inner').attr('data-active','false');
14588
14589		imgFirst = $multiBgs.first().find('.background-inner').attr('data-active','true').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
14590
14591		var loadFirst = function(){
14592			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
14593				opacity: 1
14594			}, 250, 'easeInQuad').css({
14595				zIndex: 1
14596			});	
14597		}
14598
14599		var loadError = function(){
14600			console.log('Multi BG loading error');
14601		}
14602
14603		UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
14604
14605		var loadSlides = function( $thisBg ){
14606			$thisBg.attr('data-load', 'loaded');	
14607		}
14608
14609		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
14610			var $thisBg = $(val);
14611
14612			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
14613
14614				var _imgBg = $(val).find('.background-inner').css('background-image');
14615
14616				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
14617					$thisBg.attr('data-load', 'loaded');
14618				} else {
14619					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
14620					if ( typeof _imgBg !== 'undefined' ) {
14621						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
14622					}
14623				}
14624			}
14625		});
14626					
14627		var multiCarousel = function(e) {
14628
14629			clearRequestTimeout(requestCarousel);
14630
14631			var checkTime = new Date();
14632			if ( checkTime - startTime >= carouselTime && isInViewport ) {
14633				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
14634
14635				if ( $checkEl.attr('data-load') !== 'loaded' ) {
14636					requestTimeout(function(){
14637						multiCarousel();
14638					}, 100);
14639					return;
14640				}
14641
14642				counter++;
14643
14644				$multiBgs.each(function(ind, val){
14645					if ( ind === counter%bgAmount ) {
14646						$(val).stop(true,false).animate({
14647							opacity: 1
14648						}, wait, 'easeInQuad').css({
14649							zIndex: 1
14650						}).find('.background-inner').attr('data-active','true');
14651					} else {
14652						$(val).stop(true,false).animate({
14653							opacity: 0
14654						}, wait, 'easeInQuad', function(){
14655							console.log('check1', $(val));
14656							$(val).find('.background-inner').attr('data-active','false');
14657						}).css({
14658							zIndex: 0
14659						});
14660					}
14661				});
14662
14663			}
14664
14665			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
14666				requestCarousel = requestTimeout(multiCarousel, carouselTime);
14667			}
14668	
14669		};
14670
14671		var multiMove = function(e) {
14672			if ( $body.hasClass('navbar-hover') ) {
14673				return;
14674			}
14675			var checkTime = new Date(),
14676                bound = $bgWrap[0].getBoundingClientRect(),
14677                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
14678			if (offX) {
14679				totMove += Math.sqrt(
14680					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
14681				);
14682			}
14683			if (
14684                totMove >= pace && 
14685                checkTime - startTime >= wait &&
14686                e.clientX <= (bound.left + bound.width) &&
14687                e.clientX >= bound.left &&
14688                e.clientY <= (bound.top + bound.height) &&
14689                e.clientY >= bound.top
14690            ) {
14691				counter++;
14692				startTime = checkTime;
14693				$multiBgs.each(function(ind, val){
14694					if ( ind === counter%bgAmount ) {
14695						$(val).stop(true,false).animate({
14696							opacity: 1
14697						}, wait, 'easeInQuad').css({
14698							zIndex: 1
14699						}).find('.background-inner').attr('data-active','true');
14700					} else {
14701						$(val).stop(true,false).animate({
14702							opacity: 0
14703						}, wait, 'easeInQuad', function(){
14704							console.log('check2', $(val));
14705							$(val).find('.background-inner').attr('data-active','false');
14706						}).css({
14707							zIndex: 0
14708						});
14709					}
14710				});
14711
14712				totMove = 0;
14713			}
14714			
14715			offX = e.clientX;
14716			offY = e.clientY;
14717			
14718		};
14719
14720		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
14721			document.addEventListener("mousemove", multiMove);
14722		}
14723
14724		window.addEventListener('resize', function() {
14725			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
14726				document.removeEventListener("mousemove", multiMove);
14727				document.addEventListener("mousemove", multiMove);
14728			}
14729		});
14730
14731		var lightLoopRAF = function() {
14732
14733			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
14734				checkTime = new Date(),
14735				bound = $bgWrap[0].getBoundingClientRect(),
14736				thresholdHeader = is_header ? 100 : threshold,
14737				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
14738			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
14739				counter++;
14740				lastScrollTop = scrollTop;
14741				startTime = checkTime;
14742
14743				$multiBgs.each(function(ind, val){
14744					if ( ind === counter%bgAmount ) {
14745						$(val).stop(true,false).animate({
14746							opacity: 1
14747						}, wait, 'easeInQuad').css({
14748							zIndex: 1
14749						}).find('.background-inner').attr('data-active','true');
14750					} else {
14751						$(val).stop(true,false).animate({
14752							opacity: 0
14753						}, wait, 'easeInQuad', function(){
14754							console.log('check3', $(val));
14755							$(val).find('.background-inner').attr('data-active','false');
14756						}).css({
14757							zIndex: 0
14758						});
14759					}
14760				});
14761
14762			}
14763
14764			requestAnimationFrame(function() {
14765				if ( isInViewport ) {
14766					lightLoopRAF();
14767				}
14768			});
14769		};
14770
14771		var currentInd = 0;
14772
14773		var loopRAF = function() {
14774
14775			var multiBgRotate = function(slideInd){
14776				currentInd = slideInd;
14777				$multiBgs.each(function(ind, val){
14778					if ( ind === slideInd ) {
14779						$(val).stop(true,false).animate({
14780							opacity: 1
14781						}, wait, 'easeInQuad').css({
14782							zIndex: 1
14783						}).find('.background-inner').attr('data-active','true');
14784					} else {
14785						$(val).stop(true,false).animate({
14786							opacity: 0
14787						}, wait, 'easeInQuad', function(){
14788							console.log('check', $(val));
14789							$(val).find('.background-inner').attr('data-active','false');
14790						}).css({
14791							zIndex: 0
14792						});
14793					}
14794				});
14795			};
14796			var bound = $bgWrap[0].getBoundingClientRect(),
14797				thresholdPX = UNCODE.wheight * threshold / 100,
14798				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
14799				movePX = totMove / bgAmount,
14800				moving = UNCODE.wheight - (bound.top + thresholdPX),
14801				slideInd = 0;
14802
14803			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
14804				multiBgRotate(0);
14805			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
14806				multiBgRotate(bgAmount-1);
14807			} else {
14808				slideInd = Math.ceil(moving/movePX) - 1;
14809				if ( slideInd < 0 ) {
14810					slideInd = 0;
14811				} else if ( slideInd >= bgAmount ) {
14812					slideInd = bgAmount-1;
14813				}
14814				if ( slideInd !== currentInd ) {
14815					multiBgRotate(slideInd);
14816				}
14817			}
14818
14819			requestAnimationFrame(function() {
14820				if ( isInViewport ) {
14821					loopRAF();
14822				}
14823			});
14824		};
14825
14826		if( 'IntersectionObserver' in window ) {
14827		    var observer = new IntersectionObserver(function(entries) {
14828  
14829                entries.forEach(function(entry){
14830                    if ( entry.isIntersecting ) {
14831                        isInViewport = true;
14832						if ( transition === 'scroll' ) {
14833							if ( autoScroll ) {
14834								loopRAF();
14835							} else {
14836								lightLoopRAF();
14837							}
14838						} else {
14839							multiCarousel();
14840						}
14841                    } else {
14842                        isInViewport = false;
14843                   }
14844                });
14845  
14846		    }, { 
14847				root: document,
14848				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
14849		  	});
14850
14851			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
14852		  		observer.observe(_bgWrap);
14853			}
14854
14855			window.addEventListener('resize', function() {
14856				observer.unobserve(_bgWrap);
14857				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
14858					observer.observe(_bgWrap);
14859				}
14860			});
14861	
14862		}
14863
14864	});
14865}
14866
14867UNCODE.owlNav = function(target, ev) {
14868    target = target.replace(/#\S+/g, '');
14869    var $carousel = $('#'+target),
14870        $slider = $carousel.closest('.uncode-slider'),
14871        $checkNavs = $('.uncode-owl-nav');
14872    if ( !$checkNavs.length ) {
14873        return;
14874    }
14875
14876    if ( $slider.length ){
14877        target = $slider.attr('id');
14878    }
14879
14880    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
14881        $row;
14882
14883    if ( ! $navs.length ) {
14884        $row = $carousel.closest('.vc_row.row-container');
14885        $navs = $('.uncode-owl-nav:not([data-target])', $row);
14886    }
14887        
14888    if ( ! $navs.length ) {
14889        return;
14890    }
14891
14892    $navs.each(function(){
14893        var $nav = $(this),
14894            $outer = $nav.closest('.uncode-owl-nav-out'),
14895            $inner = $nav.find('.uncode-owl-nav-in'),
14896            $navDots = $('.uncode-nav-dots', $nav),
14897            $navCounter = $('.uncode-nav-counter', $nav),
14898            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
14899            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
14900            skinInherit = $nav.hasClass('skin-inherit'),
14901            digit = parseFloat($nav.attr('data-digit')),
14902            counterDigit = parseFloat($nav.attr('data-counter-digit')),
14903            navSpeed = parseFloat($carousel.attr('data-navspeed'));
14904        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
14905
14906        if ( $nav.hasClass('pos-abs') ){
14907            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
14908                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
14909            }
14910            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
14911        } 
14912
14913        $carousel.on('refreshed.owl.carousel', counter);
14914        $carousel.on('resized.owl.carousel', counter);
14915        $carousel.on('changed.owl.carousel', counter);
14916
14917        var totalSlides = 0;
14918
14919        function counter(event) {
14920            if (!event.namespace) {
14921                return;
14922            }
14923            var slides = event.relatedTarget,
14924                current = slides._current,
14925                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
14926                item = event.item,
14927                page = event.page,
14928                countPages = Math.ceil(item.count / page.size),
14929                $currentSlide = $carousel.find('.owl-item').eq(current),
14930                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
14931                activeSlide = Math.ceil(itemIndex / page.size),
14932                $prev = $nav.find('.uncode-nav-prev'),
14933                $next = $nav.find('.uncode-nav-next'),
14934                $col = $currentSlide.find('.uncol').first();
14935
14936            if ( totalSlides != countPages ) {
14937                totalSlides = countPages;
14938                $navDots.html('');
14939                var nav_html = '';
14940                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
14941                    var padN = sl_ind+1;
14942                    if ( digit && digit > 1 ) {
14943                        padN = String(padN).padStart(digit, '0');
14944                    }
14945                    nav_html += '<button class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '" tabindex="0"><span>' + padN + '</span></button>';
14946                }
14947                $navDots.html(nav_html);
14948
14949                var totalSlidesDigit = totalSlides;
14950
14951                if ( counterDigit && counterDigit > 1 ) {
14952                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
14953                }
14954                $counterTotal.html(totalSlidesDigit);
14955            }
14956
14957            if ( loop !== true ) {
14958                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
14959                if ( itemIndex === 1 ) {
14960                    $prev.addClass('uncode-nav-disabled');
14961                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
14962                    $next.addClass('uncode-nav-disabled');
14963                    activeSlide = Math.ceil(item.count / page.size);
14964                }
14965            }
14966
14967            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
14968            var activeSlideDigit = activeSlide;
14969
14970            if ( counterDigit && counterDigit > 1 ) {
14971                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
14972            }
14973            $counterIndex.html(activeSlideDigit);
14974
14975            if ( skinInherit ) {
14976                if ( $col.hasClass('style-light') ){
14977                    $nav.removeClass('style-dark').addClass('style-light');
14978                } else if ( $col.hasClass('style-dark') ) {
14979                    $nav.removeClass('style-light').addClass('style-dark');
14980                }
14981            }
14982
14983            $inner.removeClass('uncode-owl-nav-waiting');
14984
14985            if ( $nav.hasClass('outer-width') ) {
14986                var navW = $nav.outerWidth(),
14987                    nexW = $next.outerWidth(),
14988                    prevW = $prev.outerWidth(),
14989                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
14990
14991                if ( $nav.hasClass('h-align-justify') ) {
14992                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
14993                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
14994                        $inner.css({'margin': 'auto'});
14995                    } else {
14996                        $inner.css({'margin': ''});
14997                    }
14998                } else {
14999                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
15000                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
15001                        $inner.css({'margin': 'auto'});
15002                    } else {
15003                        $inner.css({'margin': ''});
15004                    }
15005                }
15006            }
15007        }
15008
15009        $nav.on('click', '.uncode-nav-index', function(){
15010            var $bullet = $(this),
15011                slide_index = parseFloat( $bullet.attr('data-key') );
15012            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
15013        });
15014        $nav.on('click', '.uncode-nav-prev', function(){
15015            $carousel.trigger('prev.owl.carousel', [navSpeed]);
15016        });
15017        $nav.on('click', '.uncode-nav-next', function(){
15018            $carousel.trigger('next.owl.carousel', [navSpeed]);
15019        });
15020
15021        if ( $nav.hasClass('animated-arrows') ) {
15022            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
15023                $(this).addClass("hover"); 
15024            }).on('animationend', function(){
15025                $(this).removeClass("hover");  
15026            });
15027        }
15028
15029        var positionNav = function(){
15030            if ( $nav.hasClass('window-width') ) {
15031                var navOff = parseFloat( $nav.offset().left ) * -1;
15032                if ( navOff > 0 ) {
15033                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
15034                } else {
15035                    $inner.css({ transform: 'none' });
15036                }
15037            }
15038        }
15039        positionNav();
15040        $(window).on('resize', positionNav);
15041    });
15042
15043    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
15044};
15045
15046	UNCODE.init = function() {
15047		var wfl_check = false, wfl_request, waypoint_request;
15048		UNCODE.preventDoubleTransition();
15049		UNCODE.betterResize();
15050		UNCODE.utils();
15051		UNCODE.magnetic();
15052		if (typeof UNCODE.accessibility !== 'undefined') {
15053			UNCODE.accessibility();
15054		}
15055		if (typeof UNCODE.rowParallax !== 'undefined') {
15056			UNCODE.rowParallax();
15057		}
15058		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
15059			UNCODE.changeSkinOnScroll();
15060		}
15061		if (typeof UNCODE.share !== 'undefined') {
15062			UNCODE.share();
15063		}
15064		if (typeof UNCODE.tooltip !== 'undefined') {
15065			UNCODE.tooltip();
15066		}
15067		if (typeof UNCODE.counters !== 'undefined') {
15068			UNCODE.counters();
15069		}
15070		if (typeof UNCODE.countdowns !== 'undefined') {
15071			UNCODE.countdowns();
15072		}
15073		if (typeof UNCODE.tabs !== 'undefined') {
15074			UNCODE.tabs();
15075		}
15076		if (typeof UNCODE.collapse !== 'undefined') {
15077			UNCODE.collapse();
15078		}
15079		if (typeof UNCODE.bigText !== 'undefined') {
15080			UNCODE.bigText();
15081		}
15082		UNCODE.menuSystem();
15083		if (typeof UNCODE.bgChanger !== 'undefined') {
15084			UNCODE.bgChanger();
15085		}
15086		if (typeof UNCODE.magicCursor !== 'undefined') {
15087			UNCODE.magicCursor();
15088		}
15089		if (typeof UNCODE.magneticCursor !== 'undefined') {
15090			UNCODE.magneticCursor();
15091		}
15092		if (typeof UNCODE.dropImage !== 'undefined') {
15093			UNCODE.dropImage();
15094		}
15095		if (typeof UNCODE.postTable !== 'undefined') {
15096			UNCODE.postTable();
15097		}
15098		if (typeof UNCODE.rotatingTxt !== 'undefined') {
15099			UNCODE.rotatingTxt();
15100		}
15101		if (typeof UNCODE.okvideo !== 'undefined') {
15102			UNCODE.okvideo();
15103			window.addEventListener( "uncode-more-items-loaded", function() {
15104				UNCODE.okvideo("uncode-more-items-loaded");
15105			});
15106		}
15107		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
15108			UNCODE.backgroundSelfVideos();
15109		}
15110		UNCODE.tapHover();
15111		if (typeof UNCODE.isotopeLayout !== 'undefined') {
15112			UNCODE.isotopeLayout();
15113		}
15114		if (typeof UNCODE.justifiedGallery !== 'undefined') {
15115			UNCODE.justifiedGallery();
15116		}
15117		if (typeof UNCODE.cssGrid !== 'undefined') {
15118			UNCODE.cssGrid();
15119		}
15120		if (typeof UNCODE.linearGrid !== 'undefined') {
15121			UNCODE.linearGrid();
15122		}
15123		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
15124			UNCODE.lightbox();
15125		}
15126		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
15127			$(window).on('load more-items-loaded',function(){
15128				UNCODE.lightgallery();
15129			});
15130		}
15131		if (typeof UNCODE.carousel !== 'undefined') {
15132			UNCODE.carousel($('body'));
15133		}
15134		if (typeof UNCODE.lettering !== 'undefined') {
15135			UNCODE.lettering();
15136		}
15137		UNCODE.animations();
15138		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
15139			UNCODE.stickyElements();
15140		}
15141		if (typeof UNCODE.twentytwenty !== 'undefined') {
15142			UNCODE.twentytwenty();
15143		}
15144		UNCODE.disableHoverScroll();
15145		UNCODE.printScreen();
15146		if (typeof UNCODE.particles !== 'undefined') {
15147			UNCODE.particles();
15148		}
15149		if (typeof UNCODE.filters !== 'undefined') {
15150			UNCODE.filters();
15151		}
15152		if (typeof UNCODE.ajax_filters !== 'undefined') {
15153			UNCODE.ajax_filters();
15154		}
15155		if (typeof UNCODE.widgets !== 'undefined') {
15156			UNCODE.widgets();
15157		}
15158		if (typeof UNCODE.unmodal !== 'undefined') {
15159			UNCODE.unmodal();
15160		}
15161		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
15162			if ( !UNCODE.isFullPage ) {
15163				UNCODE.checkScrollForTabs();
15164			}
15165		}
15166		if (typeof UNCODE.onePage !== 'undefined') {
15167			UNCODE.onePage(UNCODE.isMobile);
15168		}
15169		if (typeof UNCODE.fullPage !== 'undefined') {
15170			$(document).ready(function(){
15171				UNCODE.fullPage();
15172			});
15173		}
15174		if (typeof UNCODE.skewIt !== 'undefined') {
15175			UNCODE.skewIt();
15176		}
15177		if (typeof UNCODE.rotateIt !== 'undefined') {
15178			UNCODE.rotateIt();
15179		}
15180		if (typeof UNCODE.textMarquee !== 'undefined') {
15181			UNCODE.textMarquee();
15182		}
15183		if (typeof UNCODE.stickyScroll !== 'undefined') {
15184			UNCODE.stickyScroll();
15185		}
15186		if (typeof UNCODE.stickyTrigger !== 'undefined') {
15187			UNCODE.stickyTrigger();
15188		}
15189		if (typeof UNCODE.areaTextReveal !== 'undefined') {
15190			UNCODE.areaTextReveal();
15191		}
15192		if (typeof UNCODE.thumbsReveal !== 'undefined') {
15193			UNCODE.thumbsReveal();
15194		}
15195		if (typeof UNCODE.verticalText !== 'undefined') {
15196			UNCODE.verticalText();
15197		}
15198		if (typeof UNCODE.videoThumbs !== 'undefined') {
15199			UNCODE.videoThumbs();
15200		}
15201		if (typeof UNCODE.revslider !== 'undefined') {
15202			UNCODE.revslider();
15203		}
15204		if (typeof UNCODE.layerslider !== 'undefined') {
15205			UNCODE.layerslider();
15206		}
15207		if (typeof UNCODE.lottie !== 'undefined') {
15208			UNCODE.lottie();
15209		}
15210		if (typeof UNCODE.inlineImgs !== 'undefined') {
15211			UNCODE.inlineImgs();
15212		}
15213		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
15214			UNCODE.animatedBgGradient();
15215		}
15216		if (typeof UNCODE.readMoreCol !== 'undefined') {
15217			UNCODE.readMoreCol();
15218		}
15219		if (typeof UNCODE.multibg !== 'undefined') {
15220			UNCODE.multibg();
15221		}
15222		if (typeof UNCODE.flexEqual !== 'undefined') {
15223			UNCODE.flexEqual();
15224		}
15225		$(window).on('load',function(){
15226			clearRequestTimeout(waypoint_request);
15227			waypoint_request = requestTimeout( function(){
15228				Waypoint.refreshAll();
15229			}, 1000);
15230		});
15231		$(window).one('load',function(){
15232			if (typeof UNCODE.parallax !== 'undefined') {
15233				UNCODE.parallax();
15234			}
15235		});
15236	}
15237
15238	if ( ! SiteParameters.is_frontend_editor ) {
15239		UNCODE.init();
15240	}
15241
15242
15243})(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.