PageSourceSearch

https://borecom.com/wp-content/themes/borecom/library/js/app.js?ver=10866546

js borecom.com collected 2026-10-08 08:26:53 UTC 438,974 bytes, 13,773 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				UNCODE.hDoc = newHdoc;
74				window.lenis.resize();
75				//window.dispatchEvent(new CustomEvent('boxResized'));
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					container.addClass('grid-filtering');
3070					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3071						var parent = $(val).parent(),
3072							objTimeout = parent.data('objTimeout');
3073						if (objTimeout) {
3074							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3075							clearRequestTimeout(objTimeout);
3076						}
3077						if (transitionDuration == 0) {
3078							if ($(val).hasClass('animate_when_almost_visible')) {
3079								$(val).addClass('zoom-reverse').removeClass('start_animation');
3080							} else {
3081								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3082							}
3083						}
3084					});
3085					requestTimeout(function(){
3086						if ( filterValue == '*' ) {
3087							container.removeClass('isotope-filtered');
3088						} else {
3089							container.addClass('isotope-filtered');
3090						}
3091						container.isotope({
3092							filter: function() {
3093								var block = $(this),
3094								filterable = (filterValue == '*') || block.hasClass(filterValue),
3095								lightboxElements = $('[data-lbox^=ilightbox]', block);
3096								if (filterable) {
3097									if (lightboxElements.length) {
3098										lightboxElements.removeClass('lb-disabled');
3099										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3100									}
3101									filterItems.push(block);
3102								} else {
3103									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3104								}
3105								container.trigger('more-items-loaded');
3106								$(window).trigger('more-items-loaded');
3107								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3108								return filterable;
3109							}
3110						});
3111						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3112
3113					}, delay);
3114
3115					/** once filtered - start **/
3116					container.isotope('once', 'arrangeComplete', function() {
3117						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3118							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3119							if (typeof getLightbox === 'object') {
3120								getLightbox.refresh();
3121							} else {
3122								UNCODE.lightbox();
3123							}
3124						}
3125						if (transitionDuration == 0) {
3126							requestTimeout(function() {
3127								boxAnimation(filterItems, 0, false, container);
3128							}, 100);
3129						}
3130						requestTimeout(function() {
3131							Waypoint.refreshAll();
3132							container.removeClass('grid-filtering');
3133						}, 2000);
3134					});
3135					/** once filtered - end **/
3136				} else {
3137					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3138						$.each(UNCODE.lightboxArray, function(index, val) {
3139							UNCODE.lightboxArray[index].destroy();
3140						});
3141					}
3142					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3143						var parent = $(val).parent(),
3144							objTimeout = parent.data('objTimeout');
3145						if (objTimeout) {
3146							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3147							clearRequestTimeout(objTimeout);
3148						}
3149						if (transitionDuration == 0) {
3150							if ($(val).hasClass('animate_when_almost_visible')) {
3151								$(val).addClass('zoom-reverse').removeClass('start_animation');
3152							} else {
3153								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3154							}
3155						}
3156					});
3157					container.parent().addClass('grid-loading');
3158					loadIsotope($filter);
3159				}
3160			};
3161
3162			if (!$filter.hasClass('active')) {
3163				/** Scroll top with filtering */
3164				if (filterContainer.hasClass('filter-scroll')) {
3165                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3166                    calc_scroll -= UNCODE.get_scroll_offset();
3167
3168					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3169						delta = bodyTop - calc_scroll,
3170						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3171						filterTolerance = false,
3172						filter_timeout;
3173					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3174
3175					if ( !UNCODE.isFullPage ) {
3176						if (scrollSpeed == 0) {
3177							$('html, body').scrollTop(calc_scroll);
3178							UNCODE.scrolling = false;
3179							filter_items();
3180						} else {
3181
3182							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3183								filter_items();
3184								filterTolerance = true;
3185							}
3186
3187							$('html, body').animate({
3188								scrollTop: calc_scroll
3189							},{
3190								easing: 'easeInOutQuad',
3191								duration: scrollSpeed,
3192								complete: function(){
3193									UNCODE.scrolling = false;
3194									if ( !filterTolerance ) {
3195										filter_timeout = setTimeout(function(){
3196											clearTimeout(filter_timeout);
3197											filter_items();
3198										}, 200);
3199									}
3200								}
3201							});
3202						}
3203					}
3204				} else {
3205					filter_items();
3206				}
3207			}
3208			evt.preventDefault();
3209		});
3210
3211		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3212			var params = UNCODE.getURLParams(window.location);
3213			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3214
3215			UNCODE.lastURL = window.location.href;
3216
3217			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
3218				return;
3219			}
3220
3221			if (params.id === undefined) {
3222				$.each($('.isotope-system'), function(index, val) {
3223					loadIsotope($(val));
3224				});
3225			} else {
3226				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3227					loadIsotope($('#' + params.id));
3228				}
3229			}
3230		});
3231
3232		var loadIsotope = function($href, $paginating) {
3233			var is_paginating = false;
3234
3235			if (undefined !== $paginating && $paginating) {
3236				var is_paginating = $paginating;
3237			}
3238
3239			var href = ($href.is("a") ? $href.attr('href') : location),
3240				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3241				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3242				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3243				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3244				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3245				isotopeId = isotopeSystem.attr('id');
3246			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3247				UNCODE.lastURL = href;
3248				history.pushState({
3249					myIsotope: true
3250				}, document.title, href);
3251			}
3252			if (is_paginating) {
3253				isotopeWrapper.addClass('grid-filtering');
3254			}
3255			$.ajax({
3256				url: href
3257			}).done(function(data) {
3258				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3259					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3260					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3261				isotopeWrapper.addClass('isotope-reloaded');
3262				requestTimeout(function() {
3263					isotopeWrapper.removeClass('grid-loading');
3264					isotopeWrapper.removeClass('isotope-reloaded');
3265					isotopeWrapper.removeClass('grid-filtering');
3266				}, 500);
3267				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3268					var parent = $(val).parent(),
3269						objTimeout = parent.data('objTimeout');
3270					if (objTimeout) {
3271						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3272						clearRequestTimeout(objTimeout);
3273					}
3274					if ($(val).hasClass('animate_when_almost_visible')) {
3275						$(val).addClass('zoom-reverse').removeClass('start_animation');
3276					} else {
3277						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3278					}
3279				});
3280				requestTimeout(function() {
3281					if (isotopeContainer.data('isotope')) {
3282						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3283						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3284						UNCODE.adaptive();
3285						if (SiteParameters.dynamic_srcset_active === '1') {
3286							UNCODE.adaptive_srcset(isotopeContainer);
3287						}
3288						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3289							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3290							if (typeof getLightbox === 'object') {
3291								getLightbox.refresh();
3292							} else {
3293								UNCODE.lightbox();
3294							}
3295						}
3296					}
3297					isotopeContainer.trigger('more-items-loaded');
3298					$(window).trigger('more-items-loaded');
3299					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3300				}, 300);
3301				$('.pagination', isotopeFooter).remove();
3302				isotopeFooter.append($resultPagination);
3303
3304				if (isotopeResultCount.length > 0) {
3305					$('.woocommerce-result-count', isotopeResultCount).remove();
3306					isotopeResultCount.append($resultCount);
3307				}
3308			});
3309		};
3310		$filters.each(function(i, buttonGroup) {
3311			var $buttonGroup = $(buttonGroup);
3312			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3313				$buttonGroup.find('.active').removeClass('active');
3314				$(this).addClass('active');
3315
3316			});
3317
3318			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3319				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3320				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3321			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3322				e.preventDefault();
3323				$cats_filters.slideToggle(400, 'easeInOutCirc');
3324			});
3325
3326		});
3327		window.addEventListener('boxResized', function(e) {
3328			if (UNCODE.printDialogOpen !== false) {
3329				return false;
3330			}
3331			$.each($('.isotope-layout'), function(index, val) {
3332				var $layoutMode = ($(this).data('layout'));
3333				if ($layoutMode === undefined) $layoutMode = 'masonry';
3334				if ($(this).data('isotope')) {
3335					$(this).isotope({
3336						itemSelector: $itemSelector,
3337						layoutMode: $layoutMode,
3338						transitionDuration: transitionDuration[index],
3339						masonry: {
3340							columnWidth: colWidth(index)
3341						},
3342						vertical: {
3343							horizontalAlignment: 0.5,
3344						},
3345						sortBy: 'original-order',
3346						isOriginLeft: isOriginLeft
3347					});
3348					$(this).isotope('unbindResize');
3349					if (SiteParameters.dynamic_srcset_active === '1') {
3350						UNCODE.refresh_dynamic_srcset_size($(this));
3351					}
3352				}
3353				$(this).find('.mejs-video,.mejs-audio').each(function() {
3354					$(this).trigger('resize');
3355				});
3356			});
3357		}, false);
3358
3359		init_isotope();
3360	};
3361}
3362
3363UNCODE.lightbox = function() {
3364	if ( SiteParameters.lbox_enhanced ) {
3365		return true;
3366	}
3367	UNCODE.lightboxArray = {};
3368	requestTimeout(function() {
3369		var groupsArr = {};
3370		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3371			var group = this.getAttribute("data-lbox"),
3372				values = $(this).data();
3373			$(this).attr('data-lbox-init','true')
3374			groupsArr[group] = values;
3375		});
3376		for (var i in groupsArr) {
3377			var skin = groupsArr[i].skin || 'black',
3378				path = groupsArr[i].dir || 'horizontal',
3379				thumbs = !groupsArr[i].notmb || false,
3380				arrows = !groupsArr[i].noarr || false,
3381				social = groupsArr[i].social || false,
3382				deeplink = groupsArr[i].deep || false,
3383				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3384				counter = $els.length,
3385				dataAlbum = $els.attr('data-album');
3386			if (social) social = {
3387				facebook: true,
3388				twitter: true,
3389				reddit: true,
3390				digg: true
3391			};
3392			UNCODE.lightboxArray[i] = $els.iLightBox({
3393				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3394				skin: skin,
3395				path: path,
3396				linkId: deeplink,
3397				infinite: false,
3398				//fullViewPort: 'fit',
3399				smartRecognition: false,
3400				fullAlone: true,
3401				maxScale: 1,
3402				minScale: .02,
3403				//fullStretchTypes: 'flash, video',
3404				overlay: {
3405					opacity: .94
3406				},
3407				controls: {
3408					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3409					fullscreen: true,
3410					thumbnail: thumbs,
3411					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3412				},
3413				show: {
3414					speed: 200
3415				},
3416				hide: {
3417					speed: 200
3418				},
3419				social: {
3420					start: false,
3421					buttons: social
3422				},
3423				caption: {
3424					start: false
3425				},
3426				styles: {
3427					nextOpacity: 1,
3428					nextScale: 1,
3429					prevOpacity: 1,
3430					prevScale: 1
3431				},
3432				effects: {
3433					switchSpeed: 400
3434				},
3435				slideshow: {
3436					pauseTime: 5000
3437				},
3438				thumbnails: {
3439					maxWidth: 60,
3440					maxHeight: 60,
3441					activeOpacity: .2
3442				},
3443				html5video: {
3444					preload: true
3445				},
3446				callback: {
3447					onOpen: function(){
3448						$(window).trigger('uncode-custom-cursor');
3449						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3450							iNoBounce.enable();
3451						}
3452					},
3453					onHide: function(){
3454						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3455							iNoBounce.disable()
3456						}
3457					},
3458				}
3459			});
3460
3461			$(document).on('infinite-loaded', function(){
3462				UNCODE.lightboxArray[i].refresh();
3463			});
3464
3465			$(window).on('gdprOpen', function(){
3466				UNCODE.lightboxArray[i].close();
3467			});
3468		};
3469	}, 100);
3470
3471	$(document).on('click', '.lb-disabled', function(e){
3472		e.preventDefault();
3473	});
3474};
3475
3476UNCODE.lightgallery = function( $el ) {
3477	var createSelectors = function(){
3478		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
3479			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3480				$(this).addClass('lbox-trigger-item');
3481			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3482				$(this).addClass('lbox-nested-item');
3483			} else {
3484				$(this).removeClass('lbox-trigger-item');
3485				$(this).removeClass('lbox-nested-item');
3486			}
3487		});
3488	};
3489
3490	createSelectors();
3491
3492	var galleries = [],
3493		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3494			return !$(this).closest('.nested-carousel').length;
3495		}),
3496		$_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .linear-container:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box .icon-box-icon:not([data-lbox-init]), .icon-box .icon-box-content:not([data-lbox-init]), .grid-container:not([data-lbox-init]), .btn-container:not([data-lbox-init])' + SiteParameters.uncode_lb_add_galleries).has('.lbox-trigger-item').not('.isotope-container *, .owl-carousel *, .index-scroll-wrapper *, .justified-gallery *, .woocommerce-product-gallery *, .grid-container *, .linear-container *'), 
3497		$galleries = $_galleries.filter(function( index ) {
3498			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3499		}),
3500		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3501
3502	if ( typeof $el === 'undefined' ) {
3503		$el = $galleries.add( $nested );
3504	}
3505
3506	var $disabled = $('a.lb-disabled');
3507	$disabled.on('click', function(e){
3508		e.preventDefault();
3509	});
3510
3511	var beforeSlide = function(event) {
3512		var detail = event.detail,
3513			info = detail.info,
3514			item = detail.item,
3515			$slide = $(detail.currentSlide.selector),
3516			$video = $('video', $slide),
3517			$previous = $(detail.previousSlide.selector),
3518			$prevVideo = $('video', $previous),
3519			isAudio = false;
3520
3521		if ( typeof info.src !== 'undefined' ) {
3522			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3523		}
3524
3525		if ( ! $video.length && ( info.video || isAudio ) ) {
3526			if ( info.video ) {
3527				if ( typeof info.video === 'object' ) {
3528					var infoJson = info.video;
3529				} else {
3530					var infoJson = JSON.parse(info.video);
3531				}
3532				var src = infoJson.source[0].src,
3533					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3534					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3535					loop = $(item).attr('data-loop');
3536
3537			} else if ( isAudio ) {
3538				var src = info.src,
3539					autoplay = true,
3540					loop = false;
3541			}
3542			if ( typeof src !== 'undefined' ) {
3543				$slide.addClass('has-html5');
3544				var video = document.createElement('video');
3545				video.src = src;
3546				video.preload = 'auto';
3547				video.controls = 'controls';
3548				video.controlsList = 'nodownload';
3549				if ( autoplay ) {
3550					video.autoplay = 'autoplay';
3551				}
3552				if ( muted ) {
3553					video.muted = 'muted';
3554				}
3555				if ( loop ) {
3556					video.loop = 'loop';
3557				}
3558				$(video).appendTo($slide);
3559			}
3560		} else {
3561			var $video = $('video', $slide);
3562			if ( $video.length ) {
3563				$video[0].currentTime = 0;
3564				if ( $video[0].autoplay ) {
3565					$video[0].play();
3566				}
3567			}
3568		}
3569		if ( $prevVideo.length ) {
3570			$prevVideo[0].currentTime = 0;
3571			$prevVideo[0].pause();
3572		}
3573	};
3574
3575	var beforeOpen = function(event) {
3576		var detail = event.detail,
3577			items = detail.items,
3578			galleryItems = detail.galleryItems,
3579			outer = detail.outer.selector,
3580			i, ii;
3581		for ( i = 0; i < galleryItems.length; i++ ) {
3582			var item = galleryItems[i];
3583			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
3584				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
3585			}
3586		}
3587		for ( ii = 0; ii < items.length; ii++ ) {
3588			var item = items[ii];
3589			if ( $(item).attr('data-icon') === 'video' ) {
3590				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
3591			}
3592		}
3593
3594	};
3595
3596	//caption builder
3597	var captionBuilder = function($el){
3598		$el.each( function( index, val ) {
3599			var $gallery = $(this).attr('data-lbox-init','true'),
3600				$_a = '.lbox-trigger-item',
3601				$_nested_a = '.lbox-nested-item';
3602
3603			$gallery.find($_a, $_nested_a).each(function(){
3604				var $a = $(this),
3605					$img = $('img', $a).first(),
3606					imgw = $img.attr('data-width'),
3607					imgh = $img.attr('data-height'),
3608					caption = $a.attr('data-caption'),
3609					title = $a.attr('data-title');
3610
3611				if ( $img.length && $img.attr('data-crop') != true ) {
3612					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
3613						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
3614					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
3615						$a.attr('data-external-thumb-image', $img[0].src);
3616					}
3617				}
3618
3619				if ( typeof title !== 'undefined' && title !== '' ) {
3620					title = '<h6>' + title + '</h6>';
3621				} else {
3622					title = '';
3623				}
3624
3625				if ( typeof caption !== 'undefined' && caption !== '' ) {
3626					caption = '<p>' + caption + '</p>';
3627					title += caption;
3628				}
3629
3630				if ( title !== '' ) {
3631					$a.attr( 'title', title );
3632				}
3633
3634				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') ) ) {
3635					$a.attr('data-lg-size', imgw + '-' + imgh);
3636				}
3637			});
3638		});
3639	};
3640	captionBuilder($el);
3641
3642	//regular galleries
3643	$el.each( function( index, val ) {
3644		var $gallery = $(this),
3645			$_a = '.lbox-trigger-item',
3646			$_nested_a = '.lbox-nested-item',
3647			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
3648			galleryID = $_first.attr('data-lbox'),
3649			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
3650			tmb = $_first.attr('data-notmb'),
3651			social = $_first.attr('data-social'),
3652			deep = $_first.attr('data-deep'),
3653			zoom = $_first.attr('data-zoom-origin'),
3654			actual = $_first.attr('data-actual-size'),
3655			download = $_first.attr('data-download'),
3656			controls = $_first.attr('data-arrows') !== 'no',
3657			fullScreen = $_first.attr('data-full'),
3658			counter = $_first.attr('data-counter'),
3659			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
3660			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3661			connect = $_first.attr('data-connect'),
3662			lgPlugins = [lgVideo],
3663			itemsLoadedTimeOut;
3664
3665		if ( typeof galleryID === 'undefined' ) {
3666			galleryID = $gallery.attr('id');
3667		}
3668
3669		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3670		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3671
3672		if ( typeof tmb == 'undefined' || !tmb ) {
3673			lgPlugins.push(lgThumbnail);
3674		}
3675		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
3676			lgPlugins.push(lgZoom);
3677		}
3678		if ( typeof deep != 'undefined' && deep != '' ) {
3679			lgPlugins.push(lgHash);
3680		}
3681		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3682			lgPlugins.push(lgFullscreen);
3683		}
3684		if ( social ) {
3685			lgPlugins.push(lgShare);
3686		}
3687
3688		if ( galleries.indexOf( galleryID ) !== -1 ) {
3689			return true;
3690		}
3691
3692		galleries.push( galleryID );
3693		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
3694			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
3695		var gallery = lightGallery( $triggerGal[0], {
3696			addClass: containerClass,
3697			plugins: lgPlugins,
3698			mode: transition,
3699			selector: $selector,
3700			galleryId: galleryID,
3701			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3702			iframeWidth: '848px',
3703			iframeMaxWidth: '90%',
3704			iframeMaxHeight: '90%',
3705			exThumbImage: 'data-external-thumb-image',
3706			loadYouTubeThumbnail: false,
3707			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ),
3708			// autoplayFirstVideo: false,
3709			pager: false,
3710			startClass: 'lg-start-opacity',
3711			zoomFromOrigin: zoom,
3712			controls: controls,
3713			download: ( typeof download != 'undefined' && download != '' ),
3714			thumbWidth: 50,
3715			thumbHeight: '50px',
3716			counter: $triggerGal.find($selector).length > 1 ? counter : false,
3717			loadYouTubePoster: false,
3718			enableDrag: $triggerGal.find($selector).length > 1,
3719			mobileSettings: {
3720				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3721			},
3722		});
3723
3724		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
3725			e.preventDefault();
3726			var index = $(this).closest('.owl-item.cloned').attr('data-index');
3727			gallery.openGallery(index-1);
3728		});
3729
3730		$triggerGal.on('more-items-loaded', function(e, items) {
3731			clearRequestTimeout(itemsLoadedTimeOut);
3732			itemsLoadedTimeOut = requestTimeout(function(){
3733				createSelectors();
3734				captionBuilder($triggerGal);
3735				gallery.refresh();
3736			}, 100);
3737		});
3738
3739		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3740			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3741				$el = model.view.$el;
3742				if ( $el.find($triggerGal).length ) {
3743					gallery.destroy();
3744				}
3745			});
3746		}
3747
3748		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
3749		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
3750		$triggerGal[0].addEventListener('lgAfterOpen', function(){
3751			$(window).trigger('uncode-custom-cursor');
3752		});
3753
3754	});
3755
3756	if ( typeof $el !== 'undefined' ) {
3757
3758		//album galleries
3759		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
3760			var album = val,
3761				galleryID = index,
3762				$album = $(album),
3763				params = $album.attr('data-album'),
3764				tmb = $(val).attr('data-notmb'),
3765				social = $(val).attr('data-social'),
3766				deep = $(val).attr('data-deep'),
3767				actual = $(val).attr('data-actual-size'),
3768				download = $(val).attr('data-download'),
3769				controls = $(val).attr('data-arrows') !== 'no',
3770				fullScreen = $(val).attr('data-full'),
3771				counter = $(val).attr('data-counter'),
3772				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
3773				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3774				lgPlugins = [lgVideo];
3775
3776			$(val).attr('data-lbox-init','true');
3777
3778			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3779			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3780
3781			if ( typeof tmb == 'undefined' || !tmb ) {
3782				lgPlugins.push(lgThumbnail);
3783			}
3784			if ( typeof actual != 'undefined' && actual != '' ) {
3785				lgPlugins.push(lgZoom);
3786			}
3787			if ( typeof deep != 'undefined' && deep != '' ) {
3788				lgPlugins.push(lgHash);
3789			}
3790			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3791				lgPlugins.push(lgFullscreen);
3792			}
3793			if ( social ) {
3794				lgPlugins.push(lgShare);
3795			}
3796
3797			var gallery = window.lightGallery(album, {
3798				dynamic: true,
3799				plugins: lgPlugins,
3800				dynamicEl: JSON.parse(params),
3801				galleryId: galleryID,
3802				addClass: containerClass,
3803				mode: transition,
3804				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3805				iframeWidth: '848px',
3806				iframeMaxWidth: '90%',
3807				iframeMaxHeight: '90%',
3808				loadYouTubeThumbnail: false,
3809				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
3810				// autoplayFirstVideo: false,
3811				pager: false,
3812				startClass: 'lg-start-opacity',
3813				zoomFromOrigin: false,
3814				controls: controls,
3815				download: ( typeof download != 'undefined' && download != '' ),
3816				thumbWidth: 50,
3817				thumbHeight: '50px',
3818				loadYouTubePoster: false,
3819				counter: counter,
3820				exThumbImage: 'data-external-thumb-image',
3821				loadYouTubePoster: false,
3822				mobileSettings: {
3823					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3824				},
3825			});
3826
3827			$album.on('click', function(){
3828				gallery.openGallery(0);
3829			});
3830
3831			album.addEventListener('lgBeforeSlide', beforeSlide);
3832			album.addEventListener('lgBeforeOpen', beforeOpen);
3833			album.addEventListener('lgAfterOpen', function(){
3834				$(window).trigger('uncode-custom-cursor');
3835			});
3836
3837			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3838				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3839					$el = model.view.$el;
3840					if ( $el.find($album).length ) {
3841						gallery.destroy();
3842					}
3843				});
3844			}
3845
3846		});
3847
3848		//single images
3849		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
3850			var gallery = lightGallery( $('.page-wrapper')[0], {
3851				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
3852				iframeWidth: '848px',
3853				iframeMaxWidth: '90%',
3854				iframeMaxHeight: '90%',
3855				loadYouTubeThumbnail: false,
3856				// autoplayFirstVideo: false,
3857				startClass: 'lg-start-opacity',
3858				thumbWidth: 50,
3859				thumbHeight: '50px',
3860				download: false,
3861				loadYouTubePoster: false,
3862				counter: false
3863			});
3864
3865			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
3866			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
3867		});
3868	}
3869};
3870
3871UNCODE.carousel = function(container) {
3872	var $owlContainers = $('.owl-carousel-container', container);
3873	$owlContainers.each(function() {
3874		var $owlContainer = $(this),
3875			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
3876			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
3877			values = {},
3878			tempTimeStamp,
3879			newWidth = UNCODE.wwidth,
3880			$owlInsideEqual = [];
3881		$owlSelector.each(function() {
3882			var itemID = $(this).attr('id'),
3883				$elSelector = $(('#' + itemID).toString());
3884			values['id'] = itemID;
3885			values['items'] = 1;
3886			values['columns'] = 3;
3887			values['fade'] = false;
3888			values['nav'] = false;
3889			values['navmobile'] = false;
3890			values['navskin'] = 'light';
3891			values['navspeed'] = 400;
3892			values['dots'] = false;
3893			values['dotsmobile'] = false;
3894			values['loop'] = false;
3895			values['autoplay'] = false;
3896			values['timeout'] = 3000;
3897			values['autoheight'] = false;
3898			values['stagepadding'] = 0;
3899			values['margin'] = 0;
3900			values['lg'] = 1;
3901			values['md'] = 1;
3902			values['sm'] = 1;
3903			$.each($(this).data(), function(i, v) {
3904				values[i] = v;
3905			});
3906
3907			if ($(this).closest('.uncode-slider').length) {
3908				values['navskin'] = '';
3909				values['navmobile'] = false;
3910				//values['dotsmobile'] = true;
3911			} else {
3912				values['navskin'] = ' style-'+values['navskin']+' style-override';
3913			}
3914
3915			var setIndexActive = function(event, init){
3916				var init = typeof init === 'undefined' ? false : init,
3917					thiis = $(event.currentTarget);
3918				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
3919					var scrolltop = $(document).scrollTop(),
3920						size = event.page.size,
3921						i;
3922					var setIndex = requestTimeout(function() {
3923						for ( i = 0; i < size; i++ ) {
3924							var itemCont = event.item.index != null ? (event.item.index + i) : i;
3925							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
3926							if (thiis.closest('.row-slider').length) {
3927								if (currentItem == undefined) {
3928									currentItem = thiis.children()[i];
3929								}
3930								if ($(currentItem).closest('#page-header').length) {
3931									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
3932										UNCODE.switchColorsMenu(scrolltop, 'dark');
3933									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
3934										UNCODE.switchColorsMenu(scrolltop, 'light');
3935									}
3936								}
3937								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
3938								if (owlCustomNav.length) {
3939									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
3940										owlCustomNav.addClass('style-dark').removeClass('style-light');
3941									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
3942										owlCustomNav.addClass('style-light').removeClass('style-dark');
3943									}
3944								}
3945							}
3946							var itendIndex = $(currentItem).attr('data-index');
3947							if ( isNaN(itendIndex) ) {
3948								itendIndex = 1;
3949							}
3950							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
3951							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
3952							if ($.fn.counterUp) {
3953								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
3954									var $counter = $(this);
3955									$counter.addClass('started').counterUp({
3956										delay: 10,
3957										time: 1500
3958									});
3959								});
3960							}
3961						}
3962						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
3963					}, 200);
3964				}
3965				tempTimeStamp = event.timeStamp;
3966			}
3967
3968			/** Initialize */
3969			$elSelector.on('initialize.owl.carousel', function(event) {
3970				if (typeof UNCODE.owlNav !== 'undefined') {
3971					UNCODE.owlNav(itemID, event);
3972				}
3973
3974				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3975					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
3976						var shortcode = model.attributes.shortcode,
3977							$el = model.view.$el,
3978							$row_wrap = $el.closest('.row');
3979						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
3980							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
3981						}
3982					});
3983					window.parent.vc.events.on('shortcodeView:updated', function(model) {
3984						var shortcode = model.attributes.shortcode;
3985						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
3986							tempTimeStamp = Math.floor(Date.now() / 1000);
3987						}
3988					});
3989					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
3990						var shortcode = model.attributes.shortcode;
3991						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
3992							UNCODE.owlNav(itemID, event);
3993							$elSelector.trigger('refresh.owl.carousel');
3994						}
3995					});
3996				}
3997			});
3998
3999			/** Initialized */
4000			$elSelector.on('initialized.owl.carousel', function(event) {
4001
4002				if ( $('.isotope-container', event.currentTarget).length ) {
4003					window.dispatchEvent(UNCODE.boxEvent);
4004				}
4005
4006				$('.owl-dot.active', $elSelector).on('click', function(){
4007					return false;
4008				});
4009
4010				var thiis = $(event.currentTarget),
4011					// get the time from the data method
4012					time = thiis.data("timer-id"),
4013					rowParent = thiis.closest('.row-parent');
4014
4015				if ( typeof rowParent[0] !== 'undefined' ) {
4016					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4017				}
4018
4019				if (time) {
4020					clearRequestTimeout(time);
4021				}
4022
4023				thiis.addClass('showControls');
4024				var new_time = requestTimeout(function() {
4025					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4026					if (thiis.hasClass('owl-height-viewport'))
4027						setItemsRelHeight(thiis);
4028					if (thiis.hasClass('owl-height-equal'))
4029						setItemsHeight(thiis);
4030					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4031					if (thiis.closest('.unequal, .unexpand').length) {
4032						UNCODE.setRowHeight(rowParent[0], true);
4033					}
4034					if (SiteParameters.dynamic_srcset_active === '1') {
4035						UNCODE.refresh_dynamic_srcset_size(thiis);
4036					}
4037				}, 350);
4038				// save the new time
4039				thiis.data("timer-id", new_time);
4040
4041				var scrolltop = $(document).scrollTop();
4042				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4043
4044				//if (!UNCODE.isMobile) {
4045					/** fix autoplay when visible **/
4046				$(window).on('load', function(){
4047					if (thiis.data('autoplay')) {
4048						if ( !thiis.closest('.sticky-element').length ) {
4049							thiis.trigger('stop.autoplay.owl');
4050						} else {
4051							thiis.trigger('play.owl.autoplay');
4052						}
4053					}
4054					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4055						return;
4056					}
4057					if ( ! thiis.closest('.sticky-element').length ) {
4058						var carouselInView = new Waypoint.Inview({
4059							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4060							element: thiis[0],
4061							exited: function() {
4062								var el = $(this.element);
4063								if (el.data('autoplay') ) {
4064									el.trigger('stop.owl.autoplay');
4065									el.data('stopped','true');
4066								}
4067							},
4068							enter: function(direction) {
4069								var el = $(this.element);
4070								requestTimeout(function() {
4071									if (el.data('autoplay')) {
4072										el.trigger('play.owl.autoplay');
4073										el.data('stopped','false');
4074									}
4075								}, 100);
4076							}
4077						});
4078					}
4079					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4080						setTimeout(function(){
4081							window.lenis.resize();
4082						}, 1000);
4083					}
4084			  
4085				});
4086				//}
4087
4088				// $(window).on('frontend:carousel_updated', function(){
4089				// 	Waypoint.refreshAll();
4090				// });
4091
4092				if (!thiis.closest('.isotope-system').length) {
4093					requestTimeout(function() {
4094						animate_thumb($('.t-inside', el), event);
4095					}, 400);
4096				} else {
4097					requestTimeout(function() {
4098						thiis.closest('.isotope-container').isotope('layout');
4099					}, 400);
4100				}
4101
4102				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4103				currentIndex = $(currentItem).attr('data-index');
4104
4105				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4106					if ($(val).closest('.uncode-slider').length) {
4107						$(val).removeClass('start_animation');
4108					}
4109				});
4110				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4111					if ($(val).closest('.uncode-slider').length) {
4112						$(val).removeClass('already-animated');
4113					}
4114				});
4115
4116				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4117					if ($(val).closest('.uncode-slider').length) {
4118						$(val).removeAttr('data-animated');
4119					}
4120				});
4121
4122				$.each($('.owl-item.cloned', thiis), function(index, val) {
4123					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4124				});
4125
4126				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4127					if ($(val).attr('data-index') != currentIndex) {
4128						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4129						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4130					}
4131					if ($(val).attr('data-index') != currentIndex) {
4132						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4133					}
4134					if ($(val).attr('data-index') == currentIndex) {
4135						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4136					}
4137				});
4138
4139				if (thiis.closest('.uncode-slider').length) {
4140					var el = thiis.closest('.row-parent')[0];
4141					if ($(el).data('imgready')) {
4142						firstLoaded(el, event);
4143					} else {
4144						el.addEventListener("imgLoaded", function(el) {
4145							firstLoaded(el.target, event);
4146						}, false);
4147					}
4148					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4149					if (transHeight != null) {
4150						requestTimeout(function() {
4151							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4152						}, 100);
4153					}
4154				} else {
4155					var el = thiis;
4156					el.closest('.uncode-slider').addClass('slider-loaded');
4157				}
4158
4159				requestTimeout(function() {
4160					if (typeof UNCODE.bigText !== 'undefined') {
4161						UNCODE.bigText(thiis);
4162					}
4163					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4164						if (thiis.data('autoplay')) pauseOnHover(thiis);
4165					}
4166				}, 500);
4167
4168				if (thiis.closest('.unequal').length) {
4169					$owlInsideEqual.push(thiis.closest('.row-parent'));
4170				}
4171
4172				var containerClasses = '',
4173					containerStyle = '';
4174				if ( $('.owl-dots-classes', $owlContainer).length ) {
4175					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4176					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4177					$('.owl-dots-classes', $owlContainer).remove();
4178				}
4179
4180				if ( containerClasses !== '' ) {
4181					requestTimeout(function() {
4182						if ( containerClasses !== '' )
4183							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4184						if ( containerStyle !== '' )
4185							$('.owl-dots', $owlContainer).addClass(containerClasses);
4186					}, 100);
4187				}
4188
4189				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4190					$(val).closest('.row-inner').css({
4191						'margin-top': '-1px'
4192					});
4193				});
4194
4195				if ($.fn.isotope) {
4196					if ( thiis.closest('.isotope-container').length ) {
4197						if (thiis.closest('.isotope-container').data('isotope')) {
4198							requestTimeout(function(){
4199								thiis.closest('.isotope-container').isotope('layout');
4200							}, 300);
4201						}
4202						$(window).on('load', function(){
4203							if (thiis.closest('.isotope-container').data('isotope')) {
4204								thiis.closest('.isotope-container').isotope('layout');
4205							}
4206						});
4207					}
4208				}
4209
4210				if (thiis.data('autoplay')) {
4211					$(window).on('menuOpen', function(){
4212						thiis.trigger('stop.owl.autoplay');
4213						thiis.data('stopped','true');
4214					}).on('menuClose', function(){
4215
4216					});
4217				}
4218				$(window).on('menuClose', function(){
4219					if (thiis.data('autoplay')) {
4220						thiis.trigger('play.owl.autoplay');
4221						thiis.data('stopped','false');
4222					}
4223				});
4224
4225				setIndexActive(event, true);
4226
4227				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4228						return !$(this).closest('.nested-carousel').length;
4229					}),
4230					$_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),
4231					$galleries = $_galleries.filter(function( index ) {
4232						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4233					});
4234
4235				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4236					UNCODE.lightgallery( $galleries );
4237				}
4238
4239			});
4240
4241			$elSelector.on('resized.owl.carousel', function(event) {
4242				var thiis = $(event.currentTarget);
4243				// if ($(this).closest('.nested-carousel').length) {
4244				// 	requestTimeout(function() {
4245				// 		window.dispatchEvent(UNCODE.boxEvent);
4246				// 	}, 200);
4247				// }
4248				if ( thiis.hasClass('owl-height-equal') )
4249					setItemsHeight(thiis);
4250
4251				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4252					newWidth = UNCODE.wwidth;
4253					setItemsRelHeight($elSelector);
4254				}
4255
4256				setIndexActive(event);
4257
4258				if (SiteParameters.dynamic_srcset_active === '1') {
4259					UNCODE.refresh_dynamic_srcset_size(thiis);
4260				}
4261
4262				if ($.fn.isotope) {
4263					$(window).on('load', function(){
4264						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4265							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4266						}
4267					});
4268				}
4269
4270				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4271					setTimeout(function(){
4272						window.lenis.resize();
4273					}, 1000);
4274				}
4275			});
4276
4277			$elSelector.on('refreshed.owl.carousel', function(event) {
4278				setIndexActive(event);
4279			});
4280
4281			/** detect resize window for fluid height layout */
4282			var setFluidResize;
4283			function manageFluidCarouseHeight() {
4284				clearRequestTimeout(setFluidResize);
4285				setFluidResize = requestTimeout(function(){
4286					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4287						newWidth = UNCODE.wwidth;
4288						setItemsRelHeight($elSelector);
4289					}
4290				}, 100);
4291			}
4292			window.addEventListener('resize', manageFluidCarouseHeight);
4293
4294			/** Change */
4295			$elSelector.on('change.owl.carousel', function(event) {
4296				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4297			});
4298
4299			/** Changed */
4300			$elSelector.on('changed.owl.carousel', function(event) {
4301				var $row = $elSelector.parents('.row')[0];
4302				if ( typeof $row !== 'undefined' ) {
4303					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4304				}
4305				setIndexActive(event);
4306			});
4307
4308			var checkDrag = function(e) {
4309				$elSelector.addClass('owl-dragging');
4310			};
4311			$elSelector.on('drag.owl.carousel', function(event) {
4312				document.addEventListener("mousemove", checkDrag);
4313			});
4314
4315			$elSelector.on('dragged.owl.carousel', function(event) {
4316				$elSelector.removeClass('owl-dragging');
4317				document.removeEventListener("mousemove", checkDrag);
4318			});
4319
4320			$elSelector.on('translate.owl.carousel', function(event) {
4321				if (UNCODE.isMobile) {
4322					$(event.currentTarget).addClass('owl-translating');
4323				}
4324			});
4325
4326			/** Translated */
4327			$elSelector.on('translated.owl.carousel', function(event) {
4328
4329				var thiis = $(event.currentTarget),
4330					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4331					currentIndex = $(currentItem).attr('data-index'),
4332					stagePadding = thiis.data('stagepadding');
4333
4334				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4335
4336				if (!UNCODE.isMobile) {
4337					UNCODE.owlPlayVideo(thiis);
4338				}
4339
4340				requestTimeout(function(){
4341					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4342					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4343					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4344						if (lastDelayElems == undefined) lastDelayElems = 0;
4345						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4346						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4347						thiis.trigger('stop.owl.autoplay');
4348						requestTimeout(function() {
4349							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4350						}, maxDelay);
4351					}
4352				}, 200);
4353
4354				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4355					if ($(val).closest('.uncode-slider').length) {
4356						$(val).removeClass('start_animation');
4357					}
4358				});
4359
4360				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4361					if ($(val).closest('.uncode-slider').length) {
4362						$(val).removeClass('already-animated');
4363					}
4364				});
4365
4366				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4367					if ($(val).closest('.uncode-slider').length) {
4368						$(val).removeAttr('data-animated');
4369					}
4370				});
4371
4372				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4373					if ($(val).attr('data-index') != currentIndex) {
4374						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4375						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4376					}
4377					if ($(val).attr('data-index') != currentIndex) {
4378						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4379					}
4380					if ($(val).attr('data-index') == currentIndex) {
4381						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4382					}
4383				});
4384
4385				if (UNCODE.isMobile) {
4386					thiis.removeClass('owl-translating');
4387				}
4388
4389				setIndexActive(event);
4390			});
4391
4392			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4393
4394			/** Init carousel */
4395			$elSelector.not('.showControls').owlCarousel({
4396				items: values['items'],
4397				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4398				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4399				nav: values['nav'],
4400				dots: values['dots'],
4401				loop: values['loop'],
4402				stagePadding: values['stagepadding'],
4403				margin: 0,
4404				video: true,
4405				autoWidth: false,
4406				autoplay: false,
4407				autoplayTimeout: values['timeout'],
4408				autoplaySpeed: values['navspeed'],
4409				autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
4410				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4411				rtl: $('body').hasClass('rtl') ? true : false,
4412				fluidSpeed: true,
4413				navSpeed: values['navspeed'],
4414				dotsSpeed: values['navspeed'] / values['items'],
4415				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4416				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>'],
4417				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4418				responsiveClass: true,
4419				responsiveBaseElement: '.box-container',
4420				responsive: {
4421					0: {
4422						items: values['sm'],
4423						nav: values['navmobile'],
4424						dots: values['dotsmobile'],
4425						dotsSpeed: values['navspeed'] / values['sm'],
4426					},
4427					480: {
4428						items: values['sm'],
4429						nav: values['navmobile'],
4430						dots: values['dotsmobile'],
4431						dotsSpeed: values['navspeed'] / values['sm'],
4432					},
4433					570: {
4434						items: values['md'],
4435						nav: values['navmobile'],
4436						dots: values['dotsmobile'],
4437						dotsSpeed: values['navspeed'] / values['md'],
4438					},
4439					960: {
4440						items: values['lg'],
4441						dotsSpeed: values['navspeed'] / values['lg'],
4442					}
4443				}
4444			});
4445
4446			var transDuration = parseFloat(values['navspeed']) * 0.3;
4447			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
4448
4449			$('.owl-item .tmb', $elSelector).css({
4450				'-webkit-transition-delay': transDuration + 'ms',
4451				'-moz-transition-delay': transDuration + 'ms',
4452				'-o-transition-delay': transDuration + 'ms',
4453				'transition-delay': transDuration + 'ms',
4454				'-webkit-transition-duration': transDuration2 + 'ms',
4455				'-moz-transition-duration': transDuration2 + 'ms',
4456				'-o-transition-duration': transDuration2 + 'ms',
4457				'transition-duration': transDuration2 + 'ms',
4458			});
4459
4460			requestTimeout(function() {
4461				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4462					UNCODE.setRowHeight($owlInsideEqual[i]);
4463				};
4464			}, 300);
4465
4466			$(window).on('load', function(){
4467				var $elCarousel = $elSelector.data('owl.carousel');
4468				if ( typeof $elCarousel !== 'undefined' ) {
4469					$elCarousel.trigger('refreshed');
4470					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4471						UNCODE.setRowHeight($owlInsideEqual[i]);
4472					};
4473				}
4474			});
4475
4476			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
4477				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4478					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
4479					$('#' + carousel_id).find('.owl-item').each( function() {
4480						var $item = $(this),
4481							index = ( $item.index() + 1 );
4482						$item.attr('data-index', index);
4483					});
4484				}
4485			});
4486
4487			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4488				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
4489					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4490						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
4491						$('#' + carousel_id).find('.owl-item').each( function() {
4492							var $item = $(this),
4493								index = ( $item.index() + 1 );
4494							$item.attr('data-index', index);
4495						});
4496					}
4497				});
4498			}
4499
4500		});
4501
4502		function firstLoaded(el, event) {
4503			var el = $(el),
4504			uncode_slider = el.find('.uncode-slider');
4505			el.find('.owl-carousel').css('opacity', 1);
4506			uncode_slider.addClass('slider-loaded');
4507			if (typeof UNCODE.bigText !== 'undefined') {
4508				UNCODE.bigText(el.find('.owl-item.active'));
4509			}
4510			//if (!UNCODE.isMobile) {
4511				requestTimeout(function() {
4512					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
4513					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
4514					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
4515						if (lastDelayElems == undefined) lastDelayElems = 0;
4516						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4517						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4518						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
4519						requestTimeout(function() {
4520							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
4521						}, maxDelay);
4522					}
4523				}, 500);
4524
4525			//}
4526		}
4527
4528		function navHover(el) {
4529			var $owlCont = el,
4530				$owlPrev = $owlCont.find('.owl-prev'),
4531				$owlNext = $owlCont.find('.owl-next'),
4532				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
4533				$owlPagination = $owlCont.next(),
4534				owlPrevW = $owlPrev.outerWidth(),
4535				owlNextW = $owlNext.outerWidth(),
4536				owlDotsH = $owlDots.innerHeight(),
4537				owlTime = 400,
4538				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4539			if ( $('body').hasClass('rtl') ) {
4540				$owlPrev.css("margin-right", -owlPrevW);
4541				$owlNext.css("margin-left", -owlNextW);
4542			} else {
4543				$owlPrev.css("margin-left", -owlPrevW);
4544				$owlNext.css("margin-right", -owlNextW);
4545			}
4546			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
4547			$owlCont.mouseenter(function() {
4548				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4549				$owlPrev.add($owlNext).css({
4550					marginLeft: 0,
4551					marginRight: 0
4552				});
4553				if (!owlNested) {
4554					$owlDots.css({
4555						opacity: 1,
4556						bottom: 0
4557					});
4558				}
4559			}).mouseleave(function() {
4560				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4561				if ( $('body').hasClass('rtl') ) {
4562					$owlPrev.css("margin-right", -owlPrevW);
4563					$owlNext.css("margin-left", -owlNextW);
4564				} else {
4565					$owlPrev.css("margin-left", -owlPrevW);
4566					$owlNext.css("margin-right", -owlNextW);
4567				}
4568				if (!owlNested) {
4569					$owlDots.css({
4570						opacity: 1,
4571						bottom: -owlDotsH
4572					});
4573				}
4574			});
4575		};
4576
4577		function animate_elems($this) {
4578			var lastDelay;
4579			$.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) {
4580				var element = $(val),
4581					delayAttr = element.attr('data-delay'),
4582					$first_item = element.closest('.owl-item[data-index="1"]');
4583
4584				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
4585					return false;
4586				}
4587
4588				if (delayAttr == undefined) delayAttr = 0;
4589				requestTimeout(function() {
4590					element.addClass('start_animation');
4591				}, delayAttr);
4592				lastDelay = delayAttr;
4593			});
4594			return lastDelay;
4595		}
4596
4597		function animate_thumb(items, event) {
4598			var lastDelay,
4599				itemIndex,
4600				thiis = $(event.currentTarget),
4601				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
4602				numActives = $('.owl-item.active', thiis).length,
4603				stagePadding = thiis.data('stagepadding');
4604
4605			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4606
4607			thiis.data('tempIndex', event.item.index);
4608				$.each(items, function(index, val) {
4609					var parent = $(val).closest('.owl-item');
4610					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4611						return;
4612					}
4613					if (!$(val).hasClass('start_animation')) {
4614						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
4615							var thumbInView = new Waypoint.Inview({
4616							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4617							  element: val,
4618							  enter: function(direction) {
4619								var element = $(this.element),
4620										delayAttr = parseInt(element.attr('data-delay')),
4621										itemIndex = element.closest('.owl-item').index() + 1,
4622										diffItem = Math.abs(itemIndex - tempIndex) - 1;
4623									if (itemIndex > tempIndex) {
4624										thiis.data('tempIndex', itemIndex);
4625									}
4626									if (isNaN(delayAttr)) delayAttr = 100;
4627									if (stagePadding) {
4628										var objTimeout = requestTimeout(function() {
4629											element.addClass('start_animation');
4630										}, index * delayAttr);
4631										lastDelay = index * delayAttr;
4632									} else {
4633										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
4634										var objTimeout = requestTimeout(function() {
4635											element.addClass('start_animation');
4636										}, diffItem * delayAttr);
4637										lastDelay = diffItem * delayAttr;
4638									}
4639									parent.data('objTimeout', objTimeout);
4640									if (!UNCODE.isUnmodalOpen) {
4641										this.destroy();
4642									}
4643								}
4644							});
4645						}
4646					}
4647				});
4648				return lastDelay;
4649			}
4650
4651		function setItemsHeight(item) {
4652			$.each($('.owl-item', item), function(index, val) {
4653				var availableThumbHeight = $('.t-inside', $(val)).height(),
4654				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
4655				difference = availableThumbHeight - innerThumbHeight;
4656				if ($('.tmb-content-under', val).length) {
4657					var visualPart = $('.t-entry-visual', val);
4658					if (visualPart.length) {
4659						difference -= $('.t-entry-visual', val).height();
4660					}
4661				}
4662				if (! $('.tmb-content-lateral', val).length)
4663					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
4664			});
4665		}
4666
4667		function setItemsRelHeight(item) {
4668			$.each($('.owl-item', item), function(index, val) {
4669				var $rowContainer = $(item).parents('.row-parent').eq(0),
4670					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
4671					$colContainer = $(item).parents('.uncell').eq(0),
4672					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
4673					winHeight = UNCODE.wheight,
4674					multiplier_h = parseInt($(item).attr('data-vp-height')),
4675					data_viewport_h,
4676					consider_menu = $(item).data('vp-menu');
4677
4678				if ( consider_menu ) {
4679					winHeight = winHeight - UNCODE.menuHeight;
4680				}
4681
4682				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
4683				$('.t-inside', val).css( 'height', data_viewport_h );
4684			});
4685		}
4686
4687		function pauseOnHover(slider) {
4688			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
4689			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
4690				mouseenter: function () {
4691					$(slider).addClass('owl-mouseenter');
4692					$(slider).trigger('stop.owl.autoplay');
4693				},
4694				mouseleave: function () {
4695					$(slider).removeClass('owl-mouseenter');
4696					$(slider).trigger('play.owl.autoplay');
4697				}
4698			});
4699		}
4700	});
4701};
4702
4703UNCODE.owlPlayVideo = function(carousel) {
4704	var player, iframe;
4705	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
4706		var content = $(val).html();
4707		if (content == '') {
4708			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
4709			$(val).append(getCloned);
4710		}
4711		if ($(this).attr('data-provider') == 'vimeo') {
4712			iframe = $(this).find('iframe');
4713			player = new Vimeo.Player(iframe[0]);
4714			player.play();
4715		} else if ($(this).attr('data-provider') == 'youtube') {
4716			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
4717		} else {
4718			var player = $(this).find('video');
4719			if (player.length) {
4720				$(this).find('video')[0].volume = 0;
4721				$(this).find('video')[0].play();
4722				$(val).css('opacity', 1);
4723			}
4724		}
4725	});
4726};
4727
4728UNCODE.owlStopVideo = function(carousel) {
4729	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
4730		var player, iframe;
4731		if ($(this).attr('data-provider') == 'vimeo') {
4732			iframe = $(this).find('iframe');
4733			player = new Vimeo.Player(iframe[0]);
4734			player.pause();
4735		} else if ($(this).attr('data-provider') == 'youtube') {
4736			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
4737		} else {
4738			var player = $(this).find('video');
4739			if (player.length) {
4740				$(this).find('video')[0].volume = 0;
4741				$(this).find('video')[0].play();
4742			}
4743		}
4744	});
4745};
4746
4747UNCODE.animations = function() {
4748
4749	var runWaypoints_TO,
4750		runWaypoints_carousel_TO,
4751		runWaypoints_delay = 0,
4752	highlightComplexFunc = function($wrap, ev){
4753
4754		var $lines = $('.heading-line-wrap', $wrap),
4755			not_animate = false;
4756
4757		if ( $wrap.data('animate') === true ) {
4758			not_animate = true;
4759		}
4760
4761		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
4762		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
4763			return;
4764		}
4765
4766		$lines.each(function(_key, _value){
4767			var $line = $(_value),
4768				$inners = $('.split-word-inner', $line),
4769				$highlights = $('.heading-text-highlight-inner', $line);
4770
4771			var highlitInnerFunc = function(ev){
4772				var delay = 0;
4773				$highlights.each(function(h_key, high){
4774					var $highlight = $(high),
4775						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
4776						$nextSplit = $split.nextUntil(),
4777						$next = $('.heading-text-highlight-inner', $nextSplit),
4778						countCh = $split.text().length;
4779
4780					$highlight.css({
4781						'-webkit-transition-duration': (30 * countCh) + 'ms',
4782						'-moz-transition-duration': (30 * countCh) + 'ms',
4783						'-o-transition-duration': (30 * countCh) + 'ms',
4784						'transition-duration': (30 * countCh) + 'ms',
4785					});
4786
4787					delay += (30 * countCh);
4788
4789					$next.css({
4790						'-webkit-transition-delay': delay + 'ms',
4791						'-moz-transition-delay': delay + 'ms',
4792						'-o-transition-delay': delay + 'ms',
4793						'transition-delay': delay + 'ms',
4794					});
4795				});
4796				$highlights.removeAttr('data-animated');
4797				if ( _key+1 === $lines.length ) {
4798					$wrap.data('animate', true);
4799				}
4800			};
4801
4802			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
4803				if ( not_animate ) {
4804					$highlights.each(function(h_key, high){
4805						var $highlight = $(high);
4806						$highlight.css({
4807							'-webkit-transition-duration': '0ms',
4808							'-moz-transition-duration': '0ms',
4809							'-o-transition-duration': '0ms',
4810							'transition-duration': '0ms',
4811						});
4812					});
4813					$highlights.removeAttr('data-animated');
4814				} else {
4815					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
4816						highlitInnerFunc();
4817					} else {
4818						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
4819					}
4820				}
4821			}
4822		});
4823	};
4824
4825	$.each($('.header-content-inner'), function(index, val) {
4826		var element = $(val),
4827			transition = '';
4828		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
4829		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
4830		if (element.hasClass('left-t-right')) transition = 'left-t-right';
4831		if (element.hasClass('right-t-left')) transition = 'right-t-left';
4832		if (element.hasClass('zoom-in')) transition = 'zoom-in';
4833		if (element.hasClass('zoom-out')) transition = 'zoom-out';
4834		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
4835		if (transition != '') {
4836			$(val).removeClass(transition);
4837			var container = element,
4838				containerDelay = container.attr('data-delay'),
4839				containerSpeed = container.attr('data-speed'),
4840				items = $('.header-title > *, .post-info', container);
4841			$.each(items, function(index, val) {
4842				var element = $(val),
4843					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
4844					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
4845				if (!element.hasClass('animate_when_almost_visible')) {
4846					delayAttr = Number(delayAttr) + (400 * index);
4847					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
4848					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
4849				}
4850			});
4851			container.css('opacity', 1);
4852		}
4853	});
4854
4855	function animate_css_grids_on_load() {
4856		$('.cssgrid-system').each(function() {
4857			var grid = $(this);
4858			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
4859			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
4860		});
4861	}
4862
4863	window.waypoint_animation = function(ev) {
4864		$.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) {
4865			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 ) ) {
4866				return true;
4867			}
4868			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4869				return;
4870			}
4871			var run = true,
4872				$carousel = $(val).closest('.owl-carousel');
4873			if ( $carousel.length ) {
4874				run = false;
4875			}
4876			if (run) {
4877				new Waypoint({
4878					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4879					element: val,
4880					handler: function() {
4881						var element = $(this.element),
4882							index = element.index(),
4883							delayAttr = element.attr('data-delay');
4884						if (delayAttr == undefined) delayAttr = 0;
4885						requestTimeout(function() {
4886							element.addClass('start_animation');
4887						}, delayAttr);
4888						if (!UNCODE.isUnmodalOpen) {
4889							this.destroy();
4890						}
4891					},
4892					offset: UNCODE.isFullPage ? '100%' : '90%'
4893				});
4894			}
4895		});
4896		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
4897			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4898				return;
4899			}
4900			var run = true,
4901				$carousel = $(val).closest('.owl-carousel');
4902			if ( $carousel.length ) {
4903				run = false;
4904			}
4905			if (run) {
4906				new Waypoint({
4907					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4908					element: val,
4909					handler: function() {
4910						var $element = $(this.element),
4911							$childs = $('.animate_when_parent_almost_visible', $element);
4912						$childs.each(function(key,el){
4913							var $child = $(el),
4914								delaySpeed = $child.attr('data-speed'),
4915								delayAttr = $child.attr('data-delay'),
4916								intervalAttr = $child.attr('data-interval');
4917							if (delayAttr == undefined) {
4918								delayAttr = 50*key;
4919							}
4920							requestTimeout(function() {
4921								$child.addClass('start_animation');
4922								if ( $child.hasClass('anim-line-checker') ) {
4923									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4924										var $line = $child.closest('.heading-line-wrap');
4925									});
4926								}
4927								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
4928								highlightComplexFunc($wrapText, ev);
4929								if ( $child.hasClass('anim-tot-checker') ) {
4930									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4931										if ( $child.hasClass('anim-tot-checker') ) {
4932											$wrapText.addClass('already-animated');
4933											$element.trigger('already-animated');
4934										}
4935									});
4936								}
4937							}, delayAttr );
4938						});
4939						$element.addClass('start_animation');
4940						if (!UNCODE.isUnmodalOpen) {
4941							this.destroy();
4942						}
4943					},
4944					offset: UNCODE.isFullPage ? '100%' : '90%'
4945				});
4946			}
4947		});
4948	}
4949	window.waypoint_carousel_animation = function(ev) {
4950		$.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) {
4951			if ( $(val).hasClass('el-text-split') ) {
4952				return true;
4953			}
4954			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4955				return;
4956			}
4957			var run = true,
4958				$carousel = $(val).closest('.owl-carousel'),
4959				$first_item = $(val).closest('.owl-item[data-index="1"]'),
4960				$all_first = $('.owl-item[data-index="1"]', $carousel);
4961			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
4962				run = false;
4963			}
4964			if (run) {
4965				new Waypoint({
4966					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4967					element: val,
4968					handler: function() {
4969						var element = $(this.element),
4970							index = element.index(),
4971							delayAttr = element.attr('data-delay');
4972						if (delayAttr == undefined) delayAttr = 0;
4973						requestTimeout(function() {
4974							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
4975								$all_first.attr('data-already-reached', 'true');
4976							}
4977							element.addClass('start_animation');
4978						}, delayAttr);
4979						if (!UNCODE.isUnmodalOpen) {
4980							this.destroy();
4981						}
4982					},
4983					offset: UNCODE.isFullPage ? '100%' : '90%'
4984				});
4985			}
4986		});
4987		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
4988			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4989				return;
4990			}
4991			var run = true,
4992				$carousel = $(val).closest('.owl-carousel'),
4993				$first_item = $(val).closest('.owl-item[data-index="1"]'),
4994				$all_first = $('.owl-item[data-index="1"]', $carousel);
4995			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
4996				run = false;
4997			}
4998			if (run) {
4999				new Waypoint({
5000					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5001					element: val,
5002					handler: function() {
5003						var $element = $(this.element),
5004							$childs = $('.animate_when_parent_almost_visible', $element);
5005						$childs.each(function(key,el){
5006							var $child = $(el),
5007								delaySpeed = $child.attr('data-speed'),
5008								delayAttr = $child.attr('data-delay'),
5009								intervalAttr = $child.attr('data-interval');
5010							if (delayAttr == undefined) {
5011								delayAttr = 50*key;
5012							}
5013							requestTimeout(function() {
5014								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5015									$all_first.attr('data-already-reached', 'true');
5016								}
5017								$child.addClass('start_animation');
5018								if ( $child.hasClass('anim-line-checker') ) {
5019									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5020										var $line = $child.closest('.heading-line-wrap');
5021									});
5022								}
5023								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5024								highlightComplexFunc($wrapText, ev);
5025								if ( $child.hasClass('anim-tot-checker') ) {
5026									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5027										if ( $child.hasClass('anim-tot-checker') ) {
5028											$wrapText.addClass('already-animated');
5029										}
5030									});
5031								}
5032							}, delayAttr );
5033						});
5034						$element.addClass('start_animation');
5035						if (!UNCODE.isUnmodalOpen) {
5036							this.destroy();
5037						}
5038					},
5039					offset: UNCODE.isFullPage ? '100%' : '90%'
5040				});
5041			}
5042		});
5043	}
5044
5045	var runWaypoints = function(ev){
5046		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5047			runWaypoints_delay = 400;
5048		}
5049		clearRequestTimeout(runWaypoints_TO);
5050		runWaypoints_TO = requestTimeout(function() {
5051			window.waypoint_animation(ev);
5052		}, runWaypoints_delay);
5053
5054		clearRequestTimeout(runWaypoints_carousel_TO);
5055		runWaypoints_carousel_TO = requestTimeout(function() {
5056			window.waypoint_carousel_animation(ev);
5057		}, 400);
5058	};
5059	runWaypoints();
5060	animate_css_grids_on_load();
5061
5062	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5063		runWaypoints(ev);
5064	});
5065	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5066		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5067	}
5068};
5069
5070UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5071	var $allItems = elements.length - startIndex,
5072		showed = 0,
5073		index = 0,
5074		use_index = false
5075		;
5076
5077	if (filtering) {
5078		if (sequential) {
5079			use_index = true;
5080		}
5081		sequential = false;
5082	}
5083
5084	$.each(elements, function(index, val) {
5085		var $this = $(val),
5086			elInner = $('> .t-inside', val);
5087
5088		if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5089			return;
5090		}
5091		if (val[0]) val = val[0];
5092
5093		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5094			new Waypoint({
5095				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5096				element: val,
5097				handler: function() {
5098					var element = $('> .t-inside', this.element),
5099						parent = $(this.element);
5100					var _index = use_index? index : 0;
5101
5102					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5103						delayAttr = parseInt(element.attr('data-delay'));
5104					if (isNaN(delayAttr)) delayAttr = 100;
5105					if (sequential || use_index) {
5106						delay -= showed;
5107					}
5108					var objTimeout = requestTimeout(function() {
5109						element.removeClass('zoom-reverse').addClass('start_animation');
5110						showed = index;
5111					}, delay * delayAttr);
5112					parent.data('objTimeout', objTimeout);
5113					if (!UNCODE.isUnmodalOpen) {
5114						this.destroy();
5115					}
5116				},
5117				offset: UNCODE.isFullPage ? '100%' : '90%'
5118			});
5119		}
5120
5121		index++;
5122	});
5123};
5124
5125UNCODE.tapHover = function() {
5126
5127	var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn
5128		elClass = "hover";
5129
5130	$(window).on('click', function() {
5131		$el.removeClass(elClass);
5132	});
5133
5134	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
5135		e.stopPropagation();
5136		var link = $(this);
5137		if ( ! link.hasClass(elClass)) {
5138			e.preventDefault();
5139			link.addClass("hover");
5140			$el.not(this).removeClass(elClass);
5141			return false;
5142		}
5143	});
5144};
5145
5146UNCODE.onePage = function(isMobile) {
5147	var current = 0,
5148		last = 0,
5149		lastScrollTop = 0,
5150		forceScroll = false,
5151		lastScrolled = 0,
5152		isSectionscroller = ($('.main-onepage').length) ? true : false,
5153		isOnePage = false,
5154		getOffset = function () {
5155			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);
5156			return calculateOffset;
5157		}
5158
5159	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5160
5161	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5162	// 	return false;
5163
5164	function init_onepage() {
5165		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5166			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5167		}
5168		last = $('.onepage-pagination li').last().find('a').data('index');
5169		$.each($('div[data-parent="true"]'), function(index, val) {
5170			$(this).attr('data-section', index);
5171			if (isMobile) return;
5172			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5173				return;
5174			}
5175			var sectionDown = new Waypoint({
5176				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5177				element: val,
5178				handler: function(direction) {
5179					if (direction == 'down') {
5180						changeMenuActive(this.element, index);
5181					}
5182				},
5183				offset: function() {
5184					return 5 + getOffset()
5185				}
5186			});
5187			var sectionUp = new Waypoint({
5188				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5189				element: val,
5190				handler: function(direction) {
5191					if (direction == 'up') {
5192						changeMenuActive(this.element, index);
5193					}
5194				},
5195				offset: function() {
5196					return -5 - getOffset()
5197				}
5198			});
5199
5200			if (isSectionscroller) {
5201				var label;
5202				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5203				else label = '';
5204				var getName = $(this).attr('data-name');
5205				if (getName == undefined) getName = index;
5206				if (label != '') {
5207					isOnePage = true;
5208					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5209					$('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>");
5210				}
5211			}
5212		});
5213
5214		if (isSectionscroller) {
5215			$.each($('ul.onepage-pagination li'), function(index, val) {
5216				var $this = $(val),
5217					$a = ('a', $this);
5218				$a.on('click', function(evt) {
5219					if ( $('.is-selected', $this).length ) {
5220						return false;
5221					}
5222					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5223						evt.preventDefault();
5224					}
5225					Waypoint.refreshAll();
5226					var el = $('a', evt.currentTarget);
5227					current = lastScrolled = parseInt(el.attr('data-index'));
5228					lastScrolled += 1;
5229					scrollBody(current);
5230				});
5231			});
5232		}
5233
5234		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5235		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5236			goToSection = String(window.location.hash).replace(/^#/, "");
5237			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5238		}
5239
5240		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5241			current = lastScrolled = goToSection;
5242			$(window).on('load', function(){
5243				if ( $('.owl-carousel').length ) {
5244					requestTimeout(function(){
5245						scrollBody(goToSection);
5246					}, 400);
5247				} else {
5248					scrollBody(goToSection);
5249				}
5250			});
5251		}
5252
5253	}
5254
5255	function changeMenuActive(section, index) {
5256		current = lastScrolled = parseInt($(section).attr('data-section'));
5257		if (isOnePage) {
5258			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5259			if (newSection.length) {
5260				$('ul.onepage-pagination li a').removeClass('is-selected');
5261				newSection.addClass('is-selected');
5262			}
5263			var getName = $('[data-section="' + index + '"]').attr('data-name');
5264			if (getName != undefined && getName !== '') {
5265				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5266					var get_href = $(val).attr('href');
5267					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5268						$(val).closest('.menu-smart').find('.active').removeClass('active');
5269						$(val).parent().addClass('active');
5270					}
5271				});
5272			}
5273		}
5274	}
5275
5276	if (isOnePage) {
5277		$(window).on('scroll', function() {
5278			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5279			if (bodyTop == 0) {
5280				$('ul.onepage-pagination li a').removeClass('is-selected');
5281				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5282				var getName = $('[data-section=0]').attr('data-name');
5283				if (getName != undefined && getName !== '') {
5284					$.each($('.menu-container .menu-item > a'), function(i, val) {
5285						var get_href = $(val).attr('href');
5286						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5287							$(val).closest('ul').find('.active').removeClass('active');
5288							$(val).parent().addClass('active');
5289						}
5290					});
5291				}
5292			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5293				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5294				if (lastSection.length) {
5295					$('ul.onepage-pagination li a').removeClass('is-selected');
5296					lastSection.addClass('is-selected');
5297				}
5298			}
5299		});
5300	}
5301
5302	var scrollBody = function(index) {
5303		$('ul.onepage-pagination li a').removeClass('is-selected');
5304		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5305
5306		var getSection = $('[data-section=' + index + ']'),
5307			scrollTo;
5308
5309		if (getSection == undefined) return;
5310
5311		var body = $("html, body"),
5312			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5313			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5314			getOffset = UNCODE.get_scroll_offset(index);
5315		if ( typeof getSection.offset() === 'undefined' )
5316			return;
5317		scrollTo = getSection.offset().top;
5318
5319		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5320		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5321			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5322			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5323				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5324			}
5325
5326			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5327				if ( index === 0 ) {
5328					scrollTo = 0;
5329				} else {
5330					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5331				}
5332			} else {
5333				scrollTo -= getOffset;
5334			}
5335		}
5336
5337		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5338		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5339
5340		if (index != 0) {
5341			UNCODE.scrolling = true;
5342		}
5343
5344		if (scrollSpeed == 0) {
5345			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5346			UNCODE.scrolling = false;
5347		} else {
5348			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5349				$(this).stop();
5350			}).animate({
5351				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5352			}, scrollSpeed, 'easeInOutCubic', function() {
5353				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5354				UNCODE.scrolling = false;
5355				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5356				||
5357				$('.menu-hided').length ) {
5358					scrollTo = getSection.offset().top;
5359					getOffset = UNCODE.get_scroll_offset(index);
5360					scrollTo -= getOffset;
5361					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5362						$(this).stop();
5363					}).animate({
5364						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5365						}, scrollSpeed, 'easeInOutCubic', function() {
5366							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5367							UNCODE.scrolling = false;
5368						}
5369					);
5370				}
5371			});
5372		}
5373
5374	};
5375
5376	init_onepage();
5377};
5378
5379UNCODE.stickyElements = function() {
5380	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5381	if (!isMobile_wide ) {
5382
5383		var $pageHeader = $('#page-header'),
5384			$headerRow = $('.vc_row', $pageHeader),
5385			startSticky = false;
5386
5387		if ( $headerRow.hasClass('sticky-element') ) {
5388			$headerRow.removeClass('sticky-element');
5389			$pageHeader.addClass('sticky-element');
5390			startSticky = true;
5391		}
5392
5393		var calculateOffset = function(el) {
5394			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5395				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5396				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5397				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5398
5399			sideOffset += UNCODE.bodyBorder;
5400
5401			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5402			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5403				if ($('.menu-shrink').length) {
5404					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5405				} else {
5406					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5407				}
5408			}
5409
5410			return sideOffset;
5411
5412		},
5413
5414		initStickyElement = function($els) {
5415			if ( $('body').hasClass('vc-safe-mode') ) {
5416				return true;
5417			}
5418			if ( typeof $els === 'undefined' ) {
5419				$els = $('.sticky-element');
5420			}
5421			$.each($els, function(index, element) {
5422				if ($(element).closest('.tab-pane').length) {
5423					var $paneParent = $(element).closest('.tab-pane');
5424					if ( !$paneParent.hasClass('active') ) {
5425						return true;
5426					}
5427				}
5428				$(element).stick_in_parent({
5429					sticky_class: 'is_stucked',
5430					offset_top: calculateOffset(element),
5431					bottoming: true,
5432					inner_scrolling: SiteParameters.sticky_elements === 'on'
5433				});
5434			});
5435		};
5436
5437		var oldW = UNCODE.wwidth,
5438			oldH = UNCODE.wHeight;
5439
5440		requestTimeout(function() {
5441			if ($('.sticky-element').length) {
5442
5443				if ($(window).width() > UNCODE.mediaQuery) {
5444					initStickyElement();
5445
5446					if ( startSticky === true ) {
5447						$('#page-header').trigger('sticky_kit:recalc');
5448					}
5449				}
5450
5451				$(window).on('resize lateral_resize', function(event) {
5452					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
5453						$(".sticky-element").trigger("sticky_kit:detach");
5454						if ($(window).width() > UNCODE.mediaQuery) {
5455							initStickyElement();
5456						}
5457						oldW = UNCODE.wwidth;
5458						oldH = UNCODE.wHeight;
5459					}
5460				});
5461			}
5462		}, 1000);
5463
5464		if ($('.sticky-element').length) {
5465			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
5466				requestTimeout(function() {
5467					$(document.body).trigger("sticky_kit:recalc");
5468				}, 100);
5469			});
5470		}
5471
5472		var $panels = $('.panel-collapse');
5473		if ( $panels.length ) {
5474			$panels.each(function(){
5475				var $panel = $(this);
5476				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
5477					$(document.body).trigger("sticky_kit:recalc");
5478				});
5479			});
5480		}
5481
5482		$('.nav-tabs a').on('shown.bs.tab', function(e){
5483			var $tabs = $(e.target).closest('.tab-container'),
5484				$panel = $('.tab-pane.active', $tabs),
5485				$els = $(e.target).nextAll(".sticky-element");
5486
5487			$els.trigger("sticky_kit:detach");
5488			initStickyElement($els);
5489		});
5490
5491		$(window).on('vc-safe-mode-on', function(){
5492			$(".sticky-element").trigger("sticky_kit:detach");
5493		});
5494
5495		$(window).on('vc-safe-mode-off', function(){
5496			initStickyElement();
5497		});
5498	}
5499};
5500
5501UNCODE.twentytwenty = function() {
5502
5503  if (!$('.twentytwenty-container').length) return;
5504
5505// DOM.event.move
5506//
5507// 2.0.0
5508//
5509// Stephen Band
5510//
5511// Triggers 'movestart', 'move' and 'moveend' events after
5512// mousemoves following a mousedown cross a distance threshold,
5513// similar to the native 'dragstart', 'drag' and 'dragend' events.
5514// Move events are throttled to animation frames. Move event objects
5515// have the properties:
5516//
5517// pageX:
5518// pageY:     Page coordinates of pointer.
5519// startX:
5520// startY:    Page coordinates of pointer at movestart.
5521// distX:
5522// distY:     Distance the pointer has moved since movestart.
5523// deltaX:
5524// deltaY:    Distance the finger has moved since last event.
5525// velocityX:
5526// velocityY: Average velocity over last few events.
5527
5528
5529(function(fn) {
5530	if (typeof define === 'function' && define.amd) {
5531        define([], fn);
5532    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
5533        module.exports = fn;
5534	} else {
5535		fn();
5536	}
5537})(function(){
5538	var assign = Object.assign || window.jQuery && jQuery.extend;
5539
5540	// Number of pixels a pressed pointer travels before movestart
5541	// event is fired.
5542	var threshold = 8;
5543
5544	// Shim for requestAnimationFrame, falling back to timer. See:
5545	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
5546	var requestFrame = (function(){
5547		return (
5548			window.requestAnimationFrame ||
5549			window.webkitRequestAnimationFrame ||
5550			window.mozRequestAnimationFrame ||
5551			window.oRequestAnimationFrame ||
5552			window.msRequestAnimationFrame ||
5553			function(fn, element){
5554				return window.setTimeout(function(){
5555					fn();
5556				}, 25);
5557			}
5558		);
5559	})();
5560
5561	// Shim for customEvent
5562	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
5563	(function () {
5564		if ( typeof window.CustomEvent === "function" ) return false;
5565		function CustomEvent ( event, params ) {
5566			params = params || { bubbles: false, cancelable: false, detail: undefined };
5567			var evt = document.createEvent( 'CustomEvent' );
5568			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
5569			return evt;
5570		}
5571
5572		CustomEvent.prototype = window.Event.prototype;
5573		window.CustomEvent = CustomEvent;
5574	})();
5575
5576	var ignoreTags = {
5577			textarea: true,
5578			input: true,
5579			select: true,
5580			button: true
5581		};
5582
5583	var mouseevents = {
5584		move:   'mousemove',
5585		cancel: 'mouseup dragstart',
5586		end:    'mouseup'
5587	};
5588
5589	var touchevents = {
5590		move:   'touchmove',
5591		cancel: 'touchend',
5592		end:    'touchend'
5593	};
5594
5595	var rspaces = /\s+/;
5596
5597
5598	// DOM Events
5599
5600	var eventOptions = { bubbles: true, cancelable: true };
5601
5602	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
5603
5604	function createEvent(type) {
5605		return new CustomEvent(type, eventOptions);
5606	}
5607
5608	function getEvents(node) {
5609		return node[eventsSymbol] || (node[eventsSymbol] = {});
5610	}
5611
5612	function on(node, types, fn, data, selector) {
5613		types = types.split(rspaces);
5614
5615		var events = getEvents(node);
5616		var i = types.length;
5617		var handlers, type;
5618
5619		function handler(e) { fn(e, data); }
5620
5621		while (i--) {
5622			type = types[i];
5623			handlers = events[type] || (events[type] = []);
5624			handlers.push([fn, handler]);
5625			node.addEventListener(type, handler);
5626		}
5627	}
5628
5629	function off(node, types, fn, selector) {
5630		types = types.split(rspaces);
5631
5632		var events = getEvents(node);
5633		var i = types.length;
5634		var type, handlers, k;
5635
5636		if (!events) { return; }
5637
5638		while (i--) {
5639			type = types[i];
5640			handlers = events[type];
5641			if (!handlers) { continue; }
5642			k = handlers.length;
5643			while (k--) {
5644				if (handlers[k][0] === fn) {
5645					node.removeEventListener(type, handlers[k][1]);
5646					handlers.splice(k, 1);
5647				}
5648			}
5649		}
5650	}
5651
5652	function trigger(node, type, properties) {
5653		// Don't cache events. It prevents you from triggering an event of a
5654		// given type from inside the handler of another event of that type.
5655		var event = createEvent(type);
5656		if (properties) { assign(event, properties); }
5657		node.dispatchEvent(event);
5658	}
5659
5660
5661	// Constructors
5662
5663	function Timer(fn){
5664		var callback = fn,
5665		    active = false,
5666		    running = false;
5667
5668		function trigger(time) {
5669			if (active){
5670				callback();
5671				requestFrame(trigger);
5672				running = true;
5673				active = false;
5674			}
5675			else {
5676				running = false;
5677			}
5678		}
5679
5680		this.kick = function(fn) {
5681			active = true;
5682			if (!running) { trigger(); }
5683		};
5684
5685		this.end = function(fn) {
5686			var cb = callback;
5687
5688			if (!fn) { return; }
5689
5690			// If the timer is not running, simply call the end callback.
5691			if (!running) {
5692				fn();
5693			}
5694			// If the timer is running, and has been kicked lately, then
5695			// queue up the current callback and the end callback, otherwise
5696			// just the end callback.
5697			else {
5698				callback = active ?
5699					function(){ cb(); fn(); } :
5700					fn ;
5701
5702				active = true;
5703			}
5704		};
5705	}
5706
5707
5708	// Functions
5709
5710	function noop() {}
5711
5712	function preventDefault(e) {
5713		e.preventDefault();
5714	}
5715
5716	function isIgnoreTag(e) {
5717		return !!ignoreTags[e.target.tagName.toLowerCase()];
5718	}
5719
5720	function isPrimaryButton(e) {
5721		// Ignore mousedowns on any button other than the left (or primary)
5722		// mouse button, or when a modifier key is pressed.
5723		return (e.which === 1 && !e.ctrlKey && !e.altKey);
5724	}
5725
5726	function identifiedTouch(touchList, id) {
5727		var i, l;
5728
5729		if (touchList.identifiedTouch) {
5730			return touchList.identifiedTouch(id);
5731		}
5732
5733		// touchList.identifiedTouch() does not exist in
5734		// webkit yet… we must do the search ourselves...
5735
5736		i = -1;
5737		l = touchList.length;
5738
5739		while (++i < l) {
5740			if (touchList[i].identifier === id) {
5741				return touchList[i];
5742			}
5743		}
5744	}
5745
5746	function changedTouch(e, data) {
5747		var touch = identifiedTouch(e.changedTouches, data.identifier);
5748
5749		// This isn't the touch you're looking for.
5750		if (!touch) { return; }
5751
5752		// Chrome Android (at least) includes touches that have not
5753		// changed in e.changedTouches. That's a bit annoying. Check
5754		// that this touch has changed.
5755		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
5756
5757		return touch;
5758	}
5759
5760
5761	// Handlers that decide when the first movestart is triggered
5762
5763	function mousedown(e){
5764		// Ignore non-primary buttons
5765		if (!isPrimaryButton(e)) { return; }
5766
5767		// Ignore form and interactive elements
5768		if (isIgnoreTag(e)) { return; }
5769
5770		on(document, mouseevents.move, mousemove, e);
5771		on(document, mouseevents.cancel, mouseend, e);
5772	}
5773
5774	function mousemove(e, data){
5775		checkThreshold(e, data, e, removeMouse);
5776	}
5777
5778	function mouseend(e, data) {
5779		removeMouse();
5780	}
5781
5782	function removeMouse() {
5783		off(document, mouseevents.move, mousemove);
5784		off(document, mouseevents.cancel, mouseend);
5785	}
5786
5787	function touchstart(e) {
5788		// Don't get in the way of interaction with form elements
5789		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
5790
5791		var touch = e.changedTouches[0];
5792
5793		// iOS live updates the touch objects whereas Android gives us copies.
5794		// That means we can't trust the touchstart object to stay the same,
5795		// so we must copy the data. This object acts as a template for
5796		// movestart, move and moveend event objects.
5797		var data = {
5798			target:     touch.target,
5799			pageX:      touch.pageX,
5800			pageY:      touch.pageY,
5801			identifier: touch.identifier,
5802
5803			// The only way to make handlers individually unbindable is by
5804			// making them unique.
5805			touchmove:  function(e, data) { touchmove(e, data); },
5806			touchend:   function(e, data) { touchend(e, data); }
5807		};
5808
5809		on(document, touchevents.move, data.touchmove, data);
5810		on(document, touchevents.cancel, data.touchend, data);
5811	}
5812
5813	function touchmove(e, data) {
5814		var touch = changedTouch(e, data);
5815		if (!touch) { return; }
5816		checkThreshold(e, data, touch, removeTouch);
5817	}
5818
5819	function touchend(e, data) {
5820		var touch = identifiedTouch(e.changedTouches, data.identifier);
5821		if (!touch) { return; }
5822		removeTouch(data);
5823	}
5824
5825	function removeTouch(data) {
5826		off(document, touchevents.move, data.touchmove);
5827		off(document, touchevents.cancel, data.touchend);
5828	}
5829
5830	function checkThreshold(e, data, touch, fn) {
5831		var distX = touch.pageX - data.pageX;
5832		var distY = touch.pageY - data.pageY;
5833
5834		// Do nothing if the threshold has not been crossed.
5835		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
5836
5837		triggerStart(e, data, touch, distX, distY, fn);
5838	}
5839
5840	function triggerStart(e, data, touch, distX, distY, fn) {
5841		var touches = e.targetTouches;
5842		var time = e.timeStamp - data.timeStamp;
5843
5844		// Create a movestart object with some special properties that
5845		// are passed only to the movestart handlers.
5846		var template = {
5847			altKey:     e.altKey,
5848			ctrlKey:    e.ctrlKey,
5849			shiftKey:   e.shiftKey,
5850			startX:     data.pageX,
5851			startY:     data.pageY,
5852			distX:      distX,
5853			distY:      distY,
5854			deltaX:     distX,
5855			deltaY:     distY,
5856			pageX:      touch.pageX,
5857			pageY:      touch.pageY,
5858			velocityX:  distX / time,
5859			velocityY:  distY / time,
5860			identifier: data.identifier,
5861			targetTouches: touches,
5862			finger: touches ? touches.length : 1,
5863			enableMove: function() {
5864				this.moveEnabled = true;
5865				this.enableMove = noop;
5866				e.preventDefault();
5867			}
5868		};
5869
5870		// Trigger the movestart event.
5871		trigger(data.target, 'movestart', template);
5872
5873		// Unbind handlers that tracked the touch or mouse up till now.
5874		fn(data);
5875	}
5876
5877
5878	// Handlers that control what happens following a movestart
5879
5880	function activeMousemove(e, data) {
5881		var timer  = data.timer;
5882
5883		data.touch = e;
5884		data.timeStamp = e.timeStamp;
5885		timer.kick();
5886	}
5887
5888	function activeMouseend(e, data) {
5889		var target = data.target;
5890		var event  = data.event;
5891		var timer  = data.timer;
5892
5893		removeActiveMouse();
5894
5895		endEvent(target, event, timer, function() {
5896			// Unbind the click suppressor, waiting until after mouseup
5897			// has been handled.
5898			setTimeout(function(){
5899				off(target, 'click', preventDefault);
5900			}, 0);
5901		});
5902	}
5903
5904	function removeActiveMouse() {
5905		off(document, mouseevents.move, activeMousemove);
5906		off(document, mouseevents.end, activeMouseend);
5907	}
5908
5909	function activeTouchmove(e, data) {
5910		var event = data.event;
5911		var timer = data.timer;
5912		var touch = changedTouch(e, event);
5913
5914		if (!touch) { return; }
5915
5916		// Stop the interface from gesturing
5917		e.preventDefault();
5918
5919		event.targetTouches = e.targetTouches;
5920		data.touch = touch;
5921		data.timeStamp = e.timeStamp;
5922
5923		timer.kick();
5924	}
5925
5926	function activeTouchend(e, data) {
5927		var target = data.target;
5928		var event  = data.event;
5929		var timer  = data.timer;
5930		var touch  = identifiedTouch(e.changedTouches, event.identifier);
5931
5932		// This isn't the touch you're looking for.
5933		if (!touch) { return; }
5934
5935		removeActiveTouch(data);
5936		endEvent(target, event, timer);
5937	}
5938
5939	function removeActiveTouch(data) {
5940		off(document, touchevents.move, data.activeTouchmove);
5941		off(document, touchevents.end, data.activeTouchend);
5942	}
5943
5944
5945	// Logic for triggering move and moveend events
5946
5947	function updateEvent(event, touch, timeStamp) {
5948		var time = timeStamp - event.timeStamp;
5949
5950		event.distX =  touch.pageX - event.startX;
5951		event.distY =  touch.pageY - event.startY;
5952		event.deltaX = touch.pageX - event.pageX;
5953		event.deltaY = touch.pageY - event.pageY;
5954
5955		// Average the velocity of the last few events using a decay
5956		// curve to even out spurious jumps in values.
5957		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
5958		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
5959		event.pageX =  touch.pageX;
5960		event.pageY =  touch.pageY;
5961	}
5962
5963	function endEvent(target, event, timer, fn) {
5964		timer.end(function(){
5965			trigger(target, 'moveend', event);
5966			return fn && fn();
5967		});
5968	}
5969
5970
5971	// Set up the DOM
5972
5973	function movestart(e) {
5974		if (e.defaultPrevented) { return; }
5975		if (!e.moveEnabled) { return; }
5976
5977		var event = {
5978			startX:        e.startX,
5979			startY:        e.startY,
5980			pageX:         e.pageX,
5981			pageY:         e.pageY,
5982			distX:         e.distX,
5983			distY:         e.distY,
5984			deltaX:        e.deltaX,
5985			deltaY:        e.deltaY,
5986			velocityX:     e.velocityX,
5987			velocityY:     e.velocityY,
5988			identifier:    e.identifier,
5989			targetTouches: e.targetTouches,
5990			finger:        e.finger
5991		};
5992
5993		var data = {
5994			target:    e.target,
5995			event:     event,
5996			timer:     new Timer(update),
5997			touch:     undefined,
5998			timeStamp: e.timeStamp
5999		};
6000
6001		function update(time) {
6002			updateEvent(event, data.touch, data.timeStamp);
6003			trigger(data.target, 'move', event);
6004		}
6005
6006		if (e.identifier === undefined) {
6007			// We're dealing with a mouse event.
6008			// Stop clicks from propagating during a move
6009			on(e.target, 'click', preventDefault);
6010			on(document, mouseevents.move, activeMousemove, data);
6011			on(document, mouseevents.end, activeMouseend, data);
6012		}
6013		else {
6014			// In order to unbind correct handlers they have to be unique
6015			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6016			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6017
6018			// We're dealing with a touch.
6019			on(document, touchevents.move, data.activeTouchmove, data);
6020			on(document, touchevents.end, data.activeTouchend, data);
6021		}
6022	}
6023
6024	on(document, 'mousedown', mousedown);
6025	on(document, 'touchstart', touchstart);
6026	on(document, 'movestart', movestart);
6027
6028
6029	// jQuery special events
6030	//
6031	// jQuery event objects are copies of DOM event objects. They need
6032	// a little help copying the move properties across.
6033
6034	if (!window.jQuery) { return; }
6035
6036	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6037
6038	function enableMove1(e) { e.enableMove(); }
6039	function enableMove2(e) { e.enableMove(); }
6040	function enableMove3(e) { e.enableMove(); }
6041
6042	function add(handleObj) {
6043		var handler = handleObj.handler;
6044
6045		handleObj.handler = function(e) {
6046			// Copy move properties across from originalEvent
6047			var i = properties.length;
6048			var property;
6049
6050			while(i--) {
6051				property = properties[i];
6052				e[property] = e.originalEvent[property];
6053			}
6054
6055			handler.apply(this, arguments);
6056		};
6057	}
6058
6059	jQuery.event.special.movestart = {
6060		setup: function() {
6061			// Movestart must be enabled to allow other move events
6062			on(this, 'movestart', enableMove1);
6063
6064			// Do listen to DOM events
6065			return false;
6066		},
6067
6068		teardown: function() {
6069			off(this, 'movestart', enableMove1);
6070			return false;
6071		},
6072
6073		add: add
6074	};
6075
6076	jQuery.event.special.move = {
6077		setup: function() {
6078			on(this, 'movestart', enableMove2);
6079			return false;
6080		},
6081
6082		teardown: function() {
6083			off(this, 'movestart', enableMove2);
6084			return false;
6085		},
6086
6087		add: add
6088	};
6089
6090	jQuery.event.special.moveend = {
6091		setup: function() {
6092			on(this, 'movestart', enableMove3);
6093			return false;
6094		},
6095
6096		teardown: function() {
6097			off(this, 'movestart', enableMove3);
6098			return false;
6099		},
6100
6101		add: add
6102	};
6103});
6104
6105  $.fn.twentytwenty = function(options) {
6106    var options = $.extend({
6107      default_offset_pct: 0.5,
6108      orientation: 'horizontal',
6109      before_label: 'Before',
6110      after_label: 'After',
6111      no_overlay: false,
6112      move_slider_on_hover: false,
6113      move_with_handle_only: true,
6114      click_to_move: false
6115    }, options);
6116
6117    return this.each(function() {
6118
6119      var sliderPct = options.default_offset_pct;
6120      var container = $(this);
6121      var sliderOrientation = options.orientation;
6122      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6123      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6124
6125
6126      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6127      if(!options.no_overlay) {
6128        container.append("<div class='twentytwenty-overlay'></div>");
6129        var overlay = container.find(".twentytwenty-overlay");
6130        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6131        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6132      }
6133      var beforeImg = container.find("img:first");
6134      var afterImg = container.find("img:last");
6135      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6136      var slider = container.find(".twentytwenty-handle");
6137      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6138      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6139      container.addClass("twentytwenty-container");
6140      beforeImg.addClass("twentytwenty-before");
6141      afterImg.addClass("twentytwenty-after");
6142
6143      var calcOffset = function(dimensionPct) {
6144        var w = beforeImg.width();
6145        var h = beforeImg.height();
6146        return {
6147          w: w+"px",
6148          h: h+"px",
6149          cw: (dimensionPct*w)+"px",
6150          ch: (dimensionPct*h)+"px"
6151        };
6152      };
6153
6154      var adjustContainer = function(offset) {
6155      	if (sliderOrientation === 'vertical') {
6156          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6157          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6158      	}
6159      	else {
6160          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6161          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6162    	}
6163        container.css("height", offset.h);
6164      };
6165
6166      var adjustSlider = function(pct) {
6167        var offset = calcOffset(pct);
6168        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6169        adjustContainer(offset);
6170      };
6171
6172      // Return the number specified or the min/max number if it outside the range given.
6173      var minMaxNumber = function(num, min, max) {
6174        return Math.max(min, Math.min(max, num));
6175      };
6176
6177      // Calculate the slider percentage based on the position.
6178      var getSliderPercentage = function(positionX, positionY) {
6179        var sliderPercentage = (sliderOrientation === 'vertical') ?
6180          (positionY-offsetY)/imgHeight :
6181          (positionX-offsetX)/imgWidth;
6182
6183        return minMaxNumber(sliderPercentage, 0, 1);
6184      };
6185
6186
6187      $(window).on("resize.twentytwenty", function(e) {
6188        adjustSlider(sliderPct);
6189      });
6190
6191      var offsetX = 0;
6192      var offsetY = 0;
6193      var imgWidth = 0;
6194      var imgHeight = 0;
6195      var onMoveStart = function(e) {
6196        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6197          e.preventDefault();
6198        }
6199        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6200          e.preventDefault();
6201        }
6202        container.addClass("active");
6203        offsetX = container.offset().left;
6204        offsetY = container.offset().top;
6205        imgWidth = beforeImg.width();
6206        imgHeight = beforeImg.height();
6207      };
6208      var onMove = function(e) {
6209        if (container.hasClass("active")) {
6210          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6211          adjustSlider(sliderPct);
6212        }
6213      };
6214      var onMoveEnd = function() {
6215          container.removeClass("active");
6216      };
6217
6218      var moveTarget = options.move_with_handle_only ? slider : container;
6219      moveTarget.on("movestart",onMoveStart);
6220      moveTarget.on("move",onMove);
6221      moveTarget.on("moveend",onMoveEnd);
6222
6223      if (options.move_slider_on_hover) {
6224        container.on("mouseenter", onMoveStart);
6225        container.on("mousemove", onMove);
6226        container.on("mouseleave", onMoveEnd);
6227      }
6228
6229      slider.on("touchmove", function(e) {
6230        e.preventDefault();
6231      });
6232
6233      container.find("img").on("mousedown", function(event) {
6234        event.preventDefault();
6235      });
6236
6237      if (options.click_to_move) {
6238        container.on('click', function(e) {
6239          offsetX = container.offset().left;
6240          offsetY = container.offset().top;
6241          imgWidth = beforeImg.width();
6242          imgHeight = beforeImg.height();
6243
6244          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6245          adjustSlider(sliderPct);
6246        });
6247      }
6248
6249      $(window).trigger("resize.twentytwenty");
6250    });
6251  };
6252
6253
6254  $(window).on("load", function(e) {
6255  	$('.twentytwenty-container').each(function(){
6256  		var $container = $(this);
6257  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6258  			$container.twentytwenty();
6259  		}
6260  		$('img', $container).on('async-done', function(){
6261	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6262	  			$container.twentytwenty();
6263	  		}
6264	    });
6265  	});
6266  });
6267}
6268
6269UNCODE.justifiedGallery = function() {
6270
6271	var breakPointMe = function( val ) {
6272		val = parseInt( val );
6273		if ( isNaN(val) ) {
6274			return false;
6275		}
6276		if ( val >= 1500 ) {
6277			return 1;
6278		} else if ( val < 1500 && val >= 960 ) {
6279			return 2;
6280		} else if ( val < 960 && val >= 570 ) {
6281			return 3;
6282		} else if ( val < 570 ) {
6283			return 4;
6284		}
6285	}
6286
6287	var gutterByBreakpoint = function( bp, gutter ) {
6288		var ret;
6289		switch(gutter) {
6290		    case 'no-gutter':
6291		    	ret = 0;
6292		        break;
6293		    case 'px-gutter':
6294		    	ret = 1;
6295		        break;
6296		    case 'half-gutter':
6297		    	ret = 18;
6298		        break;
6299		    case 'double-gutter':
6300				switch(bp) {
6301				    case 3:
6302				    case 4:
6303				    	ret = 36;
6304				        break;
6305				    default:
6306				    	ret = 72;
6307				        break;
6308				}
6309		        break;
6310		    case 'triple-gutter':
6311				switch(bp) {
6312				    case 3:
6313				    case 4:
6314				    	ret = 36;
6315				        break;
6316				    default:
6317				    	ret = 108;
6318				        break;
6319				}
6320		        break;
6321		    case 'quad-gutter':
6322				switch(bp) {
6323				    case 2:
6324				    	ret = 108;
6325				        break;
6326				    case 3:
6327				    	ret = 72;
6328				        break;
6329				    case 4:
6330				    	ret = 36;
6331				        break;
6332				    default:
6333				    	ret = 144;
6334				        break;
6335				}
6336		        break;
6337		    default:
6338		    	ret = 36;//single-gutter
6339		}
6340		return ret;
6341	}
6342
6343	if ($('.justified-layout').length > 0) {
6344		var justifiedContainersArray = [],
6345			typeGridArray = [],
6346			layoutGridArray = [],
6347			transitionDuration = [],
6348			$filterItems = [],
6349			$filters = $('.justified-system .isotope-filters'),
6350			$itemSelector = '.tmb',
6351			$items,
6352			itemMargin,
6353			correctionFactor = 0,
6354			firstLoad = true,
6355			isOriginLeft = $('body').hasClass('rtl') ? false : true,
6356			prevW = breakPointMe(UNCODE.wwidth);
6357		$('[class*="justified-container"]').each(function() {
6358			var isoData = $(this).data();
6359			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6360			if (isoData.type == 'metro') typeGridArray.push(true);
6361			else typeGridArray.push(false);
6362			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
6363			else layoutGridArray.push('justified');
6364			justifiedContainersArray.push($(this));
6365		});
6366		var init_justifiedGallery = function() {
6367			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
6368				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
6369					justifiedId = justifiedSystem.attr('id'),
6370					$layoutMode = layoutGridArray[i],
6371					gutter = $(justifiedContainersArray[i]).data('gutter'),
6372					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
6373					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
6374					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6375					margins;
6376
6377				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6378				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6379				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6380
6381				margins = gutterByBreakpoint(prevW, gutter);
6382
6383				$(justifiedContainersArray[i]).justifiedGallery({
6384					rowHeight: rowHeight,
6385					maxRowHeight: maxRowHeight,
6386					margins: margins,
6387					cssAnimation: true,
6388					lastRow: lastRow,
6389					waitThumbnailsLoad: false
6390				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6391
6392				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6393					$(justifiedContainersArray[i]).infinitescroll({
6394							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6395							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6396							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6397							animate: false,
6398							behavior: 'local',
6399							debug: false,
6400							loading: {
6401								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6402								speed: 0,
6403								finished: undefined,
6404								msg: $('#' + justifiedId + ' .loadmore-button'),
6405							},
6406							errorCallback: function() {
6407								var justified_system = $(this).closest('.justified-system');
6408								$('.loading-button', justified_system).hide();
6409								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
6410							}
6411						},
6412						// append the new items to galleryJustified on the infinitescroll callback function.
6413						function(newElements, opts) {
6414							var $galleryJustified = $(this),
6415								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
6416								filters = new Array(),
6417								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
6418								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
6419								$numPages = $('a', $infinite_button).data('pages'),
6420								delay = 300;
6421							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6422							$infinite_button.show();
6423							$loading_button.hide();
6424							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6425							$('> li', $galleryJustified).remove();
6426							$.each($(newElements), function(index, val) {
6427								$(val).addClass('tmb-iso');
6428								if ($(val).is("li")) {
6429									filters.push($(val)[0]);
6430								}
6431								$(val).addClass('uncode-appended');
6432							});
6433							newElements = newElements.filter(function(x) {
6434								return filters.indexOf(x) < 0
6435							});
6436							$.each($(filters), function(index, val) {
6437								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
6438							});
6439							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
6440							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6441								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
6442								if (typeof getLightbox === 'object') {
6443									getLightbox.refresh();
6444								} else {
6445									UNCODE.lightbox();
6446								}
6447							}
6448							if ( typeof twttr !== 'undefined' )
6449								twttr.widgets.load(justifiedContainersArray[i]);
6450
6451							requestTimeout(function() {
6452								$galleryJustified.trigger('more-items-loaded');
6453								$(window).trigger('more-items-loaded');
6454								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6455							}, 1000);
6456						});
6457					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
6458						var $infinite_justified = $(justifiedContainersArray[i]),
6459							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
6460						$infinite_justified.infinitescroll('pause');
6461						$infinite_button.on('click', function(event) {
6462							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6463								$.each(UNCODE.lightboxArray, function(index, val) {
6464									UNCODE.lightboxArray[index].destroy();
6465								});
6466							}
6467							event.preventDefault();
6468							var $justified_system = $(event.target).closest('.justified-system'),
6469							$infinite_justified = $justified_system.find('.justified-container'),
6470							justifiedId = $justified_system.attr('id');
6471							$(event.currentTarget).html(SiteParameters.loading);
6472							$infinite_justified.infinitescroll('resume');
6473							$infinite_justified.infinitescroll('retrieve');
6474							$infinite_justified.infinitescroll('pause');
6475							$infinite_justified.trigger('more-items-loaded');
6476							$(window).trigger('more-items-loaded');
6477							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6478						});
6479					}
6480				}
6481			}
6482		},
6483		onLayout = function(justifiedObj, startIndex) {
6484			justifiedObj.css('opacity', 1);
6485			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
6486			$('.tmb', justifiedObj).addClass('justified-object-loaded');
6487
6488			requestTimeout(function() {
6489				// window.dispatchEvent(UNCODE.boxEvent);
6490				UNCODE.adaptive();
6491				if (SiteParameters.dynamic_srcset_active === '1') {
6492					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
6493				}
6494				if (typeof MediaElement === "function") {
6495					$(justifiedObj).find('audio,video').each(function() {
6496						$(this).mediaelementplayer({
6497								pauseOtherPlayers: false,
6498						});
6499					});
6500				}
6501				if ($(justifiedObj).find('.nested-carousel').length) {
6502					if (typeof UNCODE.carousel !== 'undefined') {
6503						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
6504					}
6505					requestTimeout(function() {
6506						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6507						justifiedObj.addClass('justified-gallery-finished')
6508						Waypoint.refreshAll();
6509					}, 200);
6510				} else {
6511					requestTimeout(function() {
6512						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6513						justifiedObj.addClass('justified-gallery-finished')
6514						Waypoint.refreshAll();
6515					}, 300);
6516				}
6517			}, 100);
6518
6519		},
6520		boxAnimation = function(items, startIndex, sequential, container) {
6521			var $allItems = items.length - startIndex,
6522				showed = 0,
6523				index = 0;
6524			if (container.closest('.owl-item').length == 1) return false;
6525			$.each(items, function(index, val) {
6526				var elInner = $('> .t-inside', val);
6527				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
6528					return;
6529				}
6530				if (val[0]) val = val[0];
6531				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
6532					new Waypoint({
6533						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
6534						element: val,
6535						handler: function() {
6536							var element = $('> .t-inside', this.element),
6537								parent = $(this.element),
6538								currentIndex = parent.index();
6539							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
6540								delayAttr = parseInt(element.attr('data-delay'));
6541							if (isNaN(delayAttr)) delayAttr = 100;
6542							delay -= showed;
6543							var objTimeout = requestTimeout(function() {
6544								element.removeClass('zoom-reverse').addClass('start_animation');
6545								showed = parent.index();
6546							}, delay * delayAttr);
6547							parent.data('objTimeout', objTimeout);
6548							if (!UNCODE.isUnmodalOpen) {
6549								this.destroy();
6550							}
6551						},
6552						offset: '100%'
6553					})
6554				} else {
6555					elInner.removeClass('animate_when_almost_visible');
6556					$(val).addClass('no-waypoint-animation');
6557					/*if (elInner.hasClass('force-anim')) {
6558						elInner.addClass('start_animation');
6559					} else {
6560						elInner.css('opacity', 1);
6561					}*/
6562				}
6563				index++;
6564			});
6565		};
6566		$filters.on('click', 'a[data-filter]', function(evt) {
6567			var $filter = $(this),
6568				filterContainer = $filter.closest('.isotope-filters'),
6569				filterValue = $filter.attr('data-filter'),
6570				container = $filter.closest('.justified-system').find($('.justified-layout')),
6571				lastRow = container.data('last-row'),
6572				transitionDuration = 0,
6573				delay = 300,
6574				filterItems = [];
6575
6576			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6577
6578			var filter_items = function(){
6579				if (filterValue !== undefined) {
6580					$.each($('> .tmb > .t-inside', container), function(index, val) {
6581						var parent = $(val).parent(),
6582							objTimeout = parent.data('objTimeout');
6583						if (objTimeout) {
6584							$(val).removeClass('zoom-reverse');
6585							clearRequestTimeout(objTimeout);
6586						}
6587						if (transitionDuration == 0) {
6588							if ($(val).hasClass('animate_when_almost_visible')) {
6589								$(val).addClass('zoom-reverse').removeClass('start_animation');
6590							} else {
6591								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6592							}
6593						}
6594					});
6595
6596					requestTimeout(function() {
6597						var $block,
6598							selector,
6599							lightboxElements,
6600							$boxes;
6601
6602						if ( filterValue !== '' && filterValue !== '*' ) {
6603							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
6604							selector = '.' + filterValue;
6605							$.each($(selector, container), function(index, block) {
6606								lightboxElements = $('[data-lbox^=ilightbox]', block);
6607								if (lightboxElements.length) {
6608									lightboxElements.removeClass('lb-disabled');
6609									container.data('lbox', $(lightboxElements[0]).data('lbox'));
6610								}
6611								filterItems.push(block);
6612							});
6613							container.justifiedGallery({
6614								filter: selector,
6615								lastRow: 'nojustify'
6616							});
6617						} else {
6618							container.justifiedGallery({
6619								filter: false,
6620								lastRow: lastRow
6621							});
6622							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
6623							filterItems = $('> .tmb', container);
6624						}
6625						container.trigger('more-items-loaded');
6626						$(window).trigger('more-items-loaded');
6627						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6628
6629						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6630						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6631							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
6632							if (typeof getLightbox === 'object') {
6633								getLightbox.refresh();
6634							} else {
6635								UNCODE.lightbox();
6636							}
6637						}
6638
6639						if (transitionDuration == 0) {
6640							requestTimeout(function() {
6641								boxAnimation(filterItems, 0, false, container);
6642							}, 100);
6643						}
6644						requestTimeout(function() {
6645							Waypoint.refreshAll();
6646							container.trigger('more-items-loaded');
6647							$(window).trigger('more-items-loaded');
6648							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6649						}, 2000);
6650
6651					}, delay);
6652				} else {
6653					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6654						$.each(UNCODE.lightboxArray, function(index, val) {
6655							UNCODE.lightboxArray[index].destroy();
6656						});
6657					}
6658					$.each($('> .tmb > .t-inside', container), function(index, val) {
6659						var parent = $(val).parent(),
6660							objTimeout = parent.data('objTimeout');
6661						if (objTimeout) {
6662							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6663							clearRequestTimeout(objTimeout);
6664						}
6665						if (transitionDuration == 0) {
6666							if ($(val).hasClass('animate_when_almost_visible')) {
6667								$(val).addClass('zoom-reverse').removeClass('start_animation');
6668							} else {
6669								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6670							}
6671						}
6672					});
6673					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6674						UNCODE.lightbox();
6675					}
6676					container.parent().addClass('justified-loading');
6677					container.trigger('more-items-loaded');
6678					$(window).trigger('more-items-loaded');
6679					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6680				}
6681			};
6682
6683			if (!$filter.hasClass('active')) {
6684				/** Scroll top with filtering */
6685				if (filterContainer.hasClass('filter-scroll')) {
6686                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6687                    calc_scroll -= UNCODE.get_scroll_offset();
6688
6689					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6690						delta = bodyTop - calc_scroll,
6691						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6692						filterTolerance = false,
6693						filter_timeout;
6694					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6695
6696					if ( !UNCODE.isFullPage ) {
6697						if (scrollSpeed == 0) {
6698							$('html, body').scrollTop(calc_scroll);
6699							UNCODE.scrolling = false;
6700							filter_items();
6701						} else {
6702
6703							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6704								filter_items();
6705								filterTolerance = true;
6706							}
6707
6708							$('html, body').animate({
6709								scrollTop: calc_scroll
6710							},{
6711								easing: 'easeInOutQuad',
6712								duration: scrollSpeed,
6713								complete: function(){
6714									UNCODE.scrolling = false;
6715									if ( !filterTolerance ) {
6716										filter_timeout = setTimeout(function(){
6717											clearTimeout(filter_timeout);
6718											filter_items();
6719										}, 200);
6720									}
6721								}
6722							});
6723						}
6724					}
6725				} else {
6726					filter_items();
6727				}
6728			}
6729			evt.preventDefault();
6730		});
6731
6732		$filters.each(function(i, buttonGroup) {
6733			var $buttonGroup = $(buttonGroup);
6734			$buttonGroup.on('click', 'a', function() {
6735				$buttonGroup.find('.active').removeClass('active');
6736				$(this).addClass('active');
6737			});
6738
6739			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6740				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6741				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6742			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6743				e.preventDefault();
6744				$cats_filters.slideToggle(400, 'easeInOutCirc');
6745			});
6746		});
6747		window.addEventListener('boxResized', function(e) {
6748			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
6749				prevW = breakPointMe(UNCODE.wwidth);
6750				$.each($('.justified-layout'), function(index, val) {
6751					var gutter = $(this).data('gutter'),
6752						margins = gutterByBreakpoint( prevW, gutter);
6753					$(this).justifiedGallery({
6754						margins: margins
6755					});
6756					$(this).find('.mejs-video,.mejs-audio').each(function() {
6757						$(this).trigger('resize');
6758					});
6759				});
6760			}
6761		}, false);
6762
6763		init_justifiedGallery();
6764	};
6765};
6766
6767UNCODE.cssGrid = function() {
6768	if ($('.cssgrid-layout').length > 0) {
6769		var cssGridContainersArray = [];
6770		var transitionDuration = [];
6771		var $filters = $('.cssgrid-system .cssgrid-filters');
6772
6773		$('[class*="cssgrid-container"]').each(function() {
6774			cssGridContainersArray.push($(this));
6775			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6776		});
6777
6778		var init_cssGridAjax = function() {
6779			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
6780				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
6781					cssGridId = cssGridSystem.attr('id');
6782
6783				cssGridSystem.data('transitionDuration', transitionDuration[i]);
6784
6785				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
6786					$(cssGridContainersArray[i]).infinitescroll({
6787						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
6788						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6789						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
6790						animate: false,
6791						behavior: 'local',
6792						debug: false,
6793						loading: {
6794							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
6795							speed: 0,
6796							finished: undefined,
6797							msg: $('#' + cssGridId + ' .loadmore-button'),
6798						},
6799						errorCallback: function() {
6800							var cssgrid_system = $(this).closest('.cssgrid-system');
6801							$('.loading-button', cssgrid_system).hide();
6802							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
6803						}
6804					},
6805					// append the new items to cssGrid on the infinitescroll callback function.
6806					function(newElements, opts) {
6807						var $cssGrid = $(this),
6808							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
6809							cssGridId = cssGridSystemCont.attr('id'),
6810							filters = new Array(),
6811							$loading_button = cssGridSystemCont.find('.loading-button'),
6812							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
6813							$numPages = $('a', $infinite_button).data('pages'),
6814							$woo_results,
6815							delay = 300;
6816						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6817						$infinite_button.show();
6818						$loading_button.hide();
6819						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6820						$('> li', $cssGrid).remove();
6821						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
6822						$.each($(newElements), function (index, val) {
6823							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
6824								$woo_results = $(val);
6825								delete newElements[index];
6826							} else {
6827								$(val).addClass('tmb-grid');
6828								if ($(val).is("li")) {
6829									filters.push($(val)[0]);
6830								}
6831							}
6832							$(val).addClass('uncode-appended');
6833						});
6834						newElements = newElements.filter(function(x) {
6835							return filters.indexOf(x) < 0
6836						});
6837						$.each($(filters), function(index, val) {
6838							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
6839						});
6840						if ($woo_results && $woo_results.length > 0) {
6841							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
6842							var new_count = $woo_results.find('.woocommerce-result-count').text();
6843							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
6844							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
6845							function replaceMatch(match, p1, p2) {
6846        						return old_start + '–' + new_end;
6847							}
6848							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
6849							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
6850						}
6851
6852						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6853						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
6854						if (filterValue !== undefined && filterValue != '*') {
6855							$(newElements).hide();
6856							var els_to_show = $();
6857							$(newElements).each(function() {
6858								var el = $(this);
6859								if (el.hasClass(filterValue)) {
6860									els_to_show = els_to_show.add(el);
6861									el.show();
6862								}
6863							});
6864							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
6865						} else {
6866							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
6867						}
6868
6869						UNCODE.adaptive();
6870						if (SiteParameters.dynamic_srcset_active === '1') {
6871							UNCODE.refresh_dynamic_srcset_size($cssGrid);
6872						}
6873						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6874							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
6875							if (typeof getLightbox === 'object') {
6876								getLightbox.refresh();
6877							} else {
6878								UNCODE.lightbox();
6879							}
6880						}
6881						if ( typeof twttr !== 'undefined' ) {
6882							twttr.widgets.load(cssGridContainersArray[i]);
6883						}
6884
6885						UNCODE.carousel($(newElements));
6886						requestTimeout(function() {
6887							$cssGrid.trigger('more-items-loaded');
6888							$(window).trigger('more-items-loaded');
6889							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6890						}, 1000);
6891
6892					});
6893					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
6894						var $cssgrid_el = $(cssGridContainersArray[i]),
6895							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
6896						$cssgrid_el.infinitescroll('pause');
6897						$infinite_button.on('click', function(event) {
6898							event.preventDefault();
6899							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
6900							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
6901							cssGridId = $cssgrid_system.attr('id');
6902							$(event.currentTarget).html(SiteParameters.loading);
6903							$cssgrid_el.infinitescroll('resume');
6904							$cssgrid_el.infinitescroll('retrieve');
6905							$cssgrid_el.infinitescroll('pause');
6906						});
6907					}
6908				}
6909			}
6910		};
6911
6912		init_cssGridAjax();
6913
6914		if ($('.cssgrid-pagination').length > 0) {
6915			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
6916				evt.preventDefault();
6917
6918				if (SiteParameters.index_pagination_disable_scroll !== '1') {
6919					var container = $(this).closest('.cssgrid-system'),
6920					calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6921
6922					calc_scroll -= UNCODE.get_scroll_offset();
6923
6924					var menu_container = $('.menu-sticky');
6925					var menu = menu_container.find('.menu-container');
6926
6927					if (menu_container.length > 0 && menu.length > 0) {
6928						calc_scroll = calc_scroll - menu.outerHeight();
6929					}
6930
6931					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6932						delta = bodyTop - calc_scroll,
6933						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6934					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6935
6936					if ( !UNCODE.isFullPage ) {
6937						if (scrollSpeed == 0) {
6938							$('html, body').scrollTop(calc_scroll);
6939						} else {
6940							$('html, body').animate({
6941								scrollTop: calc_scroll
6942							},{
6943								easing: 'easeInOutQuad',
6944								duration: scrollSpeed,
6945								complete: function(){
6946									UNCODE.scrolling = false;
6947								}
6948							});
6949						}
6950					}
6951				}
6952
6953				loadCssGrid($(this), true);
6954			});
6955		}
6956
6957		$filters.on('click', 'a.grid-nav-link', function(evt) {
6958			if ($(this).hasClass('no-grid-filter')) {
6959				return;
6960			}
6961			var $filter = $(this),
6962				filterContainer = $filter.closest('.cssgrid-filters'),
6963				filterValue = $filter.attr('data-filter'),
6964				containerSystem = $filter.closest('.cssgrid-system'),
6965				container = containerSystem.find($('.cssgrid-layout')),
6966				transitionDuration = containerSystem.data('transitionDuration'),
6967				delay = 300,
6968				filterItems = [],
6969				all_thumbs = container.find('.tmb-grid');
6970
6971			var filter_items = function(){
6972				if (filterValue !== undefined) {
6973					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
6974						var parent = $(val).parent(),
6975							objTimeout = parent.data('objTimeout');
6976						if (objTimeout) {
6977							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6978							clearRequestTimeout(objTimeout);
6979						}
6980						if (transitionDuration == 0) {
6981							if ($(val).hasClass('animate_when_almost_visible')) {
6982								$(val).addClass('zoom-reverse').removeClass('start_animation');
6983							} else {
6984								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6985							}
6986						}
6987					});
6988					requestTimeout(function(){
6989						if ( filterValue == '*' ) {
6990							all_thumbs.show();
6991							all_thumbs.each(function(index, val) {
6992								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
6993								filterItems.push($(this));
6994							});
6995						} else {
6996							all_thumbs.each(function() {
6997								var _tmb = $(this);
6998								if (_tmb.hasClass(filterValue)) {
6999									_tmb.show();
7000									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7001									filterItems.push(_tmb);
7002								} else {
7003									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7004									_tmb.hide();
7005								}
7006							});
7007						}
7008
7009						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7010
7011						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7012						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7013						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7014						if (lightboxElements.length) {
7015							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7016							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7017								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7018								if (typeof getLightbox === 'object') {
7019									getLightbox.refresh();
7020								} else {
7021									UNCODE.lightbox();
7022								}
7023							}
7024						}
7025						container.trigger('more-items-loaded');
7026						$(window).trigger('more-items-loaded');
7027						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7028					}, delay);
7029				} else {
7030					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7031						var parent = $(val).parent(),
7032							objTimeout = parent.data('objTimeout');
7033						if (objTimeout) {
7034							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7035							clearRequestTimeout(objTimeout);
7036						}
7037						if (transitionDuration == 0) {
7038							if ($(val).hasClass('animate_when_almost_visible')) {
7039								$(val).addClass('zoom-reverse').removeClass('start_animation');
7040							} else {
7041								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7042							}
7043						}
7044					});
7045					loadCssGrid($filter);
7046				}
7047			};
7048
7049			if (!$filter.hasClass('active')) {
7050				/** Scroll top with filtering */
7051				if (filterContainer.hasClass('filter-scroll')) {
7052                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7053                    calc_scroll -= UNCODE.get_scroll_offset();
7054
7055					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7056						delta = bodyTop - calc_scroll,
7057						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7058						filterTolerance = false,
7059						filter_timeout;
7060					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7061
7062					if ( !UNCODE.isFullPage ) {
7063						if (scrollSpeed == 0) {
7064							$('html, body').scrollTop(calc_scroll);
7065							UNCODE.scrolling = false;
7066							filter_items();
7067						} else {
7068
7069							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7070								filter_items();
7071								filterTolerance = true;
7072							}
7073
7074							$('html, body').animate({
7075								scrollTop: calc_scroll
7076							},{
7077								easing: 'easeInOutQuad',
7078								duration: scrollSpeed,
7079								complete: function(){
7080									UNCODE.scrolling = false;
7081									if ( !filterTolerance ) {
7082										filter_timeout = setTimeout(function(){
7083											clearTimeout(filter_timeout);
7084											filter_items();
7085										}, 200);
7086									}
7087								}
7088							});
7089						}
7090					}
7091				} else {
7092					filter_items();
7093				}
7094			}
7095			evt.preventDefault();
7096		});
7097
7098		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7099			var params = UNCODE.getURLParams(window.location);
7100			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7101
7102			UNCODE.lastURL = window.location.href;
7103
7104			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
7105				return;
7106			}
7107
7108			if (params.id === undefined) {
7109				$.each($('.cssgrid-system'), function(index, val) {
7110					loadCssGrid($(val));
7111				});
7112			} else {
7113				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7114					loadCssGrid($('#' + params.id));
7115				}
7116			}
7117		});
7118
7119		var loadCssGrid = function($href, $paginating) {
7120			var is_paginating = false;
7121
7122			if (undefined !== $paginating && $paginating) {
7123				var is_paginating = $paginating;
7124			}
7125
7126			var href = ($href.is("a") ? $href.attr('href') : location),
7127				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7128				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7129				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7130				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7131				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7132				cssgridId = cssgridSystem.attr('id');
7133			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7134				UNCODE.lastURL = href;
7135				history.pushState({
7136					myCSSgrid: true
7137				}, document.title, href);
7138			}
7139			cssgridWrapper.addClass('cssgrid-loading');
7140			if (is_paginating) {
7141				cssgridWrapper.addClass('grid-filtering');
7142			}
7143			$.ajax({
7144				url: href
7145			}).done(function(data) {
7146				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7147					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7148					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7149				requestTimeout(function() {
7150					cssgridContainer.html($resultItems);
7151					cssgridWrapper.removeClass('cssgrid-loading');
7152					cssgridWrapper.removeClass('grid-filtering');
7153					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7154					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7155					UNCODE.adaptive();
7156					if (SiteParameters.dynamic_srcset_active === '1') {
7157						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7158					}
7159					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7160						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7161						if (typeof getLightbox === 'object') {
7162							getLightbox.refresh();
7163						} else {
7164							UNCODE.lightbox();
7165						}
7166					}
7167					cssgridContainer.trigger('more-items-loaded');
7168					$(window).trigger('more-items-loaded');
7169					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7170				}, 300);
7171
7172				$('.pagination', cssgridFooter).remove();
7173				cssgridFooter.append($resultPagination);
7174
7175				if (cssgridResultCount.length > 0) {
7176					$('.woocommerce-result-count', cssgridResultCount).remove();
7177					cssgridResultCount.append($resultCount);
7178				}
7179			});
7180		};
7181
7182		$filters.each(function(i, buttonGroup) {
7183			var $buttonGroup = $(buttonGroup);
7184			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7185				$buttonGroup.find('.active').removeClass('active');
7186				$(this).addClass('active');
7187
7188			});
7189
7190			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7191				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7192				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7193			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7194				e.preventDefault();
7195				$cats_filters.slideToggle(400, 'easeInOutCirc');
7196			});
7197
7198		});
7199	};
7200};
7201
7202UNCODE.linearGrid = function(){
7203	$('.linear-wrapper').each(function(){
7204		var $wrap = $(this),
7205			$system = $wrap.closest('.linear-system'),
7206			$row = $wrap.closest('.vc_row[data-parent]'),
7207			_row = $row[0],
7208			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7209			vertical = $cont.hasClass('linear-or-vertical'),
7210			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7211			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7212			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7213			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7214			isInViewport = false,
7215			isHover = false,
7216			init = false,
7217			stableHeight = UNCODE.wheight,
7218			wCont, hCont, docH, marqueeTL;
7219
7220		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7221		var dataX = dataSpeed;
7222
7223		dataSpeed += 5;
7224
7225		var checkLinearGridSize = function(){
7226			if ( !$wrap.is(':visible') )  {
7227				return;
7228			}
7229			$wrap.find('.cont-appended').remove();
7230
7231			if ( vertical ) {
7232				if ( ! SiteParameters.is_frontend_editor ) {
7233					hCont = $cont.outerHeight();
7234					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7235					if ( hCont < docH ) {
7236						var res = docH - hCont * 3,
7237							times = 2 * Math.round((res/hCont+1) / 2);
7238					}
7239					for ( var i = 0; i < times; i++ ) {
7240						var $cloneCont = $cont.clone(),
7241							$cloneCont2 = $cont.clone(),
7242							trans = ( (i+2) ) * 100;
7243						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7244						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7245						$cloneCont.find('a[data-lbox]').each(function(){
7246							var dataLbox = $(this).attr('data-lbox');
7247							$(this).attr('data-lbox', dataLbox + '_' + i);
7248						});
7249						$cloneCont.find('.wp-video-shortcode').each(function(){
7250							var thisID = $(this).attr('id');
7251							$(this).attr('id', thisID + '_' + i);
7252						});
7253						$cloneCont2.find('a[data-lbox]').each(function(){
7254							var dataLbox = $(this).attr('data-lbox');
7255							$(this).attr('data-lbox', dataLbox + '_2' + i);
7256						});
7257						$cloneCont2.find('.wp-video-shortcode').each(function(){
7258							var thisID = $(this).attr('id');
7259							$(this).attr('id', thisID + '__' + i);
7260						});
7261						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7262							UNCODE.lightgallery($cloneCont);
7263							UNCODE.lightgallery($cloneCont2);
7264						}
7265					}
7266                }
7267			} else {
7268				wCont = $cont.outerWidth();
7269				if ( (wCont) < UNCODE.wwidth*2 ) {
7270					var res = UNCODE.wwidth*2 - (wCont),
7271						times = 2 * Math.round((res/wCont+1) / 2);
7272				}
7273				for ( var i = 0; i < times; i++ ) {
7274					var $cloneCont = $cont.clone(),
7275						$cloneCont2 = $cont.clone(),
7276						trans = ( (i+2) ) * 100;
7277					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7278					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7279					$cloneCont.find('a[data-lbox]').each(function(){
7280						var dataLbox = $(this).attr('data-lbox');
7281						$(this).attr('data-lbox', dataLbox + '_' + i);
7282					});
7283					$cloneCont.find('[id]').each(function(){
7284						var thisID = $(this).attr('id');
7285						$(this).attr('id', thisID + '_' + i);
7286					});
7287					$cloneCont2.find('a[data-lbox]').each(function(){
7288						var dataLbox = $(this).attr('data-lbox');
7289						$(this).attr('data-lbox', dataLbox + '_2' + i);
7290					});
7291					$cloneCont2.find('[id]').each(function(){
7292						var thisID = $(this).attr('id');
7293						$(this).attr('id', thisID + '__' + i);
7294					});
7295                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
7296                        UNCODE.lightgallery($cloneCont);
7297                        UNCODE.lightgallery($cloneCont2);
7298                    }
7299                }
7300			}
7301		};
7302		if ( clone ) {
7303			checkLinearGridSize();
7304			$(window).on('resize.linearGrid', function(){
7305				checkLinearGridSize();
7306			});
7307		}
7308
7309		var continuousLinearMarquee = function(_xStrt){
7310			if ( !$wrap.is(':visible') )  {
7311				return;
7312			}
7313			var ease = 'none';
7314			wCont = $cont.outerWidth();
7315			hCont = $cont.outerHeight();
7316
7317			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
7318				xEnd = vertical ? hCont : wCont,
7319				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7320				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
7321				speedSlow = (xEnd + xStrt) / 45,
7322				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery
7323
7324			marqueeTL = new TimelineMax({paused:true, reversed:true});
7325
7326			if ( isInViewport && !isHover && !freezed ) {
7327				marqueeTL.play();
7328
7329				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
7330					var $column = $wrap.closest('.wpb_column'),
7331						$col_link = $('.col-link', $column),
7332						$hover_sel = $wrap;
7333
7334					if ( $col_link.length ) {
7335						$hover_sel = $wrap.add($column);
7336					}
7337
7338					$hover_sel.on('mouseover', function(){
7339						if ( $wrap.attr('data-hover') === 'yes' ) {
7340							//speed = ( 10 - dataSpeed ) * 5;
7341							ease = 'power2.out';
7342							marqueeTL.duration( speedSlow );
7343						} else {
7344							marqueeTL.pause();
7345						}
7346						isHover = true;
7347					}).on('mouseout', function(){
7348						if ( $wrap.attr('data-hover') === 'yes' ) {
7349							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
7350							ease = 'power2.in';
7351							marqueeTL.duration( speed );
7352						} else {
7353							marqueeTL.play();
7354						}
7355						isHover = false;
7356					});
7357				}
7358
7359			}
7360	
7361			gsap.killTweensOf($wrap);
7362			if ( vertical ) {
7363				marqueeTL.fromTo( $wrap, {
7364					y: xStrt * direction
7365				},
7366				{
7367					duration: speed,
7368					y: xEnd * direction * -1,
7369					onComplete: function(){
7370						continuousLinearMarquee();
7371					},
7372					ease: ease,
7373					paused: freezed
7374				});
7375			} else {
7376				marqueeTL.fromTo( $wrap, {
7377					x: xStrt * direction
7378				},
7379				{
7380					duration: speed,
7381					x: xEnd * direction * -1,
7382					onComplete: function(){
7383						continuousLinearMarquee();
7384					},
7385					ease: ease,
7386					paused: freezed
7387				});
7388			}
7389		};
7390
7391		var dragLinearContinuous = function(){
7392			if ( !$wrap.is(':visible') )  {
7393				return;
7394			}
7395			var matrix, _x, _y,
7396				dragAction = false;
7397			Draggable.create($wrap[0], {
7398				type: vertical ? "y" : "x",
7399				bounds: document.getElementById("container"),
7400				inertia: false,
7401				onPress: function (e) {
7402				},
7403				onRelease: function (e) {
7404					if ( dragAction === true ) {
7405						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7406						_x = matrix[12] || matrix[4];
7407						_y = matrix[13] || matrix[5];
7408						if ( vertical ) {
7409							continuousLinearMarquee(_y * -1);
7410						} else {
7411							continuousLinearMarquee(_x * -1);
7412						}
7413						$wrap.removeClass('linear-dragging');
7414					}
7415				},
7416				onDrag: function (e) {
7417					dragAction = true;
7418					$wrap.addClass('linear-dragging');
7419				},
7420				onDragEnd: function (e) {
7421					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7422					_x = matrix[12] || matrix[4];
7423					_y = matrix[13] || matrix[5];
7424					wCont = $cont.outerWidth();
7425					hCont = $cont.outerHeight();
7426					if ( vertical ) {
7427						if ( Math.abs(_y) > hCont ) {
7428							if ( _y < 0 ) {
7429								_y = hCont + parseFloat( _y );
7430							} else {
7431								_y = parseFloat( _y ) - hCont;
7432							}
7433						}
7434						continuousLinearMarquee(_y * -1);
7435					} else {
7436						if ( Math.abs(_x) > wCont ) {
7437							if ( _x < 0 ) {
7438								_x = wCont + parseFloat( _x );
7439							} else {
7440								_x = parseFloat( _x ) - wCont;
7441							}
7442						}
7443						continuousLinearMarquee(_x * -1);
7444					}
7445					$wrap.removeClass('linear-dragging');
7446					dragAction = false;
7447				},
7448			});
7449		};
7450
7451		var runScrollLinear = function(){
7452			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7453			if ( !$wrap.is(':visible') || freezed )  {
7454				return;
7455			}
7456			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7457				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
7458			
7459			var linearGridScroll = function(){
7460				if ( isInViewport ) {
7461					var bound = _row.getBoundingClientRect();
7462
7463					var bound_top = bound.top,
7464						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
7465
7466					if ( vertical ) {
7467						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7468					} else {
7469						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7470					}
7471					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7472						requestAnimationFrame(linearGridScroll);
7473					}
7474				}
7475				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
7476					window.addEventListener("scroll", linearGridScroll);
7477				}
7478			};
7479
7480			$(window).on( 'load wwResize', function(e) {
7481				stableHeight = UNCODE.wheight;
7482				linearGridScroll();
7483			});
7484			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7485				requestAnimationFrame(linearGridScroll);
7486			}
7487		};
7488		
7489		var dragLinear = function(){
7490			if ( !$wrap.is(':visible') )  {
7491				return;
7492			}
7493			var matrix, _x, _y;
7494			Draggable.create($system[0], {
7495				type: vertical ? "y" : "x",
7496				bounds: document.getElementById("container"),
7497				inertia: false,
7498				onPress: function (e) {
7499				},
7500				onRelease: function (e) {
7501				},
7502				onDrag: function (e) {
7503					$wrap.addClass('linear-dragging');
7504				},
7505				onDragEnd: function (e) {
7506					matrix = $system.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7507					_x = matrix[12] || matrix[4];
7508					_y = matrix[13] || matrix[5];
7509					wCont = $cont.outerWidth();
7510					hCont = $cont.outerHeight();
7511					if ( vertical ) {
7512						if ( Math.abs(_y) > hCont ) {
7513							if ( _y < 0 ) {
7514								_y = hCont + parseFloat( _y );
7515							} else {
7516								_y = parseFloat( _y ) - hCont;
7517							}
7518							gsap.to( $system[0], {
7519								duration: 0,
7520								y: _y,
7521							});
7522						}
7523					} else {
7524						if ( Math.abs(_x) > wCont ) {
7525							if ( _x < 0 ) {
7526								_x = wCont + parseFloat( _x );
7527							} else {
7528								_x = parseFloat( _x ) - wCont;
7529							}
7530							gsap.to( $system[0], {
7531								duration: 0,
7532								x: _x,
7533							});
7534						}
7535					}
7536					$wrap.removeClass('linear-dragging');
7537				},
7538			});
7539		};
7540
7541		if ( ! $('body').hasClass('compose-mode') ) {
7542			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
7543				continuousLinearMarquee();
7544				$(window).on( 'wwResize', function(e) {
7545					continuousLinearMarquee();
7546				});	
7547				if ( $wrap.attr('data-draggable') === 'yes' ) {
7548					dragLinearContinuous();
7549				}
7550			}
7551
7552			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7553				runScrollLinear();
7554				if ( $wrap.attr('data-draggable') === 'yes' ) {
7555					dragLinear();
7556				}
7557			}
7558
7559			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7560				var observer = new IntersectionObserver(function(entries) {
7561						
7562					entries.forEach(function(entry){
7563						if ( entry.isIntersecting ) {
7564							isInViewport = true;
7565							if ( !init ) {
7566								init = true;
7567								continuousLinearMarquee();
7568							} else {
7569								if ( typeof marqueeTL !== 'undefined' ) {
7570									marqueeTL.play();
7571								}
7572							}
7573							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7574								requestAnimFrame(runScrollLinear);
7575							}
7576						} else {
7577							isInViewport = false;
7578							if ( typeof marqueeTL !== 'undefined' ) {
7579								marqueeTL.pause();
7580							}
7581						}
7582					});
7583				}, { 
7584					root: document,
7585				});
7586
7587				observer.observe(_row);
7588
7589			} else {
7590
7591				var checkVisible = function( el, off ) {
7592					if (typeof jQuery === "function" && el instanceof jQuery) {
7593						el = el[0];
7594					}
7595			
7596					off = typeof off=='undefined' ? 50 : off;
7597			
7598					var rect = el.getBoundingClientRect();
7599			
7600					return (
7601						(
7602							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7603							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7604							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7605						)
7606					);
7607				};
7608				
7609				var checkVisibility = function(){
7610
7611					if ( checkVisible($row) ) {
7612						isInViewport = true;
7613						if ( typeof marqueeTL !== 'undefined' ) {
7614							marqueeTL.play();
7615						}
7616					} else {
7617						isInViewport = false;
7618						if ( typeof marqueeTL !== 'undefined' ) {
7619							marqueeTL.pause();
7620						}
7621					}
7622				}
7623
7624				window.addEventListener("scroll", checkVisibility);
7625
7626			}
7627		}
7628	});
7629};
7630UNCODE.preventDoubleTransition = function() {
7631	$('.sticky-element .animate_when_almost_visible').each(function(){
7632		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
7633			$el.addClass('do_not_reanimate');
7634		});
7635	});
7636};
7637
7638UNCODE.checkScrollForTabs = function(){
7639	var goToSection = window.location.hash.replace('#', ''),
7640		$index;
7641
7642	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
7643	goToSection = encodeURIComponent(goToSection);
7644	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
7645
7646	$index.attr('data-parent', 'parent-' + goToSection);
7647
7648	if (window.location.hash != undefined && window.location.hash != '') {
7649		requestTimeout(function() {
7650			scrollBody('parent-' + goToSection);
7651		}, 500);
7652	}
7653
7654	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
7655		var hash = (e.currentTarget).hash,
7656			index = (e.currentTarget).closest('.uncode-tabs');
7657		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
7658			$('a[href="' + hash + '"][data-tab-history]').click();
7659			scrollBody(index);
7660		}
7661	});
7662
7663	var scrollBody = function(index) {
7664
7665		var getSection = $('a[href="' + index + '"][data-tab-history]'),
7666			scrollTo,
7667			safeGap = 27;
7668
7669		if ( ! getSection.length ) {
7670			getSection = $('div[data-parent="' + index + '"]');
7671
7672			if ( getSection.attr('data-target') == 'row' ) {
7673				getSection = getSection.closest('.vc_row');
7674				safeGap = 0;
7675			}
7676		}
7677
7678		if (typeof getSection === 'undefined' || ! getSection.length ) {
7679			return;
7680		}
7681
7682		var body = $("html, body"),
7683		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7684		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
7685		getOffset = UNCODE.get_scroll_offset();
7686		if ( typeof getSection.offset() === 'undefined' )
7687			return;
7688		scrollTo = getSection.offset().top - safeGap;
7689		scrollTo -= getOffset;
7690
7691		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7692		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7693
7694		if (index != 0) {
7695			UNCODE.scrolling = true;
7696		}
7697
7698		if (scrollSpeed == 0) {
7699			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
7700			UNCODE.scrolling = false;
7701		} else {
7702			body.animate({
7703				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
7704			}, scrollSpeed, 'easeInOutQuad', function() {
7705				requestTimeout(function() {
7706					UNCODE.scrolling = false;
7707					if (getOffset != UNCODE.get_scroll_offset()) {
7708						scrollBody(index);
7709					}
7710				}, 100);
7711			});
7712		}
7713
7714	};
7715};
7716
7717UNCODE.printScreen = function() {
7718	var inlineMediaStyle = null,
7719		setResize;
7720
7721    function changeMediaStyle() {
7722		clearRequestTimeout(setResize);
7723		setResize = requestTimeout(function(){
7724	        var $head = document.getElementsByTagName('head')[0],
7725	        	$newStyle = document.createElement('style'),
7726	        	winW = window.innerWidth,
7727	        	printH = window.innerHeight;
7728
7729	        $newStyle.setAttribute('type', 'text/css');
7730	        $newStyle.setAttribute('media', 'print');
7731	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
7732
7733	        if (inlineMediaStyle != null) {
7734	            $head.replaceChild($newStyle, inlineMediaStyle)
7735	        } else {
7736	            $head.appendChild($newStyle);
7737	        }
7738	        inlineMediaStyle = $newStyle;
7739	    }, 1000);
7740    }
7741
7742    changeMediaStyle();
7743    window.addEventListener('resize', changeMediaStyle);
7744};
7745
7746UNCODE.fullPage = function() {
7747	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
7748		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
7749		return false;
7750	} else {
7751		requestTimeout(function() {
7752			window.scrollTo(0, 0);
7753		}, 10);
7754	}
7755
7756	var $masthead = $('#masthead'),
7757		$logo = $('#logo-container-mobile'),
7758		$logolink = $('[data-minheight]', $logo),
7759		logoMinScale = $logolink.data('minheight'),
7760		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
7761		$container = $('.main-container .post-content'),
7762		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
7763		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
7764		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
7765		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
7766		headerWithOpacity = $('.header-scroll-opacity', $header).length,
7767		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
7768		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
7769		scrollBar = true,
7770		effect,
7771		animationEndTimeOut,
7772		fp_anim_time = 900,
7773		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
7774		is_scrolling = false,
7775		dataNames = [],
7776		is_first = true,
7777		no_history = $('body').hasClass('uncode-scroll-no-history'),
7778		theres_footer = true;
7779
7780	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
7781		$('> div', $footer).each(function(index, el){
7782			if ( $(el).outerHeight() < 2 )
7783				theres_footer = false;
7784			else
7785				theres_footer = true;
7786		});
7787	}
7788
7789	if ( !$footer.length )
7790		theres_footer = false;
7791
7792	if ( !UNCODE.isFullPageSnap ) {
7793
7794		if ( $('body').hasClass('uncode-fullpage-zoom') )
7795			effect = 'scaleDown';
7796		else if ( $('body').hasClass('uncode-fullpage-parallax') )
7797			effect = 'moveparallax';
7798		else
7799			effect = 'movecurtain';
7800	}
7801
7802	if ( $('body').hasClass('uncode-fullpage-trid') )
7803		fp_anim_time = fp_anim_time*2;
7804
7805	if ( $header.length ) {
7806		if ( headerName !== '' )
7807			$header.attr('data-name', headerName);
7808		if ( headerLabel !== '' )
7809			$header.attr('data-label', headerLabel);
7810		$container.prepend($header);
7811	}
7812	if ( theres_footer ) {
7813		$container.append($footer);
7814		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
7815		$('aside.widget ul', $footer).addClass('no-list');
7816	}
7817
7818	var $all = $rows.add($header);
7819
7820	if ( theres_footer )
7821		$all = $all.add($footer);
7822
7823	$all.each(function(index, row) {
7824		if( index === 0 )
7825			$(row).addClass('uncode-scroll-active');
7826	});
7827
7828    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
7829
7830	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
7831		$("<ul class='onepage-pagination'></ul>").prependTo("body");
7832	}
7833
7834	$all.each(function(index, val) {
7835		var getName = $(val).data('name'),
7836			label;
7837
7838		if (typeof getName == 'undefined' || getName == 'undefined')
7839			getName = SiteParameters.slide_name + '-' + index;
7840
7841		//if ( dataNames.includes(getName) ) {
7842		if ( dataNames.indexOf(getName) > 0 ) {
7843			getName += '_' + index;
7844			$(val).data('name', getName);
7845		}
7846
7847		dataNames.push(getName);
7848
7849		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
7850
7851		if (typeof $(val).attr('data-label') !== 'undefined')
7852			label = $(val).attr('data-label');
7853		else label = '';
7854
7855		if ( $(val).is($footer) )
7856			return;
7857
7858		if (label != '' ) {
7859			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
7860			$('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>");
7861		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
7862			$('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>");
7863		}
7864	});
7865
7866	var checkVisible = function( el, off ) {
7867		if (typeof jQuery === "function" && el instanceof jQuery) {
7868			el = el[0];
7869		}
7870
7871		off = typeof off=='undefined' ? 50 : off;
7872
7873		var rect = el.getBoundingClientRect();
7874
7875		return (
7876			(
7877				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7878				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7879				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7880			)
7881		);
7882	};
7883
7884	var animationEndAction = function( index, nextIndex ) {
7885		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
7886			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7887			player, iframe;
7888
7889		if ( !$nextSlide.is($footer) ) {
7890			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
7891		}
7892
7893		if ( !UNCODE.isFullPageSnap ) {
7894			activateKBurns( nextIndex );
7895		}
7896
7897		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
7898			if ($(this).attr('data-provider') == 'vimeo') {
7899				iframe = $(this).find('iframe');
7900				player = new Vimeo.Player(iframe[0]);
7901				player.pause();
7902			} else if ($(this).attr('data-provider') == 'youtube') {
7903				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
7904			} else {
7905				if ($(this).is('video')) {
7906					$(this)[0].volume = 0;
7907					$(this)[0].pause();
7908				}
7909			}
7910		});
7911
7912		if ( ! UNCODE.isMobile && headerWithOpacity ) {
7913			if ( $nextSlide.is($header) )
7914				$header.removeClass('header-scrolled');
7915		}
7916
7917		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
7918		$otherEl.each(function(){
7919			var $otherThis = $(this),
7920				$bgwrapperOther = $('.background-inner', $otherThis);
7921			if ( !checkVisible($otherThis) )
7922				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
7923
7924		});
7925
7926		if ( !checkVisible($currentSlide) ) {
7927			$currentSlide.removeClass('uncode-scroll-visible');
7928			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
7929			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
7930				currentScroll.scrollTo(0, 0, 0);
7931		}
7932
7933		clearRequestTimeout(animationEndTimeOut);
7934		animationEndTimeOut = requestTimeout(function(){
7935			Waypoint.refreshAll();
7936			$( document.body ).trigger('uncode_waypoints');
7937			var eventFP = new CustomEvent('fp-slide-changed');
7938			window.dispatchEvent(eventFP);
7939			is_scrolling = false;
7940
7941			if ( is_first ) {
7942				$('ul.onepage-pagination a').removeClass('is-selected');
7943				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
7944				is_first = false;
7945			}
7946
7947		}, 500);
7948	};
7949
7950	var postLeaveActions = function( nextIndex ){
7951		if ( menuHidden && ! UNCODE.isMobile )
7952			return false;
7953
7954		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7955			$cols = $('.uncol', $el),
7956			anchor = $el.data('anchor');
7957
7958		if ( ! UNCODE.isFullPageSnap ) {
7959			$.each($cols, function(index, val){
7960				if ( $(val).hasClass('style-light') ){
7961					$masthead.removeClass('style-dark-override').addClass('style-light-override');
7962					return false;
7963				} else if ( $(val).hasClass('style-dark') ) {
7964					$masthead.removeClass('style-light-override').addClass('style-dark-override');
7965					return false;
7966				}
7967			});
7968		}
7969
7970		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
7971			$('.menu-item' ).removeClass('active');
7972			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
7973		}
7974
7975		if ( !UNCODE.isFullPageSnap ) {
7976			activateBackWash( nextIndex );
7977		}
7978	};
7979
7980	var activateBackWash = function( nextIndex ){
7981		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7982			$bgwrapper;
7983
7984		if ( $el.length ) {
7985			if ( $el.hasClass('with-zoomout') ) {
7986				$bgwrapper = $('.background-inner:nth-child(1)', $el);
7987			} else if ( $('.with-zoomout', $el).length ) {
7988				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
7989			} else {
7990				return false;
7991			}
7992		} else {
7993			return false;
7994		}
7995
7996		$bgwrapper.addClass('uncode-zoomout');
7997
7998	};
7999
8000	var activateKBurns = function( nextIndex ){
8001		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8002			$bgwrapper;
8003
8004		if ( $el.length ) {
8005			if ( $el.hasClass('with-kburns') ) {
8006				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8007			} else if ( $('.with-kburns', $el).length ) {
8008				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
8009			} else {
8010				return false;
8011			}
8012		} else {
8013			return false;
8014		}
8015
8016		$bgwrapper.addClass('uncode-kburns');
8017
8018	};
8019
8020	var activateParallax = function( nextIndex, direction ){
8021
8022		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8023			$cell = $('.fp-tableCell', $el),
8024			animationEnd = 'webkitAnimationEnd animationend',
8025			cellAnim;
8026
8027		switch( direction ) {
8028			case 'up':
8029				cellAnim = 'moveFromTopInner';
8030				break;
8031			default:
8032				cellAnim = 'moveFromBottomInner';
8033		}
8034
8035		$cell.css({
8036			'animation-name': cellAnim,
8037			'animation-duration': fp_anim_time + 'ms',
8038			'animation-delay': '',
8039			'animation-timing-function': fp_easing,
8040			'animation-fill-mode': 'both',
8041		}).off(animationEnd)
8042		.on(animationEnd, function(event) {
8043			if ( event.originalEvent.animationName === cellAnim ) {
8044				$cell
8045					.css({
8046						'animation-name': '',
8047						'animation-duration': '',
8048						'animation-delay': '',
8049						'animation-timing-function': '',
8050						'animation-fill-mode': '',
8051					});
8052			}
8053		});
8054	};
8055
8056	var scrollHashes = function(){
8057		var hash = window.location.hash.replace('#', '').split('/'),
8058			hashInd;
8059		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
8060			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
8061				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
8062				$.fn.fullpage.moveTo(hashInd+1);
8063			}
8064		} else if( hash[0] === '' ) {
8065			$.fn.fullpage.moveTo(1);
8066		}
8067	};
8068
8069	var hideMenu = function( index, nextIndex ){
8070		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
8071			return false;
8072
8073		var hMenu = UNCODE.menuHeight,
8074			transTime = hMenu * 2;
8075
8076		if ( index === 1 && nextIndex > 1 ) {
8077			hMenu = hMenu * -1;
8078		} else if  ( index !== 1 && nextIndex === 1 ) {
8079			hMenu = 0;
8080		} else {
8081			return false;
8082		}
8083
8084		$masthead.css({
8085			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8086			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8087			'-webkit-transition': 'transform 0.5s ease-in-out',
8088			'transition': 'transform 0.5s ease-in-out'
8089		});
8090	};
8091
8092	var shrinkMenu = function( index, nextIndex ){
8093		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
8094			return false;
8095
8096		if ( index === 1 && nextIndex > 1 ) {
8097			$logo.addClass('shrinked');
8098			$('div', $logo).each(function(index, val){
8099				$(val).css({
8100					'height': logoMinScale,
8101					'line-height': logoMinScale
8102				});
8103				if ($(val).hasClass('text-logo')) {
8104					$(val).css({
8105						'font-size': logoMinScale + 'px'
8106					});
8107				}
8108			});
8109			requestTimeout(function() {
8110				UNCODE.menuMobileHeight = $masthead.outerHeight();
8111			}, 300);
8112		} else if ( index !== 1 && nextIndex === 1 ) {
8113			$logo.removeClass('shrinked');
8114			$('div', $logo).each(function(index, val){
8115				$(val).css({
8116					'height': logoMaxScale,
8117					'line-height': logoMaxScale
8118				});
8119				if ($(val).hasClass('text-logo')) {
8120					$(val).css({
8121						'font-size': logoMaxScale + 'px'
8122					});
8123				}
8124			});
8125			requestTimeout(function() {
8126				UNCODE.menuMobileHeight = $masthead.outerHeight();
8127			}, 300);
8128		} else {
8129			return false;
8130		}
8131
8132	};
8133
8134	var anchorLink = function(){
8135
8136		$container.add('.menu-item').find('a[href*="#"]').click(function(e) {
8137			var $this = $(e.currentTarget),
8138				hash = e.currentTarget.href.split('#'),
8139				current = window.location.href.split('#'),
8140				ind,
8141				currentMenuOpened = UNCODE.menuOpened,
8142				go = false;
8143
8144			var hash_url = hash[0].replace(/\/?$/, '/'),
8145				current_url = current[0].replace(/\/?$/, '/');
8146
8147			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
8148				hash = '#'+hash[1];
8149				e.preventDefault();
8150				go = true;
8151			}
8152
8153			if ( go ) {
8154
8155				if ( $(hash).length ) {
8156					ind = $(hash).closest('.fp-section').index();
8157				} else {
8158					hash = hash.slice(1);
8159					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
8160				}
8161
8162				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
8163					ind = $this.closest('.fp-section').index();
8164
8165				UNCODE.menuOpened = false;
8166
8167				$.fn.fullpage.moveTo(ind+1);
8168
8169				UNCODE.menuOpened = currentMenuOpened;
8170				if (UNCODE.menuOpened) {
8171					if (UNCODE.wwidth < UNCODE.mediaQuery) {
8172						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
8173					} else {
8174						$('.mmb-container-overlay .overlay-close').trigger('click');
8175						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
8176					}
8177				}
8178
8179			}
8180
8181		});
8182
8183		$('.header-scrolldown').on('click', function(event) {
8184			event.preventDefault();
8185			var scrollDown = $(this),
8186				ind = scrollDown.closest('.fp-section').index();
8187
8188			$.fn.fullpage.moveTo(ind+2);
8189		});
8190
8191		var anchor = $('.fp-section.active').data('anchor');
8192
8193		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
8194			$('.menu-item').removeClass('active');
8195			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8196		}
8197
8198	};
8199
8200	var slideLeave = function( index, nextIndex, direction ) {
8201		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8202			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8203			animationEnd = 'webkitAnimationEnd animationend',
8204			transitionEnd = 'webkitTransitionEnd transitionend',
8205			animOut = effect != 'scaleDown' ? effect + direction : effect,
8206			animIn,
8207			isFooter = false,
8208			isFooterNext = false,
8209			footerH = $footer.outerHeight(),
8210			timeout,
8211			player, iframe,
8212			footerCoeff;
8213		switch( direction ) {
8214			case 'up':
8215				animIn = 'moveFromTop';
8216				break;
8217			default:
8218				animIn = 'moveFromBottom';
8219		}
8220
8221		if ( $('body').hasClass('uncode-fullpage-trid') ) {
8222			animOut = animIn + 'trid';
8223			animIn = animOut + 'In';
8224		} else if ( UNCODE.isFullPageSnap ) {
8225			animIn = animOut = 'none';
8226		}
8227
8228		hideMenu(index, nextIndex);
8229		shrinkMenu(index, nextIndex);
8230
8231		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8232			if ($(this).attr('data-provider') == 'vimeo') {
8233				iframe = $(this).find('iframe');
8234				player = new Vimeo.Player(iframe[0]);
8235				player.pause();
8236			} else if ($(this).attr('data-provider') == 'youtube') {
8237				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8238			} else {
8239				if ($(this).is('video')) {
8240					$(this)[0].volume = 0;
8241					$(this)[0].pause();
8242				}
8243			}
8244		});
8245
8246		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
8247			if ($(this).attr('data-provider') == 'vimeo') {
8248				iframe = $(this).find('iframe');
8249				iframe.on('load', function(){
8250					player = new Vimeo.Player(iframe);
8251					player.setVolume(0);
8252					player.play();
8253				});
8254				player = new Vimeo.Player(iframe);
8255				player.setVolume(0);
8256				player.play();
8257			} else if ($(this).attr('data-provider') == 'youtube') {
8258				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
8259			} else {
8260				if ($(this).is('video')) {
8261					$(this)[0].volume = 0;
8262					$(this)[0].play();
8263				}
8264			}
8265		});
8266
8267		if ( $currentSlide.is($footer) )
8268			isFooter = true;
8269
8270		if ( $nextSlide.is($footer) )
8271			isFooterNext = true;
8272
8273		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8274			if ( $currentSlide.is($header) )
8275				$header.addClass('header-scrolled');
8276		}
8277
8278		footerCoeff = footerH;
8279
8280		if ( UNCODE.isFullPageSnap ) {
8281			postLeaveActions( nextIndex );
8282			activateBackWash( nextIndex );
8283			activateKBurns( nextIndex );
8284			requestTimeout(function(){
8285				animationEndAction( index, nextIndex );
8286			}, fp_anim_time+150);
8287		} else {
8288			if ( isFooterNext ) {
8289
8290				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
8291				$iscrollWrapper.addClass('no-scrolloverflow');
8292
8293				$nextSlide
8294				.add($currentSlide)
8295				.addClass('uncode-scroll-front')
8296				.addClass('uncode-scroll-active')
8297				.addClass('uncode-scroll-visible');
8298				$container.css({
8299					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8300					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8301					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8302					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8303				}).off(transitionEnd)
8304				.one(transitionEnd, function(){
8305					animationEndAction( index, nextIndex );
8306				});
8307
8308			} else if ( isFooter ) {
8309
8310				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
8311				.add($currentSlide)
8312				.addClass('uncode-scroll-front')
8313				.addClass('uncode-scroll-active')
8314				.addClass('uncode-scroll-visible');
8315				$container.css({
8316					'-webkit-transform': 'translate3d(0, 0, 0)',
8317					'transform': 'translate3d(0, 0, 0)',
8318					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8319					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8320				})
8321				.one(transitionEnd, function(){
8322					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
8323						clearRequestTimeout(timeout);
8324						timeout = requestTimeout(function(){
8325							$.fn.fullpage.moveTo(nextIndex);
8326							slideLeave( index-1, nextIndex, 'up' );
8327							$container.off(transitionEnd);
8328						}, 50);
8329					}
8330					animationEndAction( index, nextIndex );
8331				});
8332
8333			} else {
8334
8335				postLeaveActions( nextIndex );
8336
8337				if ( !$('body').hasClass('uncode-fullpage-trid') )
8338					activateParallax( nextIndex, direction );
8339
8340				var $outBg = $('.background-wrapper', $currentSlide);
8341
8342				$nextSlide
8343				.addClass('uncode-scroll-front')
8344				.addClass('uncode-scroll-active')
8345				.addClass('uncode-scroll-visible')
8346				.addClass('uncode-scroll-animating-in')
8347				.css({
8348					'z-index':4,
8349					'animation-name': animIn,
8350					'animation-duration': fp_anim_time + 'ms',
8351					'animation-delay': '',
8352					'animation-timing-function': fp_easing,
8353					'animation-fill-mode': 'both',
8354					'transition': 'initial',
8355				}).off(animationEnd)
8356				.on(animationEnd, function(event) {
8357					if ( event.originalEvent.animationName === animIn ) {
8358						$(this)
8359							.addClass('uncode-scroll-already')
8360							.removeClass('uncode-scroll-front')
8361							.removeClass('uncode-scroll-animating-in')
8362							.css({
8363								'animation-name': '',
8364								'animation-duration': '',
8365								'animation-delay': '',
8366								'animation-timing-function': '',
8367								'animation-fill-mode': '',
8368								'transition': 'initial',
8369							});
8370
8371						$currentSlide
8372							.removeClass('uncode-scroll-active')
8373							.add($outBg)
8374							.css({
8375								'animation-name': '',
8376								'animation-duration': '',
8377								'animation-delay': '',
8378								'animation-timing-function': '',
8379								'animation-fill-mode': '',
8380								'transition': 'initial',
8381							});
8382
8383						animationEndAction( index, nextIndex );
8384
8385					}
8386
8387					if ( nextIndex > 1 )
8388						$('body').addClass('window-scrolled');
8389					else
8390						$('body').removeClass('window-scrolled');
8391				});
8392
8393				$currentSlide
8394					.addClass('uncode-scroll-animating-out')
8395					.removeClass('uncode-scroll-front')
8396					.css({
8397						'z-index':'1',
8398						'animation-name': animOut,
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						'will-change': 'auto'
8405					}).off(animationEnd)
8406					.on(animationEnd, function(event) {
8407						if ( event.originalEvent.animationName === animOut ) {
8408							$currentSlide.removeClass('uncode-scroll-animating-out');
8409						}
8410					});
8411
8412				if ( $('body').hasClass('uncode-fp-opacity') ) {
8413					$currentSlide.find('> div').css({
8414						'animation-name': 'opacityout',
8415						'animation-duration': fp_anim_time + 'ms',
8416						'animation-delay': '',
8417						'animation-timing-function': fp_easing,
8418						'animation-fill-mode': 'both',
8419						'transition': 'initial',
8420					}).off(animationEnd)
8421					.on(animationEnd, function(event) {
8422						if ( event.originalEvent.animationName === 'opacityout' ) {
8423							$(event.currentTarget).css({
8424								'animation-name': '',
8425								'animation-duration': '',
8426								'animation-delay': '',
8427								'animation-timing-function': '',
8428								'animation-fill-mode': '',
8429								'transition': '',
8430							});
8431						}
8432					});
8433				}
8434			}
8435		}
8436
8437		$('.scroll-top').on('click', function(e){
8438			$.fn.fullpage.moveTo(1);
8439			return false;
8440		});
8441
8442	};
8443
8444	var init_fullPage = function(mode){
8445
8446		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
8447		// 	scrollBar = false;
8448		// }
8449
8450		var checkFPeffects;
8451
8452		$container.fullpage({
8453			sectionSelector: '.uncode-scroll-lock',
8454			scrollOverflow: true,
8455			scrollOverflowOptions: {
8456				click: false,
8457				preventDefaultException: { tagName:/.*/ }
8458			},
8459			navigation: false,
8460			scrollBar: scrollBar,
8461			scrollingSpeed: fp_anim_time,
8462			verticalCentered: true,
8463			anchors: no_history ? false : dataNames,
8464			recordHistory: !no_history,
8465			afterRender: function(){
8466				$('body').removeClass('fp-waiting');
8467				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
8468					var $invisible = $(this).addClass('hidden-scroll');//,
8469				});
8470				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
8471					var $visible = $(this).addClass('uncode-scroll-visible'),
8472						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
8473					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
8474				});
8475
8476				$('ul.onepage-pagination a').on('click', function(e){
8477					e.preventDefault();
8478					var $a = $(this),
8479						toIndex = $a.data('index');
8480
8481					$.fn.fullpage.moveTo(toIndex+1);
8482				});
8483
8484				requestTimeout(function(){
8485					scrollHashes();
8486				}, 1000);
8487
8488				$(window).on('hashchange', function(e){
8489					requestTimeout(function(){
8490						scrollHashes();
8491					}, 500);
8492				});
8493
8494				anchorLink();
8495
8496				if ( $('body').hasClass('uncode-fp-opacity') ) {
8497					$all.each(function(index, row) {
8498						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
8499							classBg;
8500
8501						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
8502							classBg = testmatch[0];
8503							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
8504						}
8505					});
8506				}
8507
8508				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
8509					$(window).on('menuOpen gdprOpen', function(){
8510						$.fn.fullpage.setAutoScrolling(false);
8511					}).on('menuClose gdprClose', function(){
8512						$.fn.fullpage.setAutoScrolling(true);
8513					});
8514				}
8515
8516				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
8517					requestTimeout(function(){
8518						$.fn.fullpage.setAutoScrolling(false);
8519					}, 1000);
8520				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
8521					$.fn.fullpage.setAutoScrolling(true);
8522				});
8523
8524				if ( !UNCODE.isFullPageSnap ) {
8525					clearRequestTimeout(checkFPeffects);
8526					checkFPeffects = requestTimeout(function(){
8527						activateBackWash( 1 );
8528						activateKBurns( 1 );
8529					}, 100);
8530				}
8531
8532			},
8533			onLeave: function( index, nextIndex, direction ){
8534
8535				if ( UNCODE.menuOpened || is_scrolling )
8536					return false;
8537
8538				is_scrolling = true;
8539
8540				var event = new CustomEvent('fp-slide-leave');
8541				window.dispatchEvent(event);
8542
8543				slideLeave( index, nextIndex, direction );
8544
8545				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
8546					if ( direction === 'up' ) {
8547						$.fn.fullpage.moveTo(nextIndex-1);
8548					} else {
8549						$.fn.fullpage.moveTo(nextIndex+1);
8550					}
8551					return false;
8552				}
8553
8554				$('ul.onepage-pagination a').removeClass('is-selected');
8555				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8556
8557			}
8558		});
8559	};
8560
8561	init_fullPage();
8562	$(window).on('load', function(){
8563		requestTimeout(function(){
8564			$.fn.fullpage.reBuild();
8565		}, 3000);
8566	});
8567
8568	var addScrollingClass,
8569		removeScrollingClass;
8570
8571	window.addEventListener("fp-slide-scroll", function(){
8572		addScrollingClass = requestTimeout( function(){
8573			$('body').addClass('fp-slide-scrolling');
8574		}, 10 );
8575
8576		clearRequestTimeout(removeScrollingClass);
8577		removeScrollingClass = requestTimeout( function(){
8578			$('body').removeClass('fp-slide-scrolling');
8579		}, 150 );
8580
8581		Waypoint.refreshAll();
8582	}, false);
8583
8584	var setFPheight = function(){
8585		var $body = document.body,
8586			$footer = document.getElementById('colophon'),
8587			$maincontainer = document.querySelector('.main-wrapper'),
8588			$boxcontainer = document.querySelector('.box-container'),
8589			$sections = document.querySelectorAll('.fp-section'),
8590			rect = $maincontainer.getBoundingClientRect(),
8591			rect2 = $boxcontainer.getBoundingClientRect(),
8592			$masthead = document.getElementById('masthead'),
8593			_hideMenu = false,
8594			menuHeight = UNCODE.menuHeight;
8595		$body.style.height = UNCODE.wheight + 'px';
8596
8597		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
8598			_hideMenu = true;
8599		}
8600		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
8601			menuHeight = 0
8602		}
8603
8604
8605		if ( theres_footer )
8606			$footer.style.top = (rect.height || rect2.height) + 'px';
8607
8608		for (var i = 0; i < $sections.length; i++) {
8609			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
8610		}
8611	};
8612
8613	setFPheight();
8614
8615	window.addEventListener('resize', setFPheight, false);
8616	window.addEventListener('orientationchange', setFPheight, false);
8617
8618};
8619
8620UNCODE.particles = function() {
8621	$(".vc-particles-background").each(function() {
8622		var $particle = $(this);
8623		var $parent = $particle.closest('[data-parent]');
8624
8625		$parent.prepend($particle);
8626		// $(window).trigger('resize');
8627	})
8628};
8629
8630
8631UNCODE.readMoreCol = function( $el ){
8632	if ( typeof $el === 'undefined' || $el === null ) {
8633		$el = $('body');
8634	}
8635	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
8636	$readMoreCols.each(function(){
8637		var $uncont = $(this),
8638			$row = $uncont.closest('.row-container'),
8639			max_h = $uncont.attr('data-ov-height'),
8640			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
8641			actual_max_h = $uncont.outerHeight(),
8642			inner_h,
8643			$read_more = $('+ .btn-more-wrap', $uncont),
8644			read_more_resize = $read_more.hasClass('trigger-resize'),
8645			marginClosedBtn = $uncont.attr('data-margin-closed'),
8646			marginClosed = 0,
8647			marginOpenBtn = $uncont.attr('data-margin-open'),
8648			marginOpen = 0,
8649			anim_t = 250,
8650			resized = false;
8651
8652		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
8653
8654		switch (marginClosedBtn) {
8655			case 'sm':
8656				marginClosed = 18
8657				break;
8658				
8659			case 'std':
8660				marginClosed = 36
8661				break;
8662				
8663			case 'lg':
8664				marginClosed = 72
8665				break;
8666				
8667			case '':
8668			default:
8669				marginClosed = 0
8670				break;
8671				
8672		}
8673
8674		switch (marginOpenBtn) {
8675			case 'sm':
8676				marginOpen = 18
8677				break;
8678				
8679			case 'std':
8680				marginOpen = 36
8681				break;
8682				
8683			case 'lg':
8684				marginOpen = 72
8685				break;
8686				
8687			case 'no':
8688				marginOpen = 0
8689				break;
8690				
8691		}
8692
8693		var checkToggleMobile = function(){
8694			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
8695				resized = true;
8696				if ( $read_more.hasClass('state-closed') ) {
8697					$uncont[0].style.height = '';
8698					$uncont[0].style.maxHeight = max_h_mobile;
8699				}
8700			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
8701				if ( $read_more.hasClass('state-closed') ) {
8702					$uncont[0].style.height = '';
8703					$uncont[0].style.maxHeight = max_h;
8704				}
8705				resized = false;
8706			}
8707		}
8708		checkToggleMobile();
8709		$(window).on('resize', function() {
8710			checkToggleMobile();
8711		});
8712
8713		$('a', $read_more).on('click', function(e){
8714			e.preventDefault();
8715
8716			var $a = $(this);
8717
8718			if ( $read_more.hasClass('state-closed') ) {
8719
8720				$read_more
8721					.removeClass('state-closed')
8722					.addClass('state-open');
8723
8724				$uncont.css({
8725					'max-height': 'none',
8726					'height': 'auto',
8727				});
8728	
8729				inner_h = parseFloat( $uncont.outerHeight() );
8730
8731				$uncont.css({
8732					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8733				});
8734		
8735				anim_t = inner_h - actual_max_h;
8736				if ( anim_t < 250 ) {
8737					anim_t = 250;
8738				} else if ( anim_t > 1000 ) {
8739					anim_t = 1000;
8740				}
8741
8742				$uncont.css({
8743					'transition-duration' : anim_t + 'ms'
8744				}).addClass('overflow-mask-animation').animate({
8745					'height': inner_h
8746				}, anim_t, 'easeInOutCubic', function(){
8747					$uncont.css({
8748						'height' : 'auto'
8749					}).removeClass('overflow-mask');
8750					if ( read_more_resize === true ) {
8751						window.dispatchEvent(new Event('resize'));
8752						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8753							ScrollTrigger.refresh(true);
8754						}
8755					}
8756				});
8757
8758				if ( marginOpen != '' ) {
8759					$read_more.animate({
8760						'margin-top' : marginOpen
8761					}, anim_t, 'easeInOutCubic');
8762				}
8763
8764			} else {
8765				$read_more
8766					.removeClass('state-open')
8767					.addClass('state-closed');
8768
8769				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
8770					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8771				}, anim_t, 'easeInOutCubic', function(){
8772					if ( read_more_resize === true ) {
8773						window.dispatchEvent(new Event('resize'));
8774						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8775							ScrollTrigger.refresh(true);
8776						}
8777					}
8778				});
8779
8780				if ( marginClosed !== '' ) {
8781					$read_more.animate({
8782						'margin-top' : marginClosed
8783					}, anim_t, 'easeInOutCubic');
8784				}
8785
8786				if ( $a.hasClass('toggle-scroll') ) {
8787                    var $masthead = $('#masthead > div:first-child'),
8788                        headH = $masthead.outerHeight(),
8789						rectTop = $row[0].getBoundingClientRect().top,
8790						checkNavBar = $a.hasClass('toggle-navbar'),
8791						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
8792                        offCont = ( $row.offset().top );
8793
8794					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
8795						checkNavBar = checkNavBarMobile;
8796					}
8797
8798					if ( checkNavBar ) {
8799						offCont = offCont - headH;
8800					}
8801			
8802					if ( rectTop < headH ) {
8803						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
8804							$(this).stop();
8805						}).animate({
8806							scrollTop: offCont
8807						}, anim_t, 'easeInOutCubic');
8808					}
8809				}
8810
8811			}
8812		});
8813	});
8814}
8815UNCODE.filters = function() {
8816	var $systems = $('.isotope-system, .cssgrid-system');
8817
8818	$systems.each(function(index, val){
8819		var $system = $(this),
8820			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
8821			$widgets = $('.widgetized-cb-wrapper', $system),
8822			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
8823			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
8824			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
8825			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
8826
8827		if ($system.hasClass('isotope-processed')) {
8828			return;
8829		}
8830
8831		$cats_trigger.on('click', function(e) {
8832			if ( ! $('html').hasClass('screen-sm') ) {
8833				// $widgets.add($sorting_dd).slideUp(400);
8834				e.preventDefault();
8835				$widgets.slideUp(400, 'easeInOutCirc');
8836			}
8837		});
8838
8839		$('.filters-toggle-trigger', $system).on('click', function(e) {
8840			e.preventDefault();
8841			var $filters = $('.isotope-filters .menu-horizontal', $system);
8842			$filters.slideToggle(400, 'easeInOutCirc');
8843			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8844		});
8845
8846		$widget_trgr.on('click', function(e) {
8847			e.preventDefault();
8848			$widgets.slideToggle(400, 'easeInOutCirc');
8849			if (!$('html').hasClass('screen-sm')) {
8850				$cats_filters.slideUp(400, 'easeInOutCirc');
8851			}
8852			window.dispatchEvent(new CustomEvent('boxResized'));
8853		});
8854
8855		$sorting_trgr.on('click', function(e) {
8856			e.preventDefault();
8857			if (!$('html').hasClass('screen-sm')) {
8858				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8859			}
8860		});
8861
8862		$system.addClass('isotope-processed');
8863	});
8864
8865};
8866
8867UNCODE.widgets = function() {
8868	var widget_collapses = $('.widget-collapse');
8869
8870	widget_collapses.each(function(){
8871		var widget_collapse = $(this),
8872			widget_title = widget_collapse.find('.widget-title'),
8873			widget = widget_title.closest('.widget'),
8874			content = widget.children().not('.widget-title'),
8875			setCTA;
8876
8877		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
8878			widget_title.toggleClass('open');
8879		}
8880
8881		widget_title.each(function() {
8882			var _this = $(this);
8883			var content = _this.closest('.widget').find('.widget-collapse-content');
8884
8885			$(window).on('load resize', function(){
8886				clearRequestTimeout(setCTA);
8887				setCTA = requestTimeout( function() {
8888					if ( content.is(':visible') ) {
8889						_this.addClass( 'open' );
8890					} else {
8891						_this.removeClass( 'open' );
8892					}
8893				}, 10 );
8894			})
8895
8896			_this.on( 'click', function(){
8897
8898				// Get content of :after element (+ icon) to check the visibility
8899				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
8900
8901				if (icon_content === 'none' || !icon_content) {
8902					return false;
8903				}
8904
8905				_this.toggleClass('open');
8906				var isOpen = _this.hasClass('open'),
8907					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
8908				content.animate({
8909					height: 'toggle',
8910					padding: 'toggle',
8911					opacity: 'toggle',
8912					top: isOpen ? 0 : hasBorder
8913				}, {
8914					duration: 400,
8915					easing: "easeInOutCirc",
8916				});
8917
8918				return false;
8919
8920			});
8921		});
8922	});
8923
8924	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
8925};
8926
8927UNCODE.unmodal = function() {
8928	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
8929		$('.unmodal-overlay').fadeIn();
8930		$('.unmodal-overlay').addClass('loading');
8931		$('body').addClass('uncode-unmodal-overlay-visible');
8932		$(window).trigger('unmodal-open');
8933	});
8934
8935	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
8936		$('.unmodal-overlay').fadeOut();
8937		$('.unmodal').fadeOut();
8938		$('body').removeClass('uncode-unmodal-overlay-visible');
8939		$('body').removeClass('uncode-unmodal-open');
8940		$('html').removeClass('uncode-unmodal-body-disable-scroll');
8941		$(document).trigger('unmodal-close');
8942		UNCODE.isUnmodalOpen = false;
8943	});
8944
8945	$(document).on('uncode-unmodal-show-content', function() {
8946		$('.unmodal-overlay').removeClass('loading');
8947		$('.unmodal').show();
8948		$('.unmodal').addClass('show-unmodal-with-animation');
8949		$('.unmodal-content')[0].scrollTop = 0;
8950		$('body').addClass('uncode-unmodal-open');
8951		UNCODE.isUnmodalOpen = true;
8952
8953		if ($('body').hasClass('qw-body-scroll-disabled')) {
8954			$('html').addClass('uncode-unmodal-body-disable-scroll');
8955		}
8956
8957		if ($('.unmodal').hasClass('auto-height')) {
8958			set_modal_height();
8959		}
8960	});
8961
8962	var set_modal_height = function() {
8963		var modal = $('.unmodal').css({height: 'auto'});
8964		var window_height = $(window).outerHeight();
8965		var modal_height = modal.outerHeight();
8966
8967		modal.css('height', 'auto');
8968
8969		if (modal_height > window_height) {
8970			modal.outerHeight(window_height);
8971		}
8972	}
8973
8974	if ($('.unmodal').hasClass('auto-height')) {
8975		var setCTA;
8976
8977		$(window).on('resize', function() {
8978			clearRequestTimeout(setCTA);
8979			setCTA = requestTimeout(function() {
8980				set_modal_height();
8981			}, 100);
8982		});
8983	}
8984};
8985
8986UNCODE.bgChanger = function() {
8987	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
8988		$bg_first = $('.vc_row[data-bg-remove]'),
8989		bg_remove = $bg_first.attr('data-bg-remove'),
8990		$first = $bg_changers.first(),
8991		$last = $bg_changers.last(),
8992		$bg_wrapper = $('#changer-back-color'),
8993		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
8994		setCTA, localH = UNCODE.wheight,
8995		isScrolling;
8996
8997	$bg_first.removeClass(bg_remove);
8998
8999	var bgChange = function($col, bgColor, skin, tmbskin){
9000		$bg_wrapper.attr( 'class', bgColor );
9001		var menuskin;
9002		if ( typeof skin !== 'undefined' ) {
9003			menuskin = skin.replace('style', 'menu')
9004		}
9005
9006		if ( $col.length ) {
9007			$('.uncol[data-skin-change]').each(function(){
9008				var $isoFooter = $('.isotope-footer', this);
9009				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
9010				if ( menuskin !== '' ) {
9011					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
9012				}
9013			});
9014
9015			$('.tmb[data-skin-change]').each(function(){
9016				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
9017			});
9018		}
9019	};
9020
9021	var $masthead = $('#masthead'),
9022		transDesktop,
9023		transMobile,
9024		changeSkin,
9025
9026	checkTransparencyAndChange = function( skin ){
9027		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
9028		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
9029		changeSkin = $masthead.hasClass('menu-change-skin');
9030
9031		if ( ! transDesktop && ! transMobile ) {
9032			return false;
9033		}
9034
9035		if ( ! changeSkin ) {
9036			return false;
9037		}
9038
9039		if ( skin === 'style-light' ){
9040			$masthead.removeClass('style-dark-override').addClass('style-light-override');
9041			return false;
9042		} else if ( skin === 'style-dark' ) {
9043			$masthead.removeClass('style-light-override').addClass('style-dark-override');
9044			return false;
9045		}
9046	};
9047
9048	var bg_waypoints = function(){
9049		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
9050
9051			$.each($bg_changers, function(index, row) {
9052
9053				var $row = $(row),
9054					$col = $('.uncol[data-skin-change]', $row).eq(0),
9055					skin,
9056					$tmbs,
9057					tmbskin,
9058					bgColor = $row.attr('data-bg-color');
9059
9060				if ( ! $row.is(':visible') ) {
9061					return false;
9062				}
9063
9064				if ( $col.length ) {
9065					skin = $col.attr('data-skin-change');
9066					$tmbs = $('.tmb[data-skin-change]', $row);
9067					tmbskin = skin.replace('style', 'tmb');
9068				}
9069
9070				if ( ! $row.hasClass('unscroll-horizontal') ) {
9071					$row.waypoint(function( dir ) {
9072						if ( dir === 'down' ) {
9073							bgChange($col, bgColor, skin, tmbskin);
9074							checkTransparencyAndChange(skin);
9075						} else {
9076							return;
9077						}
9078					}, {
9079						offset: '50%'
9080		  			});
9081
9082					$row.waypoint(function( dir ) {
9083						if ( dir === 'up' ) {
9084							bgChange($col, bgColor, skin, tmbskin);
9085							checkTransparencyAndChange(skin);
9086						} else {
9087							return;
9088						}
9089					}, {
9090						offset: function() {
9091							var clH = this.element.clientHeight,
9092								wH = window.innerHeight,
9093								ret = clH > 200 ? -100 : clH * -0.5;
9094							return ( wH / 2 ) - clH;
9095						}
9096					});
9097				}
9098
9099			});
9100
9101			$('body').addClass('bg-changer-init');
9102
9103		}
9104	};
9105
9106	var body = document.body,
9107	edges = false;
9108
9109	var throttle = function(fn, wait) {
9110		var time = Date.now();
9111		return function() {
9112			if ((time + wait - Date.now()) < 0) {
9113				fn();
9114				time = Date.now();
9115			}
9116		}
9117	}
9118
9119	var $wrapper = document.querySelector(".main-wrapper"),
9120		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
9121
9122	var $title = document.querySelector('#rotating');
9123	if ( $title !== null ) {
9124		$title.style.whiteSpace = 'nowrap';
9125		$title.style.transition = 'transform 200ms linear';
9126	}
9127
9128	window.addEventListener( 'scroll', throttle( function() {
9129		window.clearRequestTimeout( isScrolling );
9130
9131		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
9132
9133			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
9134				body = document.body,
9135				html = document.documentElement,
9136				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9137				$row = false,
9138				firstOff,
9139				lastOff;
9140
9141			if ( scrolled < 100 && $first.length ) {
9142				firstOff = $first.offset().top;
9143				if ( firstOff < 100 ) {
9144					var $row = $first;
9145				}
9146			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
9147				lastOff = $last.offset().top + $last.outerHeight();
9148				if ( lastOff > ( docH - 100 ) ) {
9149					var $row = $last;
9150				}
9151			}
9152
9153			if ( $row.length ) {
9154				var $col = $('.uncol[data-skin-change]', $row).eq(0),
9155					skin,
9156					$tmbs,
9157					tmbskin,
9158					bgColor = $row.attr('data-bg-color');
9159
9160				if ( $col.length ) {
9161					skin = $col.attr('data-skin-change');
9162					$tmbs = $('.tmb[data-skin-change]', $row);
9163					tmbskin = skin.replace('style', 'tmb');
9164				}
9165
9166				bgChange($col, bgColor, skin, tmbskin);
9167				checkTransparencyAndChange(skin);
9168				edges = true;
9169			}
9170
9171		}, 150);
9172
9173		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
9174			bg_waypoints();
9175			Waypoint.refreshAll();
9176			edges = false;
9177		}
9178
9179	}, 100), false);
9180
9181	$(window).on('resize', function() {
9182		clearRequestTimeout(setCTA);
9183		setCTA = requestTimeout(function() {
9184			if ( localH != UNCODE.wheight ) {
9185				localH = UNCODE.wheight;
9186				bg_waypoints();
9187				Waypoint.refreshAll();
9188			}
9189		}, 100);
9190	});
9191
9192	bg_waypoints();
9193
9194};
9195
9196UNCODE.skewIt = function() {
9197
9198	if ( $('body').hasClass('compose-mode') ) {
9199		return;
9200	}
9201
9202	var justscrolled = false;
9203
9204	var loadSkewIt = function(){
9205
9206		var $pageHeader = $('#page-header'),
9207			$page_body = $('.page-body'),
9208			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
9209
9210		if ( $header_skew.length ) {
9211			$pageHeader.addClass('uncode-skew').css({
9212				position: 'relative',
9213				zIndex: 1
9214			});
9215			$header_skew.removeClass('uncode-skew');
9216			$page_body.css({
9217				position: 'relative',
9218				zIndex: 0
9219			});
9220		}
9221
9222		var $skew = $('.uncode-skew'),
9223			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
9224			horizontal = $horizontal.length,
9225			stopSkewing,
9226			lastOffset = 0,
9227			lastDate = Date.now();
9228
9229		if ( ! $skew.length ) {
9230			return;
9231		}
9232
9233		var dropSkew = function(){
9234			if ( UNCODE.wwidth < UNCODE.mediaQuery )
9235				return;
9236
9237			$skew.each(function(){
9238				var $this = $(this),
9239					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9240
9241				if ( $drop.length ) {
9242					$this.css({
9243						'transform': 'skew(0)'
9244					});
9245					var bound = $this[0].getBoundingClientRect();
9246					$drop.css({
9247						left: bound.x * -1,
9248						top: bound.y * -1,
9249					});
9250				}
9251			});
9252		};
9253		dropSkew();
9254
9255		$(window).on('resize', dropSkew);
9256
9257		window.addEventListener( 'scroll', function() {
9258
9259			if ( justscrolled !== true ) {
9260				justscrolled = true;
9261				return;
9262			}
9263
9264			window.clearRequestTimeout( stopSkewing );
9265
9266			var now = Date.now(),
9267				delayInMs = now - lastDate,
9268				offset = window.pageYOffset || window.document.documentElement.scrollTop,
9269				newOffset = offset - lastOffset,
9270				speed = Math.pow((newOffset / delayInMs), 3) * -1,
9271				body = document.body,
9272				html = document.documentElement,
9273				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9274				wait = 50,
9275				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
9276
9277			if ((lastDate + wait - now) < 0) {
9278
9279				lastDate = now;
9280				lastOffset = offset;
9281
9282				if ( speed > 6 ) {
9283					speed = 6;
9284				} else if ( speed < -6 ) {
9285					speed = -6;
9286				}
9287
9288				if ( speed > 2 && offset < UNCODE.wheight ) {
9289					speed = 2;
9290				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
9291					speed = -2;
9292				}
9293
9294				var speedY = speed,
9295					speedX = speed * 1.25;
9296
9297				if ( horizontal ) {
9298					speedY = 0;
9299					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9300						speedX = 0;
9301						return;
9302					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
9303						speedX = 0;
9304						return;
9305					}
9306				} else {
9307					speedX = 0;
9308				}
9309
9310				if ( ! $skew.closest('.enter-st').length ) {
9311					speedX = 0;
9312				}
9313
9314				gsap.killTweensOf($skew);
9315				gsap.to( $skew, {
9316					duration: 0.2,
9317					skewY: (speedY * maxSpeed) + "deg",
9318					skewX: (speedX * maxSpeed) + "deg",
9319					ease: Power0.easeNone,
9320					transformOrigin: 'center',
9321				});
9322
9323			}
9324
9325			stopSkewing = requestTimeout(function() {
9326				gsap.killTweensOf($skew);
9327				gsap.to( $skew, {
9328					duration: 0.5,
9329					skewY: "0deg",
9330					skewX: "0deg",
9331					transformOrigin: 'center',
9332					ease: Expo.easeOut,
9333				});
9334
9335				$skew.each(function(){
9336					var $this = $(this),
9337						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9338
9339					if ( $drop.length ) {
9340						var bound = $this[0].getBoundingClientRect()
9341						$drop.css({
9342							left: bound.x * -1,
9343							top: bound.y * -1,
9344						});
9345					}
9346				});
9347
9348			}, 200);
9349
9350		}, false);
9351
9352	};
9353
9354	$(window).on('load', loadSkewIt);
9355
9356};
9357
9358UNCODE.rotateIt = function() {
9359
9360	if ( $('body').hasClass('compose-mode') ) {
9361		return;
9362	}
9363
9364	var frameRotate = false;
9365	var loadRotateIt = function(){
9366
9367		var $toRotate = $('.uncode-rotate');
9368
9369		$toRotate.each(function(){
9370			var $rotate = $(this),
9371				deg = 0,
9372				dir = true,
9373				coeff = 1,
9374				lastOffset = 0,
9375				lastDate = Date.now();
9376
9377			var checkScroll = function($rotate){
9378				// if ( ! $rotate.length ) {
9379				// 	return;
9380				// }
9381
9382				var now = Date.now(),
9383					delayInMs = now - lastDate,
9384					offset = window.pageYOffset || window.document.documentElement.scrollTop,
9385					newOffset = offset - lastOffset,
9386					speed = (newOffset / delayInMs) * 5,
9387					body = document.body,
9388					html = document.documentElement,
9389					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
9390
9391				lastDate = now;
9392				lastOffset = offset;
9393
9394				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
9395					deg = 0;
9396				}
9397
9398				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
9399					deg = parseFloat(deg) + parseFloat(speed);
9400				}
9401
9402				if ( $rotate.hasClass('uncode-rotate-hover') ) {
9403					$rotate.hover(function(){
9404						coeff = 1.75;
9405					}, function(){
9406						coeff = 1;
9407					});
9408				}
9409
9410				// if ( speed > 0 ) {
9411				// 	dir = true
9412				// } else if ( speed < 0 ) {
9413				// 	dir = false
9414				// }
9415
9416				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
9417					deg = deg+coeff;
9418					// if ( dir ) {
9419					// 	deg = deg+coeff;
9420					// } else {
9421					// 	deg = deg-coeff;
9422					// }
9423				}
9424
9425				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9426					return false;
9427				}
9428				
9429				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
9430					var undeg = deg*-1;
9431					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
9432				} else {
9433					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
9434				}
9435
9436				requestAnimationFrame(function() {
9437					if ( frameRotate === true ) {
9438						frameRotate = false;
9439						return;
9440					}
9441					checkScroll($rotate);
9442				});
9443			};
9444
9445			checkScroll($rotate);
9446
9447		});
9448
9449	};
9450
9451	$(window).on('load', loadRotateIt);
9452
9453	var checkRotate;
9454	var resizeRotate = function(){
9455		var $inlineRotates = $('.inline-rotate');
9456		$inlineRotates.each(function(){
9457			$(this).addClass('inline-rotate-standby');
9458		});
9459		clearTimeout(checkRotate);
9460		checkRotate = setTimeout(function(){
9461			$('.inline-rotate').each(function(){
9462				$(this).removeClass('inline-rotate-standby');
9463				frameRotate = true;
9464			});
9465			loadRotateIt();
9466		}, 500);
9467	};
9468
9469	$(window).off('resize.inline-rotate', resizeRotate)
9470	.on('resize.inline-rotate', resizeRotate);
9471
9472};
9473
9474var marqueeAttempts = 0,
9475	marqueeTO,
9476	marqueeCheckResize;
9477
9478UNCODE.textMarquee = function( $titles ) {
9479
9480	var initTextMarquee = function( $titles ){
9481
9482		if ( typeof $titles == 'undefined' ) {
9483			$titles = $('.un-text-marquee');
9484		}
9485
9486		if ( ! $titles.length ) {
9487			return;
9488		}
9489
9490		var stableHeight = UNCODE.wheight;
9491
9492		$titles.each(function(){
9493			var $title = $(this),
9494				$span = $('> span, > i > span', $title),
9495				txt,
9496				first = true,
9497				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
9498				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
9499				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
9500				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
9501				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
9502				newW = UNCODE.wwidth,
9503				marqueeTL, inview;
9504
9505			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
9506				dataTrigger = 'row';
9507			}
9508
9509			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
9510				dataNavBar = dataNavBarMobile;
9511			}
9512
9513			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
9514			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
9515			var dataX = dataSpeed;
9516
9517			dataSpeed += 5;
9518
9519			$('.marquee-clone-wrap', $title).remove();
9520
9521			txt = $span.html();
9522
9523			if ( ! $('.marquee-original-core', $span).length ) {
9524				txt = $span.html();
9525				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
9526			} else {
9527				txt = $('.marquee-original-core', $span).html();
9528			}
9529
9530			var spanW,
9531				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
9532				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
9533				speed = 10 - dataSpeed;
9534
9535			$span.prepend($prepended);
9536			$span.append($appended);
9537
9538			var continuousTextMarquee = function () {
9539				var bound = $title
9540						.css({
9541							transform: "none",
9542							opacity: 0,
9543						})
9544						.offset(),
9545					ease = "none";
9546
9547				var xStrt =
9548						first || $title.hasClass("un-marquee-infinite")
9549							? 0
9550							: UNCODE.wwidth - bound.left,
9551					xEnd = $title.hasClass("un-marquee-infinite")
9552						? spanW
9553						: spanW + bound.left,
9554					xSpeed =
9555						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
9556						dataSpeed,
9557					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
9558					speedSlow = (xEnd + xStrt) / 45,
9559					transFormVal,
9560					translX;
9561
9562				marqueeTL = new TimelineMax({ paused: true, reversed: true });
9563
9564				var inViewElement =
9565						dataTrigger === "row" ? $title.closest('.sticky-trigger, .sticky-element').parent()[0] : $title[0],
9566					wayOff =
9567						dataTrigger === "row" && dataNavBar === "yes"
9568							? UNCODE.menuHeight
9569							: 0;
9570
9571				inview = new Waypoint.Inview({
9572					element: inViewElement,
9573					offset: wayOff,
9574					enter: function (direction) {
9575						marqueeTL.play();
9576					},
9577					exited: function (direction) {
9578						if (!$title.closest(".pin-spacer").length) {
9579							marqueeTL.pause();
9580						}
9581					},
9582				});
9583
9584				if ($title.hasClass("un-marquee-hover")) {
9585					var $column = $title.closest(".wpb_column"),
9586						$col_link = $(".col-link", $column),
9587						$hover_sel = $title;
9588
9589					if ($col_link.length) {
9590						$hover_sel = $title.add($column);
9591					}
9592					$hover_sel
9593						.on("mouseover", function () {
9594							ease = "power2.out";
9595							transFormVal = $title.css("transform").split(/[()]/)[1];
9596							translX = transFormVal.split(",")[4];
9597							speedSlow = (xEnd + (xStrt - translX)) / 45;
9598							marqueeTL.duration(speedSlow);
9599						})
9600						.on("mouseout", function () {
9601							ease = "power2.in";
9602							transFormVal = $title.css("transform").split(/[()]/)[1];
9603							translX = transFormVal.split(",")[4];
9604							speedSlow =
9605								((xEnd + (xStrt - translX)) /
9606									(dataSpeed * dataSpeed * dataSpeed) /
9607									5) *
9608								dataSpeed;
9609							marqueeTL.duration(speedSlow);
9610						});
9611				}
9612		
9613				gsap.killTweensOf($title);
9614				marqueeTL.fromTo( $title, {
9615					opacity: 1,
9616					x: xStrt * direction * -1
9617				},
9618				{
9619					duration: xSpeed,
9620					x: xEnd * direction,
9621					onComplete: function(){
9622						first = false;
9623						continuousTextMarquee();
9624					},
9625					ease: ease
9626				});
9627		
9628			};
9629			
9630			var runTextMarquee = function(){
9631				var time = Date.now();
9632
9633				var textMarqueeScroll = function(){
9634					var $row = $title.closest('.sticky-trigger, .sticky-element').parent(),
9635						$bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
9636
9637					if ( !$bound.length ) {
9638						return;
9639					}
9640
9641					var bound = $bound[0].getBoundingClientRect(),
9642						wait = 100,
9643						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
9644						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
9645
9646					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
9647						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
9648						marqueeAttempts < 2 ) {
9649
9650						clearRequestTimeout(marqueeTO);
9651
9652						marqueeTO = requestTimeout(function(){
9653							marqueeAttempts++;
9654							initTextMarquee();
9655						}, 100);
9656					}
9657
9658
9659					var bound_top = bound.top,
9660						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
9661
9662					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
9663						if ( dataTrigger === 'row-middle' ) {
9664							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5)
9665						}
9666						if ( dataNavBar === 'yes' ) {
9667							bound_top = bound_top - UNCODE.menuHeight;
9668						}
9669						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
9670					}
9671
9672					gsap.killTweensOf($title);
9673					gsap.to( $title, {
9674						duration: 0.24,
9675						x: gsap_calc,
9676					});
9677				};
9678
9679				textMarqueeScroll();
9680				$(window).on( 'load scroll', function(e) {
9681					textMarqueeScroll();
9682				});
9683
9684			};
9685
9686			var cloneSpan = function($_title, cntnt){
9687
9688				if ( $_title.hasClass('un-marquee-infinite') ) {
9689					$('> span.marquee-clone-wrap', $_title).text('');
9690				}
9691
9692				gsap.to( $_title, {
9693					duration: 0,
9694					x: 0
9695				});
9696				spanW = $span.outerWidth();
9697
9698				if ( !spanW ) {
9699					return;
9700				}
9701
9702				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
9703					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
9704
9705				if ( $_title.hasClass('un-marquee-infinite') ) {
9706
9707					for ( var i = 0; i < part; i++ ) {
9708						$prepended.append(cntnt + spaceSpan);
9709						$appended.append(cntnt + spaceSpan);
9710					}
9711				}
9712
9713				if ( $('body').hasClass('compose-mode') ) {
9714					$('.uncode_fe_safe').remove();
9715					return;
9716				}
9717
9718				if ( $title.closest('.marquee-freezed').length ) {
9719					return;
9720				}
9721
9722				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
9723					continuousTextMarquee();
9724				}
9725
9726				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
9727					runTextMarquee();
9728				}
9729
9730			};
9731
9732			var marqueeResize = function(e){
9733				clearRequestTimeout(marqueeCheckResize);
9734				marqueeCheckResize = requestTimeout(function(){
9735					if ( newW !== UNCODE.wwidth ) {
9736						gsap.killTweensOf($title);
9737						if ( typeof inview !== 'undefined' && inview !== null ) {
9738							inview.destroy();
9739						}
9740						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
9741							marqueeTL.kill();
9742						}
9743						first = true;
9744						initTextMarquee();
9745						newW = UNCODE.wwidth;
9746					}
9747				}, 1000);
9748			};
9749
9750			$(window).off('resize uncode.re-layout', marqueeResize)
9751			.on( 'resize uncode.re-layout', marqueeResize);
9752
9753			cloneSpan($title, txt);
9754
9755			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9756				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
9757					var $_titles = $('.un-text-marquee',e.view.$el);
9758					clearRequestTimeout(marqueeCheckResize);
9759					marqueeCheckResize = requestTimeout(function(){
9760						initTextMarquee($_titles);
9761					}, 1000);
9762				});
9763			}
9764		});
9765
9766		$(window).on( 'load wwResize', function(e) {
9767			stableHeight = UNCODE.wheight;
9768		});
9769
9770	};
9771
9772	document.addEventListener("DOMContentLoaded", function() {
9773		initTextMarquee();
9774	});
9775
9776	$(window).on('focus',function(){
9777		setTimeout(function(){
9778			initTextMarquee();
9779		},500);
9780	});
9781	
9782	$(document).on('pumAfterOpen pumAfterClose', function(args){
9783		initTextMarquee();
9784	});
9785
9786};
9787
9788UNCODE.parallax = function() {
9789	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
9790		if ($('.parallax-el').length > 0) {
9791			var parallax_elements = new Rellax('.parallax-el');
9792			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
9793			window.addEventListener('boxResized', function(e) {
9794				parallax_elements.refresh();
9795			}, false);
9796			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
9797				requestTimeout(function() {
9798					parallax_elements.refresh();
9799				}, 100);
9800			});
9801
9802			if ( typeof UNCODE.hDoc === 'undefined' ) {
9803				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
9804					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
9805			}
9806		
9807			function paralraf(time) {
9808				requestAnimationFrame(paralraf)
9809		
9810				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
9811					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
9812				
9813				if ( UNCODE.hDoc !== newHdoc ) {
9814					UNCODE.hDoc = newHdoc;
9815					parallax_elements.refresh();
9816				}
9817			}
9818		
9819			requestAnimationFrame(paralraf)
9820		
9821		}
9822	}
9823};
9824
9825UNCODE.magicCursor = function(){
9826	var $customCursor = $('#uncode-custom-cursor'),
9827		$customPilot = $('#uncode-custom-cursor-pilot'),
9828		$tooltip = $('.title-tooltip', $customCursor),
9829		$cursorSpan = $('> span', $tooltip),
9830		currentBg = false,
9831		fromTitle = false,
9832		setTime,
9833		mouseEvent;
9834
9835		var spanW, spanH,
9836		maxW = false;
9837
9838	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
9839		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
9840			$tooltip.css({opacity: 0});
9841			delayt_time += 400;
9842		}
9843		clearRequestTimeout(setTime);
9844		setTime = requestTimeout(function() {
9845
9846			$tooltip.css({opacity: ''});
9847
9848			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
9849
9850			if ( cursorTitle !== '' ) {
9851				if ( fromTitle && dataTitle === 'boing' ) {
9852					setTimeout(function(){
9853						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
9854					}, 5);
9855				}
9856				$cursorSpan.attr('class', fontClass).html( cursorTitle );
9857			} else {
9858				if ( cursorType !== 'auto' ) {
9859					$cursorSpan.html('');
9860				}
9861			}
9862
9863			$cursorSpan.addClass('in-tooltip');
9864
9865			$customCursor.attr('data-cursor', cursorType);
9866
9867			if ( fromTitle ) {
9868				$customCursor.addClass('from-tooltip-title');
9869			} else {
9870				$customCursor.removeClass('from-tooltip-title');
9871			}
9872
9873			if ( cursorBg !== false ) {
9874				$customCursor.attr('data-bg', 'transparent');
9875			} else {
9876				$customCursor.removeAttr('data-bg');
9877			}
9878
9879			currentBg = cursorBg;
9880
9881			if ( cursorTitle !== '' ) {
9882				fromTitle = true;
9883				$customCursor.attr('data-cursor', cursorType);
9884				$customCursor.attr('data-title', 'true');
9885				$cursorSpan.css({width: ''});
9886			} else {
9887				fromTitle = false;
9888				$customCursor.removeAttr('data-title');
9889			}
9890			spanW = $cursorSpan.outerWidth();
9891			
9892			if ( spanW >= maxW && maxW !== false ) {
9893				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
9894				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
9895					width: maxW
9896				});
9897				spanW = maxW;
9898			} else {
9899				$customCursor.find('> span:first-child').removeClass('max-width');
9900			}
9901			spanH = $cursorSpan.outerHeight();
9902			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
9903				$customCursor.find('> span:first-child').add($tooltip).css({
9904					width: spanW,
9905					height: spanH
9906				});
9907			} else {
9908				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
9909			}
9910			if ( $customPilot.length ) {
9911				$customPilot.attr('data-cursor', cursorType);
9912			}
9913		}, delayt_time);
9914	}
9915
9916	function changeCursor($wrap){
9917		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
9918		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
9919			$href = $wrap.find(href),
9920			cursorType,
9921			cursorTitle = '',
9922			tooltip_class = '',
9923			cursorBg = false;
9924
9925		$href.filter(':not(.cursor-init)').on('mouseenter.cursor',function(e) {
9926			var $this = $(this).addClass('cursor-init'),
9927				$tmb = $this.closest('.tmb'),
9928				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
9929				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
9930				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
9931				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
9932				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
9933				$title = $('.t-entry-title', $tmb),
9934				is_frontend_editor = $this.closest('.vc_controls').length,
9935				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
9936				$parent_cursor = $this.closest('[class*="custom-cursor"]');
9937
9938			if ( is_frontend_editor ) {
9939				cursorType = 'auto';
9940			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
9941				cursorType = data_cursor;
9942			} else if ( $parent_cursor.length ) {
9943				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
9944					cursorType = 'icon-light';
9945				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
9946					cursorType = 'icon-diff';
9947				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
9948					cursorType = 'icon-accent';
9949				} else {
9950					cursorType = 'icon-dark';
9951				}
9952			} else {
9953				cursorType = 'pointer';
9954			}
9955
9956			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
9957				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
9958					cursorTitle = custom_text;
9959				} else {
9960					cursorTitle = $title.clone();
9961					$('a', cursorTitle).replaceWith(function() {
9962						return this.childNodes;
9963					});
9964					$('*', cursorTitle).replaceWith(function(){
9965						return $(this).removeAttr('class');
9966					});
9967					cursorTitle = cursorTitle.html();
9968				}
9969			} else {
9970				cursorTitle = '';
9971			}
9972
9973			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
9974				tooltip_class = data_class;
9975			} else {
9976				tooltip_class = '';
9977			}
9978
9979			if ( cursor_bg == 'true' ) {
9980				cursorBg = true;
9981			} else {
9982				cursorBg = false;
9983			}
9984
9985			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
9986		}).on('mouseleave.cursor', function(){
9987			var outTime = 150;
9988			if ( currentBg !== false && cursorBg === false ) {
9989				outTime = 0;
9990			}
9991			delayChangeCursor('auto', '', false, outTime, false, '');
9992		});
9993
9994		$(window).on('disable-hover', function(event) {
9995			document.addEventListener("mousemove", function(e) {
9996				mouseEvent = e;
9997			});
9998			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
9999		});
10000
10001		$(window).on('enable-hover', function(event) {
10002			if ( typeof mouseEvent !== 'undefined' ) {
10003				var x = mouseEvent.clientX,
10004					y = mouseEvent.clientY;
10005
10006				var elements = document.elementsFromPoint(x, y),
10007					$element = $(elements[0]);
10008
10009				$element.closest(href).trigger('mouseenter');
10010			}
10011		});
10012
10013	}
10014
10015	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10016		changeCursor();
10017	});
10018
10019	$(document).ajaxComplete(function( event, xhr, settings ) {
10020		changeCursor();
10021	});
10022
10023	$('.isotope-container').on('isotope-layout-complete', function() {
10024		var $this = $(this);
10025		changeCursor($this);
10026	});
10027
10028};
10029
10030UNCODE.magneticCursor = function(){
10031	function magneticCursor($wrap){
10032		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10033		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'));
10034
10035		$magnetics.on('mousemove', function(e){
10036			var $this = $(this),
10037				$el,
10038				bound = e.currentTarget.getBoundingClientRect(),
10039				coeff = 30,
10040				hor = (bound.width / 2) - (e.clientX - bound.left),
10041				ver = (bound.height / 2) - (e.clientY - bound.top),
10042				toX = hor / bound.width * coeff,
10043				toY = ver / bound.height * coeff,
10044				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
10045				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
10046				toScale = Math.max(scaleX, scaleY);
10047
10048			if ( $this.hasClass('magnetic') ) {
10049				$el = $('.background-inner, .header-bg', $this);
10050			} else {
10051				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10052			}
10053
10054			gsap.killTweensOf($el);
10055			gsap.to( $el, {
10056				duration: 0.75,
10057				x: toX,
10058				y: toY,
10059				scale: toScale,
10060				ease: Power1.easeOut,
10061				transformPerspective: 900,
10062				transformOrigin: 'center',
10063				force3D: true
10064			});
10065		}).on('mouseout', function(e){
10066			var $this = $(this),
10067				$el
10068			if ( $this.hasClass('magnetic') ) {
10069				$el = $('.background-inner, .header-bg', $this);
10070			} else {
10071				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10072			}
10073			gsap.killTweensOf($el);
10074			gsap.to( $el, {
10075				duration: 0.6,
10076				y: 0,
10077				x: 0,
10078				scale: 1,
10079				ease: Power1.easeOut,
10080				transformPerspective: 900,
10081				transformOrigin: 'center',
10082				force3D: true
10083			});
10084		});
10085	};
10086
10087	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10088		magneticCursor();
10089	});
10090
10091	$(document).ajaxComplete(function( event, xhr, settings ) {
10092		magneticCursor();
10093	});
10094
10095	$('.isotope-container').on('isotope-layout-complete', function() {
10096		var $this = $(this);
10097		magneticCursor($this);
10098	});
10099
10100};
10101
10102UNCODE.dropImage = function() {
10103
10104	/****************************
10105	 * Image hover *
10106	****************************/
10107	function imageHover(){
10108		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10109			return;
10110		}
10111
10112		var $postLists = $('.uncode-post-titles');
10113		$postLists.each(function(){
10114			var $list = $(this),
10115				timing = parseFloat( $list.attr('data-timing') ),
10116				default_image = $list.hasClass('uncode-post-titles-default-image'),
10117				default_title = $list.hasClass('uncode-post-titles-default-title'),
10118				$tmbs = $('.tmb', $list),
10119				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
10120				clientX,
10121				clientY,
10122				$row_parent = $list.closest('.vc_row'),
10123				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
10124				$col_parent = $list.closest('.uncell'),
10125				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
10126				setCTA;
10127
10128			timing *= 0.001;
10129
10130			var drop_bgs = function(){
10131				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
10132					var $drop = $(this),
10133						srcset = $drop.attr('data-bgset'),
10134						setArr = srcset.split(","),
10135						setArrOrder = [],
10136						biggest = 0,
10137						checkBg = false,
10138						desktopBG = $drop.data('[data-background-image]'),
10139						mobileBG = $drop.data('[data-mobile-background-image]');
10140
10141					if ( $drop.hasClass('srcset-bg-async') ) {
10142
10143						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
10144							return;
10145						}
10146						
10147					}
10148
10149					if ( SiteParameters.uncode_adaptive == true ) {
10150						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
10151							$drop.css({
10152								'background-image' : 'url(' + setArr[0] + ')'
10153							});
10154						}
10155					} else {
10156						for ( var i = 0; i < setArr.length; i++ ) {
10157							var setLoop = setArr[i].trim().split(" ");
10158							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
10159								var parseSet = parseFloat(setLoop[1]);
10160								if ( biggest < parseSet ) {
10161									biggest = parseSet;
10162								}
10163								setArrOrder[parseSet] = setLoop[0];
10164								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
10165									checkBg = true;
10166									$drop.css({
10167										'background-image' : 'url(' + setLoop[0] + ')'
10168									});
10169								}
10170							}
10171						}
10172
10173						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
10174							$drop.css({
10175								'background-image' : 'url(' + setArrOrder[biggest] + ')'
10176							});
10177						}
10178					}
10179
10180				});
10181			};
10182
10183			drop_bgs();
10184
10185			var dropMovesSize = function(){
10186				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
10187					return;
10188				}
10189				$drop_moves.each(function(){
10190					var $drop_move = $(this),
10191						dataW = $drop_move.attr('data-w'),
10192						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
10193					if ( typeof dataW !== 'undefined' && dataW !== null ) {
10194						dataW = screenInfo.width / 12 * parseFloat( dataW );
10195					}
10196					$drop_moves.css({
10197						width: dataW
10198					});
10199
10200					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10201						$anim_parent.on('animationend', function(){
10202							var bound = $anim_parent[0].getBoundingClientRect();
10203							$drop_move.css({
10204								left: bound.x * -1,
10205								top: bound.y * -1,
10206							});
10207						});
10208					}
10209				});
10210
10211
10212			};
10213
10214			dropMovesSize();
10215
10216			$(window).on( 'resize', function(){
10217				clearRequestTimeout(setCTA);
10218				setCTA = requestTimeout( function() {
10219					drop_bgs();
10220					dropMovesSize();
10221				}, 100 );
10222			});
10223
10224			if ( $drop_row_parents.length ) {
10225				$row_parent.addClass( 'drop-added' );
10226			}
10227
10228			$drop_row_parents.each(function(index, val){
10229				var $drop = $(val);
10230				$row_parent.prepend($drop);
10231				manageVideos($drop, false);
10232				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10233					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10234				}
10235				if ( default_image && index == 0 ) {
10236					manageVideos($drop, true);
10237					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10238						image_ph = new Image();
10239					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10240						image_ph.onload = function() {
10241							$drop.addClass('active');
10242							if ( default_title ) {
10243								$list.addClass('drop-hover');
10244								$tmbs.first().addClass('drop-active');
10245							}
10246						};
10247						image_ph.src = bg_img;
10248					}
10249				}
10250			});
10251
10252			if ( $drop_col_parents.length ) {
10253				$col_parent.addClass( 'drop-added' );
10254			}
10255
10256			$drop_col_parents.each(function(index, val){
10257				var $drop = $(this);
10258				$col_parent.prepend($drop);
10259				manageVideos($drop, false);
10260				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10261					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10262				}
10263				if ( default_image && index == 0 ) {
10264					manageVideos($drop, true);
10265					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10266						image_ph = new Image();
10267					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10268						image_ph.onload = function() {
10269							$drop.addClass('active');
10270							if ( default_title ) {
10271								$list.addClass('drop-hover');
10272								$tmbs.first().addClass('drop-active');
10273							}
10274						};
10275						image_ph.src = bg_img;
10276					}
10277				}
10278			});
10279
10280			function manageVideos( $el, start ) {
10281				var videoElem = $('video', $el),
10282					$iframe = $('iframe', $el),
10283					iframeID = $iframe.attr('id');
10284				if ( videoElem.length ) {
10285					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
10286						if ( start ) {
10287							videoElem[0].setCurrentTime(0);
10288							videoElem[0].play();
10289						} else {
10290							videoElem[0].pause();
10291							videoElem[0].setCurrentTime(0);
10292						}
10293					} else {
10294						if ( start ) {
10295							videoElem[0].currentTime = 0;
10296							videoElem[0].play();
10297						} else {
10298							videoElem[0].pause();
10299							videoElem[0].currentTime = 0;
10300						}
10301					}
10302				}
10303
10304				$el.data('active', start);
10305
10306				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
10307					var iframeIDv = iframeID.replace('okplayer-', ''),
10308						optionsV = $(window).data('okoptions-' + iframeIDv),
10309						vimeo = $iframe[0],
10310						playerV = new Vimeo.Player(vimeo),
10311						timeV = 0;
10312
10313					if (optionsV.time != null) {
10314						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
10315						for ( var i = 0; i < timeArr.length; i++ ) {
10316							if ( timeArr[i] === 'h' ) {
10317								timeV += parseFloat(timeArr[i-1]) * 3600;
10318							} else if ( timeArr[i] === 'm' ) {
10319								timeV += parseFloat(timeArr[i-1]) * 60;
10320							} else if ( timeArr[i] === 's' ) {
10321								timeV += parseFloat(timeArr[i-1]);
10322							}
10323						}
10324					}
10325					playerV.setCurrentTime(timeV);
10326					if ( start ) {
10327						playerV.setVolume(0);
10328						playerV.play();
10329					} else {
10330						playerV.pause();
10331					}
10332				} else if ( $el.attr('data-provider') === 'youtube' ) {
10333					if ( start ) {
10334						$el.trigger('uncode-resume');
10335					} else {
10336						$el.trigger('uncode-pause');
10337					}
10338				}
10339
10340			}
10341
10342			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
10343
10344				document.addEventListener("mousemove", function(e) {
10345					$drop_moves.each(function(){
10346						var $drop_move = $(this),
10347							duration = 0.4;
10348
10349						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
10350							duration = 0.8;
10351						}
10352
10353						clientX = e.clientX;
10354						clientY = e.clientY;
10355
10356						gsap.to( $drop_move, {
10357							duration: duration,
10358							x: clientX,
10359							y: clientY,
10360							ease: Power1.easeOut,
10361						});
10362					});
10363				});
10364
10365			} else {
10366
10367				$(window).on("touchend scroll", function(e) {
10368					$list.removeClass('drop-hover');
10369					$drop_moves.removeClass('active');
10370					$tmbs.removeClass('drop-active');
10371				});
10372
10373				$drop_moves.each(function(){
10374					var $drop_move = $(this),
10375						$tmb = $drop_move.closest('.tmb'),
10376						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
10377
10378					if ( $anim_parent.hasClass('uncode-skew') ) {
10379						$anim_parent.css({
10380							'transform': 'skew(0)'
10381						});
10382					}
10383
10384					$tmb.on('touchend', function(e){
10385						e.stopPropagation();
10386
10387						$drop_moves.removeClass('active');
10388						$tmbs.removeClass('drop-active');
10389
10390						$list.addClass('drop-hover');
10391						$tmb.addClass('drop-active');
10392						$drop_move.addClass('active');
10393						manageVideos($drop_move, true);
10394						clientX = e.changedTouches[0].clientX;
10395						clientY = e.changedTouches[0].clientY;
10396
10397						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10398							var bound = $anim_parent[0].getBoundingClientRect();
10399							clientX = clientX - bound.x;
10400							clientY = clientY - bound.y;
10401						}
10402
10403						$drop_move.css({
10404							left: clientX,
10405							top: clientY
10406						});
10407					});
10408				});
10409
10410			}
10411
10412			$tmbs.each(function(e){
10413				var $tmb = $(this),
10414					// $trgr = $('a', $tmb),
10415					$trgr = $tmb,
10416					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
10417					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
10417(.t-inside), .parallax-el'),
10418					$video = $('video', $tmb),
10419					$iframe = $('iframe', $tmb),
10420					$entryTxt = $('.t-entry-text', $tmb),
10421					stopBounding;
10422
10423				$entryTxt.add($drop_move).css({
10424					'transition-duration': timing + 's'
10425				});
10426
10427				if ( $video.length ) {
10428					var vidH = $video[0].videoHeight,
10429						vidW = $video[0].videoWidth;
10430					$video.css({
10431						'height': vidH,
10432						'width': vidW
10433					});
10434				}
10435
10436				if ( $iframe.length ) {
10437					var vidH = $drop_move.attr('data-height'),
10438						vidW = $drop_move.attr('data-width');
10439					$iframe.css({
10440						'height': vidH,
10441						'width': vidW
10442					});
10443				}
10444
10445				$iframe.each(function(){
10446					var $video = $(this),
10447						vidH = $video[0].videoHeight,
10448						vidW = $video[0].videoWidth;
10449					$video.css({
10450						'height': vidH,
10451						'width': vidW
10452					});
10453				});
10454
10455				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10456					$trgr.on('mouseenter',function(e){
10457						$list.addClass('drop-hover');
10458						$tmbs.removeClass('drop-active');
10459						$tmb.addClass('drop-active');
10460						$drop_move.addClass('active');
10461						manageVideos($drop_move, true);
10462
10463						var clientX = e.clientX,
10464							clientY = e.clientY;
10465						$drop_move.css({
10466							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
10467						});
10468
10469					})
10470					.on('mouseleave', function(e){
10471						$list.removeClass('drop-hover');
10472						$drop_move.css({
10473							'transition-duration': ( timing*1.25 ) + 's'
10474						});
10475						$drop_move.removeClass('active');
10476						$tmb.removeClass('drop-active');
10477						$drop_move.on('transitionend', function(e){
10478							$drop_move.off('transitionend');
10479							$drop_move.css({
10480								'transition-duration': timing + 's'
10481							});
10482							manageVideos($drop_move,false);
10483						});
10484					});
10485
10486					document.addEventListener('visibilitychange', function(){
10487						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
10488							$drop_move.css({
10489								'transition-duration': '0s'
10490							});
10491							$drop_move.removeClass('active');
10492							manageVideos($drop_move, false);
10493						}
10494					});
10495
10496					document.addEventListener('scroll', function(){
10497						window.clearRequestTimeout( stopBounding );
10498
10499						if ( $drop_move.hasClass('active') ) {
10500							$list.removeClass('drop-hover');
10501							$tmbs.removeClass('drop-active');
10502							$drop_move.removeClass('active');
10503							$drop_move.on('transitionend', function(e){
10504								$drop_move.off('transitionend');
10505								$drop_move.css({
10506									'transition-duration': timing + 's'
10507								});
10508								manageVideos($drop_move,false);
10509							});
10510						}
10511
10512						stopBounding = requestTimeout(function() {
10513							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10514								var bound = $anim_parent[0].getBoundingClientRect();
10515								$drop_move.css({
10516									left: bound.x * -1,
10517									top: bound.y * -1,
10518								});
10519							}
10520						}, 200);
10521
10522					});
10523				}
10524
10525				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
10526					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
10527
10528				$drop.css({
10529					'transition-duration': timing + 's'
10530				});
10531
10532				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
10533					$trgr.on('mouseenter',function(e){
10534						$row_parent.add($col_parent).addClass('drop-list-loaded');
10535						$list.addClass('drop-hover');
10536
10537						if ( !$tmb.hasClass('drop-active') ) {
10538							$tmbs.removeClass('drop-active');
10539							$tmb.addClass('drop-active');
10540							if ( default_image && !$drop.hasClass('active') ) {
10541								var $prev = $('[data-drop].active', $row_parent);
10542								$prev.css({
10543									'transition-duration': (timing*1.5) + 's'
10544								});
10545								$prev.removeClass('active');
10546								$prev.on('transitionend', function(e){
10547									$prev.off('transitionend');
10548									manageVideos($prev,false);
10549								});
10550							}
10551							$drop.css({
10552								'transition-duration': timing + 's'
10553							});
10554							$drop.off('transitionend');
10555							$drop.addClass('active');
10556							manageVideos($drop, true);
10557						}
10558					})
10559					.on('mouseleave', function(e){
10560						if ( ( default_image && !default_title ) || !default_image ) {
10561							$list.removeClass('drop-hover');
10562							$tmb.removeClass('drop-active');
10563						}
10564						if ( ! default_image ) {
10565							$drop.css({
10566								'transition-duration': (timing*1.5) + 's'
10567							});
10568							$drop.removeClass('active');
10569
10570							$drop.on('transitionend', function(e){
10571								$drop.off('transitionend');
10572								manageVideos($drop,false);
10573							});
10574						}
10575					});
10576
10577					document.addEventListener('visibilitychange', function(){
10578						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
10579							$drop.css({
10580								'transition-duration': '0s'
10581							});
10582							$drop.removeClass('active');
10583							manageVideos($drop, false);
10584						}
10585					});
10586				}
10587			});
10588
10589		});
10590	};
10591
10592	$(window).on('load', function(event) {
10593		imageHover();
10594	});
10595
10596	var drop_wp_animation = function() {
10597		var $postLists = $('.uncode-post-titles');
10598		$postLists.each(function(){
10599			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10600				new Waypoint({
10601					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10602					element: val,
10603					handler: function() {
10604						var element = $(this.element),
10605							parent = element.closest('.tmb'),
10606							currentIndex = parent.index(),
10607							delay = currentIndex,
10608							delayAttr = parseInt(element.attr('data-delay'));
10609						if (isNaN(delayAttr)) delayAttr = 100;
10610						var objTimeout = requestTimeout(function() {
10611							element.addClass('start_animation');
10612
10613							var nextTimeout = requestTimeout(function() {
10614								$('.drop-image-separator', parent).addClass('start_animation');
10615							}, 50);
10616
10617						}, delay * delayAttr);
10618						if (!UNCODE.isUnmodalOpen) {
10619							this.destroy();
10620						}
10621					},
10622					offset: UNCODE.isFullPage ? '100%' : '90%'
10623				})
10624			});
10625		});
10626	}
10627
10628	var runWaypoints_TO,
10629		runWaypoints_delay = 0;
10630
10631	var runWaypoints = function(){
10632		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10633			runWaypoints_delay = 400;
10634		}
10635		clearRequestTimeout(runWaypoints_TO);
10636		runWaypoints_TO = requestTimeout(function() {
10637			drop_wp_animation();
10638		}, runWaypoints_delay);
10639	};
10640	runWaypoints();
10641	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10642	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10643		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10644			// imageHover();
10645			runWaypoints();
10646		});
10647	}
10648};
10649
10650UNCODE.postTable = function() {
10651
10652	var clickRow = function(){
10653		var $postLists = $('.uncode-post-table');
10654
10655		$postLists.each(function(){
10656			var $postList = $(this),
10657				$tmbClicks = $('.tmb.tmb-click-row', $postList);
10658
10659			$tmbClicks.each(function(){
10660				var $tmb = $(this),
10661					$click = $('.table-click-row', $tmb);
10662				$('*:not(.table-click-row)', $tmb).on('click', function(e){
10663					e.preventDefault();
10664					e.stopPropagation();
10665					$click[0].click();
10666					return false;
10667				});
10668			});
10669
10670		})
10671	};
10672
10673	clickRow();
10674
10675	var hoverRow = function(){
10676		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
10677
10678		$postLists.on('mouseenter', function(){
10679			$(this).addClass('post-table-hover');
10680		});
10681		$postLists.on('mouseleave', function(){
10682			$(this).removeClass('post-table-hover');
10683		});
10684	}
10685
10686	hoverRow();
10687
10688	var drop_wp_animation = function() {
10689		var $postLists = $('.uncode-post-table');
10690		$postLists.each(function(){
10691			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10692				new Waypoint({
10693					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10694					element: val,
10695					handler: function() {
10696						var element = $(this.element),
10697							parent = element.closest('.tmb'),
10698							currentIndex = parent.index(),
10699							delay = currentIndex,
10700							delayAttr = parseInt(element.attr('data-delay'));
10701						if (isNaN(delayAttr)) delayAttr = 100;
10702						var objTimeout = requestTimeout(function() {
10703							element.addClass('start_animation');
10704						}, delay * delayAttr);
10705						if (!UNCODE.isUnmodalOpen) {
10706							this.destroy();
10707						}
10708					},
10709					offset: UNCODE.isFullPage ? '100%' : '90%'
10710				})
10711			});
10712		});
10713	}
10714
10715	var runWaypoints_TO,
10716		runWaypoints_delay = 0;
10717
10718	var runWaypoints = function(){
10719		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10720			runWaypoints_delay = 400;
10721		}
10722		clearRequestTimeout(runWaypoints_TO);
10723		runWaypoints_TO = requestTimeout(function() {
10724			drop_wp_animation();
10725		}, runWaypoints_delay);
10726	};
10727	runWaypoints();
10728	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10729	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10730		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10731			runWaypoints();
10732			// clickRow();
10733		});
10734	}
10735};
10736
10737UNCODE.rotatingTxt = function($ctxt) {
10738
10739	if ( $('body').hasClass('compose-mode') ) {
10740		return;
10741	}
10742
10743	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
10744	var setCTA;
10745
10746	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
10747		var $heading = $(this),
10748			// debug = 0,
10749			cycle = 0,
10750			$trgt,
10751			$toMove,
10752			$highl,
10753			$col = $heading.closest('.uncont'),
10754			txt,
10755			arrTxt,
10756			textFadeIn, textFadeOut,
10757			removeWraps;
10758
10759		var defineObjs = function() {
10760			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
10761				var $rtx = $(this),
10762					fx = $rtx.attr('data-fx'),
10763					wait = $rtx.attr('data-wait'),
10764					$prev = $(this).prev().addClass('prev-rotating-start'),
10765					splitToMove = [],
10766					splitArray = [],
10767					lineArray = [],
10768					lineIndex = 0,
10769					lineStart = true,
10770					lineEnd = false,
10771					startSplit = false,
10772					$line_wrap = $rtx.closest('.heading-line-wrap'),
10773					same_line = true,
10774					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
10775					indexRtx = $splits.index($rtx);
10776
10777				fx = typeof fx === 'undefined' ? '' : fx;
10778				wait = typeof wait === 'undefined' ? '' : wait;
10779
10780				$splits.each(function(key, val){
10781					var $split = $(this),
10782						$new_line_wrap = $split.closest('.heading-line-wrap');
10783
10784					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
10785						splitArray.push( $split );
10786					}
10787
10788					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10789						startSplit = false;
10790					}
10791
10792					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10793						splitArray.push( $split );
10794
10795						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
10796							same_line = true;
10797						} else {
10798							same_line = false;
10799						}
10800					}
10801
10802					if ( key == indexRtx ) {
10803						if ( /\S/.test($split.text()) ) {
10804							startSplit = true;
10805							$line_wrap = $split.closest('.heading-line-wrap');
10806							splitArray.push( $split );
10807						} else {
10808							indexRtx++;
10809						}
10810					}
10811
10812					$line_wrap = $new_line_wrap;
10813				});
10814
10815				$toMove = $($.map(splitToMove, function(el){return el.get();}));
10816				$trgt = $($.map(splitArray, function(el){return el.get();}));
10817
10818				if ( same_line ) {
10819					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
10820					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
10821				}
10822
10823				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
10824					$prev.addClass('empty-span-hidden');
10825				}
10826
10827				$highl = $('.heading-text-highlight-inner', $trgt);
10828
10829				$rtx.attr('data-animated', 'true');
10830				if ( cycle == 0 ) {
10831					$( document.body ).trigger('defer-highlights');
10832					cycle++;
10833					defineObjs();
10834					return;
10835				}
10836				cycle++;
10837
10838				txt = $rtx.attr('data-text');
10839				arrTxt = txt.split("|");
10840
10841				textFadeOut($trgt);
10842
10843			});
10844		};
10845
10846		removeWraps = function(){
10847
10848			// if ( debug == 1 ) return;
10849			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
10850			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
10851
10852
10853				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
10854					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
10855
10856				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
10857
10858				$splitFlow.each(function(){
10859					$(this).append($temp_highl);
10860				});
10861
10862				var $line_wrap = $wraps[wrap_k];
10863				var $parent_wrap = $line_wrap.parentNode;
10864				if ( $parent_wrap !== null ) {
10865					while ( $line_wrap.firstChild ) {
10866						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
10867					}
10868					$parent_wrap.removeChild($line_wrap);
10869				}
10870			}
10871			// debug++;
10872			defineObjs();
10873		};
10874
10875		var loop = 0;
10876		textFadeIn = function($trgt){
10877			var word = arrTxt[loop].split(" "),
10878				worsSpan = '',
10879				$wrap = $trgt.closest('.uncode-rotating-wrap'),
10880				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
10881				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
10882
10883			for (var w = 0; w < word.length; w++) {
10884				var highl;
10885				if ( $highl.length ) {
10886					highl = $highl[0].outerHTML;
10887				} else {
10888					highl = '';
10889				}
10890
10891				if ( w > 0 ) {
10892					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
10893				}
10894				var charachters = word[w].split('');
10895				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
10896				for (var c = 0; c < charachters.length; c++) {
10897					worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
10898				}
10899				worsSpan += '</span>' + highl + '</span></span>';
10900			}
10901
10902			if ( $wrap.length && $wrap_inner.length ) {
10903				var words_w = $wrap_inner.outerWidth();
10904				$wrap.css({
10905					width: words_w
10906				});
10907
10908				$highl = $('.heading-text-highlight-inner', $wrap);
10909				$highl.prependTo($wrap);
10910
10911				$wrap_inner.css({
10912					opacity: 0
10913				});
10914
10915				$wrap_inner.html(worsSpan);
10916				$('.heading-text-highlight-inner', $wrap_inner).remove();
10917				words_w = $wrap_inner.innerWidth();
10918
10919				var duration = 0.45;
10920
10921				$heading.removeClass('auto-width');
10922				if ( words_w > $col.width() ) {
10923					$heading.addClass('auto-width');
10924					words_w = 'auto';
10925					duration = 0;
10926				}
10927
10928				$wrap.css({
10929					'width': words_w,
10930					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
10931				});
10932
10933				var $word_inner = $('.split-word-inner', $wrap_inner),
10934					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
10935
10936				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
10937
10938				if ( !$target_fx.length ) {
10939					return;
10940				}
10941
10942				gsap.killTweensOf($target_fx);
10943
10944				if ( fx !== 'zoom' ) {
10945					gsap.fromTo( $target_fx, {
10946						y: fx === 'opacity' ? '0%' : '-10%'
10947					},{
10948						delay: duration,
10949						duration: 0.25,
10950						y: '0%',
10951						ease: Circ.easeOut,
10952					});
10953
10954					if ( !$wrap_inner.length ) {
10955						return;
10956					}
10957
10958					gsap.fromTo( $wrap_inner, {
10959						opacity: 0,
10960					},{
10961						delay: duration,
10962						duration: 0.25,
10963						opacity: 1,
10964						ease: Circ.easeOut,
10965						onComplete: function(){
10966							$('> .heading-text-highlight-inner', $wrap).remove();
10967							$wrap_inner.html(worsSpan);
10968							removeWraps();
10969						}
10970					})
10971
10972				} else {
10973					gsap.fromTo( $target_fx, {
10974						transformOrigin: '50%',
10975						opacity: 0,
10976						scale: 0.875,
10977					},{
10978						opacity: 1,
10979						delay: duration,
10980						duration: 0.25,
10981						scale: 1,
10982						ease: Circ.easeOut,
10983						onComplete: function(){
10984							$('> .heading-text-highlight-inner', $wrap).remove();
10985							$wrap_inner.html(worsSpan);
10986							removeWraps();
10987						}
10988					});
10989				}
10990
10991			} else {
10992
10993				if ( !$wrap_inner.length ) {
10994					return;
10995				}
10996
10997				gsap.to( $wrap_inner, {
10998					duration: 0.4,
10999					opacity: 0,
11000					ease: Power1.easeOut,
11001					onComplete: function(){
11002						$wrap_inner.html(worsSpan);
11003						words_w = $wrap_inner.innerWidth();
11004
11005						gsap.to( $wrap_inner, {
11006							duration: 0.2,
11007							opacity: 1,
11008							ease: Power1.easeOut,
11009							onComplete: function(){
11010								$('> .heading-text-highlight-inner', $wrap).remove();
11011								$wrap_inner.html(worsSpan);
11012								removeWraps();
11013							}
11014						})
11015					}
11016				});
11017			}
11018
11019			if ( loop < arrTxt.length-1 ) {
11020				loop++;
11021			} else {
11022				loop = 0;
11023			}
11024
11025		};
11026
11027		textFadeOut = function($trgt){
11028			var $word_inner = $('.split-word-inner', $trgt),
11029				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11030				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11031				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
11032				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
11033
11034			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
11035
11036			var gsap_param = {
11037					delay: wait,
11038					duration: 0.25,
11039					y: fx === '' ? '10%' : '0%',
11040					opacity: 0,
11041					ease: Circ.easeOut,
11042					onStart: function(){
11043						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
11044							$highl = $('.heading-text-highlight-inner', $wrap);
11045							$highl.prependTo($wrap);
11046						}
11047					},
11048					onComplete: textFadeIn,
11049					onCompleteParams: [$trgt]
11050				};
11051
11052			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11053
11054			if ( fx === '' ) {
11055				gsap_param.y = '10%';
11056			} else if ( fx === 'zoom' ) {
11057				gsap_param.scale = '1.045';
11058			}
11059
11060			if ( !$target_fx.length ) {
11061				return;
11062			}
11063
11064			if ( $heading.data('waypoint') !== true ) {
11065				var textInView = new Waypoint.Inview({
11066					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11067					element: $heading[0],
11068					enter: function(direction) {
11069						$heading.data('waypoint',true);
11070						gsap.fromTo( $target_fx, {
11071							transformOrigin: '50%'
11072						}, gsap_param );
11073					}
11074				});
11075			} else {
11076				gsap.fromTo( $target_fx, {
11077					transformOrigin: '50%'
11078				}, gsap_param );
11079			}
11080		};
11081
11082		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11083			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
11084				var $el = model.view.$el,
11085					shortcode = model.attributes.shortcode;
11086
11087				UNCODE.rotatingTxt($el);
11088			});
11089		} else {
11090			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
11091				$heading.on('already-animated', function(){
11092					removeWraps();
11093					window.addEventListener('removeOldLines', function(){
11094						clearRequestTimeout(setCTA);
11095						setCTA = requestTimeout( removeWraps, 150 );
11096					});
11097				});
11098			} else {
11099				$(window).on('load', function(){
11100					removeWraps();
11101					window.addEventListener('removeOldLines', function(){
11102						clearRequestTimeout(setCTA);
11103						setCTA = requestTimeout( removeWraps, 150 );
11104					});
11105				});
11106			}
11107		}
11108	});
11109
11110};
11111
11112UNCODE.verticalText = function() {
11113	$(window).on('menuCanvasOpen', function(){
11114		$('.vertical-text--fixed').fadeOut(500);
11115		$('.horizontal-text--fixed').fadeOut(500);
11116	}).on('menuCanvasClose', function(){
11117		$('.vertical-text--fixed').fadeIn(500);
11118		$('.horizontal-text--fixed').fadeIn(500);
11119	});
11120
11121	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
11122	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
11123	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
11124	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
11125
11126	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
11127		window.addEventListener('scroll', function(e) {
11128			var totalPageHeight = document.body.scrollHeight;
11129			var scrollPoint = window.scrollY + window.innerHeight;
11130
11131			if (window.scrollY > 0) {
11132				showOnTopVerticalTexts.fadeOut();
11133				showOnTopHorizontalTexts.fadeOut();
11134			} else {
11135				showOnTopVerticalTexts.fadeIn();
11136				showOnTopHorizontalTexts.fadeIn();
11137			}
11138
11139			if (scrollPoint >= totalPageHeight) {
11140				hideOnBottomVerticalTexts.fadeOut();
11141				hideOnBottomHorizontalTexts.fadeOut();
11142			} else {
11143				hideOnBottomVerticalTexts.fadeIn();
11144				hideOnBottomHorizontalTexts.fadeIn();
11145			}
11146		}, false);
11147	}
11148};
11149
11150UNCODE.stickyScroll = function( $el ) {
11151	if ( typeof $el === 'undefined' || $el === null ) {
11152		$el = $('body');
11153	}
11154	var checkVisible = function( el, dir ) {
11155		if (typeof jQuery === "function" && el instanceof jQuery) {
11156			el = el[0];
11157		}
11158
11159		var off = 50;
11160		dir = typeof dir=='undefined' ? 'right' : dir;
11161		var rect = el.getBoundingClientRect();
11162
11163		return (
11164			(
11165				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11166				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11167				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
11168			) &&
11169			(
11170				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11171				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11172				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
11173				( rect.right <= window.innerWidth && rect.left >= 0 )
11174			)
11175		);
11176	};
11177
11178	var setItemsRelHeight = function(reset) {
11179		var $_el = $el;
11180		if ( $el.is('.index-scroll') ) {
11181			var $_el = $el.closest('.uncont');
11182		}
11183		$('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
11184			$.each($('.tmb', item), function(index, val) {
11185				if ( reset === true ) {
11186					$(val).css( 'visibility', 'hidden' );
11187				} else {
11188					$(val).css( 'visibility', 'visible' );
11189				}
11190			});
11191		});
11192		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
11193			$.each($('.tmb', item), function(index, val) {
11194				if ( reset === true ) {
11195					$(val).css( 'visibility', 'hidden' );
11196					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
11197				} else {
11198					var $rowParent = $(item).closest('.row-parent'),
11199						rowRatio = $rowParent.attr('data-height-ratio'),
11200						$rowInner = $(item).closest('.row-child'),
11201						rowRatioInner = $rowInner.attr('data-height'),
11202						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11203						$colContainer = $(item).closest('.uncell'),
11204						$uncont = $(item).closest('.uncont'),
11205						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
11206						safe_heigth = $(item).data('safe-height'),
11207						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
11208						offSet = $(item).offset().top - $uncont.offset().top,
11209						multiplier_h,
11210						data_viewport_h,
11211						body_border = $('.body-borders .top-border').outerHeight() * 2,
11212						remove_menu = $(item).data('vp-menu');
11213
11214					if ( rowRatio === 'full' || rowRatio === '' ) {
11215						rowRatio = 1;
11216					} else {
11217						rowRatio = rowRatio / 100;
11218					}
11219
11220					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
11221						rowRatio = rowRatio;
11222					} else {
11223						rowRatio = rowRatio * rowRatioInner / 100;
11224					}
11225
11226					winHeight = winHeight * rowRatio;
11227
11228					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11229						multiplier_h = parseInt($(item).attr('data-vp-height'));
11230					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
11231						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
11232					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
11233						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
11234					}
11235
11236					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
11237						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
11238						if ( remove_menu === true ) {
11239							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
11240						}
11241						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
11242					} else {
11243						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
11244					}
11245
11246				}
11247			});
11248		});
11249		$('.index-scroll', $_el).each(function(i, item){
11250			var $uncoltable = $(item).closest('.uncoltable'),
11251				$rowParent = $(item).closest('.row-parent'),
11252				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11253				body_border = $('.body-borders .top-border').outerHeight() * 2,
11254				$index_row = $('.index-row', item),
11255				safe_heigth = $index_row.data('safe-height'),
11256				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
11257			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
11258				var data_viewport_h = winHeight - ( paddingRow + body_border );
11259				$uncoltable.css({
11260					'min-height': data_viewport_h
11261				});
11262			} else {
11263				$uncoltable.css({
11264					'min-height': 'auto'
11265				});
11266			}
11267		});
11268
11269	}
11270	setItemsRelHeight();
11271
11272	var $index_scrolls = $('.index-scroll', $el);
11273
11274	$index_scrolls.each(function(key, value){
11275		var $index = $(this),
11276			$parent_row = $index.closest('.vc_row[data-parent]'),
11277			$index_row = $('.index-row', $index),
11278			dir = $index_row.attr('data-direction');
11279		dir = typeof dir === 'undefined' ? 'right' : dir;
11280
11281		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
11282	});
11283
11284	var $horScrolls = $('.unscroll-horizontal', $el);
11285
11286	if ( $horScrolls.length ) {
11287
11288		$('body').addClass('scrolling-trigger');
11289
11290		$horScrolls.each(function(key, value){
11291			var $section = $(this),
11292				$index_scroll = $('.index-scroll', $section),
11293				$index_row = $('.index-row', $index_scroll),
11294				dir = $section.attr('data-direction'),
11295				wrap = $index_row.attr('data-wrap'),
11296				$pinWrap,
11297				$pinTrigger;
11298
11299			dir = typeof dir === 'undefined' ? 'right' : dir;
11300			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
11301			$pinWrap = $('<div class="pin-wrap" />');
11302			if ( SiteParameters.is_frontend_editor ) {
11303				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
11304				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
11305			} else {
11306				if ( wrap === 'column' ) {
11307					$index_scroll.wrapInner( $pinWrap );
11308				} else {
11309					$('> .row', $section).wrap( $pinWrap );
11310				}
11311				$section.wrapInner( $pinTrigger );
11312			}
11313
11314		});
11315
11316		var $pinWraps = $('.pin-wrap', $el);
11317
11318		var horScrollSizes = function(){
11319
11320			$pinWraps.each(function(key, val){
11321				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
11322					$pinTrigger = $pinWrap.closest('.pin-trigger'),
11323					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
11324					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
11325					$boxContainer = $('.box-container'),
11326					box_m = $boxContainer.css('margin-left'),
11327					st_active = true;
11328
11329				var setHorW,
11330				horWidth = function(){
11331					$index_scroll.each(function(){
11332						var $this = $(this),
11333							$index_row = $('.index-row', $this),
11334							$rowContainer = $index_row.closest('.vc_row'),
11335							$rowInner = $index_row.closest('.wpb_row'),
11336							$rowParent = $index_row.closest('.row-parent'),
11337							$tmbs = $('.tmb', $index_row),
11338							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
11339							$uncont = $index_row.closest('.uncont'),
11340							$parent_col = $index_row.closest('.wpb_column'),
11341							col_w = $uncont.width(),
11342							data_lg = parseFloat( $index_row.attr('data-lg') ),
11343							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
11344							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
11345							tmb_w;
11346
11347						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
11348						tmb_w = ( col_w + padding_tmb ) / data_lg;
11349
11350						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
11351							tmb_w = ( col_w + padding_tmb ) / data_sm;
11352						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
11353							tmb_w = ( col_w + padding_tmb ) / data_md;
11354						}
11355
11356						if ( !isNaN(tmb_w) ) {
11357							$tmbs.css({
11358								'width': tmb_w
11359							});
11360						}
11361
11362						$tmbs.css({
11363							'visibility': 'visible'
11364						});
11365
11366					});
11367				};
11368
11369				horWidth();
11370				clearRequestTimeout(setHorW);
11371				setHorW = requestTimeout( function(){
11372					setItemsRelHeight();
11373					horWidth();
11374				}, 100 );
11375
11376				if ( SiteParameters.is_frontend_editor ) {
11377					return;
11378				}
11379
11380				var $vmenu = $('body.vmenu .vmenu-container'),
11381					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
11382					winWidth = window.innerWidth - vmenuW,
11383					$tmb = $('.tmb', $index_scroll).eq(0),
11384					paddingRight = parseFloat( $tmb.css('padding-right') ),
11385					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ),
11386					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
11387					scroll_anim;
11388
11389				if ( $('body').hasClass('rtl') ) {
11390					if ( dir === 'left' ) {
11391						scroll_anim = gsap.fromTo( $pinWrap, {
11392							x: stickyScrollLength
11393						},{
11394							x: 0,
11395							ease: "none"
11396						});
11397					} else {
11398						scroll_anim = gsap.fromTo( $pinWrap, {
11399							x: 0
11400						},{
11401							x: stickyScrollLength,
11402							ease: "none"
11403						});
11404					}
11405				} else {
11406					if ( dir === 'left' ) {
11407						scroll_anim = gsap.fromTo( $pinWrap, {
11408							x: -stickyScrollLength
11409						},{
11410							x: 0,
11411							ease: "none"
11412						});
11413					} else {
11414						scroll_anim = gsap.fromTo( $pinWrap, {
11415							x: 0
11416						},{
11417							x: -stickyScrollLength,
11418							ease: "none"
11419						});
11420					}
11421				}
11422
11423				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
11424					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
11425				}
11426
11427				var animationIncrease;
11428
11429				var checkForAnimations = function(){
11430					animationIncrease = 0
11431					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11432						var _this = this,
11433							isScrolling;
11434						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
11435							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11436							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11437							requestTimeout(function() {
11438								$(_this).addClass('start_animation');
11439							}, delayAttr + animationIncrease);
11440							animationIncrease += 150;
11441						}
11442					});
11443				};
11444				checkForAnimations();
11445
11446				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
11447				var start = 0;
11448
11449				var horST = ScrollTrigger.create({
11450					id: "stickySectionScrolling" + key,
11451					scrub: true,
11452					trigger: $pinTrigger[0],
11453					pin: true,
11454					anticipatePin: 1,
11455					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
11456					end: function() { return "+="+stickyScrollLength; },
11457					animation: scroll_anim,
11458					ease: Sine.easeOut,
11459					onUpdate: checkForAnimations,
11460					invalidateOnRefresh: true,
11461					onEnter: function(){
11462						$pinTrigger.addClass('enter-st');
11463					},
11464					onEnterBack: function(){
11465						$pinTrigger.addClass('enter-st');
11466					},
11467					onLeave: function(){
11468						$pinTrigger.removeClass('enter-st');
11469					},
11470					onLeaveBack: function(){
11471						$pinTrigger.removeClass('enter-st');
11472					}
11473				});
11474
11475				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
11476				window.dispatchEvent(new CustomEvent('boxResized'));
11477
11478				var testSecondTrigger = function(){
11479					animationIncrease = 0
11480					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11481						var _this = this;
11482						if ( checkVisible(_this) ) {
11483							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11484							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11485							requestTimeout(function() {
11486								$(_this).addClass('start_animation');
11487							}, delayAttr + animationIncrease);
11488							animationIncrease += 150;
11489						}
11490					});
11491
11492				};
11493
11494				var verST = ScrollTrigger.create({
11495					id: "verticalSectionScrolling" + key,
11496					trigger: $pinTrigger[0],
11497					start: "top center",
11498					end: function() { return "+="+UNCODE.wheight; },
11499					onUpdate: testSecondTrigger,
11500					invalidateOnRefresh: true
11501				});
11502
11503				var setCTA,
11504
11505				dis_enable_ST = function(){
11506					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
11507						horST.kill();
11508						verST.kill();
11509						$pinTrigger.addClass('disabled');
11510						st_active = false;
11511					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
11512						horST.kill();
11513						verST.kill();
11514						$pinTrigger.addClass('disabled');
11515						st_active = false;
11516					}
11517				};
11518
11519				$(window).on('resize load', function() {
11520					clearRequestTimeout(setCTA);
11521					setCTA = requestTimeout(function() {
11522						dis_enable_ST();
11523						checkForAnimations();
11524					}, 500);
11525				});
11526
11527			});
11528		};
11529
11530		$(window).on( 'load', function(){
11531			horScrollSizes();
11532		});
11533		var setResize,
11534			setReLayout,
11535			doubleResize = true,
11536			oldW = UNCODE.wwidth,
11537			isResized = true;
11538		$(window).on( 'load', function(){
11539			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
11540				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11541				Array.prototype.forEach.call($row_inners, function(el) {
11542					el.style.height = '';
11543					el.style.marginBottom = '';
11544				});
11545				setItemsRelHeight();
11546				horScrollSizes();
11547				ScrollTrigger.refresh();
11548			}
11549			var carousel = document.querySelector(".owl-carousel"),
11550				grid = document.querySelector(".isotope-container"),
11551				stickyAll = document.querySelectorAll(".index-scroll");
11552
11553			if ( stickyAll.length ) {
11554				var sticky = stickyAll[(stickyAll.length-1)];
11555			}
11556
11557			if ( typeof sticky !== "undefined" ) {
11558
11559				if ( typeof carousel !== "undefined" && carousel !== null ) {
11560					var carousel_position = sticky.compareDocumentPosition(carousel);
11561				}
11562				if ( typeof grid !== "undefined" && grid !== null ) {
11563					var grid_position = sticky.compareDocumentPosition(grid);
11564				}
11565
11566				if ( carousel_position === 2 || grid_position === 2 ) {
11567					setTimeout(function(){
11568						ScrollTrigger.refresh();
11569					}, 500);
11570				}
11571
11572			}
11573			
11574		});
11575		$(window).on( 'resize orientationchange', function(){
11576			isResized = (oldW !== UNCODE.wwidth);
11577			if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) {
11578				return;
11579			} else {
11580				oldW = UNCODE.wwidth;
11581			}
11582			setItemsRelHeight(true);
11583			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11584			Array.prototype.forEach.call($row_inners, function(el) {
11585				el.style.height = '';
11586				el.style.marginBottom = '';
11587			});
11588			clearRequestTimeout(setResize);
11589			setResize = requestTimeout( function(){
11590				setItemsRelHeight();
11591				horScrollSizes();
11592				ScrollTrigger.refresh();
11593				if ( doubleResize === true ) {
11594					window.dispatchEvent(new Event('resize'));
11595					doubleResize = false;
11596				} else {
11597					doubleResize = true;
11598				}
11599				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, isResized);
11600			}, 100 );
11601		});
11602
11603		var show_pins = function(){
11604			$('.index-scroll').css({'opacity':'1'});
11605		};
11606		ScrollTrigger.addEventListener("refresh", show_pins);
11607		$(window).on( 'uncode.re-layout', function(){
11608			//$('.index-scroll').css({'opacity':'0'});
11609			$('.pin-spacer').each(function(){
11610				var space_h = $(this).outerHeight(),
11611					$row = $(this).closest('.row-container');
11612				$row.css({
11613					'height': space_h,
11614					'overflow': 'hidden'
11615				});
11616			});
11617			ScrollTrigger.refresh(true);
11618			clearRequestTimeout(setReLayout);
11619			setReLayout = requestTimeout( function(){
11620				$('.row-container').each(function(){
11621					$(this).css({
11622						'height': '',
11623						'overflow': ''
11624					});
11625				});
11626			}, 1000);
11627		});
11628	}
11629
11630};
11631
11632UNCODE.stickyTrigger = function( $el ) {
11633	if ( SiteParameters.is_frontend_editor ) {
11634		return false;
11635	}
11636
11637	var stickyTrigger = function(){
11638		var stickyTrick = $('.sticky-trigger').each(function(){
11639			var $sticky = $(this),
11640				$inside = $('> div', $sticky),
11641				insideH = $inside.outerHeight(),
11642				$row = $sticky.closest('.vc_row'),
11643				$uncont = $sticky.closest('.uncont'),
11644				rowBottom,
11645				uncontBottom ,
11646				diffBottom;
11647
11648			ScrollTrigger.create({
11649				trigger: $sticky,
11650				start: function(){ return "top center-=" + insideH/2; },
11651				endTrigger: $row,
11652				end:  function(){
11653					rowBottom = $row.offset().top + $row.outerHeight();
11654					uncontBottom = $uncont.offset().top + $uncont.outerHeight();
11655					diffBottom = rowBottom - uncontBottom;
11656					return "bottom center+=" + ( insideH/2 + diffBottom );
11657				},
11658				anticipatePin: true,
11659				pin: true,
11660				pinSpacing: false,
11661				scrub: true,
11662				invalidateOnRefresh: true,
11663			});
11664
11665		});
11666	},
11667	setResizeSticky;
11668
11669	$(window).on( 'load', function(){
11670		stickyTrigger();
11671		var carousel = document.querySelector(".owl-carousel"),
11672			grid = document.querySelector(".isotope-container"),
11673			stickyAll = document.querySelectorAll(".sticky-trigger");
11674
11675		if ( stickyAll.length ) {
11676			var sticky = stickyAll[(stickyAll.length-1)];
11677		}
11678
11679		if ( typeof sticky !== "undefined" ) {
11680
11681			if ( typeof carousel !== "undefined" && carousel !== null ) {
11682				var carousel_position = sticky.compareDocumentPosition(carousel);
11683			}
11684			if ( typeof grid !== "undefined" && grid !== null ) {
11685				var grid_position = sticky.compareDocumentPosition(grid);
11686			}
11687
11688			if ( carousel_position === 2 || grid_position === 2 ) {
11689				setTimeout(function(){
11690					ScrollTrigger.refresh();
11691				}, 500);
11692			}
11693
11694		}
11695	});
11696
11697	var oldW = UNCODE.wwidth;
11698	$(window).on( 'resize uncode.re-layout', function(e){
11699		clearRequestTimeout(setResizeSticky);
11700		if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
11701			return;
11702		} else {
11703			oldW = UNCODE.wwidth;
11704		}
11705		setResizeSticky = requestTimeout( function(){
11706			stickyTrigger();
11707			ScrollTrigger.refresh();
11708		}, 1000 );
11709	});
11710
11711};
11712
11713UNCODE.revslider = function() {
11714	var revSliderIn = function(){
11715		$('rs-module').each(function(){
11716			var $slider = $(this);
11717
11718			$slider.on('revolution.slide.onloaded', function(e, data){
11719				if ( $(e.currentTarget).closest(".header-revslider").length ) {
11720					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
11721						scrolltop = $(document).scrollTop();
11722					if ( style != undefined ) {
11723						UNCODE.switchColorsMenu(scrolltop, style);
11724					}
11725				}
11726			});
11727
11728			$slider.on('revolution.slide.onchange', function(e, data){
11729				if ( $(e.currentTarget).closest(".header-revslider").length ) {
11730					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
11731						scrolltop = $(document).scrollTop();
11732					if ( style != undefined ) {
11733						UNCODE.switchColorsMenu(scrolltop, style);
11734					}
11735				}
11736			});
11737
11738		});
11739	};
11740	revSliderIn();
11741	$(window).on("load", revSliderIn );
11742};
11743UNCODE.layerslider = function() {
11744	$(window).on("load", function() {
11745
11746		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
11747
11748			var slideData = slider.slides.current.data,
11749				scrolltop = $(document).scrollTop();
11750			if( slideData && slideData.skin ) {
11751
11752				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
11753
11754			}
11755		});
11756
11757	});
11758};
11759
11760UNCODE.ajax_filters = function () {
11761	var isAjaxing = false;
11762
11763/*************************
11764 *
11765 * Filters Menu and Widgets Area
11766 *
11767 ************************/
11768
11769 	var clear_clicked = false;
11770
11771 	var init_ajax_grid = function(){
11772
11773		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
11774		$grids.each(function(index, val){
11775			var $body = $('body'),
11776				$grid = $(val).addClass('init-ajax-grid'),
11777				starting_point = $grid.attr('data-toggle'),
11778				$trigger = $('.uncode-toggle-ajax-filters', $grid),
11779				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
11780				$isotope_wrapper = $('.isotope-wrapper', $grid),
11781				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
11782				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
11783				$footprint = $('.ajax-filter-footprint', $grid),
11784				sidebar_w,
11785				data_w = parseFloat( $sidebar.attr('data-max-width') ),
11786				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
11787				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
11788				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
11789				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
11790				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
11791				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
11792				sidew,
11793				$inside_row = $('> .row-parent', $vc_row),
11794				bg_row,
11795				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
11796				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
11797				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
11798				sidebar_overlay = false,
11799				sidebar_hover = false,
11800				switchMobile = false,
11801				scrollTop;
11802
11803			if ( $vc_row.attr('class') ) {
11804				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
11805			}
11806
11807			if ( bg_row != null ) {
11808				$side_header.add($side_footer).addClass(bg_row[0]);
11809			}
11810
11811			$trigger.add($apply_filters).on('click', function(e){
11812				e.preventDefault();
11813				e.stopPropagation();
11814				$grid = $('.ajax-grid-system').eq(0);
11815				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
11816				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
11817				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
11818				sidebar_w = $sidebar_wrapper.width();
11819				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
11820				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
11821					$(this).trigger('uncode-ajax-clear-filters');
11822				}
11823				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
11824					$grid.toggleClass('ajax-hide-filters-blanks');
11825					$sidebar.slideToggle({
11826						duration: 400,
11827						easing: 'easeOutQuad',
11828					});
11829				} else {
11830					$grid.removeClass('ajax-hide-filters-blanks');
11831					$grid.toggleClass('ajax-hide-filters');
11832					if ( $grid.hasClass('ajax-hide-filters') ) {
11833						$body.addClass('ajax-hide-filters');
11834					} else {
11835						scrollTop = $('html, body').scrollTop();
11836						$body.removeClass('ajax-hide-filters');
11837					}
11838				}
11839				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
11840					$('html, body').scrollTop(scrollTop);
11841				}
11842				return false;
11843			});
11844
11845			$close_btn.on('click', function(e){
11846				e.preventDefault();
11847				$grid = $('.ajax-grid-system').eq(0);
11848				$grid.addClass('ajax-hide-filters');
11849				if ( $grid.hasClass('ajax-hide-filters') ) {
11850					$body.addClass('ajax-hide-filters');
11851				} else {
11852					scrollTop = $('html, body').scrollTop();
11853					$body.removeClass('ajax-hide-filters');
11854				}
11855				$('html, body').scrollTop(scrollTop);
11856			});
11857
11858			$sidebar_wrapper.on('mouseover',function(){
11859				sidebar_hover = true;
11860			}).on('mouseout', function(){
11861				sidebar_hover = false;
11862			});
11863
11864			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
11865				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
11866					return;
11867				}
11868				if (undefined !== from && from === 'select_active_attributes') {
11869					return;
11870				}
11871				if ($(e.target).closest('.select2-container--open').length ) {
11872					return;
11873				}
11874				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
11875					$grid.add($body).addClass('ajax-hide-filters');
11876				}
11877			});
11878
11879			$sorting_trgr.on('click', function(e) {
11880				e.preventDefault();
11881			});
11882
11883			var inside_width = function(){
11884				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
11885				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
11886				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
11887				$inside_row = $('> .row-parent', $vc_row);
11888				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
11889					sidew = $sidebar.width();
11890					$inside_row.css({
11891						width: sidew
11892					});
11893				} else {
11894					$inside_row.css({
11895						width: ''
11896					});
11897				}
11898			};
11899			inside_width();
11900
11901			var ajax_sidebar_position = function(e, f_editor){
11902				$grid = $('.ajax-grid-system').eq(0);
11903				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
11904				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
11905				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
11906				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
11907				$inside_row = $('> .row-parent', $vc_row);
11908				scrollTop = $('html, body').scrollTop();
11909				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
11910					$grid.add($body).addClass('ajax-hide-filters');
11911					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
11912					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
11913					sidebar_overlay = true;
11914					$body.addClass('ajax-filter-sidebar-overlay');
11915					$sidebar_wrapper.addClass(skin);
11916					var sideHeadH = $side_header.outerHeight(),
11917						sideFooterH = $side_footer.outerHeight();
11918					if ( data_w !== '' && data_w > 0 ) {
11919						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11920							$sidebar.css({
11921								'max-width': data_w
11922							});
11923						} else {
11924							$sidebar.css({
11925								'max-width':'none'
11926							});
11927						}
11928					}
11929					$vc_row.css({
11930						'padding-top':sideHeadH,
11931						'padding-bottom':sideFooterH
11932					});
11933					var sidew = $sidebar.width();
11934					$inside_row.css({
11935						width: sidew
11936					});
11937					switchMobile = true;
11938				} else {
11939					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
11940						scrollTop = $('html, body').scrollTop();
11941						$grid.add($body).removeClass('ajax-hide-filters');
11942					}
11943					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
11944						$grid.addClass('ajax-hide-filters-blanks');
11945						$sidebar.hide();
11946					}
11947					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
11948					$('.ajax-sidebar-placeholder', $grid).remove();
11949					sidebar_overlay = false;
11950					$body.removeClass('ajax-filter-sidebar-overlay');
11951					$sidebar_wrapper.removeClass(skin);
11952					if ( data_w !== '' && data_w > 0 ) {
11953						$sidebar.css({
11954							'max-width':'none'
11955						});
11956					}
11957					$vc_row.css({
11958						'padding-top':0,
11959						'padding-bottom':0,
11960					});
11961
11962					$inside_row.css({
11963						width: ''
11964					});
11965
11966					if ( f_editor === true ) {
11967						UNCODE.ajax_filters();
11968					}
11969
11970					switchMobile = false;
11971				}
11972				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
11973					$('html, body').scrollTop(scrollTop);
11974				}
11975			};
11976
11977			var sidebar_width = function(){
11978				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
11979					sidebar_w = $footprint.width();
11980					$sidebar.css({ width: sidebar_w });
11981				} else {
11982					$sidebar.css({ width: '' });
11983				}
11984			};
11985			sidebar_width();
11986
11987			if ( SiteParameters.is_frontend_editor ) {
11988				ajax_sidebar_position();
11989			}
11990
11991			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
11992				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
11993					ajax_sidebar_position(e);
11994				}
11995				sidebar_width();
11996			});
11997
11998			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
11999				ajax_sidebar_position(e, true);
12000			});
12001
12002			$isotope_wrapper.on('transitionend', function(e){
12003				if ( $(e.target).hasClass('isotope-wrapper') ) {
12004					window.dispatchEvent(new CustomEvent('boxResized'));
12005				}
12006				return false;
12007			});
12008
12009			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
12010				var $grid = $('.ajax-grid-system').eq(0);
12011				$grid.addClass('ajax-hide-filters');
12012			}
12013
12014		});
12015	};
12016
12017	init_ajax_grid();
12018	$(document).on('uncode-ajax-filtered', init_ajax_grid);
12019
12020/*************************
12021 *
12022 * Hover hack
12023 *
12024 ************************/
12025 	var widget_hover_hack = function() {
12026 		$('.widget, .uncode_widget').each(function(){
12027			var $widget = $(this),
12028				class_w = $widget.attr('class'),
12029				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
12030				$footer = $widget.closest('#colophon');
12031
12032			if ( class_w.indexOf('widget_yith') > 0 ) {
12033				return true;
12034			}
12035
12036			$lis.each(function(){
12037 				var $li = $(this),
12038 					$a = $('a', $li),
12039 					$label = $a.closest('label');
12040
12041				if ( !$footer.length ) {
12042					$li.addClass('no-evts');
12043				}
12044
12045				if ( ! $('span', $a).length ) {
12046 					$li.addClass( 'li-hover' );
12047 				}
12048
12049 				$('li', $li).hover(function(e){
12050 					$(e.target).parents('li').each(function(){
12051 						$(this).addClass( 'parent-li-hover' );
12052 					});
12053					}, function (e) {
12054 					$(e.target).parents('li').each(function(key, val){
12055 						if ( key === 0) {
12056	 						$(val).removeClass( 'parent-li-hover' );
12057	 					}
12058 					});
12059 				});
12060
12061				$li.off('mouseup').on('mouseup', function (e) {
12062					if (e.which !== 3) {
12063						e.stopPropagation();
12064						var $a = $('a', this).first();
12065						$a[0].click();
12066					}
12067	 			});
12068 			});
12069 		});
12070 	}
12071	if (SiteParameters.disable_hover_hack !== '1') {
12072		widget_hover_hack();
12073		$(document).on('uncode-ajax-filtered', widget_hover_hack);
12074	}
12075
12076/*************************
12077 *
12078 * Init Filters
12079 *
12080 ************************/
12081
12082	function init_filters() {
12083		$(document).on('click', '.term-filter-link', function(e) {
12084			var _this = $(this);
12085			var widget = _this.closest('.uncode_widget');
12086			var container = get_filters_container();
12087
12088			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
12089				return true;
12090			}
12091
12092			e.preventDefault();
12093
12094			if (widget.hasClass('widget-ajax-filters--checkbox')) {
12095				_this.parent().find('input[type="checkbox"]').trigger('click');
12096			} else {
12097				if (_this.hasClass('term-filter-link--active')) {
12098					_this.removeClass('term-filter-link--active');
12099				} else {
12100					_this.addClass('term-filter-link--active');
12101
12102					if (widget.hasClass('widget-ajax-filters--single')) {
12103						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
12104					}
12105				}
12106
12107				var url = _this.attr('href');
12108
12109				reload_items(container, url, true);
12110			}
12111		});
12112
12113		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
12114			var _this = $(this);
12115			var widget = _this.closest('.uncode_widget');
12116			var link = _this.closest('.term-filter').find('.term-filter-link');
12117			var url = link.attr('href');
12118			var container = get_filters_container();
12119
12120			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
12121				window.location = url;
12122				return;
12123			}
12124
12125			if (widget.hasClass('widget-ajax-filters--single')) {
12126				widget.find('input[type="checkbox"]').each(function() {
12127					if (_this.attr('id') !== $(this).attr('id')) {
12128						$(this).prop('checked', false);
12129						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
12130					}
12131				});
12132			}
12133
12134			if (_this.prop('checked')) {
12135				link.addClass('term-filter-link--active');
12136			} else {
12137				link.removeClass('term-filter-link--active');
12138			}
12139
12140			reload_items(container, url, true);
12141		});
12142
12143		$(document).on('change', 'select.select--term-filters', function(e) {
12144			var _this = $(this);
12145			var selected = _this.find('option:selected');
12146			var option = $(selected);
12147			var url = option.attr('data-term-filter-url');
12148			var container = get_filters_container();
12149			var widget = _this.closest('.uncode_widget');
12150
12151			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
12152				window.location = url;
12153			} else {
12154				reload_items(container, url, true);
12155			}
12156		});
12157
12158		$(document).on('click', '.filter-list__link', function(e) {
12159			if (SiteParameters.is_frontend_editor) {
12160				return false;
12161			}
12162
12163			e.preventDefault();
12164
12165			var _this = $(this);
12166			var container = get_filters_container();
12167			var url = _this.attr('href');
12168			reload_items(container, url, true);
12169		});
12170
12171		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
12172			var _this = $(this);
12173			var container = get_filters_container();
12174			var url = _this.attr('href');
12175			reload_items(container, url, true);
12176		});
12177
12178		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
12179
12180			var _this = $(this);
12181			var container = get_filters_container();
12182			var url = _this.attr('href');
12183
12184			if ( container.length ) {
12185				e.preventDefault();
12186				reload_items(container, url, true);
12187			}
12188		});
12189
12190		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
12191			var _this = $(this);
12192			var container = get_filters_container();
12193
12194			if (container.length > 0) {
12195				e.preventDefault();
12196
12197				var min_price = $('#min_price').val();
12198				var max_price = $('#max_price').val();
12199				var location = window.location;
12200				var url = location.href;
12201				var page_uri = location.origin + location.pathname;
12202				var is_filtered = page_uri !== url;
12203
12204				if (is_filtered) {
12205					url = remove_parameter_from_url(url, 'min_price');
12206					url = remove_parameter_from_url(url, 'max_price');
12207				}
12208
12209				var concat = page_uri === url ? '?' : '&';
12210				var params = {'min_price': min_price, 'max_price': max_price};
12211
12212				url = url + concat + $.param(params);
12213
12214				reload_items(container, url, true);
12215			}
12216		});
12217
12218		var search_timer;
12219
12220		$(document).on('keyup', '.term-filters-search-input', function(e) {
12221			var _this = $(this);
12222			var container = get_filters_container();
12223			var value = _this.val();
12224
12225			if (search_timer) {
12226				clearTimeout(search_timer);
12227			}
12228
12229			search_timer = setTimeout(function() {
12230				update_search_url(container, value);
12231			}, 500);
12232		});
12233	}
12234
12235	function update_search_url(container, search_value) {
12236		var location = window.location;
12237		var url = location.href;
12238		var page_uri = location.origin + location.pathname;
12239		var is_filtered = page_uri !== url;
12240		var key_search = SiteParameters.ajax_filter_key_search;
12241		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
12242
12243		if (is_filtered) {
12244			url = remove_parameter_from_url(url, key_search);
12245			url = remove_parameter_from_url(url, key_unfilter);
12246		}
12247
12248		if (search_value) {
12249			var concat = page_uri === url ? '?' : '&';
12250			var params = {};
12251
12252			params[key_search] = search_value;
12253			params[key_unfilter] = 1;
12254			url = url + concat + $.param(params);
12255		} else {
12256			url = remove_parameter_from_url(url, key_search);
12257		}
12258
12259		reload_items(container, url, true);
12260	}
12261
12262	function remove_parameter_from_url(url, parameter) {
12263		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
12264	}
12265
12266	function get_filters_container() {
12267		var container = $('.ajax-grid-system');
12268
12269		if (container.length == 0) {
12270			container = $('.ajax-filters');
12271		}
12272
12273		return container;
12274	}
12275
12276	function update_widgets_state(widgets_states, container) {
12277		for (var i = widgets_states.length - 1; i >= 0; i--) {
12278			var state = widgets_states[i];
12279
12280			if (!state.collapse) {
12281				continue;
12282			}
12283
12284			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
12285
12286			if (state.open) {
12287				new_widget.find('.widget-title').addClass('open');
12288				if (state.css) {
12289					new_widget.find('.widget-collapse-content').attr('style', state.css);
12290				}
12291			} else {
12292				new_widget.find('.widget-title').removeClass('open');
12293				if (state.css) {
12294					new_widget.find('.widget-collapse-content').attr('style', state.css);
12295				}
12296			}
12297		}
12298	}
12299
12300	// Reload items via AJAX
12301	function reload_items(container, url, push) {
12302		if (isAjaxing) {
12303			return
12304		};
12305
12306		isAjaxing = true;
12307
12308		container.addClass('grid-filtering');
12309
12310		$.ajax({
12311			url     : url,
12312			success : function(response) {
12313				if (!response) {
12314					return;
12315				}
12316
12317				$(document).trigger('uncode-ajax-pre-filtered');
12318
12319				var container_id = container.attr('id');
12320				var pagination = $('.row-navigation');
12321
12322				if (container_id) {
12323					var container_to_append = $(response).find('#' + container_id);
12324					var pagination_to_append = $(response).find('.row-navigation');
12325					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
12326
12327					// Remember open/closed widgets
12328					var widgets = $('.uncode_widget');
12329					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
12330					var widgets_states = [];
12331
12332					widgets.each(function() {
12333						var widget = $(this);
12334						var id = widget.attr('data-id');
12335						var state = {
12336							'id': id,
12337							'collapse': false,
12338							'open': false,
12339							'css': false,
12340						};
12341
12342						var collapse_wrapper = widget.find('.widget-collapse-content');
12343
12344						if (collapse_wrapper.length > 0) {
12345							state.collapse = true;
12346
12347							var collapse_wrapper_css = collapse_wrapper.attr('style');
12348							var title = widget.find('.widget-title');
12349
12350							state.css = collapse_wrapper_css;
12351
12352							if (title.hasClass('open')) {
12353								state.open = true;
12354							} else {
12355								state.open = false;
12356							}
12357						}
12358
12359						widgets_states.push(state);
12360					});
12361
12362					// Update widgets state
12363					if (offcanvas_sidebar_wrapper.length === 0) {
12364						update_widgets_state(widgets_states, container_to_append);
12365					}
12366
12367					// Update default sidebar state
12368					if (!container.hasClass('ajax-hide-filters')) {
12369						container_to_append.removeClass('ajax-hide-filters');
12370					}
12371
12372					// Update horizontal sidebar
12373					if (!container.hasClass('ajax-hide-filters-blanks')) {
12374						container_to_append.removeClass('ajax-hide-filters-blanks');
12375					}
12376					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
12377					if (horizontal_sidebar_wrapper.length > 0) {
12378						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
12379						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
12380						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
12381						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
12382
12383						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
12384						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
12385					}
12386
12387					// Append container
12388					container.replaceWith(container_to_append);
12389
12390					// Hide first thumbnail until the new srcset is loaded
12391					if (SiteParameters.dynamic_srcset_active === '1') {
12392						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
12393					}
12394
12395					// Remove loading attribute to images
12396					container_to_append.find('img').attr('loading', '');
12397
12398					// Append pagination
12399					if (pagination.length > 0) {
12400						if (pagination_to_append.length > 0) {
12401							pagination.html(pagination_to_append.html());
12402						} else {
12403							pagination.html('');
12404						}
12405					} else {
12406						if (pagination_to_append.length > 0) {
12407							$('.post-wrapper').append(pagination_to_append);
12408						}
12409					}
12410
12411					// Update off canvas sidebar (mobile and overlay)
12412					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
12413
12414					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
12415						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
12416						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
12417						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
12418						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
12419
12420						// Update widgets state
12421						update_widgets_state(widgets_states, sidebar_to_append);
12422
12423						// Update sidebar
12424						sidebar_container.html(sidebar_to_append.html());
12425					}
12426
12427					if (push) {
12428						UNCODE.lastURL = url;
12429						window.history.pushState(
12430							{ pageTitle: document.title },
12431							'',
12432							url
12433						);
12434					}
12435
12436					if (typeof UNCODE.isotopeLayout !== 'undefined') {
12437						UNCODE.isotopeLayout();
12438					}
12439					if (typeof UNCODE.justifiedGallery !== 'undefined') {
12440						UNCODE.justifiedGallery();
12441					}
12442					if (typeof UNCODE.cssGrid !== 'undefined') {
12443						UNCODE.cssGrid();
12444					}
12445					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
12446						UNCODE.lightbox();
12447					}
12448					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
12449						UNCODE.lightgallery();
12450					}
12451					if (typeof UNCODE.carousel !== 'undefined') {
12452						UNCODE.carousel($('body'));
12453					}
12454					UNCODE.animations();
12455					if (typeof UNCODE.filters !== 'undefined') {
12456						UNCODE.filters();
12457					}
12458					if (typeof UNCODE.widgets !== 'undefined') {
12459						UNCODE.widgets();
12460					}
12461
12462					if (SiteParameters.dynamic_srcset_active === '1') {
12463						UNCODE.refresh_dynamic_srcset_size();
12464					}
12465
12466					if (typeof UNCODE.menuSmartInit !== 'undefined') {
12467						UNCODE.menuSmartInit();
12468					}
12469
12470					if (typeof UNCODE.parallax !== 'undefined') {
12471						UNCODE.parallax();
12472					}
12473
12474					maybe_scroll_to_top();
12475
12476					var woo_select2_cats = $('.dropdown_product_cat');
12477
12478					if (woo_select2_cats.length > 0) {
12479						woo_select2_cats.on( 'change', function() {
12480							if ( $(this).val() != '' ) {
12481								var this_page = '';
12482								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
12483								if ( home_url.indexOf( '?' ) > 0 ) {
12484									this_page = home_url + '&product_cat=' + $(this).val();
12485								} else {
12486									this_page = home_url + '?product_cat=' + $(this).val();
12487								}
12488								location.href = this_page;
12489							} else {
12490								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
12491							}
12492						});
12493
12494						if ( $().selectWoo ) {
12495							var wc_product_cat_select = function() {
12496								woo_select2_cats.selectWoo( {
12497									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
12498									minimumResultsForSearch: 5,
12499									width: '100%',
12500									allowClear: true,
12501									language: {
12502										noResults: function() {
12503											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
12504										}
12505									}
12506								} );
12507							};
12508							wc_product_cat_select();
12509						}
12510					}
12511
12512					$(document).trigger('uncode-ajax-filtered');
12513					$(document.body).trigger('init_price_filter');
12514					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
12515
12516					isAjaxing = false;
12517				}
12518			},
12519			error: function() {
12520				container.removeClass('grid-filtering');
12521
12522				isAjaxing = false;
12523
12524				if (SiteParameters.enable_debug == true) {
12525					// This console log is disabled by default
12526					// So nothing is printed in a typical installation
12527					//
12528					// It can be enabled for debugging purposes setting
12529					// the 'uncode_enable_debug_on_js_scripts' filter to true
12530					console.log('There was an error retrieving the products');
12531				}
12532			}
12533		});
12534	}
12535
12536	// Scroll to top after filtering
12537	function maybe_scroll_to_top() {
12538		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
12539
12540		if (offcanvas_sidebar_wrapper.length > 0) {
12541			return;
12542		}
12543
12544		var container = get_filters_container();
12545		var bound = container[0].getBoundingClientRect();
12546
12547		if (bound.y < 0) {
12548			$(window).scrollTop(container.offset().top);
12549		}
12550	}
12551
12552	// Back/forward browser buttons
12553	$(window).on("popstate.ajaxfilters", function(e) {
12554		var location = window.location;
12555		var url = location.href;
12556		var params = UNCODE.getURLParams(window.location);
12557		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
12558
12559		UNCODE.lastURL = url;
12560
12561		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
12562			return;
12563		}
12564
12565		var container = get_filters_container();
12566
12567		reload_items(container, url, false);
12568	});
12569
12570	// Destroy load more before to init a new one
12571	$(window).on('uncode-ajax-pre-filtered', function() {
12572		if ($.fn.infinitescroll) {
12573			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
12574		}
12575	});
12576
12577	init_filters();
12578};
12579
12580UNCODE.videoThumbs = function() {
12581	var checkResize,
12582		newW = UNCODE.wwidth;
12583	var checkForVideos = function(){
12584
12585		$(window).on('okevents.y.change', function(e, y){
12586			var $video = $(y.target.g),
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			if ( newW >= UNCODE.mediaQuery ) {
12593
12594				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
12595					$video_wrap.data('hovered', true);
12596					$video_wrap.addClass('played-on');
12597					y.target.pauseVideo();
12598					$tmb.on('mouseenter', function(){
12599						if ( restart ) {
12600							y.target.seekTo(0);
12601						}
12602						y.target.playVideo();
12603					}).on('mouseleave', function(){
12604						clearTimeout(setTime);
12605						setTime = setTimeout(function(){
12606							y.target.pauseVideo();
12607						}, 300);
12608					});
12609				}
12610
12611			} else {
12612				if( $mobile_video_wrap.length ) {
12613					$video_wrap.addClass('played-on');
12614					y.target.playVideo();
12615				}
12616			}
12617
12618		});
12619
12620		$(window).on('okevents.v.loaded', function(e, playerV){
12621			var $video = $(playerV.element),
12622				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
12623				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
12624				restart = !$video_wrap.hasClass('play-pause'),
12625				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
12626				setTime;
12627
12628			if ( newW >= UNCODE.mediaQuery ) {
12629				
12630				if( $video_wrap.length ) {
12631
12632					var playPromise = playerV.play();
12633					if (playPromise !== undefined) {
12634						playPromise.then(function( value ) {
12635							playerV.pause();
12636						});
12637					}
12638					$video_wrap.addClass('played-on');
12639					$tmb.on('mouseenter', function(){
12640						if ( restart ) {
12641							playerV.setCurrentTime(0)
12642						}
12643						playerV.play();
12644					}).on('mouseleave', function(){
12645						clearTimeout(setTime);
12646						setTime = setTimeout(function(){
12647							playerV.pause();
12648						}, 300);
12649					});
12650				}
12651
12652			} else {
12653
12654				if( $mobile_video_wrap.length ) {
12655					var playPromise = playerV.play();
12656					if (playPromise !== undefined) {
12657						playPromise.then(function( value ) {
12658							playerV.play();
12659						});
12660					}
12661					$video_wrap.addClass('played-on');
12662				}
12663			}
12664		});
12665
12666		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
12667			var $video = $(video),
12668				$noscript = $('noscript', $video),
12669				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
12670				restart = !$video_wrap.hasClass('play-pause'),
12671				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
12672				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
12672: $video.closest('.t-entry-visual, .un-inline-image'),
12673				setTime,
12674			manageVideo = function(){
12675				video.currentTime = 0;
12676				video.pause();
12677				if ( newW >= UNCODE.mediaQuery ) {
12678					if ( $video_wrap.length ) {
12679						$video_wrap.addClass('played-on');
12680						$tmb.on('mouseenter', function(){
12681							if ( restart ) {
12682								video.currentTime = 0;
12683							}
12684							video.play();
12685						}).on('mouseleave', function(){
12686							clearTimeout(setTime);
12687							setTime = setTimeout(function(){
12688								video.pause();
12689							}, 300);
12690						});
12691					} else {
12692						video.play();
12693					}
12694				} else {
12695					if ( $mobile_video_wrap.length ) {
12696						$mobile_video_wrap.addClass('played-on');
12697						video.play();
12698					}
12699				}
12700
12701			};
12702			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
12703				$noscript.each(function(key, val){
12704					$noscript.after(val.textContent || val.innerText || val.innerHTML);
12705					$noscript.remove();
12706				});
12707			}
12708
12709			if (typeof MediaElement === "function") {
12710				$video.has('source[src]').mediaelementplayer({
12711					pauseOtherPlayers: false,
12712				});
12713			}
12714			if (video.readyState > 0) {
12715				manageVideo();
12716			} else {
12717				$video.on("loadedmetadata", function(_event) {
12718					manageVideo();
12719				});
12720			};
12721		});
12722	
12723	};
12724	
12725	checkForVideos();
12726
12727	var checkVideoResize = function(){
12728		clearRequestTimeout(checkResize);
12729		checkResize = requestTimeout(function(){
12730			if ( newW !== UNCODE.wwidth ) {
12731				checkForVideos();
12732				newW = UNCODE.wwidth;
12733			}
12734		}, 1000);
12735	};
12736
12737	$(window).off('resize.videos', checkVideoResize)
12738	.on( 'resize.videos', checkVideoResize);
12739
12740	$(window).off('more-items-loaded.videos', checkForVideos)
12741	.on('more-items-loaded.videos', checkForVideos);
12742
12743};
12744UNCODE.inlineImgs = function() {
12745    var linkInlineImgs = function(){
12746        $('.un-inline-image').each(function(){
12747            var $img = $(this),
12748                href = $(this).attr('data-link-href'),
12749                dataImg = $img.data();
12750			if ( dataImg != '' && href != null && href !== '' ) {
12751                var class_stra_a = 'unline-image-link';
12752                if ( $(this).hasClass('un-inline-space-over') ) {
12753                    class_stra_a += ' un-inline-space-over';
12754                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
12755                    class_stra_a += ' un-inline-space-gutter';
12756                }
12757                var str_a = '<a class="' + class_stra_a + '" ';
12758                for (var key in dataImg) {
12759                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
12760                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
12761                    }
12762                }
12763                str_a += ' />';
12764                $img.wrap(str_a);
12765			}
12766        });
12767    };
12768    $(window).on('load', linkInlineImgs );
12769};
12770UNCODE.lottie = function() {
12771    if ( SiteParameters.is_frontend_editor ) {
12772        var $lottie_wraps = $('div.uncode-lottie-wrap');
12773        $lottie_wraps.each(function(){
12774            var $lottie_wrap = $(this),
12775                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
12776                $player_clone = $div_player.clone(),
12777                player_id = $div_player.attr('data-id'),
12778                $lottie_players = $('lottie-player', $lottie_wrap).remove();
12779            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
12780                if ( $('#'+player_id).length ) {
12781                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
12782                }
12783                $player_clone.attr('id', player_id);
12784                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
12785                $div_player.after($player_clone);
12786                $div_player.attr('data-init',true);
12787            }
12788        });
12789    }
12790    var $players = $('.uncode-lottie-wrap lottie-player');
12791    $players.each(function(){
12792        var player = this,
12793            this_id = $(player).attr('id'),
12794            _player = document.getElementById(this_id),
12795            trigger = $(player).attr('data-trigger'),
12796            pFrames = $(player).attr('data-frames').split(','),
12797            srcPlayer = $(player).attr('src');
12798
12799        _player.load(srcPlayer);
12800
12801        _player.addEventListener("ready", function() {
12802
12803            var $_shadow = _player.shadowRoot;
12804            $($_shadow).find('.error').remove();
12805
12806            var tFrames = _player.getLottie().totalFrames / 100,
12807                pFrame_from = Math.round(tFrames * pFrames[0]),
12808                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
12809                loop = $(player).attr('loop'),
12810                mode,
12811                actions;
12812
12813            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
12814                if ( trigger === 'scroll' ) {
12815                    mode = 'scroll';
12816                    actions = [
12817                        {
12818                            visibility:[0, 1.0],
12819                            type: "seek",
12820                            frames: [pFrame_from, pFrame_to],
12821                        }
12822                    ];
12823                } else if ( trigger === 'viewport') {
12824                    mode = 'scroll';
12825                    actions = [
12826                        {
12827                            visibility: [0.20, 1.0],
12828                            frames: [pFrame_from, pFrame_to],
12829                            type: loop ? "loop" : "play"
12830                        }
12831                    ];
12832                } else if ( trigger === 'hover') {
12833                    $(player).on('mouseenter', function(){
12834                        _player.play();
12835                    }).on('mouseleave', function(){
12836                        _player.pause();
12837                    });
12838                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
12839                        _player.seek(pFrame_from);
12840                        _player.addEventListener("frame", function(){
12841                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
12842                                _player.seek(pFrame_from);
12843                            }
12844                        });
12845                    }
12846                }
12847                LottieInteractivity.create({
12848                    player: '#' + this_id,
12849                    mode: mode,
12850                    actions: actions
12851                });
12852            } else {
12853                if ( pFrame_from > 0 && pFrame_from < 99 ) {
12854                    _player.seek(pFrame_from);
12855                    _player.addEventListener("frame", function(){
12856                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
12857                            _player.seek(pFrame_from);
12858                        }
12859                    });
12860                }
12861            }
12862        });
12863
12864        $(window).on('unlottie-destroy', function(){
12865            _player.destroy();
12866        });
12867    });
12868};
12869
12870UNCODE.animatedBgGradient = function( _el ) {
12871
12872    var ev;
12873
12874	if ( typeof _el === 'undefined' || _el === null ) {
12875        _el = document;
12876        ev = false;
12877	} else {
12878        _el = _el[0];
12879        ev = 'shortcode:update';
12880    }
12881
12882    var simplex = new SimplexNoise();
12883
12884    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
12885		this.block = blockOverlay;
12886		this.wrap = canvasWrap;
12887		this.config();
12888		this.checker();
12889		this.loopRAF();
12890        this.animLoader();
12891    };
12892
12893    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
12894
12895    AnimGradient.config = function() {
12896        this.canvas = document.createElement('canvas');
12897        this.wrap.appendChild(this.canvas);
12898        this.ctx = this.canvas.getContext('2d');
12899        this.count = 0;        
12900        this.isOrientationChanged = false;
12901        this.res = UNCODE.isMobile ? 90 : 110;
12902        this.resPercent = 100/this.res;
12903        this.resAround = this.resPercent/100;
12904        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;
12905
12906        this.canvas.classList.add('uncode-bg-animated-gradient');
12907        this.canvas.setAttribute('height', this.res);
12908        this.canvas.setAttribute('width', this.res);
12909        this.canvas.style = 'height: 100%; position: relative; width:100%;';
12910
12911        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
12912
12913        this.cx = this.canvas.width/2;
12914        this.cy = this.canvas.height/2;
12915        this.data = this.imgdata.data;
12916
12917        this.opts = {
12918            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,
12919            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,
12920            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
12921        };
12922
12923        this.lavaTime = 1;
12924        this.bg_colors = [];
12925
12926        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
12927            return;
12928        }
12929
12930        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
12931            this.singleColor = true;
12932        }
12933
12934        if( this.opts.col_1st ) {
12935
12936            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
12937
12938            this.bg_colors.push({
12939                r: rgbColor1.r,
12940                g: rgbColor1.g,
12941                b: rgbColor1.b
12942            });
12943        }
12944
12945        if( this.opts.col_2nd ) {
12946
12947            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
12948
12949            this.bg_colors.push({
12950                r: rgbColor2.r,
12951                g: rgbColor2.g,
12952                b: rgbColor2.b
12953            });
12954        }
12955
12956    };
12957
12958    AnimGradient.checker = function() {
12959        var scope = this;
12960        this.checkInViewPort();
12961      
12962        window.addEventListener('resize', function() {
12963            if(UNCODE.isMobile && !scope.isOrientationChanged) {
12964                return;
12965            }
12966            scope.ratioCalc();
12967        });
12968
12969        window.addEventListener("orientationchange", function() {
12970            scope.isOrientationChanged = true;
12971        });
12972
12973        this.ratioCalc();
12974    }; 
12975
12976    AnimGradient.ratioCalc = function() {
12977      
12978        var blockW = this.block.clientWidth,
12979            blockH = this.block.clientHeight;
12980
12981        var blockRatio = blockH/blockW;
12982
12983        if(blockRatio < 1) {
12984            this.ratioParam = {
12985                x: 1.4,
12986                y: blockRatio*1.4
12987            }
12988        } else {
12989            this.ratioParam = {
12990                x: blockRatio/3,
12991                y: 1
12992            }
12993        }
12994         
12995    };
12996
12997    AnimGradient.checkInViewPort = function() {
12998		if( 'IntersectionObserver' in window ) {
12999		    var scope = this,
13000                observer = new IntersectionObserver(function(entries) {
13001  
13002                entries.forEach(function(entry){
13003                    if ( entry.isIntersecting ) {
13004                        scope.isInViewport = true;
13005                    } else {
13006                        scope.isInViewport = false;
13007                    }
13008                });
13009  
13010		    }, { 
13011			root: document,
13012		  });
13013  
13014		  observer.observe(this.block);
13015		}
13016	};
13017	
13018    AnimGradient.hexToRGB = function(hexval) {
13019        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
13020        if (!hexecuted) {
13021            return false;
13022        }
13023        return {
13024            r: parseInt(hexecuted[1], 16),
13025            g: parseInt(hexecuted[2], 16),
13026            b: parseInt(hexecuted[3], 16)
13027        }
13028    };
13029
13030    AnimGradient.factor = function(val_1, val_2, lava) { 
13031        return val_1 * (1 - lava) + val_2 * lava;
13032    };
13033
13034    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
13035        if (this.singleColor) {
13036            return this.bg_colors[0][wave_l];
13037        }
13038        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 );
13039        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
13040    };
13041
13042    AnimGradient.lava = function(x, y, grade) {
13043        var radians = (Math.PI / 180) * grade,
13044        cos = Math.cos(radians),
13045        sin = Math.sin(radians),
13046        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
13047        return nx;
13048    };
13049    
13050    AnimGradient.loopRAF = function() {
13051
13052      var scope = this;
13053
13054        if( this.isInViewport ) {
13055            for (var x = 0; x < this.res; x++) {
13056                for (var y = 0; y < this.res; y++) {
13057                    
13058                    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
13059        
13060                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
13061                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
13062                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
13063                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
13064                  
13065                }
13066            }
13067   
13068            this.count++;
13069          
13070            this.ctx.putImageData(this.imgdata, 0, 0);
13071         
13072        }
13073
13074        requestAnimationFrame(function() {
13075            scope.loopRAF();
13076        });
13077    };
13078
13079    AnimGradient.animLoader = function() {
13080        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
13081    };
13082
13083    var anim_init = function() {
13084        var bgs = _el.querySelectorAll('.block-bg-overlay');
13085      
13086        bgs.forEach(function(blockOverlay) {
13087            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
13088            if( !blockOverlay || !canvasWrap ) {
13089                return;
13090            }
13091            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
13092        });
13093    }
13094
13095    $(window).on('load', function(){
13096        anim_init();
13097    });
13098
13099    if ( ev === 'shortcode:update' ) {
13100        anim_init();
13101    }
13102
13103};
13104UNCODE.multibg = function(){
13105	var $bgsWraps = $('.uncode-multi-bgs'),
13106		$body = $('body');
13107	$bgsWraps.each(function(){
13108		var $bgWrap = $(this),
13109			transition = $bgWrap.attr('data-transition'),
13110			transitionTime = $bgWrap.attr('data-transition-time'),
13111			dataPace = $bgWrap.attr('data-transition-pace'),
13112			dataThreshold = $bgWrap.attr('data-transition-threshold'),
13113			dataTime = $bgWrap.attr('data-carousel-time'),
13114			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
13115			random = $bgWrap.attr('data-multi-random'),
13116			_bgWrap = $bgWrap[0],
13117			$multiBgs = $('.multi-background', $bgWrap),
13118			imgFirst,
13119			bgAmount = $multiBgs.length,
13120			isInViewport = false,
13121			lastScrollTop = 0,
13122			counter = 0,
13123			totMove = 0,
13124			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
13125			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
13126			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
13127			offX, offY,
13128			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
13129			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
13130			requestCarousel,
13131			is_header = $bgWrap.closest('#page-header').length,
13132			startTime = new Date();
13133
13134		transition = typeof transition === 'undefined' ? '' : transition;
13135
13136		if ( random === 'true' ) {
13137			UNCODE.shuffle($multiBgs);
13138		}
13139
13140		imgFirst = $multiBgs.first().find('.background-inner').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
13141
13142		var loadFirst = function(){
13143			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
13144				opacity: 1
13145			}, 250, 'easeInQuad').css({
13146				zIndex: 1
13147			});	
13148		}
13149
13150		var loadError = function(){
13151			console.log('Multi BG loading error');
13152		}
13153
13154		UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
13155
13156		var loadSlides = function( $thisBg ){
13157			$thisBg.attr('data-load', 'loaded');	
13158		}
13159
13160		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
13161			var $thisBg = $(val);
13162
13163			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
13164
13165				var _imgBg = $(val).find('.background-inner').css('background-image');
13166
13167				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
13168					$thisBg.attr('data-load', 'loaded');
13169				} else {
13170					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
13171					if ( typeof _imgBg !== 'undefined' ) {
13172						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
13173					}
13174				}
13175			}
13176		});
13177					
13178		var multiCarousel = function(e) {
13179
13180			clearRequestTimeout(requestCarousel);
13181
13182			var checkTime = new Date();
13183			if ( checkTime - startTime >= carouselTime && isInViewport ) {
13184				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
13185
13186				if ( $checkEl.attr('data-load') !== 'loaded' ) {
13187					requestTimeout(function(){
13188						multiCarousel();
13189					}, 100);
13190					return;
13191				}
13192
13193				counter++;
13194
13195				$multiBgs.each(function(ind, val){
13196					if ( ind === counter%bgAmount ) {
13197						$(val).stop(true,false).animate({
13198							opacity: 1
13199						}, wait, 'easeInQuad').css({
13200							zIndex: 1
13201						});
13202					} else {
13203						$(val).stop(true,false).animate({
13204							opacity: 0
13205						}, wait, 'easeInQuad').css({
13206							zIndex: 0
13207						});
13208					}
13209				});
13210
13211			}
13212
13213			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
13214				requestCarousel = requestTimeout(multiCarousel, carouselTime);
13215			}
13216	
13217		};
13218
13219		var multiMove = function(e) {
13220			if ( $body.hasClass('navbar-hover') ) {
13221				return;
13222			}
13223			var checkTime = new Date(),
13224                bound = $bgWrap[0].getBoundingClientRect(),
13225                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
13226			if (offX) {
13227				totMove += Math.sqrt(
13228					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
13229				);
13230			}
13231			if (
13232                totMove >= pace && 
13233                checkTime - startTime >= wait &&
13234                e.clientX <= (bound.left + bound.width) &&
13235                e.clientX >= bound.left &&
13236                e.clientY <= (bound.top + bound.height) &&
13237                e.clientY >= bound.top
13238            ) {
13239				counter++;
13240				startTime = checkTime;
13241				$multiBgs.each(function(ind, val){
13242					if ( ind === counter%bgAmount ) {
13243						$(val).stop(true,false).animate({
13244							opacity: 1
13245						}, wait, 'easeInQuad').css({
13246							zIndex: 1
13247						});
13248					} else {
13249						$(val).stop(true,false).animate({
13250							opacity: 0
13251						}, wait, 'easeInQuad').css({
13252							zIndex: 0
13253						});
13254					}
13255				});
13256
13257				totMove = 0;
13258			}
13259			
13260			offX = e.clientX;
13261			offY = e.clientY;
13262			
13263		};
13264
13265		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
13266			document.addEventListener("mousemove", multiMove);
13267		}
13268
13269		window.addEventListener('resize', function() {
13270			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
13271				document.removeEventListener("mousemove", multiMove);
13272				document.addEventListener("mousemove", multiMove);
13273			}
13274		});
13275
13276		var lightLoopRAF = function() {
13277
13278			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
13279				checkTime = new Date(),
13280				bound = $bgWrap[0].getBoundingClientRect(),
13281				thresholdHeader = is_header ? 100 : threshold,
13282				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
13283			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
13284				counter++;
13285				lastScrollTop = scrollTop;
13286				startTime = checkTime;
13287
13288				$multiBgs.each(function(ind, val){
13289					if ( ind === counter%bgAmount ) {
13290						$(val).stop(true,false).animate({
13291							opacity: 1
13292						}, wait, 'easeInQuad').css({
13293							zIndex: 1
13294						});
13295					} else {
13296						$(val).stop(true,false).animate({
13297							opacity: 0
13298						}, wait, 'easeInQuad').css({
13299							zIndex: 0
13300						});
13301					}
13302				});
13303
13304			}
13305
13306			requestAnimationFrame(function() {
13307				if ( isInViewport ) {
13308					lightLoopRAF();
13309				}
13310			});
13311		};
13312
13313		var currentInd = 0;
13314
13315		var loopRAF = function() {
13316
13317			var multiBgRotate = function(slideInd){
13318				currentInd = slideInd;
13319				$multiBgs.each(function(ind, val){
13320					if ( ind === slideInd ) {
13321						$(val).stop(true,false).animate({
13322							opacity: 1
13323						}, wait, 'easeInQuad').css({
13324							zIndex: 1
13325						});
13326					} else {
13327						$(val).stop(true,false).animate({
13328							opacity: 0
13329						}, wait, 'easeInQuad').css({
13330							zIndex: 0
13331						});
13332					}
13333				});
13334			};
13335			var bound = $bgWrap[0].getBoundingClientRect(),
13336				thresholdPX = UNCODE.wheight * threshold / 100,
13337				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
13338				movePX = totMove / bgAmount,
13339				moving = UNCODE.wheight - (bound.top + thresholdPX),
13340				slideInd = 0;
13341
13342			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
13343				multiBgRotate(0);
13344			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
13345				multiBgRotate(bgAmount-1);
13346			} else {
13347				slideInd = Math.ceil(moving/movePX) - 1;
13348				if ( slideInd < 0 ) {
13349					slideInd = 0;
13350				} else if ( slideInd >= bgAmount ) {
13351					slideInd = bgAmount-1;
13352				}
13353				if ( slideInd !== currentInd ) {
13354					multiBgRotate(slideInd);
13355				}
13356			}
13357
13358			requestAnimationFrame(function() {
13359				if ( isInViewport ) {
13360					loopRAF();
13361				}
13362			});
13363		};
13364
13365		if( 'IntersectionObserver' in window ) {
13366		    var observer = new IntersectionObserver(function(entries) {
13367  
13368                entries.forEach(function(entry){
13369                    if ( entry.isIntersecting ) {
13370                        isInViewport = true;
13371						if ( transition === 'scroll' ) {
13372							if ( autoScroll ) {
13373								loopRAF();
13374							} else {
13375								lightLoopRAF();
13376							}
13377						} else {
13378							multiCarousel();
13379						}
13380                    } else {
13381                        isInViewport = false;
13382                   }
13383                });
13384  
13385		    }, { 
13386				root: document,
13387				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
13388		  	});
13389
13390			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
13391		  		observer.observe(_bgWrap);
13392			}
13393
13394			window.addEventListener('resize', function() {
13395				observer.unobserve(_bgWrap);
13396				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
13397					observer.observe(_bgWrap);
13398				}
13399			});
13400	
13401		}
13402
13403	});
13404}
13405
13406UNCODE.owlNav = function(target, ev) {
13407    target = target.replace(/#\S+/g, '');
13408    var $carousel = $('#'+target),
13409        $slider = $carousel.closest('.uncode-slider'),
13410        $checkNavs = $('.uncode-owl-nav');
13411    if ( !$checkNavs.length ) {
13412        return;
13413    }
13414
13415    if ( $slider.length ){
13416        target = $slider.attr('id');
13417    }
13418
13419    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
13420        $row;
13421
13422    if ( ! $navs.length ) {
13423        $row = $carousel.closest('.vc_row.row-container');
13424        $navs = $('.uncode-owl-nav:not([data-target])', $row);
13425    }
13426        
13427    if ( ! $navs.length ) {
13428        return;
13429    }
13430
13431    $navs.each(function(){
13432        var $nav = $(this),
13433            $outer = $nav.closest('.uncode-owl-nav-out'),
13434            $inner = $nav.find('.uncode-owl-nav-in'),
13435            $navDots = $('.uncode-nav-dots', $nav),
13436            $navCounter = $('.uncode-nav-counter', $nav),
13437            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
13438            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
13439            skinInherit = $nav.hasClass('skin-inherit'),
13440            digit = parseFloat($nav.attr('data-digit')),
13441            counterDigit = parseFloat($nav.attr('data-counter-digit')),
13442            navSpeed = parseFloat($carousel.attr('data-navspeed'));
13443        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
13444
13445        if ( $nav.hasClass('pos-abs') ){
13446            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
13447                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
13448            }
13449            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
13450        } 
13451
13452        $carousel.on('refreshed.owl.carousel', counter);
13453        $carousel.on('resized.owl.carousel', counter);
13454        $carousel.on('changed.owl.carousel', counter);
13455
13456        var totalSlides = 0;
13457
13458        function counter(event) {
13459            if (!event.namespace) {
13460                return;
13461            }
13462            var slides = event.relatedTarget,
13463                current = slides._current,
13464                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
13465                item = event.item,
13466                page = event.page,
13467                countPages = Math.ceil(item.count / page.size),
13468                $currentSlide = $carousel.find('.owl-item').eq(current),
13469                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
13470                activeSlide = Math.ceil(itemIndex / page.size),
13471                $prev = $nav.find('.uncode-nav-prev'),
13472                $next = $nav.find('.uncode-nav-next'),
13473                $col = $currentSlide.find('.uncol').first();
13474
13475            if ( totalSlides != countPages ) {
13476                totalSlides = countPages;
13477                $navDots.html('');
13478                var nav_html = '';
13479                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
13480                    var padN = sl_ind+1;
13481                    if ( digit && digit > 1 ) {
13482                        padN = String(padN).padStart(digit, '0');
13483                    }
13484                    nav_html += '<span class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '"><span>' + padN + '</span></span>';
13485                }
13486                $navDots.html(nav_html);
13487
13488                var totalSlidesDigit = totalSlides;
13489
13490                if ( counterDigit && counterDigit > 1 ) {
13491                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
13492                }
13493                $counterTotal.html(totalSlidesDigit);
13494            }
13495
13496            if ( loop !== true ) {
13497                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
13498                if ( itemIndex === 1 ) {
13499                    $prev.addClass('uncode-nav-disabled');
13500                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
13501                    $next.addClass('uncode-nav-disabled');
13502                    activeSlide = Math.ceil(item.count / page.size);
13503                }
13504            }
13505
13506            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
13507            var activeSlideDigit = activeSlide;
13508
13509            if ( counterDigit && counterDigit > 1 ) {
13510                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
13511            }
13512            $counterIndex.html(activeSlideDigit);
13513
13514            if ( skinInherit ) {
13515                if ( $col.hasClass('style-light') ){
13516                    $nav.removeClass('style-dark').addClass('style-light');
13517                } else if ( $col.hasClass('style-dark') ) {
13518                    $nav.removeClass('style-light').addClass('style-dark');
13519                }
13520            }
13521
13522            $inner.removeClass('uncode-owl-nav-waiting');
13523
13524            if ( $nav.hasClass('outer-width') ) {
13525                var navW = $nav.outerWidth(),
13526                    nexW = $next.outerWidth(),
13527                    prevW = $prev.outerWidth(),
13528                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
13529
13530                if ( $nav.hasClass('h-align-justify') ) {
13531                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
13532                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
13533                        $inner.css({'margin': 'auto'});
13534                    } else {
13535                        $inner.css({'margin': ''});
13536                    }
13537                } else {
13538                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
13539                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
13540                        $inner.css({'margin': 'auto'});
13541                    } else {
13542                        $inner.css({'margin': ''});
13543                    }
13544                }
13545            }
13546        }
13547
13548        $nav.on('click', '.uncode-nav-index', function(){
13549            var $bullet = $(this),
13550                slide_index = parseFloat( $bullet.attr('data-key') );
13551            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
13552        });
13553        $nav.on('click', '.uncode-nav-prev', function(){
13554            $carousel.trigger('prev.owl.carousel', [navSpeed]);
13555        });
13556        $nav.on('click', '.uncode-nav-next', function(){
13557            $carousel.trigger('next.owl.carousel', [navSpeed]);
13558        });
13559
13560        if ( $nav.hasClass('animated-arrows') ) {
13561            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
13562                $(this).addClass("hover"); 
13563            }).on('animationend', function(){
13564                $(this).removeClass("hover");  
13565            });
13566        }
13567
13568        var positionNav = function(){
13569            if ( $nav.hasClass('window-width') ) {
13570                var navOff = parseFloat( $nav.offset().left ) * -1;
13571                if ( navOff > 0 ) {
13572                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
13573                } else {
13574                    $inner.css({ transform: 'none' });
13575                }
13576            }
13577        }
13578        positionNav();
13579        $(window).on('resize', positionNav);
13580    });
13581
13582    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
13583};
13584
13585	UNCODE.init = function() {
13586		var wfl_check = false, wfl_request, waypoint_request;
13587		UNCODE.preventDoubleTransition();
13588		UNCODE.betterResize();
13589		UNCODE.utils();
13590		UNCODE.magnetic();
13591		if (typeof UNCODE.rowParallax !== 'undefined') {
13592			UNCODE.rowParallax();
13593		}
13594		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
13595			UNCODE.changeSkinOnScroll();
13596		}
13597		if (typeof UNCODE.share !== 'undefined') {
13598			UNCODE.share();
13599		}
13600		if (typeof UNCODE.tooltip !== 'undefined') {
13601			UNCODE.tooltip();
13602		}
13603		if (typeof UNCODE.counters !== 'undefined') {
13604			UNCODE.counters();
13605		}
13606		if (typeof UNCODE.countdowns !== 'undefined') {
13607			UNCODE.countdowns();
13608		}
13609		if (typeof UNCODE.tabs !== 'undefined') {
13610			UNCODE.tabs();
13611		}
13612		if (typeof UNCODE.collapse !== 'undefined') {
13613			UNCODE.collapse();
13614		}
13615		if (typeof UNCODE.bigText !== 'undefined') {
13616			UNCODE.bigText();
13617		}
13618		UNCODE.menuSystem();
13619		if (typeof UNCODE.bgChanger !== 'undefined') {
13620			UNCODE.bgChanger();
13621		}
13622		if (typeof UNCODE.magicCursor !== 'undefined') {
13623			UNCODE.magicCursor();
13624		}
13625		if (typeof UNCODE.magneticCursor !== 'undefined') {
13626			UNCODE.magneticCursor();
13627		}
13628		if (typeof UNCODE.dropImage !== 'undefined') {
13629			UNCODE.dropImage();
13630		}
13631		if (typeof UNCODE.postTable !== 'undefined') {
13632			UNCODE.postTable();
13633		}
13634		if (typeof UNCODE.rotatingTxt !== 'undefined') {
13635			UNCODE.rotatingTxt();
13636		}
13637		if (typeof UNCODE.okvideo !== 'undefined') {
13638			UNCODE.okvideo();
13639			window.addEventListener( "uncode-more-items-loaded", function() {
13640				UNCODE.okvideo("uncode-more-items-loaded");
13641			});
13642		}
13643		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
13644			UNCODE.backgroundSelfVideos();
13645		}
13646		UNCODE.tapHover();
13647		if (typeof UNCODE.isotopeLayout !== 'undefined') {
13648			UNCODE.isotopeLayout();
13649		}
13650		if (typeof UNCODE.justifiedGallery !== 'undefined') {
13651			UNCODE.justifiedGallery();
13652		}
13653		if (typeof UNCODE.cssGrid !== 'undefined') {
13654			UNCODE.cssGrid();
13655		}
13656		if (typeof UNCODE.linearGrid !== 'undefined') {
13657			UNCODE.linearGrid();
13658		}
13659		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
13660			UNCODE.lightbox();
13661		}
13662		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
13663			$(window).on('load more-items-loaded',function(){
13664				UNCODE.lightgallery();
13665			});
13666		}
13667		if (typeof UNCODE.carousel !== 'undefined') {
13668			UNCODE.carousel($('body'));
13669		}
13670		if (typeof UNCODE.lettering !== 'undefined') {
13671			UNCODE.lettering();
13672		}
13673		UNCODE.animations();
13674		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
13675			UNCODE.stickyElements();
13676		}
13677		if (typeof UNCODE.twentytwenty !== 'undefined') {
13678			UNCODE.twentytwenty();
13679		}
13680		UNCODE.disableHoverScroll();
13681		UNCODE.printScreen();
13682		if (typeof UNCODE.particles !== 'undefined') {
13683			UNCODE.particles();
13684		}
13685		if (typeof UNCODE.filters !== 'undefined') {
13686			UNCODE.filters();
13687		}
13688		if (typeof UNCODE.ajax_filters !== 'undefined') {
13689			UNCODE.ajax_filters();
13690		}
13691		if (typeof UNCODE.widgets !== 'undefined') {
13692			UNCODE.widgets();
13693		}
13694		if (typeof UNCODE.unmodal !== 'undefined') {
13695			UNCODE.unmodal();
13696		}
13697		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
13698			if ( !UNCODE.isFullPage ) {
13699				UNCODE.checkScrollForTabs();
13700			}
13701		}
13702		if (typeof UNCODE.onePage !== 'undefined') {
13703			UNCODE.onePage(UNCODE.isMobile);
13704		}
13705		if (typeof UNCODE.fullPage !== 'undefined') {
13706			$(document).ready(function(){
13707				UNCODE.fullPage();
13708			});
13709		}
13710		if (typeof UNCODE.skewIt !== 'undefined') {
13711			UNCODE.skewIt();
13712		}
13713		if (typeof UNCODE.rotateIt !== 'undefined') {
13714			UNCODE.rotateIt();
13715		}
13716		if (typeof UNCODE.textMarquee !== 'undefined') {
13717			UNCODE.textMarquee();
13718		}
13719		if (typeof UNCODE.stickyScroll !== 'undefined') {
13720			UNCODE.stickyScroll();
13721		}
13722		if (typeof UNCODE.stickyTrigger !== 'undefined') {
13723			UNCODE.stickyTrigger();
13724		}
13725		if (typeof UNCODE.verticalText !== 'undefined') {
13726			UNCODE.verticalText();
13727		}
13728		if (typeof UNCODE.videoThumbs !== 'undefined') {
13729			UNCODE.videoThumbs();
13730		}
13731		if (typeof UNCODE.revslider !== 'undefined') {
13732			UNCODE.revslider();
13733		}
13734		if (typeof UNCODE.layerslider !== 'undefined') {
13735			UNCODE.layerslider();
13736		}
13737		if (typeof UNCODE.lottie !== 'undefined') {
13738			UNCODE.lottie();
13739		}
13740		if (typeof UNCODE.inlineImgs !== 'undefined') {
13741			UNCODE.inlineImgs();
13742		}
13743		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
13744			UNCODE.animatedBgGradient();
13745		}
13746		if (typeof UNCODE.readMoreCol !== 'undefined') {
13747			UNCODE.readMoreCol();
13748		}
13749		if (typeof UNCODE.multibg !== 'undefined') {
13750			UNCODE.multibg();
13751		}
13752		if (typeof UNCODE.flexEqual !== 'undefined') {
13753			UNCODE.flexEqual();
13754		}
13755		$(window).on('load',function(){
13756			clearRequestTimeout(waypoint_request);
13757			waypoint_request = requestTimeout( function(){
13758				Waypoint.refreshAll();
13759			}, 1000);
13760		});
13761		$(window).one('load',function(){
13762			if (typeof UNCODE.parallax !== 'undefined') {
13763				UNCODE.parallax();
13764			}
13765		});
13766	}
13767
13768	if ( ! SiteParameters.is_frontend_editor ) {
13769		UNCODE.init();
13770	}
13771
13772
13773})(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.