PageSourceSearch

https://rbu-germany.com/wp-content/themes/uncode/library/js/app.js?ver=692896345

js rbu-germany.com collected 2026-10-09 23:11:31 UTC 437,651 bytes, 13,738 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
55if ( SiteParameters.smoothScroll === 'on' && ! SiteParameters.is_frontend_editor ) {
56	window.lenis = new Lenis({
57		duration: 1
58	})
59
60	UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
61		document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
62
63	function raf(time) {
64		window.lenis.raf(time)
65		requestAnimationFrame(raf)
66		window.dispatchEvent(new CustomEvent('lenis-scroll'));
67
68		if ( SiteParameters.uncode_smooth_scroll_safe ) {
69			var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
70				document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
71			
72			if ( UNCODE.hDoc !== newHdoc ) {
73				console.log(UNCODE.hDoc, newHdoc);
74				UNCODE.hDoc = newHdoc;
75				window.lenis.resize();
76			}
77		}
78	}
79
80	requestAnimationFrame(raf)
81
82	$(window).on('unmodal-open', function(){
83		window.lenis.stop();
84	});
85
86	$(document).on('unmodal-close', function(){
87		window.lenis.start();
88	});
89
90}
91
92UNCODE.checkImgLoad = function( src, cb, err, el ) {
93	var img = new Image();
94	img.onload = function () {
95		var result = (img.width > 0) && (img.height > 0);
96		cb(el);
97	};
98	img.onerror = function () {
99		err();
100	};
101	img.src = src
102};
103
104UNCODE.betterResize = function() {
105	var setResize,
106		doubleResize = true,
107		oldW = UNCODE.wwidth,
108		oldH = UNCODE.wheight,
109		setCTA;
110	$(window).on( 'resize orientationchange', function(){
111		if ( oldW === UNCODE.wwidth ) {
112			return;
113		} else {
114			oldW = UNCODE.wwidth;
115			$(window).trigger('wwResize');
116		}
117
118		if ( oldH === UNCODE.wheight ) {
119			return;
120		} else {
121			oldH = UNCODE.wheight;
122			$(window).trigger('whResize');
123		}
124	});
125
126	$(window).on( 'resize orientationchange', function(){
127		clearRequestTimeout(setCTA);
128		setCTA = requestTimeout( function(){ $(window).trigger('resize-int'); }, 100 );
129	});
130};
131
132UNCODE.shuffle = function(array) {
133	var currentIndex = array.length,
134		randomIndex;
135  
136	while (currentIndex > 0) {
137		randomIndex = Math.floor(Math.random() * currentIndex);
138		currentIndex--;
139		[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
140	}
141  
142	return array;
143};
144
145Number.isInteger = Number.isInteger || function(value) {
146    return typeof value === "number" &&
147           isFinite(value) &&
148           Math.floor(value) === value;
149};
150
151UNCODE.utils = function() {
152	$(document).on('mouseover', 'a', function () {
153		if (!$(this).hasClass('star')) {
154			$(this).attr('data-title', $(this).attr('title'));
155			$(this).removeAttr('title');
156		}
157	});
158	$(document).on('mouseout', 'a', function () {
159		if (!$(this).hasClass('star')) {
160			$(this).attr('title', $(this).attr('data-title'));
161			$(this).removeAttr('data-title');
162		}
163	});
164
165	this.get_scroll_offset = function(e) {
166
167		var scroll_offset = 0,
168			target,
169			trigger;
170
171		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
172			target = e.target;
173			trigger = e.currentTarget;
174		}
175
176		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
177			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
178				UNCODE.hideMenu(100);
179			}
180		}
181
182		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) {
183			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
184			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
185				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) {
186					if ( !$('.menu-hided').length ) {
187						if ( $('body').hasClass('hmenu-center') ) {
188							scroll_offset += $('.menu-sticky .menu-container').outerHeight();
189						} else {
190							scroll_offset += $('.logo-container:visible').outerHeight();
191						}
192					}
193				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
194					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
195					scroll_offset += $('.menu-sticky .menu-container').outerHeight() - ( $('.navbar-brand').data('minheight') + shrink );
196				} else {
197					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
198						scroll_offset += UNCODE.menuMobileHeight;
199					} else {
200						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 ) {
201							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
202						} else {
203							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
204								scroll_offset += UNCODE.menuMobileHeight;
205							}
206						}
207					}
208				}
209			}
210
211		}
212
213		scroll_offset += UNCODE.bodyBorder;
214
215		return scroll_offset;
216	}
217
218	if ( !UNCODE.isFullPage ) {
219		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
220
221			var hash = (e.currentTarget).hash,
222			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
223			anchor = '';
224			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
225			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
226				e.preventDefault();
227				if (!$('#tab-reviews').is(':visible')) {
228					$('a[href="#tab-reviews"]').trigger('click');
229				}
230				var calc_scroll = $('.wootabs .tab-content').offset().top;
231				calc_scroll -= UNCODE.get_scroll_offset(e);
232
233				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
234					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
235
236					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
237						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
238					}
239				}
240
241				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
242					delta = bodyTop - calc_scroll,
243					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
244				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
245
246				requestTimeout(function(){
247					if (scrollSpeed == 0) {
248						$('html, body').scrollTop(calc_scroll);
249						UNCODE.scrolling = false;
250					} else {
251   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
252							$(this).stop();
253						}).animate({
254								scrollTop: calc_scroll
255							}, scrollSpeed, 'easeInOutCubic', function() {
256								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
257								UNCODE.scrolling = false;
258							}
259						);
260					}
261				}, 200);
262				return;
263			}
264			if (hash != undefined) {
265				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
266				var anchor = this.hash.slice(1);
267				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
268			  		if ( !specialFormat.test(hash) ) {
269			  			if ( $(hash).length )
270			  				anchor = $(hash);
271			  		}
272				}
273			}
274
275			if (is_scrolltop || anchor != '') {
276				if (is_scrolltop) {
277					e.preventDefault();
278					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
279					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
280					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
281
282					if (scrollSpeed == 0) {
283						$('html, body').scrollTop(0);
284						UNCODE.scrolling = false;
285					} else {
286   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
287							$(this).stop();
288						}).animate({
289							scrollTop: 0
290						}, scrollSpeed, 'easeInOutCubic', function() {
291							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
292							UNCODE.scrolling = false;
293						});
294					}
295				} else {
296					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
297					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
298						var get_href = $(val).attr('href');
299						if (get_href != undefined) {
300							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
301							else $(val).parent().removeClass('active');
302						}
303					});
304					if (scrollSection.length) {
305						if ( $('body').hasClass('uncode-scroll-no-history') ) {
306							e.preventDefault();
307						}
308
309						if (UNCODE.menuOpened) {
310							if (UNCODE.wwidth < UNCODE.mediaQuery) {
311								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
312							} else {
313								$('.mmb-container-overlay .overlay-close').trigger('click');
314								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
315							}
316						}
317
318						var calc_scroll = scrollSection.offset().top,
319							getOffset = UNCODE.get_scroll_offset(e),
320							$logo = $('.logo-container:visible'),
321							logoH,
322							$menu = $('#masthead .menu-container'),
323							menuH;
324
325						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
326
327						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
328							delta = bodyTop - calc_scroll,
329							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
330						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
331
332						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
333							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
334								logoH = $logo.outerHeight(),
335								menuH = $menu.outerHeight();
336								if ( calc_scroll < ( logoH + menuH ) ) {
337									calc_scroll = 0;
338								}
339							}
340						}
341
342						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
343							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
344						}
345
346						if (scrollSpeed == 0) {
347							$('html, body').scrollTop(calc_scroll);
348							UNCODE.scrolling = false;
349						} else {
350	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
351								$(this).stop();
352							}).animate({
353								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
354							}, scrollSpeed, 'easeInOutCubic', function() {
355								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
356								UNCODE.scrolling = false;
357								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
358								||
359								$('.menu-hided').length ) {
360									calc_scroll = scrollSection.offset().top;
361									getOffset = UNCODE.get_scroll_offset(e);
362									calc_scroll -= getOffset;
363									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
364										$(this).stop();
365									}).animate({
366										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
367										}, scrollSpeed, 'easeInOutCubic', function() {
368											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
369											UNCODE.scrolling = false;
370										}
371									);
372								}
373							});
374						}
375					}
376				}
377			}
378		});
379		$('.header-scrolldown').on('click', function(event) {
380
381			event.preventDefault();
382
383			var pageHeader = $(event.target).closest('#page-header'),
384				pageHeaderTop = pageHeader.offset().top,
385				pageHeaderHeight = pageHeader.outerHeight(),
386				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
387			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
388
389			var calc_scroll = pageHeaderTop + pageHeaderHeight,
390			getOffset = UNCODE.get_scroll_offset(event);
391			calc_scroll -= getOffset;
392
393			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
394				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
395
396				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
397					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
398				}
399			}
400
401			if (scrollSpeed == 0) {
402				$('html, body').scrollTop(calc_scroll);
403				UNCODE.scrolling = false;
404			} else {
405					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
406						$(this).stop();
407					}).animate({
408						scrollTop: calc_scroll
409					}, scrollSpeed, 'easeInOutCubic', function() {
410						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
411						UNCODE.scrolling = false;
412						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
413							calc_scroll = pageHeaderTop + pageHeaderHeight;
414							getOffset = UNCODE.get_scroll_offset(event);
415							calc_scroll -= getOffset;
416								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
417									$(this).stop();
418								}).animate({
419									scrollTop: calc_scroll
420								}, scrollSpeed, 'easeInOutCubic', function() {
421									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
422									UNCODE.scrolling = false;
423								}
424							);
425						}
426					}
427				);
428			}
429		});
430	}
431
432	// Colomun hover effect
433	// =================
434	$(document).on('mouseenter', '.col-link', function(e) {
435		var uncol = $(e.target).prev('.uncol'),
436		el = uncol.find('.column-background');
437		if (el) {
438			$('.btn-container .btn', uncol).addClass('active');
439			var elOverlay = $(el[0]).find('.block-bg-overlay');
440			if (elOverlay.length) {
441				var getOpacity = $(elOverlay).css('opacity');
442				if (getOpacity != 1) {
443					getOpacity = Math.round(getOpacity * 100) / 100;
444					var newOpacity = getOpacity + .1;
445					$(elOverlay).data('data-opacity', getOpacity);
446					$(elOverlay).css('opacity', newOpacity);
447				}
448			}
449		}
450	}).on('mouseleave', '.col-link', function(e) {
451		var uncol = $(e.target).prev('.uncol'),
452		el = uncol.find('.column-background');
453		$('.btn-container .btn', uncol).removeClass('active');
454		if (el) {
455			var elOverlay = $(el[0]).find('.block-bg-overlay');
456			if (elOverlay.length) {
457				var getOpacity = $(elOverlay).data('data-opacity');
458				$(elOverlay).css('opacity', getOpacity);
459			}
460		}
461	});
462
463	// Admin bar
464	// ============
465	var fixAdminBar = function() {
466		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
467			var getAdminBar = $('#wpadminbar');
468			if (getAdminBar.length) {
469				if (getAdminBar.css('position') !== 'hidden') {
470					var getAdminBarHeight = getAdminBar.height();
471					if (getAdminBar.css('position') === 'fixed') {
472						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
473						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
474					} else {
475						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
476						$('.body-borders .top-border').css({'margin-top':'0px'});
477					}
478				}
479			}
480		}
481	};
482	window.addEventListener('load', fixAdminBar);
483	window.addEventListener('resize', fixAdminBar);
484	// Print
485	// ===========
486	var beforePrint = function() {
487		window.dispatchEvent(new CustomEvent('resize'));
488		window.dispatchEvent(UNCODE.boxEvent);
489	};
490
491	if (window.matchMedia) {
492		var mediaQueryList = window.matchMedia('print');
493		mediaQueryList.addListener(function(mql) {
494			if (mql.matches) {
495				beforePrint();
496			}
497		});
498	}
499
500	window.onbeforeprint = beforePrint;
501
502	// Safari srcset
503	var safariSrcSet = function(){
504		if ( !SiteParameters.is_frontend_editor ) {
505			$('html.safari img[sizes]').each(function(){
506				var $img = $(this),
507					sizeImg = parseInt($img.attr('sizes'));
508				if ( typeof(sizeImg) === 'number' ) {
509					$img.attr('sizes', (sizeImg) + 'px');
510				}
511			});
512		}
513	};
514	window.addEventListener('load', safariSrcSet);
515}
516
517UNCODE.lettering = function() {
518
519	var setCTA;
520	var highlightStill = function(){
521
522		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
523
524		$.each($heading_texts, function(key, el) {
525			var $heading = $(el);
526
527			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
528				return;
529			}
530
531			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
532				return;
533			}
534
535			var waypoint = new Waypoint({
536				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
537				element: el,
538				handler: function() {
539					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
540						anims_l = $anims.length;
541					$anims.each(function(_key_, _el_){
542						var $anim = $(_el_);
543
544						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
545							$anim.addClass('heading-text-highlight-animated');
546
547							if ( $heading.data('animate') === true ) {
548								$anim.css({
549									'-webkit-transition-duration': '0ms',
550									'-moz-transition-duration': '0ms',
551									'-o-transition-duration': '0ms',
552									'transition-duration': '0ms',
553								});
554							} else {
555								$anim.css({
556									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
557									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
558									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
559									'transition-delay': ((_key_ + 2) * 200) + 'ms',
560								});
561							}
562						}
563
564					});
565					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
566						$heading.data('animate', true);
567					});
568					$anims.removeAttr('data-animated');
569				},
570				offset: '100%'
571			});
572
573		});
574
575		Waypoint.refreshAll();
576		$( document.body ).trigger('uncode_waypoints');
577
578	}
579
580	requestTimeout(function(){
581		highlightStill();
582		$(window).on( 'resize', function(){
583			clearRequestTimeout(setCTA);
584			setCTA = requestTimeout( highlightStill, 100 );
585		});
586	}, 400);
587
588};
589
590UNCODE.isUnmodalOpen = false;
591
592var manageVideoSize = function(){
593
594	var setVideoFit;
595	$('.wp-block-embed').each(function(){
596
597		var $this = $(this);
598
599		if ( $('iframe', $this).length ) {
600
601			var $iframe = $('> iframe, > a > iframe', $this),
602				w = parseFloat($iframe.attr('width')),
603				h = parseFloat($iframe.attr('height')),
604				url = $iframe.attr('src'),
605				ratio, frW;
606
607			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
608
609				ratio = h / w;
610				var setResizeiFto,
611					resizeiFrame = function(){
612					frW = $iframe.width();
613					$iframe.css({
614						height: frW * ratio
615					});
616				};
617				resizeiFrame();
618				$(window).on( 'resize load', function(){
619					clearRequestTimeout(setResizeiFto);
620					setResizeiFto = requestTimeout( function() {
621						resizeiFrame();
622					}, 10 );
623				});
624
625			}
626
627		}
628
629	});
630
631};
632
633manageVideoSize();
634
635UNCODE.vivus = function(icon, time, delay, file) {
636	if (typeof Vivus !== 'undefined') {
637		var icon_options = {
638			type: 'delayed',
639			pathTimingFunction: Vivus.EASE_OUT,
640			animTimingFunction: Vivus.LINEAR,
641			duration: time,
642		}
643
644		if (delay) {
645			icon_options.delayStart = delay;
646		}
647
648		if (file) {
649			icon_options.file = file;
650		}
651
652		new Vivus(icon, icon_options);
653	}
654};
655
656UNCODE.lastURL = '';
657
658UNCODE.getURLParams = function(current_location, is_string) {
659	var params = {};
660	if (is_string) {
661		var url = current_location.split('?')[1];
662	} else {
663		var url = current_location.search;
664		url = url.substring(1);
665	}
666	if (url) {
667		var parts = url.split('&');
668		for (var i = 0; i < parts.length; i++) {
669			var nv = parts[i].split('=');
670			if (!nv[0]) {
671				continue;
672			}
673			params[nv[0]] = nv[1] || true;
674		}
675	}
676	return params;
677}
678
679UNCODE.hasEqualURLParams = function(obj1, obj2) {
680	for (var i in obj1) {
681		if (obj1.hasOwnProperty(i)) {
682			if (!obj2.hasOwnProperty(i)) {
683				return false;
684			}
685			if (obj1[i] != obj2[i]) {
686				return false;
687			}
688		}
689	}
690	for (var i in obj2) {
691		if (obj2.hasOwnProperty(i)) {
692			if (!obj1.hasOwnProperty(i)) {
693				return false;
694			}
695			if (obj1[i] != obj2[i]) {
696				return false;
697			}
698		}
699	}
700    return true;
701}
702
703UNCODE.magnetic = function(){
704	
705	$(document).on('mousemove', '.un-magnetic-zone', function(e){
706
707		var $zone = $(this),
708			zoneOff = $zone.offset(),
709			$mgntcEl = $('.un-magnetic-el', this),
710			elBound = this.getBoundingClientRect(),
711			maxSize = Math.max($zone.outerWidth(), $zone.outerHeight());
712
713		var Xvalue = e.pageX - (zoneOff.left + maxSize / 2),
714	  		Yvalue = e.pageY - (zoneOff.top + maxSize / 2);
715	  
716		$mgntcEl.each(function(key, val){
717			var magneticValue = $(val).attr('data-mgntc') || 0.5;
718		
719			val.animate({
720				transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)',
721			},{
722				duration: 500,
723				fill: 'forwards',
724			})
725	  	});
726	})
727	
728	$(document).on('mouseleave', '.un-magnetic-zone', function(e){
729		var $mgntcEl = $('.un-magnetic-el', this);
730
731		$mgntcEl.each(function(key, val){
732			val.animate({
733		  		transform: 'translate(0)',
734			},{
735		  		duration: 500,
736		  		fill: 'forwards',
737			})
738	  	});
739	})
740};
741
742UNCODE.rowParallax = function(){
743
744	if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) {
745		return;
746	}
747
748	var $rows = $('.parallax-move'),
749		stableHeight = UNCODE.wheight;
750	$rows.each(function(){
751		var $row = $(this),
752			_row = $row[0],
753			dataMove = $row.attr('data-parallax-move'),
754			dataSafe = $row.attr('data-parallax-safe'),
755            rowInViewport = false,
756			trans;
757
758		if ( $row.find('.parallax-move').length ) {
759			return;
760		}
761
762		dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe;
763		dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove;           
764        dataMove = dataMove / 10;
765
766        if ( 'IntersectionObserver' in window ) {
767			var observer = new IntersectionObserver(function(entries) {
768	
769				entries.forEach(function(entry){
770					if ( entry.isIntersecting ) {
771						rowInViewport = true;
772					} else {
773						rowInViewport = false;
774					}
775				});
776	
777			}, { 
778				root: document,
779			});
780	
781			observer.observe(_row);
782		} else {
783            rowInViewport = true;
784		}
785
786		var loopRAF = function() {
787			if( rowInViewport ) {
788				var bound = _row.getBoundingClientRect(),
789					bound_top = bound.top,
790					bound_height = bound.height,
791					move = true,
792					scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
793					docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
794						document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ),
795					fromBottom = docH - (scrolled + bound_top + bound_height);
796
797                if ( bound_height > stableHeight && dataSafe === 'yes' ) {
798                    $row.find('>div').css({
799                        'transform':'none'
800                    });
801                    move = false;
802				}
803
804				if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) {
805					$row.find('>div').css({
806						'transform':'none'
807					});
808					move = false;
809				}
810
811				if ( move ) {
812
813					if ( fromBottom < stableHeight ) {
814						//maybe Footer
815						trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove);
816                    } else if ( scrolled + bound_top < stableHeight ) {
817						//maybe Header
818						trans = scrolled*(dataMove);
819					} else {
820						trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove);
821					}
822
823                    $row.find('>div').css({
824                        'transform':'translateY(' + (trans) + 'px) translateZ(0)',
825                    });
826                }
827			}
828	
829			requestAnimationFrame(loopRAF);
830		};
831		
832		requestAnimationFrame(loopRAF);
833
834	});
835
836	$(window).on( 'load resize', function(e) {
837		if ( ! UNCODE.isMobile ) {
838			stableHeight = UNCODE.wheight;
839		}
840	});
841
842	$(window).on( 'load wwResize', function(e) {
843		if ( UNCODE.isMobile ) {
844			stableHeight = UNCODE.wheight;
845		}
846	});
847
848}
849
850UNCODE.changeSkinOnScroll = function(){
851	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
852		return;
853	}
854	var $masthead = $('#masthead'),
855		transDesktop,
856		transMobile,
857		changeSkin,
858
859	checkTransparencyAndChange = function( $col ){
860		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
861		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
862		changeSkin = $masthead.hasClass('menu-change-skin');
863
864		if ( ! transDesktop && ! transMobile ) {
865			return false;
866		}
867
868		if ( ! changeSkin ) {
869			return false;
870		}
871
872		if ( $col.hasClass('style-light') ){
873			$masthead.removeClass('style-dark-override').addClass('style-light-override');
874			return false;
875		} else if ( $col.hasClass('style-dark') ) {
876			$masthead.removeClass('style-light-override').addClass('style-dark-override');
877			return false;
878		}
879	};
880
881	var prev_row = 'normal',
882		odd = true,
883		$rows = $('.vc_row[data-parent]:visible');
884	$.each($rows, function(index, row){
885		var $row = $(row),
886			$col = $('.uncol', $row).first(),
887			$slider = $('.uncode-slider', $row);
888
889		var wayDown = new Waypoint({
890			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
891			element: row,
892			handler: function(direction) {
893				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
894					if ( $slider.length ) {
895						$col = $('.owl-item.index-active .uncol', $slider).first();
896					}
897					checkTransparencyAndChange($col);
898				}
899				if ( odd === false ) {
900					if ( row.hasAttribute('data-bg-changer') ) {
901						prev_row = 'bg-changer';
902					} else {
903						prev_row = 'normal';
904					}
905					odd = true;
906				} else {
907					odd = false;
908				}
909			},
910			offset: function() {
911				return UNCODE.menuHeight / 2
912			}
913		});
914		var wayUp = new Waypoint({
915			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
916			element: row,
917			handler: function(direction) {
918				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
919					if ( $slider.length ) {
920						$col = $('.owl-item.index-active .uncol', $slider).first();
921					}
922					checkTransparencyAndChange($col);
923				}
924				if ( odd === false ) {
925					if ( row.hasAttribute('data-bg-changer') ) {
926						prev_row = 'bg-changer';
927					} else {
928						prev_row = 'normal';
929					}
930					odd = true;
931				} else {
932					odd = false;
933				}
934			},
935			offset: function() {
936				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
937			}
938		});
939	});
940
941};
942
943UNCODE.share = function() {
944	if (typeof Share !== 'undefined') {
945		var share_button_element = $('.share-button');
946		var share_button_url = share_button_element.data('url');
947
948		var share_button_config = {
949			ui: {
950				flyout: "top center",
951				button_font: false,
952				button_text: '',
953				icon_font: false
954			}
955		};
956
957		if (share_button_url) {
958			share_button_config.url = share_button_url.replace("&", "%26");
959		}
960
961		var share_button_top = new Share('.share-button', share_button_config);
962	}
963};
964
965UNCODE.tooltip = function() {
966	if (typeof jQuery.fn.tooltip !== 'undefined') {
967		$('.btn-tooltip').tooltip();
968	}
969};
970
971UNCODE.counters = function() {
972	var $counters = $('.uncode-counter:not(.counter-init)');
973	$counters.each(function(){
974		var $counter = $(this).addClass('counter-init');
975		if ( SiteParameters.is_frontend_editor ) {
976			$counter.addClass('started');
977		}
978		if ( $counter.closest( '.owl-carousel' ).length ) {
979			return;
980		}
981		$counter.addClass('started').counterUp({
982			delay: 10,
983			time: 1500
984		});
985	});
986};
987
988UNCODE.countdowns = function() {
989	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
990	$countdowns.each(function() {
991		var $this = $(this).addClass('counter-init'),
992			finalDate = $(this).data('uncode-countdown');
993		$this.countdown(finalDate, function(event) {
994			$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>'));
995		});
996	});
997};
998
999UNCODE.tabs = function() {
1000
1001	var tabSwitcher = function($el){
1002		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1002ical):not(.tab-switch)', $el).each(function(key, value){
1003			var $navs = $(value),
1004				$active = $('li.active', $navs),
1005				$active_a = $('> a', $active),
1006				$active_span = $('> span', $active_a),
1007				vertical = $navs.closest('.vertical-tab-menu').length;
1008			
1009			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
1010				$navs.append('<span class="switcher-cursor" />');
1011			}
1012
1013			var $cursor = $('.switcher-cursor', $navs),
1014				active_w = $('a', $active).outerWidth(),
1015				span_w = $active_span.outerWidth(),
1016				active_pos = $active.position(),
1017				active_a_pos = $active_a.position(),
1018				span_pos = $active_span.position(),
1019				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
1020				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
1021
1022			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
1023
1024			if ( ! vertical ) {
1025				$cursor.css({
1026					left: cursor_left,
1027					width: cursor_w
1028				});
1029			}
1030
1031			$navs.addClass('switch-init');
1032		});
1033	};
1034
1035	var $body = $('body');
1036	tabSwitcher($body);
1037
1038	var tabHoverIntent = function(){
1039		var setHover;
1040		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
1041			.on('mouseover', function(e){
1042				var $this = $(e.target);
1043				setHover = requestTimeout(function() {
1044					$this.trigger('hover-int');
1045				}, 50);
1046			})
1047			.on('mouseout', function(){
1048				clearRequestTimeout(setHover);
1049			});
1050	};
1051	tabHoverIntent();
1052
1053	var tabInit = function(){
1054		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
1055			e.preventDefault()
1056			var $el = $(this);
1057			$el.tab('show');
1058			var $container = $el.closest('.uncode-tabs');
1059			tabSwitcher($container);
1060			requestTimeout(function() {
1061				window.dispatchEvent(UNCODE.boxEvent);
1062				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
1063
1064				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
1065					window.dispatchEvent(new CustomEvent('boxResized'));
1066				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
1067					window.dispatchEvent(new Event('resize'));
1068					$(window).trigger('uncode.re-layout');
1069				} 
1070
1071				var $active_panel = $('.tab-pane.active', $tabs);
1072
1073				$.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) {
1074					var element = $(val),
1075						delayAttr = element.attr('data-delay');
1076					if (delayAttr == undefined) delayAttr = 0;
1077					requestTimeout(function() {
1078						element.addClass('start_animation');
1079					}, delayAttr);
1080				});
1081
1082			}, 300);
1083
1084			var $li = $el.closest('li'),
1085				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1086			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1087			$('.tab-pane', $li).slideDown(250);
1088			var completeSlideDown = requestTimeout(function(){
1089				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1090					var pos = $el.offset(),
1091						rect = $el[0].getBoundingClientRect(),
1092						$masthead = $('#masthead > .menu-container'),
1093						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1094
1095					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1096						$('html, body').animate({
1097							scrollTop: ( pos.top ) - considerMenu
1098						},{
1099							easing: 'easeInOutQuad',
1100							duration: 250
1101						});
1102					}
1103				}
1104			}, 260);
1105		});
1106	}
1107	tabInit();
1108
1109	var tabResponsive = function(){
1110		if ( SiteParameters.is_frontend_editor ) {
1111			return true;
1112		}
1113		var $tabContainers = $('.tab-container.tabs-breakpoint');
1114		$tabContainers.each(function(){
1115			var $tabContainer = $(this),
1116				$tabContent = $('.tab-content', $tabContainer),
1117				$nav = $('.nav-tabs', $tabContainer),
1118				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1119
1120			$('> li', $nav).each(function(){
1121				var $li = $(this),
1122					dataID = $li.attr('data-tab-id');
1123
1124				if ( UNCODE.wwidth <= mQuery ) {
1125					if ( ! $('.tab-pane', $li ).length ) {
1126						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1127						$tabContainer.addClass('tabs-appended');
1128						$li.append($append_pane);
1129					}
1130
1131					if ( $li.hasClass('active') ) {
1132						$('> a', $li).click();
1133					}
1134				} else {
1135					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1136						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1137						$tabContainer.removeClass('tabs-appended');
1138						$tabContent.prepend($append_pane.removeAttr('style'));
1139					}
1140				}
1141			});
1142		});
1143
1144	}
1145	tabResponsive();
1146
1147	$(window).on('wwResize', function(){
1148		tabHoverIntent();
1149		tabSwitcher($body);
1150	});
1151
1152	var setCTA;
1153	$(window).on( 'resize', function(){
1154		clearRequestTimeout(setCTA);
1155		setCTA = requestTimeout( tabResponsive, 100 );
1156	});
1157
1158	$('.nav-tabs').each(function(){
1159		var $nav = $(this),
1160			$lis = $('> li:not(.active)', $nav),
1161			$links = $('.tab-excerpt-link', $nav);
1162		$('.tab-excerpt', $lis).slideUp(400, function(){
1163			$(this).addClass('init');
1164		});
1165
1166		$links.each(function(){
1167			var $link = $(this),
1168				$par_a = $link.closest('a'),
1169				href = $link.attr('data-href'),
1170				target = $link.attr('data-target');
1171			$par_a.addClass('inner-link');
1172			$link.on('click', function(){
1173				var _link = document.createElement('a');
1174				_link.href = href;
1175				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1176				_link.click();
1177			});
1178		});
1179		$nav.addClass('tab-init');
1180	});
1181
1182	$('.uncode-tabs.tabs-no-lazy').each(function(){
1183		var $tabs = $(this),
1184			$panes = $('.tab-pane:not(.active)', $tabs);
1185		$panes.each(function(){
1186			var $pane = $(this),
1187				$imgs = $('img[loading="lazy"]', $pane);
1188			$imgs.removeAttr('loading');
1189			$imgs.removeAttr('decoding');
1190		});
1191	});
1192
1193};
1194UNCODE.collapse = function() {
1195	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1196		var $this = $(this),
1197			href
1198		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1199		var $target = $(target)
1200		var parent = $this.attr('data-parent')
1201		var $parent = parent && $(parent)
1202		var $title = $(this).parent()
1203		var $accordion = $(e.target).closest('.uncode-accordion')
1204		var $group = $this.closest('.group')
1205		var $panel_group = $this.closest('.panel-group')
1206		if ($parent) {
1207			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1208			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1209				$title.removeClass('active');
1210				$group.removeClass('active-group');
1211			} else {
1212				if ( $panel_group.attr('data-no-toggle') != true ) {
1213					$parent.find('.panel-title').removeClass('active')
1214					$parent.find('.group').removeClass('active-group')
1215				}
1216				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1217				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1218			}
1219		}
1220		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1221		requestTimeout(function() {
1222			var $accordion = $(e.target).closest('.uncode-accordion');
1223			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1224			  window.dispatchEvent(new CustomEvent('boxResized'));
1225			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1226				window.dispatchEvent(new Event('resize'));
1227				$(window).trigger('uncode.re-layout');
1228			} 
1229
1230			var $active_panel = $('.panel.active-group', $parent);
1231
1232			$.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) {
1233				var element = $(val),
1234					delayAttr = element.attr('data-delay');
1235				if (delayAttr == undefined) delayAttr = 0;
1236				requestTimeout(function() {
1237					element.addClass('start_animation');
1238				}, delayAttr);
1239			});
1240
1241		}, 500);
1242	});
1243
1244	$('.uncode-accordion.tabs-no-lazy').each(function(){
1245		var $accordion = $(this),
1246			$panes = $('.panel:not(.active-group)', $accordion);
1247		$panes.each(function(){
1248			var $pane = $(this),
1249				$imgs = $('img[loading="lazy"]', $pane);
1250			$imgs.removeAttr('loading');
1251			$imgs.removeAttr('decoding');
1252		});
1253	});
1254};
1255
1256UNCODE.bigText = function(el) {
1257	var bigTextLaunch = function(){
1258		if (el == undefined) {
1259			el = $('body');
1260		}
1261		$.each($('.bigtext', el), function(index, val) {
1262			$(val).bigtext({
1263				minfontsize: 24
1264			});
1265			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1266				opacity: 1
1267			});
1268			requestTimeout(function() {
1269				if ($(val).find('.animate_when_almost_visible').length != 0) {
1270					$(val).css({opacity: 1});
1271				}
1272			}, 400);
1273		});
1274	};
1275
1276	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1277		bigTextLaunch();
1278	}
1279	$(window).on( 'load', bigTextLaunch );
1280};
1281
1282UNCODE.process_shortpixel_image = function(image) {
1283	var data = {
1284		action: 'shortpixel_manual_optimization',
1285		image_id: image,
1286		cleanup: true
1287	};
1288
1289	$.get(SiteParameters.ajax_url, data);
1290};
1291
1292UNCODE.menuSystem = function() {
1293
1294	function menuMobile() {
1295		var $body = $('body'),
1296			scrolltop,
1297			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'),
1298			$masthead = $('#masthead'),
1299			$box,
1300			$el,
1301			$el_transp,
1302			elHeight,
1303			offCanvasAnim,
1304			check,
1305			animating = false,
1306			stickyMobile = false,
1307			menuClose = new CustomEvent('menuMobileClose'),
1308			menuOpen = new CustomEvent('menuMobileOpen');
1309		UNCODE.menuOpened = false;
1310		$mobileToggleButton.on('click', function(event) {
1311			event.stopPropagation();
1312			var btn = this;
1313			if ($(btn).hasClass('overlay-close')) return;
1314			event.preventDefault();
1315			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1316			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1317				$box = $(this).closest('.box-container').find('.main-menu-container');
1318				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
1319				$el_transp = $('.menu-absolute.menu-transparent');
1320				if (UNCODE.isMobile) {
1321					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 ) {
1322						stickyMobile = true;
1323						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1324					} else {
1325						elHeight = 0;
1326						$.each($box.find('> div'), function(index, val) {
1327							elHeight += $(val).outerHeight();
1328						});
1329					}
1330				} else {
1331					elHeight = 0;
1332					$.each($el, function(index, val) {
1333						elHeight += $(val).outerHeight();
1334					});
1335				}
1336				var open = function() {
1337					clearTimeout(offCanvasAnim);
1338					if (!animating) {
1339						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1340						scrolltop = $(window).scrollTop();
1341						window.dispatchEvent(menuOpen);
1342						animating = true;
1343						UNCODE.menuOpened = true;
1344						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1345							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1346								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1347							}
1348							if ($('body.menu-offcanvas').length) {
1349								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1350								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1351							} else {
1352								if ( $('.menu-hide, .menu-sticky').length ) {
1353									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1354										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1355									}
1356								}
1357							}
1358						}
1359						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1360							//$("#masthead")[0].scrollIntoView();
1361							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1362						}
1363						$box.addClass('open-items');
1364						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1365							$el_transp.addClass('is_mobile_open');
1366						}
1367						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1368							btn.classList.add('close');
1369							$box.animate({
1370								height: elHeight
1371							}, 600, "easeInOutCirc", function() {
1372								animating = false;
1373								if (!stickyMobile) $box.css('height', 'auto');
1374							});
1375						} else {
1376							animating = false;
1377						}
1378					}
1379				};
1380
1381				var close = function() {
1382					clearTimeout(offCanvasAnim);
1383					if (!animating) {
1384						window.dispatchEvent(menuClose);
1385						animating = true;
1386						UNCODE.menuOpened = false;
1387						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1388							btn.classList.remove('close');
1389							btn.classList.add('closing');
1390						}
1391						$box.addClass('close');
1392						requestTimeout(function() {
1393							$box.removeClass('close');
1394							$box.removeClass('open-items');
1395							btn.classList.remove('closing');
1396							if ($el_transp.length) {
1397								$el_transp.removeClass('is_mobile_open');
1398							}
1399						}, 500);
1400						$body.removeClass('opening-overlay-menu');
1401						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1402							$box.animate({
1403								height: 0
1404							}, {
1405								duration: 600,
1406								easing: "easeInOutCirc",
1407								complete: function(elements) {
1408									$(elements).css('height', '');
1409									animating = false;
1410									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1411										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1412									}
1413									$body.removeClass('open-overlay-menu');
1414								}
1415							});
1416						} else {
1417							animating = false;
1418							offCanvasAnim = setTimeout(function(){
1419								$body.removeClass('open-overlay-menu');
1420							}, 1000);
1421						}
1422					}
1423				};
1424				check = (!UNCODE.menuOpened) ? open() : close();
1425			}
1426		});
1427
1428		$('html').on('click', function(event){
1429			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1430				$('.uncode-close-offcanvas-mobile').trigger('click');
1431			}
1432		});
1433
1434		window.addEventListener('menuMobileTrigged', function(e) {
1435			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1436		});
1437		window.addEventListener('orientationchange', function(e) {
1438			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1439		});
1440		window.addEventListener("resize", function() {
1441			if ($(window).width() < UNCODE.mediaQuery) {
1442				if (UNCODE.isMobile) {
1443					var $box = $('.box-container .main-menu-container'),
1444						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
1445					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1446						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1447							elHeight = 0;
1448							$.each($el, function(index, val) {
1449								elHeight += $(val).outerHeight();
1450							});
1451							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;
1452							$($box).css('height', elHeight + 'px');
1453						}
1454					}
1455				}
1456			} else {
1457				$('.menu-hide-vertical').removeAttr('style');
1458				$('.menu-container-mobile').removeAttr('style');
1459				$('.vmenu-container.menu-container').removeAttr('style');
1460			}
1461		});
1462
1463		$(window).on('scroll', function(){
1464			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1465				$(window).scrollTop(scrolltop);
1466				return false;
1467			}
1468		});
1469
1470	};
1471
1472	function menuOffCanvas() {
1473		var menuClose = new CustomEvent('menuCanvasClose'),
1474			menuOpen = new CustomEvent('menuCanvasOpen');
1475		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1476			if ($(window).width() > UNCODE.mediaQuery) {
1477				if ( $('body.vmenu-offcanvas-overlay').length ) {
1478					if ($(event.currentTarget).hasClass('off-close')) {
1479						$(event.currentTarget).removeClass('off-close');
1480						requestTimeout(function() {
1481							window.dispatchEvent(menuClose);
1482						}, 500);
1483
1484					} else {
1485						$(event.currentTarget).addClass('off-close');
1486						window.dispatchEvent(menuOpen);
1487					}
1488				} else {
1489					if ($(event.currentTarget).hasClass('close')) {
1490						$(event.currentTarget).removeClass('close');
1491						$(event.currentTarget).addClass('closing');
1492						requestTimeout(function() {
1493							$(event.currentTarget).removeClass('closing');
1494							window.dispatchEvent(menuClose);
1495						}, 500);
1496
1497					} else {
1498						$(event.currentTarget).addClass('close');
1499						window.dispatchEvent(menuOpen);
1500					}
1501				}
1502			}
1503
1504			$('body').toggleClass('off-opened');
1505		});
1506
1507		$('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){
1508			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1509				var $vMenuCont = $('#masthead .vmenu-container'),
1510					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1511
1512					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1513					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1514					vmenu_off = $vMenuCont.offset(),
1515					vmenu_l = parseFloat(vmenu_off.left),
1516					vmenu_t = parseFloat(vmenu_off.top),
1517					vmenu_r = vmenu_l + vmenu_w,
1518					vmenu_b = vmenu_t + vmenu_h,
1519
1520					close_h = parseFloat( $close_menu.outerHeight() ),
1521					close_w = parseFloat( $close_menu.outerWidth() ),
1522					close_off = $close_menu.offset(),
1523					close_l = parseFloat(close_off.left),
1524					close_t = parseFloat(close_off.top),
1525					close_r = close_l + close_w,
1526					close_b = close_t + close_h;
1527				if (
1528					!(
1529						e.clientX > vmenu_l &&
1530						e.clientX < vmenu_r &&
1531						e.clientY > vmenu_t &&
1532						e.clientY < vmenu_b
1533					)
1534					||
1535					(
1536						e.clientX > close_l &&
1537						e.clientX < close_r &&
1538						e.clientY > close_t &&
1539						e.clientY < close_b
1540					)
1541				) {
1542					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1543				}
1544			}
1545		});
1546	};
1547
1548	function menuOverlay() {
1549		if ( $('.overlay').length ) {
1550			$('.overlay').removeClass('hidden');
1551		}
1552		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1553			$('.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) {
1554				var transDelay = (index / 20) + 0.1;
1555				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1556					transDelay = transDelay + 0.3;
1557				$(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');
1558			});
1559		}
1560
1561	};
1562	var $secondary_parent;
1563	function menuAppend() {
1564		var $body = $('body'),
1565			$menuCont = $('.menu-container:not(.vmenu-container)'),
1566			$vMenuCont = $('.menu-container.vmenu-container'),
1567			$cta = $('.navbar-cta'),
1568			$socials = $('.navbar-social:not(.appended-navbar)'),
1569			$ul = $('.navbar-main ul.menu-primary-inner'),
1570			$ulCta,
1571			$ulSocials,
1572			$navLast,
1573			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1574			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1575			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1576			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1577			$ulFirst = $('> ul', $firstNav),
1578			$ulSecond = $('> ul', $secondNav),
1579			setCTA,
1580			appendCTA = function(){
1581				return true;
1582			},
1583			appendSocials = function(){
1584				return true;
1585			},
1586			appendSplit = function(){
1587				return true;
1588			};
1589
1590		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1591			$ulCta = $('> ul', $cta);
1592			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1593
1594			appendCTA = function(){
1595				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1596
1597					$ul.after($ulCta);
1598				} else {
1599					$cta.append($ulCta);
1600				}
1601			}
1602		}
1603
1604		if ( ! $body.hasClass('cta-not-appended') ) {
1605			appendCTA();
1606		}
1607
1608		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1609		$smartSocial.each(function(){
1610			var $_smartSocial = $(this);
1611			$('> li', $_smartSocial).each(function(){
1612				var $li = $(this);
1613				if ( $li.hasClass('mobile-hidden') ) {
1614					$_smartSocial.addClass('mobile-hidden');
1615				} else {
1616					$_smartSocial.removeClass('mobile-hidden');
1617					return false;
1618				}
1619			});
1620
1621			$('> li', $_smartSocial).each(function(){
1622				var $li = $(this);
1623				if ( $li.hasClass('tablet-hidden') ) {
1624					$_smartSocial.addClass('tablet-hidden');
1625				} else {
1626					$_smartSocial.removeClass('tablet-hidden');
1627					return false;
1628				}
1629			});
1630		});
1631
1632		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1633			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1634			if ( $body.hasClass('hmenu-center-split') ) {
1635				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1636			} else {
1637				$navLast = $('.navbar-nav-last', $vMenuCont);
1638			}
1639
1640			if ( ! $navLast.length ) {
1641				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1642				if ( $body.hasClass('hmenu-center-split') ) {
1643					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1644					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1645				} else {
1646					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1647					$navLast = $('.navbar-nav-last', $vMenuCont);
1648				}
1649			}
1650
1651			appendSocials = function(){
1652				if ( !$body.hasClass('menu-overlay-center') ) {
1653				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1654				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1655				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1656				// 		$ulSocials.each(function(){
1657				// 			var $li_social = $(this);
1658				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1659				// 		});
1660				// 	}
1661				// } else {
1662					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1663						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1664						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1665							$('> ul.menu-smart-social li', $socials).remove();
1666						}
1667						$navLast.append($ulSocials);
1668					} else {
1669						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1670							$('> ul.menu-smart-social li', $navLast).remove();
1671						}
1672						$socials.append($ulSocials);
1673					}
1674				}
1675			}
1676			appendSocials();
1677		}
1678
1679		if ( $vMenuCont.length ) {
1680			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1681		} else {
1682			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1683		}
1684		if ( $accordion_secondary.length ) {
1685			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1686			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1687				if ( !$accordion_secondary_ph.length ) {
1688					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1689				}
1690				if ( $vMenuCont.length ) {
1691					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1692				} else {
1693					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1694						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1695					} else {
1696						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1697					}
1698				}
1699			} else {
1700				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1701					$accordion_secondary_ph.before($accordion_secondary);
1702				}
1703			}
1704		}
1705
1706		if ( $vMenuCont.length ) {
1707			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1708		} else {
1709			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1710		}
1711
1712		if ( $extra_icons.length ) {
1713			if ( $vMenuCont.length ) {
1714				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1715					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1716						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1717							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1718						$not_social.each(function(){
1719							if ( ! $primary_after.length ) {
1720								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1721								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1722								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1723							}
1724							var $extra_li = $(this);
1725							$primary_after.find('> ul').append($extra_li);
1726						});
1727					} else {
1728						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1729							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1730						$not_social.each(function(){
1731							var $extra_li = $(this);
1732							$extra_icons.find('> ul').append($extra_li);
1733						});
1734					}
1735				} /*else {
1736					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1737					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1738						if ( !$extra_icons_ph.length ) {
1739							$extra_icons.after('<span class="extra-icons-ph" />');
1740						}
1741						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1742							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1743						} else {
1744							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1745						}
1746					} else {
1747						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1748							$extra_icons_ph.before($extra_icons);
1749						}
1750					}
1751				}*/
1752			} else {
1753				if ( ! $body.hasClass('hmenu-center-double') ) {
1754					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1755						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1756							$primary_after = $('.nav.navbar-main-after', $menuCont);
1757
1758						if ( ! $primary_after.length && $not_social.length ) {
1759							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1760								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1761							} else {
1762								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1763							}
1764							$primary_after = $('.nav.navbar-main-after', $menuCont);
1765							$primary_after.append('<ul class="menu-smart sm menu-smart-social" />');
1766						}
1767						var tablet_hidden = true,
1768							mobile_hidden = true;
1769						$not_social.each(function(){
1770							var $extra_li = $(this);
1771							$primary_after.find('> ul').append($extra_li);
1772							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1773								tablet_hidden = false;
1774							}
1775							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1776								mobile_hidden = false;
1777							}
1778						});
1779						if ( tablet_hidden === true && $not_social.length ) {
1780							$primary_after.addClass('tablet-hidden');
1781						}
1782						if ( mobile_hidden === true && $not_social.length ) {
1783							$primary_after.addClass('mobile-hidden');
1784						}
1785					} else {
1786						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1787
1788						if ( $primary_after.length ) {
1789							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1790							$not_social.each(function(){
1791								var $extra_li = $(this);
1792								$extra_icons.find('> ul').append($extra_li);
1793							});
1794							$primary_after.remove();
1795						}
1796					}
1797				}
1798			}
1799		}
1800
1801		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1802			appendSplit = function(){
1803				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1804					if ( $extra_icons.length ) {
1805						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1806							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1807								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1808							$not_social.each(function(){
1809								var $extra_li = $(this);
1810								$append_ul.append($extra_li);
1811							});
1812							if ( $secondNav.length ) {
1813								$secondNav.append($append_ul);
1814							} else {
1815								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1816							}
1817						}
1818					}
1819					if ( $secondNav.length ) {
1820						$secondNav.prepend($ulFirst);
1821					} else {
1822						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1823					}
1824					$firstMenu.hide();
1825				} else {
1826					$firstNav.append($ulFirst);
1827					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1828					if ( $append_ul.length ) {
1829						var $not_social = $('> li:not(.social-icon)', $append_ul);
1830						$not_social.each(function(){
1831							var $extra_li = $(this);
1832							$extra_icons.find('> ul').append($extra_li);
1833						});
1834					}
1835					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1836					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1837					$firstMenu.css({
1838						'display': 'table-cell'
1839					});
1840				}
1841			}
1842		}
1843		appendSplit();
1844
1845		$(window).on( 'resize', function(){
1846			clearRequestTimeout(setCTA);
1847			setCTA = requestTimeout( function() {
1848				appendCTA();
1849				appendSocials();
1850				appendSplit();
1851			}, 10 );
1852		});
1853	}
1854	//menuMobileButton();
1855	menuMobile();
1856	menuOffCanvas();
1857	menuAppend();
1858	menuOverlay();
1859
1860	var stickyDropdownSearch = function(){
1861		var $masthead = $('#masthead'),
1862			$ddSearch = $('.overlay.overlay-search', $masthead),
1863			$styles = $('#stickyDropdownSearch').remove();
1864		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1865			var $menuWrapper = $('.menu-wrapper'),
1866				$navbar = $('.menu-container-mobile', $menuWrapper),
1867				navbarH = $navbar.outerHeight(),
1868				//$topbar = $('.top-menu', $menuWrapper),
1869				//topbarH = $topbar.outerHeight(),
1870				_css;
1871
1872			_css = '<style id="stickyDropdownSearch">';
1873			_css += '@media (max-width: 959px) {';
1874			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
1875			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
1876			_css += '}';
1877			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
1878			_css += 'position: fixed;';
1879			_css += 'top: 0;';
1880			_css += '}';
1881			_css += '</style>';
1882
1883			$(_css).appendTo($('head'));
1884		}
1885	}
1886	stickyDropdownSearch();
1887
1888	var setMenuOverlay;
1889	$(window).on( 'resize', function(){
1890		if ( $('.overlay').length && $(window).width() > 1024 ) {
1891			$('.overlay').addClass('hidden');
1892		}
1893		clearRequestTimeout(setMenuOverlay);
1894		setMenuOverlay = requestTimeout( function(){
1895			menuOverlay();
1896			menuAppend();
1897			stickyDropdownSearch();
1898		}, 150 );
1899	});
1900	UNCODE.menuSmartInit();
1901};
1902
1903UNCODE.menuSmartInit = function() {
1904	var $menusmart = $('[class*="menu-smart"]'),
1905		$masthead = $('#masthead'),
1906		$hMenu = $('.menu-horizontal-inner', $masthead),
1907		$focus = $('.overlay-menu-focus'),
1908		showTimeout = 50,
1909		hideTimeout = 50,
1910		showTimeoutFunc, hideTimeoutFunc;
1911
1912	$('> li.menu-item-has-children', $menusmart).hover(function(){
1913		$(this).data('hover', true);
1914	}, function(){
1915		$(this).data('hover', false);
1916	});
1917
1918	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
1919		e.preventDefault();
1920	});
1921
1922	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
1923		var $notLis = $('> .nav > ul > li a', $hMenu),
1924			$menuA = $('a', $masthead).not($notLis),
1925			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
1926			showFuncCond = function() { return true };
1927
1928		if ( $('body').hasClass('focus-megamenu') ) {
1929			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner');
1930			showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') };
1931		} else if ( $('body').hasClass('focus-links') ) {
1932			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
1933		}
1934
1935		$hoverSelector.hover(function(){
1936			clearRequestTimeout(hideTimeoutFunc);
1937			showTimeoutFunc = requestTimeout(function(){
1938				$('body').addClass('navbar-hover');
1939			}, showTimeout*2);
1940		}, function(){
1941			hideTimeoutFunc = requestTimeout(function(){
1942				if ( ! $('.overlay-search.open', $masthead).length ) {
1943					$('body').removeClass('navbar-hover');
1944				}
1945			}, hideTimeout*2);
1946		});
1947	} else {
1948		showFuncCond = function() { return false };
1949	}
1950
1951	if ($menusmart.length > 0) {
1952		$menusmart.smartmenus({
1953			subIndicators: false,
1954			subIndicatorsPos: 'append',
1955			//subMenusMinWidth: '13em',
1956			subIndicatorsText: '',
1957			showTimeout: showTimeout,
1958			hideTimeout: hideTimeout,
1959			scrollStep: 8,
1960			showFunction: function($ul, complete) {
1961				clearRequestTimeout(showTimeoutFunc);
1962				$ul.fadeIn(0, 'linear', function(){
1963					complete();
1964					if ( $ul.hasClass('vc_row') ) {
1965						$ul.css({
1966							'display': 'table'
1967						});
1968					}
1969					if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) {
1970						$('body').addClass('open-megamenu');
1971					}
1972					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
1973						$('body').addClass('navbar-hover');
1974					}
1975				}).addClass('open-animated');
1976			},
1977			hideFunction: function($ul, complete) {
1978				if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) {
1979					$('body').removeClass('open-megamenu');
1980				}
1981				var fixIE = $('html.ie').length;
1982				if (fixIE) {
1983					var $rowParent = $($ul).closest('.main-menu-container');
1984					$rowParent.height('auto');
1985				}
1986				$ul.fadeOut(0, 'linear', function(){
1987					complete();
1988					$ul.removeClass('open-animated');
1989					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
1990						$('body').removeClass('open-submenu');
1991					}
1992				});
1993			},
1994			collapsibleShowFunction: function($ul, complete) {
1995				$ul.slideDown(400, 'easeInOutCirc', complete);
1996			},
1997			collapsibleHideFunction: function($ul, complete) {
1998				$ul.slideUp(200, 'easeInOutCirc', complete);
1999			},
2000			hideOnClick: SiteParameters.menuHideOnClick,
2001		});
2002
2003		if ( $('body').hasClass('menu-accordion-active') ) {
2004			$menusmart.each(function(key, menu){
2005				$(menu).addClass('menu-smart-init');
2006				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2007			});
2008		}
2009		
2010		$(document).on( 'uncode.smartmenu-appended', function(){
2011			requestTimeout(function(){
2012				$menusmart.smartmenus( 'refresh' );
2013			}, 1000);
2014		});
2015	}
2016
2017	$('.main-menu-container').each(function(){
2018		var $main_cont = $(this),
2019			$uls = $('ul', $main_cont);
2020
2021		$uls.each(function(){
2022			var $ul = $(this),
2023				mobile_hidden = true,
2024				tablet_hidden = true;
2025			$('> li:not(.hidden)', $ul).each(function(){
2026				if ( !$(this).hasClass('mobile-hidden') ) {
2027					mobile_hidden = false;
2028					return false;
2029				}
2030			});
2031			$('> li:not(.hidden)', $ul).each(function(){
2032				if ( !$(this).hasClass('tablet-hidden') ) {
2033					tablet_hidden = false;
2034					return false;
2035				}
2036			});
2037			if ( mobile_hidden ) {
2038				$ul.addClass('mobile-hidden');
2039			}
2040			if ( tablet_hidden ) {
2041				$ul.addClass('tablet-hidden');
2042			}
2043		});
2044
2045		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2046
2047		$divUlsMB.each(function(){
2048			var $divUlMB = $(this),
2049				div_mobile_hidden = true,
2050				div_tablet_hidden = true;
2051
2052			$('> ul:not(.hidden)', $divUlMB).each(function(){
2053				if ( !$(this).hasClass('mobile-hidden') ) {
2054					div_mobile_hidden = false;
2055					return false;
2056				}
2057			});
2058			$('> ul:not(.hidden)', $divUlMB).each(function(){
2059				if ( !$(this).hasClass('tablet-hidden') ) {
2060					div_tablet_hidden = false;
2061					return false;
2062				}
2063			});
2064			if ( div_mobile_hidden ) {
2065				$divUlMB.addClass('mobile-hidden');
2066			}
2067			if ( div_tablet_hidden ) {
2068				$divUlMB.addClass('tablet-hidden');
2069			}
2070		});
2071	});
2072
2073	var overlaySearchButton = function(){
2074		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2075
2076		$search_wrap.each(function(){
2077			var $form = $('form', this),
2078				$icon = $('i', $form);
2079
2080			$icon.on('click', function(){
2081				$form.submit();
2082			});
2083		});
2084	};
2085	overlaySearchButton();
2086}
2087
2088UNCODE.okvideo = function(ev) {
2089	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2090	$.okvideo = function(options) {
2091		// if the option var was just a string, turn it into an object
2092		if (typeof options !== 'object') options = {
2093			'video': options
2094		};
2095		var base = this;
2096		// kick things off
2097		base.init = function() {
2098			base.options = $.extend({}, $.okvideo.options, options);
2099			// support older versions of okvideo
2100			if (base.options.video === null) base.options.video = base.options.source;
2101			base.setOptions();
2102			var target = base.options.target || $('body');
2103			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2104			var zIndex = base.options.controls === 3 ? -999 : "auto";
2105			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2106				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>';
2107				if (OKEvents.utils.isMobile()) {
2108					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>');
2109				} else {
2110					if (base.options.controls === 3) {
2111						target.append(mask)
2112					}
2113					if (base.options.adproof === 1) {
2114						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>');
2115					} else {
2116						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>');
2117					}
2118				}
2119				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2120				if (base.options.playlist.list === null) {
2121					if (base.options.video.provider === 'youtube') {
2122						base.loadYouTubeAPI();
2123					} else if (base.options.video.provider === 'vimeo') {
2124						base.options.volume /= 100;
2125						base.loadVimeoAPI();
2126					}
2127				} else {
2128					base.loadYouTubeAPI();
2129				}
2130			}
2131		};
2132		// clean the options
2133		base.setOptions = function() {
2134			// exchange 'true' for '1' and 'false' for 3
2135			for (var key in this.options) {
2136				if (this.options[key] === true) this.options[key] = 1;
2137				if (this.options[key] === false) this.options[key] = 3;
2138			}
2139			if (base.options.playlist.list === null) {
2140				base.options.video = base.determineProvider();
2141			}
2142			// pass options to the window
2143			$(window).data('okoptions-' + base.options.id, base.options);
2144		};
2145		// insert js into the head and exectue a callback function
2146		base.insertJS = function(src, callback, provider){
2147			var tag;
2148			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2149				delete UNCODE.insertedSripts[src];
2150				var tags = document.getElementsByTagName('script');
2151				for (var i = tags.length; i >= 0; i--){
2152					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2153						tags[i].parentNode.removeChild(tags[i]);
2154					}
2155				}
2156			} else {
2157				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2158					tag = UNCODE.insertedSripts[src];
2159					if (callback){
2160						if (tag.readyState){  //IE
2161							tag.onreadystatechange = function(){
2162								if (tag.readyState === "loaded" ||
2163									tag.readyState === "complete"){
2164									tag.onreadystatechange = null;
2165									callback();
2166								}
2167							};
2168						} else {
2169							$(tag).on('load', callback);
2170						}
2171					}
2172					return;
2173				}
2174			}
2175			tag = document.createElement('script');
2176			if (callback){
2177				if (tag.readyState){  //IE
2178					tag.onreadystatechange = function(){
2179						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2180							tag.onreadystatechange = null;
2181							callback();
2182						}
2183					};
2184				} else {
2185					tag.onload = function() {
2186						callback();
2187					};
2188				}
2189			}
2190			tag.src = src;
2191			var firstScriptTag = document.getElementsByTagName('script')[0];
2192			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2193			if ( ! UNCODE.insertedSripts ) {
2194				UNCODE.insertedSripts = [];
2195			}
2196			UNCODE.insertedSripts[src] = tag;
2197		};
2198		// load the youtube api
2199		base.loadYouTubeAPI = function(callback) {
2200			if ( ev === 'uncode-more-items-loaded' ) {
2201				onYouTubeIframeAPIReady();
2202			} else {
2203				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2204			}
2205		};
2206		base.loadYouTubePlaylist = function() {
2207			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2208		};
2209		// load the vimeo api by replacing the div with an iframe and loading js
2210		base.loadVimeoAPI = function() {
2211			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',
2212			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2213			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2214			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2215			base.insertJS('//player.vimeo.com/api/player.js', function() {
2216				vimeoPlayerReady(base.options.id);
2217			}, 'vimeo');
2218		};
2219		// is it from youtube or vimeo?
2220		base.determineProvider = function() {
2221			var a = document.createElement('a');
2222			a.href = base.options.video;
2223			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2224				var videoid = a.href.split('/')[3].toString();
2225				var query = videoid.substring(videoid.indexOf('?') + 1);
2226				if (query != '') {
2227					var vars = query.split('&');
2228					for (var i = 0; i < vars.length; i++) {
2229						var pair = vars[i].split('=');
2230						if (pair[0] == 'v') {
2231							videoid = pair[1];
2232						}
2233					}
2234				}
2235				return {
2236					"provider": "youtube",
2237					"id": videoid
2238				};
2239			} else if (/vimeo.com/.test(base.options.video)) {
2240				return {
2241					"provider": "vimeo",
2242					"id": (a.href.split('/')[3].toString()).split('#')[0],
2243				};
2244			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2245				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2246				if (id.length == 11) {
2247					return {
2248						"provider": "youtube",
2249						"id": id.toString()
2250					};
2251				} else {
2252					for (var i = 0; i < base.options.video.length; i++) {
2253						if (typeof parseInt(base.options.video[i]) !== "number") {
2254							throw 'not vimeo but thought it was for a sec';
2255						}
2256					}
2257					return {
2258						"provider": "vimeo",
2259						"id": base.options.video
2260					};
2261				}
2262			} else {
2263				throw "OKVideo: Invalid video source";
2264			}
2265		};
2266		base.init();
2267	};
2268
2269	var checkResize,
2270		newW = UNCODE.wwidth;
2271
2272	$.okvideo.options = {
2273		id: null,
2274		source: null, // Deprecate dis l8r
2275		video: null,
2276		playlist: { // eat ur heart out @brokyo
2277			list: null,
2278			index: 0,
2279			startSeconds: 0,
2280			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2281		},
2282		disableKeyControl: 1,
2283		captions: 0,
2284		loop: 1,
2285		hd: 1,
2286		volume: 0,
2287		adproof: false,
2288		unstarted: null,
2289		onFinished: null,
2290		onReady: null,
2291		onPlay: null,
2292		onPause: null,
2293		buffering: null,
2294		controls: false,
2295		autoplay: true,
2296		annotations: true,
2297		cued: null
2298	};
2299	$.fn.okvideo = function(options) {
2300		options.target = this;
2301		return this.each(function() {
2302			(new $.okvideo(options));
2303		});
2304	};
2305
2306	var checkForVideos = function(){
2307		$(".uncode-video-container.video").each(function(index, el) {
2308			var $this = $(this),
2309				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2310				url = $this.attr('data-video'),
2311				id = $this.attr('data-id'),
2312				cloned = $this.closest('.owl-item');
2313
2314			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2315				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2316					$this.okvideo({
2317						id: id,
2318						source: url.split('#')[0],
2319						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2320						autoplay: 1,
2321						controls: 0,
2322						volume: 0,
2323						adproof: 0,
2324						caller: $this,
2325						hd: 1,
2326						onReady: function(player) {
2327							var getPlayer = player.c || player.h || player,
2328							$iframe,
2329							getContainer = $(getPlayer).closest('.background-element');
2330							if (getContainer.length) {
2331								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2332							}
2333
2334							if ( $this.hasClass('drop-move') ) {
2335
2336								var $iframe = $(getPlayer),
2337									w = parseFloat($iframe.attr('width')),
2338									h = parseFloat($iframe.attr('height')),
2339									ratio = h / w,
2340									setResizeiFto,
2341								resizeiFrame = function(){
2342									var dataW = $this.attr('data-w'),
2343										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2344										newH = newW * ratio;
2345									$iframe.css({
2346										width: newW,
2347										height: newH
2348									});
2349								};
2350								resizeiFrame();
2351								$(window).on( 'load', resizeiFrame );
2352								$(window).on( 'resize', function(){
2353									clearRequestTimeout(setResizeiFto);
2354									setResizeiFto = requestTimeout( function() {
2355										resizeiFrame();
2356									}, 10 );
2357								});
2358
2359							}
2360
2361						}
2362					});
2363				}
2364			}
2365		});
2366	};
2367
2368	checkForVideos();
2369
2370	$(window).on('load', function(){
2371		$('.mejs-fullscreen-button button').on('click', function(){
2372			var $button = $(this),
2373				$stuck = $button.closest('.is_stucked');
2374
2375			if ( $stuck.length ) {
2376				$stuck = $(this).trigger("sticky_kit:detach");
2377				window.scrollTo(0, 0);
2378			}
2379		});
2380	});
2381
2382	var checkVideoResize = function(){
2383		clearRequestTimeout(checkResize);
2384		checkResize = requestTimeout(function(){
2385			if ( newW !== UNCODE.wwidth ) {
2386				newW = UNCODE.wwidth;
2387				checkForVideos();
2388			}
2389		}, 1000);
2390	};
2391
2392	$(window).off('resize', checkVideoResize)
2393	.on( 'resize', checkVideoResize);
2394
2395};
2396
2397UNCODE.backgroundSelfVideos = function( $ctx ) {
2398
2399	var backgroundSelfVideosInit = function( $ctx ) {
2400		if ( SiteParameters.block_mobile_videos === true ) {
2401			return false;
2402		}
2403		if (typeof MediaElement === "function") {
2404			if ( typeof $ctx === 'undefined' ) {
2405				$ctx = document;
2406			}
2407		
2408			$(".background-video-shortcode", $ctx).each(function(index, el) {
2409				if ( $(this).closest('mediaelementwrapper').length ) {
2410					return true;
2411				}
2412				var $video_el = $(this),
2413					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2414					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2415					video_id = $video_el.attr('id');
2416
2417				if ( SiteParameters.is_frontend_editor ) {
2418					video_id = video_id + '_' + index;
2419					$video_el.attr('id', video_id);
2420				}
2421
2422				var media = new MediaElement(video_id, {
2423					startVolume: 0,
2424					loop: true,
2425					success: function(mediaElement, domObject) {
2426						domObject.volume = 0;
2427						$(mediaElement).data('started', false);
2428						mediaElement.addEventListener('timeupdate', function(e) {
2429							if (!$(e.target).data('started')) {
2430								$(mediaElement).data('started', true);
2431							}
2432						});
2433						mediaElement.addEventListener('loadedmetadata', function(e) {
2434							$('body').removeClass('video-not-supported');
2435							mediaElement.play();
2436						});
2437						if (!UNCODE.isMobile) {
2438							requestTimeout(function() {
2439								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2440							}, 100);
2441						}
2442						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2443							mediaElement.play();
2444						}
2445
2446						if ( $parent_drop_move.length ) {
2447							var setResizeMEto,
2448								resizeMediaElement = function(){
2449								var dataW = $parent_drop_move.attr('data-w'),
2450									videoW = domObject.width,
2451									videoH = domObject.height,
2452									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2453									newH = newW / ( videoW / videoH );
2454
2455								$(domObject).css({
2456									'height': newH,
2457									'width': newW
2458								});
2459							};
2460							$(window).on( 'resize load', function(){
2461								clearRequestTimeout(setResizeMEto);
2462								setResizeMEto = requestTimeout( function() {
2463									resizeMediaElement();
2464								}, 10 );
2465							});
2466						}
2467
2468						mediaElement.addEventListener('play', function() {
2469							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2470							$(mediaElement).closest('#page-header').addClass('video-started');
2471							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2472						}, true);
2473
2474					},
2475					// fires when a problem is detected
2476					error: function() {}
2477				});
2478			});
2479		} else {
2480
2481			if ( typeof $ctx === 'undefined' ) {
2482				$ctx = document;
2483			}
2484		
2485			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2486			Array.from(videos).forEach(function(video_el) {
2487				video_el.addEventListener('loadedmetadata', function(e) {
2488					$('body').removeClass('video-not-supported');
2489					video_el.play();
2490				});
2491				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2492					video_el.muted = true;
2493					video_el.loop = true;
2494					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2495					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2496					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2497					$('body').removeClass('video-not-supported');
2498					video_el.play();
2499				} else {
2500					requestTimeout(function(){
2501                         backgroundSelfVideosInit( $ctx );
2502					}, 1000);
2503				}
2504			});
2505		}
2506	};
2507
2508	backgroundSelfVideosInit( $ctx );
2509
2510	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2511		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2512			var $el = model.view.$el,
2513				shortcode = model.attributes.shortcode;
2514
2515			if (typeof MediaElement === "function") {
2516				backgroundSelfVideosInit( $el );
2517			} else {
2518				backgroundSelfVideosInit( $el[0] );
2519			}
2520		});
2521	}
2522};
2523
2524UNCODE.is_scrolling = false;
2525
2526UNCODE.disableHoverScroll = function() {
2527
2528	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2529		var body = document.body,
2530		timer;
2531
2532		window.addEventListener('scroll', function() {
2533			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2534			clearRequestTimeout(timer);
2535			if ( body.classList && !body.classList.contains('disable-hover') ) {
2536				body.classList.add('disable-hover');
2537				window.dispatchEvent(new CustomEvent('disable-hover'));
2538			}
2539			UNCODE.is_scrolling = true;
2540
2541			timer = requestTimeout(function() {
2542				if ( body.classList ) {
2543					body.classList.remove('disable-hover');
2544					window.dispatchEvent(new CustomEvent('enable-hover'));
2545				}
2546				UNCODE.is_scrolling = false;
2547			}, delay);
2548		}, false);
2549	}
2550};
2551
2552UNCODE.isotopeLayout = function() {
2553	if ($('.isotope-layout').length > 0) {
2554		var isotopeContainersArray = [],
2555			typeGridArray = [],
2556			layoutGridArray = [],
2557			screenLgArray = [],
2558			screenMdArray = [],
2559			screenSmArray = [],
2560			transitionDuration = [],
2561			$filterItems = [],
2562			$filters = $('.isotope-system .isotope-filters'),
2563			$itemSelector = '.tmb-iso',
2564			$items,
2565			itemMargin,
2566			correctionFactor = 0,
2567			firstLoad = true,
2568			isOriginLeft = $('body').hasClass('rtl') ? false : true;
2569		$('[class*="isotope-container"]').each(function(index) {
2570			var _this = $(this);
2571			var isoData = _this.data(),
2572			$data_lg,
2573			$data_md,
2574			$data_sm;
2575			_this.children('.tmb').addClass('tmb-iso');
2576			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
2577			else $data_lg = '1000';
2578			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
2579			else $data_md = '600';
2580			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
2581			else $data_sm = '480';
2582			screenLgArray.push($data_lg);
2583			screenMdArray.push($data_md);
2584			screenSmArray.push($data_sm);
2585			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
2586			if (isoData.type == 'metro') typeGridArray.push(true);
2587			else typeGridArray.push(false);
2588			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
2589			else layoutGridArray.push('masonry');
2590			isotopeContainersArray.push(_this);
2591			_this.attr('data-iso-index', index);
2592		});
2593		var colWidth = function(index) {
2594				$(isotopeContainersArray[index]).width('');
2595				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
2596					widthAvailable = $(isotopeContainersArray[index]).width(),
2597					columnNum = 12,
2598					columnWidth = 0,
2599					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
2600					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
2601					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
2602					$rowContainer,
2603					paddingRow,
2604					$colContainer,
2605					paddingCol;
2606
2607				if ( consider_menu )
2608					winHeight = winHeight - UNCODE.menuHeight;
2609
2610				if ( data_vp_height === '1' ) {
2611					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
2612					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
2613					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
2614					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
2615					winHeight = winHeight - ( paddingRow + paddingCol );
2616				}
2617
2618				if (isPx) {
2619					columnWidth = Math.ceil(widthAvailable / columnNum);
2620					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
2621				} else {
2622					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
2623				}
2624				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
2625				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
2626				for (var i = 0, len = $items.length; i < len; i++) {
2627					var $item = $($items[i]),
2628						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
2629						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
2630						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
2631
2632
2633					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
2634						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
2635					}
2636
2637					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
2638						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
2639					}
2640
2641					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
2642						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2643							switch (parseInt(multiplier_w[1])) {
2644								case (5):
2645								case (4):
2646								case (3):
2647									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2648									multiplier_w[1] = 6;
2649									break;
2650								case (2):
2651								case (1):
2652									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
2653									multiplier_w[1] = 3;
2654									break;
2655								default:
2656									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2657									multiplier_w[1] = 12;
2658									break;
2659							}
2660
2661							if (multiplier_w[1] == 2.4) { // 5 columns
2662								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2663								multiplier_w[1] = 6;
2664							}
2665						}
2666					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
2667						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2668							switch (parseInt(multiplier_w[1])) {
2669								case (5):
2670								case (4):
2671								case (3):
2672								case (2):
2673								case (1):
2674									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2675									multiplier_w[1] = 6;
2676									break;
2677								default:
2678									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2679									multiplier_w[1] = 12;
2680									break;
2681							}
2682
2683							if (multiplier_w[1] == 2.4) { // 5 columns
2684								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2685								multiplier_w[1] = 6;
2686							}
2687						}
2688					} else if (widthAvailable < screenSmArray[index]) {
2689						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2690							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2691							multiplier_w[1] = 12;
2692							if (typeGridArray[index]) multiplier_h[1] = 12;
2693						}
2694					}
2695					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
2696						height;
2697
2698					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
2699						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
2700						if ( widthAvailable < screenSmArray[index] ) {
2701							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
2702						}
2703					} else {
2704						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
2705					}
2706
2707					if (width >= widthAvailable) {
2708						$item.css({
2709							width: widthAvailable
2710						});
2711						if (typeGridArray[index]) {
2712							$item.children().add($item.find('.backimg')).css({
2713								height: height
2714							});
2715						}
2716					} else {
2717						$item.css({
2718							width: width
2719						});
2720						if (typeGridArray[index]) {
2721							$item.children().add($item.find('.backimg')).css({
2722								height: height
2723							});
2724						}
2725					}
2726				}
2727				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
2728					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
2729				} else {
2730					return columnWidth;
2731				}
2732			},
2733			init_isotope = function() {
2734				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
2735					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
2736						isotopeId = isotopeSystem.attr('id'),
2737						$layoutMode = layoutGridArray[i],
2738						setIsotopeFirstRowTimeOut,
2739					setIsotopeFirstRow = function(items){
2740						var firstRow = true;
2741						$(items).each(function(index, val){
2742							var el = items[index].element,
2743								el_top = items[index].position.y,
2744								$el = $(el);
2745							if ( index > 0 && el_top > 0 && firstRow ) {
2746								firstRow = false;
2747							} else if ( index == 0 && el_top == 0 ) {
2748								firstRow = true;
2749							}
2750							if ( firstRow ) {
2751								$el.removeClass('tmb-isotope-further-row');
2752							} else {
2753								$el.addClass('tmb-isotope-further-row');
2754							}
2755						});
2756					};
2757					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
2758						//resizable: true,
2759						itemSelector: $itemSelector,
2760						layoutMode: $layoutMode,
2761						transitionDuration: transitionDuration[i],
2762						masonry: {
2763							columnWidth: colWidth(i)
2764						},
2765						vertical: {
2766							horizontalAlignment: 0.5,
2767						},
2768						sortBy: 'original-order',
2769						isOriginLeft: isOriginLeft
2770					})
2771					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
2772					.on('layoutComplete', function( event, items ){
2773						if ( typeof items[0] !== 'undefined' ) {
2774							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2775								setIsotopeFirstRow(items);
2776							}
2777						}
2778					})
2779					.on('arrangeComplete', function( event, items ){
2780						if ( typeof items[0] !== 'undefined' ) {
2781							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2782								clearRequestTimeout(setIsotopeFirstRowTimeOut);
2783								setIsotopeFirstRowTimeOut = requestTimeout(function(){
2784									setIsotopeFirstRow(items);
2785								}, 100);
2786							}
2787						}
2788					});
2789					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
2790						$(isotopeContainersArray[i]).infinitescroll({
2791								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
2792								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
2793								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
2794								animate: false,
2795								behavior: 'local',
2796								debug: false,
2797								loading: {
2798									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
2799									speed: 0,
2800									finished: undefined,
2801									msg: $('#' + isotopeId + ' .loadmore-button'),
2802								},
2803								errorCallback: function() {
2804									var isotope_system = $(this).closest('.isotope-system');
2805									$('.loading-button', isotope_system).hide();
2806									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
2807								}
2808							},
2809							// append the new items to isotope on the infinitescroll callback function.
2810							function(newElements, opts) {
2811								var $isotope = $(this),
2812									isotope_system = $isotope.closest('.isotope-system'),
2813									isotopeId = isotope_system.attr('id'),
2814									filters = new Array(),
2815									$loading_button = isotope_system.find('.loading-button'),
2816									$infinite_button = isotope_system.find('.loadmore-button'),
2817									$numPages = $('a', $infinite_button).data('pages'),
2818									$woo_results,
2819									delay = 300;
2820								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
2821								$infinite_button.show();
2822								$loading_button.hide();
2823								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
2824								$('> li', $isotope).remove();
2825								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
2826								$.each($(newElements), function (index, val) {
2827									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
2828										$woo_results = $(val);
2829										delete newElements[index];
2830									} else {
2831										$(val).addClass('tmb-iso');
2832										if ($(val).is("li")) {
2833											filters.push($(val)[0]);
2834										}
2835									}
2836									$(val).addClass('uncode-appended');
2837								});
2838								newElements = newElements.filter(function(x) {
2839									return filters.indexOf(x) < 0
2840								});
2841								$.each($(filters), function(index, val) {
2842									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
2843								});
2844								if ($woo_results && $woo_results.length > 0) {
2845									var old_count = isotope_system.find('.woocommerce-result-count').text();
2846									var new_count = $woo_results.find('.woocommerce-result-count').text();
2847									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
2848									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
2849									function replaceMatch(match, p1, p2) {
2850        								return old_start + '–' + new_end;
2851									}
2852									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
2853									isotope_system.find('.woocommerce-result-count').text(new_count_text);
2854								}
2855								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
2856								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2857									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
2858									if (typeof getLightbox === 'object') {
2859										getLightbox.refresh();
2860									} else {
2861										UNCODE.lightbox();
2862									}
2863								}
2864								if ( typeof twttr !== 'undefined' )
2865									twttr.widgets.load(isotopeContainersArray[i]);
2866
2867								requestTimeout(function() {
2868									Waypoint.refreshAll();
2869									$isotope.trigger('more-items-loaded');
2870									$(window).trigger('more-items-loaded');
2871									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
2872								}, 1000);
2873
2874							});
2875						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
2876							var $infinite_isotope = $(isotopeContainersArray[i]),
2877								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
2878							$infinite_isotope.infinitescroll('pause');
2879							$infinite_button.on('click', function(event) {
2880								event.preventDefault();
2881								var $infinite_system = $(event.target).closest('.isotope-system'),
2882								$infinite_isotope = $infinite_system.find('.isotope-container'),
2883								isotopeId = $infinite_system.attr('id');
2884								$(event.currentTarget).html(SiteParameters.loading);
2885								$infinite_isotope.infinitescroll('resume');
2886								$infinite_isotope.infinitescroll('retrieve');
2887								$infinite_isotope.infinitescroll('pause');
2888							});
2889						}
2890					}
2891				}
2892			},
2893			onLayout = function(isotopeObj, startIndex, needsReload) {
2894				var needsReload = needsReload ? true : false;
2895
2896				if (typeof UNCODE.bigText !== 'undefined') {
2897					UNCODE.bigText();
2898				}
2899				isotopeObj.css('opacity', 1);
2900				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
2901
2902				requestTimeout(function() {
2903					if (startIndex > 0) {
2904						reloadIsotope(isotopeObj);
2905						if (SiteParameters.dynamic_srcset_active === '1') {
2906							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2907							UNCODE.adaptive_srcset(isotopeObj);
2908						}
2909						// window.dispatchEvent(UNCODE.boxEvent);
2910					} else if (needsReload) {
2911						reloadIsotope(isotopeObj);
2912					}
2913
2914					UNCODE.adaptive();
2915					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
2916						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2917					}
2918					if (typeof MediaElement === "function") {
2919						$(isotopeObj).find('audio,video').each(function() {
2920							$(this).mediaelementplayer({
2921	 							pauseOtherPlayers: false,
2922							});
2923						});
2924					}
2925					if ($(isotopeObj).find('.nested-carousel').length) {
2926						if (typeof UNCODE.carousel !== 'undefined') {
2927							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
2928						}
2929						requestTimeout(function() {
2930							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2931						}, 200);
2932					} else {
2933						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2934					}
2935					isotopeObj.trigger('isotope-layout-complete');
2936
2937				}, 100);
2938
2939			},
2940			boxAnimation = function(items, startIndex, sequential, container) {
2941				var $allItems = items.length - startIndex,
2942					showed = 0,
2943					index = 0;
2944				if (container.closest('.owl-item').length == 1) return false;
2945				$.each(items, function(index, val) {
2946					var $this = $(val),
2947						elInner = $('> .t-inside', val);
2948					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
2949						return;
2950					}
2951					if (val[0]) val = val[0];
2952					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
2953						new Waypoint({
2954							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
2955							element: val,
2956							handler: function() {
2957								var element = $('> .t-inside', this.element),
2958									parent = $(this.element),
2959									currentIndex = parent.index();
2960								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
2961									delayAttr = parseInt(element.attr('data-delay'));
2962								if (isNaN(delayAttr)) delayAttr = 100;
2963								delay -= showed;
2964								var objTimeout = requestTimeout(function() {
2965									element.removeClass('zoom-reverse').addClass('start_animation');
2966									showed = parent.index();
2967									if ( container.data('isotope') ) {
2968										container.isotope('layout');
2969									}
2970								}, delay * delayAttr)
2971								parent.data('objTimeout', objTimeout);
2972								if (!UNCODE.isUnmodalOpen) {
2973									this.destroy();
2974								}
2975							},
2976							offset: '100%'
2977						})
2978					} else {
2979						if (elInner.hasClass('force-anim')) {
2980							elInner.addClass('start_animation');
2981						} else {
2982							elInner.css('opacity', 1);
2983						}
2984						container.isotope('layout');
2985					}
2986
2987					index++;
2988				});
2989			},
2990			reloadIsotope = function(isotopeObj) {
2991				var isoIndex = $(isotopeObj).attr('data-iso-index');
2992				var $layoutMode = ($(isotopeObj).data('layout'));
2993				if ($layoutMode === undefined) {
2994					$layoutMode = 'masonry';
2995				}
2996				if (isotopeObj.data('isotope')) {
2997					isotopeObj.isotope({
2998						itemSelector: $itemSelector,
2999						layoutMode: $layoutMode,
3000						transitionDuration: transitionDuration[isoIndex],
3001						masonry: {
3002							columnWidth: colWidth(isoIndex)
3003						},
3004						vertical: {
3005							horizontalAlignment: 0.5,
3006						},
3007						sortBy: 'original-order',
3008						isOriginLeft: isOriginLeft
3009					});
3010				}
3011			}
3012			;
3013		if ($('.isotope-pagination').length > 0) {
3014			$('.isotope-system').on('click', '.pagination a', function(evt) {
3015				evt.preventDefault();
3016
3017				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3018					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3019						container = $(this).closest('.isotope-system'),
3020						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3021					calc_scroll -= UNCODE.get_scroll_offset();
3022
3023					var menu_container = $('.menu-sticky');
3024					var menu = menu_container.find('.menu-container');
3025
3026					if (menu_container.length > 0 && menu.length > 0) {
3027						calc_scroll = calc_scroll - menu.outerHeight();
3028					}
3029
3030					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3031						delta = bodyTop - calc_scroll,
3032						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3033					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3034
3035					if (!UNCODE.isFullPage) {
3036						if (scrollSpeed == 0) {
3037							$('html, body').scrollTop(calc_scroll);
3038						} else {
3039							$('html, body').animate({
3040								scrollTop: calc_scroll
3041							}, {
3042								easing: 'easeInOutQuad',
3043								duration: scrollSpeed,
3044								complete: function () {
3045									UNCODE.scrolling = false;
3046								}
3047							});
3048						}
3049					}
3050				}
3051
3052				loadIsotope($(this), true);
3053			});
3054		}
3055		$filters.on('click', 'a.isotope-nav-link', function(evt) {
3056			if ($(this).hasClass('no-isotope-filter')) {
3057				return;
3058			}
3059			var $filter = $(this),
3060				filterContainer = $filter.closest('.isotope-filters'),
3061				filterValue = $filter.attr('data-filter'),
3062				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
3063				transitionDuration = container.data().isotope.options.transitionDuration,
3064				delay = 300,
3065				filterItems = [];
3066
3067			var filter_items = function(){
3068				if (filterValue !== undefined) {
3069					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3070						var parent = $(val).parent(),
3071							objTimeout = parent.data('objTimeout');
3072						if (objTimeout) {
3073							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3074							clearRequestTimeout(objTimeout);
3075						}
3076						if (transitionDuration == 0) {
3077							if ($(val).hasClass('animate_when_almost_visible')) {
3078								$(val).addClass('zoom-reverse').removeClass('start_animation');
3079							} else {
3080								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3081							}
3082						}
3083					});
3084					requestTimeout(function(){
3085						if ( filterValue == '*' ) {
3086							container.removeClass('isotope-filtered');
3087						} else {
3088							container.addClass('isotope-filtered');
3089						}
3090						container.isotope({
3091							filter: function() {
3092								var block = $(this),
3093								filterable = (filterValue == '*') || block.hasClass(filterValue),
3094								lightboxElements = $('[data-lbox^=ilightbox]', block);
3095								if (filterable) {
3096									if (lightboxElements.length) {
3097										lightboxElements.removeClass('lb-disabled');
3098										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3099									}
3100									filterItems.push(block);
3101								} else {
3102									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3103								}
3104								container.trigger('more-items-loaded');
3105								$(window).trigger('more-items-loaded');
3106								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3107								return filterable;
3108							}
3109						});
3110						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3111
3112					}, delay);
3113
3114					/** once filtered - start **/
3115					container.isotope('once', 'arrangeComplete', function() {
3116						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3117							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3118							if (typeof getLightbox === 'object') {
3119								getLightbox.refresh();
3120							} else {
3121								UNCODE.lightbox();
3122							}
3123						}
3124						if (transitionDuration == 0) {
3125							requestTimeout(function() {
3126								boxAnimation(filterItems, 0, false, container);
3127							}, 100);
3128						}
3129						requestTimeout(function() {
3130							Waypoint.refreshAll();
3131						}, 2000);
3132					});
3133					/** once filtered - end **/
3134				} else {
3135					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3136						$.each(UNCODE.lightboxArray, function(index, val) {
3137							UNCODE.lightboxArray[index].destroy();
3138						});
3139					}
3140					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3141						var parent = $(val).parent(),
3142							objTimeout = parent.data('objTimeout');
3143						if (objTimeout) {
3144							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3145							clearRequestTimeout(objTimeout);
3146						}
3147						if (transitionDuration == 0) {
3148							if ($(val).hasClass('animate_when_almost_visible')) {
3149								$(val).addClass('zoom-reverse').removeClass('start_animation');
3150							} else {
3151								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3152							}
3153						}
3154					});
3155					container.parent().addClass('grid-loading');
3156					loadIsotope($filter);
3157				}
3158			};
3159
3160			if (!$filter.hasClass('active')) {
3161				/** Scroll top with filtering */
3162				if (filterContainer.hasClass('filter-scroll')) {
3163                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3164                    calc_scroll -= UNCODE.get_scroll_offset();
3165
3166					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3167						delta = bodyTop - calc_scroll,
3168						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3169						filterTolerance = false,
3170						filter_timeout;
3171					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3172
3173					if ( !UNCODE.isFullPage ) {
3174						if (scrollSpeed == 0) {
3175							$('html, body').scrollTop(calc_scroll);
3176							UNCODE.scrolling = false;
3177							filter_items();
3178						} else {
3179
3180							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3181								filter_items();
3182								filterTolerance = true;
3183							}
3184
3185							$('html, body').animate({
3186								scrollTop: calc_scroll
3187							},{
3188								easing: 'easeInOutQuad',
3189								duration: scrollSpeed,
3190								complete: function(){
3191									UNCODE.scrolling = false;
3192									if ( !filterTolerance ) {
3193										filter_timeout = setTimeout(function(){
3194											clearTimeout(filter_timeout);
3195											filter_items();
3196										}, 200);
3197									}
3198								}
3199							});
3200						}
3201					}
3202				} else {
3203					filter_items();
3204				}
3205			}
3206			evt.preventDefault();
3207		});
3208
3209		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3210			var params = UNCODE.getURLParams(window.location);
3211			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3212
3213			UNCODE.lastURL = window.location.href;
3214
3215			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
3216				return;
3217			}
3218
3219			if (params.id === undefined) {
3220				$.each($('.isotope-system'), function(index, val) {
3221					loadIsotope($(val));
3222				});
3223			} else {
3224				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3225					loadIsotope($('#' + params.id));
3226				}
3227			}
3228		});
3229
3230		var loadIsotope = function($href, $paginating) {
3231			var is_paginating = false;
3232
3233			if (undefined !== $paginating && $paginating) {
3234				var is_paginating = $paginating;
3235			}
3236
3237			var href = ($href.is("a") ? $href.attr('href') : location),
3238				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3239				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3240				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3241				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3242				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3243				isotopeId = isotopeSystem.attr('id');
3244			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3245				UNCODE.lastURL = href;
3246				history.pushState({
3247					myIsotope: true
3248				}, document.title, href);
3249			}
3250			if (is_paginating) {
3251				isotopeWrapper.addClass('grid-filtering');
3252			}
3253			$.ajax({
3254				url: href
3255			}).done(function(data) {
3256				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3257					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3258					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3259				isotopeWrapper.addClass('isotope-reloaded');
3260				requestTimeout(function() {
3261					isotopeWrapper.removeClass('grid-loading');
3262					isotopeWrapper.removeClass('isotope-reloaded');
3263					isotopeWrapper.removeClass('grid-filtering');
3264				}, 500);
3265				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3266					var parent = $(val).parent(),
3267						objTimeout = parent.data('objTimeout');
3268					if (objTimeout) {
3269						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3270						clearRequestTimeout(objTimeout);
3271					}
3272					if ($(val).hasClass('animate_when_almost_visible')) {
3273						$(val).addClass('zoom-reverse').removeClass('start_animation');
3274					} else {
3275						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3276					}
3277				});
3278				requestTimeout(function() {
3279					if (isotopeContainer.data('isotope')) {
3280						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3281						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3282						UNCODE.adaptive();
3283						if (SiteParameters.dynamic_srcset_active === '1') {
3284							UNCODE.adaptive_srcset(isotopeContainer);
3285						}
3286						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3287							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3288							if (typeof getLightbox === 'object') {
3289								getLightbox.refresh();
3290							} else {
3291								UNCODE.lightbox();
3292							}
3293						}
3294					}
3295					isotopeContainer.trigger('more-items-loaded');
3296					$(window).trigger('more-items-loaded');
3297					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3298				}, 300);
3299				$('.pagination', isotopeFooter).remove();
3300				isotopeFooter.append($resultPagination);
3301
3302				if (isotopeResultCount.length > 0) {
3303					$('.woocommerce-result-count', isotopeResultCount).remove();
3304					isotopeResultCount.append($resultCount);
3305				}
3306			});
3307		};
3308		$filters.each(function(i, buttonGroup) {
3309			var $buttonGroup = $(buttonGroup);
3310			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3311				$buttonGroup.find('.active').removeClass('active');
3312				$(this).addClass('active');
3313
3314			});
3315
3316			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3317				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3318				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3319			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3320				e.preventDefault();
3321				$cats_filters.slideToggle(400, 'easeInOutCirc');
3322			});
3323
3324		});
3325		window.addEventListener('boxResized', function(e) {
3326			if (UNCODE.printDialogOpen !== false) {
3327				return false;
3328			}
3329			$.each($('.isotope-layout'), function(index, val) {
3330				var $layoutMode = ($(this).data('layout'));
3331				if ($layoutMode === undefined) $layoutMode = 'masonry';
3332				if ($(this).data('isotope')) {
3333					$(this).isotope({
3334						itemSelector: $itemSelector,
3335						layoutMode: $layoutMode,
3336						transitionDuration: transitionDuration[index],
3337						masonry: {
3338							columnWidth: colWidth(index)
3339						},
3340						vertical: {
3341							horizontalAlignment: 0.5,
3342						},
3343						sortBy: 'original-order',
3344						isOriginLeft: isOriginLeft
3345					});
3346					$(this).isotope('unbindResize');
3347					if (SiteParameters.dynamic_srcset_active === '1') {
3348						UNCODE.refresh_dynamic_srcset_size($(this));
3349					}
3350				}
3351				$(this).find('.mejs-video,.mejs-audio').each(function() {
3352					$(this).trigger('resize');
3353				});
3354			});
3355		}, false);
3356
3357		init_isotope();
3358	};
3359}
3360
3361UNCODE.lightbox = function() {
3362	if ( SiteParameters.lbox_enhanced ) {
3363		return true;
3364	}
3365	UNCODE.lightboxArray = {};
3366	requestTimeout(function() {
3367		var groupsArr = {};
3368		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3369			var group = this.getAttribute("data-lbox"),
3370				values = $(this).data();
3371			$(this).attr('data-lbox-init','true')
3372			groupsArr[group] = values;
3373		});
3374		for (var i in groupsArr) {
3375			var skin = groupsArr[i].skin || 'black',
3376				path = groupsArr[i].dir || 'horizontal',
3377				thumbs = !groupsArr[i].notmb || false,
3378				arrows = !groupsArr[i].noarr || false,
3379				social = groupsArr[i].social || false,
3380				deeplink = groupsArr[i].deep || false,
3381				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3382				counter = $els.length,
3383				dataAlbum = $els.attr('data-album');
3384			if (social) social = {
3385				facebook: true,
3386				twitter: true,
3387				reddit: true,
3388				digg: true
3389			};
3390			UNCODE.lightboxArray[i] = $els.iLightBox({
3391				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3392				skin: skin,
3393				path: path,
3394				linkId: deeplink,
3395				infinite: false,
3396				//fullViewPort: 'fit',
3397				smartRecognition: false,
3398				fullAlone: true,
3399				maxScale: 1,
3400				minScale: .02,
3401				//fullStretchTypes: 'flash, video',
3402				overlay: {
3403					opacity: .94
3404				},
3405				controls: {
3406					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3407					fullscreen: true,
3408					thumbnail: thumbs,
3409					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3410				},
3411				show: {
3412					speed: 200
3413				},
3414				hide: {
3415					speed: 200
3416				},
3417				social: {
3418					start: false,
3419					buttons: social
3420				},
3421				caption: {
3422					start: false
3423				},
3424				styles: {
3425					nextOpacity: 1,
3426					nextScale: 1,
3427					prevOpacity: 1,
3428					prevScale: 1
3429				},
3430				effects: {
3431					switchSpeed: 400
3432				},
3433				slideshow: {
3434					pauseTime: 5000
3435				},
3436				thumbnails: {
3437					maxWidth: 60,
3438					maxHeight: 60,
3439					activeOpacity: .2
3440				},
3441				html5video: {
3442					preload: true
3443				},
3444				callback: {
3445					onOpen: function(){
3446						$(window).trigger('uncode-custom-cursor');
3447						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3448							iNoBounce.enable();
3449						}
3450					},
3451					onHide: function(){
3452						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3453							iNoBounce.disable()
3454						}
3455					},
3456				}
3457			});
3458
3459			$(document).on('infinite-loaded', function(){
3460				UNCODE.lightboxArray[i].refresh();
3461			});
3462
3463			$(window).on('gdprOpen', function(){
3464				UNCODE.lightboxArray[i].close();
3465			});
3466		};
3467	}, 100);
3468
3469	$(document).on('click', '.lb-disabled', function(e){
3470		e.preventDefault();
3471	});
3472};
3473
3474UNCODE.lightgallery = function( $el ) {
3475	var createSelectors = function(){
3476		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
3477			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3478				$(this).addClass('lbox-trigger-item');
3479			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3480				$(this).addClass('lbox-nested-item');
3481			} else {
3482				$(this).removeClass('lbox-trigger-item');
3483				$(this).removeClass('lbox-nested-item');
3484			}
3485		});
3486	};
3487
3488	createSelectors();
3489
3490	var galleries = [],
3491		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3492			return !$(this).closest('.nested-carousel').length;
3493		}),
3494		$_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:not([data-lbox-init]), .grid-container:not([data-lbox-init]), .btn-container' + 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 *'), 
3495		$galleries = $_galleries.filter(function( index ) {
3496			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3497		}),
3498		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3499
3500	if ( typeof $el === 'undefined' ) {
3501		$el = $galleries.add( $nested );
3502	}
3503
3504	var $disabled = $('a.lb-disabled');
3505	$disabled.on('click', function(e){
3506		e.preventDefault();
3507	});
3508
3509	var beforeSlide = function(event) {
3510		var detail = event.detail,
3511			info = detail.info,
3512			item = detail.item,
3513			$slide = $(detail.currentSlide.selector),
3514			$video = $('video', $slide),
3515			$previous = $(detail.previousSlide.selector),
3516			$prevVideo = $('video', $previous),
3517			isAudio = false;
3518
3519		if ( typeof info.src !== 'undefined' ) {
3520			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3521		}
3522
3523		if ( ! $video.length && ( info.video || isAudio ) ) {
3524			if ( info.video ) {
3525				if ( typeof info.video === 'object' ) {
3526					var infoJson = info.video;
3527				} else {
3528					var infoJson = JSON.parse(info.video);
3529				}
3530				var src = infoJson.source[0].src,
3531					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3532					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3533					loop = $(item).attr('data-loop');
3534
3535			} else if ( isAudio ) {
3536				var src = info.src,
3537					autoplay = true,
3538					loop = false;
3539			}
3540			if ( typeof src !== 'undefined' ) {
3541				$slide.addClass('has-html5');
3542				var video = document.createElement('video');
3543				video.src = src;
3544				video.preload = 'auto';
3545				video.controls = 'controls';
3546				video.controlsList = 'nodownload';
3547				if ( autoplay ) {
3548					video.autoplay = 'autoplay';
3549				}
3550				if ( muted ) {
3551					video.muted = 'muted';
3552				}
3553				if ( loop ) {
3554					video.loop = 'loop';
3555				}
3556				$(video).appendTo($slide);
3557			}
3558		} else {
3559			var $video = $('video', $slide);
3560			if ( $video.length ) {
3561				$video[0].currentTime = 0;
3562				if ( $video[0].autoplay ) {
3563					$video[0].play();
3564				}
3565			}
3566		}
3567		if ( $prevVideo.length ) {
3568			$prevVideo[0].currentTime = 0;
3569			$prevVideo[0].pause();
3570		}
3571	};
3572
3573	var beforeOpen = function(event) {
3574		var detail = event.detail,
3575			items = detail.items,
3576			galleryItems = detail.galleryItems,
3577			outer = detail.outer.selector,
3578			i, ii;
3579		for ( i = 0; i < galleryItems.length; i++ ) {
3580			var item = galleryItems[i];
3581			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
3582				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
3583			}
3584		}
3585		for ( ii = 0; ii < items.length; ii++ ) {
3586			var item = items[ii];
3587			if ( $(item).attr('data-icon') === 'video' ) {
3588				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
3589			}
3590		}
3591
3592	};
3593
3594	//caption builder
3595	var captionBuilder = function($el){
3596		$el.each( function( index, val ) {
3597			var $gallery = $(this).attr('data-lbox-init','true'),
3598				$_a = '.lbox-trigger-item',
3599				$_nested_a = '.lbox-nested-item';
3600
3601			$gallery.find($_a, $_nested_a).each(function(){
3602				var $a = $(this),
3603					$img = $('img', $a).first(),
3604					imgw = $img.attr('data-width'),
3605					imgh = $img.attr('data-height'),
3606					caption = $a.attr('data-caption'),
3607					title = $a.attr('data-title');
3608
3609				if ( $img.length && $img.attr('data-crop') != true ) {
3610					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
3611						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
3612					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
3613						$a.attr('data-external-thumb-image', $img[0].src);
3614					}
3615				}
3616
3617				if ( typeof title !== 'undefined' && title !== '' ) {
3618					title = '<h6>' + title + '</h6>';
3619				} else {
3620					title = '';
3621				}
3622
3623				if ( typeof caption !== 'undefined' && caption !== '' ) {
3624					caption = '<p>' + caption + '</p>';
3625					title += caption;
3626				}
3627
3628				if ( title !== '' ) {
3629					$a.attr( 'title', title );
3630				}
3631
3632				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') ) ) {
3633					$a.attr('data-lg-size', imgw + '-' + imgh);
3634				}
3635			});
3636		});
3637	};
3638	captionBuilder($el);
3639
3640	//regular galleries
3641	$el.each( function( index, val ) {
3642		var $gallery = $(this),
3643			$_a = '.lbox-trigger-item',
3644			$_nested_a = '.lbox-nested-item',
3645			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
3646			galleryID = $_first.attr('data-lbox'),
3647			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
3648			tmb = $_first.attr('data-notmb'),
3649			social = $_first.attr('data-social'),
3650			deep = $_first.attr('data-deep'),
3651			zoom = $_first.attr('data-zoom-origin'),
3652			actual = $_first.attr('data-actual-size'),
3653			download = $_first.attr('data-download'),
3654			controls = $_first.attr('data-arrows') !== 'no',
3655			fullScreen = $_first.attr('data-full'),
3656			counter = $_first.attr('data-counter'),
3657			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
3658			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3659			connect = $_first.attr('data-connect'),
3660			lgPlugins = [lgVideo],
3661			itemsLoadedTimeOut;
3662
3663		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3664		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3665
3666		if ( typeof tmb == 'undefined' || !tmb ) {
3667			lgPlugins.push(lgThumbnail);
3668		}
3669		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
3670			lgPlugins.push(lgZoom);
3671		}
3672		if ( typeof deep != 'undefined' && deep != '' ) {
3673			lgPlugins.push(lgHash);
3674		}
3675		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3676			lgPlugins.push(lgFullscreen);
3677		}
3678		if ( social ) {
3679			lgPlugins.push(lgShare);
3680		}
3681
3682		if ( galleries.indexOf( galleryID ) !== -1 ) {
3683			return true;
3684		}
3685
3686		galleries.push( galleryID );
3687		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
3688			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
3689		var gallery = lightGallery( $triggerGal[0], {
3690			addClass: containerClass,
3691			plugins: lgPlugins,
3692			mode: transition,
3693			selector: $selector,
3694			galleryId: galleryID,
3695			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3696			iframeWidth: '848px',
3697			iframeMaxWidth: '90%',
3698			iframeMaxHeight: '90%',
3699			exThumbImage: 'data-external-thumb-image',
3700			loadYouTubeThumbnail: false,
3701			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ),
3702			// autoplayFirstVideo: false,
3703			pager: false,
3704			startClass: 'lg-start-opacity',
3705			zoomFromOrigin: zoom,
3706			controls: controls,
3707			download: ( typeof download != 'undefined' && download != '' ),
3708			thumbWidth: 50,
3709			thumbHeight: '50px',
3710			counter: $triggerGal.find($selector).length > 1 ? counter : false,
3711			loadYouTubePoster: false,
3712			enableDrag: $triggerGal.find($selector).length > 1,
3713			mobileSettings: {
3714				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3715			},
3716		});
3717
3718		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
3719			e.preventDefault();
3720			var index = $(this).closest('.owl-item.cloned').attr('data-index');
3721			gallery.openGallery(index-1);
3722		});
3723
3724		$triggerGal.on('more-items-loaded', function(e, items) {
3725			clearRequestTimeout(itemsLoadedTimeOut);
3726			itemsLoadedTimeOut = requestTimeout(function(){
3727				createSelectors();
3728				captionBuilder($triggerGal);
3729				gallery.refresh();
3730			}, 100);
3731		});
3732
3733		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3734			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3735				$el = model.view.$el;
3736				if ( $el.find($triggerGal).length ) {
3737					gallery.destroy();
3738				}
3739			});
3740		}
3741
3742		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
3743		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
3744		$triggerGal[0].addEventListener('lgAfterOpen', function(){
3745			$(window).trigger('uncode-custom-cursor');
3746		});
3747
3748	});
3749
3750	if ( typeof $el !== 'undefined' ) {
3751
3752		//album galleries
3753		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
3754			var album = val,
3755				galleryID = index,
3756				$album = $(album),
3757				params = $album.attr('data-album'),
3758				tmb = $(val).attr('data-notmb'),
3759				social = $(val).attr('data-social'),
3760				deep = $(val).attr('data-deep'),
3761				actual = $(val).attr('data-actual-size'),
3762				download = $(val).attr('data-download'),
3763				controls = $(val).attr('data-arrows') !== 'no',
3764				fullScreen = $(val).attr('data-full'),
3765				counter = $(val).attr('data-counter'),
3766				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
3767				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3768				lgPlugins = [lgVideo];
3769
3770			$(val).attr('data-lbox-init','true');
3771
3772			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3773			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3774
3775			if ( typeof tmb == 'undefined' || !tmb ) {
3776				lgPlugins.push(lgThumbnail);
3777			}
3778			if ( typeof actual != 'undefined' && actual != '' ) {
3779				lgPlugins.push(lgZoom);
3780			}
3781			if ( typeof deep != 'undefined' && deep != '' ) {
3782				lgPlugins.push(lgHash);
3783			}
3784			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3785				lgPlugins.push(lgFullscreen);
3786			}
3787			if ( social ) {
3788				lgPlugins.push(lgShare);
3789			}
3790
3791			var gallery = window.lightGallery(album, {
3792				dynamic: true,
3793				plugins: lgPlugins,
3794				dynamicEl: JSON.parse(params),
3795				galleryId: galleryID,
3796				addClass: containerClass,
3797				mode: transition,
3798				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3799				iframeWidth: '848px',
3800				iframeMaxWidth: '90%',
3801				iframeMaxHeight: '90%',
3802				loadYouTubeThumbnail: false,
3803				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
3804				// autoplayFirstVideo: false,
3805				pager: false,
3806				startClass: 'lg-start-opacity',
3807				zoomFromOrigin: false,
3808				controls: controls,
3809				download: ( typeof download != 'undefined' && download != '' ),
3810				thumbWidth: 50,
3811				thumbHeight: '50px',
3812				loadYouTubePoster: false,
3813				counter: counter,
3814				exThumbImage: 'data-external-thumb-image',
3815				loadYouTubePoster: false,
3816				mobileSettings: {
3817					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3818				},
3819			});
3820
3821			$album.on('click', function(){
3822				gallery.openGallery(0);
3823			});
3824
3825			album.addEventListener('lgBeforeSlide', beforeSlide);
3826			album.addEventListener('lgBeforeOpen', beforeOpen);
3827			album.addEventListener('lgAfterOpen', function(){
3828				$(window).trigger('uncode-custom-cursor');
3829			});
3830
3831			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3832				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3833					$el = model.view.$el;
3834					if ( $el.find($album).length ) {
3835						gallery.destroy();
3836					}
3837				});
3838			}
3839
3840		});
3841
3842		//single images
3843		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
3844			var gallery = lightGallery( $('.page-wrapper')[0], {
3845				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
3846				iframeWidth: '848px',
3847				iframeMaxWidth: '90%',
3848				iframeMaxHeight: '90%',
3849				loadYouTubeThumbnail: false,
3850				// autoplayFirstVideo: false,
3851				startClass: 'lg-start-opacity',
3852				thumbWidth: 50,
3853				thumbHeight: '50px',
3854				download: false,
3855				loadYouTubePoster: false,
3856				counter: false
3857			});
3858
3859			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
3860			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
3861		});
3862	}
3863};
3864
3865UNCODE.carousel = function(container) {
3866	var $owlContainers = $('.owl-carousel-container', container);
3867	$owlContainers.each(function() {
3868		var $owlContainer = $(this),
3869			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
3870			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
3871			values = {},
3872			tempTimeStamp,
3873			newWidth = UNCODE.wwidth,
3874			$owlInsideEqual = [];
3875		$owlSelector.each(function() {
3876			var itemID = $(this).attr('id'),
3877				$elSelector = $(('#' + itemID).toString());
3878			values['id'] = itemID;
3879			values['items'] = 1;
3880			values['columns'] = 3;
3881			values['fade'] = false;
3882			values['nav'] = false;
3883			values['navmobile'] = false;
3884			values['navskin'] = 'light';
3885			values['navspeed'] = 400;
3886			values['dots'] = false;
3887			values['dotsmobile'] = false;
3888			values['loop'] = false;
3889			values['autoplay'] = false;
3890			values['timeout'] = 3000;
3891			values['autoheight'] = false;
3892			values['stagepadding'] = 0;
3893			values['margin'] = 0;
3894			values['lg'] = 1;
3895			values['md'] = 1;
3896			values['sm'] = 1;
3897			$.each($(this).data(), function(i, v) {
3898				values[i] = v;
3899			});
3900
3901			if ($(this).closest('.uncode-slider').length) {
3902				values['navskin'] = '';
3903				values['navmobile'] = false;
3904				//values['dotsmobile'] = true;
3905			} else {
3906				values['navskin'] = ' style-'+values['navskin']+' style-override';
3907			}
3908
3909			var setIndexActive = function(event, init){
3910				var init = typeof init === 'undefined' ? false : init,
3911					thiis = $(event.currentTarget);
3912				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
3913					var scrolltop = $(document).scrollTop(),
3914						size = event.page.size,
3915						i;
3916					var setIndex = requestTimeout(function() {
3917						for ( i = 0; i < size; i++ ) {
3918							var itemCont = event.item.index != null ? (event.item.index + i) : i;
3919							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
3920							if (thiis.closest('.row-slider').length) {
3921								if (currentItem == undefined) {
3922									currentItem = thiis.children()[i];
3923								}
3924								if ($(currentItem).closest('#page-header').length) {
3925									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
3926										UNCODE.switchColorsMenu(scrolltop, 'dark');
3927									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
3928										UNCODE.switchColorsMenu(scrolltop, 'light');
3929									}
3930								}
3931								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
3932								if (owlCustomNav.length) {
3933									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
3934										owlCustomNav.addClass('style-dark').removeClass('style-light');
3935									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
3936										owlCustomNav.addClass('style-light').removeClass('style-dark');
3937									}
3938								}
3939							}
3940							var itendIndex = $(currentItem).attr('data-index');
3941							if ( isNaN(itendIndex) ) {
3942								itendIndex = 1;
3943							}
3944							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
3945							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
3946							if ($.fn.counterUp) {
3947								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
3948									var $counter = $(this);
3949									$counter.addClass('started').counterUp({
3950										delay: 10,
3951										time: 1500
3952									});
3953								});
3954							}
3955						}
3956						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
3957					}, 200);
3958				}
3959				tempTimeStamp = event.timeStamp;
3960			}
3961
3962			/** Initialize */
3963			$elSelector.on('initialize.owl.carousel', function(event) {
3964				if (typeof UNCODE.owlNav !== 'undefined') {
3965					UNCODE.owlNav(itemID, event);
3966				}
3967
3968				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3969					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
3970						var shortcode = model.attributes.shortcode,
3971							$el = model.view.$el,
3972							$row_wrap = $el.closest('.row');
3973						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
3974							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
3975						}
3976					});
3977					window.parent.vc.events.on('shortcodeView:updated', function(model) {
3978						var shortcode = model.attributes.shortcode;
3979						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
3980							tempTimeStamp = Math.floor(Date.now() / 1000);
3981						}
3982					});
3983					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
3984						var shortcode = model.attributes.shortcode;
3985						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
3986							UNCODE.owlNav(itemID, event);
3987							$elSelector.trigger('refresh.owl.carousel');
3988						}
3989					});
3990				}
3991			});
3992
3993			/** Initialized */
3994			$elSelector.on('initialized.owl.carousel', function(event) {
3995
3996				if ( $('.isotope-container', event.currentTarget).length ) {
3997					window.dispatchEvent(UNCODE.boxEvent);
3998				}
3999
4000				$('.owl-dot.active', $elSelector).on('click', function(){
4001					return false;
4002				});
4003
4004				var thiis = $(event.currentTarget),
4005					// get the time from the data method
4006					time = thiis.data("timer-id"),
4007					rowParent = thiis.closest('.row-parent');
4008
4009				if ( typeof rowParent[0] !== 'undefined' ) {
4010					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4011				}
4012
4013				if (time) {
4014					clearRequestTimeout(time);
4015				}
4016
4017				thiis.addClass('showControls');
4018				var new_time = requestTimeout(function() {
4019					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4020					if (thiis.hasClass('owl-height-viewport'))
4021						setItemsRelHeight(thiis);
4022					if (thiis.hasClass('owl-height-equal'))
4023						setItemsHeight(thiis);
4024					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4025					if (thiis.closest('.unequal, .unexpand').length) {
4026						UNCODE.setRowHeight(rowParent[0], true);
4027					}
4028					if (SiteParameters.dynamic_srcset_active === '1') {
4029						UNCODE.refresh_dynamic_srcset_size(thiis);
4030					}
4031				}, 350);
4032				// save the new time
4033				thiis.data("timer-id", new_time);
4034
4035				var scrolltop = $(document).scrollTop();
4036				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4037
4038				//if (!UNCODE.isMobile) {
4039					/** fix autoplay when visible **/
4040				$(window).on('load', function(){
4041					if (thiis.data('autoplay')) {
4042						if ( !thiis.closest('.sticky-element').length ) {
4043							thiis.trigger('stop.autoplay.owl');
4044						} else {
4045							thiis.trigger('play.owl.autoplay');
4046						}
4047					}
4048					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4049						return;
4050					}
4051					if ( ! thiis.closest('.sticky-element').length ) {
4052						var carouselInView = new Waypoint.Inview({
4053							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4054							element: thiis[0],
4055							exited: function() {
4056								var el = $(this.element);
4057								if (el.data('autoplay') ) {
4058									el.trigger('stop.owl.autoplay');
4059									el.data('stopped','true');
4060								}
4061							},
4062							enter: function(direction) {
4063								var el = $(this.element);
4064								requestTimeout(function() {
4065									if (el.data('autoplay')) {
4066										el.trigger('play.owl.autoplay');
4067										el.data('stopped','false');
4068									}
4069								}, 100);
4070							}
4071						});
4072					}
4073					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4074						setTimeout(function(){
4075							window.lenis.resize();
4076						}, 1000);
4077					}
4078			  
4079				});
4080				//}
4081
4082				// $(window).on('frontend:carousel_updated', function(){
4083				// 	Waypoint.refreshAll();
4084				// });
4085
4086				if (!thiis.closest('.isotope-system').length) {
4087					requestTimeout(function() {
4088						animate_thumb($('.t-inside', el), event);
4089					}, 400);
4090				} else {
4091					requestTimeout(function() {
4092						thiis.closest('.isotope-container').isotope('layout');
4093					}, 400);
4094				}
4095
4096				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4097				currentIndex = $(currentItem).attr('data-index');
4098
4099				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4100					if ($(val).closest('.uncode-slider').length) {
4101						$(val).removeClass('start_animation');
4102					}
4103				});
4104				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4105					if ($(val).closest('.uncode-slider').length) {
4106						$(val).removeClass('already-animated');
4107					}
4108				});
4109
4110				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4111					if ($(val).closest('.uncode-slider').length) {
4112						$(val).removeAttr('data-animated');
4113					}
4114				});
4115
4116				$.each($('.owl-item.cloned', thiis), function(index, val) {
4117					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4118				});
4119
4120				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4121					if ($(val).attr('data-index') != currentIndex) {
4122						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4123						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4124					}
4125					if ($(val).attr('data-index') != currentIndex) {
4126						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4127					}
4128					if ($(val).attr('data-index') == currentIndex) {
4129						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4130					}
4131				});
4132
4133				if (thiis.closest('.uncode-slider').length) {
4134					var el = thiis.closest('.row-parent')[0];
4135					if ($(el).data('imgready')) {
4136						firstLoaded(el, event);
4137					} else {
4138						el.addEventListener("imgLoaded", function(el) {
4139							firstLoaded(el.target, event);
4140						}, false);
4141					}
4142					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4143					if (transHeight != null) {
4144						requestTimeout(function() {
4145							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4146						}, 100);
4147					}
4148				} else {
4149					var el = thiis;
4150					el.closest('.uncode-slider').addClass('slider-loaded');
4151				}
4152
4153				requestTimeout(function() {
4154					if (typeof UNCODE.bigText !== 'undefined') {
4155						UNCODE.bigText(thiis);
4156					}
4157					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4158						if (thiis.data('autoplay')) pauseOnHover(thiis);
4159					}
4160				}, 500);
4161
4162				if (thiis.closest('.unequal').length) {
4163					$owlInsideEqual.push(thiis.closest('.row-parent'));
4164				}
4165
4166				var containerClasses = '',
4167					containerStyle = '';
4168				if ( $('.owl-dots-classes', $owlContainer).length ) {
4169					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4170					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4171					$('.owl-dots-classes', $owlContainer).remove();
4172				}
4173
4174				if ( containerClasses !== '' ) {
4175					requestTimeout(function() {
4176						if ( containerClasses !== '' )
4177							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4178						if ( containerStyle !== '' )
4179							$('.owl-dots', $owlContainer).addClass(containerClasses);
4180					}, 100);
4181				}
4182
4183				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4184					$(val).closest('.row-inner').css({
4185						'margin-top': '-1px'
4186					});
4187				});
4188
4189				if ($.fn.isotope) {
4190					if ( thiis.closest('.isotope-container').length ) {
4191						if (thiis.closest('.isotope-container').data('isotope')) {
4192							requestTimeout(function(){
4193								thiis.closest('.isotope-container').isotope('layout');
4194							}, 300);
4195						}
4196						$(window).on('load', function(){
4197							if (thiis.closest('.isotope-container').data('isotope')) {
4198								thiis.closest('.isotope-container').isotope('layout');
4199							}
4200						});
4201					}
4202				}
4203
4204				if (thiis.data('autoplay')) {
4205					$(window).on('menuOpen', function(){
4206						thiis.trigger('stop.owl.autoplay');
4207						thiis.data('stopped','true');
4208					}).on('menuClose', function(){
4209
4210					});
4211				}
4212				$(window).on('menuClose', function(){
4213					if (thiis.data('autoplay')) {
4214						thiis.trigger('play.owl.autoplay');
4215						thiis.data('stopped','false');
4216					}
4217				});
4218
4219				setIndexActive(event, true);
4220
4221				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4222						return !$(this).closest('.nested-carousel').length;
4223					}),
4224					$_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),
4225					$galleries = $_galleries.filter(function( index ) {
4226						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4227					});
4228
4229				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4230					UNCODE.lightgallery( $galleries );
4231				}
4232
4233			});
4234
4235			$elSelector.on('resized.owl.carousel', function(event) {
4236				var thiis = $(event.currentTarget);
4237				// if ($(this).closest('.nested-carousel').length) {
4238				// 	requestTimeout(function() {
4239				// 		window.dispatchEvent(UNCODE.boxEvent);
4240				// 	}, 200);
4241				// }
4242				if ( thiis.hasClass('owl-height-equal') )
4243					setItemsHeight(thiis);
4244
4245				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4246					newWidth = UNCODE.wwidth;
4247					setItemsRelHeight($elSelector);
4248				}
4249
4250				setIndexActive(event);
4251
4252				if (SiteParameters.dynamic_srcset_active === '1') {
4253					UNCODE.refresh_dynamic_srcset_size(thiis);
4254				}
4255
4256				if ($.fn.isotope) {
4257					$(window).on('load', function(){
4258						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4259							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4260						}
4261					});
4262				}
4263
4264				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4265					setTimeout(function(){
4266						window.lenis.resize();
4267					}, 1000);
4268				}
4269			});
4270
4271			$elSelector.on('refreshed.owl.carousel', function(event) {
4272				setIndexActive(event);
4273			});
4274
4275			/** detect resize window for fluid height layout */
4276			var setFluidResize;
4277			function manageFluidCarouseHeight() {
4278				clearRequestTimeout(setFluidResize);
4279				setFluidResize = requestTimeout(function(){
4280					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4281						newWidth = UNCODE.wwidth;
4282						setItemsRelHeight($elSelector);
4283					}
4284				}, 100);
4285			}
4286			window.addEventListener('resize', manageFluidCarouseHeight);
4287
4288			/** Change */
4289			$elSelector.on('change.owl.carousel', function(event) {
4290				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4291			});
4292
4293			/** Changed */
4294			$elSelector.on('changed.owl.carousel', function(event) {
4295				var $row = $elSelector.parents('.row')[0];
4296				if ( typeof $row !== 'undefined' ) {
4297					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4298				}
4299				setIndexActive(event);
4300			});
4301
4302			var checkDrag = function(e) {
4303				$elSelector.addClass('owl-dragging');
4304			};
4305			$elSelector.on('drag.owl.carousel', function(event) {
4306				document.addEventListener("mousemove", checkDrag);
4307			});
4308
4309			$elSelector.on('dragged.owl.carousel', function(event) {
4310				$elSelector.removeClass('owl-dragging');
4311				document.removeEventListener("mousemove", checkDrag);
4312			});
4313
4314			$elSelector.on('translate.owl.carousel', function(event) {
4315				if (UNCODE.isMobile) {
4316					$(event.currentTarget).addClass('owl-translating');
4317				}
4318			});
4319
4320			/** Translated */
4321			$elSelector.on('translated.owl.carousel', function(event) {
4322
4323				var thiis = $(event.currentTarget),
4324					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4325					currentIndex = $(currentItem).attr('data-index'),
4326					stagePadding = thiis.data('stagepadding');
4327
4328				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4329
4330				if (!UNCODE.isMobile) {
4331					UNCODE.owlPlayVideo(thiis);
4332				}
4333
4334				requestTimeout(function(){
4335					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4336					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4337					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4338						if (lastDelayElems == undefined) lastDelayElems = 0;
4339						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4340						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4341						thiis.trigger('stop.owl.autoplay');
4342						requestTimeout(function() {
4343							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4344						}, maxDelay);
4345					}
4346				}, 200);
4347
4348				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4349					if ($(val).closest('.uncode-slider').length) {
4350						$(val).removeClass('start_animation');
4351					}
4352				});
4353
4354				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4355					if ($(val).closest('.uncode-slider').length) {
4356						$(val).removeClass('already-animated');
4357					}
4358				});
4359
4360				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4361					if ($(val).closest('.uncode-slider').length) {
4362						$(val).removeAttr('data-animated');
4363					}
4364				});
4365
4366				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4367					if ($(val).attr('data-index') != currentIndex) {
4368						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4369						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4370					}
4371					if ($(val).attr('data-index') != currentIndex) {
4372						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4373					}
4374					if ($(val).attr('data-index') == currentIndex) {
4375						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4376					}
4377				});
4378
4379				if (UNCODE.isMobile) {
4380					thiis.removeClass('owl-translating');
4381				}
4382
4383				setIndexActive(event);
4384			});
4385
4386			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4387
4388			/** Init carousel */
4389			$elSelector.not('.showControls').owlCarousel({
4390				items: values['items'],
4391				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4392				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4393				nav: values['nav'],
4394				dots: values['dots'],
4395				loop: values['loop'],
4396				stagePadding: values['stagepadding'],
4397				margin: 0,
4398				video: true,
4399				autoWidth: false,
4400				autoplay: false,
4401				autoplayTimeout: values['timeout'],
4402				autoplaySpeed: values['navspeed'],
4403				autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
4404				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4405				rtl: $('body').hasClass('rtl') ? true : false,
4406				fluidSpeed: true,
4407				navSpeed: values['navspeed'],
4408				dotsSpeed: values['navspeed'] / values['items'],
4409				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4410				navText: ['<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-right"></i></div>'],
4411				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4412				responsiveClass: true,
4413				responsiveBaseElement: '.box-container',
4414				responsive: {
4415					0: {
4416						items: values['sm'],
4417						nav: values['navmobile'],
4418						dots: values['dotsmobile'],
4419						dotsSpeed: values['navspeed'] / values['sm'],
4420					},
4421					480: {
4422						items: values['sm'],
4423						nav: values['navmobile'],
4424						dots: values['dotsmobile'],
4425						dotsSpeed: values['navspeed'] / values['sm'],
4426					},
4427					570: {
4428						items: values['md'],
4429						nav: values['navmobile'],
4430						dots: values['dotsmobile'],
4431						dotsSpeed: values['navspeed'] / values['md'],
4432					},
4433					960: {
4434						items: values['lg'],
4435						dotsSpeed: values['navspeed'] / values['lg'],
4436					}
4437				}
4438			});
4439
4440			var transDuration = parseFloat(values['navspeed']) * 0.3;
4441			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
4442
4443			$('.owl-item .tmb', $elSelector).css({
4444				'-webkit-transition-delay': transDuration + 'ms',
4445				'-moz-transition-delay': transDuration + 'ms',
4446				'-o-transition-delay': transDuration + 'ms',
4447				'transition-delay': transDuration + 'ms',
4448				'-webkit-transition-duration': transDuration2 + 'ms',
4449				'-moz-transition-duration': transDuration2 + 'ms',
4450				'-o-transition-duration': transDuration2 + 'ms',
4451				'transition-duration': transDuration2 + 'ms',
4452			});
4453
4454			requestTimeout(function() {
4455				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4456					UNCODE.setRowHeight($owlInsideEqual[i]);
4457				};
4458			}, 300);
4459
4460			$(window).on('load', function(){
4461				var $elCarousel = $elSelector.data('owl.carousel');
4462				if ( typeof $elCarousel !== 'undefined' ) {
4463					$elCarousel.trigger('refreshed');
4464					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4465						UNCODE.setRowHeight($owlInsideEqual[i]);
4466					};
4467				}
4468			});
4469
4470			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
4471				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4472					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
4473					$('#' + carousel_id).find('.owl-item').each( function() {
4474						var $item = $(this),
4475							index = ( $item.index() + 1 );
4476						$item.attr('data-index', index);
4477					});
4478				}
4479			});
4480
4481			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4482				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
4483					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4484						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
4485						$('#' + carousel_id).find('.owl-item').each( function() {
4486							var $item = $(this),
4487								index = ( $item.index() + 1 );
4488							$item.attr('data-index', index);
4489						});
4490					}
4491				});
4492			}
4493
4494		});
4495
4496		function firstLoaded(el, event) {
4497			var el = $(el),
4498			uncode_slider = el.find('.uncode-slider');
4499			el.find('.owl-carousel').css('opacity', 1);
4500			uncode_slider.addClass('slider-loaded');
4501			if (typeof UNCODE.bigText !== 'undefined') {
4502				UNCODE.bigText(el.find('.owl-item.active'));
4503			}
4504			//if (!UNCODE.isMobile) {
4505				requestTimeout(function() {
4506					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
4507					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
4508					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
4509						if (lastDelayElems == undefined) lastDelayElems = 0;
4510						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4511						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4512						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
4513						requestTimeout(function() {
4514							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
4515						}, maxDelay);
4516					}
4517				}, 500);
4518
4519			//}
4520		}
4521
4522		function navHover(el) {
4523			var $owlCont = el,
4524				$owlPrev = $owlCont.find('.owl-prev'),
4525				$owlNext = $owlCont.find('.owl-next'),
4526				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
4527				$owlPagination = $owlCont.next(),
4528				owlPrevW = $owlPrev.outerWidth(),
4529				owlNextW = $owlNext.outerWidth(),
4530				owlDotsH = $owlDots.innerHeight(),
4531				owlTime = 400,
4532				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4533			if ( $('body').hasClass('rtl') ) {
4534				$owlPrev.css("margin-right", -owlPrevW);
4535				$owlNext.css("margin-left", -owlNextW);
4536			} else {
4537				$owlPrev.css("margin-left", -owlPrevW);
4538				$owlNext.css("margin-right", -owlNextW);
4539			}
4540			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
4541			$owlCont.mouseenter(function() {
4542				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4543				$owlPrev.add($owlNext).css({
4544					marginLeft: 0,
4545					marginRight: 0
4546				});
4547				if (!owlNested) {
4548					$owlDots.css({
4549						opacity: 1,
4550						bottom: 0
4551					});
4552				}
4553			}).mouseleave(function() {
4554				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4555				if ( $('body').hasClass('rtl') ) {
4556					$owlPrev.css("margin-right", -owlPrevW);
4557					$owlNext.css("margin-left", -owlNextW);
4558				} else {
4559					$owlPrev.css("margin-left", -owlPrevW);
4560					$owlNext.css("margin-right", -owlNextW);
4561				}
4562				if (!owlNested) {
4563					$owlDots.css({
4564						opacity: 1,
4565						bottom: -owlDotsH
4566					});
4567				}
4568			});
4569		};
4570
4571		function animate_elems($this) {
4572			var lastDelay;
4573			$.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) {
4574				var element = $(val),
4575					delayAttr = element.attr('data-delay'),
4576					$first_item = element.closest('.owl-item[data-index="1"]');
4577
4578				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
4579					return false;
4580				}
4581
4582				if (delayAttr == undefined) delayAttr = 0;
4583				requestTimeout(function() {
4584					element.addClass('start_animation');
4585				}, delayAttr);
4586				lastDelay = delayAttr;
4587			});
4588			return lastDelay;
4589		}
4590
4591		function animate_thumb(items, event) {
4592			var lastDelay,
4593				itemIndex,
4594				thiis = $(event.currentTarget),
4595				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
4596				numActives = $('.owl-item.active', thiis).length,
4597				stagePadding = thiis.data('stagepadding');
4598
4599			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4600
4601			thiis.data('tempIndex', event.item.index);
4602				$.each(items, function(index, val) {
4603					var parent = $(val).closest('.owl-item');
4604					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4605						return;
4606					}
4607					if (!$(val).hasClass('start_animation')) {
4608						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
4609							var thumbInView = new Waypoint.Inview({
4610							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4611							  element: val,
4612							  enter: function(direction) {
4613								var element = $(this.element),
4614										delayAttr = parseInt(element.attr('data-delay')),
4615										itemIndex = element.closest('.owl-item').index() + 1,
4616										diffItem = Math.abs(itemIndex - tempIndex) - 1;
4617									if (itemIndex > tempIndex) {
4618										thiis.data('tempIndex', itemIndex);
4619									}
4620									if (isNaN(delayAttr)) delayAttr = 100;
4621									if (stagePadding) {
4622										var objTimeout = requestTimeout(function() {
4623											element.addClass('start_animation');
4624										}, index * delayAttr);
4625										lastDelay = index * delayAttr;
4626									} else {
4627										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
4628										var objTimeout = requestTimeout(function() {
4629											element.addClass('start_animation');
4630										}, diffItem * delayAttr);
4631										lastDelay = diffItem * delayAttr;
4632									}
4633									parent.data('objTimeout', objTimeout);
4634									if (!UNCODE.isUnmodalOpen) {
4635										this.destroy();
4636									}
4637								}
4638							});
4639						}
4640					}
4641				});
4642				return lastDelay;
4643			}
4644
4645		function setItemsHeight(item) {
4646			$.each($('.owl-item', item), function(index, val) {
4647				var availableThumbHeight = $('.t-inside', $(val)).height(),
4648				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
4649				difference = availableThumbHeight - innerThumbHeight;
4650				if ($('.tmb-content-under', val).length) {
4651					var visualPart = $('.t-entry-visual', val);
4652					if (visualPart.length) {
4653						difference -= $('.t-entry-visual', val).height();
4654					}
4655				}
4656				if (! $('.tmb-content-lateral', val).length)
4657					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
4658			});
4659		}
4660
4661		function setItemsRelHeight(item) {
4662			$.each($('.owl-item', item), function(index, val) {
4663				var $rowContainer = $(item).parents('.row-parent').eq(0),
4664					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
4665					$colContainer = $(item).parents('.uncell').eq(0),
4666					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
4667					winHeight = UNCODE.wheight,
4668					multiplier_h = parseInt($(item).attr('data-vp-height')),
4669					data_viewport_h,
4670					consider_menu = $(item).data('vp-menu');
4671
4672				if ( consider_menu ) {
4673					winHeight = winHeight - UNCODE.menuHeight;
4674				}
4675
4676				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
4677				$('.t-inside', val).css( 'height', data_viewport_h );
4678			});
4679		}
4680
4681		function pauseOnHover(slider) {
4682			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
4683			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
4684				mouseenter: function () {
4685					$(slider).addClass('owl-mouseenter');
4686					$(slider).trigger('stop.owl.autoplay');
4687				},
4688				mouseleave: function () {
4689					$(slider).removeClass('owl-mouseenter');
4690					$(slider).trigger('play.owl.autoplay');
4691				}
4692			});
4693		}
4694	});
4695};
4696
4697UNCODE.owlPlayVideo = function(carousel) {
4698	var player, iframe;
4699	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
4700		var content = $(val).html();
4701		if (content == '') {
4702			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
4703			$(val).append(getCloned);
4704		}
4705		if ($(this).attr('data-provider') == 'vimeo') {
4706			iframe = $(this).find('iframe');
4707			player = new Vimeo.Player(iframe[0]);
4708			player.play();
4709		} else if ($(this).attr('data-provider') == 'youtube') {
4710			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
4711		} else {
4712			var player = $(this).find('video');
4713			if (player.length) {
4714				$(this).find('video')[0].volume = 0;
4715				$(this).find('video')[0].play();
4716				$(val).css('opacity', 1);
4717			}
4718		}
4719	});
4720};
4721
4722UNCODE.owlStopVideo = function(carousel) {
4723	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
4724		var player, iframe;
4725		if ($(this).attr('data-provider') == 'vimeo') {
4726			iframe = $(this).find('iframe');
4727			player = new Vimeo.Player(iframe[0]);
4728			player.pause();
4729		} else if ($(this).attr('data-provider') == 'youtube') {
4730			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
4731		} else {
4732			var player = $(this).find('video');
4733			if (player.length) {
4734				$(this).find('video')[0].volume = 0;
4735				$(this).find('video')[0].play();
4736			}
4737		}
4738	});
4739};
4740
4741UNCODE.animations = function() {
4742
4743	var runWaypoints_TO,
4744		runWaypoints_carousel_TO,
4745		runWaypoints_delay = 0,
4746	highlightComplexFunc = function($wrap, ev){
4747
4748		var $lines = $('.heading-line-wrap', $wrap),
4749			not_animate = false;
4750
4751		if ( $wrap.data('animate') === true ) {
4752			not_animate = true;
4753		}
4754
4755		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
4756		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
4757			return;
4758		}
4759
4760		$lines.each(function(_key, _value){
4761			var $line = $(_value),
4762				$inners = $('.split-word-inner', $line),
4763				$highlights = $('.heading-text-highlight-inner', $line);
4764
4765			var highlitInnerFunc = function(ev){
4766				var delay = 0;
4767				$highlights.each(function(h_key, high){
4768					var $highlight = $(high),
4769						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
4770						$nextSplit = $split.nextUntil(),
4771						$next = $('.heading-text-highlight-inner', $nextSplit),
4772						countCh = $split.text().length;
4773
4774					$highlight.css({
4775						'-webkit-transition-duration': (30 * countCh) + 'ms',
4776						'-moz-transition-duration': (30 * countCh) + 'ms',
4777						'-o-transition-duration': (30 * countCh) + 'ms',
4778						'transition-duration': (30 * countCh) + 'ms',
4779					});
4780
4781					delay += (30 * countCh);
4782
4783					$next.css({
4784						'-webkit-transition-delay': delay + 'ms',
4785						'-moz-transition-delay': delay + 'ms',
4786						'-o-transition-delay': delay + 'ms',
4787						'transition-delay': delay + 'ms',
4788					});
4789				});
4790				$highlights.removeAttr('data-animated');
4791				if ( _key+1 === $lines.length ) {
4792					$wrap.data('animate', true);
4793				}
4794			};
4795
4796			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
4797				if ( not_animate ) {
4798					$highlights.each(function(h_key, high){
4799						var $highlight = $(high);
4800						$highlight.css({
4801							'-webkit-transition-duration': '0ms',
4802							'-moz-transition-duration': '0ms',
4803							'-o-transition-duration': '0ms',
4804							'transition-duration': '0ms',
4805						});
4806					});
4807					$highlights.removeAttr('data-animated');
4808				} else {
4809					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
4810						highlitInnerFunc();
4811					} else {
4812						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
4813					}
4814				}
4815			}
4816		});
4817	};
4818
4819	$.each($('.header-content-inner'), function(index, val) {
4820		var element = $(val),
4821			transition = '';
4822		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
4823		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
4824		if (element.hasClass('left-t-right')) transition = 'left-t-right';
4825		if (element.hasClass('right-t-left')) transition = 'right-t-left';
4826		if (element.hasClass('zoom-in')) transition = 'zoom-in';
4827		if (element.hasClass('zoom-out')) transition = 'zoom-out';
4828		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
4829		if (transition != '') {
4830			$(val).removeClass(transition);
4831			var container = element,
4832				containerDelay = container.attr('data-delay'),
4833				containerSpeed = container.attr('data-speed'),
4834				items = $('.header-title > *, .post-info', container);
4835			$.each(items, function(index, val) {
4836				var element = $(val),
4837					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
4838					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
4839				if (!element.hasClass('animate_when_almost_visible')) {
4840					delayAttr = Number(delayAttr) + (400 * index);
4841					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
4842					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
4843				}
4844			});
4845			container.css('opacity', 1);
4846		}
4847	});
4848
4849	function animate_css_grids_on_load() {
4850		$('.cssgrid-system').each(function() {
4851			var grid = $(this);
4852			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
4853			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
4854		});
4855	}
4856
4857	window.waypoint_animation = function(ev) {
4858		$.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)'), function(index, val) {
4859			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 ) ) {
4860				return true;
4861			}
4862			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4863				return;
4864			}
4865			var run = true,
4866				$carousel = $(val).closest('.owl-carousel');
4867			if ( $carousel.length ) {
4868				run = false;
4869			}
4870			if (run) {
4871				new Waypoint({
4872					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4873					element: val,
4874					handler: function() {
4875						var element = $(this.element),
4876							index = element.index(),
4877							delayAttr = element.attr('data-delay');
4878						if (delayAttr == undefined) delayAttr = 0;
4879						requestTimeout(function() {
4880							element.addClass('start_animation');
4881						}, delayAttr);
4882						if (!UNCODE.isUnmodalOpen) {
4883							this.destroy();
4884						}
4885					},
4886					offset: UNCODE.isFullPage ? '100%' : '90%'
4887				});
4888			}
4889		});
4890		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
4891			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4892				return;
4893			}
4894			var run = true,
4895				$carousel = $(val).closest('.owl-carousel');
4896			if ( $carousel.length ) {
4897				run = false;
4898			}
4899			if (run) {
4900				new Waypoint({
4901					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4902					element: val,
4903					handler: function() {
4904						var $element = $(this.element),
4905							$childs = $('.animate_when_parent_almost_visible', $element);
4906						$childs.each(function(key,el){
4907							var $child = $(el),
4908								delaySpeed = $child.attr('data-speed'),
4909								delayAttr = $child.attr('data-delay'),
4910								intervalAttr = $child.attr('data-interval');
4911							if (delayAttr == undefined) {
4912								delayAttr = 50*key;
4913							}
4914							requestTimeout(function() {
4915								$child.addClass('start_animation');
4916								if ( $child.hasClass('anim-line-checker') ) {
4917									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4918										var $line = $child.closest('.heading-line-wrap');
4919									});
4920								}
4921								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
4922								highlightComplexFunc($wrapText, ev);
4923								if ( $child.hasClass('anim-tot-checker') ) {
4924									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4925										if ( $child.hasClass('anim-tot-checker') ) {
4926											$wrapText.addClass('already-animated');
4927											$element.trigger('already-animated');
4928										}
4929									});
4930								}
4931							}, delayAttr );
4932						});
4933						$element.addClass('start_animation');
4934						if (!UNCODE.isUnmodalOpen) {
4935							this.destroy();
4936						}
4937					},
4938					offset: UNCODE.isFullPage ? '100%' : '90%'
4939				});
4940			}
4941		});
4942	}
4943	window.waypoint_carousel_animation = function(ev) {
4944		$.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) {
4945			if ( $(val).hasClass('el-text-split') ) {
4946				return true;
4947			}
4948			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4949				return;
4950			}
4951			var run = true,
4952				$carousel = $(val).closest('.owl-carousel'),
4953				$first_item = $(val).closest('.owl-item[data-index="1"]'),
4954				$all_first = $('.owl-item[data-index="1"]', $carousel);
4955			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
4956				run = false;
4957			}
4958			if (run) {
4959				new Waypoint({
4960					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4961					element: val,
4962					handler: function() {
4963						var element = $(this.element),
4964							index = element.index(),
4965							delayAttr = element.attr('data-delay');
4966						if (delayAttr == undefined) delayAttr = 0;
4967						requestTimeout(function() {
4968							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
4969								$all_first.attr('data-already-reached', 'true');
4970							}
4971							element.addClass('start_animation');
4972						}, delayAttr);
4973						if (!UNCODE.isUnmodalOpen) {
4974							this.destroy();
4975						}
4976					},
4977					offset: UNCODE.isFullPage ? '100%' : '90%'
4978				});
4979			}
4980		});
4981		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
4982			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4983				return;
4984			}
4985			var run = true,
4986				$carousel = $(val).closest('.owl-carousel'),
4987				$first_item = $(val).closest('.owl-item[data-index="1"]'),
4988				$all_first = $('.owl-item[data-index="1"]', $carousel);
4989			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
4990				run = false;
4991			}
4992			if (run) {
4993				new Waypoint({
4994					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4995					element: val,
4996					handler: function() {
4997						var $element = $(this.element),
4998							$childs = $('.animate_when_parent_almost_visible', $element);
4999						$childs.each(function(key,el){
5000							var $child = $(el),
5001								delaySpeed = $child.attr('data-speed'),
5002								delayAttr = $child.attr('data-delay'),
5003								intervalAttr = $child.attr('data-interval');
5004							if (delayAttr == undefined) {
5005								delayAttr = 50*key;
5006							}
5007							requestTimeout(function() {
5008								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5009									$all_first.attr('data-already-reached', 'true');
5010								}
5011								$child.addClass('start_animation');
5012								if ( $child.hasClass('anim-line-checker') ) {
5013									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5014										var $line = $child.closest('.heading-line-wrap');
5015									});
5016								}
5017								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5018								highlightComplexFunc($wrapText, ev);
5019								if ( $child.hasClass('anim-tot-checker') ) {
5020									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5021										if ( $child.hasClass('anim-tot-checker') ) {
5022											$wrapText.addClass('already-animated');
5023										}
5024									});
5025								}
5026							}, delayAttr );
5027						});
5028						$element.addClass('start_animation');
5029						if (!UNCODE.isUnmodalOpen) {
5030							this.destroy();
5031						}
5032					},
5033					offset: UNCODE.isFullPage ? '100%' : '90%'
5034				});
5035			}
5036		});
5037	}
5038
5039	var runWaypoints = function(ev){
5040		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5041			runWaypoints_delay = 400;
5042		}
5043		clearRequestTimeout(runWaypoints_TO);
5044		runWaypoints_TO = requestTimeout(function() {
5045			window.waypoint_animation(ev);
5046		}, runWaypoints_delay);
5047
5048		clearRequestTimeout(runWaypoints_carousel_TO);
5049		runWaypoints_carousel_TO = requestTimeout(function() {
5050			window.waypoint_carousel_animation(ev);
5051		}, 400);
5052	};
5053	runWaypoints();
5054	animate_css_grids_on_load();
5055
5056	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5057		runWaypoints(ev);
5058	});
5059	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5060		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5061	}
5062};
5063
5064UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5065	var $allItems = elements.length - startIndex,
5066		showed = 0,
5067		index = 0,
5068		use_index = false
5069		;
5070
5071	if (filtering) {
5072		if (sequential) {
5073			use_index = true;
5074		}
5075		sequential = false;
5076	}
5077
5078	$.each(elements, function(index, val) {
5079		var $this = $(val),
5080			elInner = $('> .t-inside', val);
5081
5082		if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5083			return;
5084		}
5085		if (val[0]) val = val[0];
5086
5087		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5088			new Waypoint({
5089				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5090				element: val,
5091				handler: function() {
5092					var element = $('> .t-inside', this.element),
5093						parent = $(this.element);
5094					var _index = use_index? index : 0;
5095
5096					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5097						delayAttr = parseInt(element.attr('data-delay'));
5098					if (isNaN(delayAttr)) delayAttr = 100;
5099					if (sequential || use_index) {
5100						delay -= showed;
5101					}
5102					var objTimeout = requestTimeout(function() {
5103						element.removeClass('zoom-reverse').addClass('start_animation');
5104						showed = index;
5105					}, delay * delayAttr);
5106					parent.data('objTimeout', objTimeout);
5107					if (!UNCODE.isUnmodalOpen) {
5108						this.destroy();
5109					}
5110				},
5111				offset: UNCODE.isFullPage ? '100%' : '90%'
5112			});
5113		}
5114
5115		index++;
5116	});
5117};
5118
5119UNCODE.tapHover = function() {
5120
5121	var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn
5122		elClass = "hover";
5123
5124	$(window).on('click', function() {
5125		$el.removeClass(elClass);
5126	});
5127
5128	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
5129		e.stopPropagation();
5130		var link = $(this);
5131		if ( ! link.hasClass(elClass)) {
5132			e.preventDefault();
5133			link.addClass("hover");
5134			$el.not(this).removeClass(elClass);
5135			return false;
5136		}
5137	});
5138};
5139
5140UNCODE.onePage = function(isMobile) {
5141	var current = 0,
5142		last = 0,
5143		lastScrollTop = 0,
5144		forceScroll = false,
5145		lastScrolled = 0,
5146		isSectionscroller = ($('.main-onepage').length) ? true : false,
5147		isOnePage = false,
5148		getOffset = function () {
5149			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);
5150			return calculateOffset;
5151		}
5152
5153	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5154
5155	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5156	// 	return false;
5157
5158	function init_onepage() {
5159		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5160			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5161		}
5162		last = $('.onepage-pagination li').last().find('a').data('index');
5163		$.each($('div[data-parent="true"]'), function(index, val) {
5164			$(this).attr('data-section', index);
5165			if (isMobile) return;
5166			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5167				return;
5168			}
5169			var sectionDown = new Waypoint({
5170				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5171				element: val,
5172				handler: function(direction) {
5173					if (direction == 'down') {
5174						changeMenuActive(this.element, index);
5175					}
5176				},
5177				offset: function() {
5178					return 5 + getOffset()
5179				}
5180			});
5181			var sectionUp = new Waypoint({
5182				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5183				element: val,
5184				handler: function(direction) {
5185					if (direction == 'up') {
5186						changeMenuActive(this.element, index);
5187					}
5188				},
5189				offset: function() {
5190					return -5 - getOffset()
5191				}
5192			});
5193
5194			if (isSectionscroller) {
5195				var label;
5196				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5197				else label = '';
5198				var getName = $(this).attr('data-name');
5199				if (getName == undefined) getName = index;
5200				if (label != '') {
5201					isOnePage = true;
5202					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5203					$('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
5204				}
5205			}
5206		});
5207
5208		if (isSectionscroller) {
5209			$.each($('ul.onepage-pagination li'), function(index, val) {
5210				var $this = $(val),
5211					$a = ('a', $this);
5212				$a.on('click', function(evt) {
5213					if ( $('.is-selected', $this).length ) {
5214						return false;
5215					}
5216					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5217						evt.preventDefault();
5218					}
5219					Waypoint.refreshAll();
5220					var el = $('a', evt.currentTarget);
5221					current = lastScrolled = parseInt(el.attr('data-index'));
5222					lastScrolled += 1;
5223					scrollBody(current);
5224				});
5225			});
5226		}
5227
5228		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5229		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5230			goToSection = String(window.location.hash).replace(/^#/, "");
5231			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5232		}
5233
5234		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5235			current = lastScrolled = goToSection;
5236			$(window).on('load', function(){
5237				if ( $('.owl-carousel').length ) {
5238					requestTimeout(function(){
5239						scrollBody(goToSection);
5240					}, 400);
5241				} else {
5242					scrollBody(goToSection);
5243				}
5244			});
5245		}
5246
5247	}
5248
5249	function changeMenuActive(section, index) {
5250		current = lastScrolled = parseInt($(section).attr('data-section'));
5251		if (isOnePage) {
5252			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5253			if (newSection.length) {
5254				$('ul.onepage-pagination li a').removeClass('is-selected');
5255				newSection.addClass('is-selected');
5256			}
5257			var getName = $('[data-section="' + index + '"]').attr('data-name');
5258			if (getName != undefined && getName !== '') {
5259				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5260					var get_href = $(val).attr('href');
5261					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5262						$(val).closest('.menu-smart').find('.active').removeClass('active');
5263						$(val).parent().addClass('active');
5264					}
5265				});
5266			}
5267		}
5268	}
5269
5270	if (isOnePage) {
5271		$(window).on('scroll', function() {
5272			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5273			if (bodyTop == 0) {
5274				$('ul.onepage-pagination li a').removeClass('is-selected');
5275				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5276				var getName = $('[data-section=0]').attr('data-name');
5277				if (getName != undefined && getName !== '') {
5278					$.each($('.menu-container .menu-item > a'), function(i, val) {
5279						var get_href = $(val).attr('href');
5280						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5281							$(val).closest('ul').find('.active').removeClass('active');
5282							$(val).parent().addClass('active');
5283						}
5284					});
5285				}
5286			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5287				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5288				if (lastSection.length) {
5289					$('ul.onepage-pagination li a').removeClass('is-selected');
5290					lastSection.addClass('is-selected');
5291				}
5292			}
5293		});
5294	}
5295
5296	var scrollBody = function(index) {
5297		$('ul.onepage-pagination li a').removeClass('is-selected');
5298		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5299
5300		var getSection = $('[data-section=' + index + ']'),
5301			scrollTo;
5302
5303		if (getSection == undefined) return;
5304
5305		var body = $("html, body"),
5306			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5307			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5308			getOffset = UNCODE.get_scroll_offset(index);
5309		if ( typeof getSection.offset() === 'undefined' )
5310			return;
5311		scrollTo = getSection.offset().top;
5312
5313		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5314		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5315			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5316			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5317				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5318			}
5319
5320			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5321				if ( index === 0 ) {
5322					scrollTo = 0;
5323				} else {
5324					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5325				}
5326			} else {
5327				scrollTo -= getOffset;
5328			}
5329		}
5330
5331		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5332		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5333
5334		if (index != 0) {
5335			UNCODE.scrolling = true;
5336		}
5337
5338		if (scrollSpeed == 0) {
5339			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5340			UNCODE.scrolling = false;
5341		} else {
5342			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5343				$(this).stop();
5344			}).animate({
5345				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5346			}, scrollSpeed, 'easeInOutCubic', function() {
5347				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5348				UNCODE.scrolling = false;
5349				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5350				||
5351				$('.menu-hided').length ) {
5352					scrollTo = getSection.offset().top;
5353					getOffset = UNCODE.get_scroll_offset(index);
5354					scrollTo -= getOffset;
5355					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5356						$(this).stop();
5357					}).animate({
5358						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5359						}, scrollSpeed, 'easeInOutCubic', function() {
5360							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5361							UNCODE.scrolling = false;
5362						}
5363					);
5364				}
5365			});
5366		}
5367
5368	};
5369
5370	init_onepage();
5371};
5372
5373UNCODE.stickyElements = function() {
5374	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5375	if (!isMobile_wide ) {
5376
5377		var $pageHeader = $('#page-header'),
5378			$headerRow = $('.vc_row', $pageHeader),
5379			startSticky = false;
5380
5381		if ( $headerRow.hasClass('sticky-element') ) {
5382			$headerRow.removeClass('sticky-element');
5383			$pageHeader.addClass('sticky-element');
5384			startSticky = true;
5385		}
5386
5387		var calculateOffset = function(el) {
5388			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5389				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5390				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5391				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5392
5393			sideOffset += UNCODE.bodyBorder;
5394
5395			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5396			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5397				if ($('.menu-shrink').length) {
5398					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5399				} else {
5400					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5401				}
5402			}
5403
5404			return sideOffset;
5405
5406		},
5407
5408		initStickyElement = function($els) {
5409			if ( $('body').hasClass('vc-safe-mode') ) {
5410				return true;
5411			}
5412			if ( typeof $els === 'undefined' ) {
5413				$els = $('.sticky-element');
5414			}
5415			$.each($els, function(index, element) {
5416				if ($(element).closest('.tab-pane').length) {
5417					var $paneParent = $(element).closest('.tab-pane');
5418					if ( !$paneParent.hasClass('active') ) {
5419						return true;
5420					}
5421				}
5422				$(element).stick_in_parent({
5423					sticky_class: 'is_stucked',
5424					offset_top: calculateOffset(element),
5425					bottoming: true,
5426					inner_scrolling: SiteParameters.sticky_elements === 'on'
5427				});
5428			});
5429		};
5430
5431		var oldW = UNCODE.wwidth,
5432			oldH = UNCODE.wHeight;
5433
5434		requestTimeout(function() {
5435			if ($('.sticky-element').length) {
5436
5437				if ($(window).width() > UNCODE.mediaQuery) {
5438					initStickyElement();
5439
5440					if ( startSticky === true ) {
5441						$('#page-header').trigger('sticky_kit:recalc');
5442					}
5443				}
5444
5445				$(window).on('resize lateral_resize', function(event) {
5446					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
5447						$(".sticky-element").trigger("sticky_kit:detach");
5448						if ($(window).width() > UNCODE.mediaQuery) {
5449							initStickyElement();
5450						}
5451						oldW = UNCODE.wwidth;
5452						oldH = UNCODE.wHeight;
5453					}
5454				});
5455			}
5456		}, 1000);
5457
5458		if ($('.sticky-element').length) {
5459			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
5460				requestTimeout(function() {
5461					$(document.body).trigger("sticky_kit:recalc");
5462				}, 100);
5463			});
5464		}
5465
5466		var $panels = $('.panel-collapse');
5467		if ( $panels.length ) {
5468			$panels.each(function(){
5469				var $panel = $(this);
5470				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
5471					$(document.body).trigger("sticky_kit:recalc");
5472				});
5473			});
5474		}
5475
5476		$('.nav-tabs a').on('shown.bs.tab', function(e){
5477			var $tabs = $(e.target).closest('.tab-container'),
5478				$panel = $('.tab-pane.active', $tabs),
5479				$els = $(e.target).nextAll(".sticky-element");
5480
5481			$els.trigger("sticky_kit:detach");
5482			initStickyElement($els);
5483		});
5484
5485		$(window).on('vc-safe-mode-on', function(){
5486			$(".sticky-element").trigger("sticky_kit:detach");
5487		});
5488
5489		$(window).on('vc-safe-mode-off', function(){
5490			initStickyElement();
5491		});
5492	}
5493};
5494
5495UNCODE.twentytwenty = function() {
5496
5497  if (!$('.twentytwenty-container').length) return;
5498
5499// DOM.event.move
5500//
5501// 2.0.0
5502//
5503// Stephen Band
5504//
5505// Triggers 'movestart', 'move' and 'moveend' events after
5506// mousemoves following a mousedown cross a distance threshold,
5507// similar to the native 'dragstart', 'drag' and 'dragend' events.
5508// Move events are throttled to animation frames. Move event objects
5509// have the properties:
5510//
5511// pageX:
5512// pageY:     Page coordinates of pointer.
5513// startX:
5514// startY:    Page coordinates of pointer at movestart.
5515// distX:
5516// distY:     Distance the pointer has moved since movestart.
5517// deltaX:
5518// deltaY:    Distance the finger has moved since last event.
5519// velocityX:
5520// velocityY: Average velocity over last few events.
5521
5522
5523(function(fn) {
5524	if (typeof define === 'function' && define.amd) {
5525        define([], fn);
5526    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
5527        module.exports = fn;
5528	} else {
5529		fn();
5530	}
5531})(function(){
5532	var assign = Object.assign || window.jQuery && jQuery.extend;
5533
5534	// Number of pixels a pressed pointer travels before movestart
5535	// event is fired.
5536	var threshold = 8;
5537
5538	// Shim for requestAnimationFrame, falling back to timer. See:
5539	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
5540	var requestFrame = (function(){
5541		return (
5542			window.requestAnimationFrame ||
5543			window.webkitRequestAnimationFrame ||
5544			window.mozRequestAnimationFrame ||
5545			window.oRequestAnimationFrame ||
5546			window.msRequestAnimationFrame ||
5547			function(fn, element){
5548				return window.setTimeout(function(){
5549					fn();
5550				}, 25);
5551			}
5552		);
5553	})();
5554
5555	// Shim for customEvent
5556	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
5557	(function () {
5558		if ( typeof window.CustomEvent === "function" ) return false;
5559		function CustomEvent ( event, params ) {
5560			params = params || { bubbles: false, cancelable: false, detail: undefined };
5561			var evt = document.createEvent( 'CustomEvent' );
5562			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
5563			return evt;
5564		}
5565
5566		CustomEvent.prototype = window.Event.prototype;
5567		window.CustomEvent = CustomEvent;
5568	})();
5569
5570	var ignoreTags = {
5571			textarea: true,
5572			input: true,
5573			select: true,
5574			button: true
5575		};
5576
5577	var mouseevents = {
5578		move:   'mousemove',
5579		cancel: 'mouseup dragstart',
5580		end:    'mouseup'
5581	};
5582
5583	var touchevents = {
5584		move:   'touchmove',
5585		cancel: 'touchend',
5586		end:    'touchend'
5587	};
5588
5589	var rspaces = /\s+/;
5590
5591
5592	// DOM Events
5593
5594	var eventOptions = { bubbles: true, cancelable: true };
5595
5596	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
5597
5598	function createEvent(type) {
5599		return new CustomEvent(type, eventOptions);
5600	}
5601
5602	function getEvents(node) {
5603		return node[eventsSymbol] || (node[eventsSymbol] = {});
5604	}
5605
5606	function on(node, types, fn, data, selector) {
5607		types = types.split(rspaces);
5608
5609		var events = getEvents(node);
5610		var i = types.length;
5611		var handlers, type;
5612
5613		function handler(e) { fn(e, data); }
5614
5615		while (i--) {
5616			type = types[i];
5617			handlers = events[type] || (events[type] = []);
5618			handlers.push([fn, handler]);
5619			node.addEventListener(type, handler);
5620		}
5621	}
5622
5623	function off(node, types, fn, selector) {
5624		types = types.split(rspaces);
5625
5626		var events = getEvents(node);
5627		var i = types.length;
5628		var type, handlers, k;
5629
5630		if (!events) { return; }
5631
5632		while (i--) {
5633			type = types[i];
5634			handlers = events[type];
5635			if (!handlers) { continue; }
5636			k = handlers.length;
5637			while (k--) {
5638				if (handlers[k][0] === fn) {
5639					node.removeEventListener(type, handlers[k][1]);
5640					handlers.splice(k, 1);
5641				}
5642			}
5643		}
5644	}
5645
5646	function trigger(node, type, properties) {
5647		// Don't cache events. It prevents you from triggering an event of a
5648		// given type from inside the handler of another event of that type.
5649		var event = createEvent(type);
5650		if (properties) { assign(event, properties); }
5651		node.dispatchEvent(event);
5652	}
5653
5654
5655	// Constructors
5656
5657	function Timer(fn){
5658		var callback = fn,
5659		    active = false,
5660		    running = false;
5661
5662		function trigger(time) {
5663			if (active){
5664				callback();
5665				requestFrame(trigger);
5666				running = true;
5667				active = false;
5668			}
5669			else {
5670				running = false;
5671			}
5672		}
5673
5674		this.kick = function(fn) {
5675			active = true;
5676			if (!running) { trigger(); }
5677		};
5678
5679		this.end = function(fn) {
5680			var cb = callback;
5681
5682			if (!fn) { return; }
5683
5684			// If the timer is not running, simply call the end callback.
5685			if (!running) {
5686				fn();
5687			}
5688			// If the timer is running, and has been kicked lately, then
5689			// queue up the current callback and the end callback, otherwise
5690			// just the end callback.
5691			else {
5692				callback = active ?
5693					function(){ cb(); fn(); } :
5694					fn ;
5695
5696				active = true;
5697			}
5698		};
5699	}
5700
5701
5702	// Functions
5703
5704	function noop() {}
5705
5706	function preventDefault(e) {
5707		e.preventDefault();
5708	}
5709
5710	function isIgnoreTag(e) {
5711		return !!ignoreTags[e.target.tagName.toLowerCase()];
5712	}
5713
5714	function isPrimaryButton(e) {
5715		// Ignore mousedowns on any button other than the left (or primary)
5716		// mouse button, or when a modifier key is pressed.
5717		return (e.which === 1 && !e.ctrlKey && !e.altKey);
5718	}
5719
5720	function identifiedTouch(touchList, id) {
5721		var i, l;
5722
5723		if (touchList.identifiedTouch) {
5724			return touchList.identifiedTouch(id);
5725		}
5726
5727		// touchList.identifiedTouch() does not exist in
5728		// webkit yet… we must do the search ourselves...
5729
5730		i = -1;
5731		l = touchList.length;
5732
5733		while (++i < l) {
5734			if (touchList[i].identifier === id) {
5735				return touchList[i];
5736			}
5737		}
5738	}
5739
5740	function changedTouch(e, data) {
5741		var touch = identifiedTouch(e.changedTouches, data.identifier);
5742
5743		// This isn't the touch you're looking for.
5744		if (!touch) { return; }
5745
5746		// Chrome Android (at least) includes touches that have not
5747		// changed in e.changedTouches. That's a bit annoying. Check
5748		// that this touch has changed.
5749		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
5750
5751		return touch;
5752	}
5753
5754
5755	// Handlers that decide when the first movestart is triggered
5756
5757	function mousedown(e){
5758		// Ignore non-primary buttons
5759		if (!isPrimaryButton(e)) { return; }
5760
5761		// Ignore form and interactive elements
5762		if (isIgnoreTag(e)) { return; }
5763
5764		on(document, mouseevents.move, mousemove, e);
5765		on(document, mouseevents.cancel, mouseend, e);
5766	}
5767
5768	function mousemove(e, data){
5769		checkThreshold(e, data, e, removeMouse);
5770	}
5771
5772	function mouseend(e, data) {
5773		removeMouse();
5774	}
5775
5776	function removeMouse() {
5777		off(document, mouseevents.move, mousemove);
5778		off(document, mouseevents.cancel, mouseend);
5779	}
5780
5781	function touchstart(e) {
5782		// Don't get in the way of interaction with form elements
5783		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
5784
5785		var touch = e.changedTouches[0];
5786
5787		// iOS live updates the touch objects whereas Android gives us copies.
5788		// That means we can't trust the touchstart object to stay the same,
5789		// so we must copy the data. This object acts as a template for
5790		// movestart, move and moveend event objects.
5791		var data = {
5792			target:     touch.target,
5793			pageX:      touch.pageX,
5794			pageY:      touch.pageY,
5795			identifier: touch.identifier,
5796
5797			// The only way to make handlers individually unbindable is by
5798			// making them unique.
5799			touchmove:  function(e, data) { touchmove(e, data); },
5800			touchend:   function(e, data) { touchend(e, data); }
5801		};
5802
5803		on(document, touchevents.move, data.touchmove, data);
5804		on(document, touchevents.cancel, data.touchend, data);
5805	}
5806
5807	function touchmove(e, data) {
5808		var touch = changedTouch(e, data);
5809		if (!touch) { return; }
5810		checkThreshold(e, data, touch, removeTouch);
5811	}
5812
5813	function touchend(e, data) {
5814		var touch = identifiedTouch(e.changedTouches, data.identifier);
5815		if (!touch) { return; }
5816		removeTouch(data);
5817	}
5818
5819	function removeTouch(data) {
5820		off(document, touchevents.move, data.touchmove);
5821		off(document, touchevents.cancel, data.touchend);
5822	}
5823
5824	function checkThreshold(e, data, touch, fn) {
5825		var distX = touch.pageX - data.pageX;
5826		var distY = touch.pageY - data.pageY;
5827
5828		// Do nothing if the threshold has not been crossed.
5829		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
5830
5831		triggerStart(e, data, touch, distX, distY, fn);
5832	}
5833
5834	function triggerStart(e, data, touch, distX, distY, fn) {
5835		var touches = e.targetTouches;
5836		var time = e.timeStamp - data.timeStamp;
5837
5838		// Create a movestart object with some special properties that
5839		// are passed only to the movestart handlers.
5840		var template = {
5841			altKey:     e.altKey,
5842			ctrlKey:    e.ctrlKey,
5843			shiftKey:   e.shiftKey,
5844			startX:     data.pageX,
5845			startY:     data.pageY,
5846			distX:      distX,
5847			distY:      distY,
5848			deltaX:     distX,
5849			deltaY:     distY,
5850			pageX:      touch.pageX,
5851			pageY:      touch.pageY,
5852			velocityX:  distX / time,
5853			velocityY:  distY / time,
5854			identifier: data.identifier,
5855			targetTouches: touches,
5856			finger: touches ? touches.length : 1,
5857			enableMove: function() {
5858				this.moveEnabled = true;
5859				this.enableMove = noop;
5860				e.preventDefault();
5861			}
5862		};
5863
5864		// Trigger the movestart event.
5865		trigger(data.target, 'movestart', template);
5866
5867		// Unbind handlers that tracked the touch or mouse up till now.
5868		fn(data);
5869	}
5870
5871
5872	// Handlers that control what happens following a movestart
5873
5874	function activeMousemove(e, data) {
5875		var timer  = data.timer;
5876
5877		data.touch = e;
5878		data.timeStamp = e.timeStamp;
5879		timer.kick();
5880	}
5881
5882	function activeMouseend(e, data) {
5883		var target = data.target;
5884		var event  = data.event;
5885		var timer  = data.timer;
5886
5887		removeActiveMouse();
5888
5889		endEvent(target, event, timer, function() {
5890			// Unbind the click suppressor, waiting until after mouseup
5891			// has been handled.
5892			setTimeout(function(){
5893				off(target, 'click', preventDefault);
5894			}, 0);
5895		});
5896	}
5897
5898	function removeActiveMouse() {
5899		off(document, mouseevents.move, activeMousemove);
5900		off(document, mouseevents.end, activeMouseend);
5901	}
5902
5903	function activeTouchmove(e, data) {
5904		var event = data.event;
5905		var timer = data.timer;
5906		var touch = changedTouch(e, event);
5907
5908		if (!touch) { return; }
5909
5910		// Stop the interface from gesturing
5911		e.preventDefault();
5912
5913		event.targetTouches = e.targetTouches;
5914		data.touch = touch;
5915		data.timeStamp = e.timeStamp;
5916
5917		timer.kick();
5918	}
5919
5920	function activeTouchend(e, data) {
5921		var target = data.target;
5922		var event  = data.event;
5923		var timer  = data.timer;
5924		var touch  = identifiedTouch(e.changedTouches, event.identifier);
5925
5926		// This isn't the touch you're looking for.
5927		if (!touch) { return; }
5928
5929		removeActiveTouch(data);
5930		endEvent(target, event, timer);
5931	}
5932
5933	function removeActiveTouch(data) {
5934		off(document, touchevents.move, data.activeTouchmove);
5935		off(document, touchevents.end, data.activeTouchend);
5936	}
5937
5938
5939	// Logic for triggering move and moveend events
5940
5941	function updateEvent(event, touch, timeStamp) {
5942		var time = timeStamp - event.timeStamp;
5943
5944		event.distX =  touch.pageX - event.startX;
5945		event.distY =  touch.pageY - event.startY;
5946		event.deltaX = touch.pageX - event.pageX;
5947		event.deltaY = touch.pageY - event.pageY;
5948
5949		// Average the velocity of the last few events using a decay
5950		// curve to even out spurious jumps in values.
5951		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
5952		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
5953		event.pageX =  touch.pageX;
5954		event.pageY =  touch.pageY;
5955	}
5956
5957	function endEvent(target, event, timer, fn) {
5958		timer.end(function(){
5959			trigger(target, 'moveend', event);
5960			return fn && fn();
5961		});
5962	}
5963
5964
5965	// Set up the DOM
5966
5967	function movestart(e) {
5968		if (e.defaultPrevented) { return; }
5969		if (!e.moveEnabled) { return; }
5970
5971		var event = {
5972			startX:        e.startX,
5973			startY:        e.startY,
5974			pageX:         e.pageX,
5975			pageY:         e.pageY,
5976			distX:         e.distX,
5977			distY:         e.distY,
5978			deltaX:        e.deltaX,
5979			deltaY:        e.deltaY,
5980			velocityX:     e.velocityX,
5981			velocityY:     e.velocityY,
5982			identifier:    e.identifier,
5983			targetTouches: e.targetTouches,
5984			finger:        e.finger
5985		};
5986
5987		var data = {
5988			target:    e.target,
5989			event:     event,
5990			timer:     new Timer(update),
5991			touch:     undefined,
5992			timeStamp: e.timeStamp
5993		};
5994
5995		function update(time) {
5996			updateEvent(event, data.touch, data.timeStamp);
5997			trigger(data.target, 'move', event);
5998		}
5999
6000		if (e.identifier === undefined) {
6001			// We're dealing with a mouse event.
6002			// Stop clicks from propagating during a move
6003			on(e.target, 'click', preventDefault);
6004			on(document, mouseevents.move, activeMousemove, data);
6005			on(document, mouseevents.end, activeMouseend, data);
6006		}
6007		else {
6008			// In order to unbind correct handlers they have to be unique
6009			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6010			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6011
6012			// We're dealing with a touch.
6013			on(document, touchevents.move, data.activeTouchmove, data);
6014			on(document, touchevents.end, data.activeTouchend, data);
6015		}
6016	}
6017
6018	on(document, 'mousedown', mousedown);
6019	on(document, 'touchstart', touchstart);
6020	on(document, 'movestart', movestart);
6021
6022
6023	// jQuery special events
6024	//
6025	// jQuery event objects are copies of DOM event objects. They need
6026	// a little help copying the move properties across.
6027
6028	if (!window.jQuery) { return; }
6029
6030	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6031
6032	function enableMove1(e) { e.enableMove(); }
6033	function enableMove2(e) { e.enableMove(); }
6034	function enableMove3(e) { e.enableMove(); }
6035
6036	function add(handleObj) {
6037		var handler = handleObj.handler;
6038
6039		handleObj.handler = function(e) {
6040			// Copy move properties across from originalEvent
6041			var i = properties.length;
6042			var property;
6043
6044			while(i--) {
6045				property = properties[i];
6046				e[property] = e.originalEvent[property];
6047			}
6048
6049			handler.apply(this, arguments);
6050		};
6051	}
6052
6053	jQuery.event.special.movestart = {
6054		setup: function() {
6055			// Movestart must be enabled to allow other move events
6056			on(this, 'movestart', enableMove1);
6057
6058			// Do listen to DOM events
6059			return false;
6060		},
6061
6062		teardown: function() {
6063			off(this, 'movestart', enableMove1);
6064			return false;
6065		},
6066
6067		add: add
6068	};
6069
6070	jQuery.event.special.move = {
6071		setup: function() {
6072			on(this, 'movestart', enableMove2);
6073			return false;
6074		},
6075
6076		teardown: function() {
6077			off(this, 'movestart', enableMove2);
6078			return false;
6079		},
6080
6081		add: add
6082	};
6083
6084	jQuery.event.special.moveend = {
6085		setup: function() {
6086			on(this, 'movestart', enableMove3);
6087			return false;
6088		},
6089
6090		teardown: function() {
6091			off(this, 'movestart', enableMove3);
6092			return false;
6093		},
6094
6095		add: add
6096	};
6097});
6098
6099  $.fn.twentytwenty = function(options) {
6100    var options = $.extend({
6101      default_offset_pct: 0.5,
6102      orientation: 'horizontal',
6103      before_label: 'Before',
6104      after_label: 'After',
6105      no_overlay: false,
6106      move_slider_on_hover: false,
6107      move_with_handle_only: true,
6108      click_to_move: false
6109    }, options);
6110
6111    return this.each(function() {
6112
6113      var sliderPct = options.default_offset_pct;
6114      var container = $(this);
6115      var sliderOrientation = options.orientation;
6116      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6117      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6118
6119
6120      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6121      if(!options.no_overlay) {
6122        container.append("<div class='twentytwenty-overlay'></div>");
6123        var overlay = container.find(".twentytwenty-overlay");
6124        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6125        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6126      }
6127      var beforeImg = container.find("img:first");
6128      var afterImg = container.find("img:last");
6129      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6130      var slider = container.find(".twentytwenty-handle");
6131      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6132      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6133      container.addClass("twentytwenty-container");
6134      beforeImg.addClass("twentytwenty-before");
6135      afterImg.addClass("twentytwenty-after");
6136
6137      var calcOffset = function(dimensionPct) {
6138        var w = beforeImg.width();
6139        var h = beforeImg.height();
6140        return {
6141          w: w+"px",
6142          h: h+"px",
6143          cw: (dimensionPct*w)+"px",
6144          ch: (dimensionPct*h)+"px"
6145        };
6146      };
6147
6148      var adjustContainer = function(offset) {
6149      	if (sliderOrientation === 'vertical') {
6150          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6151          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6152      	}
6153      	else {
6154          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6155          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6156    	}
6157        container.css("height", offset.h);
6158      };
6159
6160      var adjustSlider = function(pct) {
6161        var offset = calcOffset(pct);
6162        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6163        adjustContainer(offset);
6164      };
6165
6166      // Return the number specified or the min/max number if it outside the range given.
6167      var minMaxNumber = function(num, min, max) {
6168        return Math.max(min, Math.min(max, num));
6169      };
6170
6171      // Calculate the slider percentage based on the position.
6172      var getSliderPercentage = function(positionX, positionY) {
6173        var sliderPercentage = (sliderOrientation === 'vertical') ?
6174          (positionY-offsetY)/imgHeight :
6175          (positionX-offsetX)/imgWidth;
6176
6177        return minMaxNumber(sliderPercentage, 0, 1);
6178      };
6179
6180
6181      $(window).on("resize.twentytwenty", function(e) {
6182        adjustSlider(sliderPct);
6183      });
6184
6185      var offsetX = 0;
6186      var offsetY = 0;
6187      var imgWidth = 0;
6188      var imgHeight = 0;
6189      var onMoveStart = function(e) {
6190        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6191          e.preventDefault();
6192        }
6193        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6194          e.preventDefault();
6195        }
6196        container.addClass("active");
6197        offsetX = container.offset().left;
6198        offsetY = container.offset().top;
6199        imgWidth = beforeImg.width();
6200        imgHeight = beforeImg.height();
6201      };
6202      var onMove = function(e) {
6203        if (container.hasClass("active")) {
6204          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6205          adjustSlider(sliderPct);
6206        }
6207      };
6208      var onMoveEnd = function() {
6209          container.removeClass("active");
6210      };
6211
6212      var moveTarget = options.move_with_handle_only ? slider : container;
6213      moveTarget.on("movestart",onMoveStart);
6214      moveTarget.on("move",onMove);
6215      moveTarget.on("moveend",onMoveEnd);
6216
6217      if (options.move_slider_on_hover) {
6218        container.on("mouseenter", onMoveStart);
6219        container.on("mousemove", onMove);
6220        container.on("mouseleave", onMoveEnd);
6221      }
6222
6223      slider.on("touchmove", function(e) {
6224        e.preventDefault();
6225      });
6226
6227      container.find("img").on("mousedown", function(event) {
6228        event.preventDefault();
6229      });
6230
6231      if (options.click_to_move) {
6232        container.on('click', function(e) {
6233          offsetX = container.offset().left;
6234          offsetY = container.offset().top;
6235          imgWidth = beforeImg.width();
6236          imgHeight = beforeImg.height();
6237
6238          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6239          adjustSlider(sliderPct);
6240        });
6241      }
6242
6243      $(window).trigger("resize.twentytwenty");
6244    });
6245  };
6246
6247
6248  $(window).on("load", function(e) {
6249  	$('.twentytwenty-container').each(function(){
6250  		var $container = $(this);
6251  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6252  			$container.twentytwenty();
6253  		}
6254  		$('img', $container).on('async-done', function(){
6255	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6256	  			$container.twentytwenty();
6257	  		}
6258	    });
6259  	});
6260  });
6261}
6262
6263UNCODE.justifiedGallery = function() {
6264
6265	var breakPointMe = function( val ) {
6266		val = parseInt( val );
6267		if ( isNaN(val) ) {
6268			return false;
6269		}
6270		if ( val >= 1500 ) {
6271			return 1;
6272		} else if ( val < 1500 && val >= 960 ) {
6273			return 2;
6274		} else if ( val < 960 && val >= 570 ) {
6275			return 3;
6276		} else if ( val < 570 ) {
6277			return 4;
6278		}
6279	}
6280
6281	var gutterByBreakpoint = function( bp, gutter ) {
6282		var ret;
6283		switch(gutter) {
6284		    case 'no-gutter':
6285		    	ret = 0;
6286		        break;
6287		    case 'px-gutter':
6288		    	ret = 1;
6289		        break;
6290		    case 'half-gutter':
6291		    	ret = 18;
6292		        break;
6293		    case 'double-gutter':
6294				switch(bp) {
6295				    case 3:
6296				    case 4:
6297				    	ret = 36;
6298				        break;
6299				    default:
6300				    	ret = 72;
6301				        break;
6302				}
6303		        break;
6304		    case 'triple-gutter':
6305				switch(bp) {
6306				    case 3:
6307				    case 4:
6308				    	ret = 36;
6309				        break;
6310				    default:
6311				    	ret = 108;
6312				        break;
6313				}
6314		        break;
6315		    case 'quad-gutter':
6316				switch(bp) {
6317				    case 2:
6318				    	ret = 108;
6319				        break;
6320				    case 3:
6321				    	ret = 72;
6322				        break;
6323				    case 4:
6324				    	ret = 36;
6325				        break;
6326				    default:
6327				    	ret = 144;
6328				        break;
6329				}
6330		        break;
6331		    default:
6332		    	ret = 36;//single-gutter
6333		}
6334		return ret;
6335	}
6336
6337	if ($('.justified-layout').length > 0) {
6338		var justifiedContainersArray = [],
6339			typeGridArray = [],
6340			layoutGridArray = [],
6341			transitionDuration = [],
6342			$filterItems = [],
6343			$filters = $('.justified-system .isotope-filters'),
6344			$itemSelector = '.tmb',
6345			$items,
6346			itemMargin,
6347			correctionFactor = 0,
6348			firstLoad = true,
6349			isOriginLeft = $('body').hasClass('rtl') ? false : true,
6350			prevW = breakPointMe(UNCODE.wwidth);
6351		$('[class*="justified-container"]').each(function() {
6352			var isoData = $(this).data();
6353			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6354			if (isoData.type == 'metro') typeGridArray.push(true);
6355			else typeGridArray.push(false);
6356			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
6357			else layoutGridArray.push('justified');
6358			justifiedContainersArray.push($(this));
6359		});
6360		var init_justifiedGallery = function() {
6361			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
6362				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
6363					justifiedId = justifiedSystem.attr('id'),
6364					$layoutMode = layoutGridArray[i],
6365					gutter = $(justifiedContainersArray[i]).data('gutter'),
6366					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
6367					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
6368					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6369					margins;
6370
6371				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6372				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6373				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6374
6375				margins = gutterByBreakpoint(prevW, gutter);
6376
6377				$(justifiedContainersArray[i]).justifiedGallery({
6378					rowHeight: rowHeight,
6379					maxRowHeight: maxRowHeight,
6380					margins: margins,
6381					cssAnimation: true,
6382					lastRow: lastRow,
6383					waitThumbnailsLoad: false
6384				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6385
6386				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6387					$(justifiedContainersArray[i]).infinitescroll({
6388							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6389							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6390							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6391							animate: false,
6392							behavior: 'local',
6393							debug: false,
6394							loading: {
6395								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6396								speed: 0,
6397								finished: undefined,
6398								msg: $('#' + justifiedId + ' .loadmore-button'),
6399							},
6400							errorCallback: function() {
6401								var justified_system = $(this).closest('.justified-system');
6402								$('.loading-button', justified_system).hide();
6403								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
6404							}
6405						},
6406						// append the new items to galleryJustified on the infinitescroll callback function.
6407						function(newElements, opts) {
6408							var $galleryJustified = $(this),
6409								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
6410								filters = new Array(),
6411								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
6412								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
6413								$numPages = $('a', $infinite_button).data('pages'),
6414								delay = 300;
6415							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6416							$infinite_button.show();
6417							$loading_button.hide();
6418							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6419							$('> li', $galleryJustified).remove();
6420							$.each($(newElements), function(index, val) {
6421								$(val).addClass('tmb-iso');
6422								if ($(val).is("li")) {
6423									filters.push($(val)[0]);
6424								}
6425								$(val).addClass('uncode-appended');
6426							});
6427							newElements = newElements.filter(function(x) {
6428								return filters.indexOf(x) < 0
6429							});
6430							$.each($(filters), function(index, val) {
6431								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
6432							});
6433							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
6434							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6435								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
6436								if (typeof getLightbox === 'object') {
6437									getLightbox.refresh();
6438								} else {
6439									UNCODE.lightbox();
6440								}
6441							}
6442							if ( typeof twttr !== 'undefined' )
6443								twttr.widgets.load(justifiedContainersArray[i]);
6444
6445							requestTimeout(function() {
6446								$galleryJustified.trigger('more-items-loaded');
6447								$(window).trigger('more-items-loaded');
6448								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6449							}, 1000);
6450						});
6451					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
6452						var $infinite_justified = $(justifiedContainersArray[i]),
6453							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
6454						$infinite_justified.infinitescroll('pause');
6455						$infinite_button.on('click', function(event) {
6456							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6457								$.each(UNCODE.lightboxArray, function(index, val) {
6458									UNCODE.lightboxArray[index].destroy();
6459								});
6460							}
6461							event.preventDefault();
6462							var $justified_system = $(event.target).closest('.justified-system'),
6463							$infinite_justified = $justified_system.find('.justified-container'),
6464							justifiedId = $justified_system.attr('id');
6465							$(event.currentTarget).html(SiteParameters.loading);
6466							$infinite_justified.infinitescroll('resume');
6467							$infinite_justified.infinitescroll('retrieve');
6468							$infinite_justified.infinitescroll('pause');
6469							$infinite_justified.trigger('more-items-loaded');
6470							$(window).trigger('more-items-loaded');
6471							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6472						});
6473					}
6474				}
6475			}
6476		},
6477		onLayout = function(justifiedObj, startIndex) {
6478			justifiedObj.css('opacity', 1);
6479			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
6480			$('.tmb', justifiedObj).addClass('justified-object-loaded');
6481
6482			requestTimeout(function() {
6483				// window.dispatchEvent(UNCODE.boxEvent);
6484				UNCODE.adaptive();
6485				if (SiteParameters.dynamic_srcset_active === '1') {
6486					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
6487				}
6488				if (typeof MediaElement === "function") {
6489					$(justifiedObj).find('audio,video').each(function() {
6490						$(this).mediaelementplayer({
6491								pauseOtherPlayers: false,
6492						});
6493					});
6494				}
6495				if ($(justifiedObj).find('.nested-carousel').length) {
6496					if (typeof UNCODE.carousel !== 'undefined') {
6497						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
6498					}
6499					requestTimeout(function() {
6500						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6501						justifiedObj.addClass('justified-gallery-finished')
6502						Waypoint.refreshAll();
6503					}, 200);
6504				} else {
6505					requestTimeout(function() {
6506						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6507						justifiedObj.addClass('justified-gallery-finished')
6508						Waypoint.refreshAll();
6509					}, 300);
6510				}
6511			}, 100);
6512
6513		},
6514		boxAnimation = function(items, startIndex, sequential, container) {
6515			var $allItems = items.length - startIndex,
6516				showed = 0,
6517				index = 0;
6518			if (container.closest('.owl-item').length == 1) return false;
6519			$.each(items, function(index, val) {
6520				var elInner = $('> .t-inside', val);
6521				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
6522					return;
6523				}
6524				if (val[0]) val = val[0];
6525				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
6526					new Waypoint({
6527						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
6528						element: val,
6529						handler: function() {
6530							var element = $('> .t-inside', this.element),
6531								parent = $(this.element),
6532								currentIndex = parent.index();
6533							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
6534								delayAttr = parseInt(element.attr('data-delay'));
6535							if (isNaN(delayAttr)) delayAttr = 100;
6536							delay -= showed;
6537							var objTimeout = requestTimeout(function() {
6538								element.removeClass('zoom-reverse').addClass('start_animation');
6539								showed = parent.index();
6540							}, delay * delayAttr);
6541							parent.data('objTimeout', objTimeout);
6542							if (!UNCODE.isUnmodalOpen) {
6543								this.destroy();
6544							}
6545						},
6546						offset: '100%'
6547					})
6548				} else {
6549					elInner.removeClass('animate_when_almost_visible');
6550					$(val).addClass('no-waypoint-animation');
6551					/*if (elInner.hasClass('force-anim')) {
6552						elInner.addClass('start_animation');
6553					} else {
6554						elInner.css('opacity', 1);
6555					}*/
6556				}
6557				index++;
6558			});
6559		};
6560		$filters.on('click', 'a[data-filter]', function(evt) {
6561			var $filter = $(this),
6562				filterContainer = $filter.closest('.isotope-filters'),
6563				filterValue = $filter.attr('data-filter'),
6564				container = $filter.closest('.justified-system').find($('.justified-layout')),
6565				lastRow = container.data('last-row'),
6566				transitionDuration = 0,
6567				delay = 300,
6568				filterItems = [];
6569
6570			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6571
6572			var filter_items = function(){
6573				if (filterValue !== undefined) {
6574					$.each($('> .tmb > .t-inside', container), function(index, val) {
6575						var parent = $(val).parent(),
6576							objTimeout = parent.data('objTimeout');
6577						if (objTimeout) {
6578							$(val).removeClass('zoom-reverse');
6579							clearRequestTimeout(objTimeout);
6580						}
6581						if (transitionDuration == 0) {
6582							if ($(val).hasClass('animate_when_almost_visible')) {
6583								$(val).addClass('zoom-reverse').removeClass('start_animation');
6584							} else {
6585								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6586							}
6587						}
6588					});
6589
6590					requestTimeout(function() {
6591						var $block,
6592							selector,
6593							lightboxElements,
6594							$boxes;
6595
6596						if ( filterValue !== '' && filterValue !== '*' ) {
6597							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
6598							selector = '.' + filterValue;
6599							$.each($(selector, container), function(index, block) {
6600								lightboxElements = $('[data-lbox^=ilightbox]', block);
6601								if (lightboxElements.length) {
6602									lightboxElements.removeClass('lb-disabled');
6603									container.data('lbox', $(lightboxElements[0]).data('lbox'));
6604								}
6605								filterItems.push(block);
6606							});
6607							container.justifiedGallery({
6608								filter: selector,
6609								lastRow: 'nojustify'
6610							});
6611						} else {
6612							container.justifiedGallery({
6613								filter: false,
6614								lastRow: lastRow
6615							});
6616							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
6617							filterItems = $('> .tmb', container);
6618						}
6619						container.trigger('more-items-loaded');
6620						$(window).trigger('more-items-loaded');
6621						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6622
6623						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6624						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6625							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
6626							if (typeof getLightbox === 'object') {
6627								getLightbox.refresh();
6628							} else {
6629								UNCODE.lightbox();
6630							}
6631						}
6632
6633						if (transitionDuration == 0) {
6634							requestTimeout(function() {
6635								boxAnimation(filterItems, 0, false, container);
6636							}, 100);
6637						}
6638						requestTimeout(function() {
6639							Waypoint.refreshAll();
6640							container.trigger('more-items-loaded');
6641							$(window).trigger('more-items-loaded');
6642							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6643						}, 2000);
6644
6645					}, delay);
6646				} else {
6647					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6648						$.each(UNCODE.lightboxArray, function(index, val) {
6649							UNCODE.lightboxArray[index].destroy();
6650						});
6651					}
6652					$.each($('> .tmb > .t-inside', container), function(index, val) {
6653						var parent = $(val).parent(),
6654							objTimeout = parent.data('objTimeout');
6655						if (objTimeout) {
6656							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6657							clearRequestTimeout(objTimeout);
6658						}
6659						if (transitionDuration == 0) {
6660							if ($(val).hasClass('animate_when_almost_visible')) {
6661								$(val).addClass('zoom-reverse').removeClass('start_animation');
6662							} else {
6663								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6664							}
6665						}
6666					});
6667					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6668						UNCODE.lightbox();
6669					}
6670					container.parent().addClass('justified-loading');
6671					container.trigger('more-items-loaded');
6672					$(window).trigger('more-items-loaded');
6673					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6674				}
6675			};
6676
6677			if (!$filter.hasClass('active')) {
6678				/** Scroll top with filtering */
6679				if (filterContainer.hasClass('filter-scroll')) {
6680                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6681                    calc_scroll -= UNCODE.get_scroll_offset();
6682
6683					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6684						delta = bodyTop - calc_scroll,
6685						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6686						filterTolerance = false,
6687						filter_timeout;
6688					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6689
6690					if ( !UNCODE.isFullPage ) {
6691						if (scrollSpeed == 0) {
6692							$('html, body').scrollTop(calc_scroll);
6693							UNCODE.scrolling = false;
6694							filter_items();
6695						} else {
6696
6697							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6698								filter_items();
6699								filterTolerance = true;
6700							}
6701
6702							$('html, body').animate({
6703								scrollTop: calc_scroll
6704							},{
6705								easing: 'easeInOutQuad',
6706								duration: scrollSpeed,
6707								complete: function(){
6708									UNCODE.scrolling = false;
6709									if ( !filterTolerance ) {
6710										filter_timeout = setTimeout(function(){
6711											clearTimeout(filter_timeout);
6712											filter_items();
6713										}, 200);
6714									}
6715								}
6716							});
6717						}
6718					}
6719				} else {
6720					filter_items();
6721				}
6722			}
6723			evt.preventDefault();
6724		});
6725
6726		$filters.each(function(i, buttonGroup) {
6727			var $buttonGroup = $(buttonGroup);
6728			$buttonGroup.on('click', 'a', function() {
6729				$buttonGroup.find('.active').removeClass('active');
6730				$(this).addClass('active');
6731			});
6732
6733			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6734				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6735				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6736			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6737				e.preventDefault();
6738				$cats_filters.slideToggle(400, 'easeInOutCirc');
6739			});
6740		});
6741		window.addEventListener('boxResized', function(e) {
6742			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
6743				prevW = breakPointMe(UNCODE.wwidth);
6744				$.each($('.justified-layout'), function(index, val) {
6745					var gutter = $(this).data('gutter'),
6746						margins = gutterByBreakpoint( prevW, gutter);
6747					$(this).justifiedGallery({
6748						margins: margins
6749					});
6750					$(this).find('.mejs-video,.mejs-audio').each(function() {
6751						$(this).trigger('resize');
6752					});
6753				});
6754			}
6755		}, false);
6756
6757		init_justifiedGallery();
6758	};
6759};
6760
6761UNCODE.cssGrid = function() {
6762	if ($('.cssgrid-layout').length > 0) {
6763		var cssGridContainersArray = [];
6764		var transitionDuration = [];
6765		var $filters = $('.cssgrid-system .cssgrid-filters');
6766
6767		$('[class*="cssgrid-container"]').each(function() {
6768			cssGridContainersArray.push($(this));
6769			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6770		});
6771
6772		var init_cssGridAjax = function() {
6773			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
6774				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
6775					cssGridId = cssGridSystem.attr('id');
6776
6777				cssGridSystem.data('transitionDuration', transitionDuration[i]);
6778
6779				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
6780					$(cssGridContainersArray[i]).infinitescroll({
6781						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
6782						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6783						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
6784						animate: false,
6785						behavior: 'local',
6786						debug: false,
6787						loading: {
6788							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
6789							speed: 0,
6790							finished: undefined,
6791							msg: $('#' + cssGridId + ' .loadmore-button'),
6792						},
6793						errorCallback: function() {
6794							var cssgrid_system = $(this).closest('.cssgrid-system');
6795							$('.loading-button', cssgrid_system).hide();
6796							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
6797						}
6798					},
6799					// append the new items to cssGrid on the infinitescroll callback function.
6800					function(newElements, opts) {
6801						var $cssGrid = $(this),
6802							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
6803							cssGridId = cssGridSystemCont.attr('id'),
6804							filters = new Array(),
6805							$loading_button = cssGridSystemCont.find('.loading-button'),
6806							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
6807							$numPages = $('a', $infinite_button).data('pages'),
6808							$woo_results,
6809							delay = 300;
6810						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6811						$infinite_button.show();
6812						$loading_button.hide();
6813						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6814						$('> li', $cssGrid).remove();
6815						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
6816						$.each($(newElements), function (index, val) {
6817							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
6818								$woo_results = $(val);
6819								delete newElements[index];
6820							} else {
6821								$(val).addClass('tmb-grid');
6822								if ($(val).is("li")) {
6823									filters.push($(val)[0]);
6824								}
6825							}
6826							$(val).addClass('uncode-appended');
6827						});
6828						newElements = newElements.filter(function(x) {
6829							return filters.indexOf(x) < 0
6830						});
6831						$.each($(filters), function(index, val) {
6832							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
6833						});
6834						if ($woo_results && $woo_results.length > 0) {
6835							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
6836							var new_count = $woo_results.find('.woocommerce-result-count').text();
6837							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
6838							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
6839							function replaceMatch(match, p1, p2) {
6840        						return old_start + '–' + new_end;
6841							}
6842							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
6843							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
6844						}
6845
6846						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6847						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
6848						if (filterValue !== undefined && filterValue != '*') {
6849							$(newElements).hide();
6850							var els_to_show = $();
6851							$(newElements).each(function() {
6852								var el = $(this);
6853								if (el.hasClass(filterValue)) {
6854									els_to_show = els_to_show.add(el);
6855									el.show();
6856								}
6857							});
6858							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
6859						} else {
6860							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
6861						}
6862
6863						UNCODE.adaptive();
6864						if (SiteParameters.dynamic_srcset_active === '1') {
6865							UNCODE.refresh_dynamic_srcset_size($cssGrid);
6866						}
6867						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6868							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
6869							if (typeof getLightbox === 'object') {
6870								getLightbox.refresh();
6871							} else {
6872								UNCODE.lightbox();
6873							}
6874						}
6875						if ( typeof twttr !== 'undefined' ) {
6876							twttr.widgets.load(cssGridContainersArray[i]);
6877						}
6878
6879						UNCODE.carousel($(newElements));
6880						requestTimeout(function() {
6881							$cssGrid.trigger('more-items-loaded');
6882							$(window).trigger('more-items-loaded');
6883							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6884						}, 1000);
6885
6886					});
6887					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
6888						var $cssgrid_el = $(cssGridContainersArray[i]),
6889							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
6890						$cssgrid_el.infinitescroll('pause');
6891						$infinite_button.on('click', function(event) {
6892							event.preventDefault();
6893							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
6894							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
6895							cssGridId = $cssgrid_system.attr('id');
6896							$(event.currentTarget).html(SiteParameters.loading);
6897							$cssgrid_el.infinitescroll('resume');
6898							$cssgrid_el.infinitescroll('retrieve');
6899							$cssgrid_el.infinitescroll('pause');
6900						});
6901					}
6902				}
6903			}
6904		};
6905
6906		init_cssGridAjax();
6907
6908		if ($('.cssgrid-pagination').length > 0) {
6909			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
6910				evt.preventDefault();
6911
6912				if (SiteParameters.index_pagination_disable_scroll !== '1') {
6913					var container = $(this).closest('.cssgrid-system'),
6914					calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6915
6916					calc_scroll -= UNCODE.get_scroll_offset();
6917
6918					var menu_container = $('.menu-sticky');
6919					var menu = menu_container.find('.menu-container');
6920
6921					if (menu_container.length > 0 && menu.length > 0) {
6922						calc_scroll = calc_scroll - menu.outerHeight();
6923					}
6924
6925					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6926						delta = bodyTop - calc_scroll,
6927						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6928					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6929
6930					if ( !UNCODE.isFullPage ) {
6931						if (scrollSpeed == 0) {
6932							$('html, body').scrollTop(calc_scroll);
6933						} else {
6934							$('html, body').animate({
6935								scrollTop: calc_scroll
6936							},{
6937								easing: 'easeInOutQuad',
6938								duration: scrollSpeed,
6939								complete: function(){
6940									UNCODE.scrolling = false;
6941								}
6942							});
6943						}
6944					}
6945				}
6946
6947				loadCssGrid($(this), true);
6948			});
6949		}
6950
6951		$filters.on('click', 'a.grid-nav-link', function(evt) {
6952			if ($(this).hasClass('no-grid-filter')) {
6953				return;
6954			}
6955			var $filter = $(this),
6956				filterContainer = $filter.closest('.cssgrid-filters'),
6957				filterValue = $filter.attr('data-filter'),
6958				containerSystem = $filter.closest('.cssgrid-system'),
6959				container = containerSystem.find($('.cssgrid-layout')),
6960				transitionDuration = containerSystem.data('transitionDuration'),
6961				delay = 300,
6962				filterItems = [],
6963				all_thumbs = container.find('.tmb-grid');
6964
6965			var filter_items = function(){
6966				if (filterValue !== undefined) {
6967					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
6968						var parent = $(val).parent(),
6969							objTimeout = parent.data('objTimeout');
6970						if (objTimeout) {
6971							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6972							clearRequestTimeout(objTimeout);
6973						}
6974						if (transitionDuration == 0) {
6975							if ($(val).hasClass('animate_when_almost_visible')) {
6976								$(val).addClass('zoom-reverse').removeClass('start_animation');
6977							} else {
6978								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6979							}
6980						}
6981					});
6982					requestTimeout(function(){
6983						if ( filterValue == '*' ) {
6984							all_thumbs.show();
6985							all_thumbs.each(function(index, val) {
6986								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
6987								filterItems.push($(this));
6988							});
6989						} else {
6990							all_thumbs.each(function() {
6991								var _tmb = $(this);
6992								if (_tmb.hasClass(filterValue)) {
6993									_tmb.show();
6994									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
6995									filterItems.push(_tmb);
6996								} else {
6997									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
6998									_tmb.hide();
6999								}
7000							});
7001						}
7002
7003						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7004
7005						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7006						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7007						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7008						if (lightboxElements.length) {
7009							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7010							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7011								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7012								if (typeof getLightbox === 'object') {
7013									getLightbox.refresh();
7014								} else {
7015									UNCODE.lightbox();
7016								}
7017							}
7018						}
7019						container.trigger('more-items-loaded');
7020						$(window).trigger('more-items-loaded');
7021						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7022					}, delay);
7023				} else {
7024					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7025						var parent = $(val).parent(),
7026							objTimeout = parent.data('objTimeout');
7027						if (objTimeout) {
7028							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7029							clearRequestTimeout(objTimeout);
7030						}
7031						if (transitionDuration == 0) {
7032							if ($(val).hasClass('animate_when_almost_visible')) {
7033								$(val).addClass('zoom-reverse').removeClass('start_animation');
7034							} else {
7035								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7036							}
7037						}
7038					});
7039					loadCssGrid($filter);
7040				}
7041			};
7042
7043			if (!$filter.hasClass('active')) {
7044				/** Scroll top with filtering */
7045				if (filterContainer.hasClass('filter-scroll')) {
7046                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7047                    calc_scroll -= UNCODE.get_scroll_offset();
7048
7049					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7050						delta = bodyTop - calc_scroll,
7051						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7052						filterTolerance = false,
7053						filter_timeout;
7054					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7055
7056					if ( !UNCODE.isFullPage ) {
7057						if (scrollSpeed == 0) {
7058							$('html, body').scrollTop(calc_scroll);
7059							UNCODE.scrolling = false;
7060							filter_items();
7061						} else {
7062
7063							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7064								filter_items();
7065								filterTolerance = true;
7066							}
7067
7068							$('html, body').animate({
7069								scrollTop: calc_scroll
7070							},{
7071								easing: 'easeInOutQuad',
7072								duration: scrollSpeed,
7073								complete: function(){
7074									UNCODE.scrolling = false;
7075									if ( !filterTolerance ) {
7076										filter_timeout = setTimeout(function(){
7077											clearTimeout(filter_timeout);
7078											filter_items();
7079										}, 200);
7080									}
7081								}
7082							});
7083						}
7084					}
7085				} else {
7086					filter_items();
7087				}
7088			}
7089			evt.preventDefault();
7090		});
7091
7092		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7093			var params = UNCODE.getURLParams(window.location);
7094			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7095
7096			UNCODE.lastURL = window.location.href;
7097
7098			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
7099				return;
7100			}
7101
7102			if (params.id === undefined) {
7103				$.each($('.cssgrid-system'), function(index, val) {
7104					loadCssGrid($(val));
7105				});
7106			} else {
7107				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7108					loadCssGrid($('#' + params.id));
7109				}
7110			}
7111		});
7112
7113		var loadCssGrid = function($href, $paginating) {
7114			var is_paginating = false;
7115
7116			if (undefined !== $paginating && $paginating) {
7117				var is_paginating = $paginating;
7118			}
7119
7120			var href = ($href.is("a") ? $href.attr('href') : location),
7121				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7122				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7123				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7124				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7125				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7126				cssgridId = cssgridSystem.attr('id');
7127			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7128				UNCODE.lastURL = href;
7129				history.pushState({
7130					myCSSgrid: true
7131				}, document.title, href);
7132			}
7133			cssgridWrapper.addClass('cssgrid-loading');
7134			if (is_paginating) {
7135				cssgridWrapper.addClass('grid-filtering');
7136			}
7137			$.ajax({
7138				url: href
7139			}).done(function(data) {
7140				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7141					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7142					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7143				requestTimeout(function() {
7144					cssgridContainer.html($resultItems);
7145					cssgridWrapper.removeClass('cssgrid-loading');
7146					cssgridWrapper.removeClass('grid-filtering');
7147					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7148					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7149					UNCODE.adaptive();
7150					if (SiteParameters.dynamic_srcset_active === '1') {
7151						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7152					}
7153					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7154						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7155						if (typeof getLightbox === 'object') {
7156							getLightbox.refresh();
7157						} else {
7158							UNCODE.lightbox();
7159						}
7160					}
7161					cssgridContainer.trigger('more-items-loaded');
7162					$(window).trigger('more-items-loaded');
7163					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7164				}, 300);
7165
7166				$('.pagination', cssgridFooter).remove();
7167				cssgridFooter.append($resultPagination);
7168
7169				if (cssgridResultCount.length > 0) {
7170					$('.woocommerce-result-count', cssgridResultCount).remove();
7171					cssgridResultCount.append($resultCount);
7172				}
7173			});
7174		};
7175
7176		$filters.each(function(i, buttonGroup) {
7177			var $buttonGroup = $(buttonGroup);
7178			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7179				$buttonGroup.find('.active').removeClass('active');
7180				$(this).addClass('active');
7181
7182			});
7183
7184			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7185				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7186				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7187			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7188				e.preventDefault();
7189				$cats_filters.slideToggle(400, 'easeInOutCirc');
7190			});
7191
7192		});
7193	};
7194};
7195
7196UNCODE.linearGrid = function(){
7197	$('.linear-wrapper').each(function(){
7198		var $wrap = $(this),
7199			$system = $wrap.closest('.linear-system'),
7200			$row = $wrap.closest('.vc_row[data-parent]'),
7201			row_id = $row.attr('id'),
7202			_row = $row[0],
7203			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7204			vertical = $cont.hasClass('linear-or-vertical'),
7205			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7206			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7207			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7208			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7209			isInViewport = false,
7210			isHover = false,
7211			stableHeight = UNCODE.wheight,
7212			wCont, hCont, docH, marqueeTL;
7213
7214		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7215		var dataX = dataSpeed;
7216
7217		dataSpeed += 5;
7218
7219		var checkLinearGridSize = function(){
7220			if ( !$wrap.is(':visible') )  {
7221				return;
7222			}
7223			$wrap.find('.cont-appended').remove();
7224
7225			if ( vertical ) {
7226				if ( ! SiteParameters.is_frontend_editor ) {
7227					hCont = $cont.outerHeight();
7228					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7229					if ( hCont < docH ) {
7230						var res = docH - hCont * 3,
7231							times = 2 * Math.round((res/hCont+1) / 2);
7232					}
7233					for ( var i = 0; i < times; i++ ) {
7234						var $cloneCont = $cont.clone(),
7235							$cloneCont2 = $cont.clone(),
7236							trans = ( (i+2) ) * 100;
7237						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7238						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7239						$cloneCont.find('a[data-lbox]').each(function(){
7240							var dataLbox = $(this).attr('data-lbox');
7241							$(this).attr('data-lbox', dataLbox + '_' + i);
7242						});
7243						$cloneCont.find('.wp-video-shortcode').each(function(){
7244							var thisID = $(this).attr('id');
7245							$(this).attr('id', thisID + '_' + i);
7246						});
7247						$cloneCont2.find('a[data-lbox]').each(function(){
7248							var dataLbox = $(this).attr('data-lbox');
7249							$(this).attr('data-lbox', dataLbox + '_2' + i);
7250						});
7251						$cloneCont2.find('.wp-video-shortcode').each(function(){
7252							var thisID = $(this).attr('id');
7253							$(this).attr('id', thisID + '__' + i);
7254						});
7255						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7256							UNCODE.lightgallery($cloneCont);
7257							UNCODE.lightgallery($cloneCont2);
7258						}
7259					}
7260                }
7261			} else {
7262				wCont = $cont.outerWidth();
7263				if ( (wCont) < UNCODE.wwidth*2 ) {
7264					var res = UNCODE.wwidth*2 - (wCont),
7265						times = 2 * Math.round((res/wCont+1) / 2);
7266				}
7267				for ( var i = 0; i < times; i++ ) {
7268					var $cloneCont = $cont.clone(),
7269						$cloneCont2 = $cont.clone(),
7270						trans = ( (i+2) ) * 100;
7271					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7272					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7273					$cloneCont.find('a[data-lbox]').each(function(){
7274						var dataLbox = $(this).attr('data-lbox');
7275						$(this).attr('data-lbox', dataLbox + '_' + i);
7276					});
7277					$cloneCont.find('[id]').each(function(){
7278						var thisID = $(this).attr('id');
7279						$(this).attr('id', thisID + '_' + i);
7280					});
7281					$cloneCont2.find('a[data-lbox]').each(function(){
7282						var dataLbox = $(this).attr('data-lbox');
7283						$(this).attr('data-lbox', dataLbox + '_2' + i);
7284					});
7285					$cloneCont2.find('[id]').each(function(){
7286						var thisID = $(this).attr('id');
7287						$(this).attr('id', thisID + '__' + i);
7288					});
7289                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
7290                        UNCODE.lightgallery($cloneCont);
7291                        UNCODE.lightgallery($cloneCont2);
7292                    }
7293                }
7294			}
7295		};
7296		if ( clone ) {
7297			checkLinearGridSize();
7298			$(window).on('resize.linearGrid', function(){
7299				checkLinearGridSize();
7300			});
7301		}
7302
7303		var continuousLinearMarquee = function(_xStrt){
7304			if ( !$wrap.is(':visible') )  {
7305				return;
7306			}
7307			var ease = 'none';
7308			wCont = $cont.outerWidth();
7309			hCont = $cont.outerHeight();
7310
7311			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
7312				xEnd = vertical ? hCont : wCont,
7313				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7314				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
7315				speedSlow = (xEnd + xStrt) / 45,
7316				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery
7317
7318			marqueeTL = new TimelineMax({paused:true, reversed:true});
7319
7320			if ( isInViewport && !isHover && !freezed ) {
7321				marqueeTL.play();
7322
7323				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
7324					var $column = $wrap.closest('.wpb_column'),
7325						$col_link = $('.col-link', $column),
7326						$hover_sel = $wrap;
7327
7328					if ( $col_link.length ) {
7329						$hover_sel = $wrap.add($column);
7330					}
7331
7332					$hover_sel.on('mouseover', function(){
7333						if ( $wrap.attr('data-hover') === 'yes' ) {
7334							//speed = ( 10 - dataSpeed ) * 5;
7335							ease = 'power2.out';
7336							marqueeTL.duration( speedSlow );
7337						} else {
7338							marqueeTL.pause();
7339						}
7340						isHover = true;
7341					}).on('mouseout', function(){
7342						if ( $wrap.attr('data-hover') === 'yes' ) {
7343							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
7344							ease = 'power2.in';
7345							marqueeTL.duration( speed );
7346						} else {
7347							marqueeTL.play();
7348						}
7349						isHover = false;
7350					});
7351				}
7352
7353			}
7354	
7355			gsap.killTweensOf($wrap);
7356			if ( vertical ) {
7357				marqueeTL.fromTo( $wrap, {
7358					y: xStrt * direction
7359				},
7360				{
7361					duration: speed,
7362					y: xEnd * direction * -1,
7363					onComplete: function(){
7364						continuousLinearMarquee();
7365					},
7366					ease: ease,
7367					paused: freezed
7368				});
7369			} else {
7370				marqueeTL.fromTo( $wrap, {
7371					x: xStrt * direction
7372				},
7373				{
7374					duration: speed,
7375					x: xEnd * direction * -1,
7376					onComplete: function(){
7377						continuousLinearMarquee();
7378					},
7379					ease: ease,
7380					paused: freezed
7381				});
7382			}
7383		};
7384
7385		var dragLinearContinuous = function(){
7386			if ( !$wrap.is(':visible') )  {
7387				return;
7388			}
7389			var matrix, _x, _y;
7390			Draggable.create($wrap[0], {
7391				type: vertical ? "y" : "x",
7392				bounds: document.getElementById("container"),
7393				inertia: false,
7394				onPress: function (e) {
7395				},
7396				onRelease: function (e) {
7397					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7398					_x = matrix[12] || matrix[4];
7399					_y = matrix[13] || matrix[5];
7400					if ( vertical ) {
7401						continuousLinearMarquee(_y * -1);
7402					} else {
7403						continuousLinearMarquee(_x * -1);
7404					}
7405					$wrap.removeClass('linear-dragging');
7406				},
7407				onDrag: function (e) {
7408					$wrap.addClass('linear-dragging');
7409				},
7410				onDragEnd: function (e) {
7411					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7412					_x = matrix[12] || matrix[4];
7413					_y = matrix[13] || matrix[5];
7414					wCont = $cont.outerWidth();
7415					hCont = $cont.outerHeight();
7416					if ( vertical ) {
7417						if ( Math.abs(_y) > hCont ) {
7418							if ( _y < 0 ) {
7419								_y = hCont + parseFloat( _y );
7420							} else {
7421								_y = parseFloat( _y ) - hCont;
7422							}
7423						}
7424						continuousLinearMarquee(_y * -1);
7425					} else {
7426						if ( Math.abs(_x) > wCont ) {
7427							if ( _x < 0 ) {
7428								_x = wCont + parseFloat( _x );
7429							} else {
7430								_x = parseFloat( _x ) - wCont;
7431							}
7432						}
7433						continuousLinearMarquee(_x * -1);
7434					}
7435					$wrap.removeClass('linear-dragging');
7436				},
7437			});
7438		};
7439
7440		var runScrollLinear = function(){
7441			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7442			if ( !$wrap.is(':visible') || freezed )  {
7443				return;
7444			}
7445			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7446				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
7447			
7448			var linearGridScroll = function(){
7449				if ( isInViewport ) {
7450					var bound = _row.getBoundingClientRect();
7451
7452					var bound_top = bound.top,
7453						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
7454
7455					if ( vertical ) {
7456						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7457					} else {
7458						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7459					}
7460					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7461						requestAnimationFrame(linearGridScroll);
7462					}
7463				}
7464				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
7465					window.addEventListener("scroll", linearGridScroll);
7466				}
7467			};
7468
7469			$(window).on( 'load wwResize', function(e) {
7470				stableHeight = UNCODE.wheight;
7471				linearGridScroll();
7472			});
7473			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7474				requestAnimationFrame(linearGridScroll);
7475			}
7476		};
7477		
7478		var dragLinear = function(){
7479			if ( !$wrap.is(':visible') )  {
7480				return;
7481			}
7482			var matrix, _x, _y;
7483			Draggable.create($system[0], {
7484				type: vertical ? "y" : "x",
7485				bounds: document.getElementById("container"),
7486				inertia: false,
7487				onPress: function (e) {
7488				},
7489				onRelease: function (e) {
7490				},
7491				onDrag: function (e) {
7492					$wrap.addClass('linear-dragging');
7493				},
7494				onDragEnd: function (e) {
7495					matrix = $system.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7496					_x = matrix[12] || matrix[4];
7497					_y = matrix[13] || matrix[5];
7498					wCont = $cont.outerWidth();
7499					hCont = $cont.outerHeight();
7500					if ( vertical ) {
7501						if ( Math.abs(_y) > hCont ) {
7502							if ( _y < 0 ) {
7503								_y = hCont + parseFloat( _y );
7504							} else {
7505								_y = parseFloat( _y ) - hCont;
7506							}
7507							gsap.to( $system[0], {
7508								duration: 0,
7509								y: _y,
7510							});
7511						}
7512					} else {
7513						if ( Math.abs(_x) > wCont ) {
7514							if ( _x < 0 ) {
7515								_x = wCont + parseFloat( _x );
7516							} else {
7517								_x = parseFloat( _x ) - wCont;
7518							}
7519							gsap.to( $system[0], {
7520								duration: 0,
7521								x: _x,
7522							});
7523						}
7524					}
7525					$wrap.removeClass('linear-dragging');
7526				},
7527			});
7528		};
7529
7530		if ( ! $('body').hasClass('compose-mode') ) {
7531			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
7532				continuousLinearMarquee();
7533				$(window).on( 'wwResize', function(e) {
7534					continuousLinearMarquee();
7535				});	
7536				if ( $wrap.attr('data-draggable') === 'yes' ) {
7537					dragLinearContinuous();
7538				}
7539			}
7540
7541			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7542				runScrollLinear();
7543				if ( $wrap.attr('data-draggable') === 'yes' ) {
7544					dragLinear();
7545				}
7546			}
7547
7548			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7549				var observer = new IntersectionObserver(function(entries) {
7550						
7551					entries.forEach(function(entry){
7552						if ( entry.isIntersecting ) {
7553						isInViewport = true;
7554						if ( typeof marqueeTL !== 'undefined' ) {
7555							marqueeTL.play();
7556						}
7557						if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7558							requestAnimFrame(runScrollLinear);
7559						}
7560					} else {
7561						isInViewport = false;
7562						if ( typeof marqueeTL !== 'undefined' ) {
7563							marqueeTL.pause();
7564						}
7565					}
7566					});
7567				}, { 
7568					root: document,
7569				});
7570
7571				observer.observe(_row);
7572
7573			} else {
7574
7575				var checkVisible = function( el, off ) {
7576					if (typeof jQuery === "function" && el instanceof jQuery) {
7577						el = el[0];
7578					}
7579			
7580					off = typeof off=='undefined' ? 50 : off;
7581			
7582					var rect = el.getBoundingClientRect();
7583			
7584					return (
7585						(
7586							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7587							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7588							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7589						)
7590					);
7591				};
7592				
7593				var checkVisibility = function(){
7594
7595					if ( checkVisible($row) ) {
7596						isInViewport = true;
7597						if ( typeof marqueeTL !== 'undefined' ) {
7598							marqueeTL.play();
7599						}
7600					} else {
7601						isInViewport = false;
7602						if ( typeof marqueeTL !== 'undefined' ) {
7603							marqueeTL.pause();
7604						}
7605					}
7606				}
7607
7608				window.addEventListener("scroll", checkVisibility);
7609
7610			}
7611		}
7612	});
7613};
7614UNCODE.preventDoubleTransition = function() {
7615	$('.sticky-element .animate_when_almost_visible').each(function(){
7616		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
7617			$el.addClass('do_not_reanimate');
7618		});
7619	});
7620};
7621
7622UNCODE.checkScrollForTabs = function(){
7623	var goToSection = window.location.hash.replace('#', ''),
7624		$index;
7625
7626	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
7627	goToSection = encodeURIComponent(goToSection);
7628	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
7629
7630	$index.attr('data-parent', 'parent-' + goToSection);
7631
7632	if (window.location.hash != undefined && window.location.hash != '') {
7633		requestTimeout(function() {
7634			scrollBody('parent-' + goToSection);
7635		}, 500);
7636	}
7637
7638	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
7639		var hash = (e.currentTarget).hash,
7640			index = (e.currentTarget).closest('.uncode-tabs');
7641		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
7642			$('a[href="' + hash + '"][data-tab-history]').click();
7643			scrollBody(index);
7644		}
7645	});
7646
7647	var scrollBody = function(index) {
7648
7649		var getSection = $('a[href="' + index + '"][data-tab-history]'),
7650			scrollTo,
7651			safeGap = 27;
7652
7653		if ( ! getSection.length ) {
7654			getSection = $('div[data-parent="' + index + '"]');
7655
7656			if ( getSection.attr('data-target') == 'row' ) {
7657				getSection = getSection.closest('.vc_row');
7658				safeGap = 0;
7659			}
7660		}
7661
7662		if (typeof getSection === 'undefined' || ! getSection.length ) {
7663			return;
7664		}
7665
7666		var body = $("html, body"),
7667		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7668		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
7669		getOffset = UNCODE.get_scroll_offset();
7670		if ( typeof getSection.offset() === 'undefined' )
7671			return;
7672		scrollTo = getSection.offset().top - safeGap;
7673		scrollTo -= getOffset;
7674
7675		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7676		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7677
7678		if (index != 0) {
7679			UNCODE.scrolling = true;
7680		}
7681
7682		if (scrollSpeed == 0) {
7683			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
7684			UNCODE.scrolling = false;
7685		} else {
7686			body.animate({
7687				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
7688			}, scrollSpeed, 'easeInOutQuad', function() {
7689				requestTimeout(function() {
7690					UNCODE.scrolling = false;
7691					if (getOffset != UNCODE.get_scroll_offset()) {
7692						scrollBody(index);
7693					}
7694				}, 100);
7695			});
7696		}
7697
7698	};
7699};
7700
7701UNCODE.printScreen = function() {
7702	var inlineMediaStyle = null,
7703		setResize;
7704
7705    function changeMediaStyle() {
7706		clearRequestTimeout(setResize);
7707		setResize = requestTimeout(function(){
7708	        var $head = document.getElementsByTagName('head')[0],
7709	        	$newStyle = document.createElement('style'),
7710	        	winW = window.innerWidth,
7711	        	printH = window.innerHeight;
7712
7713	        $newStyle.setAttribute('type', 'text/css');
7714	        $newStyle.setAttribute('media', 'print');
7715	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
7716
7717	        if (inlineMediaStyle != null) {
7718	            $head.replaceChild($newStyle, inlineMediaStyle)
7719	        } else {
7720	            $head.appendChild($newStyle);
7721	        }
7722	        inlineMediaStyle = $newStyle;
7723	    }, 1000);
7724    }
7725
7726    changeMediaStyle();
7727    window.addEventListener('resize', changeMediaStyle);
7728};
7729
7730UNCODE.fullPage = function() {
7731	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
7732		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
7733		return false;
7734	} else {
7735		requestTimeout(function() {
7736			window.scrollTo(0, 0);
7737		}, 10);
7738	}
7739
7740	var $masthead = $('#masthead'),
7741		$logo = $('#logo-container-mobile'),
7742		$logolink = $('[data-minheight]', $logo),
7743		logoMinScale = $logolink.data('minheight'),
7744		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
7745		$container = $('.main-container .post-content'),
7746		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
7747		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
7748		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
7749		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
7750		headerWithOpacity = $('.header-scroll-opacity', $header).length,
7751		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
7752		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
7753		scrollBar = true,
7754		effect,
7755		animationEndTimeOut,
7756		fp_anim_time = 900,
7757		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
7758		is_scrolling = false,
7759		dataNames = [],
7760		is_first = true,
7761		no_history = $('body').hasClass('uncode-scroll-no-history'),
7762		theres_footer = true;
7763
7764	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
7765		$('> div', $footer).each(function(index, el){
7766			if ( $(el).outerHeight() < 2 )
7767				theres_footer = false;
7768			else
7769				theres_footer = true;
7770		});
7771	}
7772
7773	if ( !$footer.length )
7774		theres_footer = false;
7775
7776	if ( !UNCODE.isFullPageSnap ) {
7777
7778		if ( $('body').hasClass('uncode-fullpage-zoom') )
7779			effect = 'scaleDown';
7780		else if ( $('body').hasClass('uncode-fullpage-parallax') )
7781			effect = 'moveparallax';
7782		else
7783			effect = 'movecurtain';
7784	}
7785
7786	if ( $('body').hasClass('uncode-fullpage-trid') )
7787		fp_anim_time = fp_anim_time*2;
7788
7789	if ( $header.length ) {
7790		if ( headerName !== '' )
7791			$header.attr('data-name', headerName);
7792		if ( headerLabel !== '' )
7793			$header.attr('data-label', headerLabel);
7794		$container.prepend($header);
7795	}
7796	if ( theres_footer ) {
7797		$container.append($footer);
7798		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
7799		$('aside.widget ul', $footer).addClass('no-list');
7800	}
7801
7802	var $all = $rows.add($header);
7803
7804	if ( theres_footer )
7805		$all = $all.add($footer);
7806
7807	$all.each(function(index, row) {
7808		if( index === 0 )
7809			$(row).addClass('uncode-scroll-active');
7810	});
7811
7812    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
7813
7814	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
7815		$("<ul class='onepage-pagination'></ul>").prependTo("body");
7816	}
7817
7818	$all.each(function(index, val) {
7819		var getName = $(val).data('name'),
7820			label;
7821
7822		if (typeof getName == 'undefined' || getName == 'undefined')
7823			getName = SiteParameters.slide_name + '-' + index;
7824
7825		//if ( dataNames.includes(getName) ) {
7826		if ( dataNames.indexOf(getName) > 0 ) {
7827			getName += '_' + index;
7828			$(val).data('name', getName);
7829		}
7830
7831		dataNames.push(getName);
7832
7833		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
7834
7835		if (typeof $(val).attr('data-label') !== 'undefined')
7836			label = $(val).attr('data-label');
7837		else label = '';
7838
7839		if ( $(val).is($footer) )
7840			return;
7841
7842		if (label != '' ) {
7843			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
7844			$('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
7845		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
7846			$('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span></a></li>");
7847		}
7848	});
7849
7850	var checkVisible = function( el, off ) {
7851		if (typeof jQuery === "function" && el instanceof jQuery) {
7852			el = el[0];
7853		}
7854
7855		off = typeof off=='undefined' ? 50 : off;
7856
7857		var rect = el.getBoundingClientRect();
7858
7859		return (
7860			(
7861				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7862				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7863				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7864			)
7865		);
7866	};
7867
7868	var animationEndAction = function( index, nextIndex ) {
7869		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
7870			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7871			player, iframe;
7872
7873		if ( !$nextSlide.is($footer) ) {
7874			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
7875		}
7876
7877		if ( !UNCODE.isFullPageSnap ) {
7878			activateKBurns( nextIndex );
7879		}
7880
7881		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
7882			if ($(this).attr('data-provider') == 'vimeo') {
7883				iframe = $(this).find('iframe');
7884				player = new Vimeo.Player(iframe[0]);
7885				player.pause();
7886			} else if ($(this).attr('data-provider') == 'youtube') {
7887				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
7888			} else {
7889				if ($(this).is('video')) {
7890					$(this)[0].volume = 0;
7891					$(this)[0].pause();
7892				}
7893			}
7894		});
7895
7896		if ( ! UNCODE.isMobile && headerWithOpacity ) {
7897			if ( $nextSlide.is($header) )
7898				$header.removeClass('header-scrolled');
7899		}
7900
7901		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
7902		$otherEl.each(function(){
7903			var $otherThis = $(this),
7904				$bgwrapperOther = $('.background-inner', $otherThis);
7905			if ( !checkVisible($otherThis) )
7906				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
7907
7908		});
7909
7910		if ( !checkVisible($currentSlide) ) {
7911			$currentSlide.removeClass('uncode-scroll-visible');
7912			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
7913			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
7914				currentScroll.scrollTo(0, 0, 0);
7915		}
7916
7917		clearRequestTimeout(animationEndTimeOut);
7918		animationEndTimeOut = requestTimeout(function(){
7919			Waypoint.refreshAll();
7920			$( document.body ).trigger('uncode_waypoints');
7921			var eventFP = new CustomEvent('fp-slide-changed');
7922			window.dispatchEvent(eventFP);
7923			is_scrolling = false;
7924
7925			if ( is_first ) {
7926				$('ul.onepage-pagination a').removeClass('is-selected');
7927				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
7928				is_first = false;
7929			}
7930
7931		}, 500);
7932	};
7933
7934	var postLeaveActions = function( nextIndex ){
7935		if ( menuHidden && ! UNCODE.isMobile )
7936			return false;
7937
7938		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7939			$cols = $('.uncol', $el),
7940			anchor = $el.data('anchor');
7941
7942		if ( ! UNCODE.isFullPageSnap ) {
7943			$.each($cols, function(index, val){
7944				if ( $(val).hasClass('style-light') ){
7945					$masthead.removeClass('style-dark-override').addClass('style-light-override');
7946					return false;
7947				} else if ( $(val).hasClass('style-dark') ) {
7948					$masthead.removeClass('style-light-override').addClass('style-dark-override');
7949					return false;
7950				}
7951			});
7952		}
7953
7954		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
7955			$('.menu-item' ).removeClass('active');
7956			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
7957		}
7958
7959		if ( !UNCODE.isFullPageSnap ) {
7960			activateBackWash( nextIndex );
7961		}
7962	};
7963
7964	var activateBackWash = function( nextIndex ){
7965		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7966			$bgwrapper;
7967
7968		if ( $el.length ) {
7969			if ( $el.hasClass('with-zoomout') ) {
7970				$bgwrapper = $('.background-inner:nth-child(1)', $el);
7971			} else if ( $('.with-zoomout', $el).length ) {
7972				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
7973			} else {
7974				return false;
7975			}
7976		} else {
7977			return false;
7978		}
7979
7980		$bgwrapper.addClass('uncode-zoomout');
7981
7982	};
7983
7984	var activateKBurns = function( nextIndex ){
7985		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7986			$bgwrapper;
7987
7988		if ( $el.length ) {
7989			if ( $el.hasClass('with-kburns') ) {
7990				$bgwrapper = $('.background-inner:nth-child(1)', $el);
7991			} else if ( $('.with-kburns', $el).length ) {
7992				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
7993			} else {
7994				return false;
7995			}
7996		} else {
7997			return false;
7998		}
7999
8000		$bgwrapper.addClass('uncode-kburns');
8001
8002	};
8003
8004	var activateParallax = function( nextIndex, direction ){
8005
8006		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8007			$cell = $('.fp-tableCell', $el),
8008			animationEnd = 'webkitAnimationEnd animationend',
8009			cellAnim;
8010
8011		switch( direction ) {
8012			case 'up':
8013				cellAnim = 'moveFromTopInner';
8014				break;
8015			default:
8016				cellAnim = 'moveFromBottomInner';
8017		}
8018
8019		$cell.css({
8020			'animation-name': cellAnim,
8021			'animation-duration': fp_anim_time + 'ms',
8022			'animation-delay': '',
8023			'animation-timing-function': fp_easing,
8024			'animation-fill-mode': 'both',
8025		}).off(animationEnd)
8026		.on(animationEnd, function(event) {
8027			if ( event.originalEvent.animationName === cellAnim ) {
8028				$cell
8029					.css({
8030						'animation-name': '',
8031						'animation-duration': '',
8032						'animation-delay': '',
8033						'animation-timing-function': '',
8034						'animation-fill-mode': '',
8035					});
8036			}
8037		});
8038	};
8039
8040	var scrollHashes = function(){
8041		var hash = window.location.hash.replace('#', '').split('/'),
8042			hashInd;
8043		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
8044			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
8045				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
8046				$.fn.fullpage.moveTo(hashInd+1);
8047			}
8048		} else if( hash[0] === '' ) {
8049			$.fn.fullpage.moveTo(1);
8050		}
8051	};
8052
8053	var hideMenu = function( index, nextIndex ){
8054		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
8055			return false;
8056
8057		var hMenu = UNCODE.menuHeight,
8058			transTime = hMenu * 2;
8059
8060		if ( index === 1 && nextIndex > 1 ) {
8061			hMenu = hMenu * -1;
8062		} else if  ( index !== 1 && nextIndex === 1 ) {
8063			hMenu = 0;
8064		} else {
8065			return false;
8066		}
8067
8068		$masthead.css({
8069			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8070			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8071			'-webkit-transition': 'transform 0.5s ease-in-out',
8072			'transition': 'transform 0.5s ease-in-out'
8073		});
8074	};
8075
8076	var shrinkMenu = function( index, nextIndex ){
8077		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
8078			return false;
8079
8080		if ( index === 1 && nextIndex > 1 ) {
8081			$logo.addClass('shrinked');
8082			$('div', $logo).each(function(index, val){
8083				$(val).css({
8084					'height': logoMinScale,
8085					'line-height': logoMinScale
8086				});
8087				if ($(val).hasClass('text-logo')) {
8088					$(val).css({
8089						'font-size': logoMinScale + 'px'
8090					});
8091				}
8092			});
8093			requestTimeout(function() {
8094				UNCODE.menuMobileHeight = $masthead.outerHeight();
8095			}, 300);
8096		} else if ( index !== 1 && nextIndex === 1 ) {
8097			$logo.removeClass('shrinked');
8098			$('div', $logo).each(function(index, val){
8099				$(val).css({
8100					'height': logoMaxScale,
8101					'line-height': logoMaxScale
8102				});
8103				if ($(val).hasClass('text-logo')) {
8104					$(val).css({
8105						'font-size': logoMaxScale + 'px'
8106					});
8107				}
8108			});
8109			requestTimeout(function() {
8110				UNCODE.menuMobileHeight = $masthead.outerHeight();
8111			}, 300);
8112		} else {
8113			return false;
8114		}
8115
8116	};
8117
8118	var anchorLink = function(){
8119
8120		$container.add('.menu-item').find('a[href*="#"]').click(function(e) {
8121			var $this = $(e.currentTarget),
8122				hash = e.currentTarget.href.split('#'),
8123				current = window.location.href.split('#'),
8124				ind,
8125				currentMenuOpened = UNCODE.menuOpened,
8126				go = false;
8127
8128			var hash_url = hash[0].replace(/\/?$/, '/'),
8129				current_url = current[0].replace(/\/?$/, '/');
8130
8131			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
8132				hash = '#'+hash[1];
8133				e.preventDefault();
8134				go = true;
8135			}
8136
8137			if ( go ) {
8138
8139				if ( $(hash).length ) {
8140					ind = $(hash).closest('.fp-section').index();
8141				} else {
8142					hash = hash.slice(1);
8143					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
8144				}
8145
8146				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
8147					ind = $this.closest('.fp-section').index();
8148
8149				UNCODE.menuOpened = false;
8150
8151				$.fn.fullpage.moveTo(ind+1);
8152
8153				UNCODE.menuOpened = currentMenuOpened;
8154				if (UNCODE.menuOpened) {
8155					if (UNCODE.wwidth < UNCODE.mediaQuery) {
8156						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
8157					} else {
8158						$('.mmb-container-overlay .overlay-close').trigger('click');
8159						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
8160					}
8161				}
8162
8163			}
8164
8165		});
8166
8167		$('.header-scrolldown').on('click', function(event) {
8168			event.preventDefault();
8169			var scrollDown = $(this),
8170				ind = scrollDown.closest('.fp-section').index();
8171
8172			$.fn.fullpage.moveTo(ind+2);
8173		});
8174
8175		var anchor = $('.fp-section.active').data('anchor');
8176
8177		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
8178			$('.menu-item').removeClass('active');
8179			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8180		}
8181
8182	};
8183
8184	var slideLeave = function( index, nextIndex, direction ) {
8185		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8186			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8187			animationEnd = 'webkitAnimationEnd animationend',
8188			transitionEnd = 'webkitTransitionEnd transitionend',
8189			animOut = effect != 'scaleDown' ? effect + direction : effect,
8190			animIn,
8191			isFooter = false,
8192			isFooterNext = false,
8193			footerH = $footer.outerHeight(),
8194			timeout,
8195			player, iframe,
8196			footerCoeff;
8197		switch( direction ) {
8198			case 'up':
8199				animIn = 'moveFromTop';
8200				break;
8201			default:
8202				animIn = 'moveFromBottom';
8203		}
8204
8205		if ( $('body').hasClass('uncode-fullpage-trid') ) {
8206			animOut = animIn + 'trid';
8207			animIn = animOut + 'In';
8208		} else if ( UNCODE.isFullPageSnap ) {
8209			animIn = animOut = 'none';
8210		}
8211
8212		hideMenu(index, nextIndex);
8213		shrinkMenu(index, nextIndex);
8214
8215		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8216			if ($(this).attr('data-provider') == 'vimeo') {
8217				iframe = $(this).find('iframe');
8218				player = new Vimeo.Player(iframe[0]);
8219				player.pause();
8220			} else if ($(this).attr('data-provider') == 'youtube') {
8221				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8222			} else {
8223				if ($(this).is('video')) {
8224					$(this)[0].volume = 0;
8225					$(this)[0].pause();
8226				}
8227			}
8228		});
8229
8230		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
8231			if ($(this).attr('data-provider') == 'vimeo') {
8232				iframe = $(this).find('iframe');
8233				iframe.on('load', function(){
8234					player = new Vimeo.Player(iframe);
8235					player.setVolume(0);
8236					player.play();
8237				});
8238				player = new Vimeo.Player(iframe);
8239				player.setVolume(0);
8240				player.play();
8241			} else if ($(this).attr('data-provider') == 'youtube') {
8242				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
8243			} else {
8244				if ($(this).is('video')) {
8245					$(this)[0].volume = 0;
8246					$(this)[0].play();
8247				}
8248			}
8249		});
8250
8251		if ( $currentSlide.is($footer) )
8252			isFooter = true;
8253
8254		if ( $nextSlide.is($footer) )
8255			isFooterNext = true;
8256
8257		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8258			if ( $currentSlide.is($header) )
8259				$header.addClass('header-scrolled');
8260		}
8261
8262		footerCoeff = footerH;
8263
8264		if ( UNCODE.isFullPageSnap ) {
8265			postLeaveActions( nextIndex );
8266			activateBackWash( nextIndex );
8267			activateKBurns( nextIndex );
8268			requestTimeout(function(){
8269				animationEndAction( index, nextIndex );
8270			}, fp_anim_time+150);
8271		} else {
8272			if ( isFooterNext ) {
8273
8274				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
8275				$iscrollWrapper.addClass('no-scrolloverflow');
8276
8277				$nextSlide
8278				.add($currentSlide)
8279				.addClass('uncode-scroll-front')
8280				.addClass('uncode-scroll-active')
8281				.addClass('uncode-scroll-visible');
8282				$container.css({
8283					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8284					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8285					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8286					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8287				}).off(transitionEnd)
8288				.one(transitionEnd, function(){
8289					animationEndAction( index, nextIndex );
8290				});
8291
8292			} else if ( isFooter ) {
8293
8294				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
8295				.add($currentSlide)
8296				.addClass('uncode-scroll-front')
8297				.addClass('uncode-scroll-active')
8298				.addClass('uncode-scroll-visible');
8299				$container.css({
8300					'-webkit-transform': 'translate3d(0, 0, 0)',
8301					'transform': 'translate3d(0, 0, 0)',
8302					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8303					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8304				})
8305				.one(transitionEnd, function(){
8306					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
8307						clearRequestTimeout(timeout);
8308						timeout = requestTimeout(function(){
8309							$.fn.fullpage.moveTo(nextIndex);
8310							slideLeave( index-1, nextIndex, 'up' );
8311							$container.off(transitionEnd);
8312						}, 50);
8313					}
8314					animationEndAction( index, nextIndex );
8315				});
8316
8317			} else {
8318
8319				postLeaveActions( nextIndex );
8320
8321				if ( !$('body').hasClass('uncode-fullpage-trid') )
8322					activateParallax( nextIndex, direction );
8323
8324				var $outBg = $('.background-wrapper', $currentSlide);
8325
8326				$nextSlide
8327				.addClass('uncode-scroll-front')
8328				.addClass('uncode-scroll-active')
8329				.addClass('uncode-scroll-visible')
8330				.addClass('uncode-scroll-animating-in')
8331				.css({
8332					'z-index':4,
8333					'animation-name': animIn,
8334					'animation-duration': fp_anim_time + 'ms',
8335					'animation-delay': '',
8336					'animation-timing-function': fp_easing,
8337					'animation-fill-mode': 'both',
8338					'transition': 'initial',
8339				}).off(animationEnd)
8340				.on(animationEnd, function(event) {
8341					if ( event.originalEvent.animationName === animIn ) {
8342						$(this)
8343							.addClass('uncode-scroll-already')
8344							.removeClass('uncode-scroll-front')
8345							.removeClass('uncode-scroll-animating-in')
8346							.css({
8347								'animation-name': '',
8348								'animation-duration': '',
8349								'animation-delay': '',
8350								'animation-timing-function': '',
8351								'animation-fill-mode': '',
8352								'transition': 'initial',
8353							});
8354
8355						$currentSlide
8356							.removeClass('uncode-scroll-active')
8357							.add($outBg)
8358							.css({
8359								'animation-name': '',
8360								'animation-duration': '',
8361								'animation-delay': '',
8362								'animation-timing-function': '',
8363								'animation-fill-mode': '',
8364								'transition': 'initial',
8365							});
8366
8367						animationEndAction( index, nextIndex );
8368
8369					}
8370
8371					if ( nextIndex > 1 )
8372						$('body').addClass('window-scrolled');
8373					else
8374						$('body').removeClass('window-scrolled');
8375				});
8376
8377				$currentSlide
8378					.addClass('uncode-scroll-animating-out')
8379					.removeClass('uncode-scroll-front')
8380					.css({
8381						'z-index':'1',
8382						'animation-name': animOut,
8383						'animation-duration': fp_anim_time + 'ms',
8384						'animation-delay': '',
8385						'animation-timing-function': fp_easing,
8386						'animation-fill-mode': 'both',
8387						'transition': 'initial',
8388						'will-change': 'auto'
8389					}).off(animationEnd)
8390					.on(animationEnd, function(event) {
8391						if ( event.originalEvent.animationName === animOut ) {
8392							$currentSlide.removeClass('uncode-scroll-animating-out');
8393						}
8394					});
8395
8396				if ( $('body').hasClass('uncode-fp-opacity') ) {
8397					$currentSlide.find('> div').css({
8398						'animation-name': 'opacityout',
8399						'animation-duration': fp_anim_time + 'ms',
8400						'animation-delay': '',
8401						'animation-timing-function': fp_easing,
8402						'animation-fill-mode': 'both',
8403						'transition': 'initial',
8404					}).off(animationEnd)
8405					.on(animationEnd, function(event) {
8406						if ( event.originalEvent.animationName === 'opacityout' ) {
8407							$(event.currentTarget).css({
8408								'animation-name': '',
8409								'animation-duration': '',
8410								'animation-delay': '',
8411								'animation-timing-function': '',
8412								'animation-fill-mode': '',
8413								'transition': '',
8414							});
8415						}
8416					});
8417				}
8418			}
8419		}
8420
8421		$('.scroll-top').on('click', function(e){
8422			$.fn.fullpage.moveTo(1);
8423			return false;
8424		});
8425
8426	};
8427
8428	var init_fullPage = function(mode){
8429
8430		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
8431		// 	scrollBar = false;
8432		// }
8433
8434		var checkFPeffects;
8435
8436		$container.fullpage({
8437			sectionSelector: '.uncode-scroll-lock',
8438			scrollOverflow: true,
8439			scrollOverflowOptions: {
8440				click: false,
8441				preventDefaultException: { tagName:/.*/ }
8442			},
8443			navigation: false,
8444			scrollBar: scrollBar,
8445			scrollingSpeed: fp_anim_time,
8446			verticalCentered: true,
8447			anchors: no_history ? false : dataNames,
8448			recordHistory: !no_history,
8449			afterRender: function(){
8450				$('body').removeClass('fp-waiting');
8451				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
8452					var $invisible = $(this).addClass('hidden-scroll');//,
8453				});
8454				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
8455					var $visible = $(this).addClass('uncode-scroll-visible'),
8456						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
8457					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
8458				});
8459
8460				$('ul.onepage-pagination a').on('click', function(e){
8461					e.preventDefault();
8462					var $a = $(this),
8463						toIndex = $a.data('index');
8464
8465					$.fn.fullpage.moveTo(toIndex+1);
8466				});
8467
8468				requestTimeout(function(){
8469					scrollHashes();
8470				}, 1000);
8471
8472				$(window).on('hashchange', function(e){
8473					requestTimeout(function(){
8474						scrollHashes();
8475					}, 500);
8476				});
8477
8478				anchorLink();
8479
8480				if ( $('body').hasClass('uncode-fp-opacity') ) {
8481					$all.each(function(index, row) {
8482						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
8483							classBg;
8484
8485						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
8486							classBg = testmatch[0];
8487							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
8488						}
8489					});
8490				}
8491
8492				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
8493					$(window).on('menuOpen gdprOpen', function(){
8494						$.fn.fullpage.setAutoScrolling(false);
8495					}).on('menuClose gdprClose', function(){
8496						$.fn.fullpage.setAutoScrolling(true);
8497					});
8498				}
8499
8500				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
8501					requestTimeout(function(){
8502						$.fn.fullpage.setAutoScrolling(false);
8503					}, 1000);
8504				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
8505					$.fn.fullpage.setAutoScrolling(true);
8506				});
8507
8508				if ( !UNCODE.isFullPageSnap ) {
8509					clearRequestTimeout(checkFPeffects);
8510					checkFPeffects = requestTimeout(function(){
8511						activateBackWash( 1 );
8512						activateKBurns( 1 );
8513					}, 100);
8514				}
8515
8516			},
8517			onLeave: function( index, nextIndex, direction ){
8518
8519				if ( UNCODE.menuOpened || is_scrolling )
8520					return false;
8521
8522				is_scrolling = true;
8523
8524				var event = new CustomEvent('fp-slide-leave');
8525				window.dispatchEvent(event);
8526
8527				slideLeave( index, nextIndex, direction );
8528
8529				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
8530					if ( direction === 'up' ) {
8531						$.fn.fullpage.moveTo(nextIndex-1);
8532					} else {
8533						$.fn.fullpage.moveTo(nextIndex+1);
8534					}
8535					return false;
8536				}
8537
8538				$('ul.onepage-pagination a').removeClass('is-selected');
8539				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8540
8541			}
8542		});
8543	};
8544
8545	init_fullPage();
8546	$(window).on('load', function(){
8547		requestTimeout(function(){
8548			$.fn.fullpage.reBuild();
8549		}, 3000);
8550	});
8551
8552	var addScrollingClass,
8553		removeScrollingClass;
8554
8555	window.addEventListener("fp-slide-scroll", function(){
8556		addScrollingClass = requestTimeout( function(){
8557			$('body').addClass('fp-slide-scrolling');
8558		}, 10 );
8559
8560		clearRequestTimeout(removeScrollingClass);
8561		removeScrollingClass = requestTimeout( function(){
8562			$('body').removeClass('fp-slide-scrolling');
8563		}, 150 );
8564
8565		Waypoint.refreshAll();
8566	}, false);
8567
8568	var setFPheight = function(){
8569		var $body = document.body,
8570			$footer = document.getElementById('colophon'),
8571			$maincontainer = document.querySelector('.main-wrapper'),
8572			$boxcontainer = document.querySelector('.box-container'),
8573			$sections = document.querySelectorAll('.fp-section'),
8574			rect = $maincontainer.getBoundingClientRect(),
8575			rect2 = $boxcontainer.getBoundingClientRect(),
8576			$masthead = document.getElementById('masthead'),
8577			_hideMenu = false,
8578			menuHeight = UNCODE.menuHeight;
8579		$body.style.height = UNCODE.wheight + 'px';
8580
8581		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
8582			_hideMenu = true;
8583		}
8584		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
8585			menuHeight = 0
8586		}
8587
8588
8589		if ( theres_footer )
8590			$footer.style.top = (rect.height || rect2.height) + 'px';
8591
8592		for (var i = 0; i < $sections.length; i++) {
8593			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
8594		}
8595	};
8596
8597	setFPheight();
8598
8599	window.addEventListener('resize', setFPheight, false);
8600	window.addEventListener('orientationchange', setFPheight, false);
8601
8602};
8603
8604UNCODE.particles = function() {
8605	$(".vc-particles-background").each(function() {
8606		var $particle = $(this);
8607		var $parent = $particle.closest('[data-parent]');
8608
8609		$parent.prepend($particle);
8610		// $(window).trigger('resize');
8611	})
8612};
8613
8614
8615UNCODE.readMoreCol = function( $el ){
8616	if ( typeof $el === 'undefined' || $el === null ) {
8617		$el = $('body');
8618	}
8619	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
8620	$readMoreCols.each(function(){
8621		var $uncont = $(this),
8622			$row = $uncont.closest('.row-container'),
8623			max_h = $uncont.attr('data-ov-height'),
8624			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
8625			actual_max_h = $uncont.outerHeight(),
8626			inner_h,
8627			$read_more = $('+ .btn-more-wrap', $uncont),
8628			read_more_resize = $read_more.hasClass('trigger-resize'),
8629			marginClosedBtn = $uncont.attr('data-margin-closed'),
8630			marginClosed = 0,
8631			marginOpenBtn = $uncont.attr('data-margin-open'),
8632			marginOpen = 0,
8633			anim_t = 250,
8634			resized = false;
8635
8636		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
8637
8638		switch (marginClosedBtn) {
8639			case 'sm':
8640				marginClosed = 18
8641				break;
8642				
8643			case 'std':
8644				marginClosed = 36
8645				break;
8646				
8647			case 'lg':
8648				marginClosed = 72
8649				break;
8650				
8651			case '':
8652			default:
8653				marginClosed = 0
8654				break;
8655				
8656		}
8657
8658		switch (marginOpenBtn) {
8659			case 'sm':
8660				marginOpen = 18
8661				break;
8662				
8663			case 'std':
8664				marginOpen = 36
8665				break;
8666				
8667			case 'lg':
8668				marginOpen = 72
8669				break;
8670				
8671			case 'no':
8672				marginOpen = 0
8673				break;
8674				
8675		}
8676
8677		var checkToggleMobile = function(){
8678			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
8679				resized = true;
8680				if ( $read_more.hasClass('state-closed') ) {
8681					$uncont[0].style.height = '';
8682					$uncont[0].style.maxHeight = max_h_mobile;
8683				}
8684			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
8685				if ( $read_more.hasClass('state-closed') ) {
8686					$uncont[0].style.height = '';
8687					$uncont[0].style.maxHeight = max_h;
8688				}
8689				resized = false;
8690			}
8691		}
8692		checkToggleMobile();
8693		$(window).on('resize', function() {
8694			checkToggleMobile();
8695		});
8696
8697		$('a', $read_more).on('click', function(e){
8698			e.preventDefault();
8699
8700			var $a = $(this);
8701
8702			if ( $read_more.hasClass('state-closed') ) {
8703
8704				$read_more
8705					.removeClass('state-closed')
8706					.addClass('state-open');
8707
8708				$uncont.css({
8709					'max-height': 'none',
8710					'height': 'auto',
8711				});
8712	
8713				inner_h = parseFloat( $uncont.outerHeight() );
8714
8715				$uncont.css({
8716					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8717				});
8718		
8719				anim_t = inner_h - actual_max_h;
8720				if ( anim_t < 250 ) {
8721					anim_t = 250;
8722				} else if ( anim_t > 1000 ) {
8723					anim_t = 1000;
8724				}
8725
8726				$uncont.css({
8727					'transition-duration' : anim_t + 'ms'
8728				}).addClass('overflow-mask-animation').animate({
8729					'height': inner_h
8730				}, anim_t, 'easeInOutCubic', function(){
8731					$uncont.css({
8732						'height' : 'auto'
8733					}).removeClass('overflow-mask');
8734					if ( read_more_resize === true ) {
8735						window.dispatchEvent(new Event('resize'));
8736						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8737							ScrollTrigger.refresh(true);
8738						}
8739					}
8740				});
8741
8742				if ( marginOpen != '' ) {
8743					$read_more.animate({
8744						'margin-top' : marginOpen
8745					}, anim_t, 'easeInOutCubic');
8746				}
8747
8748			} else {
8749				$read_more
8750					.removeClass('state-open')
8751					.addClass('state-closed');
8752
8753				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
8754					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8755				}, anim_t, 'easeInOutCubic', function(){
8756					if ( read_more_resize === true ) {
8757						window.dispatchEvent(new Event('resize'));
8758						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8759							ScrollTrigger.refresh(true);
8760						}
8761					}
8762				});
8763
8764				if ( marginClosed !== '' ) {
8765					$read_more.animate({
8766						'margin-top' : marginClosed
8767					}, anim_t, 'easeInOutCubic');
8768				}
8769
8770				if ( $a.hasClass('toggle-scroll') ) {
8771                    var $masthead = $('#masthead > div:first-child'),
8772                        headH = $masthead.outerHeight(),
8773						rectTop = $row[0].getBoundingClientRect().top,
8774						checkNavBar = $a.hasClass('toggle-navbar'),
8775						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
8776                        offCont = ( $row.offset().top );
8777
8778					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
8779						checkNavBar = checkNavBarMobile;
8780					}
8781
8782					if ( checkNavBar ) {
8783						offCont = offCont - headH;
8784					}
8785			
8786					if ( rectTop < headH ) {
8787						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
8788							$(this).stop();
8789						}).animate({
8790							scrollTop: offCont
8791						}, anim_t, 'easeInOutCubic');
8792					}
8793				}
8794
8795			}
8796		});
8797	});
8798}
8799UNCODE.filters = function() {
8800	var $systems = $('.isotope-system, .cssgrid-system');
8801
8802	$systems.each(function(index, val){
8803		var $system = $(this),
8804			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
8805			$widgets = $('.widgetized-cb-wrapper', $system),
8806			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
8807			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
8808			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
8809			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
8810
8811		if ($system.hasClass('isotope-processed')) {
8812			return;
8813		}
8814
8815		$cats_trigger.on('click', function(e) {
8816			if ( ! $('html').hasClass('screen-sm') ) {
8817				// $widgets.add($sorting_dd).slideUp(400);
8818				e.preventDefault();
8819				$widgets.slideUp(400, 'easeInOutCirc');
8820			}
8821		});
8822
8823		$('.filters-toggle-trigger', $system).on('click', function(e) {
8824			e.preventDefault();
8825			var $filters = $('.isotope-filters .menu-horizontal', $system);
8826			$filters.slideToggle(400, 'easeInOutCirc');
8827			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8828		});
8829
8830		$widget_trgr.on('click', function(e) {
8831			e.preventDefault();
8832			$widgets.slideToggle(400, 'easeInOutCirc');
8833			if (!$('html').hasClass('screen-sm')) {
8834				$cats_filters.slideUp(400, 'easeInOutCirc');
8835			}
8836			window.dispatchEvent(new CustomEvent('boxResized'));
8837		});
8838
8839		$sorting_trgr.on('click', function(e) {
8840			e.preventDefault();
8841			if (!$('html').hasClass('screen-sm')) {
8842				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8843			}
8844		});
8845
8846		$system.addClass('isotope-processed');
8847	});
8848
8849};
8850
8851UNCODE.widgets = function() {
8852	var widget_collapses = $('.widget-collapse');
8853
8854	widget_collapses.each(function(){
8855		var widget_collapse = $(this),
8856			widget_title = widget_collapse.find('.widget-title'),
8857			widget = widget_title.closest('.widget'),
8858			content = widget.children().not('.widget-title'),
8859			setCTA;
8860
8861		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
8862			widget_title.toggleClass('open');
8863		}
8864
8865		widget_title.each(function() {
8866			var _this = $(this);
8867			var content = _this.closest('.widget').find('.widget-collapse-content');
8868
8869			$(window).on('load resize', function(){
8870				clearRequestTimeout(setCTA);
8871				setCTA = requestTimeout( function() {
8872					if ( content.is(':visible') ) {
8873						_this.addClass( 'open' );
8874					} else {
8875						_this.removeClass( 'open' );
8876					}
8877				}, 10 );
8878			})
8879
8880			_this.on( 'click', function(){
8881
8882				// Get content of :after element (+ icon) to check the visibility
8883				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
8884
8885				if (icon_content === 'none' || !icon_content) {
8886					return false;
8887				}
8888
8889				_this.toggleClass('open');
8890				var isOpen = _this.hasClass('open'),
8891					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
8892				content.animate({
8893					height: 'toggle',
8894					padding: 'toggle',
8895					opacity: 'toggle',
8896					top: isOpen ? 0 : hasBorder
8897				}, {
8898					duration: 400,
8899					easing: "easeInOutCirc",
8900				});
8901
8902				return false;
8903
8904			});
8905		});
8906	});
8907
8908	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
8909};
8910
8911UNCODE.unmodal = function() {
8912	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
8913		$('.unmodal-overlay').fadeIn();
8914		$('.unmodal-overlay').addClass('loading');
8915		$('body').addClass('uncode-unmodal-overlay-visible');
8916		$(window).trigger('unmodal-open');
8917	});
8918
8919	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
8920		$('.unmodal-overlay').fadeOut();
8921		$('.unmodal').fadeOut();
8922		$('body').removeClass('uncode-unmodal-overlay-visible');
8923		$('body').removeClass('uncode-unmodal-open');
8924		$('html').removeClass('uncode-unmodal-body-disable-scroll');
8925		$(document).trigger('unmodal-close');
8926		UNCODE.isUnmodalOpen = false;
8927	});
8928
8929	$(document).on('uncode-unmodal-show-content', function() {
8930		$('.unmodal-overlay').removeClass('loading');
8931		$('.unmodal').show();
8932		$('.unmodal').addClass('show-unmodal-with-animation');
8933		$('.unmodal-content')[0].scrollTop = 0;
8934		$('body').addClass('uncode-unmodal-open');
8935		UNCODE.isUnmodalOpen = true;
8936
8937		if ($('body').hasClass('qw-body-scroll-disabled')) {
8938			$('html').addClass('uncode-unmodal-body-disable-scroll');
8939		}
8940
8941		if ($('.unmodal').hasClass('auto-height')) {
8942			set_modal_height();
8943		}
8944	});
8945
8946	var set_modal_height = function() {
8947		var modal = $('.unmodal').css({height: 'auto'});
8948		var window_height = $(window).outerHeight();
8949		var modal_height = modal.outerHeight();
8950
8951		modal.css('height', 'auto');
8952
8953		if (modal_height > window_height) {
8954			modal.outerHeight(window_height);
8955		}
8956	}
8957
8958	if ($('.unmodal').hasClass('auto-height')) {
8959		var setCTA;
8960
8961		$(window).on('resize', function() {
8962			clearRequestTimeout(setCTA);
8963			setCTA = requestTimeout(function() {
8964				set_modal_height();
8965			}, 100);
8966		});
8967	}
8968};
8969
8970UNCODE.bgChanger = function() {
8971	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
8972		$bg_first = $('.vc_row[data-bg-remove]'),
8973		bg_remove = $bg_first.attr('data-bg-remove'),
8974		$first = $bg_changers.first(),
8975		$last = $bg_changers.last(),
8976		$bg_wrapper = $('#changer-back-color'),
8977		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
8978		setCTA, localH = UNCODE.wheight,
8979		isScrolling;
8980
8981	$bg_first.removeClass(bg_remove);
8982
8983	var bgChange = function($col, bgColor, skin, tmbskin){
8984		$bg_wrapper.attr( 'class', bgColor );
8985		var menuskin;
8986		if ( typeof skin !== 'undefined' ) {
8987			menuskin = skin.replace('style', 'menu')
8988		}
8989
8990		if ( $col.length ) {
8991			$('.uncol[data-skin-change]').each(function(){
8992				var $isoFooter = $('.isotope-footer', this);
8993				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
8994				if ( menuskin !== '' ) {
8995					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
8996				}
8997			});
8998
8999			$('.tmb[data-skin-change]').each(function(){
9000				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
9001			});
9002		}
9003	};
9004
9005	var $masthead = $('#masthead'),
9006		transDesktop,
9007		transMobile,
9008		changeSkin,
9009
9010	checkTransparencyAndChange = function( skin ){
9011		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
9012		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
9013		changeSkin = $masthead.hasClass('menu-change-skin');
9014
9015		if ( ! transDesktop && ! transMobile ) {
9016			return false;
9017		}
9018
9019		if ( ! changeSkin ) {
9020			return false;
9021		}
9022
9023		if ( skin === 'style-light' ){
9024			$masthead.removeClass('style-dark-override').addClass('style-light-override');
9025			return false;
9026		} else if ( skin === 'style-dark' ) {
9027			$masthead.removeClass('style-light-override').addClass('style-dark-override');
9028			return false;
9029		}
9030	};
9031
9032	var bg_waypoints = function(){
9033		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
9034
9035			$.each($bg_changers, function(index, row) {
9036
9037				var $row = $(row),
9038					$col = $('.uncol[data-skin-change]', $row).eq(0),
9039					skin,
9040					$tmbs,
9041					tmbskin,
9042					bgColor = $row.attr('data-bg-color');
9043
9044				if ( ! $row.is(':visible') ) {
9045					return false;
9046				}
9047
9048				if ( $col.length ) {
9049					skin = $col.attr('data-skin-change');
9050					$tmbs = $('.tmb[data-skin-change]', $row);
9051					tmbskin = skin.replace('style', 'tmb');
9052				}
9053
9054				if ( ! $row.hasClass('unscroll-horizontal') ) {
9055					$row.waypoint(function( dir ) {
9056						if ( dir === 'down' ) {
9057							bgChange($col, bgColor, skin, tmbskin);
9058							checkTransparencyAndChange(skin);
9059						} else {
9060							return;
9061						}
9062					}, {
9063						offset: '50%'
9064		  			});
9065
9066					$row.waypoint(function( dir ) {
9067						if ( dir === 'up' ) {
9068							bgChange($col, bgColor, skin, tmbskin);
9069							checkTransparencyAndChange(skin);
9070						} else {
9071							return;
9072						}
9073					}, {
9074						offset: function() {
9075							var clH = this.element.clientHeight,
9076								wH = window.innerHeight,
9077								ret = clH > 200 ? -100 : clH * -0.5;
9078							return ( wH / 2 ) - clH;
9079						}
9080					});
9081				}
9082
9083			});
9084
9085			$('body').addClass('bg-changer-init');
9086
9087		}
9088	};
9089
9090	var body = document.body,
9091	edges = false;
9092
9093	var throttle = function(fn, wait) {
9094		var time = Date.now();
9095		return function() {
9096			if ((time + wait - Date.now()) < 0) {
9097				fn();
9098				time = Date.now();
9099			}
9100		}
9101	}
9102
9103	var $wrapper = document.querySelector(".main-wrapper"),
9104		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
9105
9106	var $title = document.querySelector('#rotating');
9107	if ( $title !== null ) {
9108		$title.style.whiteSpace = 'nowrap';
9109		$title.style.transition = 'transform 200ms linear';
9110	}
9111
9112	window.addEventListener( 'scroll', throttle( function() {
9113		window.clearRequestTimeout( isScrolling );
9114
9115		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
9116
9117			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
9118				body = document.body,
9119				html = document.documentElement,
9120				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9121				$row = false,
9122				firstOff,
9123				lastOff;
9124
9125			if ( scrolled < 100 && $first.length ) {
9126				firstOff = $first.offset().top;
9127				if ( firstOff < 100 ) {
9128					var $row = $first;
9129				}
9130			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
9131				lastOff = $last.offset().top + $last.outerHeight();
9132				if ( lastOff > ( docH - 100 ) ) {
9133					var $row = $last;
9134				}
9135			}
9136
9137			if ( $row.length ) {
9138				var $col = $('.uncol[data-skin-change]', $row).eq(0),
9139					skin,
9140					$tmbs,
9141					tmbskin,
9142					bgColor = $row.attr('data-bg-color');
9143
9144				if ( $col.length ) {
9145					skin = $col.attr('data-skin-change');
9146					$tmbs = $('.tmb[data-skin-change]', $row);
9147					tmbskin = skin.replace('style', 'tmb');
9148				}
9149
9150				bgChange($col, bgColor, skin, tmbskin);
9151				checkTransparencyAndChange(skin);
9152				edges = true;
9153			}
9154
9155		}, 150);
9156
9157		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
9158			bg_waypoints();
9159			Waypoint.refreshAll();
9160			edges = false;
9161		}
9162
9163	}, 100), false);
9164
9165	$(window).on('resize', function() {
9166		clearRequestTimeout(setCTA);
9167		setCTA = requestTimeout(function() {
9168			if ( localH != UNCODE.wheight ) {
9169				localH = UNCODE.wheight;
9170				bg_waypoints();
9171				Waypoint.refreshAll();
9172			}
9173		}, 100);
9174	});
9175
9176	bg_waypoints();
9177
9178};
9179
9180UNCODE.skewIt = function() {
9181
9182	if ( $('body').hasClass('compose-mode') ) {
9183		return;
9184	}
9185
9186	var justscrolled = false;
9187
9188	var loadSkewIt = function(){
9189
9190		var $pageHeader = $('#page-header'),
9191			$page_body = $('.page-body'),
9192			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
9193
9194		if ( $header_skew.length ) {
9195			$pageHeader.addClass('uncode-skew').css({
9196				position: 'relative',
9197				zIndex: 1
9198			});
9199			$header_skew.removeClass('uncode-skew');
9200			$page_body.css({
9201				position: 'relative',
9202				zIndex: 0
9203			});
9204		}
9205
9206		var $skew = $('.uncode-skew'),
9207			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
9208			horizontal = $horizontal.length,
9209			stopSkewing,
9210			lastOffset = 0,
9211			lastDate = Date.now();
9212
9213		if ( ! $skew.length ) {
9214			return;
9215		}
9216
9217		var dropSkew = function(){
9218			if ( UNCODE.wwidth < UNCODE.mediaQuery )
9219				return;
9220
9221			$skew.each(function(){
9222				var $this = $(this),
9223					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9224
9225				if ( $drop.length ) {
9226					$this.css({
9227						'transform': 'skew(0)'
9228					});
9229					var bound = $this[0].getBoundingClientRect();
9230					$drop.css({
9231						left: bound.x * -1,
9232						top: bound.y * -1,
9233					});
9234				}
9235			});
9236		};
9237		dropSkew();
9238
9239		$(window).on('resize', dropSkew);
9240
9241		window.addEventListener( 'scroll', function() {
9242
9243			if ( justscrolled !== true ) {
9244				justscrolled = true;
9245				return;
9246			}
9247
9248			window.clearRequestTimeout( stopSkewing );
9249
9250			var now = Date.now(),
9251				delayInMs = now - lastDate,
9252				offset = window.pageYOffset || window.document.documentElement.scrollTop,
9253				newOffset = offset - lastOffset,
9254				speed = Math.pow((newOffset / delayInMs), 3) * -1,
9255				body = document.body,
9256				html = document.documentElement,
9257				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9258				wait = 50,
9259				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
9260
9261			if ((lastDate + wait - now) < 0) {
9262
9263				lastDate = now;
9264				lastOffset = offset;
9265
9266				if ( speed > 6 ) {
9267					speed = 6;
9268				} else if ( speed < -6 ) {
9269					speed = -6;
9270				}
9271
9272				if ( speed > 2 && offset < UNCODE.wheight ) {
9273					speed = 2;
9274				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
9275					speed = -2;
9276				}
9277
9278				var speedY = speed,
9279					speedX = speed * 1.25;
9280
9281				if ( horizontal ) {
9282					speedY = 0;
9283					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9284						speedX = 0;
9285						return;
9286					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
9287						speedX = 0;
9288						return;
9289					}
9290				} else {
9291					speedX = 0;
9292				}
9293
9294				if ( ! $skew.closest('.enter-st').length ) {
9295					speedX = 0;
9296				}
9297
9298				gsap.killTweensOf($skew);
9299				gsap.to( $skew, {
9300					duration: 0.2,
9301					skewY: (speedY * maxSpeed) + "deg",
9302					skewX: (speedX * maxSpeed) + "deg",
9303					ease: Power0.easeNone,
9304					transformOrigin: 'center',
9305				});
9306
9307			}
9308
9309			stopSkewing = requestTimeout(function() {
9310				gsap.killTweensOf($skew);
9311				gsap.to( $skew, {
9312					duration: 0.5,
9313					skewY: "0deg",
9314					skewX: "0deg",
9315					transformOrigin: 'center',
9316					ease: Expo.easeOut,
9317				});
9318
9319				$skew.each(function(){
9320					var $this = $(this),
9321						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9322
9323					if ( $drop.length ) {
9324						var bound = $this[0].getBoundingClientRect()
9325						$drop.css({
9326							left: bound.x * -1,
9327							top: bound.y * -1,
9328						});
9329					}
9330				});
9331
9332			}, 200);
9333
9334		}, false);
9335
9336	};
9337
9338	$(window).on('load', loadSkewIt);
9339
9340};
9341
9342UNCODE.rotateIt = function() {
9343
9344	if ( $('body').hasClass('compose-mode') ) {
9345		return;
9346	}
9347
9348	var frameRotate = false;
9349	var loadRotateIt = function(){
9350
9351		var $toRotate = $('.uncode-rotate');
9352
9353		$toRotate.each(function(){
9354			var $rotate = $(this),
9355				deg = 0,
9356				dir = true,
9357				coeff = 1,
9358				lastOffset = 0,
9359				lastDate = Date.now();
9360
9361			var checkScroll = function($rotate){
9362				// if ( ! $rotate.length ) {
9363				// 	return;
9364				// }
9365
9366				var now = Date.now(),
9367					delayInMs = now - lastDate,
9368					offset = window.pageYOffset || window.document.documentElement.scrollTop,
9369					newOffset = offset - lastOffset,
9370					speed = (newOffset / delayInMs) * 5,
9371					body = document.body,
9372					html = document.documentElement,
9373					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
9374
9375				lastDate = now;
9376				lastOffset = offset;
9377
9378				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
9379					deg = 0;
9380				}
9381
9382				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
9383					deg = parseFloat(deg) + parseFloat(speed);
9384				}
9385
9386				if ( $rotate.hasClass('uncode-rotate-hover') ) {
9387					$rotate.hover(function(){
9388						coeff = 1.75;
9389					}, function(){
9390						coeff = 1;
9391					});
9392				}
9393
9394				// if ( speed > 0 ) {
9395				// 	dir = true
9396				// } else if ( speed < 0 ) {
9397				// 	dir = false
9398				// }
9399
9400				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
9401					deg = deg+coeff;
9402					// if ( dir ) {
9403					// 	deg = deg+coeff;
9404					// } else {
9405					// 	deg = deg-coeff;
9406					// }
9407				}
9408
9409				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9410					return false;
9411				}
9412				
9413				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
9414					var undeg = deg*-1;
9415					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
9416				} else {
9417					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
9418				}
9419
9420				requestAnimationFrame(function() {
9421					if ( frameRotate === true ) {
9422						frameRotate = false;
9423						return;
9424					}
9425					checkScroll($rotate);
9426				});
9427			};
9428
9429			checkScroll($rotate);
9430
9431		});
9432
9433	};
9434
9435	$(window).on('load', loadRotateIt);
9436
9437	var checkRotate;
9438	var resizeRotate = function(){
9439		var $inlineRotates = $('.inline-rotate');
9440		$inlineRotates.each(function(){
9441			$(this).addClass('inline-rotate-standby');
9442		});
9443		clearTimeout(checkRotate);
9444		checkRotate = setTimeout(function(){
9445			$('.inline-rotate').each(function(){
9446				$(this).removeClass('inline-rotate-standby');
9447				frameRotate = true;
9448			});
9449			loadRotateIt();
9450		}, 500);
9451	};
9452
9453	$(window).off('resize.inline-rotate', resizeRotate)
9454	.on('resize.inline-rotate', resizeRotate);
9455
9456};
9457
9458var marqueeAttempts = 0,
9459	marqueeTO,
9460	marqueeCheckResize;
9461
9462UNCODE.textMarquee = function( $titles ) {
9463
9464	var initTextMarquee = function( $titles ){
9465
9466		if ( typeof $titles == 'undefined' ) {
9467			$titles = $('.un-text-marquee');
9468		}
9469
9470		if ( ! $titles.length ) {
9471			return;
9472		}
9473
9474		var stableHeight = UNCODE.wheight;
9475
9476		$titles.each(function(){
9477			var $title = $(this),
9478				$span = $('> span, > i > span', $title),
9479				txt,
9480				first = true,
9481				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
9482				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
9483				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
9484				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
9485				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
9486				newW = UNCODE.wwidth,
9487				marqueeTL, inview;
9488
9489			if ( $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ) {
9490				dataTrigger = 'row';
9491			}
9492
9493			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
9494				dataNavBar = dataNavBarMobile;
9495			}
9496
9497			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
9498			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
9499			var dataX = dataSpeed;
9500
9501			dataSpeed += 5;
9502
9503			$('.marquee-clone-wrap', $title).remove();
9504
9505			txt = $span.html();
9506
9507			if ( ! $('.marquee-original-core', $span).length ) {
9508				txt = $span.html();
9509				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
9510			} else {
9511				txt = $('.marquee-original-core', $span).html();
9512			}
9513
9514			var spanW,
9515				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
9516				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
9517				speed = 10 - dataSpeed;
9518
9519			$span.prepend($prepended);
9520			$span.append($appended);
9521
9522			var continuousTextMarquee = function () {
9523				var bound = $title
9524						.css({
9525							transform: "none",
9526							opacity: 0,
9527						})
9528						.offset(),
9529					ease = "none";
9530
9531				var xStrt =
9532						first || $title.hasClass("un-marquee-infinite")
9533							? 0
9534							: UNCODE.wwidth - bound.left,
9535					xEnd = $title.hasClass("un-marquee-infinite")
9536						? spanW
9537						: spanW + bound.left,
9538					xSpeed =
9539						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
9540						dataSpeed,
9541					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
9542					speedSlow = (xEnd + xStrt) / 45,
9543					transFormVal,
9544					translX;
9545
9546				marqueeTL = new TimelineMax({ paused: true, reversed: true });
9547
9548				var inViewElement =
9549						dataTrigger === "row" ? $title.closest(".vc_row")[0] : $title[0],
9550					wayOff =
9551						dataTrigger === "row" && dataNavBar === "yes"
9552							? UNCODE.menuHeight
9553							: 0;
9554
9555				inview = new Waypoint.Inview({
9556					element: inViewElement,
9557					offset: wayOff,
9558					enter: function (direction) {
9559						marqueeTL.play();
9560					},
9561					exited: function (direction) {
9562						if (!$title.closest(".pin-spacer").length) {
9563							marqueeTL.pause();
9564						}
9565					},
9566				});
9567
9568				if ($title.hasClass("un-marquee-hover")) {
9569					var $column = $title.closest(".wpb_column"),
9570						$col_link = $(".col-link", $column),
9571						$hover_sel = $title;
9572
9573					if ($col_link.length) {
9574						$hover_sel = $title.add($column);
9575					}
9576					$hover_sel
9577						.on("mouseover", function () {
9578							ease = "power2.out";
9579							transFormVal = $title.css("transform").split(/[()]/)[1];
9580							translX = transFormVal.split(",")[4];
9581							speedSlow = (xEnd + (xStrt - translX)) / 45;
9582							marqueeTL.duration(speedSlow);
9583						})
9584						.on("mouseout", function () {
9585							ease = "power2.in";
9586							transFormVal = $title.css("transform").split(/[()]/)[1];
9587							translX = transFormVal.split(",")[4];
9588							speedSlow =
9589								((xEnd + (xStrt - translX)) /
9590									(dataSpeed * dataSpeed * dataSpeed) /
9591									5) *
9592								dataSpeed;
9593							marqueeTL.duration(speedSlow);
9594						});
9595				}
9596		
9597				gsap.killTweensOf($title);
9598				marqueeTL.fromTo( $title, {
9599					opacity: 1,
9600					x: xStrt * direction * -1
9601				},
9602				{
9603					duration: xSpeed,
9604					x: xEnd * direction,
9605					onComplete: function(){
9606						first = false;
9607						continuousTextMarquee();
9608					},
9609					ease: ease
9610				});
9611		
9612			};
9613			
9614			var runTextMarquee = function(){
9615				var time = Date.now();
9616
9617				var textMarqueeScroll = function(){
9618					var $row = $title.closest('.vc_row'),
9619						$bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
9620
9621					if ( !$bound.length ) {
9622						return;
9623					}
9624
9625					var bound = $bound[0].getBoundingClientRect(),
9626						wait = 100,
9627						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
9628						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
9629
9630					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
9631						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
9632						marqueeAttempts < 2 ) {
9633
9634						clearRequestTimeout(marqueeTO);
9635
9636						marqueeTO = requestTimeout(function(){
9637							marqueeAttempts++;
9638							initTextMarquee();
9639						}, 100);
9640					}
9641
9642
9643					var bound_top = bound.top,
9644						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
9645
9646					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
9647						if ( dataTrigger === 'row-middle' ) {
9648							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5)
9649						}
9650						if ( dataNavBar === 'yes' ) {
9651							bound_top = bound_top - UNCODE.menuHeight;
9652						}
9653						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
9654					}
9655
9656					gsap.killTweensOf($title);
9657					gsap.to( $title, {
9658						duration: 0.24,
9659						x: gsap_calc,
9660					});
9661				};
9662
9663				textMarqueeScroll();
9664				$(window).on( 'load scroll', function(e) {
9665					textMarqueeScroll();
9666				});
9667
9668			};
9669
9670			var cloneSpan = function($_title, cntnt){
9671
9672				if ( $_title.hasClass('un-marquee-infinite') ) {
9673					$('> span.marquee-clone-wrap', $_title).text('');
9674				}
9675
9676				gsap.to( $_title, {
9677					duration: 0,
9678					x: 0
9679				});
9680				spanW = $span.outerWidth();
9681
9682				if ( !spanW ) {
9683					return;
9684				}
9685
9686				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
9687					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
9688
9689				if ( $_title.hasClass('un-marquee-infinite') ) {
9690
9691					for ( var i = 0; i < part; i++ ) {
9692						$prepended.append(cntnt + spaceSpan);
9693						$appended.append(cntnt + spaceSpan);
9694					}
9695				}
9696
9697				if ( $('body').hasClass('compose-mode') ) {
9698					$('.uncode_fe_safe').remove();
9699					return;
9700				}
9701
9702				if ( $title.closest('.marquee-freezed').length ) {
9703					return;
9704				}
9705
9706				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
9707					continuousTextMarquee();
9708				}
9709
9710				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
9711					runTextMarquee();
9712				}
9713
9714			};
9715
9716			var marqueeResize = function(e){
9717				clearRequestTimeout(marqueeCheckResize);
9718				marqueeCheckResize = requestTimeout(function(){
9719					if ( newW !== UNCODE.wwidth ) {
9720						gsap.killTweensOf($title);
9721						if ( typeof inview !== 'undefined' && inview !== null ) {
9722							inview.destroy();
9723						}
9724						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
9725							marqueeTL.kill();
9726						}
9727						first = true;
9728						initTextMarquee();
9729						newW = UNCODE.wwidth;
9730					}
9731				}, 1000);
9732			};
9733
9734			$(window).off('resize uncode.re-layout', marqueeResize)
9735			.on( 'resize uncode.re-layout', marqueeResize);
9736
9737			cloneSpan($title, txt);
9738
9739			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9740				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
9741					var $_titles = $('.un-text-marquee',e.view.$el);
9742					clearRequestTimeout(marqueeCheckResize);
9743					marqueeCheckResize = requestTimeout(function(){
9744						initTextMarquee($_titles);
9745					}, 1000);
9746				});
9747			}
9748		});
9749
9750		$(window).on( 'load wwResize', function(e) {
9751			stableHeight = UNCODE.wheight;
9752		});
9753
9754	};
9755
9756	document.addEventListener("DOMContentLoaded", function() {
9757		initTextMarquee();
9758	});
9759
9760	$(window).on('focus',function(){
9761		setTimeout(function(){
9762			initTextMarquee();
9763		},500);
9764	});
9765	
9766	$(document).on('pumAfterOpen pumAfterClose', function(args){
9767		initTextMarquee();
9768	});
9769
9770};
9771
9772UNCODE.parallax = function() {
9773	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
9774		if ($('.parallax-el').length > 0) {
9775			var parallax_elements = new Rellax('.parallax-el');
9776			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
9777			window.addEventListener('boxResized', function(e) {
9778				parallax_elements.refresh();
9779			}, false);
9780			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
9781				requestTimeout(function() {
9782					parallax_elements.refresh();
9783				}, 100);
9784			});
9785
9786		}
9787	}
9788};
9789
9790UNCODE.magicCursor = function(){
9791	var $customCursor = $('#uncode-custom-cursor'),
9792		$customPilot = $('#uncode-custom-cursor-pilot'),
9793		$tooltip = $('.title-tooltip', $customCursor),
9794		$cursorSpan = $('> span', $tooltip),
9795		currentBg = false,
9796		fromTitle = false,
9797		setTime,
9798		mouseEvent;
9799
9800		var spanW, spanH,
9801		maxW = false;
9802
9803	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
9804		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
9805			$tooltip.css({opacity: 0});
9806			delayt_time += 400;
9807		}
9808		clearRequestTimeout(setTime);
9809		setTime = requestTimeout(function() {
9810
9811			$tooltip.css({opacity: ''});
9812
9813			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
9814
9815			if ( cursorTitle !== '' ) {
9816				if ( fromTitle && dataTitle === 'boing' ) {
9817					setTimeout(function(){
9818						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
9819					}, 5);
9820				}
9821				$cursorSpan.attr('class', fontClass).html( cursorTitle );
9822			} else {
9823				if ( cursorType !== 'auto' ) {
9824					$cursorSpan.html('');
9825				}
9826			}
9827
9828			$cursorSpan.addClass('in-tooltip');
9829
9830			$customCursor.attr('data-cursor', cursorType);
9831
9832			if ( fromTitle ) {
9833				$customCursor.addClass('from-tooltip-title');
9834			} else {
9835				$customCursor.removeClass('from-tooltip-title');
9836			}
9837
9838			if ( cursorBg !== false ) {
9839				$customCursor.attr('data-bg', 'transparent');
9840			} else {
9841				$customCursor.removeAttr('data-bg');
9842			}
9843
9844			currentBg = cursorBg;
9845
9846			if ( cursorTitle !== '' ) {
9847				fromTitle = true;
9848				$customCursor.attr('data-cursor', cursorType);
9849				$customCursor.attr('data-title', 'true');
9850				$cursorSpan.css({width: ''});
9851			} else {
9852				fromTitle = false;
9853				$customCursor.removeAttr('data-title');
9854			}
9855			spanW = $cursorSpan.outerWidth();
9856			
9857			if ( spanW >= maxW && maxW !== false ) {
9858				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
9859				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
9860					width: maxW
9861				});
9862				spanW = maxW;
9863			} else {
9864				$customCursor.find('> span:first-child').removeClass('max-width');
9865			}
9866			spanH = $cursorSpan.outerHeight();
9867			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
9868				$customCursor.find('> span:first-child').add($tooltip).css({
9869					width: spanW,
9870					height: spanH
9871				});
9872			} else {
9873				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
9874			}
9875			if ( $customPilot.length ) {
9876				$customPilot.attr('data-cursor', cursorType);
9877			}
9878		}, delayt_time);
9879	}
9880
9881	function changeCursor($wrap){
9882		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
9883		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
9884			$href = $wrap.find(href),
9885			cursorType,
9886			cursorTitle = '',
9887			tooltip_class = '',
9888			cursorBg = false;
9889
9890		$href.filter(':not(.cursor-init)').on('mouseenter.cursor',function(e) {
9891			var $this = $(this).addClass('cursor-init'),
9892				$tmb = $this.closest('.tmb'),
9893				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
9894				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
9895				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
9896				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
9897				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
9898				$title = $('.t-entry-title', $tmb),
9899				is_frontend_editor = $this.closest('.vc_controls').length,
9900				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
9901				$parent_cursor = $this.closest('[class*="custom-cursor"]');
9902
9903			if ( is_frontend_editor ) {
9904				cursorType = 'auto';
9905			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
9906				cursorType = data_cursor;
9907			} else if ( $parent_cursor.length ) {
9908				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
9909					cursorType = 'icon-light';
9910				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
9911					cursorType = 'icon-diff';
9912				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
9913					cursorType = 'icon-accent';
9914				} else {
9915					cursorType = 'icon-dark';
9916				}
9917			} else {
9918				cursorType = 'pointer';
9919			}
9920
9921			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
9922				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
9923					cursorTitle = custom_text;
9924				} else {
9925					cursorTitle = $title.clone();
9926					$('a', cursorTitle).replaceWith(function() {
9927						return this.childNodes;
9928					});
9929					$('*', cursorTitle).replaceWith(function(){
9930						return $(this).removeAttr('class');
9931					});
9932					cursorTitle = cursorTitle.html();
9933				}
9934			} else {
9935				cursorTitle = '';
9936			}
9937
9938			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
9939				tooltip_class = data_class;
9940			} else {
9941				tooltip_class = '';
9942			}
9943
9944			if ( cursor_bg == 'true' ) {
9945				cursorBg = true;
9946			} else {
9947				cursorBg = false;
9948			}
9949
9950			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
9951		}).on('mouseleave.cursor', function(){
9952			var outTime = 150;
9953			if ( currentBg !== false && cursorBg === false ) {
9954				outTime = 0;
9955			}
9956			delayChangeCursor('auto', '', false, outTime, false, '');
9957		});
9958
9959		$(window).on('disable-hover', function(event) {
9960			document.addEventListener("mousemove", function(e) {
9961				mouseEvent = e;
9962			});
9963			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
9964		});
9965
9966		$(window).on('enable-hover', function(event) {
9967			if ( typeof mouseEvent !== 'undefined' ) {
9968				var x = mouseEvent.clientX,
9969					y = mouseEvent.clientY;
9970
9971				var elements = document.elementsFromPoint(x, y),
9972					$element = $(elements[0]);
9973
9974				$element.closest(href).trigger('mouseenter');
9975			}
9976		});
9977
9978	}
9979
9980	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
9981		changeCursor();
9982	});
9983
9984	$(document).ajaxComplete(function( event, xhr, settings ) {
9985		changeCursor();
9986	});
9987
9988	$('.isotope-container').on('isotope-layout-complete', function() {
9989		var $this = $(this);
9990		changeCursor($this);
9991	});
9992
9993};
9994
9995UNCODE.magneticCursor = function(){
9996	function magneticCursor($wrap){
9997		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
9998		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'));
9999
10000		$magnetics.on('mousemove', function(e){
10001			var $this = $(this),
10002				$el,
10003				bound = e.currentTarget.getBoundingClientRect(),
10004				coeff = 30,
10005				hor = (bound.width / 2) - (e.clientX - bound.left),
10006				ver = (bound.height / 2) - (e.clientY - bound.top),
10007				toX = hor / bound.width * coeff,
10008				toY = ver / bound.height * coeff,
10009				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
10010				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
10011				toScale = Math.max(scaleX, scaleY);
10012
10013			if ( $this.hasClass('magnetic') ) {
10014				$el = $('.background-inner, .header-bg', $this);
10015			} else {
10016				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10017			}
10018
10019			gsap.killTweensOf($el);
10020			gsap.to( $el, {
10021				duration: 0.75,
10022				x: toX,
10023				y: toY,
10024				scale: toScale,
10025				ease: Power1.easeOut,
10026				transformPerspective: 900,
10027				transformOrigin: 'center',
10028				force3D: true
10029			});
10030		}).on('mouseout', function(e){
10031			var $this = $(this),
10032				$el
10033			if ( $this.hasClass('magnetic') ) {
10034				$el = $('.background-inner, .header-bg', $this);
10035			} else {
10036				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10037			}
10038			gsap.killTweensOf($el);
10039			gsap.to( $el, {
10040				duration: 0.6,
10041				y: 0,
10042				x: 0,
10043				scale: 1,
10044				ease: Power1.easeOut,
10045				transformPerspective: 900,
10046				transformOrigin: 'center',
10047				force3D: true
10048			});
10049		});
10050	};
10051
10052	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10053		magneticCursor();
10054	});
10055
10056	$(document).ajaxComplete(function( event, xhr, settings ) {
10057		magneticCursor();
10058	});
10059
10060	$('.isotope-container').on('isotope-layout-complete', function() {
10061		var $this = $(this);
10062		magneticCursor($this);
10063	});
10064
10065};
10066
10067UNCODE.dropImage = function() {
10068
10069	/****************************
10070	 * Image hover *
10071	****************************/
10072	function imageHover(){
10073		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10074			return;
10075		}
10076
10077		var $postLists = $('.uncode-post-titles');
10078		$postLists.each(function(){
10079			var $list = $(this),
10080				timing = parseFloat( $list.attr('data-timing') ),
10081				default_image = $list.hasClass('uncode-post-titles-default-image'),
10082				default_title = $list.hasClass('uncode-post-titles-default-title'),
10083				$tmbs = $('.tmb', $list),
10084				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
10085				clientX,
10086				clientY,
10087				$row_parent = $list.closest('.vc_row'),
10088				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
10089				$col_parent = $list.closest('.uncell'),
10090				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
10091				setCTA;
10092
10093			timing *= 0.001;
10094
10095			var drop_bgs = function(){
10096				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
10097					var $drop = $(this),
10098						srcset = $drop.attr('data-bgset'),
10099						setArr = srcset.split(","),
10100						setArrOrder = [],
10101						biggest = 0,
10102						checkBg = false,
10103						desktopBG = $drop.data('[data-background-image]'),
10104						mobileBG = $drop.data('[data-mobile-background-image]');
10105
10106					if ( $drop.hasClass('srcset-bg-async') ) {
10107
10108						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
10109							return;
10110						}
10111						
10112					}
10113
10114					if ( SiteParameters.uncode_adaptive == true ) {
10115						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
10116							$drop.css({
10117								'background-image' : 'url(' + setArr[0] + ')'
10118							});
10119						}
10120					} else {
10121						for ( var i = 0; i < setArr.length; i++ ) {
10122							var setLoop = setArr[i].trim().split(" ");
10123							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
10124								var parseSet = parseFloat(setLoop[1]);
10125								if ( biggest < parseSet ) {
10126									biggest = parseSet;
10127								}
10128								setArrOrder[parseSet] = setLoop[0];
10129								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
10130									checkBg = true;
10131									$drop.css({
10132										'background-image' : 'url(' + setLoop[0] + ')'
10133									});
10134								}
10135							}
10136						}
10137
10138						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
10139							$drop.css({
10140								'background-image' : 'url(' + setArrOrder[biggest] + ')'
10141							});
10142						}
10143					}
10144
10145				});
10146			};
10147
10148			drop_bgs();
10149
10150			var dropMovesSize = function(){
10151				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
10152					return;
10153				}
10154				$drop_moves.each(function(){
10155					var $drop_move = $(this),
10156						dataW = $drop_move.attr('data-w'),
10157						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
10158					if ( typeof dataW !== 'undefined' && dataW !== null ) {
10159						dataW = screenInfo.width / 12 * parseFloat( dataW );
10160					}
10161					$drop_moves.css({
10162						width: dataW
10163					});
10164
10165					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10166						$anim_parent.on('animationend', function(){
10167							var bound = $anim_parent[0].getBoundingClientRect();
10168							$drop_move.css({
10169								left: bound.x * -1,
10170								top: bound.y * -1,
10171							});
10172						});
10173					}
10174				});
10175
10176
10177			};
10178
10179			dropMovesSize();
10180
10181			$(window).on( 'resize', function(){
10182				clearRequestTimeout(setCTA);
10183				setCTA = requestTimeout( function() {
10184					drop_bgs();
10185					dropMovesSize();
10186				}, 100 );
10187			});
10188
10189			if ( $drop_row_parents.length ) {
10190				$row_parent.addClass( 'drop-added' );
10191			}
10192
10193			$drop_row_parents.each(function(index, val){
10194				var $drop = $(val);
10195				$row_parent.prepend($drop);
10196				manageVideos($drop, false);
10197				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10198					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10199				}
10200				if ( default_image && index == 0 ) {
10201					manageVideos($drop, true);
10202					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10203						image_ph = new Image();
10204					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10205						image_ph.onload = function() {
10206							$drop.addClass('active');
10207							if ( default_title ) {
10208								$list.addClass('drop-hover');
10209								$tmbs.first().addClass('drop-active');
10210							}
10211						};
10212						image_ph.src = bg_img;
10213					}
10214				}
10215			});
10216
10217			if ( $drop_col_parents.length ) {
10218				$col_parent.addClass( 'drop-added' );
10219			}
10220
10221			$drop_col_parents.each(function(index, val){
10222				var $drop = $(this);
10223				$col_parent.prepend($drop);
10224				manageVideos($drop, false);
10225				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10226					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10227				}
10228				if ( default_image && index == 0 ) {
10229					manageVideos($drop, true);
10230					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10231						image_ph = new Image();
10232					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10233						image_ph.onload = function() {
10234							$drop.addClass('active');
10235							if ( default_title ) {
10236								$list.addClass('drop-hover');
10237								$tmbs.first().addClass('drop-active');
10238							}
10239						};
10240						image_ph.src = bg_img;
10241					}
10242				}
10243			});
10244
10245			function manageVideos( $el, start ) {
10246				var videoElem = $('video', $el),
10247					$iframe = $('iframe', $el),
10248					iframeID = $iframe.attr('id');
10249				if ( videoElem.length ) {
10250					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
10251						if ( start ) {
10252							videoElem[0].setCurrentTime(0);
10253							videoElem[0].play();
10254						} else {
10255							videoElem[0].pause();
10256							videoElem[0].setCurrentTime(0);
10257						}
10258					} else {
10259						if ( start ) {
10260							videoElem[0].currentTime = 0;
10261							videoElem[0].play();
10262						} else {
10263							videoElem[0].pause();
10264							videoElem[0].currentTime = 0;
10265						}
10266					}
10267				}
10268
10269				$el.data('active', start);
10270
10271				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
10272					var iframeIDv = iframeID.replace('okplayer-', ''),
10273						optionsV = $(window).data('okoptions-' + iframeIDv),
10274						vimeo = $iframe[0],
10275						playerV = new Vimeo.Player(vimeo),
10276						timeV = 0;
10277
10278					if (optionsV.time != null) {
10279						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
10280						for ( var i = 0; i < timeArr.length; i++ ) {
10281							if ( timeArr[i] === 'h' ) {
10282								timeV += parseFloat(timeArr[i-1]) * 3600;
10283							} else if ( timeArr[i] === 'm' ) {
10284								timeV += parseFloat(timeArr[i-1]) * 60;
10285							} else if ( timeArr[i] === 's' ) {
10286								timeV += parseFloat(timeArr[i-1]);
10287							}
10288						}
10289					}
10290					playerV.setCurrentTime(timeV);
10291					if ( start ) {
10292						playerV.setVolume(0);
10293						playerV.play();
10294					} else {
10295						playerV.pause();
10296					}
10297				} else if ( $el.attr('data-provider') === 'youtube' ) {
10298					if ( start ) {
10299						$el.trigger('uncode-resume');
10300					} else {
10301						$el.trigger('uncode-pause');
10302					}
10303				}
10304
10305			}
10306
10307			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
10308
10309				document.addEventListener("mousemove", function(e) {
10310					$drop_moves.each(function(){
10311						var $drop_move = $(this),
10312							duration = 0.4;
10313
10314						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
10315							duration = 0.8;
10316						}
10317
10318						clientX = e.clientX;
10319						clientY = e.clientY;
10320
10321						gsap.to( $drop_move, {
10322							duration: duration,
10323							x: clientX,
10324							y: clientY,
10325							ease: Power1.easeOut,
10326						});
10327					});
10328				});
10329
10330			} else {
10331
10332				$(window).on("touchend scroll", function(e) {
10333					$list.removeClass('drop-hover');
10334					$drop_moves.removeClass('active');
10335					$tmbs.removeClass('drop-active');
10336				});
10337
10338				$drop_moves.each(function(){
10339					var $drop_move = $(this),
10340						$tmb = $drop_move.closest('.tmb'),
10341						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
10342
10343					if ( $anim_parent.hasClass('uncode-skew') ) {
10344						$anim_parent.css({
10345							'transform': 'skew(0)'
10346						});
10347					}
10348
10349					$tmb.on('touchend', function(e){
10350						e.stopPropagation();
10351
10352						$drop_moves.removeClass('active');
10353						$tmbs.removeClass('drop-active');
10354
10355						$list.addClass('drop-hover');
10356						$tmb.addClass('drop-active');
10357						$drop_move.addClass('active');
10358						manageVideos($drop_move, true);
10359						clientX = e.changedTouches[0].clientX;
10360						clientY = e.changedTouches[0].clientY;
10361
10362						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10363							var bound = $anim_parent[0].getBoundingClientRect();
10364							clientX = clientX - bound.x;
10365							clientY = clientY - bound.y;
10366						}
10367
10368						$drop_move.css({
10369							left: clientX,
10370							top: clientY
10371						});
10372					});
10373				});
10374
10375			}
10376
10377			$tmbs.each(function(e){
10378				var $tmb = $(this),
10379					// $trgr = $('a', $tmb),
10380					$trgr = $tmb,
10381					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
10382					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
10382(.t-inside), .parallax-el'),
10383					$video = $('video', $tmb),
10384					$iframe = $('iframe', $tmb),
10385					$entryTxt = $('.t-entry-text', $tmb),
10386					stopBounding;
10387
10388				$entryTxt.add($drop_move).css({
10389					'transition-duration': timing + 's'
10390				});
10391
10392				if ( $video.length ) {
10393					var vidH = $video[0].videoHeight,
10394						vidW = $video[0].videoWidth;
10395					$video.css({
10396						'height': vidH,
10397						'width': vidW
10398					});
10399				}
10400
10401				if ( $iframe.length ) {
10402					var vidH = $drop_move.attr('data-height'),
10403						vidW = $drop_move.attr('data-width');
10404					$iframe.css({
10405						'height': vidH,
10406						'width': vidW
10407					});
10408				}
10409
10410				$iframe.each(function(){
10411					var $video = $(this),
10412						vidH = $video[0].videoHeight,
10413						vidW = $video[0].videoWidth;
10414					$video.css({
10415						'height': vidH,
10416						'width': vidW
10417					});
10418				});
10419
10420				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10421					$trgr.on('mouseenter',function(e){
10422						$list.addClass('drop-hover');
10423						$tmbs.removeClass('drop-active');
10424						$tmb.addClass('drop-active');
10425						$drop_move.addClass('active');
10426						manageVideos($drop_move, true);
10427
10428						var clientX = e.clientX,
10429							clientY = e.clientY;
10430						$drop_move.css({
10431							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
10432						});
10433
10434					})
10435					.on('mouseleave', function(e){
10436						$list.removeClass('drop-hover');
10437						$drop_move.css({
10438							'transition-duration': ( timing*1.25 ) + 's'
10439						});
10440						$drop_move.removeClass('active');
10441						$tmb.removeClass('drop-active');
10442						$drop_move.on('transitionend', function(e){
10443							$drop_move.off('transitionend');
10444							$drop_move.css({
10445								'transition-duration': timing + 's'
10446							});
10447							manageVideos($drop_move,false);
10448						});
10449					});
10450
10451					document.addEventListener('visibilitychange', function(){
10452						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
10453							$drop_move.css({
10454								'transition-duration': '0s'
10455							});
10456							$drop_move.removeClass('active');
10457							manageVideos($drop_move, false);
10458						}
10459					});
10460
10461					document.addEventListener('scroll', function(){
10462						window.clearRequestTimeout( stopBounding );
10463
10464						if ( $drop_move.hasClass('active') ) {
10465							$list.removeClass('drop-hover');
10466							$tmbs.removeClass('drop-active');
10467							$drop_move.removeClass('active');
10468							$drop_move.on('transitionend', function(e){
10469								$drop_move.off('transitionend');
10470								$drop_move.css({
10471									'transition-duration': timing + 's'
10472								});
10473								manageVideos($drop_move,false);
10474							});
10475						}
10476
10477						stopBounding = requestTimeout(function() {
10478							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10479								var bound = $anim_parent[0].getBoundingClientRect();
10480								$drop_move.css({
10481									left: bound.x * -1,
10482									top: bound.y * -1,
10483								});
10484							}
10485						}, 200);
10486
10487					});
10488				}
10489
10490				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
10491					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
10492
10493				$drop.css({
10494					'transition-duration': timing + 's'
10495				});
10496
10497				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
10498					$trgr.on('mouseenter',function(e){
10499						$row_parent.add($col_parent).addClass('drop-list-loaded');
10500						$list.addClass('drop-hover');
10501
10502						if ( !$tmb.hasClass('drop-active') ) {
10503							$tmbs.removeClass('drop-active');
10504							$tmb.addClass('drop-active');
10505							if ( default_image && !$drop.hasClass('active') ) {
10506								var $prev = $('[data-drop].active', $row_parent);
10507								$prev.css({
10508									'transition-duration': (timing*1.5) + 's'
10509								});
10510								$prev.removeClass('active');
10511								$prev.on('transitionend', function(e){
10512									$prev.off('transitionend');
10513									manageVideos($prev,false);
10514								});
10515							}
10516							$drop.css({
10517								'transition-duration': timing + 's'
10518							});
10519							$drop.off('transitionend');
10520							$drop.addClass('active');
10521							manageVideos($drop, true);
10522						}
10523					})
10524					.on('mouseleave', function(e){
10525						if ( ( default_image && !default_title ) || !default_image ) {
10526							$list.removeClass('drop-hover');
10527							$tmb.removeClass('drop-active');
10528						}
10529						if ( ! default_image ) {
10530							$drop.css({
10531								'transition-duration': (timing*1.5) + 's'
10532							});
10533							$drop.removeClass('active');
10534
10535							$drop.on('transitionend', function(e){
10536								$drop.off('transitionend');
10537								manageVideos($drop,false);
10538							});
10539						}
10540					});
10541
10542					document.addEventListener('visibilitychange', function(){
10543						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
10544							$drop.css({
10545								'transition-duration': '0s'
10546							});
10547							$drop.removeClass('active');
10548							manageVideos($drop, false);
10549						}
10550					});
10551				}
10552			});
10553
10554		});
10555	};
10556
10557	$(window).on('load', function(event) {
10558		imageHover();
10559	});
10560
10561	var drop_wp_animation = function() {
10562		var $postLists = $('.uncode-post-titles');
10563		$postLists.each(function(){
10564			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10565				new Waypoint({
10566					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10567					element: val,
10568					handler: function() {
10569						var element = $(this.element),
10570							parent = element.closest('.tmb'),
10571							currentIndex = parent.index(),
10572							delay = currentIndex,
10573							delayAttr = parseInt(element.attr('data-delay'));
10574						if (isNaN(delayAttr)) delayAttr = 100;
10575						var objTimeout = requestTimeout(function() {
10576							element.addClass('start_animation');
10577
10578							var nextTimeout = requestTimeout(function() {
10579								$('.drop-image-separator', parent).addClass('start_animation');
10580							}, 50);
10581
10582						}, delay * delayAttr);
10583						if (!UNCODE.isUnmodalOpen) {
10584							this.destroy();
10585						}
10586					},
10587					offset: UNCODE.isFullPage ? '100%' : '90%'
10588				})
10589			});
10590		});
10591	}
10592
10593	var runWaypoints_TO,
10594		runWaypoints_delay = 0;
10595
10596	var runWaypoints = function(){
10597		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10598			runWaypoints_delay = 400;
10599		}
10600		clearRequestTimeout(runWaypoints_TO);
10601		runWaypoints_TO = requestTimeout(function() {
10602			drop_wp_animation();
10603		}, runWaypoints_delay);
10604	};
10605	runWaypoints();
10606	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10607	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10608		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10609			// imageHover();
10610			runWaypoints();
10611		});
10612	}
10613};
10614
10615UNCODE.postTable = function() {
10616
10617	var clickRow = function(){
10618		var $postLists = $('.uncode-post-table');
10619
10620		$postLists.each(function(){
10621			var $postList = $(this),
10622				$tmbClicks = $('.tmb.tmb-click-row', $postList);
10623
10624			$tmbClicks.each(function(){
10625				var $tmb = $(this),
10626					$click = $('.table-click-row', $tmb);
10627				$('*:not(.table-click-row)', $tmb).on('click', function(e){
10628					e.preventDefault();
10629					e.stopPropagation();
10630					$click[0].click();
10631					return false;
10632				});
10633			});
10634
10635		})
10636	};
10637
10638	clickRow();
10639
10640	var hoverRow = function(){
10641		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
10642
10643		$postLists.on('mouseenter', function(){
10644			$(this).addClass('post-table-hover');
10645		});
10646		$postLists.on('mouseleave', function(){
10647			$(this).removeClass('post-table-hover');
10648		});
10649	}
10650
10651	hoverRow();
10652
10653	var drop_wp_animation = function() {
10654		var $postLists = $('.uncode-post-table');
10655		$postLists.each(function(){
10656			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10657				new Waypoint({
10658					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10659					element: val,
10660					handler: function() {
10661						var element = $(this.element),
10662							parent = element.closest('.tmb'),
10663							currentIndex = parent.index(),
10664							delay = currentIndex,
10665							delayAttr = parseInt(element.attr('data-delay'));
10666						if (isNaN(delayAttr)) delayAttr = 100;
10667						var objTimeout = requestTimeout(function() {
10668							element.addClass('start_animation');
10669						}, delay * delayAttr);
10670						if (!UNCODE.isUnmodalOpen) {
10671							this.destroy();
10672						}
10673					},
10674					offset: UNCODE.isFullPage ? '100%' : '90%'
10675				})
10676			});
10677		});
10678	}
10679
10680	var runWaypoints_TO,
10681		runWaypoints_delay = 0;
10682
10683	var runWaypoints = function(){
10684		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10685			runWaypoints_delay = 400;
10686		}
10687		clearRequestTimeout(runWaypoints_TO);
10688		runWaypoints_TO = requestTimeout(function() {
10689			drop_wp_animation();
10690		}, runWaypoints_delay);
10691	};
10692	runWaypoints();
10693	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10694	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10695		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10696			runWaypoints();
10697			// clickRow();
10698		});
10699	}
10700};
10701
10702UNCODE.rotatingTxt = function($ctxt) {
10703
10704	if ( $('body').hasClass('compose-mode') ) {
10705		return;
10706	}
10707
10708	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
10709	var setCTA;
10710
10711	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
10712		var $heading = $(this),
10713			// debug = 0,
10714			cycle = 0,
10715			$trgt,
10716			$toMove,
10717			$highl,
10718			$col = $heading.closest('.uncont'),
10719			txt,
10720			arrTxt,
10721			textFadeIn, textFadeOut,
10722			removeWraps;
10723
10724		var defineObjs = function() {
10725			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
10726				var $rtx = $(this),
10727					fx = $rtx.attr('data-fx'),
10728					wait = $rtx.attr('data-wait'),
10729					$prev = $(this).prev().addClass('prev-rotating-start'),
10730					splitToMove = [],
10731					splitArray = [],
10732					lineArray = [],
10733					lineIndex = 0,
10734					lineStart = true,
10735					lineEnd = false,
10736					startSplit = false,
10737					$line_wrap = $rtx.closest('.heading-line-wrap'),
10738					same_line = true,
10739					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
10740					indexRtx = $splits.index($rtx);
10741
10742				fx = typeof fx === 'undefined' ? '' : fx;
10743				wait = typeof wait === 'undefined' ? '' : wait;
10744
10745				$splits.each(function(key, val){
10746					var $split = $(this),
10747						$new_line_wrap = $split.closest('.heading-line-wrap');
10748
10749					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
10750						splitArray.push( $split );
10751					}
10752
10753					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10754						startSplit = false;
10755					}
10756
10757					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10758						splitArray.push( $split );
10759
10760						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
10761							same_line = true;
10762						} else {
10763							same_line = false;
10764						}
10765					}
10766
10767					if ( key == indexRtx ) {
10768						if ( /\S/.test($split.text()) ) {
10769							startSplit = true;
10770							$line_wrap = $split.closest('.heading-line-wrap');
10771							splitArray.push( $split );
10772						} else {
10773							indexRtx++;
10774						}
10775					}
10776
10777					$line_wrap = $new_line_wrap;
10778				});
10779
10780				$toMove = $($.map(splitToMove, function(el){return el.get();}));
10781				$trgt = $($.map(splitArray, function(el){return el.get();}));
10782
10783				if ( same_line ) {
10784					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
10785					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
10786				}
10787
10788				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
10789					$prev.addClass('empty-span-hidden');
10790				}
10791
10792				$highl = $('.heading-text-highlight-inner', $trgt);
10793
10794				$rtx.attr('data-animated', 'true');
10795				if ( cycle == 0 ) {
10796					$( document.body ).trigger('defer-highlights');
10797					cycle++;
10798					defineObjs();
10799					return;
10800				}
10801				cycle++;
10802
10803				txt = $rtx.attr('data-text');
10804				arrTxt = txt.split("|");
10805
10806				textFadeOut($trgt);
10807
10808			});
10809		};
10810
10811		removeWraps = function(){
10812
10813			// if ( debug == 1 ) return;
10814			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
10815			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
10816
10817
10818				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
10819					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
10820
10821				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
10822
10823				$splitFlow.each(function(){
10824					$(this).append($temp_highl);
10825				});
10826
10827				var $line_wrap = $wraps[wrap_k];
10828				var $parent_wrap = $line_wrap.parentNode;
10829				if ( $parent_wrap !== null ) {
10830					while ( $line_wrap.firstChild ) {
10831						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
10832					}
10833					$parent_wrap.removeChild($line_wrap);
10834				}
10835			}
10836			// debug++;
10837			defineObjs();
10838		};
10839
10840		var loop = 0;
10841		textFadeIn = function($trgt){
10842			var word = arrTxt[loop].split(" "),
10843				worsSpan = '',
10844				$wrap = $trgt.closest('.uncode-rotating-wrap'),
10845				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
10846				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
10847
10848			for (var w = 0; w < word.length; w++) {
10849				var highl;
10850				if ( $highl.length ) {
10851					highl = $highl[0].outerHTML;
10852				} else {
10853					highl = '';
10854				}
10855
10856				if ( w > 0 ) {
10857					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
10858				}
10859				var charachters = word[w].split('');
10860				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
10861				for (var c = 0; c < charachters.length; c++) {
10862					worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
10863				}
10864				worsSpan += '</span>' + highl + '</span></span>';
10865			}
10866
10867			if ( $wrap.length && $wrap_inner.length ) {
10868				var words_w = $wrap_inner.outerWidth();
10869				$wrap.css({
10870					width: words_w
10871				});
10872
10873				$highl = $('.heading-text-highlight-inner', $wrap);
10874				$highl.prependTo($wrap);
10875
10876				$wrap_inner.css({
10877					opacity: 0
10878				});
10879
10880				$wrap_inner.html(worsSpan);
10881				$('.heading-text-highlight-inner', $wrap_inner).remove();
10882				words_w = $wrap_inner.innerWidth();
10883
10884				var duration = 0.45;
10885
10886				$heading.removeClass('auto-width');
10887				if ( words_w > $col.width() ) {
10888					$heading.addClass('auto-width');
10889					words_w = 'auto';
10890					duration = 0;
10891				}
10892
10893				$wrap.css({
10894					'width': words_w,
10895					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
10896				});
10897
10898				var $word_inner = $('.split-word-inner', $wrap_inner),
10899					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
10900
10901				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
10902
10903				if ( !$target_fx.length ) {
10904					return;
10905				}
10906
10907				gsap.killTweensOf($target_fx);
10908
10909				if ( fx !== 'zoom' ) {
10910					gsap.fromTo( $target_fx, {
10911						y: fx === 'opacity' ? '0%' : '-10%'
10912					},{
10913						delay: duration,
10914						duration: 0.25,
10915						y: '0%',
10916						ease: Circ.easeOut,
10917					});
10918
10919					if ( !$wrap_inner.length ) {
10920						return;
10921					}
10922
10923					gsap.fromTo( $wrap_inner, {
10924						opacity: 0,
10925					},{
10926						delay: duration,
10927						duration: 0.25,
10928						opacity: 1,
10929						ease: Circ.easeOut,
10930						onComplete: function(){
10931							$('> .heading-text-highlight-inner', $wrap).remove();
10932							$wrap_inner.html(worsSpan);
10933							removeWraps();
10934						}
10935					})
10936
10937				} else {
10938					gsap.fromTo( $target_fx, {
10939						transformOrigin: '50%',
10940						opacity: 0,
10941						scale: 0.875,
10942					},{
10943						opacity: 1,
10944						delay: duration,
10945						duration: 0.25,
10946						scale: 1,
10947						ease: Circ.easeOut,
10948						onComplete: function(){
10949							$('> .heading-text-highlight-inner', $wrap).remove();
10950							$wrap_inner.html(worsSpan);
10951							removeWraps();
10952						}
10953					});
10954				}
10955
10956			} else {
10957
10958				if ( !$wrap_inner.length ) {
10959					return;
10960				}
10961
10962				gsap.to( $wrap_inner, {
10963					duration: 0.4,
10964					opacity: 0,
10965					ease: Power1.easeOut,
10966					onComplete: function(){
10967						$wrap_inner.html(worsSpan);
10968						words_w = $wrap_inner.innerWidth();
10969
10970						gsap.to( $wrap_inner, {
10971							duration: 0.2,
10972							opacity: 1,
10973							ease: Power1.easeOut,
10974							onComplete: function(){
10975								$('> .heading-text-highlight-inner', $wrap).remove();
10976								$wrap_inner.html(worsSpan);
10977								removeWraps();
10978							}
10979						})
10980					}
10981				});
10982			}
10983
10984			if ( loop < arrTxt.length-1 ) {
10985				loop++;
10986			} else {
10987				loop = 0;
10988			}
10989
10990		};
10991
10992		textFadeOut = function($trgt){
10993			var $word_inner = $('.split-word-inner', $trgt),
10994				$wrap = $trgt.closest('.uncode-rotating-wrap'),
10995				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
10996				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
10997				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
10998
10999			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
11000
11001			var gsap_param = {
11002					delay: wait,
11003					duration: 0.25,
11004					y: fx === '' ? '10%' : '0%',
11005					opacity: 0,
11006					ease: Circ.easeOut,
11007					onStart: function(){
11008						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
11009							$highl = $('.heading-text-highlight-inner', $wrap);
11010							$highl.prependTo($wrap);
11011						}
11012					},
11013					onComplete: textFadeIn,
11014					onCompleteParams: [$trgt]
11015				};
11016
11017			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11018
11019			if ( fx === '' ) {
11020				gsap_param.y = '10%';
11021			} else if ( fx === 'zoom' ) {
11022				gsap_param.scale = '1.045';
11023			}
11024
11025			if ( !$target_fx.length ) {
11026				return;
11027			}
11028
11029			if ( $heading.data('waypoint') !== true ) {
11030				var textInView = new Waypoint.Inview({
11031					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11032					element: $heading[0],
11033					enter: function(direction) {
11034						$heading.data('waypoint',true);
11035						gsap.fromTo( $target_fx, {
11036							transformOrigin: '50%'
11037						}, gsap_param );
11038					}
11039				});
11040			} else {
11041				gsap.fromTo( $target_fx, {
11042					transformOrigin: '50%'
11043				}, gsap_param );
11044			}
11045		};
11046
11047		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11048			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
11049				var $el = model.view.$el,
11050					shortcode = model.attributes.shortcode;
11051
11052				UNCODE.rotatingTxt($el);
11053			});
11054		} else {
11055			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
11056				$heading.on('already-animated', function(){
11057					removeWraps();
11058					window.addEventListener('removeOldLines', function(){
11059						clearRequestTimeout(setCTA);
11060						setCTA = requestTimeout( removeWraps, 150 );
11061					});
11062				});
11063			} else {
11064				$(window).on('load', function(){
11065					removeWraps();
11066					window.addEventListener('removeOldLines', function(){
11067						clearRequestTimeout(setCTA);
11068						setCTA = requestTimeout( removeWraps, 150 );
11069					});
11070				});
11071			}
11072		}
11073	});
11074
11075};
11076
11077UNCODE.verticalText = function() {
11078	$(window).on('menuCanvasOpen', function(){
11079		$('.vertical-text--fixed').fadeOut(500);
11080		$('.horizontal-text--fixed').fadeOut(500);
11081	}).on('menuCanvasClose', function(){
11082		$('.vertical-text--fixed').fadeIn(500);
11083		$('.horizontal-text--fixed').fadeIn(500);
11084	});
11085
11086	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
11087	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
11088	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
11089	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
11090
11091	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
11092		window.addEventListener('scroll', function(e) {
11093			var totalPageHeight = document.body.scrollHeight;
11094			var scrollPoint = window.scrollY + window.innerHeight;
11095
11096			if (window.scrollY > 0) {
11097				showOnTopVerticalTexts.fadeOut();
11098				showOnTopHorizontalTexts.fadeOut();
11099			} else {
11100				showOnTopVerticalTexts.fadeIn();
11101				showOnTopHorizontalTexts.fadeIn();
11102			}
11103
11104			if (scrollPoint >= totalPageHeight) {
11105				hideOnBottomVerticalTexts.fadeOut();
11106				hideOnBottomHorizontalTexts.fadeOut();
11107			} else {
11108				hideOnBottomVerticalTexts.fadeIn();
11109				hideOnBottomHorizontalTexts.fadeIn();
11110			}
11111		}, false);
11112	}
11113};
11114
11115UNCODE.stickyScroll = function( $el ) {
11116	if ( typeof $el === 'undefined' || $el === null ) {
11117		$el = $('body');
11118	}
11119	var checkVisible = function( el, dir ) {
11120		if (typeof jQuery === "function" && el instanceof jQuery) {
11121			el = el[0];
11122		}
11123
11124		var off = 50;
11125		dir = typeof dir=='undefined' ? 'right' : dir;
11126		var rect = el.getBoundingClientRect();
11127
11128		return (
11129			(
11130				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11131				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11132				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
11133			) &&
11134			(
11135				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11136				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11137				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
11138				( rect.right <= window.innerWidth && rect.left >= 0 )
11139			)
11140		);
11141	};
11142
11143	var setItemsRelHeight = function(reset) {
11144		var $_el = $el;
11145		if ( $el.is('.index-scroll') ) {
11146			var $_el = $el.closest('.uncont');
11147		}
11148		$('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
11149			$.each($('.tmb', item), function(index, val) {
11150				if ( reset === true ) {
11151					$(val).css( 'visibility', 'hidden' );
11152				} else {
11153					$(val).css( 'visibility', 'visible' );
11154				}
11155			});
11156		});
11157		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
11158			$.each($('.tmb', item), function(index, val) {
11159				if ( reset === true ) {
11160					$(val).css( 'visibility', 'hidden' );
11161					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
11162				} else {
11163					var $rowParent = $(item).closest('.row-parent'),
11164						rowRatio = $rowParent.attr('data-height-ratio'),
11165						$rowInner = $(item).closest('.row-child'),
11166						rowRatioInner = $rowInner.attr('data-height'),
11167						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11168						$colContainer = $(item).closest('.uncell'),
11169						$uncont = $(item).closest('.uncont'),
11170						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
11171						safe_heigth = $(item).data('safe-height'),
11172						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
11173						offSet = $(item).offset().top - $uncont.offset().top,
11174						multiplier_h,
11175						data_viewport_h,
11176						body_border = $('.body-borders .top-border').outerHeight() * 2,
11177						remove_menu = $(item).data('vp-menu');
11178
11179					if ( rowRatio === 'full' || rowRatio === '' ) {
11180						rowRatio = 1;
11181					} else {
11182						rowRatio = rowRatio / 100;
11183					}
11184
11185					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
11186						rowRatio = rowRatio;
11187					} else {
11188						rowRatio = rowRatio * rowRatioInner / 100;
11189					}
11190
11191					winHeight = winHeight * rowRatio;
11192
11193					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11194						multiplier_h = parseInt($(item).attr('data-vp-height'));
11195					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
11196						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
11197					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
11198						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
11199					}
11200
11201					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
11202						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
11203						if ( remove_menu === true ) {
11204							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
11205						}
11206						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
11207					} else {
11208						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
11209					}
11210
11211				}
11212			});
11213		});
11214		$('.index-scroll', $_el).each(function(i, item){
11215			var $uncoltable = $(item).closest('.uncoltable'),
11216				$rowParent = $(item).closest('.row-parent'),
11217				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11218				body_border = $('.body-borders .top-border').outerHeight() * 2,
11219				$index_row = $('.index-row', item),
11220				safe_heigth = $index_row.data('safe-height'),
11221				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
11222			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
11223				var data_viewport_h = winHeight - ( paddingRow + body_border );
11224				$uncoltable.css({
11225					'min-height': data_viewport_h
11226				});
11227			} else {
11228				$uncoltable.css({
11229					'min-height': 'auto'
11230				});
11231			}
11232		});
11233
11234	}
11235	setItemsRelHeight();
11236
11237	var $index_scrolls = $('.index-scroll', $el);
11238
11239	$index_scrolls.each(function(key, value){
11240		var $index = $(this),
11241			$parent_row = $index.closest('.vc_row[data-parent]'),
11242			$index_row = $('.index-row', $index),
11243			dir = $index_row.attr('data-direction');
11244		dir = typeof dir === 'undefined' ? 'right' : dir;
11245
11246		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
11247	});
11248
11249	var $horScrolls = $('.unscroll-horizontal', $el);
11250
11251	if ( $horScrolls.length ) {
11252
11253		$('body').addClass('scrolling-trigger');
11254
11255		$horScrolls.each(function(key, value){
11256			var $section = $(this),
11257				$index_scroll = $('.index-scroll', $section),
11258				$index_row = $('.index-row', $index_scroll),
11259				dir = $section.attr('data-direction'),
11260				wrap = $index_row.attr('data-wrap'),
11261				$pinWrap,
11262				$pinTrigger;
11263
11264			dir = typeof dir === 'undefined' ? 'right' : dir;
11265			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
11266			$pinWrap = $('<div class="pin-wrap" />');
11267			if ( SiteParameters.is_frontend_editor ) {
11268				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
11269				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
11270			} else {
11271				if ( wrap === 'column' ) {
11272					$index_scroll.wrapInner( $pinWrap );
11273				} else {
11274					$('> .row', $section).wrap( $pinWrap );
11275				}
11276				$section.wrapInner( $pinTrigger );
11277			}
11278
11279		});
11280
11281		var $pinWraps = $('.pin-wrap', $el);
11282
11283		var horScrollSizes = function(){
11284
11285			$pinWraps.each(function(key, val){
11286				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
11287					$pinTrigger = $pinWrap.closest('.pin-trigger'),
11288					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
11289					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
11290					$boxContainer = $('.box-container'),
11291					box_m = $boxContainer.css('margin-left'),
11292					st_active = true;
11293
11294				var setHorW,
11295				horWidth = function(){
11296					$index_scroll.each(function(){
11297						var $this = $(this),
11298							$index_row = $('.index-row', $this),
11299							$rowContainer = $index_row.closest('.vc_row'),
11300							$rowInner = $index_row.closest('.wpb_row'),
11301							$rowParent = $index_row.closest('.row-parent'),
11302							$tmbs = $('.tmb', $index_row),
11303							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
11304							$uncont = $index_row.closest('.uncont'),
11305							$parent_col = $index_row.closest('.wpb_column'),
11306							col_w = $uncont.width(),
11307							data_lg = parseFloat( $index_row.attr('data-lg') ),
11308							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
11309							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
11310							tmb_w;
11311
11312						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
11313						tmb_w = ( col_w + padding_tmb ) / data_lg;
11314
11315						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
11316							tmb_w = ( col_w + padding_tmb ) / data_sm;
11317						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
11318							tmb_w = ( col_w + padding_tmb ) / data_md;
11319						}
11320
11321						if ( !isNaN(tmb_w) ) {
11322							$tmbs.css({
11323								'width': tmb_w
11324							});
11325						}
11326
11327						$tmbs.css({
11328							'visibility': 'visible'
11329						});
11330
11331					});
11332				};
11333
11334				horWidth();
11335				clearRequestTimeout(setHorW);
11336				setHorW = requestTimeout( function(){
11337					setItemsRelHeight();
11338					horWidth();
11339				}, 100 );
11340
11341				if ( SiteParameters.is_frontend_editor ) {
11342					return;
11343				}
11344
11345				var $vmenu = $('body.vmenu .vmenu-container'),
11346					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
11347					winWidth = window.innerWidth - vmenuW,
11348					$tmb = $('.tmb', $index_scroll).eq(0),
11349					paddingRight = parseFloat( $tmb.css('padding-right') ),
11350					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ),
11351					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
11352					scroll_anim;
11353
11354				if ( $('body').hasClass('rtl') ) {
11355					if ( dir === 'left' ) {
11356						scroll_anim = gsap.fromTo( $pinWrap, {
11357							x: stickyScrollLength
11358						},{
11359							x: 0,
11360							ease: "none"
11361						});
11362					} else {
11363						scroll_anim = gsap.fromTo( $pinWrap, {
11364							x: 0
11365						},{
11366							x: stickyScrollLength,
11367							ease: "none"
11368						});
11369					}
11370				} else {
11371					if ( dir === 'left' ) {
11372						scroll_anim = gsap.fromTo( $pinWrap, {
11373							x: -stickyScrollLength
11374						},{
11375							x: 0,
11376							ease: "none"
11377						});
11378					} else {
11379						scroll_anim = gsap.fromTo( $pinWrap, {
11380							x: 0
11381						},{
11382							x: -stickyScrollLength,
11383							ease: "none"
11384						});
11385					}
11386				}
11387
11388				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
11389					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
11390				}
11391
11392				var animationIncrease;
11393
11394				var checkForAnimations = function(){
11395					animationIncrease = 0
11396					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11397						var _this = this,
11398							isScrolling;
11399						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
11400							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11401							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11402							requestTimeout(function() {
11403								$(_this).addClass('start_animation');
11404							}, delayAttr + animationIncrease);
11405							animationIncrease += 150;
11406						}
11407					});
11408				};
11409				checkForAnimations();
11410
11411				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
11412				var start = 0;
11413
11414				var horST = ScrollTrigger.create({
11415					id: "stickySectionScrolling" + key,
11416					scrub: true,
11417					trigger: $pinTrigger[0],
11418					pin: true,
11419					anticipatePin: 1,
11420					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
11421					end: function() { return "+="+stickyScrollLength; },
11422					animation: scroll_anim,
11423					ease: Sine.easeOut,
11424					onUpdate: checkForAnimations,
11425					invalidateOnRefresh: true,
11426					onEnter: function(){
11427						$pinTrigger.addClass('enter-st');
11428					},
11429					onEnterBack: function(){
11430						$pinTrigger.addClass('enter-st');
11431					},
11432					onLeave: function(){
11433						$pinTrigger.removeClass('enter-st');
11434					},
11435					onLeaveBack: function(){
11436						$pinTrigger.removeClass('enter-st');
11437					}
11438				});
11439
11440				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
11441				window.dispatchEvent(new CustomEvent('boxResized'));
11442
11443				var testSecondTrigger = function(){
11444					animationIncrease = 0
11445					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11446						var _this = this;
11447						if ( checkVisible(_this) ) {
11448							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11449							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11450							requestTimeout(function() {
11451								$(_this).addClass('start_animation');
11452							}, delayAttr + animationIncrease);
11453							animationIncrease += 150;
11454						}
11455					});
11456
11457				};
11458
11459				var verST = ScrollTrigger.create({
11460					id: "verticalSectionScrolling" + key,
11461					trigger: $pinTrigger[0],
11462					start: "top center",
11463					end: function() { return "+="+UNCODE.wheight; },
11464					onUpdate: testSecondTrigger,
11465					invalidateOnRefresh: true
11466				});
11467
11468				var setCTA,
11469
11470				dis_enable_ST = function(){
11471					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
11472						horST.kill();
11473						verST.kill();
11474						$pinTrigger.addClass('disabled');
11475						st_active = false;
11476					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
11477						horST.kill();
11478						verST.kill();
11479						$pinTrigger.addClass('disabled');
11480						st_active = false;
11481					}
11482				};
11483
11484				$(window).on('resize load', function() {
11485					clearRequestTimeout(setCTA);
11486					setCTA = requestTimeout(function() {
11487						dis_enable_ST();
11488						checkForAnimations();
11489					}, 500);
11490				});
11491
11492			});
11493		};
11494
11495		$(window).on( 'load', function(){
11496			horScrollSizes();
11497		});
11498		var setResize,
11499			setReLayout,
11500			doubleResize = true,
11501			oldW = UNCODE.wwidth,
11502			isResized = true;
11503		$(window).on( 'load', function(){
11504			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
11505				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11506				Array.prototype.forEach.call($row_inners, function(el) {
11507					el.style.height = '';
11508					el.style.marginBottom = '';
11509				});
11510				setItemsRelHeight();
11511				horScrollSizes();
11512				ScrollTrigger.refresh();
11513			}
11514			var carousel = document.querySelector(".owl-carousel"),
11515				grid = document.querySelector(".isotope-container"),
11516				stickyAll = document.querySelectorAll(".index-scroll");
11517
11518			if ( stickyAll.length ) {
11519				var sticky = stickyAll[(stickyAll.length-1)];
11520			}
11521
11522			if ( typeof sticky !== "undefined" ) {
11523
11524				if ( typeof carousel !== "undefined" && carousel !== null ) {
11525					var carousel_position = sticky.compareDocumentPosition(carousel);
11526				}
11527				if ( typeof grid !== "undefined" && grid !== null ) {
11528					var grid_position = sticky.compareDocumentPosition(grid);
11529				}
11530
11531				if ( carousel_position === 2 || grid_position === 2 ) {
11532					setTimeout(function(){
11533						ScrollTrigger.refresh();
11534					}, 500);
11535				}
11536
11537			}
11538			
11539		});
11540		$(window).on( 'resize orientationchange', function(){
11541			isResized = (oldW !== UNCODE.wwidth);
11542			if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) {
11543				return;
11544			} else {
11545				oldW = UNCODE.wwidth;
11546			}
11547			setItemsRelHeight(true);
11548			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11549			Array.prototype.forEach.call($row_inners, function(el) {
11550				el.style.height = '';
11551				el.style.marginBottom = '';
11552			});
11553			clearRequestTimeout(setResize);
11554			setResize = requestTimeout( function(){
11555				setItemsRelHeight();
11556				horScrollSizes();
11557				ScrollTrigger.refresh();
11558				if ( doubleResize === true ) {
11559					window.dispatchEvent(new Event('resize'));
11560					doubleResize = false;
11561				} else {
11562					doubleResize = true;
11563				}
11564				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, isResized);
11565			}, 100 );
11566		});
11567
11568		var show_pins = function(){
11569			$('.index-scroll').css({'opacity':'1'});
11570		};
11571		ScrollTrigger.addEventListener("refresh", show_pins);
11572		$(window).on( 'uncode.re-layout', function(){
11573			//$('.index-scroll').css({'opacity':'0'});
11574			$('.pin-spacer').each(function(){
11575				var space_h = $(this).outerHeight(),
11576					$row = $(this).closest('.row-container');
11577				$row.css({
11578					'height': space_h,
11579					'overflow': 'hidden'
11580				});
11581			});
11582			ScrollTrigger.refresh(true);
11583			clearRequestTimeout(setReLayout);
11584			setReLayout = requestTimeout( function(){
11585				$('.row-container').each(function(){
11586					$(this).css({
11587						'height': '',
11588						'overflow': ''
11589					});
11590				});
11591			}, 1000);
11592		});
11593	}
11594
11595};
11596
11597UNCODE.stickyTrigger = function( $el ) {
11598	if ( SiteParameters.is_frontend_editor ) {
11599		return false;
11600	}
11601
11602	var stickyTrigger = function(){
11603		var stickyTrick = $('.sticky-trigger').each(function(){
11604			var $sticky = $(this),
11605				$inside = $('> div', $sticky),
11606				insideH = $inside.outerHeight(),
11607				$row = $sticky.closest('.vc_row'),
11608				$uncont = $sticky.closest('.uncont'),
11609				rowBottom,
11610				uncontBottom ,
11611				diffBottom;
11612
11613			ScrollTrigger.create({
11614				trigger: $sticky,
11615				start: function(){ return "top center-=" + insideH/2; },
11616				endTrigger: $row,
11617				end:  function(){
11618					rowBottom = $row.offset().top + $row.outerHeight();
11619					uncontBottom = $uncont.offset().top + $uncont.outerHeight();
11620					diffBottom = rowBottom - uncontBottom;
11621					return "bottom center+=" + ( insideH/2 + diffBottom );
11622				},
11623				anticipatePin: true,
11624				pin: true,
11625				pinSpacing: false,
11626				scrub: true,
11627				invalidateOnRefresh: true,
11628			});
11629
11630		});
11631	},
11632	setResizeSticky;
11633
11634	$(window).on( 'load', function(){
11635		stickyTrigger();
11636		var carousel = document.querySelector(".owl-carousel"),
11637			grid = document.querySelector(".isotope-container"),
11638			stickyAll = document.querySelectorAll(".sticky-trigger");
11639
11640		if ( stickyAll.length ) {
11641			var sticky = stickyAll[(stickyAll.length-1)];
11642		}
11643
11644		if ( typeof sticky !== "undefined" ) {
11645
11646			if ( typeof carousel !== "undefined" && carousel !== null ) {
11647				var carousel_position = sticky.compareDocumentPosition(carousel);
11648			}
11649			if ( typeof grid !== "undefined" && grid !== null ) {
11650				var grid_position = sticky.compareDocumentPosition(grid);
11651			}
11652
11653			if ( carousel_position === 2 || grid_position === 2 ) {
11654				setTimeout(function(){
11655					ScrollTrigger.refresh();
11656				}, 500);
11657			}
11658
11659		}
11660	});
11661
11662	var oldW = UNCODE.wwidth;
11663	$(window).on( 'resize uncode.re-layout', function(e){
11664		clearRequestTimeout(setResizeSticky);
11665		if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
11666			return;
11667		} else {
11668			oldW = UNCODE.wwidth;
11669		}
11670		setResizeSticky = requestTimeout( function(){
11671			stickyTrigger();
11672			ScrollTrigger.refresh();
11673		}, 1000 );
11674	});
11675
11676};
11677
11678UNCODE.revslider = function() {
11679	var revSliderIn = function(){
11680		$('rs-module').each(function(){
11681			var $slider = $(this);
11682
11683			$slider.on('revolution.slide.onloaded', function(e, data){
11684				if ( $(e.currentTarget).closest(".header-revslider").length ) {
11685					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
11686						scrolltop = $(document).scrollTop();
11687					if ( style != undefined ) {
11688						UNCODE.switchColorsMenu(scrolltop, style);
11689					}
11690				}
11691			});
11692
11693			$slider.on('revolution.slide.onchange', function(e, data){
11694				if ( $(e.currentTarget).closest(".header-revslider").length ) {
11695					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
11696						scrolltop = $(document).scrollTop();
11697					if ( style != undefined ) {
11698						UNCODE.switchColorsMenu(scrolltop, style);
11699					}
11700				}
11701			});
11702
11703		});
11704	};
11705	revSliderIn();
11706	$(window).on("load", revSliderIn );
11707};
11708UNCODE.layerslider = function() {
11709	$(window).on("load", function() {
11710
11711		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
11712
11713			var slideData = slider.slides.current.data,
11714				scrolltop = $(document).scrollTop();
11715			if( slideData && slideData.skin ) {
11716
11717				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
11718
11719			}
11720		});
11721
11722	});
11723};
11724
11725UNCODE.ajax_filters = function () {
11726	var isAjaxing = false;
11727
11728/*************************
11729 *
11730 * Filters Menu and Widgets Area
11731 *
11732 ************************/
11733
11734 	var clear_clicked = false;
11735
11736 	var init_ajax_grid = function(){
11737
11738		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
11739		$grids.each(function(index, val){
11740			var $body = $('body'),
11741				$grid = $(val).addClass('init-ajax-grid'),
11742				starting_point = $grid.attr('data-toggle'),
11743				$trigger = $('.uncode-toggle-ajax-filters', $grid),
11744				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
11745				$isotope_wrapper = $('.isotope-wrapper', $grid),
11746				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
11747				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
11748				$footprint = $('.ajax-filter-footprint', $grid),
11749				sidebar_w,
11750				data_w = parseFloat( $sidebar.attr('data-max-width') ),
11751				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
11752				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
11753				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
11754				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
11755				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
11756				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
11757				sidew,
11758				$inside_row = $('> .row-parent', $vc_row),
11759				bg_row,
11760				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
11761				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
11762				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
11763				sidebar_overlay = false,
11764				sidebar_hover = false,
11765				switchMobile = false,
11766				scrollTop;
11767
11768			if ( $vc_row.attr('class') ) {
11769				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
11770			}
11771
11772			if ( bg_row != null ) {
11773				$side_header.add($side_footer).addClass(bg_row[0]);
11774			}
11775
11776			$trigger.add($apply_filters).on('click', function(e){
11777				e.preventDefault();
11778				e.stopPropagation();
11779				$grid = $('.ajax-grid-system').eq(0);
11780				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
11781				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
11782				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
11783				sidebar_w = $sidebar_wrapper.width();
11784				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
11785				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
11786					$(this).trigger('uncode-ajax-clear-filters');
11787				}
11788				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
11789					$grid.toggleClass('ajax-hide-filters-blanks');
11790					$sidebar.slideToggle({
11791						duration: 400,
11792						easing: 'easeOutQuad',
11793					});
11794				} else {
11795					$grid.removeClass('ajax-hide-filters-blanks');
11796					$grid.toggleClass('ajax-hide-filters');
11797					if ( $grid.hasClass('ajax-hide-filters') ) {
11798						$body.addClass('ajax-hide-filters');
11799					} else {
11800						scrollTop = $('html, body').scrollTop();
11801						$body.removeClass('ajax-hide-filters');
11802					}
11803				}
11804				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
11805					$('html, body').scrollTop(scrollTop);
11806				}
11807				return false;
11808			});
11809
11810			$close_btn.on('click', function(e){
11811				e.preventDefault();
11812				$grid = $('.ajax-grid-system').eq(0);
11813				$grid.addClass('ajax-hide-filters');
11814				if ( $grid.hasClass('ajax-hide-filters') ) {
11815					$body.addClass('ajax-hide-filters');
11816				} else {
11817					scrollTop = $('html, body').scrollTop();
11818					$body.removeClass('ajax-hide-filters');
11819				}
11820				$('html, body').scrollTop(scrollTop);
11821			});
11822
11823			$sidebar_wrapper.on('mouseover',function(){
11824				sidebar_hover = true;
11825			}).on('mouseout', function(){
11826				sidebar_hover = false;
11827			});
11828
11829			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
11830				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
11831					return;
11832				}
11833				if (undefined !== from && from === 'select_active_attributes') {
11834					return;
11835				}
11836				if ($(e.target).closest('.select2-container--open').length ) {
11837					return;
11838				}
11839				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
11840					$grid.add($body).addClass('ajax-hide-filters');
11841				}
11842			});
11843
11844			$sorting_trgr.on('click', function(e) {
11845				e.preventDefault();
11846			});
11847
11848			var inside_width = function(){
11849				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
11850				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
11851				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
11852				$inside_row = $('> .row-parent', $vc_row);
11853				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
11854					sidew = $sidebar.width();
11855					$inside_row.css({
11856						width: sidew
11857					});
11858				} else {
11859					$inside_row.css({
11860						width: ''
11861					});
11862				}
11863			};
11864			inside_width();
11865
11866			var ajax_sidebar_position = function(e, f_editor){
11867				$grid = $('.ajax-grid-system').eq(0);
11868				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
11869				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
11870				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
11871				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
11872				$inside_row = $('> .row-parent', $vc_row);
11873				scrollTop = $('html, body').scrollTop();
11874				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
11875					$grid.add($body).addClass('ajax-hide-filters');
11876					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
11877					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
11878					sidebar_overlay = true;
11879					$body.addClass('ajax-filter-sidebar-overlay');
11880					$sidebar_wrapper.addClass(skin);
11881					var sideHeadH = $side_header.outerHeight(),
11882						sideFooterH = $side_footer.outerHeight();
11883					if ( data_w !== '' && data_w > 0 ) {
11884						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11885							$sidebar.css({
11886								'max-width': data_w
11887							});
11888						} else {
11889							$sidebar.css({
11890								'max-width':'none'
11891							});
11892						}
11893					}
11894					$vc_row.css({
11895						'padding-top':sideHeadH,
11896						'padding-bottom':sideFooterH
11897					});
11898					var sidew = $sidebar.width();
11899					$inside_row.css({
11900						width: sidew
11901					});
11902					switchMobile = true;
11903				} else {
11904					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
11905						scrollTop = $('html, body').scrollTop();
11906						$grid.add($body).removeClass('ajax-hide-filters');
11907					}
11908					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
11909						$grid.addClass('ajax-hide-filters-blanks');
11910						$sidebar.hide();
11911					}
11912					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
11913					$('.ajax-sidebar-placeholder', $grid).remove();
11914					sidebar_overlay = false;
11915					$body.removeClass('ajax-filter-sidebar-overlay');
11916					$sidebar_wrapper.removeClass(skin);
11917					if ( data_w !== '' && data_w > 0 ) {
11918						$sidebar.css({
11919							'max-width':'none'
11920						});
11921					}
11922					$vc_row.css({
11923						'padding-top':0,
11924						'padding-bottom':0,
11925					});
11926
11927					$inside_row.css({
11928						width: ''
11929					});
11930
11931					if ( f_editor === true ) {
11932						UNCODE.ajax_filters();
11933					}
11934
11935					switchMobile = false;
11936				}
11937				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
11938					$('html, body').scrollTop(scrollTop);
11939				}
11940			};
11941
11942			var sidebar_width = function(){
11943				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
11944					sidebar_w = $footprint.width();
11945					$sidebar.css({ width: sidebar_w });
11946				} else {
11947					$sidebar.css({ width: '' });
11948				}
11949			};
11950			sidebar_width();
11951
11952			if ( SiteParameters.is_frontend_editor ) {
11953				ajax_sidebar_position();
11954			}
11955
11956			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
11957				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
11958					ajax_sidebar_position(e);
11959				}
11960				sidebar_width();
11961			});
11962
11963			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
11964				ajax_sidebar_position(e, true);
11965			});
11966
11967			$isotope_wrapper.on('transitionend', function(e){
11968				if ( $(e.target).hasClass('isotope-wrapper') ) {
11969					window.dispatchEvent(new CustomEvent('boxResized'));
11970				}
11971				return false;
11972			});
11973
11974			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
11975				var $grid = $('.ajax-grid-system').eq(0);
11976				$grid.addClass('ajax-hide-filters');
11977			}
11978
11979		});
11980	};
11981
11982	init_ajax_grid();
11983	$(document).on('uncode-ajax-filtered', init_ajax_grid);
11984
11985/*************************
11986 *
11987 * Hover hack
11988 *
11989 ************************/
11990 	var widget_hover_hack = function() {
11991 		$('.widget, .uncode_widget').each(function(){
11992			var $widget = $(this),
11993				class_w = $widget.attr('class'),
11994				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
11995				$footer = $widget.closest('#colophon');
11996
11997			if ( class_w.indexOf('widget_yith') > 0 ) {
11998				return true;
11999			}
12000
12001			$lis.each(function(){
12002 				var $li = $(this),
12003 					$a = $('a', $li),
12004 					$label = $a.closest('label');
12005
12006				if ( !$footer.length ) {
12007					$li.addClass('no-evts');
12008				}
12009
12010				if ( ! $('span', $a).length ) {
12011 					$li.addClass( 'li-hover' );
12012 				}
12013
12014 				$('li', $li).hover(function(e){
12015 					$(e.target).parents('li').each(function(){
12016 						$(this).addClass( 'parent-li-hover' );
12017 					});
12018					}, function (e) {
12019 					$(e.target).parents('li').each(function(key, val){
12020 						if ( key === 0) {
12021	 						$(val).removeClass( 'parent-li-hover' );
12022	 					}
12023 					});
12024 				});
12025
12026				$li.off('mouseup').on('mouseup', function (e) {
12027					if (e.which !== 3) {
12028						e.stopPropagation();
12029						var $a = $('a', this).first();
12030						$a[0].click();
12031					}
12032	 			});
12033 			});
12034 		});
12035 	}
12036	if (SiteParameters.disable_hover_hack !== '1') {
12037		widget_hover_hack();
12038		$(document).on('uncode-ajax-filtered', widget_hover_hack);
12039	}
12040
12041/*************************
12042 *
12043 * Init Filters
12044 *
12045 ************************/
12046
12047	function init_filters() {
12048		$(document).on('click', '.term-filter-link', function(e) {
12049			var _this = $(this);
12050			var widget = _this.closest('.uncode_widget');
12051			var container = get_filters_container();
12052
12053			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
12054				return true;
12055			}
12056
12057			e.preventDefault();
12058
12059			if (widget.hasClass('widget-ajax-filters--checkbox')) {
12060				_this.parent().find('input[type="checkbox"]').trigger('click');
12061			} else {
12062				if (_this.hasClass('term-filter-link--active')) {
12063					_this.removeClass('term-filter-link--active');
12064				} else {
12065					_this.addClass('term-filter-link--active');
12066
12067					if (widget.hasClass('widget-ajax-filters--single')) {
12068						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
12069					}
12070				}
12071
12072				var url = _this.attr('href');
12073
12074				reload_items(container, url, true);
12075			}
12076		});
12077
12078		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
12079			var _this = $(this);
12080			var widget = _this.closest('.uncode_widget');
12081			var link = _this.closest('.term-filter').find('.term-filter-link');
12082			var url = link.attr('href');
12083			var container = get_filters_container();
12084
12085			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
12086				window.location = url;
12087				return;
12088			}
12089
12090			if (widget.hasClass('widget-ajax-filters--single')) {
12091				widget.find('input[type="checkbox"]').each(function() {
12092					if (_this.attr('id') !== $(this).attr('id')) {
12093						$(this).prop('checked', false);
12094						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
12095					}
12096				});
12097			}
12098
12099			if (_this.prop('checked')) {
12100				link.addClass('term-filter-link--active');
12101			} else {
12102				link.removeClass('term-filter-link--active');
12103			}
12104
12105			reload_items(container, url, true);
12106		});
12107
12108		$(document).on('change', 'select.select--term-filters', function(e) {
12109			var _this = $(this);
12110			var selected = _this.find('option:selected');
12111			var option = $(selected);
12112			var url = option.attr('data-term-filter-url');
12113			var container = get_filters_container();
12114			var widget = _this.closest('.uncode_widget');
12115
12116			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
12117				window.location = url;
12118			} else {
12119				reload_items(container, url, true);
12120			}
12121		});
12122
12123		$(document).on('click', '.filter-list__link', function(e) {
12124			if (SiteParameters.is_frontend_editor) {
12125				return false;
12126			}
12127
12128			e.preventDefault();
12129
12130			var _this = $(this);
12131			var container = get_filters_container();
12132			var url = _this.attr('href');
12133			reload_items(container, url, true);
12134		});
12135
12136		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
12137			var _this = $(this);
12138			var container = get_filters_container();
12139			var url = _this.attr('href');
12140			reload_items(container, url, true);
12141		});
12142
12143		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
12144
12145			var _this = $(this);
12146			var container = get_filters_container();
12147			var url = _this.attr('href');
12148
12149			if ( container.length ) {
12150				e.preventDefault();
12151				reload_items(container, url, true);
12152			}
12153		});
12154
12155		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
12156			var _this = $(this);
12157			var container = get_filters_container();
12158
12159			if (container.length > 0) {
12160				e.preventDefault();
12161
12162				var min_price = $('#min_price').val();
12163				var max_price = $('#max_price').val();
12164				var location = window.location;
12165				var url = location.href;
12166				var page_uri = location.origin + location.pathname;
12167				var is_filtered = page_uri !== url;
12168
12169				if (is_filtered) {
12170					url = remove_parameter_from_url(url, 'min_price');
12171					url = remove_parameter_from_url(url, 'max_price');
12172				}
12173
12174				var concat = page_uri === url ? '?' : '&';
12175				var params = {'min_price': min_price, 'max_price': max_price};
12176
12177				url = url + concat + $.param(params);
12178
12179				reload_items(container, url, true);
12180			}
12181		});
12182
12183		var search_timer;
12184
12185		$(document).on('keyup', '.term-filters-search-input', function(e) {
12186			var _this = $(this);
12187			var container = get_filters_container();
12188			var value = _this.val();
12189
12190			if (search_timer) {
12191				clearTimeout(search_timer);
12192			}
12193
12194			search_timer = setTimeout(function() {
12195				update_search_url(container, value);
12196			}, 500);
12197		});
12198	}
12199
12200	function update_search_url(container, search_value) {
12201		var location = window.location;
12202		var url = location.href;
12203		var page_uri = location.origin + location.pathname;
12204		var is_filtered = page_uri !== url;
12205		var key_search = SiteParameters.ajax_filter_key_search;
12206		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
12207
12208		if (is_filtered) {
12209			url = remove_parameter_from_url(url, key_search);
12210			url = remove_parameter_from_url(url, key_unfilter);
12211		}
12212
12213		if (search_value) {
12214			var concat = page_uri === url ? '?' : '&';
12215			var params = {};
12216
12217			params[key_search] = search_value;
12218			params[key_unfilter] = 1;
12219			url = url + concat + $.param(params);
12220		} else {
12221			url = remove_parameter_from_url(url, key_search);
12222		}
12223
12224		reload_items(container, url, true);
12225	}
12226
12227	function remove_parameter_from_url(url, parameter) {
12228		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
12229	}
12230
12231	function get_filters_container() {
12232		var container = $('.ajax-grid-system');
12233
12234		if (container.length == 0) {
12235			container = $('.ajax-filters');
12236		}
12237
12238		return container;
12239	}
12240
12241	function update_widgets_state(widgets_states, container) {
12242		for (var i = widgets_states.length - 1; i >= 0; i--) {
12243			var state = widgets_states[i];
12244
12245			if (!state.collapse) {
12246				continue;
12247			}
12248
12249			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
12250
12251			if (state.open) {
12252				new_widget.find('.widget-title').addClass('open');
12253				if (state.css) {
12254					new_widget.find('.widget-collapse-content').attr('style', state.css);
12255				}
12256			} else {
12257				new_widget.find('.widget-title').removeClass('open');
12258				if (state.css) {
12259					new_widget.find('.widget-collapse-content').attr('style', state.css);
12260				}
12261			}
12262		}
12263	}
12264
12265	// Reload items via AJAX
12266	function reload_items(container, url, push) {
12267		if (isAjaxing) {
12268			return
12269		};
12270
12271		isAjaxing = true;
12272
12273		container.addClass('grid-filtering');
12274
12275		$.ajax({
12276			url     : url,
12277			success : function(response) {
12278				if (!response) {
12279					return;
12280				}
12281
12282				$(document).trigger('uncode-ajax-pre-filtered');
12283
12284				var container_id = container.attr('id');
12285				var pagination = $('.row-navigation');
12286
12287				if (container_id) {
12288					var container_to_append = $(response).find('#' + container_id);
12289					var pagination_to_append = $(response).find('.row-navigation');
12290					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
12291
12292					// Remember open/closed widgets
12293					var widgets = $('.uncode_widget');
12294					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
12295					var widgets_states = [];
12296
12297					widgets.each(function() {
12298						var widget = $(this);
12299						var id = widget.attr('data-id');
12300						var state = {
12301							'id': id,
12302							'collapse': false,
12303							'open': false,
12304							'css': false,
12305						};
12306
12307						var collapse_wrapper = widget.find('.widget-collapse-content');
12308
12309						if (collapse_wrapper.length > 0) {
12310							state.collapse = true;
12311
12312							var collapse_wrapper_css = collapse_wrapper.attr('style');
12313							var title = widget.find('.widget-title');
12314
12315							state.css = collapse_wrapper_css;
12316
12317							if (title.hasClass('open')) {
12318								state.open = true;
12319							} else {
12320								state.open = false;
12321							}
12322						}
12323
12324						widgets_states.push(state);
12325					});
12326
12327					// Update widgets state
12328					if (offcanvas_sidebar_wrapper.length === 0) {
12329						update_widgets_state(widgets_states, container_to_append);
12330					}
12331
12332					// Update default sidebar state
12333					if (!container.hasClass('ajax-hide-filters')) {
12334						container_to_append.removeClass('ajax-hide-filters');
12335					}
12336
12337					// Update horizontal sidebar
12338					if (!container.hasClass('ajax-hide-filters-blanks')) {
12339						container_to_append.removeClass('ajax-hide-filters-blanks');
12340					}
12341					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
12342					if (horizontal_sidebar_wrapper.length > 0) {
12343						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
12344						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
12345						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
12346						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
12347
12348						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
12349						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
12350					}
12351
12352					// Append container
12353					container.replaceWith(container_to_append);
12354
12355					// Hide first thumbnail until the new srcset is loaded
12356					if (SiteParameters.dynamic_srcset_active === '1') {
12357						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
12358					}
12359
12360					// Remove loading attribute to images
12361					container_to_append.find('img').attr('loading', '');
12362
12363					// Append pagination
12364					if (pagination.length > 0) {
12365						if (pagination_to_append.length > 0) {
12366							pagination.html(pagination_to_append.html());
12367						} else {
12368							pagination.html('');
12369						}
12370					} else {
12371						if (pagination_to_append.length > 0) {
12372							$('.post-wrapper').append(pagination_to_append);
12373						}
12374					}
12375
12376					// Update off canvas sidebar (mobile and overlay)
12377					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
12378
12379					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
12380						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
12381						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
12382						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
12383						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
12384
12385						// Update widgets state
12386						update_widgets_state(widgets_states, sidebar_to_append);
12387
12388						// Update sidebar
12389						sidebar_container.html(sidebar_to_append.html());
12390					}
12391
12392					if (push) {
12393						UNCODE.lastURL = url;
12394						window.history.pushState(
12395							{ pageTitle: document.title },
12396							'',
12397							url
12398						);
12399					}
12400
12401					if (typeof UNCODE.isotopeLayout !== 'undefined') {
12402						UNCODE.isotopeLayout();
12403					}
12404					if (typeof UNCODE.justifiedGallery !== 'undefined') {
12405						UNCODE.justifiedGallery();
12406					}
12407					if (typeof UNCODE.cssGrid !== 'undefined') {
12408						UNCODE.cssGrid();
12409					}
12410					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
12411						UNCODE.lightbox();
12412					}
12413					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
12414						UNCODE.lightgallery();
12415					}
12416					if (typeof UNCODE.carousel !== 'undefined') {
12417						UNCODE.carousel($('body'));
12418					}
12419					UNCODE.animations();
12420					if (typeof UNCODE.filters !== 'undefined') {
12421						UNCODE.filters();
12422					}
12423					if (typeof UNCODE.widgets !== 'undefined') {
12424						UNCODE.widgets();
12425					}
12426
12427					if (SiteParameters.dynamic_srcset_active === '1') {
12428						UNCODE.refresh_dynamic_srcset_size();
12429					}
12430
12431					if (typeof UNCODE.menuSmartInit !== 'undefined') {
12432						UNCODE.menuSmartInit();
12433					}
12434
12435					if (typeof UNCODE.parallax !== 'undefined') {
12436						UNCODE.parallax();
12437					}
12438
12439					maybe_scroll_to_top();
12440
12441					var woo_select2_cats = $('.dropdown_product_cat');
12442
12443					if (woo_select2_cats.length > 0) {
12444						woo_select2_cats.on( 'change', function() {
12445							if ( $(this).val() != '' ) {
12446								var this_page = '';
12447								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
12448								if ( home_url.indexOf( '?' ) > 0 ) {
12449									this_page = home_url + '&product_cat=' + $(this).val();
12450								} else {
12451									this_page = home_url + '?product_cat=' + $(this).val();
12452								}
12453								location.href = this_page;
12454							} else {
12455								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
12456							}
12457						});
12458
12459						if ( $().selectWoo ) {
12460							var wc_product_cat_select = function() {
12461								woo_select2_cats.selectWoo( {
12462									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
12463									minimumResultsForSearch: 5,
12464									width: '100%',
12465									allowClear: true,
12466									language: {
12467										noResults: function() {
12468											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
12469										}
12470									}
12471								} );
12472							};
12473							wc_product_cat_select();
12474						}
12475					}
12476
12477					$(document).trigger('uncode-ajax-filtered');
12478					$(document.body).trigger('init_price_filter');
12479					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
12480
12481					isAjaxing = false;
12482				}
12483			},
12484			error: function() {
12485				container.removeClass('grid-filtering');
12486
12487				isAjaxing = false;
12488
12489				if (SiteParameters.enable_debug == true) {
12490					// This console log is disabled by default
12491					// So nothing is printed in a typical installation
12492					//
12493					// It can be enabled for debugging purposes setting
12494					// the 'uncode_enable_debug_on_js_scripts' filter to true
12495					console.log('There was an error retrieving the products');
12496				}
12497			}
12498		});
12499	}
12500
12501	// Scroll to top after filtering
12502	function maybe_scroll_to_top() {
12503		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
12504
12505		if (offcanvas_sidebar_wrapper.length > 0) {
12506			return;
12507		}
12508
12509		var container = get_filters_container();
12510		var bound = container[0].getBoundingClientRect();
12511
12512		if (bound.y < 0) {
12513			$(window).scrollTop(container.offset().top);
12514		}
12515	}
12516
12517	// Back/forward browser buttons
12518	$(window).on("popstate.ajaxfilters", function(e) {
12519		var location = window.location;
12520		var url = location.href;
12521		var params = UNCODE.getURLParams(window.location);
12522		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
12523
12524		UNCODE.lastURL = url;
12525
12526		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
12527			return;
12528		}
12529
12530		var container = get_filters_container();
12531
12532		reload_items(container, url, false);
12533	});
12534
12535	// Destroy load more before to init a new one
12536	$(window).on('uncode-ajax-pre-filtered', function() {
12537		if ($.fn.infinitescroll) {
12538			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
12539		}
12540	});
12541
12542	init_filters();
12543};
12544
12545UNCODE.videoThumbs = function() {
12546	var checkResize,
12547		newW = UNCODE.wwidth;
12548	var checkForVideos = function(){
12549
12550		$(window).on('okevents.y.change', function(e, y){
12551			var $video = $(y.target.g),
12552				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
12553				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
12554				restart = !$video_wrap.hasClass('play-pause'),
12555				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
12556				setTime;
12557			if ( newW >= UNCODE.mediaQuery ) {
12558
12559				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
12560					$video_wrap.data('hovered', true);
12561					$video_wrap.addClass('played-on');
12562					y.target.pauseVideo();
12563					$tmb.on('mouseenter', function(){
12564						if ( restart ) {
12565							y.target.seekTo(0);
12566						}
12567						y.target.playVideo();
12568					}).on('mouseleave', function(){
12569						clearTimeout(setTime);
12570						setTime = setTimeout(function(){
12571							y.target.pauseVideo();
12572						}, 300);
12573					});
12574				}
12575
12576			} else {
12577				if( $mobile_video_wrap.length ) {
12578					$video_wrap.addClass('played-on');
12579					y.target.playVideo();
12580				}
12581			}
12582
12583		});
12584
12585		$(window).on('okevents.v.loaded', function(e, playerV){
12586			var $video = $(playerV.element),
12587				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
12588				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
12589				restart = !$video_wrap.hasClass('play-pause'),
12590				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
12591				setTime;
12592
12593			if ( newW >= UNCODE.mediaQuery ) {
12594				
12595				if( $video_wrap.length ) {
12596
12597					var playPromise = playerV.play();
12598					if (playPromise !== undefined) {
12599						playPromise.then(function( value ) {
12600							playerV.pause();
12601						});
12602					}
12603					$video_wrap.addClass('played-on');
12604					$tmb.on('mouseenter', function(){
12605						if ( restart ) {
12606							playerV.setCurrentTime(0)
12607						}
12608						playerV.play();
12609					}).on('mouseleave', function(){
12610						clearTimeout(setTime);
12611						setTime = setTimeout(function(){
12612							playerV.pause();
12613						}, 300);
12614					});
12615				}
12616
12617			} else {
12618
12619				if( $mobile_video_wrap.length ) {
12620					var playPromise = playerV.play();
12621					if (playPromise !== undefined) {
12622						playPromise.then(function( value ) {
12623							playerV.play();
12624						});
12625					}
12626					$video_wrap.addClass('played-on');
12627				}
12628			}
12629		});
12630
12631		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
12632			var $video = $(video),
12633				$noscript = $('noscript', $video),
12634				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
12635				restart = !$video_wrap.hasClass('play-pause'),
12636				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
12637				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
12637: $video.closest('.t-entry-visual, .un-inline-image'),
12638				setTime,
12639			manageVideo = function(){
12640				video.currentTime = 0;
12641				video.pause();
12642				if ( newW >= UNCODE.mediaQuery ) {
12643					if ( $video_wrap.length ) {
12644						$video_wrap.addClass('played-on');
12645						$tmb.on('mouseenter', function(){
12646							if ( restart ) {
12647								video.currentTime = 0;
12648							}
12649							video.play();
12650						}).on('mouseleave', function(){
12651							clearTimeout(setTime);
12652							setTime = setTimeout(function(){
12653								video.pause();
12654							}, 300);
12655						});
12656					} else {
12657						video.play();
12658					}
12659				} else {
12660					if ( $mobile_video_wrap.length ) {
12661						$mobile_video_wrap.addClass('played-on');
12662						video.play();
12663					}
12664				}
12665
12666			};
12667			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
12668				$noscript.each(function(key, val){
12669					$noscript.after(val.textContent || val.innerText || val.innerHTML);
12670					$noscript.remove();
12671				});
12672			}
12673
12674			if (typeof MediaElement === "function") {
12675				$video.has('source[src]').mediaelementplayer({
12676					pauseOtherPlayers: false,
12677				});
12678			}
12679			if (video.readyState > 0) {
12680				manageVideo();
12681			} else {
12682				$video.on("loadedmetadata", function(_event) {
12683					manageVideo();
12684				});
12685			};
12686		});
12687	
12688	};
12689	
12690	checkForVideos();
12691
12692	var checkVideoResize = function(){
12693		clearRequestTimeout(checkResize);
12694		checkResize = requestTimeout(function(){
12695			if ( newW !== UNCODE.wwidth ) {
12696				checkForVideos();
12697				newW = UNCODE.wwidth;
12698			}
12699		}, 1000);
12700	};
12701
12702	$(window).off('resize.videos', checkVideoResize)
12703	.on( 'resize.videos', checkVideoResize);
12704
12705	$(window).off('more-items-loaded.videos', checkForVideos)
12706	.on('more-items-loaded.videos', checkForVideos);
12707
12708};
12709UNCODE.inlineImgs = function() {
12710    var linkInlineImgs = function(){
12711        $('.un-inline-image').each(function(){
12712            var $img = $(this),
12713                href = $(this).attr('data-link-href'),
12714                dataImg = $img.data();
12715			if ( dataImg != '' && href != null && href !== '' ) {
12716                var class_stra_a = 'unline-image-link';
12717                if ( $(this).hasClass('un-inline-space-over') ) {
12718                    class_stra_a += ' un-inline-space-over';
12719                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
12720                    class_stra_a += ' un-inline-space-gutter';
12721                }
12722                var str_a = '<a class="' + class_stra_a + '" ';
12723                for (var key in dataImg) {
12724                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
12725                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
12726                    }
12727                }
12728                str_a += ' />';
12729                $img.wrap(str_a);
12730			}
12731        });
12732    };
12733    $(window).on('load', linkInlineImgs );
12734};
12735UNCODE.lottie = function() {
12736    if ( SiteParameters.is_frontend_editor ) {
12737        var $lottie_wraps = $('div.uncode-lottie-wrap');
12738        $lottie_wraps.each(function(){
12739            var $lottie_wrap = $(this),
12740                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
12741                $player_clone = $div_player.clone(),
12742                player_id = $div_player.attr('data-id'),
12743                $lottie_players = $('lottie-player', $lottie_wrap).remove();
12744            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
12745                if ( $('#'+player_id).length ) {
12746                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
12747                }
12748                $player_clone.attr('id', player_id);
12749                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
12750                $div_player.after($player_clone);
12751                $div_player.attr('data-init',true);
12752            }
12753        });
12754    }
12755    var $players = $('.uncode-lottie-wrap lottie-player');
12756    $players.each(function(){
12757        var player = this,
12758            this_id = $(player).attr('id'),
12759            _player = document.getElementById(this_id),
12760            trigger = $(player).attr('data-trigger'),
12761            pFrames = $(player).attr('data-frames').split(','),
12762            srcPlayer = $(player).attr('src');
12763
12764        _player.load(srcPlayer);
12765
12766        _player.addEventListener("ready", function() {
12767
12768            var $_shadow = _player.shadowRoot;
12769            $($_shadow).find('.error').remove();
12770
12771            var tFrames = _player.getLottie().totalFrames / 100,
12772                pFrame_from = Math.round(tFrames * pFrames[0]),
12773                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
12774                loop = $(player).attr('loop'),
12775                mode,
12776                actions;
12777
12778            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
12779                if ( trigger === 'scroll' ) {
12780                    mode = 'scroll';
12781                    actions = [
12782                        {
12783                            visibility:[0, 1.0],
12784                            type: "seek",
12785                            frames: [pFrame_from, pFrame_to],
12786                        }
12787                    ];
12788                } else if ( trigger === 'viewport') {
12789                    mode = 'scroll';
12790                    actions = [
12791                        {
12792                            visibility: [0.20, 1.0],
12793                            frames: [pFrame_from, pFrame_to],
12794                            type: loop ? "loop" : "play"
12795                        }
12796                    ];
12797                } else if ( trigger === 'hover') {
12798                    $(player).on('mouseenter', function(){
12799                        _player.play();
12800                    }).on('mouseleave', function(){
12801                        _player.pause();
12802                    });
12803                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
12804                        _player.seek(pFrame_from);
12805                        _player.addEventListener("frame", function(){
12806                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
12807                                _player.seek(pFrame_from);
12808                            }
12809                        });
12810                    }
12811                }
12812                LottieInteractivity.create({
12813                    player: '#' + this_id,
12814                    mode: mode,
12815                    actions: actions
12816                });
12817            } else {
12818                if ( pFrame_from > 0 && pFrame_from < 99 ) {
12819                    _player.seek(pFrame_from);
12820                    _player.addEventListener("frame", function(){
12821                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
12822                            _player.seek(pFrame_from);
12823                        }
12824                    });
12825                }
12826            }
12827        });
12828
12829        $(window).on('unlottie-destroy', function(){
12830            _player.destroy();
12831        });
12832    });
12833};
12834
12835UNCODE.animatedBgGradient = function( _el ) {
12836
12837    var ev;
12838
12839	if ( typeof _el === 'undefined' || _el === null ) {
12840        _el = document;
12841        ev = false;
12842	} else {
12843        _el = _el[0];
12844        ev = 'shortcode:update';
12845    }
12846
12847    var simplex = new SimplexNoise();
12848
12849    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
12850		this.block = blockOverlay;
12851		this.wrap = canvasWrap;
12852		this.config();
12853		this.checker();
12854		this.loopRAF();
12855        this.animLoader();
12856    };
12857
12858    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
12859
12860    AnimGradient.config = function() {
12861        this.canvas = document.createElement('canvas');
12862        this.wrap.appendChild(this.canvas);
12863        this.ctx = this.canvas.getContext('2d');
12864        this.count = 0;        
12865        this.isOrientationChanged = false;
12866        this.res = UNCODE.isMobile ? 90 : 110;
12867        this.resPercent = 100/this.res;
12868        this.resAround = this.resPercent/100;
12869        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;
12870
12871        this.canvas.classList.add('uncode-bg-animated-gradient');
12872        this.canvas.setAttribute('height', this.res);
12873        this.canvas.setAttribute('width', this.res);
12874        this.canvas.style = 'height: 100%; position: relative; width:100%;';
12875
12876        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
12877
12878        this.cx = this.canvas.width/2;
12879        this.cy = this.canvas.height/2;
12880        this.data = this.imgdata.data;
12881
12882        this.opts = {
12883            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,
12884            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,
12885            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
12886        };
12887
12888        this.lavaTime = 1;
12889        this.bg_colors = [];
12890
12891        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
12892            return;
12893        }
12894
12895        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
12896            this.singleColor = true;
12897        }
12898
12899        if( this.opts.col_1st ) {
12900
12901            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
12902
12903            this.bg_colors.push({
12904                r: rgbColor1.r,
12905                g: rgbColor1.g,
12906                b: rgbColor1.b
12907            });
12908        }
12909
12910        if( this.opts.col_2nd ) {
12911
12912            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
12913
12914            this.bg_colors.push({
12915                r: rgbColor2.r,
12916                g: rgbColor2.g,
12917                b: rgbColor2.b
12918            });
12919        }
12920
12921    };
12922
12923    AnimGradient.checker = function() {
12924        var scope = this;
12925        this.checkInViewPort();
12926      
12927        window.addEventListener('resize', function() {
12928            if(UNCODE.isMobile && !scope.isOrientationChanged) {
12929                return;
12930            }
12931            scope.ratioCalc();
12932        });
12933
12934        window.addEventListener("orientationchange", function() {
12935            scope.isOrientationChanged = true;
12936        });
12937
12938        this.ratioCalc();
12939    }; 
12940
12941    AnimGradient.ratioCalc = function() {
12942      
12943        var blockW = this.block.clientWidth,
12944            blockH = this.block.clientHeight;
12945
12946        var blockRatio = blockH/blockW;
12947
12948        if(blockRatio < 1) {
12949            this.ratioParam = {
12950                x: 1.4,
12951                y: blockRatio*1.4
12952            }
12953        } else {
12954            this.ratioParam = {
12955                x: blockRatio/3,
12956                y: 1
12957            }
12958        }
12959         
12960    };
12961
12962    AnimGradient.checkInViewPort = function() {
12963		if( 'IntersectionObserver' in window ) {
12964		    var scope = this,
12965                observer = new IntersectionObserver(function(entries) {
12966  
12967                entries.forEach(function(entry){
12968                    if ( entry.isIntersecting ) {
12969                        scope.isInViewport = true;
12970                    } else {
12971                        scope.isInViewport = false;
12972                    }
12973                });
12974  
12975		    }, { 
12976			root: document,
12977		  });
12978  
12979		  observer.observe(this.block);
12980		}
12981	};
12982	
12983    AnimGradient.hexToRGB = function(hexval) {
12984        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
12985        if (!hexecuted) {
12986            return false;
12987        }
12988        return {
12989            r: parseInt(hexecuted[1], 16),
12990            g: parseInt(hexecuted[2], 16),
12991            b: parseInt(hexecuted[3], 16)
12992        }
12993    };
12994
12995    AnimGradient.factor = function(val_1, val_2, lava) { 
12996        return val_1 * (1 - lava) + val_2 * lava;
12997    };
12998
12999    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
13000        if (this.singleColor) {
13001            return this.bg_colors[0][wave_l];
13002        }
13003        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 );
13004        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
13005    };
13006
13007    AnimGradient.lava = function(x, y, grade) {
13008        var radians = (Math.PI / 180) * grade,
13009        cos = Math.cos(radians),
13010        sin = Math.sin(radians),
13011        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
13012        return nx;
13013    };
13014    
13015    AnimGradient.loopRAF = function() {
13016
13017      var scope = this;
13018
13019        if( this.isInViewport ) {
13020            for (var x = 0; x < this.res; x++) {
13021                for (var y = 0; y < this.res; y++) {
13022                    
13023                    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
13024        
13025                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
13026                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
13027                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
13028                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
13029                  
13030                }
13031            }
13032   
13033            this.count++;
13034          
13035            this.ctx.putImageData(this.imgdata, 0, 0);
13036         
13037        }
13038
13039        requestAnimationFrame(function() {
13040            scope.loopRAF();
13041        });
13042    };
13043
13044    AnimGradient.animLoader = function() {
13045        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
13046    };
13047
13048    var anim_init = function() {
13049        var bgs = _el.querySelectorAll('.block-bg-overlay');
13050      
13051        bgs.forEach(function(blockOverlay) {
13052            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
13053            if( !blockOverlay || !canvasWrap ) {
13054                return;
13055            }
13056            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
13057        });
13058    }
13059
13060    $(window).on('load', function(){
13061        anim_init();
13062    });
13063
13064    if ( ev === 'shortcode:update' ) {
13065        anim_init();
13066    }
13067
13068};
13069UNCODE.multibg = function(){
13070	var $bgsWraps = $('.uncode-multi-bgs'),
13071		$body = $('body');
13072	$bgsWraps.each(function(){
13073		var $bgWrap = $(this),
13074			transition = $bgWrap.attr('data-transition'),
13075			transitionTime = $bgWrap.attr('data-transition-time'),
13076			dataPace = $bgWrap.attr('data-transition-pace'),
13077			dataThreshold = $bgWrap.attr('data-transition-threshold'),
13078			dataTime = $bgWrap.attr('data-carousel-time'),
13079			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
13080			random = $bgWrap.attr('data-multi-random'),
13081			_bgWrap = $bgWrap[0],
13082			$multiBgs = $('.multi-background', $bgWrap),
13083			imgFirst,
13084			bgAmount = $multiBgs.length,
13085			isInViewport = false,
13086			lastScrollTop = 0,
13087			counter = 0,
13088			totMove = 0,
13089			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
13090			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
13091			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
13092			offX, offY,
13093			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
13094			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
13095			requestCarousel,
13096			is_header = $bgWrap.closest('#page-header').length,
13097			startTime = new Date();
13098
13099		transition = typeof transition === 'undefined' ? '' : transition;
13100
13101		if ( random === 'true' ) {
13102			UNCODE.shuffle($multiBgs);
13103		}
13104
13105		imgFirst = $multiBgs.first().find('.background-inner').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
13106
13107		var loadFirst = function(){
13108			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
13109				opacity: 1
13110			}, 250, 'easeInQuad').css({
13111				zIndex: 1
13112			});	
13113		}
13114
13115		var loadError = function(){
13116			console.log('Multi BG loading error');
13117		}
13118
13119		UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
13120
13121		var loadSlides = function( $thisBg ){
13122			$thisBg.attr('data-load', 'loaded');	
13123		}
13124
13125		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
13126			var $thisBg = $(val);
13127
13128			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
13129
13130				var _imgBg = $(val).find('.background-inner').css('background-image');
13131
13132				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
13133					$thisBg.attr('data-load', 'loaded');
13134				} else {
13135					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
13136					if ( typeof _imgBg !== 'undefined' ) {
13137						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
13138					}
13139				}
13140			}
13141		});
13142					
13143		var multiCarousel = function(e) {
13144
13145			clearRequestTimeout(requestCarousel);
13146
13147			var checkTime = new Date();
13148			if ( checkTime - startTime >= carouselTime && isInViewport ) {
13149				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
13150
13151				if ( $checkEl.attr('data-load') !== 'loaded' ) {
13152					requestTimeout(function(){
13153						multiCarousel();
13154					}, 100);
13155					return;
13156				}
13157
13158				counter++;
13159
13160				$multiBgs.each(function(ind, val){
13161					if ( ind === counter%bgAmount ) {
13162						$(val).stop(true,false).animate({
13163							opacity: 1
13164						}, wait, 'easeInQuad').css({
13165							zIndex: 1
13166						});
13167					} else {
13168						$(val).stop(true,false).animate({
13169							opacity: 0
13170						}, wait, 'easeInQuad').css({
13171							zIndex: 0
13172						});
13173					}
13174				});
13175
13176			}
13177
13178			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13179				requestCarousel = requestTimeout(multiCarousel, carouselTime);
13180			}
13181	
13182		};
13183
13184		var multiMove = function(e) {
13185			if ( $body.hasClass('navbar-hover') ) {
13186				return;
13187			}
13188			var checkTime = new Date(),
13189                bound = $bgWrap[0].getBoundingClientRect(),
13190                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
13191			if (offX) {
13192				totMove += Math.sqrt(
13193					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
13194				);
13195			}
13196			if (
13197                totMove >= pace && 
13198                checkTime - startTime >= wait &&
13199                e.clientX <= (bound.left + bound.width) &&
13200                e.clientX >= bound.left &&
13201                e.clientY <= (bound.top + bound.height) &&
13202                e.clientY >= bound.top
13203            ) {
13204				counter++;
13205				startTime = checkTime;
13206				$multiBgs.each(function(ind, val){
13207					if ( ind === counter%bgAmount ) {
13208						$(val).stop(true,false).animate({
13209							opacity: 1
13210						}, wait, 'easeInQuad').css({
13211							zIndex: 1
13212						});
13213					} else {
13214						$(val).stop(true,false).animate({
13215							opacity: 0
13216						}, wait, 'easeInQuad').css({
13217							zIndex: 0
13218						});
13219					}
13220				});
13221
13222				totMove = 0;
13223			}
13224			
13225			offX = e.clientX;
13226			offY = e.clientY;
13227			
13228		};
13229
13230		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
13231			document.addEventListener("mousemove", multiMove);
13232		}
13233
13234		window.addEventListener('resize', function() {
13235			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
13236				document.removeEventListener("mousemove", multiMove);
13237				document.addEventListener("mousemove", multiMove);
13238			}
13239		});
13240
13241		var lightLoopRAF = function() {
13242
13243			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
13244				checkTime = new Date(),
13245				bound = $bgWrap[0].getBoundingClientRect(),
13246				thresholdHeader = is_header ? 100 : threshold,
13247				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
13248			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
13249				counter++;
13250				lastScrollTop = scrollTop;
13251				startTime = checkTime;
13252
13253				$multiBgs.each(function(ind, val){
13254					if ( ind === counter%bgAmount ) {
13255						$(val).stop(true,false).animate({
13256							opacity: 1
13257						}, wait, 'easeInQuad').css({
13258							zIndex: 1
13259						});
13260					} else {
13261						$(val).stop(true,false).animate({
13262							opacity: 0
13263						}, wait, 'easeInQuad').css({
13264							zIndex: 0
13265						});
13266					}
13267				});
13268
13269			}
13270
13271			requestAnimationFrame(function() {
13272				if ( isInViewport ) {
13273					lightLoopRAF();
13274				}
13275			});
13276		};
13277
13278		var currentInd = 0;
13279
13280		var loopRAF = function() {
13281
13282			var multiBgRotate = function(slideInd){
13283				currentInd = slideInd;
13284				$multiBgs.each(function(ind, val){
13285					if ( ind === slideInd ) {
13286						$(val).stop(true,false).animate({
13287							opacity: 1
13288						}, wait, 'easeInQuad').css({
13289							zIndex: 1
13290						});
13291					} else {
13292						$(val).stop(true,false).animate({
13293							opacity: 0
13294						}, wait, 'easeInQuad').css({
13295							zIndex: 0
13296						});
13297					}
13298				});
13299			};
13300			var bound = $bgWrap[0].getBoundingClientRect(),
13301				thresholdPX = UNCODE.wheight * threshold / 100,
13302				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
13303				movePX = totMove / bgAmount,
13304				moving = UNCODE.wheight - (bound.top + thresholdPX),
13305				slideInd = 0;
13306
13307			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
13308				multiBgRotate(0);
13309			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
13310				multiBgRotate(bgAmount-1);
13311			} else {
13312				slideInd = Math.ceil(moving/movePX) - 1;
13313				if ( slideInd < 0 ) {
13314					slideInd = 0;
13315				} else if ( slideInd >= bgAmount ) {
13316					slideInd = bgAmount-1;
13317				}
13318				if ( slideInd !== currentInd ) {
13319					multiBgRotate(slideInd);
13320				}
13321			}
13322
13323			requestAnimationFrame(function() {
13324				if ( isInViewport ) {
13325					loopRAF();
13326				}
13327			});
13328		};
13329
13330		if( 'IntersectionObserver' in window ) {
13331		    var observer = new IntersectionObserver(function(entries) {
13332  
13333                entries.forEach(function(entry){
13334                    if ( entry.isIntersecting ) {
13335                        isInViewport = true;
13336						if ( transition === 'scroll' ) {
13337							if ( autoScroll ) {
13338								loopRAF();
13339							} else {
13340								lightLoopRAF();
13341							}
13342						} else {
13343							multiCarousel();
13344						}
13345                    } else {
13346                        isInViewport = false;
13347                   }
13348                });
13349  
13350		    }, { 
13351				root: document,
13352				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
13353		  	});
13354
13355			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
13356		  		observer.observe(_bgWrap);
13357			}
13358
13359			window.addEventListener('resize', function() {
13360				observer.unobserve(_bgWrap);
13361				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
13362					observer.observe(_bgWrap);
13363				}
13364			});
13365	
13366		}
13367
13368	});
13369}
13370
13371UNCODE.owlNav = function(target, ev) {
13372    target = target.replace(/#\S+/g, '');
13373    var $carousel = $('#'+target),
13374        $slider = $carousel.closest('.uncode-slider'),
13375        $checkNavs = $('.uncode-owl-nav');
13376    if ( !$checkNavs.length ) {
13377        return;
13378    }
13379
13380    if ( $slider.length ){
13381        target = $slider.attr('id');
13382    }
13383
13384    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
13385        $row;
13386
13387    if ( ! $navs.length ) {
13388        $row = $carousel.closest('.vc_row.row-container');
13389        $navs = $('.uncode-owl-nav:not([data-target])', $row);
13390    }
13391        
13392    if ( ! $navs.length ) {
13393        return;
13394    }
13395
13396    $navs.each(function(){
13397        var $nav = $(this),
13398            $outer = $nav.closest('.uncode-owl-nav-out'),
13399            $inner = $nav.find('.uncode-owl-nav-in'),
13400            $navDots = $('.uncode-nav-dots', $nav),
13401            $navCounter = $('.uncode-nav-counter', $nav),
13402            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
13403            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
13404            skinInherit = $nav.hasClass('skin-inherit'),
13405            digit = parseFloat($nav.attr('data-digit')),
13406            counterDigit = parseFloat($nav.attr('data-counter-digit')),
13407            navSpeed = parseFloat($carousel.attr('data-navspeed'));
13408        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
13409
13410        if ( $nav.hasClass('pos-abs') ){
13411            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
13412                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
13413            }
13414            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
13415        } 
13416
13417        $carousel.on('refreshed.owl.carousel', counter);
13418        $carousel.on('resized.owl.carousel', counter);
13419        $carousel.on('changed.owl.carousel', counter);
13420
13421        var totalSlides = 0;
13422
13423        function counter(event) {
13424            if (!event.namespace) {
13425                return;
13426            }
13427            var slides = event.relatedTarget,
13428                current = slides._current,
13429                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
13430                item = event.item,
13431                page = event.page,
13432                countPages = Math.ceil(item.count / page.size),
13433                $currentSlide = $carousel.find('.owl-item').eq(current),
13434                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
13435                activeSlide = Math.ceil(itemIndex / page.size),
13436                $prev = $nav.find('.uncode-nav-prev'),
13437                $next = $nav.find('.uncode-nav-next'),
13438                $col = $currentSlide.find('.uncol').first();
13439
13440            if ( totalSlides != countPages ) {
13441                totalSlides = countPages;
13442                $navDots.html('');
13443                var nav_html = '';
13444                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
13445                    var padN = sl_ind+1;
13446                    if ( digit && digit > 1 ) {
13447                        padN = String(padN).padStart(digit, '0');
13448                    }
13449                    nav_html += '<span class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '"><span>' + padN + '</span></span>';
13450                }
13451                $navDots.html(nav_html);
13452
13453                var totalSlidesDigit = totalSlides;
13454
13455                if ( counterDigit && counterDigit > 1 ) {
13456                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
13457                }
13458                $counterTotal.html(totalSlidesDigit);
13459            }
13460
13461            if ( loop !== true ) {
13462                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
13463                if ( itemIndex === 1 ) {
13464                    $prev.addClass('uncode-nav-disabled');
13465                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
13466                    $next.addClass('uncode-nav-disabled');
13467                    activeSlide = Math.ceil(item.count / page.size);
13468                }
13469            }
13470
13471            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
13472            var activeSlideDigit = activeSlide;
13473
13474            if ( counterDigit && counterDigit > 1 ) {
13475                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
13476            }
13477            $counterIndex.html(activeSlideDigit);
13478
13479            if ( skinInherit ) {
13480                if ( $col.hasClass('style-light') ){
13481                    $nav.removeClass('style-dark').addClass('style-light');
13482                } else if ( $col.hasClass('style-dark') ) {
13483                    $nav.removeClass('style-light').addClass('style-dark');
13484                }
13485            }
13486
13487            $inner.removeClass('uncode-owl-nav-waiting');
13488
13489            if ( $nav.hasClass('outer-width') ) {
13490                var navW = $nav.outerWidth(),
13491                    nexW = $next.outerWidth(),
13492                    prevW = $prev.outerWidth(),
13493                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
13494
13495                if ( $nav.hasClass('h-align-justify') ) {
13496                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
13497                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
13498                        $inner.css({'margin': 'auto'});
13499                    } else {
13500                        $inner.css({'margin': ''});
13501                    }
13502                } else {
13503                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
13504                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
13505                        $inner.css({'margin': 'auto'});
13506                    } else {
13507                        $inner.css({'margin': ''});
13508                    }
13509                }
13510            }
13511        }
13512
13513        $nav.on('click', '.uncode-nav-index', function(){
13514            var $bullet = $(this),
13515                slide_index = parseFloat( $bullet.attr('data-key') );
13516            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
13517        });
13518        $nav.on('click', '.uncode-nav-prev', function(){
13519            $carousel.trigger('prev.owl.carousel', [navSpeed]);
13520        });
13521        $nav.on('click', '.uncode-nav-next', function(){
13522            $carousel.trigger('next.owl.carousel', [navSpeed]);
13523        });
13524
13525        if ( $nav.hasClass('animated-arrows') ) {
13526            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
13527                $(this).addClass("hover"); 
13528            }).on('animationend', function(){
13529                $(this).removeClass("hover");  
13530            });
13531        }
13532
13533        var positionNav = function(){
13534            if ( $nav.hasClass('window-width') ) {
13535                var navOff = parseFloat( $nav.offset().left ) * -1;
13536                if ( navOff > 0 ) {
13537                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
13538                } else {
13539                    $inner.css({ transform: 'none' });
13540                }
13541            }
13542        }
13543        positionNav();
13544        $(window).on('resize', positionNav);
13545    });
13546
13547    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
13548};
13549
13550	UNCODE.init = function() {
13551		var wfl_check = false, wfl_request, waypoint_request;
13552		UNCODE.preventDoubleTransition();
13553		UNCODE.betterResize();
13554		UNCODE.utils();
13555		UNCODE.magnetic();
13556		if (typeof UNCODE.rowParallax !== 'undefined') {
13557			UNCODE.rowParallax();
13558		}
13559		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
13560			UNCODE.changeSkinOnScroll();
13561		}
13562		if (typeof UNCODE.share !== 'undefined') {
13563			UNCODE.share();
13564		}
13565		if (typeof UNCODE.tooltip !== 'undefined') {
13566			UNCODE.tooltip();
13567		}
13568		if (typeof UNCODE.counters !== 'undefined') {
13569			UNCODE.counters();
13570		}
13571		if (typeof UNCODE.countdowns !== 'undefined') {
13572			UNCODE.countdowns();
13573		}
13574		if (typeof UNCODE.tabs !== 'undefined') {
13575			UNCODE.tabs();
13576		}
13577		if (typeof UNCODE.collapse !== 'undefined') {
13578			UNCODE.collapse();
13579		}
13580		if (typeof UNCODE.bigText !== 'undefined') {
13581			UNCODE.bigText();
13582		}
13583		UNCODE.menuSystem();
13584		if (typeof UNCODE.bgChanger !== 'undefined') {
13585			UNCODE.bgChanger();
13586		}
13587		if (typeof UNCODE.magicCursor !== 'undefined') {
13588			UNCODE.magicCursor();
13589		}
13590		if (typeof UNCODE.magneticCursor !== 'undefined') {
13591			UNCODE.magneticCursor();
13592		}
13593		if (typeof UNCODE.dropImage !== 'undefined') {
13594			UNCODE.dropImage();
13595		}
13596		if (typeof UNCODE.postTable !== 'undefined') {
13597			UNCODE.postTable();
13598		}
13599		if (typeof UNCODE.rotatingTxt !== 'undefined') {
13600			UNCODE.rotatingTxt();
13601		}
13602		if (typeof UNCODE.okvideo !== 'undefined') {
13603			UNCODE.okvideo();
13604			window.addEventListener( "uncode-more-items-loaded", function() {
13605				UNCODE.okvideo("uncode-more-items-loaded");
13606			});
13607		}
13608		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
13609			UNCODE.backgroundSelfVideos();
13610		}
13611		UNCODE.tapHover();
13612		if (typeof UNCODE.isotopeLayout !== 'undefined') {
13613			UNCODE.isotopeLayout();
13614		}
13615		if (typeof UNCODE.justifiedGallery !== 'undefined') {
13616			UNCODE.justifiedGallery();
13617		}
13618		if (typeof UNCODE.cssGrid !== 'undefined') {
13619			UNCODE.cssGrid();
13620		}
13621		if (typeof UNCODE.linearGrid !== 'undefined') {
13622			UNCODE.linearGrid();
13623		}
13624		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
13625			UNCODE.lightbox();
13626		}
13627		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
13628			$(window).on('load more-items-loaded',function(){
13629				UNCODE.lightgallery();
13630			});
13631		}
13632		if (typeof UNCODE.carousel !== 'undefined') {
13633			UNCODE.carousel($('body'));
13634		}
13635		if (typeof UNCODE.lettering !== 'undefined') {
13636			UNCODE.lettering();
13637		}
13638		UNCODE.animations();
13639		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
13640			UNCODE.stickyElements();
13641		}
13642		if (typeof UNCODE.twentytwenty !== 'undefined') {
13643			UNCODE.twentytwenty();
13644		}
13645		UNCODE.disableHoverScroll();
13646		UNCODE.printScreen();
13647		if (typeof UNCODE.particles !== 'undefined') {
13648			UNCODE.particles();
13649		}
13650		if (typeof UNCODE.filters !== 'undefined') {
13651			UNCODE.filters();
13652		}
13653		if (typeof UNCODE.ajax_filters !== 'undefined') {
13654			UNCODE.ajax_filters();
13655		}
13656		if (typeof UNCODE.widgets !== 'undefined') {
13657			UNCODE.widgets();
13658		}
13659		if (typeof UNCODE.unmodal !== 'undefined') {
13660			UNCODE.unmodal();
13661		}
13662		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
13663			if ( !UNCODE.isFullPage ) {
13664				UNCODE.checkScrollForTabs();
13665			}
13666		}
13667		if (typeof UNCODE.onePage !== 'undefined') {
13668			UNCODE.onePage(UNCODE.isMobile);
13669		}
13670		if (typeof UNCODE.fullPage !== 'undefined') {
13671			$(document).ready(function(){
13672				UNCODE.fullPage();
13673			});
13674		}
13675		if (typeof UNCODE.skewIt !== 'undefined') {
13676			UNCODE.skewIt();
13677		}
13678		if (typeof UNCODE.rotateIt !== 'undefined') {
13679			UNCODE.rotateIt();
13680		}
13681		if (typeof UNCODE.textMarquee !== 'undefined') {
13682			UNCODE.textMarquee();
13683		}
13684		if (typeof UNCODE.stickyScroll !== 'undefined') {
13685			UNCODE.stickyScroll();
13686		}
13687		if (typeof UNCODE.stickyTrigger !== 'undefined') {
13688			UNCODE.stickyTrigger();
13689		}
13690		if (typeof UNCODE.verticalText !== 'undefined') {
13691			UNCODE.verticalText();
13692		}
13693		if (typeof UNCODE.videoThumbs !== 'undefined') {
13694			UNCODE.videoThumbs();
13695		}
13696		if (typeof UNCODE.revslider !== 'undefined') {
13697			UNCODE.revslider();
13698		}
13699		if (typeof UNCODE.layerslider !== 'undefined') {
13700			UNCODE.layerslider();
13701		}
13702		if (typeof UNCODE.lottie !== 'undefined') {
13703			UNCODE.lottie();
13704		}
13705		if (typeof UNCODE.inlineImgs !== 'undefined') {
13706			UNCODE.inlineImgs();
13707		}
13708		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
13709			UNCODE.animatedBgGradient();
13710		}
13711		if (typeof UNCODE.readMoreCol !== 'undefined') {
13712			UNCODE.readMoreCol();
13713		}
13714		if (typeof UNCODE.multibg !== 'undefined') {
13715			UNCODE.multibg();
13716		}
13717		if (typeof UNCODE.flexEqual !== 'undefined') {
13718			UNCODE.flexEqual();
13719		}
13720		$(window).on('load',function(){
13721			clearRequestTimeout(waypoint_request);
13722			waypoint_request = requestTimeout( function(){
13723				Waypoint.refreshAll();
13724			}, 1000);
13725		});
13726		$(window).one('load',function(){
13727			if (typeof UNCODE.parallax !== 'undefined') {
13728				UNCODE.parallax();
13729			}
13730		});
13731	}
13732
13733	if ( ! SiteParameters.is_frontend_editor ) {
13734		UNCODE.init();
13735	}
13736
13737
13738})(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.