PageSourceSearch

https://johnviscardi.com/wp-content/themes/MLS-theme/library/js/app.js?ver=1173188535

js johnviscardi.com collected 2026-09-24 13:34:07 UTC 500,923 bytes, 15,025 lines download raw bytes

1/* ----------------------------------------------------------
2 * Uncode App
3 * ---------------------------------------------------------- */
4
5(function($) {
6	"use strict";
7	var UNCODE = window.UNCODE || {};
8	window.UNCODE = UNCODE;
9
10	window.requestAnimFrame = (function() {
11	return  window.requestAnimationFrame	   ||
12			window.webkitRequestAnimationFrame ||
13			window.mozRequestAnimationFrame	||
14			window.oRequestAnimationFrame	  ||
15			window.msRequestAnimationFrame	 ||
16			function(/* function */ callback, /* DOMElement */ element){
17				window.setTimeout(callback, 1000 / 60);
18			};
19})();
20
21window.requestTimeout = function(fn, delay) {
22	if( !window.requestAnimationFrame	  	&&
23		!window.webkitRequestAnimationFrame &&
24		!(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support
25		!window.oRequestAnimationFrame	  &&
26		!window.msRequestAnimationFrame)
27			return window.setTimeout(fn, delay);
28
29	var start = new Date().getTime(),
30		handle = new Object();
31
32	function loop(){
33		var current = new Date().getTime(),
34			delta = current - start;
35
36		delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop);
37	};
38
39	handle.value = requestAnimFrame(loop);
40	return handle;
41};
42
43window.clearRequestTimeout = function(handle) {
44	if ( typeof handle !== 'undefined' ) {
45		window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
46		window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) :
47		window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */
48		window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
49		window.oCancelRequestAnimationFrame	? window.oCancelRequestAnimationFrame(handle.value) :
50		window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) :
51		clearTimeout(handle);
52	}
53};
54
55function uncodeVisibilityChange() {
56	if (document.hidden) {
57		window.dispatchEvent(new CustomEvent('is-blur'));
58	} else {
59		window.dispatchEvent(new CustomEvent('is-focus'));
60	}
61  }
62document.addEventListener('visibilitychange', uncodeVisibilityChange, false);
63
64if ( SiteParameters.smoothScroll === 'on' && ! SiteParameters.is_frontend_editor ) {
65	window.lenis = new Lenis({
66		duration: 1
67	})
68
69	UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
70		document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
71
72	function raf(time) {
73		window.lenis.raf(time)
74		requestAnimationFrame(raf)
75		window.dispatchEvent(new CustomEvent('lenis-scroll'));
76
77		if ( SiteParameters.uncode_smooth_scroll_safe ) {
78			var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
79				document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
80			
81			if ( UNCODE.hDoc !== newHdoc ) {
82				UNCODE.hDoc = newHdoc;
83				window.lenis.resize();
84				//window.dispatchEvent(new CustomEvent('boxResized'));
85			}
86		}
87	}
88
89	requestAnimationFrame(raf)
90
91	$(window).on('unmodal-open', function(){
92		window.lenis.stop();
93	});
94
95	$(document).on('unmodal-close', function(){
96		window.lenis.start();
97	});
98
99}
100
101var checkScrollTriggerRefresh;
102$(function(){
103	$(document).on('uncode-scrolltrigger-refresh', function(){
104		clearRequestTimeout(checkScrollTriggerRefresh);
105		checkScrollTriggerRefresh = requestTimeout(function(){
106			ScrollTrigger.refresh();
107		}, 500);
108	});
109});
110
111UNCODE.checkImgLoad = function( src, cb, err, el ) {
112	var img = new Image();
113	img.onload = function () {
114		var result = (img.width > 0) && (img.height > 0);
115		cb(el);
116	};
117	img.onerror = function () {
118		err();
119	};
120	img.src = src
121};
122
123UNCODE.betterResize = function() {
124	var setResize,
125		doubleResize = true,
126		oldW = UNCODE.wwidth,
127		oldH = UNCODE.wheight,
128		setCTA;
129	$(window).on( 'resize orientationchange', function(){
130		if ( oldW === UNCODE.wwidth ) {
131			return;
132		} else {
133			oldW = UNCODE.wwidth;
134			$(window).trigger('wwResize');
135		}
136
137		if ( oldH === UNCODE.wheight ) {
138			return;
139		} else {
140			oldH = UNCODE.wheight;
141			$(window).trigger('whResize');
142		}
143	});
144
145	$(window).on( 'resize orientationchange', function(){
146		clearRequestTimeout(setCTA);
147		setCTA = requestTimeout( function(){ $(window).trigger('resize-int'); }, 100 );
148	});
149};
150
151UNCODE.shuffle = function(array) {
152	var currentIndex = array.length,
153		randomIndex;
154  
155	while (currentIndex > 0) {
156		randomIndex = Math.floor(Math.random() * currentIndex);
157		currentIndex--;
158		[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
159	}
160  
161	return array;
162};
163
164Number.isInteger = Number.isInteger || function(value) {
165    return typeof value === "number" &&
166           isFinite(value) &&
167           Math.floor(value) === value;
168};
169
170UNCODE.utils = function() {
171	$(document).on('mouseover', 'a', function () {
172		if (!$(this).hasClass('star')) {
173			$(this).attr('data-title', $(this).attr('title'));
174			$(this).removeAttr('title');
175		}
176	});
177	$(document).on('mouseout', 'a', function () {
178		if (!$(this).hasClass('star')) {
179			$(this).attr('title', $(this).attr('data-title'));
180			$(this).removeAttr('data-title');
181		}
182	});
183
184	this.get_scroll_offset = function(e) {
185
186		var scroll_offset = 0,
187			target,
188			trigger;
189
190		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
191			target = e.target;
192			trigger = e.currentTarget;
193		}
194
195		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
196			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
197				UNCODE.hideMenu(100);
198			}
199		}
200
201		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) {
202			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
203			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
204				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) {
205					if ( !$('.menu-hided').length ) {
206						if ( $('body').hasClass('hmenu-center') ) {
207							scroll_offset += ~~$('.menu-sticky .menu-container').outerHeight();
208						} else {
209							scroll_offset += ~~$('.logo-container:visible').outerHeight();
210						}
211					}
212				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
213					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
214					scroll_offset += (~~$('.menu-sticky .menu-container').outerHeight()) - ( $('.navbar-brand').data('minheight') + shrink );
215				} else {
216					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
217						scroll_offset += UNCODE.menuMobileHeight;
218					} else {
219						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 ) {
220							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
221						} else {
222							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
223								scroll_offset += UNCODE.menuMobileHeight;
224							}
225						}
226					}
227				}
228			}
229
230		}
231
232		scroll_offset += UNCODE.bodyBorder;
233
234		return scroll_offset;
235	}
236
237	if ( !UNCODE.isFullPage ) {
238		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
239
240			var hash = (e.currentTarget).hash,
241			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
242			anchor = '';
243			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
244			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
245				e.preventDefault();
246				if (!$('#tab-reviews').is(':visible')) {
247					$('a[href="#tab-reviews"]').trigger('click');
248				}
249				var calc_scroll = $('.wootabs .tab-content').offset().top;
250				calc_scroll -= UNCODE.get_scroll_offset(e);
251
252				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
253					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
254
255					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
256						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
257					}
258				}
259
260				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
261					delta = bodyTop - calc_scroll,
262					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
263				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
264
265				requestTimeout(function(){
266					if (scrollSpeed == 0) {
267						$('html, body').scrollTop(calc_scroll);
268						UNCODE.scrolling = false;
269					} else {
270   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
271							$(this).stop();
272						}).animate({
273								scrollTop: calc_scroll
274							}, scrollSpeed, 'easeInOutCubic', function() {
275								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
276								UNCODE.scrolling = false;
277							}
278						);
279					}
280				}, 200);
281				return;
282			}
283			if (hash != undefined) {
284				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
285				var anchor = this.hash.slice(1);
286				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
287			  		if ( !specialFormat.test(hash) ) {
288			  			if ( $(hash).length )
289			  				anchor = $(hash);
290			  		}
291				}
292			}
293
294			if (is_scrolltop || anchor != '') {
295				if (is_scrolltop) {
296					e.preventDefault();
297					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
298					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
299					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
300
301					if (scrollSpeed == 0) {
302						$('html, body').scrollTop(0);
303						UNCODE.scrolling = false;
304					} else {
305   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
306							$(this).stop();
307						}).animate({
308							scrollTop: 0
309						}, scrollSpeed, 'easeInOutCubic', function() {
310							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
311							UNCODE.scrolling = false;
312						});
313					}
314				} else {
315					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
316					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
317						var get_href = $(val).attr('href');
318						if (get_href != undefined) {
319							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
320							else $(val).parent().removeClass('active');
321						}
322					});
323					if (scrollSection.length) {
324						if ( $('body').hasClass('uncode-scroll-no-history') ) {
325							e.preventDefault();
326						}
327
328						if (UNCODE.menuOpened) {
329							if (UNCODE.wwidth < UNCODE.mediaQuery) {
330								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
331							} else {
332								$('.mmb-container-overlay .overlay-close').trigger('click');
333								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
334							}
335						}
336
337						var calc_scroll = scrollSection.offset().top,
338							getOffset = UNCODE.get_scroll_offset(e),
339							$logo = $('.logo-container:visible'),
340							logoH,
341							$menu = $('#masthead .menu-container'),
342							menuH;
343
344						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
345
346						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
347							delta = bodyTop - calc_scroll,
348							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
349						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
350
351						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
352							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
353								logoH = $logo.outerHeight(),
354								menuH = $menu.outerHeight();
355								if ( calc_scroll < ( logoH + menuH ) ) {
356									calc_scroll = 0;
357								}
358							}
359						}
360
361						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
362							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
363						}
364
365						if (scrollSpeed == 0) {
366							$('html, body').scrollTop(calc_scroll);
367							UNCODE.scrolling = false;
368						} else {
369	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
370								$(this).stop();
371							}).animate({
372								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
373							}, scrollSpeed, 'easeInOutCubic', function() {
374								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
375								UNCODE.scrolling = false;
376								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
377								||
378								$('.menu-hided').length ) {
379									calc_scroll = scrollSection.offset().top;
380									getOffset = UNCODE.get_scroll_offset(e);
381									calc_scroll -= getOffset;
382									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
383										$(this).stop();
384									}).animate({
385										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
386										}, scrollSpeed, 'easeInOutCubic', function() {
387											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
388											UNCODE.scrolling = false;
389										}
390									);
391								}
392							});
393						}
394					}
395				}
396			}
397		});
398		$('.header-scrolldown').on('click', function(event) {
399
400			event.preventDefault();
401
402			var pageHeader = $(event.target).closest('#page-header'),
403				pageHeaderTop = pageHeader.offset().top,
404				pageHeaderHeight = pageHeader.outerHeight(),
405				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
406			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
407
408			var calc_scroll = pageHeaderTop + pageHeaderHeight,
409			getOffset = UNCODE.get_scroll_offset(event);
410			calc_scroll -= getOffset;
411
412			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
413				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
414
415				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
416					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
417				}
418			}
419
420			if (scrollSpeed == 0) {
421				$('html, body').scrollTop(calc_scroll);
422				UNCODE.scrolling = false;
423			} else {
424					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
425						$(this).stop();
426					}).animate({
427						scrollTop: calc_scroll
428					}, scrollSpeed, 'easeInOutCubic', function() {
429						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
430						UNCODE.scrolling = false;
431						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
432							calc_scroll = pageHeaderTop + pageHeaderHeight;
433							getOffset = UNCODE.get_scroll_offset(event);
434							calc_scroll -= getOffset;
435								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
436									$(this).stop();
437								}).animate({
438									scrollTop: calc_scroll
439								}, scrollSpeed, 'easeInOutCubic', function() {
440									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
441									UNCODE.scrolling = false;
442								}
443							);
444						}
445					}
446				);
447			}
448		});
449	}
450
451	// Colomun hover effect
452	// =================
453	$(document).on('mouseenter', '.col-link', function(e) {
454		var uncol = $(e.target).prev('.uncol'),
455		el = uncol.find('.column-background');
456		if (el) {
457			$('.btn-container .btn', uncol).addClass('active');
458			var elOverlay = $(el[0]).find('.block-bg-overlay');
459			if (elOverlay.length) {
460				var getOpacity = $(elOverlay).css('opacity');
461				if (getOpacity != 1) {
462					getOpacity = Math.round(getOpacity * 100) / 100;
463					var newOpacity = getOpacity + .1;
464					$(elOverlay).data('data-opacity', getOpacity);
465					$(elOverlay).css('opacity', newOpacity);
466				}
467			}
468		}
469	}).on('mouseleave', '.col-link', function(e) {
470		var uncol = $(e.target).prev('.uncol'),
471		el = uncol.find('.column-background');
472		$('.btn-container .btn', uncol).removeClass('active');
473		if (el) {
474			var elOverlay = $(el[0]).find('.block-bg-overlay');
475			if (elOverlay.length) {
476				var getOpacity = $(elOverlay).data('data-opacity');
477				$(elOverlay).css('opacity', getOpacity);
478			}
479		}
480	});
481
482	// Admin bar
483	// ============
484	var fixAdminBar = function() {
485		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
486			var getAdminBar = $('#wpadminbar');
487			if (getAdminBar.length) {
488				if (getAdminBar.css('position') !== 'hidden') {
489					var getAdminBarHeight = getAdminBar.height();
490					if (getAdminBar.css('position') === 'fixed') {
491						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
492						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
493					} else {
494						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
495						$('.body-borders .top-border').css({'margin-top':'0px'});
496					}
497				}
498			}
499		}
500	};
501	window.addEventListener('load', fixAdminBar);
502	window.addEventListener('resize', fixAdminBar);
503	// Print
504	// ===========
505	var beforePrint = function() {
506		window.dispatchEvent(new CustomEvent('resize'));
507		window.dispatchEvent(UNCODE.boxEvent);
508	};
509
510	if (window.matchMedia) {
511		var mediaQueryList = window.matchMedia('print');
512		mediaQueryList.addListener(function(mql) {
513			if (mql.matches) {
514				beforePrint();
515			}
516		});
517	}
518
519	window.onbeforeprint = beforePrint;
520
521	// Safari srcset
522	var safariSrcSet = function(){
523		if ( !SiteParameters.is_frontend_editor ) {
524			$('html.safari img[sizes]').each(function(){
525				var $img = $(this),
526					sizeImg = parseInt($img.attr('sizes'));
527				if ( typeof(sizeImg) === 'number' ) {
528					$img.attr('sizes', (sizeImg) + 'px');
529				}
530			});
531		}
532	};
533	window.addEventListener('load', safariSrcSet);
534}
535
536UNCODE.lettering = function() {
537
538	var setCTA;
539	var highlightStill = function(){
540
541		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
542
543		$.each($heading_texts, function(key, el) {
544			var $heading = $(el);
545
546			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
547				return;
548			}
549
550			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
551				return;
552			}
553
554			var waypoint = new Waypoint({
555				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
556				element: el,
557				handler: function() {
558					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
559						anims_l = $anims.length;
560					$anims.each(function(_key_, _el_){
561						var $anim = $(_el_);
562
563						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
564							$anim.addClass('heading-text-highlight-animated');
565
566							if ( $heading.data('animate') === true ) {
567								$anim.css({
568									'-webkit-transition-duration': '0ms',
569									'-moz-transition-duration': '0ms',
570									'-o-transition-duration': '0ms',
571									'transition-duration': '0ms',
572								});
573							} else {
574								$anim.css({
575									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
576									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
577									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
578									'transition-delay': ((_key_ + 2) * 200) + 'ms',
579								});
580							}
581						}
582
583					});
584					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
585						$heading.data('animate', true);
586					});
587					$anims.removeAttr('data-animated');
588				},
589				offset: '100%'
590			});
591
592		});
593
594		Waypoint.refreshAll();
595		$( document.body ).trigger('uncode_waypoints');
596		if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
597			$(document).trigger('uncode-scrolltrigger-refresh');
598		}
599
600	}
601
602	requestTimeout(function(){
603		highlightStill();
604		$(window).on( 'wwResize', function(){
605			clearRequestTimeout(setCTA);
606			setCTA = requestTimeout( highlightStill, 100 );
607		});
608	}, 400);
609
610};
611
612UNCODE.isUnmodalOpen = false;
613
614var manageVideoSize = function(){
615
616	var setVideoFit;
617	$('.wp-block-embed').each(function(){
618
619		var $this = $(this);
620
621		if ( $('iframe', $this).length ) {
622
623			var $iframe = $('> iframe, > a > iframe', $this),
624				w = parseFloat($iframe.attr('width')),
625				h = parseFloat($iframe.attr('height')),
626				url = $iframe.attr('src'),
627				ratio, frW;
628
629			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
630
631				ratio = h / w;
632				var setResizeiFto,
633					resizeiFrame = function(){
634					frW = $iframe.width();
635					$iframe.css({
636						height: frW * ratio
637					});
638				};
639				resizeiFrame();
640				$(window).on( 'wwResize load', function(){
641					clearRequestTimeout(setResizeiFto);
642					setResizeiFto = requestTimeout( function() {
643						resizeiFrame();
644					}, 10 );
645				});
646
647			}
648
649		}
650
651	});
652
653};
654
655manageVideoSize();
656
657UNCODE.vivus = function(icon, time, delay, file) {
658	if (typeof Vivus !== 'undefined') {
659		var icon_options = {
660			type: 'delayed',
661			pathTimingFunction: Vivus.EASE_OUT,
662			animTimingFunction: Vivus.LINEAR,
663			duration: time,
664		}
665
666		if (delay) {
667			icon_options.delayStart = delay;
668		}
669
670		if (file) {
671			icon_options.file = file;
672		}
673
674		new Vivus(icon, icon_options);
675	}
676};
677
678UNCODE.lastURL = '';
679
680UNCODE.getURLParams = function(current_location, is_string) {
681	var params = {};
682	if (is_string) {
683		var url = current_location.split('?')[1];
684	} else {
685		var url = current_location.search;
686		url = url.substring(1);
687	}
688	if (url) {
689		var parts = url.split('&');
690		for (var i = 0; i < parts.length; i++) {
691			var nv = parts[i].split('=');
692			if (!nv[0]) {
693				continue;
694			}
695			params[nv[0]] = nv[1] || true;
696		}
697	}
698	return params;
699}
700
701UNCODE.hasEqualURLParams = function(obj1, obj2) {
702	for (var i in obj1) {
703		if (obj1.hasOwnProperty(i)) {
704			if (!obj2.hasOwnProperty(i)) {
705				return false;
706			}
707			if (obj1[i] != obj2[i]) {
708				return false;
709			}
710		}
711	}
712	for (var i in obj2) {
713		if (obj2.hasOwnProperty(i)) {
714			if (!obj1.hasOwnProperty(i)) {
715				return false;
716			}
717			if (obj1[i] != obj2[i]) {
718				return false;
719			}
720		}
721	}
722    return true;
723}
724
725UNCODE.magnetic = function(){
726	
727	$(document).on('mousemove', '.un-magnetic-zone', function(e){
728
729		var $zone = $(this),
730			zoneOff = $zone.offset(),
731			$mgntcEl = $('.un-magnetic-el', this),
732			elBound = this.getBoundingClientRect(),
733			maxSize = Math.max($zone.outerWidth(), $zone.outerHeight());
734
735		var Xvalue = e.pageX - (zoneOff.left + maxSize / 2),
736	  		Yvalue = e.pageY - (zoneOff.top + maxSize / 2);
737	  
738		$mgntcEl.each(function(key, val){
739			var magneticValue = $(val).attr('data-mgntc') || 0.5;
740		
741			val.animate({
742				transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)',
743			},{
744				duration: 500,
745				fill: 'forwards',
746			})
747	  	});
748	})
749	
750	$(document).on('mouseleave', '.un-magnetic-zone', function(e){
751		var $mgntcEl = $('.un-magnetic-el', this);
752
753		$mgntcEl.each(function(key, val){
754			val.animate({
755		  		transform: 'translate(0)',
756			},{
757		  		duration: 500,
758		  		fill: 'forwards',
759			})
760	  	});
761	})
762};
763
764UNCODE.rowParallax = function(){
765
766	if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) {
767		return;
768	}
769
770	var $rows = $('.parallax-move'),
771		stableHeight = UNCODE.wheight;
772	$rows.each(function(){
773		var $row = $(this),
774			_row = $row[0],
775			dataMove = $row.attr('data-parallax-move'),
776			dataSafe = $row.attr('data-parallax-safe'),
777            rowInViewport = false,
778			trans;
779
780		if ( $row.find('.parallax-move').length ) {
781			return;
782		}
783
784		dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe;
785		dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove;           
786        dataMove = dataMove / 10;
787
788        if ( 'IntersectionObserver' in window ) {
789			var observer = new IntersectionObserver(function(entries) {
790	
791				entries.forEach(function(entry){
792					if ( entry.isIntersecting ) {
793						rowInViewport = true;
794					} else {
795						rowInViewport = false;
796					}
797				});
798	
799			}, { 
800				root: document,
801			});
802	
803			observer.observe(_row);
804		} else {
805            rowInViewport = true;
806		}
807
808		var loopRAF = function() {
809			if( rowInViewport ) {
810				var bound = _row.getBoundingClientRect(),
811					bound_top = bound.top,
812					bound_height = bound.height,
813					move = true,
814					scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
815					docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
816						document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ),
817					fromBottom = docH - (scrolled + bound_top + bound_height);
818
819                if ( bound_height > stableHeight && dataSafe === 'yes' ) {
820                    $row.find('>div').css({
821                        'transform':'none'
822                    });
823                    move = false;
824				}
825
826				if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) {
827					$row.find('>div').css({
828						'transform':'none'
829					});
830					move = false;
831				}
832
833				if ( move ) {
834
835					if ( fromBottom < stableHeight ) {
836						//maybe Footer
837						trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove);
838                    } else if ( scrolled + bound_top < stableHeight ) {
839						//maybe Header
840						trans = scrolled*(dataMove);
841					} else {
842						trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove);
843					}
844
845                    $row.find('>div').css({
846                        'transform':'translateY(' + (trans) + 'px) translateZ(0)',
847                    });
848                }
849			}
850	
851			requestAnimationFrame(loopRAF);
852		};
853		
854		requestAnimationFrame(loopRAF);
855
856	});
857
858	$(window).on( 'load resize', function(e) {
859		if ( ! UNCODE.isMobile ) {
860			stableHeight = UNCODE.wheight;
861		}
862	});
863
864	$(window).on( 'load wwResize', function(e) {
865		if ( UNCODE.isMobile ) {
866			stableHeight = UNCODE.wheight;
867		}
868	});
869
870}
871
872UNCODE.changeSkinOnScroll = function(){
873	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
874		return;
875	}
876	var $masthead = $('#masthead'),
877		transDesktop,
878		transMobile,
879		changeSkin,
880
881	checkTransparencyAndChange = function( $col ){
882		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
883		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
884		changeSkin = $masthead.hasClass('menu-change-skin');
885
886		if ( ! transDesktop && ! transMobile ) {
887			return false;
888		}
889
890		if ( ! changeSkin ) {
891			return false;
892		}
893
894		if ( $col.hasClass('style-light') ){
895			$masthead.removeClass('style-dark-override').addClass('style-light-override');
896			return false;
897		} else if ( $col.hasClass('style-dark') ) {
898			$masthead.removeClass('style-light-override').addClass('style-dark-override');
899			return false;
900		}
901	};
902
903	var prev_row = 'normal',
904		odd = true,
905		$rows = $('.vc_row[data-parent]:visible');
906	$.each($rows, function(index, row){
907		var $row = $(row),
908			$col = $('.uncol', $row).first(),
909			$slider = $('.uncode-slider', $row);
910
911		var wayDown = new Waypoint({
912			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
913			element: row,
914			handler: function(direction) {
915				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
916					if ( $slider.length ) {
917						$col = $('.owl-item.index-active .uncol', $slider).first();
918					}
919					checkTransparencyAndChange($col);
920				}
921				if ( odd === false ) {
922					if ( row.hasAttribute('data-bg-changer') ) {
923						prev_row = 'bg-changer';
924					} else {
925						prev_row = 'normal';
926					}
927					odd = true;
928				} else {
929					odd = false;
930				}
931			},
932			offset: function() {
933				return UNCODE.menuHeight / 2
934			}
935		});
936		var wayUp = new Waypoint({
937			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
938			element: row,
939			handler: function(direction) {
940				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
941					if ( $slider.length ) {
942						$col = $('.owl-item.index-active .uncol', $slider).first();
943					}
944					checkTransparencyAndChange($col);
945				}
946				if ( odd === false ) {
947					if ( row.hasAttribute('data-bg-changer') ) {
948						prev_row = 'bg-changer';
949					} else {
950						prev_row = 'normal';
951					}
952					odd = true;
953				} else {
954					odd = false;
955				}
956			},
957			offset: function() {
958				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
959			}
960		});
961	});
962
963};
964
965UNCODE.share = function() {
966	if (typeof Share !== 'undefined') {
967		var share_button_element = $('.share-button');
968		var share_button_url = share_button_element.data('url');
969
970		var share_button_config = {
971			ui: {
972				flyout: "top center",
973				button_font: false,
974				button_text: '',
975				icon_font: false
976			}
977		};
978
979		if (share_button_url) {
980			share_button_config.url = share_button_url.replace("&", "%26");
981		}
982
983		var share_button_top = new Share('.share-button', share_button_config);
984
985		$('li[data-network]', share_button_element).each(function(){
986			var label = SiteParameters.uncode_share_label,
987				network = $(this).attr('data-network');
988			label = label.replace("%", network);
989			$(this).attr('aria-label', label);
990		});
991	}
992};
993
994UNCODE.tooltip = function() {
995	if (typeof jQuery.fn.tooltip !== 'undefined') {
996		$('.btn-tooltip').tooltip();
997	}
998};
999
1000UNCODE.counters = function() {
1001	var $counters = $('.uncode-counter:not(.counter-init)');
1002	$counters.each(function(){
1003		var $counter = $(this).addClass('counter-init');
1004		if ( SiteParameters.is_frontend_editor ) {
1005			$counter.addClass('started');
1006		}
1007		if ( $counter.closest( '.owl-carousel' ).length ) {
1008			return;
1009		}
1010		$counter.addClass('started').counterUp({
1011			delay: 10,
1012			time: 1500
1013		});
1014	});
1015};
1016
1017UNCODE.countdowns = function() {
1018	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
1019	$countdowns.each(function() {
1020		var $this = $(this).addClass('counter-init'),
1021			finalDate = $(this).data('uncode-countdown');
1022		$this.countdown(finalDate, function(event) {
1023			$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>'));
1024		});
1025	});
1026};
1027
1028UNCODE.tabs = function() {
1029
1030	var tabSwitcher = function($el){
1031		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1031ical):not(.tab-switch)', $el).each(function(key, value){
1032			var $navs = $(value),
1033				$active = $('li.active', $navs),
1034				$active_a = $('> a', $active),
1035				$active_span = $('> span', $active_a),
1036				vertical = $navs.closest('.vertical-tab-menu').length;
1037			
1038			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
1039				$navs.append('<span class="switcher-cursor" aria-hidden="true" tabindex="-1" />');
1040			}
1041
1042			var $cursor = $('.switcher-cursor', $navs),
1043				active_w = $('a', $active).outerWidth(),
1044				span_w = $active_span.outerWidth(),
1045				active_pos = $active.position(),
1046				active_a_pos = $active_a.position(),
1047				span_pos = $active_span.position(),
1048				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
1049				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
1050
1051			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
1052
1053			if ( ! vertical ) {
1054				$cursor.css({
1055					left: cursor_left,
1056					width: cursor_w
1057				});
1058			}
1059
1060			$navs.addClass('switch-init');
1061		});
1062	};
1063
1064	var $body = $('body');
1065	tabSwitcher($body);
1066
1067	var tabHoverIntent = function(){
1068		var setHover;
1069		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
1070			.on('mouseover', function(e){
1071				var $this = $(e.target);
1072				setHover = requestTimeout(function() {
1073					$this.trigger('hover-int');
1074				}, 50);
1075			})
1076			.on('mouseout', function(){
1077				clearRequestTimeout(setHover);
1078			});
1079	};
1080	tabHoverIntent();
1081
1082	var tabInit = function(){
1083		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
1084			e.preventDefault()
1085			var $el = $(this);
1086			$el.tab('show');
1087			var $container = $el.closest('.uncode-tabs');
1088			tabSwitcher($container);
1089			requestTimeout(function() {
1090				window.dispatchEvent(UNCODE.boxEvent);
1091				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
1092
1093				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
1094					window.dispatchEvent(new CustomEvent('boxResized'));
1095				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
1096					window.dispatchEvent(new Event('resize'));
1097					$(window).trigger('uncode.re-layout');
1098				} 
1099
1100				var $active_panel = $('.tab-pane.active', $tabs);
1101
1102				$.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) {
1103					var element = $(val),
1104						delayAttr = element.attr('data-delay');
1105					if (delayAttr == undefined) delayAttr = 0;
1106					requestTimeout(function() {
1107						element.addClass('start_animation');
1108					}, delayAttr);
1109				});
1110
1111			}, 300);
1112
1113			var $li = $el.closest('li'),
1114				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1115			$('li', $container).not($li).find('.tab-pane').slideUp(250)
1116			$('.tab-pane', $li).slideDown(250);
1117			var completeSlideDown = requestTimeout(function(){
1118				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
1119					var pos = $el.offset(),
1120						rect = $el[0].getBoundingClientRect(),
1121						$masthead = $('#masthead > .menu-container'),
1122						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
1123
1124					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
1125						$('html, body').animate({
1126							scrollTop: ( pos.top ) - considerMenu
1127						},{
1128							easing: 'easeInOutQuad',
1129							duration: 250
1130						});
1131					}
1132				}
1133			}, 260);
1134		});
1135	}
1136	tabInit();
1137
1138	var tabResponsive = function(){
1139		if ( SiteParameters.is_frontend_editor ) {
1140			return true;
1141		}
1142		var $tabContainers = $('.tab-container.tabs-breakpoint');
1143		$tabContainers.each(function(){
1144			var $tabContainer = $(this),
1145				$tabContent = $('.tab-content', $tabContainer),
1146				$nav = $('.nav-tabs', $tabContainer),
1147				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
1148
1149			$('> li', $nav).each(function(){
1150				var $li = $(this),
1151					dataID = $li.attr('data-tab-id');
1152
1153				if ( UNCODE.wwidth <= mQuery ) {
1154					if ( ! $('.tab-pane', $li ).length ) {
1155						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
1156						$tabContainer.addClass('tabs-appended');
1157						$li.append($append_pane);
1158					}
1159
1160					if ( $li.hasClass('active') ) {
1161						$('> a', $li).click();
1162					}
1163				} else {
1164					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
1165						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
1166						$tabContainer.removeClass('tabs-appended');
1167						$tabContent.prepend($append_pane.removeAttr('style'));
1168					}
1169				}
1170			});
1171		});
1172
1173	}
1174	tabResponsive();
1175
1176	$(window).on('wwResize', function(){
1177		tabHoverIntent();
1178		tabSwitcher($body);
1179	});
1180
1181	var setCTA;
1182	$(window).on( 'resize', function(){
1183		clearRequestTimeout(setCTA);
1184		setCTA = requestTimeout( tabResponsive, 100 );
1185	});
1186
1187	$('.nav-tabs').each(function(){
1188		var $nav = $(this),
1189			$lis = $('> li:not(.active)', $nav),
1190			$links = $('.tab-excerpt-link', $nav);
1191		$('.tab-excerpt', $lis).slideUp(400, function(){
1192			$(this).addClass('init');
1193		});
1194
1195		$links.each(function(){
1196			var $link = $(this),
1197				$par_a = $link.closest('a'),
1198				href = $link.attr('data-href'),
1199				target = $link.attr('data-target');
1200			$par_a.addClass('inner-link');
1201			$link.on('click', function(){
1202				var _link = document.createElement('a');
1203				_link.href = href;
1204				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1205				_link.click();
1206			});
1207		});
1208		$nav.addClass('tab-init');
1209	});
1210
1211	$('.uncode-tabs.tabs-no-lazy').each(function(){
1212		var $tabs = $(this),
1213			$panes = $('.tab-pane:not(.active)', $tabs);
1214		$panes.each(function(){
1215			var $pane = $(this),
1216				$imgs = $('img[loading="lazy"]', $pane);
1217			$imgs.removeAttr('loading');
1218			$imgs.removeAttr('decoding');
1219		});
1220	});
1221
1222};
1223UNCODE.collapse = function() {
1224	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1225		var $this = $(this),
1226			href
1227		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1228		var $target = $(target)
1229		var parent = $this.attr('data-parent')
1230		var $parent = parent && $(parent)
1231		var $title = $(this).parent()
1232		var $accordion = $(e.target).closest('.uncode-accordion')
1233		var $group = $this.closest('.group')
1234		var $panel_group = $this.closest('.panel-group')
1235		if ($parent) {
1236			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1237			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1238				$title.removeClass('active');
1239				$group.removeClass('active-group');
1240			} else {
1241				if ( $panel_group.attr('data-no-toggle') != true ) {
1242					$parent.find('.panel-title').removeClass('active')
1243					$parent.find('.group').removeClass('active-group')
1244				}
1245				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1246				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1247			}
1248		}
1249		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1250		requestTimeout(function() {
1251			var $accordion = $(e.target).closest('.uncode-accordion');
1252			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1253			  window.dispatchEvent(new CustomEvent('boxResized'));
1254			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1255				window.dispatchEvent(new Event('resize'));
1256				$(window).trigger('uncode.re-layout');
1257			} 
1258
1259			var $active_panel = $('.panel.active-group', $parent);
1260
1261			$.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) {
1262				var element = $(val),
1263					delayAttr = element.attr('data-delay');
1264				if (delayAttr == undefined) delayAttr = 0;
1265				requestTimeout(function() {
1266					element.addClass('start_animation');
1267				}, delayAttr);
1268			});
1269
1270		}, 500);
1271	});
1272
1273	$('.uncode-accordion.tabs-no-lazy').each(function(){
1274		var $accordion = $(this),
1275			$panes = $('.panel:not(.active-group)', $accordion);
1276		$panes.each(function(){
1277			var $pane = $(this),
1278				$imgs = $('img[loading="lazy"]', $pane);
1279			$imgs.removeAttr('loading');
1280			$imgs.removeAttr('decoding');
1281		});
1282	});
1283};
1284
1285UNCODE.accessibility = function() {
1286    if ( ! SiteParameters.uncode_is_accessible ) {
1287        return;
1288    }
1289
1290    //
1291
1292};
1293UNCODE.bigText = function(el) {
1294	var bigTextLaunch = function(){
1295		if (el == undefined) {
1296			el = $('body');
1297		}
1298		$.each($('.bigtext', el), function(index, val) {
1299			$(val).bigtext({
1300				minfontsize: 24
1301			});
1302			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1303				opacity: 1
1304			});
1305			requestTimeout(function() {
1306				if ($(val).find('.animate_when_almost_visible').length != 0) {
1307					$(val).css({opacity: 1});
1308				}
1309			}, 400);
1310		});
1311	};
1312
1313	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1314		bigTextLaunch();
1315	}
1316	$(window).on( 'load', bigTextLaunch );
1317};
1318
1319UNCODE.process_shortpixel_image = function(image) {
1320	var data = {
1321		action: 'shortpixel_manual_optimization',
1322		image_id: image,
1323		cleanup: true
1324	};
1325
1326	$.get(SiteParameters.ajax_url, data);
1327};
1328
1329UNCODE.menuSystem = function() {
1330
1331	function menuMobile() {
1332		var $body = $('body'),
1333			scrolltop,
1334			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'),
1335			$masthead = $('#masthead'),
1336			$box,
1337			$el,
1338			$el_transp,
1339			elHeight,
1340			offCanvasAnim,
1341			check,
1342			animating = false,
1343			stickyMobile = false,
1344			menuClose = new CustomEvent('menuMobileClose'),
1345			menuOpen = new CustomEvent('menuMobileOpen');
1346		UNCODE.menuOpened = false;
1347		$mobileToggleButton.on('click', function(event) {
1348			event.stopPropagation();
1349			var btn = this;
1350			if ($(btn).hasClass('overlay-close')) return;
1351			event.preventDefault();
1352			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1353			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1354				$box = $(this).closest('.box-container').find('.main-menu-container');
1355				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
1356				$el_transp = $('.menu-absolute.menu-transparent');
1357				if (UNCODE.isMobile) {
1358					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 ) {
1359						stickyMobile = true;
1360						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1361					} else {
1362						elHeight = 0;
1363						$.each($box.find('> div'), function(index, val) {
1364							elHeight += $(val).outerHeight();
1365						});
1366					}
1367				} else {
1368					elHeight = 0;
1369					$.each($el, function(index, val) {
1370						elHeight += $(val).outerHeight();
1371					});
1372				}
1373				var open = function() {
1374					clearTimeout(offCanvasAnim);
1375					if (!animating) {
1376						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1377						scrolltop = $(window).scrollTop();
1378						window.dispatchEvent(menuOpen);
1379						animating = true;
1380						UNCODE.menuOpened = true;
1381						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1382							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1383								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1384							}
1385							if ($('body.menu-offcanvas').length) {
1386								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1387								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1388							} else {
1389								if ( $('.menu-hide, .menu-sticky').length ) {
1390									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1391										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1392									}
1393								}
1394							}
1395						}
1396						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1397							//$("#masthead")[0].scrollIntoView();
1398							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1399						}
1400						$box.addClass('open-items');
1401						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1402							$el_transp.addClass('is_mobile_open');
1403						}
1404						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1405							btn.classList.add('close');
1406							$box.animate({
1407								height: elHeight
1408							}, 600, "easeInOutCirc", function() {
1409								animating = false;
1410								if (!stickyMobile) $box.css('height', 'auto');
1411							});
1412						} else {
1413							animating = false;
1414						}
1415					}
1416				};
1417
1418				var close = function() {
1419					clearTimeout(offCanvasAnim);
1420					if (!animating) {
1421						window.dispatchEvent(menuClose);
1422						animating = true;
1423						UNCODE.menuOpened = false;
1424						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1425							btn.classList.remove('close');
1426							btn.classList.add('closing');
1427						}
1428						$box.addClass('close');
1429						requestTimeout(function() {
1430							$box.removeClass('close');
1431							$box.removeClass('open-items');
1432							btn.classList.remove('closing');
1433							if ($el_transp.length) {
1434								$el_transp.removeClass('is_mobile_open');
1435							}
1436						}, 500);
1437						$body.removeClass('opening-overlay-menu');
1438						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1439							$box.animate({
1440								height: 0
1441							}, {
1442								duration: 600,
1443								easing: "easeInOutCirc",
1444								complete: function(elements) {
1445									$(elements).css('height', '');
1446									animating = false;
1447									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1448										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1449									}
1450									$body.removeClass('open-overlay-menu');
1451								}
1452							});
1453						} else {
1454							animating = false;
1455							offCanvasAnim = setTimeout(function(){
1456								$body.removeClass('open-overlay-menu');
1457							}, 1000);
1458						}
1459					}
1460				};
1461				check = (!UNCODE.menuOpened) ? open() : close();
1462			}
1463		});
1464
1465		$('html').on('click', function(event){
1466			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1467				$('.uncode-close-offcanvas-mobile').trigger('click');
1468			}
1469		});
1470
1471		window.addEventListener('menuMobileTrigged', function(e) {
1472			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1473		});
1474		window.addEventListener('orientationchange', function(e) {
1475			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1476		});
1477		window.addEventListener("resize", function() {
1478			if ($(window).width() < UNCODE.mediaQuery) {
1479				if (UNCODE.isMobile) {
1480					var $box = $('.box-container .main-menu-container'),
1481						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
1482					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1483						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1484							elHeight = 0;
1485							$.each($el, function(index, val) {
1486								elHeight += $(val).outerHeight();
1487							});
1488							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;
1489							$($box).css('height', elHeight + 'px');
1490						}
1491					}
1492				}
1493			} else {
1494				$('.menu-hide-vertical').removeAttr('style');
1495				$('.menu-container-mobile').removeAttr('style');
1496				$('.vmenu-container.menu-container').removeAttr('style');
1497			}
1498		});
1499
1500		$(window).on('scroll', function(){
1501			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1502				$(window).scrollTop(scrolltop);
1503				return false;
1504			}
1505		});
1506
1507	};
1508
1509	function menuOffCanvas() {
1510		var menuClose = new CustomEvent('menuCanvasClose'),
1511			menuOpen = new CustomEvent('menuCanvasOpen');
1512		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1513			if ($(window).width() > UNCODE.mediaQuery) {
1514				if ( $('body.vmenu-offcanvas-overlay').length ) {
1515					if ($(event.currentTarget).hasClass('off-close')) {
1516						$(event.currentTarget).removeClass('off-close');
1517						requestTimeout(function() {
1518							window.dispatchEvent(menuClose);
1519						}, 500);
1520
1521					} else {
1522						$(event.currentTarget).addClass('off-close');
1523						window.dispatchEvent(menuOpen);
1524					}
1525				} else {
1526					if ($(event.currentTarget).hasClass('close')) {
1527						$(event.currentTarget).removeClass('close');
1528						$(event.currentTarget).addClass('closing');
1529						requestTimeout(function() {
1530							$(event.currentTarget).removeClass('closing');
1531							window.dispatchEvent(menuClose);
1532						}, 500);
1533
1534					} else {
1535						$(event.currentTarget).addClass('close');
1536						window.dispatchEvent(menuOpen);
1537					}
1538				}
1539			}
1540
1541			$('body').toggleClass('off-opened');
1542		});
1543
1544		$('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){
1545			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1546				var $vMenuCont = $('#masthead .vmenu-container'),
1547					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1548
1549					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1550					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1551					vmenu_off = $vMenuCont.offset(),
1552					vmenu_l = parseFloat(vmenu_off.left),
1553					vmenu_t = parseFloat(vmenu_off.top),
1554					vmenu_r = vmenu_l + vmenu_w,
1555					vmenu_b = vmenu_t + vmenu_h,
1556
1557					close_h = parseFloat( $close_menu.outerHeight() ),
1558					close_w = parseFloat( $close_menu.outerWidth() ),
1559					close_off = $close_menu.offset(),
1560					close_l = parseFloat(close_off.left),
1561					close_t = parseFloat(close_off.top),
1562					close_r = close_l + close_w,
1563					close_b = close_t + close_h;
1564				if (
1565					!(
1566						e.clientX > vmenu_l &&
1567						e.clientX < vmenu_r &&
1568						e.clientY > vmenu_t &&
1569						e.clientY < vmenu_b
1570					)
1571					||
1572					(
1573						e.clientX > close_l &&
1574						e.clientX < close_r &&
1575						e.clientY > close_t &&
1576						e.clientY < close_b
1577					)
1578				) {
1579					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1580				}
1581			}
1582		});
1583	};
1584
1585	function menuOverlay() {
1586		if ( $('.overlay').length ) {
1587			$('.overlay').removeClass('hidden');
1588		}
1589		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1590			$('.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) {
1591				var transDelay = (index / 20) + 0.1;
1592				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1593					transDelay = transDelay + 0.3;
1594				$(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');
1595			});
1596		}
1597
1598	};
1599	var $secondary_parent;
1600	function menuAppend() {
1601		var $body = $('body'),
1602			$menuCont = $('.menu-container:not(.vmenu-container)'),
1603			$vMenuCont = $('.menu-container.vmenu-container'),
1604			$cta = $('.navbar-cta'),
1605			$socials = $('.navbar-social:not(.appended-navbar)'),
1606			$ul = $('.navbar-main ul.menu-primary-inner'),
1607			$ulCta,
1608			$ulSocials,
1609			$navLast,
1610			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1611			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1612			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1613			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1614			$ulFirst = $('> ul', $firstNav),
1615			$ulSecond = $('> ul', $secondNav),
1616			setCTA,
1617			appendCTA = function(){
1618				return true;
1619			},
1620			appendSocials = function(){
1621				return true;
1622			},
1623			appendSplit = function(){
1624				return true;
1625			};
1626
1627		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1628			$ulCta = $('> ul', $cta);
1629			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1630
1631			appendCTA = function(){
1632				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1633					$ul.after($ulCta);
1634				} else {
1635					$cta.append($ulCta);
1636				}
1637			}
1638		}
1639
1640		if ( ! $body.hasClass('cta-not-appended') ) {
1641			appendCTA();
1642		}
1643
1644		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1645		$smartSocial.each(function(){
1646			var $_smartSocial = $(this);
1647			$('> li', $_smartSocial).each(function(){
1648				var $li = $(this);
1649				if ( $li.hasClass('mobile-hidden') ) {
1650					$_smartSocial.addClass('mobile-hidden');
1651				} else {
1652					$_smartSocial.removeClass('mobile-hidden');
1653					return false;
1654				}
1655			});
1656
1657			$('> li', $_smartSocial).each(function(){
1658				var $li = $(this);
1659				if ( $li.hasClass('tablet-hidden') ) {
1660					$_smartSocial.addClass('tablet-hidden');
1661				} else {
1662					$_smartSocial.removeClass('tablet-hidden');
1663					return false;
1664				}
1665			});
1666		});
1667
1668		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1669			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1670			if ( $body.hasClass('hmenu-center-split') ) {
1671				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1672			} else {
1673				$navLast = $('.navbar-nav-last', $vMenuCont);
1674			}
1675
1676			if ( ! $navLast.length ) {
1677				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1678				if ( $body.hasClass('hmenu-center-split') ) {
1679					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1680					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1681				} else {
1682					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1683					$navLast = $('.navbar-nav-last', $vMenuCont);
1684				}
1685			}
1686
1687			appendSocials = function(){
1688				if ( !$body.hasClass('menu-overlay-center') ) {
1689				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1690				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1691				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1692				// 		$ulSocials.each(function(){
1693				// 			var $li_social = $(this);
1694				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1695				// 		});
1696				// 	}
1697				// } else {
1698					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1699						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1700						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1701							$('> ul.menu-smart-social li', $socials).remove();
1702						}
1703						$navLast.append($ulSocials);
1704					} else {
1705						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1706							$('> ul.menu-smart-social li', $navLast).remove();
1707						}
1708						$socials.append($ulSocials);
1709					}
1710				}
1711			}
1712			appendSocials();
1713		}
1714
1715		if ( $vMenuCont.length ) {
1716			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1717		} else {
1718			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1719		}
1720		if ( $accordion_secondary.length ) {
1721			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1722			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1723				if ( !$accordion_secondary_ph.length ) {
1724					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1725				}
1726				if ( $vMenuCont.length ) {
1727					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1728				} else {
1729					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1730						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1731					} else {
1732						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1733					}
1734				}
1735			} else {
1736				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1737					$accordion_secondary_ph.before($accordion_secondary);
1738				}
1739			}
1740		}
1741
1742		if ( $vMenuCont.length ) {
1743			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1744		} else {
1745			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1746		}
1747
1748		if ( $extra_icons.length ) {
1749			if ( $vMenuCont.length ) {
1750				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1751					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1752						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1753							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1754						$not_social.each(function(){
1755							if ( ! $primary_after.length ) {
1756								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1757								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1758								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1759							}
1760							var $extra_li = $(this);
1761							$primary_after.find('> ul').append($extra_li);
1762						});
1763					} else {
1764						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1765							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1766						$not_social.each(function(){
1767							var $extra_li = $(this);
1768							$extra_icons.find('> ul').append($extra_li);
1769						});
1770					}
1771				} /*else {
1772					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1773					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1774						if ( !$extra_icons_ph.length ) {
1775							$extra_icons.after('<span class="extra-icons-ph" />');
1776						}
1777						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1778							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1779						} else {
1780							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1781						}
1782					} else {
1783						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1784							$extra_icons_ph.before($extra_icons);
1785						}
1786					}
1787				}*/
1788			} else {
1789				if ( ! $body.hasClass('hmenu-center-double') ) {
1790					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1791						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1792							$primary_after = $('.nav.navbar-main-after', $menuCont);
1793
1794						if ( ! $primary_after.length && $not_social.length ) {
1795							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1796								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1797							} else {
1798								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1799							}
1800							$primary_after = $('.nav.navbar-main-after', $menuCont);
1801							$primary_after.append('<ul class="menu-smart sm menu-smart-social" />');
1802						}
1803						var tablet_hidden = true,
1804							mobile_hidden = true;
1805						$not_social.each(function(){
1806							var $extra_li = $(this);
1807							$primary_after.find('> ul').append($extra_li);
1808							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1809								tablet_hidden = false;
1810							}
1811							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1812								mobile_hidden = false;
1813							}
1814						});
1815						if ( tablet_hidden === true && $not_social.length ) {
1816							$primary_after.addClass('tablet-hidden');
1817						}
1818						if ( mobile_hidden === true && $not_social.length ) {
1819							$primary_after.addClass('mobile-hidden');
1820						}
1821					} else {
1822						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1823
1824						if ( $primary_after.length ) {
1825							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1826							$not_social.each(function(){
1827								var $extra_li = $(this);
1828								$extra_icons.find('> ul').append($extra_li);
1829							});
1830							$primary_after.remove();
1831						}
1832					}
1833				}
1834			}
1835		}
1836
1837		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1838			appendSplit = function(){
1839				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1840					if ( $extra_icons.length ) {
1841						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1842							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1843								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1844							$not_social.each(function(){
1845								var $extra_li = $(this);
1846								$append_ul.append($extra_li);
1847							});
1848							if ( $secondNav.length ) {
1849								$secondNav.append($append_ul);
1850							} else {
1851								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1852							}
1853						}
1854					}
1855					if ( $secondNav.length ) {
1856						$secondNav.prepend($ulFirst);
1857					} else {
1858						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1859					}
1860					$firstMenu.hide();
1861				} else {
1862					$firstNav.append($ulFirst);
1863					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1864					if ( $append_ul.length ) {
1865						var $not_social = $('> li:not(.social-icon)', $append_ul);
1866						$not_social.each(function(){
1867							var $extra_li = $(this);
1868							$extra_icons.find('> ul').append($extra_li);
1869						});
1870					}
1871					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1872					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1873					$firstMenu.css({
1874						'display': 'table-cell'
1875					});
1876				}
1877			}
1878		}
1879		appendSplit();
1880
1881		$(window).on( 'wwresize', function(){
1882			clearRequestTimeout(setCTA);
1883			setCTA = requestTimeout( function() {
1884				appendCTA();
1885				appendSocials();
1886				appendSplit();
1887			}, 10 );
1888		});
1889	}
1890	//menuMobileButton();
1891	menuMobile();
1892	menuOffCanvas();
1893	menuAppend();
1894	menuOverlay();
1895
1896	var stickyDropdownSearch = function(){
1897		var $masthead = $('#masthead'),
1898			$ddSearch = $('.overlay.overlay-search', $masthead),
1899			$styles = $('#stickyDropdownSearch').remove();
1900		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1901			var $menuWrapper = $('.menu-wrapper'),
1902				$navbar = $('.menu-container-mobile', $menuWrapper),
1903				navbarH = $navbar.outerHeight(),
1904				//$topbar = $('.top-menu', $menuWrapper),
1905				//topbarH = $topbar.outerHeight(),
1906				_css;
1907
1908			_css = '<style id="stickyDropdownSearch">';
1909			_css += '@media (max-width: 959px) {';
1910			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
1911			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
1912			_css += '}';
1913			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
1914			_css += 'position: fixed;';
1915			_css += 'top: 0;';
1916			_css += '}';
1917			_css += '</style>';
1918
1919			$(_css).appendTo($('head'));
1920		}
1921	}
1922	stickyDropdownSearch();
1923
1924	var setMenuOverlay;
1925	$(window).on( 'wwResize', function(){
1926		if ( $('.overlay').length && $(window).width() > 1024 ) {
1927			$('.overlay').addClass('hidden');
1928		}
1929		clearRequestTimeout(setMenuOverlay);
1930		setMenuOverlay = requestTimeout( function(){
1931			menuOverlay();
1932			menuAppend();
1933			stickyDropdownSearch();
1934		}, 150 );
1935	});
1936	UNCODE.menuSmartInit();
1937};
1938
1939UNCODE.menuSmartInit = function() {
1940	var $menusmart = $('[class*="menu-smart"]'),
1941		$masthead = $('#masthead'),
1942		$hMenu = $('.menu-horizontal-inner', $masthead),
1943		$focus = $('.overlay-menu-focus'),
1944		showTimeout = 50,
1945		hideTimeout = 50,
1946		showTimeoutFunc, hideTimeoutFunc;
1947
1948	$('> li.menu-item-has-children', $menusmart).hover(function(){
1949		$(this).data('hover', true);
1950	}, function(){
1951		$(this).data('hover', false);
1952	});
1953
1954	$('> li.menu-item-has-children', $menusmart).each(function(){
1955		var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false')
1956	});
1957
1958	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
1959		e.preventDefault();
1960	});
1961
1962	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
1963		var $notLis = $('> .nav > ul > li a', $hMenu),
1964			$menuA = $('a', $masthead).not($notLis),
1965			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
1966			showFuncCond = function() { return true };
1967
1968		if ( $('body').hasClass('focus-megamenu') ) {
1969			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner');
1970			showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') };
1971		} else if ( $('body').hasClass('focus-links') ) {
1972			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
1973		}
1974
1975		$hoverSelector.hover(function(){
1976			clearRequestTimeout(hideTimeoutFunc);
1977			showTimeoutFunc = requestTimeout(function(){
1978				$('body').addClass('navbar-hover');
1979			}, showTimeout*2);
1980		}, function(){
1981			hideTimeoutFunc = requestTimeout(function(){
1982				if ( ! $('.overlay-search.open', $masthead).length ) {
1983					$('body').removeClass('navbar-hover');
1984				}
1985			}, hideTimeout*2);
1986		});
1987	} else {
1988		showFuncCond = function() { return false };
1989	}
1990
1991	if ($menusmart.length > 0) {
1992		$menusmart.smartmenus({
1993			subIndicators: false,
1994			subIndicatorsPos: 'append',
1995			//subMenusMinWidth: '13em',
1996			subIndicatorsText: '',
1997			showTimeout: showTimeout,
1998			hideTimeout: hideTimeout,
1999			scrollStep: 8,
2000			showFunction: function($ul, complete) {
2001				clearRequestTimeout(showTimeoutFunc);
2002				$ul.fadeIn(0, 'linear', function(){
2003					complete();
2004					if ( $ul.hasClass('vc_row') ) {
2005						$ul.css({
2006							'display': 'table'
2007						});
2008					}
2009					if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) {
2010						$('body').addClass('open-megamenu');
2011					}
2012					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
2013						$('body').addClass('navbar-hover');
2014					}
2015				}).addClass('open-animated');
2016			},
2017			hideFunction: function($ul, complete) {
2018				if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) {
2019					$('body').removeClass('open-megamenu');
2020				}
2021				var fixIE = $('html.ie').length;
2022				if (fixIE) {
2023					var $rowParent = $($ul).closest('.main-menu-container');
2024					$rowParent.height('auto');
2025				}
2026				$ul.fadeOut(0, 'linear', function(){
2027					complete();
2028					$ul.removeClass('open-animated');
2029					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
2030						$('body').removeClass('open-submenu');
2031					}
2032				});
2033			},
2034			collapsibleShowFunction: function($ul, complete) {
2035				$ul.slideDown(400, 'easeInOutCirc', complete);
2036			},
2037			collapsibleHideFunction: function($ul, complete) {
2038				$ul.slideUp(200, 'easeInOutCirc', complete);
2039			},
2040			hideOnClick: SiteParameters.menuHideOnClick,
2041		});
2042
2043		if ( $('body').hasClass('menu-accordion-active') ) {
2044			$menusmart.each(function(key, menu){
2045				$(menu).addClass('menu-smart-init');
2046				$(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) );
2047			});
2048		}
2049		
2050		$(document).on( 'uncode.smartmenu-appended', function(){
2051			requestTimeout(function(){
2052				$menusmart.smartmenus( 'refresh' );
2053			}, 1000);
2054		});
2055	}
2056
2057	$('.main-menu-container').each(function(){
2058		var $main_cont = $(this),
2059			$uls = $('ul', $main_cont);
2060
2061		$uls.each(function(){
2062			var $ul = $(this),
2063				mobile_hidden = true,
2064				tablet_hidden = true;
2065			$('> li:not(.hidden)', $ul).each(function(){
2066				if ( !$(this).hasClass('mobile-hidden') ) {
2067					mobile_hidden = false;
2068					return false;
2069				}
2070			});
2071			$('> li:not(.hidden)', $ul).each(function(){
2072				if ( !$(this).hasClass('tablet-hidden') ) {
2073					tablet_hidden = false;
2074					return false;
2075				}
2076			});
2077			if ( mobile_hidden ) {
2078				$ul.addClass('mobile-hidden');
2079			}
2080			if ( tablet_hidden ) {
2081				$ul.addClass('tablet-hidden');
2082			}
2083		});
2084
2085		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
2086
2087		$divUlsMB.each(function(){
2088			var $divUlMB = $(this),
2089				div_mobile_hidden = true,
2090				div_tablet_hidden = true;
2091
2092			$('> ul:not(.hidden)', $divUlMB).each(function(){
2093				if ( !$(this).hasClass('mobile-hidden') ) {
2094					div_mobile_hidden = false;
2095					return false;
2096				}
2097			});
2098			$('> ul:not(.hidden)', $divUlMB).each(function(){
2099				if ( !$(this).hasClass('tablet-hidden') ) {
2100					div_tablet_hidden = false;
2101					return false;
2102				}
2103			});
2104			if ( div_mobile_hidden ) {
2105				$divUlMB.addClass('mobile-hidden');
2106			}
2107			if ( div_tablet_hidden ) {
2108				$divUlMB.addClass('tablet-hidden');
2109			}
2110		});
2111	});
2112
2113	var overlaySearchButton = function(){
2114		var $search_wrap = $('.overlay.overlay-search, .widget_search');
2115
2116		$search_wrap.each(function(){
2117			var $form = $('form', this),
2118				$icon = $('i', $form);
2119
2120			$icon.on('click', function(){
2121				$form.submit();
2122			});
2123		});
2124	};
2125	overlaySearchButton();
2126}
2127
2128UNCODE.okvideo = function(ev) {
2129	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
2130	$.okvideo = function(options) {
2131		// if the option var was just a string, turn it into an object
2132		if (typeof options !== 'object') options = {
2133			'video': options
2134		};
2135		var base = this;
2136		// kick things off
2137		base.init = function() {
2138			base.options = $.extend({}, $.okvideo.options, options);
2139			// support older versions of okvideo
2140			if (base.options.video === null) base.options.video = base.options.source;
2141			base.setOptions();
2142			var target = base.options.target || $('body');
2143			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
2144			var zIndex = base.options.controls === 3 ? -999 : "auto";
2145			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
2146				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>';
2147				if (OKEvents.utils.isMobile()) {
2148					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>');
2149				} else {
2150					if (base.options.controls === 3) {
2151						target.append(mask)
2152					}
2153					if (base.options.adproof === 1) {
2154						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>');
2155					} else {
2156						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>');
2157					}
2158				}
2159				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
2160				if (base.options.playlist.list === null) {
2161					if (base.options.video.provider === 'youtube') {
2162						base.loadYouTubeAPI();
2163					} else if (base.options.video.provider === 'vimeo') {
2164						base.options.volume /= 100;
2165						base.loadVimeoAPI();
2166					}
2167				} else {
2168					base.loadYouTubeAPI();
2169				}
2170			}
2171		};
2172		// clean the options
2173		base.setOptions = function() {
2174			// exchange 'true' for '1' and 'false' for 3
2175			for (var key in this.options) {
2176				if (this.options[key] === true) this.options[key] = 1;
2177				if (this.options[key] === false) this.options[key] = 3;
2178			}
2179			if (base.options.playlist.list === null) {
2180				base.options.video = base.determineProvider();
2181			}
2182			// pass options to the window
2183			$(window).data('okoptions-' + base.options.id, base.options);
2184		};
2185		// insert js into the head and exectue a callback function
2186		base.insertJS = function(src, callback, provider){
2187			var tag;
2188			if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) {
2189				delete UNCODE.insertedSripts[src];
2190				var tags = document.getElementsByTagName('script');
2191				for (var i = tags.length; i >= 0; i--){
2192					if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) {
2193						tags[i].parentNode.removeChild(tags[i]);
2194					}
2195				}
2196			} else {
2197				if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
2198					tag = UNCODE.insertedSripts[src];
2199					if (callback){
2200						if (tag.readyState){  //IE
2201							tag.onreadystatechange = function(){
2202								if (tag.readyState === "loaded" ||
2203									tag.readyState === "complete"){
2204									tag.onreadystatechange = null;
2205									callback();
2206								}
2207							};
2208						} else {
2209							$(tag).on('load', callback);
2210						}
2211					}
2212					return;
2213				}
2214			}
2215			tag = document.createElement('script');
2216			if (callback){
2217				if (tag.readyState){  //IE
2218					tag.onreadystatechange = function(){
2219						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2220							tag.onreadystatechange = null;
2221							callback();
2222						}
2223					};
2224				} else {
2225					tag.onload = function() {
2226						callback();
2227					};
2228				}
2229			}
2230			tag.src = src;
2231			var firstScriptTag = document.getElementsByTagName('script')[0];
2232			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2233			if ( ! UNCODE.insertedSripts ) {
2234				UNCODE.insertedSripts = [];
2235			}
2236			UNCODE.insertedSripts[src] = tag;
2237		};
2238		// load the youtube api
2239		base.loadYouTubeAPI = function(callback) {
2240			if ( ev === 'uncode-more-items-loaded' ) {
2241				onYouTubeIframeAPIReady();
2242			} else {
2243				base.insertJS('https://www.youtube.com/player_api', false, 'youtube');
2244			}
2245		};
2246		base.loadYouTubePlaylist = function() {
2247			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2248		};
2249		// load the vimeo api by replacing the div with an iframe and loading js
2250		base.loadVimeoAPI = function() {
2251			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',
2252			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2253			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2254			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2255			base.insertJS('//player.vimeo.com/api/player.js', function() {
2256				vimeoPlayerReady(base.options.id);
2257			}, 'vimeo');
2258		};
2259		// is it from youtube or vimeo?
2260		base.determineProvider = function() {
2261			var a = document.createElement('a');
2262			a.href = base.options.video;
2263			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2264				var videoid = a.href.split('/')[3].toString();
2265				var query = videoid.substring(videoid.indexOf('?') + 1);
2266				if (query != '') {
2267					var vars = query.split('&');
2268					for (var i = 0; i < vars.length; i++) {
2269						var pair = vars[i].split('=');
2270						if (pair[0] == 'v') {
2271							videoid = pair[1];
2272						}
2273					}
2274				}
2275				return {
2276					"provider": "youtube",
2277					"id": videoid
2278				};
2279			} else if (/vimeo.com/.test(base.options.video)) {
2280				return {
2281					"provider": "vimeo",
2282					"id": (a.href.split('/')[3].toString()).split('#')[0],
2283				};
2284			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2285				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2286				if (id.length == 11) {
2287					return {
2288						"provider": "youtube",
2289						"id": id.toString()
2290					};
2291				} else {
2292					for (var i = 0; i < base.options.video.length; i++) {
2293						if (typeof parseInt(base.options.video[i]) !== "number") {
2294							throw 'not vimeo but thought it was for a sec';
2295						}
2296					}
2297					return {
2298						"provider": "vimeo",
2299						"id": base.options.video
2300					};
2301				}
2302			} else {
2303				throw "OKVideo: Invalid video source";
2304			}
2305		};
2306		base.init();
2307	};
2308
2309	var checkResize,
2310		newW = UNCODE.wwidth;
2311
2312	$.okvideo.options = {
2313		id: null,
2314		source: null, // Deprecate dis l8r
2315		video: null,
2316		playlist: { // eat ur heart out @brokyo
2317			list: null,
2318			index: 0,
2319			startSeconds: 0,
2320			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2321		},
2322		disableKeyControl: 1,
2323		captions: 0,
2324		loop: 1,
2325		hd: 1,
2326		volume: 0,
2327		adproof: false,
2328		unstarted: null,
2329		onFinished: null,
2330		onReady: null,
2331		onPlay: null,
2332		onPause: null,
2333		buffering: null,
2334		controls: false,
2335		autoplay: true,
2336		annotations: true,
2337		cued: null
2338	};
2339	$.fn.okvideo = function(options) {
2340		options.target = this;
2341		return this.each(function() {
2342			(new $.okvideo(options));
2343		});
2344	};
2345
2346	var checkForVideos = function(){
2347		$(".uncode-video-container.video").each(function(index, el) {
2348			var $this = $(this),
2349				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2350				url = $this.attr('data-video'),
2351				id = $this.attr('data-id'),
2352				cloned = $this.closest('.owl-item');
2353
2354			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2355				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2356					$this.okvideo({
2357						id: id,
2358						source: url.split('#')[0],
2359						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2360						autoplay: 1,
2361						controls: 0,
2362						volume: 0,
2363						adproof: 0,
2364						caller: $this,
2365						hd: 1,
2366						onReady: function(player) {
2367							var getPlayer = player.c || player.h || player,
2368							$iframe,
2369							getContainer = $(getPlayer).closest('.background-element');
2370							if (getContainer.length) {
2371								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2372							}
2373
2374							if ( $this.hasClass('drop-move') ) {
2375
2376								var $iframe = $(getPlayer),
2377									w = parseFloat($iframe.attr('width')),
2378									h = parseFloat($iframe.attr('height')),
2379									ratio = h / w,
2380									setResizeiFto,
2381								resizeiFrame = function(){
2382									var dataW = $this.attr('data-w'),
2383										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2384										newH = newW * ratio;
2385									$iframe.css({
2386										width: newW,
2387										height: newH
2388									});
2389								};
2390								resizeiFrame();
2391								$(window).on( 'load', resizeiFrame );
2392								$(window).on( 'resize', function(){
2393									clearRequestTimeout(setResizeiFto);
2394									setResizeiFto = requestTimeout( function() {
2395										resizeiFrame();
2396									}, 10 );
2397								});
2398
2399							}
2400
2401						}
2402					});
2403				}
2404			}
2405		});
2406	};
2407
2408	checkForVideos();
2409
2410	$(window).on('load', function(){
2411		$('.mejs-fullscreen-button button').on('click', function(){
2412			var $button = $(this),
2413				$stuck = $button.closest('.is_stucked');
2414
2415			if ( $stuck.length ) {
2416				$stuck = $(this).trigger("sticky_kit:detach");
2417				window.scrollTo(0, 0);
2418			}
2419		});
2420	});
2421
2422	var checkVideoResize = function(){
2423		clearRequestTimeout(checkResize);
2424		checkResize = requestTimeout(function(){
2425			if ( newW !== UNCODE.wwidth ) {
2426				newW = UNCODE.wwidth;
2427				checkForVideos();
2428			}
2429		}, 1000);
2430	};
2431
2432	$(window).off('resize', checkVideoResize)
2433	.on( 'resize', checkVideoResize);
2434
2435};
2436
2437$(document).on('uncode-ajax-filtered.videos', function(){
2438	UNCODE.okvideo("uncode-more-items-loaded");
2439});
2440UNCODE.backgroundSelfVideos = function( $ctx ) {
2441
2442	var backgroundSelfVideosInit = function( $ctx ) {
2443		if ( SiteParameters.block_mobile_videos === true ) {
2444			return false;
2445		}
2446		if (typeof MediaElement === "function") {
2447			if ( typeof $ctx === 'undefined' ) {
2448				$ctx = document;
2449			}
2450		
2451			$(".background-video-shortcode", $ctx).each(function(index, el) {
2452				if ( $(this).closest('mediaelementwrapper').length ) {
2453					return true;
2454				}
2455				var $video_el = $(this),
2456					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2457					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2458					video_id = $video_el.attr('id');
2459
2460				if ( SiteParameters.is_frontend_editor ) {
2461					video_id = video_id + '_' + index;
2462					$video_el.attr('id', video_id);
2463				}
2464
2465				var media = new MediaElement(video_id, {
2466					startVolume: 0,
2467					loop: true,
2468					success: function(mediaElement, domObject) {
2469						domObject.volume = 0;
2470						$(mediaElement).data('started', false);
2471						mediaElement.addEventListener('timeupdate', function(e) {
2472							if (!$(e.target).data('started')) {
2473								$(mediaElement).data('started', true);
2474							}
2475						});
2476						mediaElement.addEventListener('loadedmetadata', function(e) {
2477							$('body').removeClass('video-not-supported');
2478							mediaElement.play();
2479						});
2480						if (!UNCODE.isMobile) {
2481							requestTimeout(function() {
2482								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2483							}, 100);
2484						}
2485						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2486							mediaElement.play();
2487						}
2488
2489						if ( $parent_drop_move.length ) {
2490							var setResizeMEto,
2491								resizeMediaElement = function(){
2492								var dataW = $parent_drop_move.attr('data-w'),
2493									videoW = domObject.width,
2494									videoH = domObject.height,
2495									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2496									newH = newW / ( videoW / videoH );
2497
2498								$(domObject).css({
2499									'height': newH,
2500									'width': newW
2501								});
2502							};
2503							$(window).on( 'resize load', function(){
2504								clearRequestTimeout(setResizeMEto);
2505								setResizeMEto = requestTimeout( function() {
2506									resizeMediaElement();
2507								}, 10 );
2508							});
2509						}
2510
2511						mediaElement.addEventListener('play', function() {
2512							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2513							$(mediaElement).closest('#page-header').addClass('video-started');
2514							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2515						}, true);
2516
2517					},
2518					// fires when a problem is detected
2519					error: function() {}
2520				});
2521			});
2522		} else {
2523
2524			if ( typeof $ctx === 'undefined' ) {
2525				$ctx = document;
2526			}
2527		
2528			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2529			Array.from(videos).forEach(function(video_el) {
2530				video_el.addEventListener('loadedmetadata', function(e) {
2531					$('body').removeClass('video-not-supported');
2532					video_el.play();
2533				});
2534				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2535					video_el.muted = true;
2536					video_el.loop = true;
2537					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2538					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2539					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2540					$('body').removeClass('video-not-supported');
2541					video_el.play();
2542				} else {
2543					requestTimeout(function(){
2544                         backgroundSelfVideosInit( $ctx );
2545					}, 1000);
2546				}
2547			});
2548		}
2549	};
2550
2551	backgroundSelfVideosInit( $ctx );
2552
2553	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2554		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2555			var $el = model.view.$el,
2556				shortcode = model.attributes.shortcode;
2557
2558			if (typeof MediaElement === "function") {
2559				backgroundSelfVideosInit( $el );
2560			} else {
2561				backgroundSelfVideosInit( $el[0] );
2562			}
2563		});
2564	}
2565};
2566
2567UNCODE.is_scrolling = false;
2568
2569UNCODE.disableHoverScroll = function() {
2570
2571	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) {
2572		var body = document.body,
2573		timer;
2574
2575		window.addEventListener('scroll', function() {
2576			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2577			clearRequestTimeout(timer);
2578			if ( body.classList && !body.classList.contains('disable-hover') ) {
2579				body.classList.add('disable-hover');
2580				window.dispatchEvent(new CustomEvent('disable-hover'));
2581			}
2582			UNCODE.is_scrolling = true;
2583
2584			timer = requestTimeout(function() {
2585				if ( body.classList ) {
2586					body.classList.remove('disable-hover');
2587					window.dispatchEvent(new CustomEvent('enable-hover'));
2588				}
2589				UNCODE.is_scrolling = false;
2590			}, delay);
2591		}, false);
2592	}
2593};
2594
2595UNCODE.isotopeLayout = function() {
2596	if ($('.isotope-layout').length > 0) {
2597		var isotopeContainersArray = [],
2598			typeGridArray = [],
2599			layoutGridArray = [],
2600			screenLgArray = [],
2601			screenMdArray = [],
2602			screenSmArray = [],
2603			transitionDuration = [],
2604			$filterItems = [],
2605			$filters = $('.isotope-system .isotope-filters'),
2606			$itemSelector = '.tmb-iso',
2607			$items,
2608			itemMargin,
2609			correctionFactor = 0,
2610			firstLoad = true,
2611			isOriginLeft = $('body').hasClass('rtl') ? false : true;
2612		$('[class*="isotope-container"]').each(function(index) {
2613			var _this = $(this);
2614			var isoData = _this.data(),
2615			$data_lg,
2616			$data_md,
2617			$data_sm;
2618			_this.children('.tmb').addClass('tmb-iso');
2619			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
2620			else $data_lg = '1000';
2621			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
2622			else $data_md = '600';
2623			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
2624			else $data_sm = '480';
2625			screenLgArray.push($data_lg);
2626			screenMdArray.push($data_md);
2627			screenSmArray.push($data_sm);
2628			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
2629			if (isoData.type == 'metro') typeGridArray.push(true);
2630			else typeGridArray.push(false);
2631			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
2632			else layoutGridArray.push('masonry');
2633			isotopeContainersArray.push(_this);
2634			_this.attr('data-iso-index', index);
2635		});
2636		var colWidth = function(index) {
2637				$(isotopeContainersArray[index]).width('');
2638				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
2639					widthAvailable = $(isotopeContainersArray[index]).width(),
2640					columnNum = 12,
2641					columnWidth = 0,
2642					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
2643					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
2644					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
2645					$rowContainer,
2646					paddingRow,
2647					$colContainer,
2648					paddingCol;
2649
2650				if ( consider_menu )
2651					winHeight = winHeight - UNCODE.menuHeight;
2652
2653				if ( data_vp_height === '1' ) {
2654					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
2655					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
2656					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
2657					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
2658					winHeight = winHeight - ( paddingRow + paddingCol );
2659				}
2660
2661				if (isPx) {
2662					columnWidth = Math.ceil(widthAvailable / columnNum);
2663					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
2664				} else {
2665					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
2666				}
2667				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
2668				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
2669				for (var i = 0, len = $items.length; i < len; i++) {
2670					var $item = $($items[i]),
2671						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
2672						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
2673						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
2674
2675
2676					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
2677						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
2678					}
2679
2680					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
2681						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
2682					}
2683
2684					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
2685						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2686							switch (parseInt(multiplier_w[1])) {
2687								case (5):
2688								case (4):
2689								case (3):
2690									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2691									multiplier_w[1] = 6;
2692									break;
2693								case (2):
2694								case (1):
2695									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
2696									multiplier_w[1] = 3;
2697									break;
2698								default:
2699									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2700									multiplier_w[1] = 12;
2701									break;
2702							}
2703
2704							if (multiplier_w[1] == 2.4) { // 5 columns
2705								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2706								multiplier_w[1] = 6;
2707							}
2708						}
2709					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
2710						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2711							switch (parseInt(multiplier_w[1])) {
2712								case (5):
2713								case (4):
2714								case (3):
2715								case (2):
2716								case (1):
2717									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2718									multiplier_w[1] = 6;
2719									break;
2720								default:
2721									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2722									multiplier_w[1] = 12;
2723									break;
2724							}
2725
2726							if (multiplier_w[1] == 2.4) { // 5 columns
2727								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2728								multiplier_w[1] = 6;
2729							}
2730						}
2731					} else if (widthAvailable < screenSmArray[index]) {
2732						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2733							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2734							multiplier_w[1] = 12;
2735							if (typeGridArray[index]) multiplier_h[1] = 12;
2736						}
2737					}
2738					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
2739						height;
2740
2741					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
2742						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
2743						if ( widthAvailable < screenSmArray[index] ) {
2744							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
2745						}
2746					} else {
2747						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
2748					}
2749
2750					if (width >= widthAvailable) {
2751						$item.css({
2752							width: widthAvailable
2753						});
2754						if (typeGridArray[index]) {
2755							$item.children().add($item.find('.backimg')).css({
2756								height: height
2757							});
2758						}
2759					} else {
2760						$item.css({
2761							width: width
2762						});
2763						if (typeGridArray[index]) {
2764							$item.children().add($item.find('.backimg')).css({
2765								height: height
2766							});
2767						}
2768					}
2769				}
2770				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
2771					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
2772				} else {
2773					return columnWidth;
2774				}
2775			},
2776			init_isotope = function() {
2777				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
2778					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
2779						isotopeId = isotopeSystem.attr('id'),
2780						$layoutMode = layoutGridArray[i],
2781						setIsotopeFirstRowTimeOut,
2782					setIsotopeFirstRow = function(items){
2783						var firstRow = true;
2784						$(items).each(function(index, val){
2785							var el = items[index].element,
2786								el_top = items[index].position.y,
2787								$el = $(el);
2788							if ( index > 0 && el_top > 0 && firstRow ) {
2789								firstRow = false;
2790							} else if ( index == 0 && el_top == 0 ) {
2791								firstRow = true;
2792							}
2793							if ( firstRow ) {
2794								$el.removeClass('tmb-isotope-further-row');
2795							} else {
2796								$el.addClass('tmb-isotope-further-row');
2797							}
2798						});
2799					};
2800					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
2801						//resizable: true,
2802						itemSelector: $itemSelector,
2803						layoutMode: $layoutMode,
2804						transitionDuration: transitionDuration[i],
2805						masonry: {
2806							columnWidth: colWidth(i)
2807						},
2808						vertical: {
2809							horizontalAlignment: 0.5,
2810						},
2811						sortBy: 'original-order',
2812						isOriginLeft: isOriginLeft
2813					})
2814					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
2815					.on('layoutComplete', function( event, items ){
2816						if ( typeof items[0] !== 'undefined' ) {
2817							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2818								setIsotopeFirstRow(items);
2819							}
2820						}
2821					})
2822					.on('arrangeComplete', function( event, items ){
2823						if ( typeof items[0] !== 'undefined' ) {
2824							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2825								clearRequestTimeout(setIsotopeFirstRowTimeOut);
2826								setIsotopeFirstRowTimeOut = requestTimeout(function(){
2827									setIsotopeFirstRow(items);
2828								}, 100);
2829							}
2830						}
2831					});
2832					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
2833						$(isotopeContainersArray[i]).infinitescroll({
2834								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
2835								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
2836								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
2837								animate: false,
2838								behavior: 'local',
2839								debug: false,
2840								loading: {
2841									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
2842									speed: 0,
2843									finished: undefined,
2844									msg: $('#' + isotopeId + ' .loadmore-button'),
2845								},
2846								errorCallback: function() {
2847									var isotope_system = $(this).closest('.isotope-system');
2848									$('.loading-button', isotope_system).hide();
2849									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
2850								}
2851							},
2852							// append the new items to isotope on the infinitescroll callback function.
2853							function(newElements, opts) {
2854								var $isotope = $(this),
2855									isotope_system = $isotope.closest('.isotope-system'),
2856									isotopeId = isotope_system.attr('id'),
2857									filters = new Array(),
2858									$loading_button = isotope_system.find('.loading-button'),
2859									$infinite_button = isotope_system.find('.loadmore-button'),
2860									$numPages = $('a', $infinite_button).data('pages'),
2861									$woo_results,
2862									delay = 300;
2863								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
2864								$infinite_button.show();
2865								$loading_button.hide();
2866								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
2867								$('> li', $isotope).remove();
2868								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
2869								$.each($(newElements), function (index, val) {
2870									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
2871										$woo_results = $(val);
2872										delete newElements[index];
2873									} else {
2874										$(val).addClass('tmb-iso');
2875										if ($(val).is("li")) {
2876											filters.push($(val)[0]);
2877										}
2878									}
2879									$(val).addClass('uncode-appended');
2880								});
2881								newElements = newElements.filter(function(x) {
2882									return filters.indexOf(x) < 0
2883								});
2884								$.each($(filters), function(index, val) {
2885									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
2886								});
2887								if ($woo_results && $woo_results.length > 0) {
2888									var old_count = isotope_system.find('.woocommerce-result-count').text();
2889									var new_count = $woo_results.find('.woocommerce-result-count').text();
2890									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
2891									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
2892									function replaceMatch(match, p1, p2) {
2893        								return old_start + '–' + new_end;
2894									}
2895									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
2896									isotope_system.find('.woocommerce-result-count').text(new_count_text);
2897								}
2898								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
2899								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2900									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
2901									if (typeof getLightbox === 'object') {
2902										getLightbox.refresh();
2903									} else {
2904										UNCODE.lightbox();
2905									}
2906								}
2907								if ( typeof twttr !== 'undefined' )
2908									twttr.widgets.load(isotopeContainersArray[i]);
2909
2910								requestTimeout(function() {
2911									Waypoint.refreshAll();
2912									$isotope.trigger('more-items-loaded');
2913									$(window).trigger('more-items-loaded');
2914									window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
2915									if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
2916										$(document).trigger('uncode-scrolltrigger-refresh');
2917									}
2918								}, 1000);
2919
2920							});
2921						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
2922							var $infinite_isotope = $(isotopeContainersArray[i]),
2923								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
2924							$infinite_isotope.infinitescroll('pause');
2925							$infinite_button.on('click', function(event) {
2926								event.preventDefault();
2927								var $infinite_system = $(event.target).closest('.isotope-system'),
2928								$infinite_isotope = $infinite_system.find('.isotope-container'),
2929								isotopeId = $infinite_system.attr('id');
2930								$(event.currentTarget).html(SiteParameters.loading);
2931								$infinite_isotope.infinitescroll('resume');
2932								$infinite_isotope.infinitescroll('retrieve');
2933								$infinite_isotope.infinitescroll('pause');
2934							});
2935						}
2936					}
2937				}
2938			},
2939			onLayout = function(isotopeObj, startIndex, needsReload) {
2940				var needsReload = needsReload ? true : false;
2941
2942				if (typeof UNCODE.bigText !== 'undefined') {
2943					UNCODE.bigText();
2944				}
2945				isotopeObj.css('opacity', 1);
2946				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
2947
2948				requestTimeout(function() {
2949					if (startIndex > 0) {
2950						reloadIsotope(isotopeObj);
2951						if (SiteParameters.dynamic_srcset_active === '1') {
2952							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2953							UNCODE.adaptive_srcset(isotopeObj);
2954						}
2955						// window.dispatchEvent(UNCODE.boxEvent);
2956					} else if (needsReload) {
2957						reloadIsotope(isotopeObj);
2958					}
2959
2960					UNCODE.adaptive();
2961					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
2962						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2963					}
2964					if (typeof MediaElement === "function") {
2965						$(isotopeObj).find('audio,video').each(function() {
2966							$(this).mediaelementplayer({
2967	 							pauseOtherPlayers: false,
2968							});
2969						});
2970					}
2971					if ($(isotopeObj).find('.nested-carousel').length) {
2972						if (typeof UNCODE.carousel !== 'undefined') {
2973							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
2974						}
2975						requestTimeout(function() {
2976							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2977						}, 200);
2978					} else {
2979						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2980					}
2981					isotopeObj.trigger('isotope-layout-complete');
2982
2983				}, 100);
2984
2985			},
2986			boxAnimation = function(items, startIndex, sequential, container) {
2987				var $allItems = items.length - startIndex,
2988					showed = 0,
2989					index = 0;
2990				if (container.closest('.owl-item').length == 1) return false;
2991				$.each(items, function(index, val) {
2992					var $this = $(val),
2993						elInner = $('> .t-inside', val);
2994					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
2995						return;
2996					}
2997					if (val[0]) val = val[0];
2998					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
2999						new Waypoint({
3000							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3001							element: val,
3002							handler: function() {
3003								var element = $('> .t-inside', this.element),
3004									parent = $(this.element),
3005									currentIndex = parent.index();
3006								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
3007									delayAttr = parseInt(element.attr('data-delay'));
3008								if (isNaN(delayAttr)) delayAttr = 100;
3009								delay -= showed;
3010								var objTimeout = requestTimeout(function() {
3011									element.removeClass('zoom-reverse').addClass('start_animation');
3012									showed = parent.index();
3013									if ( container.data('isotope') ) {
3014										container.isotope('layout');
3015									}
3016								}, delay * delayAttr)
3017								parent.data('objTimeout', objTimeout);
3018								if (!UNCODE.isUnmodalOpen) {
3019									this.destroy();
3020								}
3021							},
3022							offset: '100%'
3023						})
3024					} else {
3025						if (elInner.hasClass('force-anim')) {
3026							elInner.addClass('start_animation');
3027						} else {
3028							elInner.css('opacity', 1);
3029						}
3030						container.isotope('layout');
3031					}
3032
3033					index++;
3034				});
3035			},
3036			reloadIsotope = function(isotopeObj) {
3037				var isoIndex = $(isotopeObj).attr('data-iso-index');
3038				var $layoutMode = ($(isotopeObj).data('layout'));
3039				if ($layoutMode === undefined) {
3040					$layoutMode = 'masonry';
3041				}
3042				if (isotopeObj.data('isotope')) {
3043					isotopeObj.isotope({
3044						itemSelector: $itemSelector,
3045						layoutMode: $layoutMode,
3046						transitionDuration: transitionDuration[isoIndex],
3047						masonry: {
3048							columnWidth: colWidth(isoIndex)
3049						},
3050						vertical: {
3051							horizontalAlignment: 0.5,
3052						},
3053						sortBy: 'original-order',
3054						isOriginLeft: isOriginLeft
3055					});
3056				}
3057			}
3058			;
3059		if ($('.isotope-pagination').length > 0) {
3060			$('.isotope-system').on('click', '.pagination a', function(evt) {
3061				evt.preventDefault();
3062
3063				if (SiteParameters.index_pagination_disable_scroll !== '1') {
3064					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
3065						container = $(this).closest('.isotope-system'),
3066						pagination_disable_scroll = container.attr('data-pagination-scroll'),
3067						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3068					calc_scroll -= UNCODE.get_scroll_offset();
3069
3070					if ( pagination_disable_scroll === 'disabled' ) {
3071						return;
3072					}
3073
3074					var menu_container = $('.menu-sticky');
3075					var menu = menu_container.find('.menu-container');
3076
3077					if (menu_container.length > 0 && menu.length > 0) {
3078						calc_scroll = calc_scroll - menu.outerHeight();
3079					}
3080
3081					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3082						delta = bodyTop - calc_scroll,
3083						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
3084					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3085
3086					if (!UNCODE.isFullPage) {
3087						if (scrollSpeed == 0) {
3088							$('html, body').scrollTop(calc_scroll);
3089						} else {
3090							$('html, body').animate({
3091								scrollTop: calc_scroll
3092							}, {
3093								easing: 'easeInOutQuad',
3094								duration: scrollSpeed,
3095								complete: function () {
3096									UNCODE.scrolling = false;
3097								}
3098							});
3099						}
3100					}
3101				}
3102
3103				loadIsotope($(this), true);
3104			});
3105		}
3106		$filters.on('click', 'a.isotope-nav-link', function(evt) {
3107			if ($(this).hasClass('no-isotope-filter')) {
3108				return;
3109			}
3110			var $filter = $(this),
3111				filterContainer = $filter.closest('.isotope-filters'),
3112				filterValue = $filter.attr('data-filter'),
3113				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
3114				transitionDuration = container.data().isotope.options.transitionDuration,
3115				delay = 300,
3116				filterItems = [];
3117
3118			var filter_items = function(){
3119				if (filterValue !== undefined) {
3120					container.addClass('grid-filtering');
3121					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3122						var parent = $(val).parent(),
3123							objTimeout = parent.data('objTimeout');
3124						if (objTimeout) {
3125							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3126							clearRequestTimeout(objTimeout);
3127						}
3128						if (transitionDuration == 0) {
3129							if ($(val).hasClass('animate_when_almost_visible')) {
3130								$(val).addClass('zoom-reverse').removeClass('start_animation');
3131							} else {
3132								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3133							}
3134						}
3135					});
3136					requestTimeout(function(){
3137						if ( filterValue == '*' ) {
3138							container.removeClass('isotope-filtered');
3139						} else {
3140							container.addClass('isotope-filtered');
3141						}
3142						container.isotope({
3143							filter: function() {
3144								var block = $(this),
3145								filterable = (filterValue == '*') || block.hasClass(filterValue),
3146								lightboxElements = $('[data-lbox^=ilightbox]', block);
3147								if (filterable) {
3148									if (lightboxElements.length) {
3149										lightboxElements.removeClass('lb-disabled');
3150										container.data('lbox', $(lightboxElements[0]).data('lbox'));
3151									}
3152									filterItems.push(block);
3153								} else {
3154									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
3155								}
3156								container.trigger('more-items-loaded');
3157								$(window).trigger('more-items-loaded');
3158								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3159								return filterable;
3160							}
3161						});
3162						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
3163
3164					}, delay);
3165
3166					/** once filtered - start **/
3167					container.isotope('once', 'arrangeComplete', function() {
3168						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3169							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
3170							if (typeof getLightbox === 'object') {
3171								getLightbox.refresh();
3172							} else {
3173								UNCODE.lightbox();
3174							}
3175						}
3176						if (transitionDuration == 0) {
3177							requestTimeout(function() {
3178								boxAnimation(filterItems, 0, false, container);
3179							}, 100);
3180						}
3181						requestTimeout(function() {
3182							Waypoint.refreshAll();
3183							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
3184								$(document).trigger('uncode-scrolltrigger-refresh');
3185							}
3186							container.removeClass('grid-filtering');
3187						}, 2000);
3188					});
3189					/** once filtered - end **/
3190				} else {
3191					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3192						$.each(UNCODE.lightboxArray, function(index, val) {
3193							UNCODE.lightboxArray[index].destroy();
3194						});
3195					}
3196					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
3197						var parent = $(val).parent(),
3198							objTimeout = parent.data('objTimeout');
3199						if (objTimeout) {
3200							$(val).removeClass('zoom-reverse').removeClass('start_animation')
3201							clearRequestTimeout(objTimeout);
3202						}
3203						if (transitionDuration == 0) {
3204							if ($(val).hasClass('animate_when_almost_visible')) {
3205								$(val).addClass('zoom-reverse').removeClass('start_animation');
3206							} else {
3207								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
3208							}
3209						}
3210					});
3211					container.parent().addClass('grid-loading');
3212					loadIsotope($filter);
3213				}
3214			};
3215
3216			if (!$filter.hasClass('active')) {
3217				/** Scroll top with filtering */
3218				if (filterContainer.hasClass('filter-scroll')) {
3219                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
3220                    calc_scroll -= UNCODE.get_scroll_offset();
3221
3222					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
3223						delta = bodyTop - calc_scroll,
3224						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
3225						filterTolerance = false,
3226						filter_timeout;
3227					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
3228
3229					if ( !UNCODE.isFullPage ) {
3230						if (scrollSpeed == 0) {
3231							$('html, body').scrollTop(calc_scroll);
3232							UNCODE.scrolling = false;
3233							filter_items();
3234						} else {
3235
3236							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3237								filter_items();
3238								filterTolerance = true;
3239							}
3240
3241							$('html, body').animate({
3242								scrollTop: calc_scroll
3243							},{
3244								easing: 'easeInOutQuad',
3245								duration: scrollSpeed,
3246								complete: function(){
3247									UNCODE.scrolling = false;
3248									if ( !filterTolerance ) {
3249										filter_timeout = setTimeout(function(){
3250											clearTimeout(filter_timeout);
3251											filter_items();
3252										}, 200);
3253									}
3254								}
3255							});
3256						}
3257					}
3258				} else {
3259					filter_items();
3260				}
3261			}
3262			evt.preventDefault();
3263		});
3264
3265		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3266			var params = UNCODE.getURLParams(window.location);
3267			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3268
3269			UNCODE.lastURL = window.location.href;
3270
3271			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
3272				return;
3273			}
3274
3275			if (params.id === undefined) {
3276				$.each($('.isotope-system'), function(index, val) {
3277					loadIsotope($(val));
3278				});
3279			} else {
3280				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3281					loadIsotope($('#' + params.id));
3282				}
3283			}
3284		});
3285
3286		var loadIsotope = function($href, $paginating) {
3287			var is_paginating = false;
3288
3289			if (undefined !== $paginating && $paginating) {
3290				var is_paginating = $paginating;
3291			}
3292
3293			var href = ($href.is("a") ? $href.attr('href') : location),
3294				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3295				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3296				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3297				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3298				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3299				isotopeId = isotopeSystem.attr('id');
3300			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3301				UNCODE.lastURL = href;
3302				history.pushState({
3303					myIsotope: true
3304				}, document.title, href);
3305			}
3306			if (is_paginating) {
3307				isotopeWrapper.addClass('grid-filtering');
3308			}
3309			$.ajax({
3310				url: href
3311			}).done(function(data) {
3312				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3313					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3314					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3315				isotopeWrapper.addClass('isotope-reloaded');
3316				requestTimeout(function() {
3317					isotopeWrapper.removeClass('grid-loading');
3318					isotopeWrapper.removeClass('isotope-reloaded');
3319					isotopeWrapper.removeClass('grid-filtering');
3320				}, 500);
3321				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3322					var parent = $(val).parent(),
3323						objTimeout = parent.data('objTimeout');
3324					if (objTimeout) {
3325						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3326						clearRequestTimeout(objTimeout);
3327					}
3328					if ($(val).hasClass('animate_when_almost_visible')) {
3329						$(val).addClass('zoom-reverse').removeClass('start_animation');
3330					} else {
3331						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3332					}
3333				});
3334				requestTimeout(function() {
3335					if (isotopeContainer.data('isotope')) {
3336						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3337						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3338						UNCODE.adaptive();
3339						if (SiteParameters.dynamic_srcset_active === '1') {
3340							UNCODE.adaptive_srcset(isotopeContainer);
3341						}
3342						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3343							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3344							if (typeof getLightbox === 'object') {
3345								getLightbox.refresh();
3346							} else {
3347								UNCODE.lightbox();
3348							}
3349						}
3350					}
3351					isotopeContainer.trigger('more-items-loaded');
3352					$(window).trigger('more-items-loaded');
3353					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
3354				}, 300);
3355				$('.pagination', isotopeFooter).remove();
3356				isotopeFooter.append($resultPagination);
3357
3358				if (isotopeResultCount.length > 0) {
3359					$('.woocommerce-result-count', isotopeResultCount).remove();
3360					isotopeResultCount.append($resultCount);
3361				}
3362			});
3363		};
3364		$filters.each(function(i, buttonGroup) {
3365			var $buttonGroup = $(buttonGroup);
3366			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3367				$buttonGroup.find('.active').removeClass('active');
3368				$(this).addClass('active');
3369
3370			});
3371
3372			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3373				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3374				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3375			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3376				e.preventDefault();
3377				$cats_filters.slideToggle(400, 'easeInOutCirc');
3378			});
3379
3380		});
3381		window.addEventListener('boxResized', function(e) {
3382			if (UNCODE.printDialogOpen !== false) {
3383				return false;
3384			}
3385			$.each($('.isotope-layout'), function(index, val) {
3386				var $layoutMode = ($(this).data('layout'));
3387				if ($layoutMode === undefined) $layoutMode = 'masonry';
3388				if ($(this).data('isotope')) {
3389					$(this).isotope({
3390						itemSelector: $itemSelector,
3391						layoutMode: $layoutMode,
3392						transitionDuration: transitionDuration[index],
3393						masonry: {
3394							columnWidth: colWidth(index)
3395						},
3396						vertical: {
3397							horizontalAlignment: 0.5,
3398						},
3399						sortBy: 'original-order',
3400						isOriginLeft: isOriginLeft
3401					});
3402					$(this).isotope('unbindResize');
3403					if (SiteParameters.dynamic_srcset_active === '1') {
3404						UNCODE.refresh_dynamic_srcset_size($(this));
3405					}
3406				}
3407				$(this).find('.mejs-video,.mejs-audio').each(function() {
3408					$(this).trigger('resize');
3409				});
3410			});
3411		}, false);
3412
3413		init_isotope();
3414	};
3415}
3416
3417UNCODE.lightbox = function() {
3418	if ( SiteParameters.lbox_enhanced ) {
3419		return true;
3420	}
3421	UNCODE.lightboxArray = {};
3422	requestTimeout(function() {
3423		var groupsArr = {};
3424		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3425			var group = this.getAttribute("data-lbox"),
3426				values = $(this).data();
3427			$(this).attr('data-lbox-init','true')
3428			groupsArr[group] = values;
3429		});
3430		for (var i in groupsArr) {
3431			var skin = groupsArr[i].skin || 'black',
3432				path = groupsArr[i].dir || 'horizontal',
3433				thumbs = !groupsArr[i].notmb || false,
3434				arrows = !groupsArr[i].noarr || false,
3435				social = groupsArr[i].social || false,
3436				deeplink = groupsArr[i].deep || false,
3437				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3438				counter = $els.length,
3439				dataAlbum = $els.attr('data-album');
3440			if (social) social = {
3441				facebook: true,
3442				twitter: true,
3443				reddit: true,
3444				digg: true
3445			};
3446			UNCODE.lightboxArray[i] = $els.iLightBox({
3447				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3448				skin: skin,
3449				path: path,
3450				linkId: deeplink,
3451				infinite: false,
3452				//fullViewPort: 'fit',
3453				smartRecognition: false,
3454				fullAlone: true,
3455				maxScale: 1,
3456				minScale: .02,
3457				//fullStretchTypes: 'flash, video',
3458				overlay: {
3459					opacity: .94
3460				},
3461				controls: {
3462					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3463					fullscreen: true,
3464					thumbnail: thumbs,
3465					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3466				},
3467				show: {
3468					speed: 200
3469				},
3470				hide: {
3471					speed: 200
3472				},
3473				social: {
3474					start: false,
3475					buttons: social
3476				},
3477				caption: {
3478					start: false
3479				},
3480				styles: {
3481					nextOpacity: 1,
3482					nextScale: 1,
3483					prevOpacity: 1,
3484					prevScale: 1
3485				},
3486				effects: {
3487					switchSpeed: 400
3488				},
3489				slideshow: {
3490					pauseTime: 5000
3491				},
3492				thumbnails: {
3493					maxWidth: 60,
3494					maxHeight: 60,
3495					activeOpacity: .2
3496				},
3497				html5video: {
3498					preload: true
3499				},
3500				callback: {
3501					onOpen: function(){
3502						$(window).trigger('uncode-custom-cursor');
3503						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3504							iNoBounce.enable();
3505						}
3506					},
3507					onHide: function(){
3508						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3509							iNoBounce.disable()
3510						}
3511					},
3512				}
3513			});
3514
3515			$(document).on('infinite-loaded', function(){
3516				UNCODE.lightboxArray[i].refresh();
3517			});
3518
3519			$(window).on('gdprOpen', function(){
3520				UNCODE.lightboxArray[i].close();
3521			});
3522		};
3523	}, 100);
3524
3525	$(document).on('click', '.lb-disabled', function(e){
3526		e.preventDefault();
3527	});
3528};
3529
3530UNCODE.lightgallery = function( $el ) {
3531	var createSelectors = function(){
3532		$('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){
3533			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3534				$(this).addClass('lbox-trigger-item');
3535			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3536				$(this).addClass('lbox-nested-item');
3537			} else {
3538				$(this).removeClass('lbox-trigger-item');
3539				$(this).removeClass('lbox-nested-item');
3540			}
3541		});
3542	};
3543
3544	createSelectors();
3545
3546	var galleries = [],
3547		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3548			return !$(this).closest('.nested-carousel').length;
3549		}),
3550		$_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 *'), 
3551		$galleries = $_galleries.filter(function( index ) {
3552			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3553		}),
3554		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3555
3556	if ( typeof $el === 'undefined' ) {
3557		$el = $galleries.add( $nested );
3558	}
3559
3560	var $disabled = $('a.lb-disabled');
3561	$disabled.on('click', function(e){
3562		e.preventDefault();
3563	});
3564
3565	var beforeSlide = function(event) {
3566		var detail = event.detail,
3567			info = detail.info,
3568			item = detail.item,
3569			$slide = $(detail.currentSlide.selector),
3570			$video = $('video', $slide),
3571			$previous = $(detail.previousSlide.selector),
3572			$prevVideo = $('video', $previous),
3573			isAudio = false;
3574
3575		if ( typeof info.src !== 'undefined' ) {
3576			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3577		}
3578
3579		if ( ! $video.length && ( info.video || isAudio ) ) {
3580			if ( info.video ) {
3581				if ( typeof info.video === 'object' ) {
3582					var infoJson = info.video;
3583				} else {
3584					var infoJson = JSON.parse(info.video);
3585				}
3586				var src = infoJson.source[0].src,
3587					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3588					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3589					loop = $(item).attr('data-loop');
3590
3591			} else if ( isAudio ) {
3592				var src = info.src,
3593					autoplay = true,
3594					loop = false;
3595			}
3596			if ( typeof src !== 'undefined' ) {
3597				$slide.addClass('has-html5');
3598				var video = document.createElement('video');
3599				video.src = src;
3600				video.preload = 'auto';
3601				video.controls = 'controls';
3602				video.controlsList = 'nodownload';
3603				if ( autoplay ) {
3604					video.autoplay = 'autoplay';
3605				}
3606				if ( muted ) {
3607					video.muted = 'muted';
3608				}
3609				if ( loop ) {
3610					video.loop = 'loop';
3611				}
3612				$(video).appendTo($slide);
3613			}
3614		} else {
3615			var $video = $('video', $slide);
3616			if ( $video.length ) {
3617				$video[0].currentTime = 0;
3618				if ( $video[0].autoplay ) {
3619					$video[0].play();
3620				}
3621			}
3622		}
3623		if ( $prevVideo.length ) {
3624			$prevVideo[0].currentTime = 0;
3625			$prevVideo[0].pause();
3626		}
3627	};
3628
3629	var beforeOpen = function(event) {
3630		var detail = event.detail,
3631			items = detail.items,
3632			galleryItems = detail.galleryItems,
3633			outer = detail.outer.selector,
3634			i, ii;
3635		for ( i = 0; i < galleryItems.length; i++ ) {
3636			var item = galleryItems[i];
3637			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
3638				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
3639			}
3640		}
3641		for ( ii = 0; ii < items.length; ii++ ) {
3642			var item = items[ii];
3643			if ( $(item).attr('data-icon') === 'video' ) {
3644				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
3645			}
3646		}
3647
3648	};
3649
3650	//caption builder
3651	var captionBuilder = function($el){
3652		$el.each( function( index, val ) {
3653			var $gallery = $(this).attr('data-lbox-init','true'),
3654				$_a = '.lbox-trigger-item',
3655				$_nested_a = '.lbox-nested-item';
3656
3657			$gallery.find($_a, $_nested_a).each(function(){
3658				var $a = $(this),
3659					$img = $('img', $a).first(),
3660					imgw = $img.attr('data-width'),
3661					imgh = $img.attr('data-height'),
3662					caption = $a.attr('data-caption'),
3663					title = $a.attr('data-title');
3664
3665				if ( $img.length && $img.attr('data-crop') != true ) {
3666					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
3667						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
3668					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
3669						$a.attr('data-external-thumb-image', $img[0].src);
3670					}
3671				}
3672
3673				if ( typeof title !== 'undefined' && title !== '' ) {
3674					title = '<h6>' + title + '</h6>';
3675				} else {
3676					title = '';
3677				}
3678
3679				if ( typeof caption !== 'undefined' && caption !== '' ) {
3680					caption = '<p>' + caption + '</p>';
3681					title += caption;
3682				}
3683
3684				if ( title !== '' ) {
3685					$a.attr( 'title', title );
3686				}
3687
3688				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') ) ) {
3689					$a.attr('data-lg-size', imgw + '-' + imgh);
3690				}
3691			});
3692		});
3693	};
3694	captionBuilder($el);
3695
3696	//regular galleries
3697	$el.each( function( index, val ) {
3698		var $gallery = $(this),
3699			$_a = '.lbox-trigger-item',
3700			$_nested_a = '.lbox-nested-item',
3701			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
3702			galleryID = $_first.attr('data-lbox'),
3703			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
3704			tmb = $_first.attr('data-notmb'),
3705			social = $_first.attr('data-social'),
3706			deep = $_first.attr('data-deep'),
3707			zoom = $_first.attr('data-zoom-origin'),
3708			actual = $_first.attr('data-actual-size'),
3709			download = $_first.attr('data-download'),
3710			controls = $_first.attr('data-arrows') !== 'no',
3711			fullScreen = $_first.attr('data-full'),
3712			counter = $_first.attr('data-counter'),
3713			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
3714			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3715			connect = $_first.attr('data-connect'),
3716			lgPlugins = [lgVideo],
3717			itemsLoadedTimeOut;
3718
3719		if ( typeof galleryID === 'undefined' ) {
3720			galleryID = $gallery.attr('id');
3721		}
3722
3723		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3724		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3725
3726		if ( typeof tmb == 'undefined' || !tmb ) {
3727			lgPlugins.push(lgThumbnail);
3728		}
3729		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
3730			lgPlugins.push(lgZoom);
3731		}
3732		if ( typeof deep != 'undefined' && deep != '' ) {
3733			lgPlugins.push(lgHash);
3734		}
3735		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3736			lgPlugins.push(lgFullscreen);
3737		}
3738		if ( social ) {
3739			lgPlugins.push(lgShare);
3740		}
3741
3742		if ( galleries.indexOf( galleryID ) !== -1 ) {
3743			return true;
3744		}
3745
3746		galleries.push( galleryID );
3747		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
3748			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
3749		var gallery = lightGallery( $triggerGal[0], {
3750			addClass: containerClass,
3751			plugins: lgPlugins,
3752			mode: transition,
3753			selector: $selector,
3754			galleryId: galleryID,
3755			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3756			iframeWidth: '848px',
3757			iframeMaxWidth: '90%',
3758			iframeMaxHeight: '90%',
3759			exThumbImage: 'data-external-thumb-image',
3760			loadYouTubeThumbnail: false,
3761			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ),
3762			// autoplayFirstVideo: false,
3763			pager: false,
3764			startClass: 'lg-start-opacity',
3765			zoomFromOrigin: zoom,
3766			controls: controls,
3767			download: ( typeof download != 'undefined' && download != '' ),
3768			thumbWidth: 50,
3769			thumbHeight: '50px',
3770			counter: $triggerGal.find($selector).length > 1 ? counter : false,
3771			loadYouTubePoster: false,
3772			enableDrag: $triggerGal.find($selector).length > 1,
3773			mobileSettings: {
3774				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3775			},
3776		});
3777
3778		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
3779			e.preventDefault();
3780			var index = $(this).closest('.owl-item.cloned').attr('data-index');
3781			gallery.openGallery(index-1);
3782		});
3783
3784		$triggerGal.on('more-items-loaded', function(e, items) {
3785			clearRequestTimeout(itemsLoadedTimeOut);
3786			itemsLoadedTimeOut = requestTimeout(function(){
3787				createSelectors();
3788				captionBuilder($triggerGal);
3789				gallery.refresh();
3790			}, 100);
3791		});
3792
3793		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3794			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3795				$el = model.view.$el;
3796				if ( $el.find($triggerGal).length ) {
3797					gallery.destroy();
3798				}
3799			});
3800		}
3801
3802		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
3803		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
3804		$triggerGal[0].addEventListener('lgAfterOpen', function(){
3805			$(window).trigger('uncode-custom-cursor');
3806		});
3807
3808	});
3809
3810	if ( typeof $el !== 'undefined' ) {
3811
3812		//album galleries
3813		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
3814			var album = val,
3815				galleryID = index,
3816				$album = $(album),
3817				params = $album.attr('data-album'),
3818				tmb = $(val).attr('data-notmb'),
3819				social = $(val).attr('data-social'),
3820				deep = $(val).attr('data-deep'),
3821				actual = $(val).attr('data-actual-size'),
3822				download = $(val).attr('data-download'),
3823				controls = $(val).attr('data-arrows') !== 'no',
3824				fullScreen = $(val).attr('data-full'),
3825				counter = $(val).attr('data-counter'),
3826				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
3827				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3828				lgPlugins = [lgVideo];
3829
3830			$(val).attr('data-lbox-init','true');
3831
3832			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3833			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3834
3835			if ( typeof tmb == 'undefined' || !tmb ) {
3836				lgPlugins.push(lgThumbnail);
3837			}
3838			if ( typeof actual != 'undefined' && actual != '' ) {
3839				lgPlugins.push(lgZoom);
3840			}
3841			if ( typeof deep != 'undefined' && deep != '' ) {
3842				lgPlugins.push(lgHash);
3843			}
3844			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3845				lgPlugins.push(lgFullscreen);
3846			}
3847			if ( social ) {
3848				lgPlugins.push(lgShare);
3849			}
3850
3851			var gallery = window.lightGallery(album, {
3852				dynamic: true,
3853				plugins: lgPlugins,
3854				dynamicEl: JSON.parse(params),
3855				galleryId: galleryID,
3856				addClass: containerClass,
3857				mode: transition,
3858				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3859				iframeWidth: '848px',
3860				iframeMaxWidth: '90%',
3861				iframeMaxHeight: '90%',
3862				loadYouTubeThumbnail: false,
3863				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
3864				// autoplayFirstVideo: false,
3865				pager: false,
3866				startClass: 'lg-start-opacity',
3867				zoomFromOrigin: false,
3868				controls: controls,
3869				download: ( typeof download != 'undefined' && download != '' ),
3870				thumbWidth: 50,
3871				thumbHeight: '50px',
3872				loadYouTubePoster: false,
3873				counter: counter,
3874				exThumbImage: 'data-external-thumb-image',
3875				loadYouTubePoster: false,
3876				mobileSettings: {
3877					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3878				},
3879			});
3880
3881			$album.on('click', function(){
3882				gallery.openGallery(0);
3883			});
3884
3885			album.addEventListener('lgBeforeSlide', beforeSlide);
3886			album.addEventListener('lgBeforeOpen', beforeOpen);
3887			album.addEventListener('lgAfterOpen', function(){
3888				$(window).trigger('uncode-custom-cursor');
3889			});
3890
3891			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3892				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3893					$el = model.view.$el;
3894					if ( $el.find($album).length ) {
3895						gallery.destroy();
3896					}
3897				});
3898			}
3899
3900		});
3901
3902		//single images
3903		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
3904			var gallery = lightGallery( $('.page-wrapper')[0], {
3905				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
3906				iframeWidth: '848px',
3907				iframeMaxWidth: '90%',
3908				iframeMaxHeight: '90%',
3909				loadYouTubeThumbnail: false,
3910				// autoplayFirstVideo: false,
3911				startClass: 'lg-start-opacity',
3912				thumbWidth: 50,
3913				thumbHeight: '50px',
3914				download: false,
3915				loadYouTubePoster: false,
3916				counter: false
3917			});
3918
3919			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
3920			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
3921		});
3922	}
3923};
3924
3925UNCODE.carousel = function(container) {
3926	var $owlContainers = $('.owl-carousel-container', container);
3927	$owlContainers.each(function() {
3928		var $owlContainer = $(this),
3929			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
3930			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
3931			values = {},
3932			tempTimeStamp,
3933			newWidth = UNCODE.wwidth,
3934			$owlInsideEqual = [];
3935		$owlSelector.each(function() {
3936			var itemID = $(this).attr('id'),
3937				$elSelector = $(('#' + itemID).toString());
3938			values['id'] = itemID;
3939			values['items'] = 1;
3940			values['columns'] = 3;
3941			values['fade'] = false;
3942			values['nav'] = false;
3943			values['navmobile'] = false;
3944			values['navskin'] = 'light';
3945			values['navspeed'] = 400;
3946			values['dots'] = false;
3947			values['dotsmobile'] = false;
3948			values['loop'] = false;
3949			values['autoplay'] = false;
3950			values['timeout'] = 3000;
3951			values['autoheight'] = false;
3952			values['stagepadding'] = 0;
3953			values['margin'] = 0;
3954			values['lg'] = 1;
3955			values['md'] = 1;
3956			values['sm'] = 1;
3957			$.each($(this).data(), function(i, v) {
3958				values[i] = v;
3959			});
3960
3961			if ($(this).closest('.uncode-slider').length) {
3962				values['navskin'] = '';
3963				values['navmobile'] = false;
3964				//values['dotsmobile'] = true;
3965			} else {
3966				values['navskin'] = ' style-'+values['navskin']+' style-override';
3967			}
3968
3969			var setIndexActive = function(event, init){
3970				var init = typeof init === 'undefined' ? false : init,
3971					thiis = $(event.currentTarget);
3972				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
3973					var scrolltop = $(document).scrollTop(),
3974						size = event.page.size,
3975						i;
3976					var setIndex = requestTimeout(function() {
3977						for ( i = 0; i < size; i++ ) {
3978							var itemCont = event.item.index != null ? (event.item.index + i) : i;
3979							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
3980							if (thiis.closest('.row-slider').length) {
3981								if (currentItem == undefined) {
3982									currentItem = thiis.children()[i];
3983								}
3984								if ($(currentItem).closest('#page-header').length) {
3985									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
3986										UNCODE.switchColorsMenu(scrolltop, 'dark');
3987									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
3988										UNCODE.switchColorsMenu(scrolltop, 'light');
3989									}
3990								}
3991								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
3992								if (owlCustomNav.length) {
3993									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
3994										owlCustomNav.addClass('style-dark').removeClass('style-light');
3995									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
3996										owlCustomNav.addClass('style-light').removeClass('style-dark');
3997									}
3998								}
3999							}
4000							var itendIndex = $(currentItem).attr('data-index');
4001							if ( isNaN(itendIndex) ) {
4002								itendIndex = 1;
4003							}
4004							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
4005							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
4006							if ($.fn.counterUp) {
4007								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
4008									var $counter = $(this);
4009									$counter.addClass('started').counterUp({
4010										delay: 10,
4011										time: 1500
4012									});
4013								});
4014							}
4015						}
4016						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
4017					}, 200);
4018				}
4019				tempTimeStamp = event.timeStamp;
4020			}
4021
4022			/** Initialize */
4023			$elSelector.on('initialize.owl.carousel', function(event) {
4024				if (typeof UNCODE.owlNav !== 'undefined') {
4025					UNCODE.owlNav(itemID, event);
4026				}
4027
4028				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4029					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
4030						var shortcode = model.attributes.shortcode,
4031							$el = model.view.$el,
4032							$row_wrap = $el.closest('.row');
4033						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4034							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
4035						}
4036					});
4037					window.parent.vc.events.on('shortcodeView:updated', function(model) {
4038						var shortcode = model.attributes.shortcode;
4039						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4040							tempTimeStamp = Math.floor(Date.now() / 1000);
4041						}
4042					});
4043					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
4044						var shortcode = model.attributes.shortcode;
4045						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
4046							UNCODE.owlNav(itemID, event);
4047							$elSelector.trigger('refresh.owl.carousel');
4048						}
4049					});
4050				}
4051			});
4052
4053			/** Initialized */
4054			$elSelector.on('initialized.owl.carousel', function(event) {
4055
4056				if ( $('.isotope-container', event.currentTarget).length ) {
4057					window.dispatchEvent(UNCODE.boxEvent);
4058				}
4059
4060				$('.owl-dot.active', $elSelector).on('click', function(){
4061					return false;
4062				});
4063
4064				var thiis = $(event.currentTarget),
4065					// get the time from the data method
4066					time = thiis.data("timer-id"),
4067					rowParent = thiis.closest('.row-parent');
4068
4069				if ( typeof rowParent[0] !== 'undefined' ) {
4070					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
4071				}
4072
4073				if (time) {
4074					clearRequestTimeout(time);
4075				}
4076
4077				thiis.addClass('showControls');
4078				var new_time = requestTimeout(function() {
4079					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
4080					if (thiis.hasClass('owl-height-viewport'))
4081						setItemsRelHeight(thiis);
4082					if (thiis.hasClass('owl-height-equal'))
4083						setItemsHeight(thiis);
4084					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
4085					if (thiis.closest('.unequal, .unexpand').length) {
4086						UNCODE.setRowHeight(rowParent[0], true);
4087					}
4088					if (SiteParameters.dynamic_srcset_active === '1') {
4089						UNCODE.refresh_dynamic_srcset_size(thiis);
4090					}
4091				}, 350);
4092				// save the new time
4093				thiis.data("timer-id", new_time);
4094
4095				var scrolltop = $(document).scrollTop();
4096				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
4097
4098				//if (!UNCODE.isMobile) {
4099					/** fix autoplay when visible **/
4100				$(window).on('load', function(){
4101					if (thiis.data('autoplay')) {
4102						if ( !thiis.closest('.sticky-element').length ) {
4103							thiis.trigger('stop.autoplay.owl');
4104						} else {
4105							thiis.trigger('play.owl.autoplay');
4106						}
4107					}
4108					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
4109						return;
4110					}
4111					if ( ! thiis.closest('.sticky-element').length ) {
4112						var carouselInView = new Waypoint.Inview({
4113							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4114							element: thiis[0],
4115							exited: function() {
4116								var el = $(this.element);
4117								if (el.data('autoplay') ) {
4118									el.trigger('stop.owl.autoplay');
4119									el.data('stopped','true');
4120								}
4121							},
4122							enter: function(direction) {
4123								var el = $(this.element);
4124								requestTimeout(function() {
4125									if (el.data('autoplay')) {
4126										el.trigger('play.owl.autoplay');
4127										el.data('stopped','false');
4128									}
4129								}, 100);
4130							}
4131						});
4132					}
4133					if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4134						setTimeout(function(){
4135							window.lenis.resize();
4136						}, 1000);
4137					}
4138			  
4139					$('.owl-dot', event.currentTarget).each(function(key, val){
4140						$(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1));
4141					});
4142	
4143				});
4144				//}
4145
4146				// $(window).on('frontend:carousel_updated', function(){
4147				// 	Waypoint.refreshAll();
4148				// });
4149
4150				if (!thiis.closest('.isotope-system').length) {
4151					requestTimeout(function() {
4152						animate_thumb($('.t-inside', el), event);
4153					}, 400);
4154				} else {
4155					requestTimeout(function() {
4156						thiis.closest('.isotope-container').isotope('layout');
4157					}, 400);
4158				}
4159
4160				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4161				currentIndex = $(currentItem).attr('data-index');
4162
4163				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4164					if ($(val).closest('.uncode-slider').length) {
4165						$(val).removeClass('start_animation');
4166					}
4167				});
4168				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4169					if ($(val).closest('.uncode-slider').length) {
4170						$(val).removeClass('already-animated');
4171					}
4172				});
4173
4174				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4175					if ($(val).closest('.uncode-slider').length) {
4176						$(val).removeAttr('data-animated');
4177					}
4178				});
4179
4180				$.each($('.owl-item.cloned', thiis), function(index, val) {
4181					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
4182				});
4183
4184				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4185					if ($(val).attr('data-index') != currentIndex) {
4186						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4187						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4188					}
4189					if ($(val).attr('data-index') != currentIndex) {
4190						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
4191					}
4192					if ($(val).attr('data-index') == currentIndex) {
4193						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4194					}
4195				});
4196
4197				if (thiis.closest('.uncode-slider').length) {
4198					var el = thiis.closest('.row-parent')[0],
4199						section = thiis.closest('.vc_section');
4200					if ( section.length ) {
4201						el = $('> .row-parent', section)[0];
4202					}
4203					if ($(el).data('imgready')) {
4204						firstLoaded(el, event);
4205					} else {
4206						el.addEventListener("imgLoaded", function(el) {
4207							firstLoaded(el.target, event);
4208						}, false);
4209					}
4210					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
4211					if (transHeight != null) {
4212						requestTimeout(function() {
4213							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
4214						}, 100);
4215					}
4216				} else {
4217					var el = thiis;
4218					el.closest('.uncode-slider').addClass('slider-loaded');
4219				}
4220
4221				requestTimeout(function() {
4222					if (typeof UNCODE.bigText !== 'undefined') {
4223						UNCODE.bigText(thiis);
4224					}
4225					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
4226						if (thiis.data('autoplay')) pauseOnHover(thiis);
4227					}
4228				}, 500);
4229
4230				if (thiis.closest('.unequal').length) {
4231					$owlInsideEqual.push(thiis.closest('.row-parent'));
4232				}
4233
4234				var containerClasses = '',
4235					containerStyle = '';
4236				if ( $('.owl-dots-classes', $owlContainer).length ) {
4237					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4238					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4239					$('.owl-dots-classes', $owlContainer).remove();
4240				}
4241
4242				if ( containerClasses !== '' ) {
4243					requestTimeout(function() {
4244						if ( containerClasses !== '' )
4245							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4246						if ( containerStyle !== '' )
4247							$('.owl-dots', $owlContainer).addClass(containerClasses);
4248					}, 100);
4249				}
4250
4251				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4252					$(val).closest('.row-inner').css({
4253						'margin-top': '-1px'
4254					});
4255				});
4256
4257				if ($.fn.isotope) {
4258					if ( thiis.closest('.isotope-container').length ) {
4259						if (thiis.closest('.isotope-container').data('isotope')) {
4260							requestTimeout(function(){
4261								thiis.closest('.isotope-container').isotope('layout');
4262							}, 300);
4263						}
4264						$(window).on('load', function(){
4265							if (thiis.closest('.isotope-container').data('isotope')) {
4266								thiis.closest('.isotope-container').isotope('layout');
4267							}
4268						});
4269					}
4270				}
4271
4272				if (thiis.data('autoplay')) {
4273					$(window).on('menuOpen', function(){
4274						thiis.trigger('stop.owl.autoplay');
4275						thiis.data('stopped','true');
4276					}).on('menuClose', function(){
4277
4278					});
4279				}
4280				$(window).on('menuClose', function(){
4281					if (thiis.data('autoplay')) {
4282						thiis.trigger('play.owl.autoplay');
4283						thiis.data('stopped','false');
4284					}
4285				});
4286
4287				setIndexActive(event, true);
4288
4289				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4290						return !$(this).closest('.nested-carousel').length;
4291					}),
4292					$_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),
4293					$galleries = $_galleries.filter(function( index ) {
4294						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4295					});
4296
4297				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4298					UNCODE.lightgallery( $galleries );
4299				}
4300
4301				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4302					$(document).trigger('uncode-scrolltrigger-refresh');
4303				}
4304			});
4305
4306			$elSelector.on('resized.owl.carousel', function(event) {
4307				var thiis = $(event.currentTarget);
4308				// if ($(this).closest('.nested-carousel').length) {
4309				// 	requestTimeout(function() {
4310				// 		window.dispatchEvent(UNCODE.boxEvent);
4311				// 	}, 200);
4312				// }
4313				if ( thiis.hasClass('owl-height-equal') )
4314					setItemsHeight(thiis);
4315
4316				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4317					newWidth = UNCODE.wwidth;
4318					setItemsRelHeight($elSelector);
4319				}
4320
4321				setIndexActive(event);
4322
4323				if (SiteParameters.dynamic_srcset_active === '1') {
4324					UNCODE.refresh_dynamic_srcset_size(thiis);
4325				}
4326
4327				if ($.fn.isotope) {
4328					$(window).on('load', function(){
4329						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4330							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4331						}
4332					});
4333				}
4334
4335				if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
4336					setTimeout(function(){
4337						window.lenis.resize();
4338					}, 1000);
4339				}
4340				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
4341					$(document).trigger('uncode-scrolltrigger-refresh');
4342				}
4343			});
4344
4345			$elSelector.on('refreshed.owl.carousel', function(event) {
4346				setIndexActive(event);
4347			});
4348
4349			/** detect resize window for fluid height layout */
4350			var setFluidResize;
4351			function manageFluidCarouseHeight() {
4352				clearRequestTimeout(setFluidResize);
4353				setFluidResize = requestTimeout(function(){
4354					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4355						newWidth = UNCODE.wwidth;
4356						setItemsRelHeight($elSelector);
4357					}
4358				}, 100);
4359			}
4360			window.addEventListener('resize', manageFluidCarouseHeight);
4361
4362			/** Change */
4363			$elSelector.on('change.owl.carousel', function(event) {
4364				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4365			});
4366
4367			/** Changed */
4368			$elSelector.on('changed.owl.carousel', function(event) {
4369				var $row = $elSelector.parents('.row')[0];
4370				if ( typeof $row !== 'undefined' ) {
4371					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4372				}
4373				setIndexActive(event);
4374			});
4375
4376			var checkDrag = function(e) {
4377				$elSelector.addClass('owl-dragging');
4378			};
4379			$elSelector.on('drag.owl.carousel', function(event) {
4380				document.addEventListener("mousemove", checkDrag);
4381			});
4382
4383			$elSelector.on('dragged.owl.carousel', function(event) {
4384				$elSelector.removeClass('owl-dragging');
4385				document.removeEventListener("mousemove", checkDrag);
4386			});
4387
4388			$elSelector.on('translate.owl.carousel', function(event) {
4389				if (UNCODE.isMobile) {
4390					$(event.currentTarget).addClass('owl-translating');
4391				}
4392			});
4393
4394			/** Translated */
4395			$elSelector.on('translated.owl.carousel', function(event) {
4396
4397				var thiis = $(event.currentTarget),
4398					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4399					currentIndex = $(currentItem).attr('data-index'),
4400					stagePadding = thiis.data('stagepadding');
4401
4402				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4403
4404				if (!UNCODE.isMobile) {
4405					UNCODE.owlPlayVideo(thiis);
4406				}
4407
4408				requestTimeout(function(){
4409					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4410					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4411					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4412						if (lastDelayElems == undefined) lastDelayElems = 0;
4413						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4414						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4415						thiis.trigger('stop.owl.autoplay');
4416						requestTimeout(function() {
4417							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4418						}, maxDelay);
4419					}
4420				}, 200);
4421
4422				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4423					if ($(val).closest('.uncode-slider').length) {
4424						$(val).removeClass('start_animation');
4425					}
4426				});
4427
4428				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4429					if ($(val).closest('.uncode-slider').length) {
4430						$(val).removeClass('already-animated');
4431					}
4432				});
4433
4434				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4435					if ($(val).closest('.uncode-slider').length) {
4436						$(val).removeAttr('data-animated');
4437					}
4438				});
4439
4440				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4441					if ($(val).attr('data-index') != currentIndex) {
4442						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4443						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4444					}
4445					if ($(val).attr('data-index') != currentIndex) {
4446						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4447					}
4448					if ($(val).attr('data-index') == currentIndex) {
4449						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4450					}
4451				});
4452
4453				if (UNCODE.isMobile) {
4454					thiis.removeClass('owl-translating');
4455				}
4456
4457				setIndexActive(event);
4458			});
4459
4460			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4461
4462			/** Init carousel */
4463			$elSelector.not('.showControls').owlCarousel({
4464				items: values['items'],
4465				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4466				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4467				nav: values['nav'],
4468				dots: values['dots'],
4469				loop: values['loop'],
4470				stagePadding: values['stagepadding'],
4471				margin: 0,
4472				video: true,
4473				autoWidth: false,
4474				autoplay: false,
4475				autoplayTimeout: values['timeout'],
4476				autoplaySpeed: values['navspeed'],
4477				autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
4478				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4479				rtl: $('body').hasClass('rtl') ? true : false,
4480				fluidSpeed: true,
4481				navSpeed: values['navspeed'],
4482				dotsSpeed: values['navspeed'] / values['items'],
4483				navElement: ['button type="button" role="presentation" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" role="presentation" aria-label="' + SiteParameters.uncode_next_label + '"'],
4484				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4485				navText: ['<div class="owl-nav-container btn-default btn-hover-nobg" tabindex="0"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg" aria-label="' + SiteParameters.uncode_next_label + '" tabindex="0"><i class="fa fa-fw fa-angle-right"></i></div>'],
4486				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4487				responsiveClass: true,
4488				responsiveBaseElement: '.box-container',
4489				responsive: {
4490					0: {
4491						items: values['sm'],
4492						nav: values['navmobile'],
4493						dots: values['dotsmobile'],
4494						dotsSpeed: values['navspeed'] / values['sm'],
4495					},
4496					480: {
4497						items: values['sm'],
4498						nav: values['navmobile'],
4499						dots: values['dotsmobile'],
4500						dotsSpeed: values['navspeed'] / values['sm'],
4501					},
4502					570: {
4503						items: values['md'],
4504						nav: values['navmobile'],
4505						dots: values['dotsmobile'],
4506						dotsSpeed: values['navspeed'] / values['md'],
4507					},
4508					960: {
4509						items: values['lg'],
4510						dotsSpeed: values['navspeed'] / values['lg'],
4511					}
4512				}
4513			});
4514
4515			var transDuration = parseFloat(values['navspeed']) * 0.3;
4516			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
4517
4518			$('.owl-item .tmb', $elSelector).css({
4519				'-webkit-transition-delay': transDuration + 'ms',
4520				'-moz-transition-delay': transDuration + 'ms',
4521				'-o-transition-delay': transDuration + 'ms',
4522				'transition-delay': transDuration + 'ms',
4523				'-webkit-transition-duration': transDuration2 + 'ms',
4524				'-moz-transition-duration': transDuration2 + 'ms',
4525				'-o-transition-duration': transDuration2 + 'ms',
4526				'transition-duration': transDuration2 + 'ms',
4527			});
4528
4529			requestTimeout(function() {
4530				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4531					UNCODE.setRowHeight($owlInsideEqual[i]);
4532				};
4533			}, 300);
4534
4535			$(window).on('load', function(){
4536				var $elCarousel = $elSelector.data('owl.carousel');
4537				if ( typeof $elCarousel !== 'undefined' ) {
4538					$elCarousel.trigger('refreshed');
4539					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4540						UNCODE.setRowHeight($owlInsideEqual[i]);
4541					};
4542				}
4543			});
4544
4545			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
4546				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4547					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
4548					$('#' + carousel_id).find('.owl-item').each( function() {
4549						var $item = $(this),
4550							index = ( $item.index() + 1 );
4551						$item.attr('data-index', index);
4552					});
4553				}
4554			});
4555
4556			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4557				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
4558					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4559						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
4560						$('#' + carousel_id).find('.owl-item').each( function() {
4561							var $item = $(this),
4562								index = ( $item.index() + 1 );
4563							$item.attr('data-index', index);
4564						});
4565					}
4566				});
4567			}
4568
4569		});
4570
4571		function firstLoaded(el, event) {
4572			var el = $(el),
4573			uncode_slider = el.find('.uncode-slider');
4574			el.find('.owl-carousel').css('opacity', 1);
4575			uncode_slider.addClass('slider-loaded');
4576			if (typeof UNCODE.bigText !== 'undefined') {
4577				UNCODE.bigText(el.find('.owl-item.active'));
4578			}
4579			//if (!UNCODE.isMobile) {
4580				requestTimeout(function() {
4581					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
4582					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
4583					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
4584						if (lastDelayElems == undefined) lastDelayElems = 0;
4585						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4586						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4587						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
4588						requestTimeout(function() {
4589							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
4590						}, maxDelay);
4591					}
4592				}, 500);
4593
4594			//}
4595		}
4596
4597		function navHover(el) {
4598			var $owlCont = el,
4599				$owlPrev = $owlCont.find('.owl-prev'),
4600				$owlNext = $owlCont.find('.owl-next'),
4601				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
4602				$owlPagination = $owlCont.next(),
4603				owlPrevW = $owlPrev.outerWidth(),
4604				owlNextW = $owlNext.outerWidth(),
4605				owlDotsH = $owlDots.innerHeight(),
4606				owlTime = 400,
4607				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4608			if ( $('body').hasClass('rtl') ) {
4609				$owlPrev.css("margin-right", -owlPrevW);
4610				$owlNext.css("margin-left", -owlNextW);
4611			} else {
4612				$owlPrev.css("margin-left", -owlPrevW);
4613				$owlNext.css("margin-right", -owlNextW);
4614			}
4615			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
4616			$owlCont.mouseenter(function() {
4617				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4618				$owlPrev.add($owlNext).css({
4619					marginLeft: 0,
4620					marginRight: 0
4621				});
4622				if (!owlNested) {
4623					$owlDots.css({
4624						opacity: 1,
4625						bottom: 0
4626					});
4627				}
4628			}).mouseleave(function() {
4629				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4630				if ( $('body').hasClass('rtl') ) {
4631					$owlPrev.css("margin-right", -owlPrevW);
4632					$owlNext.css("margin-left", -owlNextW);
4633				} else {
4634					$owlPrev.css("margin-left", -owlPrevW);
4635					$owlNext.css("margin-right", -owlNextW);
4636				}
4637				if (!owlNested) {
4638					$owlDots.css({
4639						opacity: 1,
4640						bottom: -owlDotsH
4641					});
4642				}
4643			});
4644		};
4645
4646		function animate_elems($this) {
4647			var lastDelay;
4648			$.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) {
4649				var element = $(val),
4650					delayAttr = element.attr('data-delay'),
4651					$first_item = element.closest('.owl-item[data-index="1"]');
4652
4653				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
4654					return false;
4655				}
4656
4657				if (delayAttr == undefined) delayAttr = 0;
4658				requestTimeout(function() {
4659					element.addClass('start_animation');
4660				}, delayAttr);
4661				lastDelay = delayAttr;
4662			});
4663			return lastDelay;
4664		}
4665
4666		function animate_thumb(items, event) {
4667			var lastDelay,
4668				itemIndex,
4669				thiis = $(event.currentTarget),
4670				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
4671				numActives = $('.owl-item.active', thiis).length,
4672				stagePadding = thiis.data('stagepadding');
4673
4674			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4675
4676			thiis.data('tempIndex', event.item.index);
4677				$.each(items, function(index, val) {
4678					var parent = $(val).closest('.owl-item');
4679					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4680						return;
4681					}
4682					if (!$(val).hasClass('start_animation')) {
4683						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
4684							var thumbInView = new Waypoint.Inview({
4685							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4686							  element: val,
4687							  enter: function(direction) {
4688								var element = $(this.element),
4689										delayAttr = parseInt(element.attr('data-delay')),
4690										itemIndex = element.closest('.owl-item').index() + 1,
4691										diffItem = Math.abs(itemIndex - tempIndex) - 1;
4692									if (itemIndex > tempIndex) {
4693										thiis.data('tempIndex', itemIndex);
4694									}
4695									if (isNaN(delayAttr)) delayAttr = 100;
4696									if (stagePadding) {
4697										var objTimeout = requestTimeout(function() {
4698											element.addClass('start_animation');
4699										}, index * delayAttr);
4700										lastDelay = index * delayAttr;
4701									} else {
4702										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
4703										var objTimeout = requestTimeout(function() {
4704											element.addClass('start_animation');
4705										}, diffItem * delayAttr);
4706										lastDelay = diffItem * delayAttr;
4707									}
4708									parent.data('objTimeout', objTimeout);
4709									if (!UNCODE.isUnmodalOpen) {
4710										this.destroy();
4711									}
4712								}
4713							});
4714						}
4715					}
4716				});
4717				return lastDelay;
4718			}
4719
4720		function setItemsHeight(item) {
4721			$.each($('.owl-item', item), function(index, val) {
4722				var availableThumbHeight = $('.t-inside', $(val)).height(),
4723				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
4724				difference = availableThumbHeight - innerThumbHeight;
4725				if ($('.tmb-content-under', val).length) {
4726					var visualPart = $('.t-entry-visual', val);
4727					if (visualPart.length) {
4728						difference -= $('.t-entry-visual', val).height();
4729					}
4730				}
4731				if (! $('.tmb-content-lateral', val).length)
4732					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
4733			});
4734		}
4735
4736		function setItemsRelHeight(item) {
4737			$.each($('.owl-item', item), function(index, val) {
4738				var $rowContainer = $(item).parents('.row-parent').eq(0),
4739					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
4740					$colContainer = $(item).parents('.uncell').eq(0),
4741					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
4742					winHeight = UNCODE.wheight,
4743					multiplier_h = parseInt($(item).attr('data-vp-height')),
4744					data_viewport_h,
4745					consider_menu = $(item).data('vp-menu');
4746
4747				if ( consider_menu ) {
4748					winHeight = winHeight - UNCODE.menuHeight;
4749				}
4750
4751				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
4752				$('.t-inside', val).css( 'height', data_viewport_h );
4753			});
4754		}
4755
4756		function pauseOnHover(slider) {
4757			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
4758			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
4759				mouseenter: function () {
4760					$(slider).addClass('owl-mouseenter');
4761					$(slider).trigger('stop.owl.autoplay');
4762				},
4763				mouseleave: function () {
4764					$(slider).removeClass('owl-mouseenter');
4765					$(slider).trigger('play.owl.autoplay');
4766				}
4767			});
4768		}
4769	});
4770};
4771
4772UNCODE.owlPlayVideo = function(carousel) {
4773	var player, iframe;
4774	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
4775		var content = $(val).html();
4776		if (content == '') {
4777			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
4778			$(val).append(getCloned);
4779		}
4780		if ($(this).attr('data-provider') == 'vimeo') {
4781			iframe = $(this).find('iframe');
4782			player = new Vimeo.Player(iframe[0]);
4783			player.play();
4784		} else if ($(this).attr('data-provider') == 'youtube') {
4785			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
4786		} else {
4787			var player = $(this).find('video');
4788			if (player.length) {
4789				$(this).find('video')[0].volume = 0;
4790				$(this).find('video')[0].play();
4791				$(val).css('opacity', 1);
4792			}
4793		}
4794	});
4795};
4796
4797UNCODE.owlStopVideo = function(carousel) {
4798	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
4799		var player, iframe;
4800		if ($(this).attr('data-provider') == 'vimeo') {
4801			iframe = $(this).find('iframe');
4802			player = new Vimeo.Player(iframe[0]);
4803			player.pause();
4804		} else if ($(this).attr('data-provider') == 'youtube') {
4805			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
4806		} else {
4807			var player = $(this).find('video');
4808			if (player.length) {
4809				$(this).find('video')[0].volume = 0;
4810				$(this).find('video')[0].play();
4811			}
4812		}
4813	});
4814};
4815
4816UNCODE.animations = function() {
4817
4818	var runWaypoints_TO,
4819		runWaypoints_carousel_TO,
4820		runWaypoints_delay = 0,
4821	highlightComplexFunc = function($wrap, ev){
4822
4823		var $lines = $('.heading-line-wrap', $wrap),
4824			not_animate = false;
4825
4826		if ( $wrap.data('animate') === true ) {
4827			not_animate = true;
4828		}
4829
4830		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
4831		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
4832			return;
4833		}
4834
4835		$lines.each(function(_key, _value){
4836			var $line = $(_value),
4837				$inners = $('.split-word-inner', $line),
4838				$highlights = $('.heading-text-highlight-inner', $line);
4839
4840			var highlitInnerFunc = function(ev){
4841				var delay = 0;
4842				$highlights.each(function(h_key, high){
4843					var $highlight = $(high),
4844						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
4845						$nextSplit = $split.nextUntil(),
4846						$next = $('.heading-text-highlight-inner', $nextSplit),
4847						countCh = $split.text().length;
4848
4849					$highlight.css({
4850						'-webkit-transition-duration': (30 * countCh) + 'ms',
4851						'-moz-transition-duration': (30 * countCh) + 'ms',
4852						'-o-transition-duration': (30 * countCh) + 'ms',
4853						'transition-duration': (30 * countCh) + 'ms',
4854					});
4855
4856					delay += (30 * countCh);
4857
4858					$next.css({
4859						'-webkit-transition-delay': delay + 'ms',
4860						'-moz-transition-delay': delay + 'ms',
4861						'-o-transition-delay': delay + 'ms',
4862						'transition-delay': delay + 'ms',
4863					});
4864				});
4865				$highlights.removeAttr('data-animated');
4866				if ( _key+1 === $lines.length ) {
4867					$wrap.data('animate', true);
4868				}
4869			};
4870
4871			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
4872				if ( not_animate ) {
4873					$highlights.each(function(h_key, high){
4874						var $highlight = $(high);
4875						$highlight.css({
4876							'-webkit-transition-duration': '0ms',
4877							'-moz-transition-duration': '0ms',
4878							'-o-transition-duration': '0ms',
4879							'transition-duration': '0ms',
4880						});
4881					});
4882					$highlights.removeAttr('data-animated');
4883				} else {
4884					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
4885						highlitInnerFunc();
4886					} else {
4887						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
4888					}
4889				}
4890			}
4891		});
4892	};
4893
4894	$.each($('.header-content-inner'), function(index, val) {
4895		var element = $(val),
4896			transition = '';
4897		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
4898		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
4899		if (element.hasClass('left-t-right')) transition = 'left-t-right';
4900		if (element.hasClass('right-t-left')) transition = 'right-t-left';
4901		if (element.hasClass('zoom-in')) transition = 'zoom-in';
4902		if (element.hasClass('zoom-out')) transition = 'zoom-out';
4903		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
4904		if (transition != '') {
4905			$(val).removeClass(transition);
4906			var container = element,
4907				containerDelay = container.attr('data-delay'),
4908				containerSpeed = container.attr('data-speed'),
4909				items = $('.header-title > *, .post-info', container);
4910			$.each(items, function(index, val) {
4911				var element = $(val),
4912					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
4913					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
4914				if (!element.hasClass('animate_when_almost_visible')) {
4915					delayAttr = Number(delayAttr) + (400 * index);
4916					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
4917					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
4918				}
4919			});
4920			container.css('opacity', 1);
4921		}
4922	});
4923
4924	function animate_css_grids_on_load() {
4925		$('.cssgrid-system').each(function() {
4926			var grid = $(this);
4927			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
4928			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
4929		});
4930	}
4931
4932	var delayAdd = 0;
4933
4934	window.waypoint_animation = function(ev) {
4935		$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-linear .animate_when_almost_visible:not(.start_animation), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
4936			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 ) ) {
4937				return true;
4938			}
4939			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4940				return;
4941			}
4942			var run = true,
4943				$carousel = $(val).closest('.owl-carousel'),
4944				marquee = $(val).closest('.tmb-linear').length;
4945			if ( $carousel.length ) {
4946				run = false;
4947			}
4948			if (run) {
4949				new Waypoint({
4950					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4951					element: val,
4952					handler: function() {
4953						var element = $(this.element),
4954							index = element.index(),
4955							delayAttr = element.attr('data-delay');
4956						if (delayAttr == undefined) delayAttr = 0;
4957						// delayAttr = parseFloat(delayAttr) + delayAdd;
4958						// if ( marquee ) {
4959						// 	delayAdd += 50;
4960						// } else {
4961						// 	delayAdd = 0;
4962						// }
4963						requestTimeout(function() {
4964							element.addClass('start_animation');
4965						}, delayAttr);
4966						if (!UNCODE.isUnmodalOpen) {
4967							this.destroy();
4968						}
4969					},
4970					offset: UNCODE.isFullPage ? '100%' : '90%'
4971				});
4972			}
4973		});
4974		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
4975			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4976				return;
4977			}
4978			var run = true,
4979				$carousel = $(val).closest('.owl-carousel');
4980			if ( $carousel.length ) {
4981				run = false;
4982			}
4983			if (run) {
4984				new Waypoint({
4985					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4986					element: val,
4987					handler: function() {
4988						var $element = $(this.element),
4989							$childs = $('.animate_when_parent_almost_visible', $element);
4990						$childs.each(function(key,el){
4991							var $child = $(el),
4992								delaySpeed = $child.attr('data-speed'),
4993								delayAttr = $child.attr('data-delay'),
4994								intervalAttr = $child.attr('data-interval');
4995							if (delayAttr == undefined) {
4996								delayAttr = 50*key;
4997							}
4998							requestTimeout(function() {
4999								$child.addClass('start_animation');
5000								if ( $child.hasClass('anim-line-checker') ) {
5001									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5002										var $line = $child.closest('.heading-line-wrap');
5003									});
5004								}
5005								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5006								highlightComplexFunc($wrapText, ev);
5007								if ( $child.hasClass('anim-tot-checker') ) {
5008									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5009										if ( $child.hasClass('anim-tot-checker') ) {
5010											$wrapText.addClass('already-animated');
5011											$element.trigger('already-animated');
5012										}
5013									});
5014								}
5015							}, delayAttr );
5016						});
5017						$element.addClass('start_animation');
5018						if (!UNCODE.isUnmodalOpen) {
5019							this.destroy();
5020						}
5021					},
5022					offset: UNCODE.isFullPage ? '100%' : '90%'
5023				});
5024			}
5025		});
5026	}
5027	window.waypoint_carousel_animation = function(ev) {
5028		$.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) {
5029			if ( $(val).hasClass('el-text-split') ) {
5030				return true;
5031			}
5032			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5033				return;
5034			}
5035			var run = true,
5036				$carousel = $(val).closest('.owl-carousel'),
5037				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5038				$all_first = $('.owl-item[data-index="1"]', $carousel);
5039			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5040				run = false;
5041			}
5042			if (run) {
5043				new Waypoint({
5044					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5045					element: val,
5046					handler: function() {
5047						var element = $(this.element),
5048							index = element.index(),
5049							delayAttr = element.attr('data-delay');
5050						if (delayAttr == undefined) delayAttr = 0;
5051						requestTimeout(function() {
5052							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5053								$all_first.attr('data-already-reached', 'true');
5054							}
5055							element.addClass('start_animation');
5056						}, delayAttr);
5057						if (!UNCODE.isUnmodalOpen) {
5058							this.destroy();
5059						}
5060					},
5061					offset: UNCODE.isFullPage ? '100%' : '90%'
5062				});
5063			}
5064		});
5065		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
5066			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5067				return;
5068			}
5069			var run = true,
5070				$carousel = $(val).closest('.owl-carousel'),
5071				$first_item = $(val).closest('.owl-item[data-index="1"]'),
5072				$all_first = $('.owl-item[data-index="1"]', $carousel);
5073			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
5074				run = false;
5075			}
5076			if (run) {
5077				new Waypoint({
5078					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5079					element: val,
5080					handler: function() {
5081						var $element = $(this.element),
5082							$childs = $('.animate_when_parent_almost_visible', $element);
5083						$childs.each(function(key,el){
5084							var $child = $(el),
5085								delaySpeed = $child.attr('data-speed'),
5086								delayAttr = $child.attr('data-delay'),
5087								intervalAttr = $child.attr('data-interval');
5088							if (delayAttr == undefined) {
5089								delayAttr = 50*key;
5090							}
5091							requestTimeout(function() {
5092								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
5093									$all_first.attr('data-already-reached', 'true');
5094								}
5095								$child.addClass('start_animation');
5096								if ( $child.hasClass('anim-line-checker') ) {
5097									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5098										var $line = $child.closest('.heading-line-wrap');
5099									});
5100								}
5101								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
5102								highlightComplexFunc($wrapText, ev);
5103								if ( $child.hasClass('anim-tot-checker') ) {
5104									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
5105										if ( $child.hasClass('anim-tot-checker') ) {
5106											$wrapText.addClass('already-animated');
5107										}
5108									});
5109								}
5110							}, delayAttr );
5111						});
5112						$element.addClass('start_animation');
5113						if (!UNCODE.isUnmodalOpen) {
5114							this.destroy();
5115						}
5116					},
5117					offset: UNCODE.isFullPage ? '100%' : '90%'
5118				});
5119			}
5120		});
5121	}
5122
5123	var runWaypoints = function(ev){
5124		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
5125			runWaypoints_delay = 400;
5126		}
5127		clearRequestTimeout(runWaypoints_TO);
5128		runWaypoints_TO = requestTimeout(function() {
5129			window.waypoint_animation(ev);
5130		}, runWaypoints_delay);
5131
5132		clearRequestTimeout(runWaypoints_carousel_TO);
5133		runWaypoints_carousel_TO = requestTimeout(function() {
5134			window.waypoint_carousel_animation(ev);
5135		}, 400);
5136	};
5137	runWaypoints();
5138	animate_css_grids_on_load();
5139
5140	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
5141		runWaypoints(ev);
5142	});
5143	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
5144		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
5145		window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints );
5146	}
5147};
5148
5149UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
5150	var $allItems = elements.length - startIndex,
5151		showed = 0,
5152		index = 0,
5153		use_index = false
5154		;
5155
5156	if (filtering) {
5157		if (sequential) {
5158			use_index = true;
5159		}
5160		sequential = false;
5161	}
5162
5163	$.each(elements, function(index, val) {
5164		var $this = $(val),
5165			elInner = $('> .t-inside', val);
5166
5167		if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5168			return;
5169		}
5170		if (val[0]) val = val[0];
5171
5172		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
5173			new Waypoint({
5174				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5175				element: val,
5176				handler: function() {
5177					var element = $('> .t-inside', this.element),
5178						parent = $(this.element);
5179					var _index = use_index? index : 0;
5180
5181					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
5182						delayAttr = parseInt(element.attr('data-delay'));
5183					if (isNaN(delayAttr)) delayAttr = 100;
5184					if (sequential || use_index) {
5185						delay -= showed;
5186					}
5187					var objTimeout = requestTimeout(function() {
5188						element.removeClass('zoom-reverse').addClass('start_animation');
5189						showed = index;
5190					}, delay * delayAttr);
5191					parent.data('objTimeout', objTimeout);
5192					if (!UNCODE.isUnmodalOpen) {
5193						this.destroy();
5194					}
5195				},
5196				offset: UNCODE.isFullPage ? '100%' : '90%'
5197			});
5198		}
5199
5200		index++;
5201	});
5202};
5203
5204UNCODE.tapHover = function() {
5205
5206	var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-v
5206isual-cont > a, .drop-hover-link'), //.length //html.touch a.btn
5207		elClass = "hover";
5208
5209	$(window).on('click', function() {
5210		$el.removeClass(elClass);
5211	});
5212
5213	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
5214		e.stopPropagation();
5215		var link = $(this);
5216		if ( ! link.hasClass(elClass)) {
5217			e.preventDefault();
5218			link.addClass("hover");
5219			$el.not(this).removeClass(elClass);
5220			return false;
5221		}
5222	});
5223};
5224
5225UNCODE.onePage = function(isMobile) {
5226	var current = 0,
5227		last = 0,
5228		lastScrollTop = 0,
5229		forceScroll = false,
5230		lastScrolled = 0,
5231		isSectionscroller = ($('.main-onepage').length) ? true : false,
5232		isOnePage = false,
5233		getOffset = function () {
5234			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);
5235			return calculateOffset;
5236		}
5237
5238	isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile;
5239
5240	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
5241	// 	return false;
5242
5243	function init_onepage() {
5244		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
5245			$("<ul class='onepage-pagination'></ul>").prependTo("body");
5246		}
5247		last = $('.onepage-pagination li').last().find('a').data('index');
5248		$.each($('div[data-parent="true"]'), function(index, val) {
5249			$(this).attr('data-section', index);
5250			if (isMobile) return;
5251			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
5252				return;
5253			}
5254			var sectionDown = new Waypoint({
5255				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5256				element: val,
5257				handler: function(direction) {
5258					if (direction == 'down') {
5259						changeMenuActive(this.element, index);
5260					}
5261				},
5262				offset: function() {
5263					return 5 + getOffset()
5264				}
5265			});
5266			var sectionUp = new Waypoint({
5267				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5268				element: val,
5269				handler: function(direction) {
5270					if (direction == 'up') {
5271						changeMenuActive(this.element, index);
5272					}
5273				},
5274				offset: function() {
5275					return -5 - getOffset()
5276				}
5277			});
5278
5279			if (isSectionscroller) {
5280				var label;
5281				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5282				else label = '';
5283				var getName = $(this).attr('data-name');
5284				if (getName == undefined) getName = index;
5285				if (label != '') {
5286					isOnePage = true;
5287					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5288					$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + label + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
5289				}
5290			}
5291		});
5292
5293		if (isSectionscroller) {
5294			$.each($('ul.onepage-pagination li'), function(index, val) {
5295				var $this = $(val),
5296					$a = ('a', $this);
5297				$a.on('click', function(evt) {
5298					if ( $('.is-selected', $this).length || UNCODE.scrolling ) {
5299						return false;
5300					}
5301					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5302						evt.preventDefault();
5303					}
5304					Waypoint.refreshAll();
5305					var el = $('a', evt.currentTarget);
5306					current = lastScrolled = parseInt(el.attr('data-index'));
5307					lastScrolled += 1;
5308					scrollBody(current);
5309				});
5310			});
5311		}
5312
5313		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5314		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5315			goToSection = String(window.location.hash).replace(/^#/, "");
5316			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5317		}
5318
5319		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5320			current = lastScrolled = goToSection;
5321			$(window).on('load', function(){
5322				if ( $('.owl-carousel').length ) {
5323					requestTimeout(function(){
5324						scrollBody(goToSection);
5325					}, 400);
5326				} else {
5327					scrollBody(goToSection);
5328				}
5329			});
5330		}
5331
5332	}
5333
5334	function changeMenuActive(section, index) {
5335		current = lastScrolled = parseInt($(section).attr('data-section'));
5336		if (isOnePage) {
5337			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5338			if (newSection.length) {
5339				$('ul.onepage-pagination li a').removeClass('is-selected');
5340				newSection.addClass('is-selected');
5341			}
5342			var getName = $('[data-section="' + index + '"]').attr('data-name');
5343			if (getName != undefined && getName !== '') {
5344				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5345					var get_href = $(val).attr('href');
5346					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5347						$(val).closest('.menu-smart').find('.active').removeClass('active');
5348						$(val).parent().addClass('active');
5349					}
5350				});
5351			}
5352		}
5353	}
5354
5355	if (isOnePage) {
5356		$(window).on('scroll', function() {
5357			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5358			if (bodyTop == 0) {
5359				$('ul.onepage-pagination li a').removeClass('is-selected');
5360				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5361				var getName = $('[data-section=0]').attr('data-name');
5362				if (getName != undefined && getName !== '') {
5363					$.each($('.menu-container .menu-item > a'), function(i, val) {
5364						var get_href = $(val).attr('href');
5365						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5366							$(val).closest('ul').find('.active').removeClass('active');
5367							$(val).parent().addClass('active');
5368						}
5369					});
5370				}
5371			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5372				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5373				if (lastSection.length) {
5374					$('ul.onepage-pagination li a').removeClass('is-selected');
5375					lastSection.addClass('is-selected');
5376				}
5377			}
5378		});
5379	}
5380
5381	var scrollBody = function(index) {
5382		$('ul.onepage-pagination li a').removeClass('is-selected');
5383		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5384
5385		var getSection = $('[data-section=' + index + ']'),
5386			scrollTo;
5387
5388		if (getSection == undefined) return;
5389
5390		var body = $("html, body"),
5391			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5392			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5393			getOffset = UNCODE.get_scroll_offset(index);
5394		if ( typeof getSection.offset() === 'undefined' )
5395			return;
5396		scrollTo = getSection.offset().top;
5397
5398		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5399		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5400			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5401			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5402				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5403			}
5404
5405			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5406				if ( index === 0 ) {
5407					scrollTo = 0;
5408				} else {
5409					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5410				}
5411			} else {
5412				scrollTo -= getOffset;
5413			}
5414		}
5415
5416		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5417		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5418
5419		if (index != 0) {
5420			UNCODE.scrolling = true;
5421		}
5422
5423		if (scrollSpeed == 0) {
5424			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5425			UNCODE.scrolling = false;
5426		} else {
5427			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5428				$(this).stop();
5429			}).animate({
5430				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5431			}, scrollSpeed, 'easeInOutCubic', function() {
5432				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5433				UNCODE.scrolling = false;
5434				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5435				||
5436				$('.menu-hided').length ) {
5437					scrollTo = getSection.offset().top;
5438					getOffset = UNCODE.get_scroll_offset(index);
5439					scrollTo -= getOffset;
5440					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5441						$(this).stop();
5442					}).animate({
5443						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5444						}, scrollSpeed, 'easeInOutCubic', function() {
5445							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5446							UNCODE.scrolling = false;
5447						}
5448					);
5449				}
5450			});
5451		}
5452
5453	};
5454
5455	init_onepage();
5456};
5457
5458UNCODE.stickyElements = function() {
5459	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5460	if (!isMobile_wide ) {
5461
5462		var $pageHeader = $('#page-header'),
5463			$headerRow = $('.vc_row', $pageHeader),
5464			$headerSection = $headerRow.closest('section[data-parent]'),
5465			startSticky = false;
5466
5467		if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) {
5468			$headerRow.removeClass('sticky-element');
5469			$pageHeader.addClass('sticky-element');
5470			startSticky = true;
5471		}
5472
5473		var calculateOffset = function(el) {
5474			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5475				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5476				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5477				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5478
5479			sideOffset += UNCODE.bodyBorder;
5480
5481			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5482			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5483				if ($('.menu-shrink').length) {
5484					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5485				} else {
5486					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5487				}
5488			}
5489
5490			return sideOffset;
5491
5492		},
5493
5494		initStickyElement = function($els) {
5495			if ( $('body').hasClass('vc-safe-mode') ) {
5496				return true;
5497			}
5498			if ( typeof $els === 'undefined' ) {
5499				$els = $('.sticky-element');
5500			}
5501			$.each($els, function(index, element) {
5502				if ($(element).closest('.tab-pane').length) {
5503					var $paneParent = $(element).closest('.tab-pane');
5504					if ( !$paneParent.hasClass('active') ) {
5505						return true;
5506					}
5507				}
5508				$(element).stick_in_parent({
5509					sticky_class: 'is_stucked',
5510					offset_top: calculateOffset(element),
5511					bottoming: true,
5512					inner_scrolling: SiteParameters.sticky_elements === 'on'
5513				});
5514			});
5515		};
5516
5517		var oldW = UNCODE.wwidth,
5518			oldH = UNCODE.wHeight;
5519
5520		requestTimeout(function() {
5521			if ($('.sticky-element').length) {
5522
5523				if ($(window).width() > UNCODE.mediaQuery) {
5524					initStickyElement();
5525
5526					if ( startSticky === true ) {
5527						$('#page-header').trigger('sticky_kit:recalc');
5528					}
5529				}
5530
5531				$(window).on('resize lateral_resize', function(event) {
5532					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
5533						$(".sticky-element").trigger("sticky_kit:detach");
5534						if ($(window).width() > UNCODE.mediaQuery) {
5535							initStickyElement();
5536						}
5537						oldW = UNCODE.wwidth;
5538						oldH = UNCODE.wHeight;
5539					}
5540				});
5541			}
5542		}, 1000);
5543
5544		if ($('.sticky-element').length) {
5545			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
5546				requestTimeout(function() {
5547					$(document.body).trigger("sticky_kit:recalc");
5548				}, 100);
5549			});
5550		}
5551
5552		var $panels = $('.panel-collapse');
5553		if ( $panels.length ) {
5554			$panels.each(function(){
5555				var $panel = $(this);
5556				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
5557					$(document.body).trigger("sticky_kit:recalc");
5558				});
5559			});
5560		}
5561
5562		$('.nav-tabs a').on('shown.bs.tab', function(e){
5563			var $tabs = $(e.target).closest('.tab-container'),
5564				$panel = $('.tab-pane.active', $tabs),
5565				$els = $(e.target).nextAll(".sticky-element");
5566
5567			$els.trigger("sticky_kit:detach");
5568			initStickyElement($els);
5569		});
5570
5571		$(window).on('vc-safe-mode-on', function(){
5572			$(".sticky-element").trigger("sticky_kit:detach");
5573		});
5574
5575		$(window).on('vc-safe-mode-off', function(){
5576			initStickyElement();
5577		});
5578	}
5579};
5580
5581UNCODE.twentytwenty = function() {
5582
5583  if (!$('.twentytwenty-container').length) return;
5584
5585// DOM.event.move
5586//
5587// 2.0.0
5588//
5589// Stephen Band
5590//
5591// Triggers 'movestart', 'move' and 'moveend' events after
5592// mousemoves following a mousedown cross a distance threshold,
5593// similar to the native 'dragstart', 'drag' and 'dragend' events.
5594// Move events are throttled to animation frames. Move event objects
5595// have the properties:
5596//
5597// pageX:
5598// pageY:     Page coordinates of pointer.
5599// startX:
5600// startY:    Page coordinates of pointer at movestart.
5601// distX:
5602// distY:     Distance the pointer has moved since movestart.
5603// deltaX:
5604// deltaY:    Distance the finger has moved since last event.
5605// velocityX:
5606// velocityY: Average velocity over last few events.
5607
5608
5609(function(fn) {
5610	if (typeof define === 'function' && define.amd) {
5611        define([], fn);
5612    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
5613        module.exports = fn;
5614	} else {
5615		fn();
5616	}
5617})(function(){
5618	var assign = Object.assign || window.jQuery && jQuery.extend;
5619
5620	// Number of pixels a pressed pointer travels before movestart
5621	// event is fired.
5622	var threshold = 8;
5623
5624	// Shim for requestAnimationFrame, falling back to timer. See:
5625	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
5626	var requestFrame = (function(){
5627		return (
5628			window.requestAnimationFrame ||
5629			window.webkitRequestAnimationFrame ||
5630			window.mozRequestAnimationFrame ||
5631			window.oRequestAnimationFrame ||
5632			window.msRequestAnimationFrame ||
5633			function(fn, element){
5634				return window.setTimeout(function(){
5635					fn();
5636				}, 25);
5637			}
5638		);
5639	})();
5640
5641	// Shim for customEvent
5642	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
5643	(function () {
5644		if ( typeof window.CustomEvent === "function" ) return false;
5645		function CustomEvent ( event, params ) {
5646			params = params || { bubbles: false, cancelable: false, detail: undefined };
5647			var evt = document.createEvent( 'CustomEvent' );
5648			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
5649			return evt;
5650		}
5651
5652		CustomEvent.prototype = window.Event.prototype;
5653		window.CustomEvent = CustomEvent;
5654	})();
5655
5656	var ignoreTags = {
5657			textarea: true,
5658			input: true,
5659			select: true,
5660			button: true
5661		};
5662
5663	var mouseevents = {
5664		move:   'mousemove',
5665		cancel: 'mouseup dragstart',
5666		end:    'mouseup'
5667	};
5668
5669	var touchevents = {
5670		move:   'touchmove',
5671		cancel: 'touchend',
5672		end:    'touchend'
5673	};
5674
5675	var rspaces = /\s+/;
5676
5677
5678	// DOM Events
5679
5680	var eventOptions = { bubbles: true, cancelable: true };
5681
5682	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
5683
5684	function createEvent(type) {
5685		return new CustomEvent(type, eventOptions);
5686	}
5687
5688	function getEvents(node) {
5689		return node[eventsSymbol] || (node[eventsSymbol] = {});
5690	}
5691
5692	function on(node, types, fn, data, selector) {
5693		types = types.split(rspaces);
5694
5695		var events = getEvents(node);
5696		var i = types.length;
5697		var handlers, type;
5698
5699		function handler(e) { fn(e, data); }
5700
5701		while (i--) {
5702			type = types[i];
5703			handlers = events[type] || (events[type] = []);
5704			handlers.push([fn, handler]);
5705			node.addEventListener(type, handler);
5706		}
5707	}
5708
5709	function off(node, types, fn, selector) {
5710		types = types.split(rspaces);
5711
5712		var events = getEvents(node);
5713		var i = types.length;
5714		var type, handlers, k;
5715
5716		if (!events) { return; }
5717
5718		while (i--) {
5719			type = types[i];
5720			handlers = events[type];
5721			if (!handlers) { continue; }
5722			k = handlers.length;
5723			while (k--) {
5724				if (handlers[k][0] === fn) {
5725					node.removeEventListener(type, handlers[k][1]);
5726					handlers.splice(k, 1);
5727				}
5728			}
5729		}
5730	}
5731
5732	function trigger(node, type, properties) {
5733		// Don't cache events. It prevents you from triggering an event of a
5734		// given type from inside the handler of another event of that type.
5735		var event = createEvent(type);
5736		if (properties) { assign(event, properties); }
5737		node.dispatchEvent(event);
5738	}
5739
5740
5741	// Constructors
5742
5743	function Timer(fn){
5744		var callback = fn,
5745		    active = false,
5746		    running = false;
5747
5748		function trigger(time) {
5749			if (active){
5750				callback();
5751				requestFrame(trigger);
5752				running = true;
5753				active = false;
5754			}
5755			else {
5756				running = false;
5757			}
5758		}
5759
5760		this.kick = function(fn) {
5761			active = true;
5762			if (!running) { trigger(); }
5763		};
5764
5765		this.end = function(fn) {
5766			var cb = callback;
5767
5768			if (!fn) { return; }
5769
5770			// If the timer is not running, simply call the end callback.
5771			if (!running) {
5772				fn();
5773			}
5774			// If the timer is running, and has been kicked lately, then
5775			// queue up the current callback and the end callback, otherwise
5776			// just the end callback.
5777			else {
5778				callback = active ?
5779					function(){ cb(); fn(); } :
5780					fn ;
5781
5782				active = true;
5783			}
5784		};
5785	}
5786
5787
5788	// Functions
5789
5790	function noop() {}
5791
5792	function preventDefault(e) {
5793		e.preventDefault();
5794	}
5795
5796	function isIgnoreTag(e) {
5797		return !!ignoreTags[e.target.tagName.toLowerCase()];
5798	}
5799
5800	function isPrimaryButton(e) {
5801		// Ignore mousedowns on any button other than the left (or primary)
5802		// mouse button, or when a modifier key is pressed.
5803		return (e.which === 1 && !e.ctrlKey && !e.altKey);
5804	}
5805
5806	function identifiedTouch(touchList, id) {
5807		var i, l;
5808
5809		if (touchList.identifiedTouch) {
5810			return touchList.identifiedTouch(id);
5811		}
5812
5813		// touchList.identifiedTouch() does not exist in
5814		// webkit yet… we must do the search ourselves...
5815
5816		i = -1;
5817		l = touchList.length;
5818
5819		while (++i < l) {
5820			if (touchList[i].identifier === id) {
5821				return touchList[i];
5822			}
5823		}
5824	}
5825
5826	function changedTouch(e, data) {
5827		var touch = identifiedTouch(e.changedTouches, data.identifier);
5828
5829		// This isn't the touch you're looking for.
5830		if (!touch) { return; }
5831
5832		// Chrome Android (at least) includes touches that have not
5833		// changed in e.changedTouches. That's a bit annoying. Check
5834		// that this touch has changed.
5835		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
5836
5837		return touch;
5838	}
5839
5840
5841	// Handlers that decide when the first movestart is triggered
5842
5843	function mousedown(e){
5844		// Ignore non-primary buttons
5845		if (!isPrimaryButton(e)) { return; }
5846
5847		// Ignore form and interactive elements
5848		if (isIgnoreTag(e)) { return; }
5849
5850		on(document, mouseevents.move, mousemove, e);
5851		on(document, mouseevents.cancel, mouseend, e);
5852	}
5853
5854	function mousemove(e, data){
5855		checkThreshold(e, data, e, removeMouse);
5856	}
5857
5858	function mouseend(e, data) {
5859		removeMouse();
5860	}
5861
5862	function removeMouse() {
5863		off(document, mouseevents.move, mousemove);
5864		off(document, mouseevents.cancel, mouseend);
5865	}
5866
5867	function touchstart(e) {
5868		// Don't get in the way of interaction with form elements
5869		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
5870
5871		var touch = e.changedTouches[0];
5872
5873		// iOS live updates the touch objects whereas Android gives us copies.
5874		// That means we can't trust the touchstart object to stay the same,
5875		// so we must copy the data. This object acts as a template for
5876		// movestart, move and moveend event objects.
5877		var data = {
5878			target:     touch.target,
5879			pageX:      touch.pageX,
5880			pageY:      touch.pageY,
5881			identifier: touch.identifier,
5882
5883			// The only way to make handlers individually unbindable is by
5884			// making them unique.
5885			touchmove:  function(e, data) { touchmove(e, data); },
5886			touchend:   function(e, data) { touchend(e, data); }
5887		};
5888
5889		on(document, touchevents.move, data.touchmove, data);
5890		on(document, touchevents.cancel, data.touchend, data);
5891	}
5892
5893	function touchmove(e, data) {
5894		var touch = changedTouch(e, data);
5895		if (!touch) { return; }
5896		checkThreshold(e, data, touch, removeTouch);
5897	}
5898
5899	function touchend(e, data) {
5900		var touch = identifiedTouch(e.changedTouches, data.identifier);
5901		if (!touch) { return; }
5902		removeTouch(data);
5903	}
5904
5905	function removeTouch(data) {
5906		off(document, touchevents.move, data.touchmove);
5907		off(document, touchevents.cancel, data.touchend);
5908	}
5909
5910	function checkThreshold(e, data, touch, fn) {
5911		var distX = touch.pageX - data.pageX;
5912		var distY = touch.pageY - data.pageY;
5913
5914		// Do nothing if the threshold has not been crossed.
5915		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
5916
5917		triggerStart(e, data, touch, distX, distY, fn);
5918	}
5919
5920	function triggerStart(e, data, touch, distX, distY, fn) {
5921		var touches = e.targetTouches;
5922		var time = e.timeStamp - data.timeStamp;
5923
5924		// Create a movestart object with some special properties that
5925		// are passed only to the movestart handlers.
5926		var template = {
5927			altKey:     e.altKey,
5928			ctrlKey:    e.ctrlKey,
5929			shiftKey:   e.shiftKey,
5930			startX:     data.pageX,
5931			startY:     data.pageY,
5932			distX:      distX,
5933			distY:      distY,
5934			deltaX:     distX,
5935			deltaY:     distY,
5936			pageX:      touch.pageX,
5937			pageY:      touch.pageY,
5938			velocityX:  distX / time,
5939			velocityY:  distY / time,
5940			identifier: data.identifier,
5941			targetTouches: touches,
5942			finger: touches ? touches.length : 1,
5943			enableMove: function() {
5944				this.moveEnabled = true;
5945				this.enableMove = noop;
5946				e.preventDefault();
5947			}
5948		};
5949
5950		// Trigger the movestart event.
5951		trigger(data.target, 'movestart', template);
5952
5953		// Unbind handlers that tracked the touch or mouse up till now.
5954		fn(data);
5955	}
5956
5957
5958	// Handlers that control what happens following a movestart
5959
5960	function activeMousemove(e, data) {
5961		var timer  = data.timer;
5962
5963		data.touch = e;
5964		data.timeStamp = e.timeStamp;
5965		timer.kick();
5966	}
5967
5968	function activeMouseend(e, data) {
5969		var target = data.target;
5970		var event  = data.event;
5971		var timer  = data.timer;
5972
5973		removeActiveMouse();
5974
5975		endEvent(target, event, timer, function() {
5976			// Unbind the click suppressor, waiting until after mouseup
5977			// has been handled.
5978			setTimeout(function(){
5979				off(target, 'click', preventDefault);
5980			}, 0);
5981		});
5982	}
5983
5984	function removeActiveMouse() {
5985		off(document, mouseevents.move, activeMousemove);
5986		off(document, mouseevents.end, activeMouseend);
5987	}
5988
5989	function activeTouchmove(e, data) {
5990		var event = data.event;
5991		var timer = data.timer;
5992		var touch = changedTouch(e, event);
5993
5994		if (!touch) { return; }
5995
5996		// Stop the interface from gesturing
5997		e.preventDefault();
5998
5999		event.targetTouches = e.targetTouches;
6000		data.touch = touch;
6001		data.timeStamp = e.timeStamp;
6002
6003		timer.kick();
6004	}
6005
6006	function activeTouchend(e, data) {
6007		var target = data.target;
6008		var event  = data.event;
6009		var timer  = data.timer;
6010		var touch  = identifiedTouch(e.changedTouches, event.identifier);
6011
6012		// This isn't the touch you're looking for.
6013		if (!touch) { return; }
6014
6015		removeActiveTouch(data);
6016		endEvent(target, event, timer);
6017	}
6018
6019	function removeActiveTouch(data) {
6020		off(document, touchevents.move, data.activeTouchmove);
6021		off(document, touchevents.end, data.activeTouchend);
6022	}
6023
6024
6025	// Logic for triggering move and moveend events
6026
6027	function updateEvent(event, touch, timeStamp) {
6028		var time = timeStamp - event.timeStamp;
6029
6030		event.distX =  touch.pageX - event.startX;
6031		event.distY =  touch.pageY - event.startY;
6032		event.deltaX = touch.pageX - event.pageX;
6033		event.deltaY = touch.pageY - event.pageY;
6034
6035		// Average the velocity of the last few events using a decay
6036		// curve to even out spurious jumps in values.
6037		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
6038		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
6039		event.pageX =  touch.pageX;
6040		event.pageY =  touch.pageY;
6041	}
6042
6043	function endEvent(target, event, timer, fn) {
6044		timer.end(function(){
6045			trigger(target, 'moveend', event);
6046			return fn && fn();
6047		});
6048	}
6049
6050
6051	// Set up the DOM
6052
6053	function movestart(e) {
6054		if (e.defaultPrevented) { return; }
6055		if (!e.moveEnabled) { return; }
6056
6057		var event = {
6058			startX:        e.startX,
6059			startY:        e.startY,
6060			pageX:         e.pageX,
6061			pageY:         e.pageY,
6062			distX:         e.distX,
6063			distY:         e.distY,
6064			deltaX:        e.deltaX,
6065			deltaY:        e.deltaY,
6066			velocityX:     e.velocityX,
6067			velocityY:     e.velocityY,
6068			identifier:    e.identifier,
6069			targetTouches: e.targetTouches,
6070			finger:        e.finger
6071		};
6072
6073		var data = {
6074			target:    e.target,
6075			event:     event,
6076			timer:     new Timer(update),
6077			touch:     undefined,
6078			timeStamp: e.timeStamp
6079		};
6080
6081		function update(time) {
6082			updateEvent(event, data.touch, data.timeStamp);
6083			trigger(data.target, 'move', event);
6084		}
6085
6086		if (e.identifier === undefined) {
6087			// We're dealing with a mouse event.
6088			// Stop clicks from propagating during a move
6089			on(e.target, 'click', preventDefault);
6090			on(document, mouseevents.move, activeMousemove, data);
6091			on(document, mouseevents.end, activeMouseend, data);
6092		}
6093		else {
6094			// In order to unbind correct handlers they have to be unique
6095			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
6096			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
6097
6098			// We're dealing with a touch.
6099			on(document, touchevents.move, data.activeTouchmove, data);
6100			on(document, touchevents.end, data.activeTouchend, data);
6101		}
6102	}
6103
6104	on(document, 'mousedown', mousedown);
6105	on(document, 'touchstart', touchstart);
6106	on(document, 'movestart', movestart);
6107
6108
6109	// jQuery special events
6110	//
6111	// jQuery event objects are copies of DOM event objects. They need
6112	// a little help copying the move properties across.
6113
6114	if (!window.jQuery) { return; }
6115
6116	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
6117
6118	function enableMove1(e) { e.enableMove(); }
6119	function enableMove2(e) { e.enableMove(); }
6120	function enableMove3(e) { e.enableMove(); }
6121
6122	function add(handleObj) {
6123		var handler = handleObj.handler;
6124
6125		handleObj.handler = function(e) {
6126			// Copy move properties across from originalEvent
6127			var i = properties.length;
6128			var property;
6129
6130			while(i--) {
6131				property = properties[i];
6132				e[property] = e.originalEvent[property];
6133			}
6134
6135			handler.apply(this, arguments);
6136		};
6137	}
6138
6139	jQuery.event.special.movestart = {
6140		setup: function() {
6141			// Movestart must be enabled to allow other move events
6142			on(this, 'movestart', enableMove1);
6143
6144			// Do listen to DOM events
6145			return false;
6146		},
6147
6148		teardown: function() {
6149			off(this, 'movestart', enableMove1);
6150			return false;
6151		},
6152
6153		add: add
6154	};
6155
6156	jQuery.event.special.move = {
6157		setup: function() {
6158			on(this, 'movestart', enableMove2);
6159			return false;
6160		},
6161
6162		teardown: function() {
6163			off(this, 'movestart', enableMove2);
6164			return false;
6165		},
6166
6167		add: add
6168	};
6169
6170	jQuery.event.special.moveend = {
6171		setup: function() {
6172			on(this, 'movestart', enableMove3);
6173			return false;
6174		},
6175
6176		teardown: function() {
6177			off(this, 'movestart', enableMove3);
6178			return false;
6179		},
6180
6181		add: add
6182	};
6183});
6184
6185  $.fn.twentytwenty = function(options) {
6186    var options = $.extend({
6187      default_offset_pct: 0.5,
6188      orientation: 'horizontal',
6189      before_label: 'Before',
6190      after_label: 'After',
6191      no_overlay: false,
6192      move_slider_on_hover: false,
6193      move_with_handle_only: true,
6194      click_to_move: false
6195    }, options);
6196
6197    return this.each(function() {
6198
6199      var sliderPct = options.default_offset_pct;
6200      var container = $(this);
6201      var sliderOrientation = options.orientation;
6202      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
6203      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
6204
6205
6206      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
6207      if(!options.no_overlay) {
6208        container.append("<div class='twentytwenty-overlay'></div>");
6209        var overlay = container.find(".twentytwenty-overlay");
6210        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
6211        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
6212      }
6213      var beforeImg = container.find("img:first");
6214      var afterImg = container.find("img:last");
6215      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
6216      var slider = container.find(".twentytwenty-handle");
6217      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
6218      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
6219      container.addClass("twentytwenty-container");
6220      beforeImg.addClass("twentytwenty-before");
6221      afterImg.addClass("twentytwenty-after");
6222
6223      var calcOffset = function(dimensionPct) {
6224        var w = beforeImg.width();
6225        var h = beforeImg.height();
6226        return {
6227          w: w+"px",
6228          h: h+"px",
6229          cw: (dimensionPct*w)+"px",
6230          ch: (dimensionPct*h)+"px"
6231        };
6232      };
6233
6234      var adjustContainer = function(offset) {
6235      	if (sliderOrientation === 'vertical') {
6236          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
6237          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
6238      	}
6239      	else {
6240          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
6241          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
6242    	}
6243        container.css("height", offset.h);
6244      };
6245
6246      var adjustSlider = function(pct) {
6247        var offset = calcOffset(pct);
6248        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
6249        adjustContainer(offset);
6250      };
6251
6252      // Return the number specified or the min/max number if it outside the range given.
6253      var minMaxNumber = function(num, min, max) {
6254        return Math.max(min, Math.min(max, num));
6255      };
6256
6257      // Calculate the slider percentage based on the position.
6258      var getSliderPercentage = function(positionX, positionY) {
6259        var sliderPercentage = (sliderOrientation === 'vertical') ?
6260          (positionY-offsetY)/imgHeight :
6261          (positionX-offsetX)/imgWidth;
6262
6263        return minMaxNumber(sliderPercentage, 0, 1);
6264      };
6265
6266
6267      $(window).on("resize.twentytwenty", function(e) {
6268        adjustSlider(sliderPct);
6269      });
6270
6271      var offsetX = 0;
6272      var offsetY = 0;
6273      var imgWidth = 0;
6274      var imgHeight = 0;
6275      var onMoveStart = function(e) {
6276        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6277          e.preventDefault();
6278        }
6279        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6280          e.preventDefault();
6281        }
6282        container.addClass("active");
6283        offsetX = container.offset().left;
6284        offsetY = container.offset().top;
6285        imgWidth = beforeImg.width();
6286        imgHeight = beforeImg.height();
6287      };
6288      var onMove = function(e) {
6289        if (container.hasClass("active")) {
6290          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6291          adjustSlider(sliderPct);
6292        }
6293      };
6294      var onMoveEnd = function() {
6295          container.removeClass("active");
6296      };
6297
6298      var moveTarget = options.move_with_handle_only ? slider : container;
6299      moveTarget.on("movestart",onMoveStart);
6300      moveTarget.on("move",onMove);
6301      moveTarget.on("moveend",onMoveEnd);
6302
6303      if (options.move_slider_on_hover) {
6304        container.on("mouseenter", onMoveStart);
6305        container.on("mousemove", onMove);
6306        container.on("mouseleave", onMoveEnd);
6307      }
6308
6309      slider.on("touchmove", function(e) {
6310        e.preventDefault();
6311      });
6312
6313      container.find("img").on("mousedown", function(event) {
6314        event.preventDefault();
6315      });
6316
6317      if (options.click_to_move) {
6318        container.on('click', function(e) {
6319          offsetX = container.offset().left;
6320          offsetY = container.offset().top;
6321          imgWidth = beforeImg.width();
6322          imgHeight = beforeImg.height();
6323
6324          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6325          adjustSlider(sliderPct);
6326        });
6327      }
6328
6329      $(window).trigger("resize.twentytwenty");
6330    });
6331  };
6332
6333
6334  $(window).on("load", function(e) {
6335  	$('.twentytwenty-container').each(function(){
6336  		var $container = $(this);
6337  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6338  			$container.twentytwenty();
6339  		}
6340  		$('img', $container).on('async-done', function(){
6341	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6342	  			$container.twentytwenty();
6343	  		}
6344	    });
6345  	});
6346  });
6347}
6348
6349UNCODE.justifiedGallery = function() {
6350
6351	var breakPointMe = function( val ) {
6352		val = parseInt( val );
6353		if ( isNaN(val) ) {
6354			return false;
6355		}
6356		if ( val >= 1500 ) {
6357			return 1;
6358		} else if ( val < 1500 && val >= 960 ) {
6359			return 2;
6360		} else if ( val < 960 && val >= 570 ) {
6361			return 3;
6362		} else if ( val < 570 ) {
6363			return 4;
6364		}
6365	}
6366
6367	var gutterByBreakpoint = function( bp, gutter ) {
6368		var ret;
6369		switch(gutter) {
6370		    case 'no-gutter':
6371		    	ret = 0;
6372		        break;
6373		    case 'px-gutter':
6374		    	ret = 1;
6375		        break;
6376		    case 'half-gutter':
6377		    	ret = 18;
6378		        break;
6379		    case 'double-gutter':
6380				switch(bp) {
6381				    case 3:
6382				    case 4:
6383				    	ret = 36;
6384				        break;
6385				    default:
6386				    	ret = 72;
6387				        break;
6388				}
6389		        break;
6390		    case 'triple-gutter':
6391				switch(bp) {
6392				    case 3:
6393				    case 4:
6394				    	ret = 36;
6395				        break;
6396				    default:
6397				    	ret = 108;
6398				        break;
6399				}
6400		        break;
6401		    case 'quad-gutter':
6402				switch(bp) {
6403				    case 2:
6404				    	ret = 108;
6405				        break;
6406				    case 3:
6407				    	ret = 72;
6408				        break;
6409				    case 4:
6410				    	ret = 36;
6411				        break;
6412				    default:
6413				    	ret = 144;
6414				        break;
6415				}
6416		        break;
6417		    default:
6418		    	ret = 36;//single-gutter
6419		}
6420		return ret;
6421	}
6422
6423	if ($('.justified-layout').length > 0) {
6424		var justifiedContainersArray = [],
6425			typeGridArray = [],
6426			layoutGridArray = [],
6427			transitionDuration = [],
6428			$filterItems = [],
6429			$filters = $('.justified-system .isotope-filters'),
6430			$itemSelector = '.tmb',
6431			$items,
6432			itemMargin,
6433			correctionFactor = 0,
6434			firstLoad = true,
6435			isOriginLeft = $('body').hasClass('rtl') ? false : true,
6436			prevW = breakPointMe(UNCODE.wwidth);
6437		$('[class*="justified-container"]').each(function() {
6438			var isoData = $(this).data();
6439			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6440			if (isoData.type == 'metro') typeGridArray.push(true);
6441			else typeGridArray.push(false);
6442			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
6443			else layoutGridArray.push('justified');
6444			justifiedContainersArray.push($(this));
6445		});
6446		var init_justifiedGallery = function() {
6447			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
6448				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
6449					justifiedId = justifiedSystem.attr('id'),
6450					$layoutMode = layoutGridArray[i],
6451					gutter = $(justifiedContainersArray[i]).data('gutter'),
6452					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
6453					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
6454					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6455					margins;
6456
6457				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6458				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6459				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6460
6461				margins = gutterByBreakpoint(prevW, gutter);
6462
6463				$(justifiedContainersArray[i]).justifiedGallery({
6464					rowHeight: rowHeight,
6465					maxRowHeight: maxRowHeight,
6466					margins: margins,
6467					cssAnimation: true,
6468					lastRow: lastRow,
6469					waitThumbnailsLoad: false
6470				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6471
6472				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6473					$(justifiedContainersArray[i]).infinitescroll({
6474							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6475							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6476							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6477							animate: false,
6478							behavior: 'local',
6479							debug: false,
6480							loading: {
6481								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6482								speed: 0,
6483								finished: undefined,
6484								msg: $('#' + justifiedId + ' .loadmore-button'),
6485							},
6486							errorCallback: function() {
6487								var justified_system = $(this).closest('.justified-system');
6488								$('.loading-button', justified_system).hide();
6489								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
6490							}
6491						},
6492						// append the new items to galleryJustified on the infinitescroll callback function.
6493						function(newElements, opts) {
6494							var $galleryJustified = $(this),
6495								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
6496								filters = new Array(),
6497								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
6498								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
6499								$numPages = $('a', $infinite_button).data('pages'),
6500								delay = 300;
6501							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6502							$infinite_button.show();
6503							$loading_button.hide();
6504							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6505							$('> li', $galleryJustified).remove();
6506							$.each($(newElements), function(index, val) {
6507								$(val).addClass('tmb-iso');
6508								if ($(val).is("li")) {
6509									filters.push($(val)[0]);
6510								}
6511								$(val).addClass('uncode-appended');
6512							});
6513							newElements = newElements.filter(function(x) {
6514								return filters.indexOf(x) < 0
6515							});
6516							$.each($(filters), function(index, val) {
6517								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
6518							});
6519							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
6520							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6521								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
6522								if (typeof getLightbox === 'object') {
6523									getLightbox.refresh();
6524								} else {
6525									UNCODE.lightbox();
6526								}
6527							}
6528							if ( typeof twttr !== 'undefined' )
6529								twttr.widgets.load(justifiedContainersArray[i]);
6530
6531							requestTimeout(function() {
6532								$galleryJustified.trigger('more-items-loaded');
6533								$(window).trigger('more-items-loaded');
6534								window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6535							}, 1000);
6536						});
6537					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
6538						var $infinite_justified = $(justifiedContainersArray[i]),
6539							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
6540						$infinite_justified.infinitescroll('pause');
6541						$infinite_button.on('click', function(event) {
6542							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6543								$.each(UNCODE.lightboxArray, function(index, val) {
6544									UNCODE.lightboxArray[index].destroy();
6545								});
6546							}
6547							event.preventDefault();
6548							var $justified_system = $(event.target).closest('.justified-system'),
6549							$infinite_justified = $justified_system.find('.justified-container'),
6550							justifiedId = $justified_system.attr('id');
6551							$(event.currentTarget).html(SiteParameters.loading);
6552							$infinite_justified.infinitescroll('resume');
6553							$infinite_justified.infinitescroll('retrieve');
6554							$infinite_justified.infinitescroll('pause');
6555							$infinite_justified.trigger('more-items-loaded');
6556							$(window).trigger('more-items-loaded');
6557							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6558						});
6559					}
6560				}
6561			}
6562		},
6563		onLayout = function(justifiedObj, startIndex) {
6564			justifiedObj.css('opacity', 1);
6565			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
6566			$('.tmb', justifiedObj).addClass('justified-object-loaded');
6567
6568			requestTimeout(function() {
6569				// window.dispatchEvent(UNCODE.boxEvent);
6570				UNCODE.adaptive();
6571				if (SiteParameters.dynamic_srcset_active === '1') {
6572					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
6573				}
6574				if (typeof MediaElement === "function") {
6575					$(justifiedObj).find('audio,video').each(function() {
6576						$(this).mediaelementplayer({
6577								pauseOtherPlayers: false,
6578						});
6579					});
6580				}
6581				if ($(justifiedObj).find('.nested-carousel').length) {
6582					if (typeof UNCODE.carousel !== 'undefined') {
6583						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
6584					}
6585					requestTimeout(function() {
6586						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6587						justifiedObj.addClass('justified-gallery-finished')
6588						Waypoint.refreshAll();
6589					}, 200);
6590				} else {
6591					requestTimeout(function() {
6592						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6593						justifiedObj.addClass('justified-gallery-finished')
6594						Waypoint.refreshAll();
6595					}, 300);
6596				}
6597			}, 100);
6598
6599		},
6600		boxAnimation = function(items, startIndex, sequential, container) {
6601			var $allItems = items.length - startIndex,
6602				showed = 0,
6603				index = 0;
6604			if (container.closest('.owl-item').length == 1) return false;
6605			$.each(items, function(index, val) {
6606				var elInner = $('> .t-inside', val);
6607				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
6608					return;
6609				}
6610				if (val[0]) val = val[0];
6611				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
6612					new Waypoint({
6613						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
6614						element: val,
6615						handler: function() {
6616							var element = $('> .t-inside', this.element),
6617								parent = $(this.element),
6618								currentIndex = parent.index();
6619							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
6620								delayAttr = parseInt(element.attr('data-delay'));
6621							if (isNaN(delayAttr)) delayAttr = 100;
6622							delay -= showed;
6623							var objTimeout = requestTimeout(function() {
6624								element.removeClass('zoom-reverse').addClass('start_animation');
6625								showed = parent.index();
6626							}, delay * delayAttr);
6627							parent.data('objTimeout', objTimeout);
6628							if (!UNCODE.isUnmodalOpen) {
6629								this.destroy();
6630							}
6631						},
6632						offset: '100%'
6633					})
6634				} else {
6635					elInner.removeClass('animate_when_almost_visible');
6636					$(val).addClass('no-waypoint-animation');
6637					/*if (elInner.hasClass('force-anim')) {
6638						elInner.addClass('start_animation');
6639					} else {
6640						elInner.css('opacity', 1);
6641					}*/
6642				}
6643				index++;
6644			});
6645		};
6646		$filters.on('click', 'a[data-filter]', function(evt) {
6647			var $filter = $(this),
6648				filterContainer = $filter.closest('.isotope-filters'),
6649				filterValue = $filter.attr('data-filter'),
6650				container = $filter.closest('.justified-system').find($('.justified-layout')),
6651				lastRow = container.data('last-row'),
6652				transitionDuration = 0,
6653				delay = 300,
6654				filterItems = [];
6655
6656			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6657
6658			var filter_items = function(){
6659				if (filterValue !== undefined) {
6660					$.each($('> .tmb > .t-inside', container), function(index, val) {
6661						var parent = $(val).parent(),
6662							objTimeout = parent.data('objTimeout');
6663						if (objTimeout) {
6664							$(val).removeClass('zoom-reverse');
6665							clearRequestTimeout(objTimeout);
6666						}
6667						if (transitionDuration == 0) {
6668							if ($(val).hasClass('animate_when_almost_visible')) {
6669								$(val).addClass('zoom-reverse').removeClass('start_animation');
6670							} else {
6671								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6672							}
6673						}
6674					});
6675
6676					requestTimeout(function() {
6677						var $block,
6678							selector,
6679							lightboxElements,
6680							$boxes;
6681
6682						if ( filterValue !== '' && filterValue !== '*' ) {
6683							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
6684							selector = '.' + filterValue;
6685							$.each($(selector, container), function(index, block) {
6686								lightboxElements = $('[data-lbox^=ilightbox]', block);
6687								if (lightboxElements.length) {
6688									lightboxElements.removeClass('lb-disabled');
6689									container.data('lbox', $(lightboxElements[0]).data('lbox'));
6690								}
6691								filterItems.push(block);
6692							});
6693							container.justifiedGallery({
6694								filter: selector,
6695								lastRow: 'nojustify'
6696							});
6697						} else {
6698							container.justifiedGallery({
6699								filter: false,
6700								lastRow: lastRow
6701							});
6702							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
6703							filterItems = $('> .tmb', container);
6704						}
6705						container.trigger('more-items-loaded');
6706						$(window).trigger('more-items-loaded');
6707						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6708
6709						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6710						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6711							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
6712							if (typeof getLightbox === 'object') {
6713								getLightbox.refresh();
6714							} else {
6715								UNCODE.lightbox();
6716							}
6717						}
6718
6719						if (transitionDuration == 0) {
6720							requestTimeout(function() {
6721								boxAnimation(filterItems, 0, false, container);
6722							}, 100);
6723						}
6724						requestTimeout(function() {
6725							Waypoint.refreshAll();
6726							container.trigger('more-items-loaded');
6727							$(window).trigger('more-items-loaded');
6728							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6729							if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
6730								$(document).trigger('uncode-scrolltrigger-refresh');
6731							}
6732						}, 2000);
6733
6734					}, delay);
6735				} else {
6736					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6737						$.each(UNCODE.lightboxArray, function(index, val) {
6738							UNCODE.lightboxArray[index].destroy();
6739						});
6740					}
6741					$.each($('> .tmb > .t-inside', container), function(index, val) {
6742						var parent = $(val).parent(),
6743							objTimeout = parent.data('objTimeout');
6744						if (objTimeout) {
6745							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6746							clearRequestTimeout(objTimeout);
6747						}
6748						if (transitionDuration == 0) {
6749							if ($(val).hasClass('animate_when_almost_visible')) {
6750								$(val).addClass('zoom-reverse').removeClass('start_animation');
6751							} else {
6752								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6753							}
6754						}
6755					});
6756					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6757						UNCODE.lightbox();
6758					}
6759					container.parent().addClass('justified-loading');
6760					container.trigger('more-items-loaded');
6761					$(window).trigger('more-items-loaded');
6762					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6763				}
6764			};
6765
6766			if (!$filter.hasClass('active')) {
6767				/** Scroll top with filtering */
6768				if (filterContainer.hasClass('filter-scroll')) {
6769                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6770                    calc_scroll -= UNCODE.get_scroll_offset();
6771
6772					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6773						delta = bodyTop - calc_scroll,
6774						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6775						filterTolerance = false,
6776						filter_timeout;
6777					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6778
6779					if ( !UNCODE.isFullPage ) {
6780						if (scrollSpeed == 0) {
6781							$('html, body').scrollTop(calc_scroll);
6782							UNCODE.scrolling = false;
6783							filter_items();
6784						} else {
6785
6786							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6787								filter_items();
6788								filterTolerance = true;
6789							}
6790
6791							$('html, body').animate({
6792								scrollTop: calc_scroll
6793							},{
6794								easing: 'easeInOutQuad',
6795								duration: scrollSpeed,
6796								complete: function(){
6797									UNCODE.scrolling = false;
6798									if ( !filterTolerance ) {
6799										filter_timeout = setTimeout(function(){
6800											clearTimeout(filter_timeout);
6801											filter_items();
6802										}, 200);
6803									}
6804								}
6805							});
6806						}
6807					}
6808				} else {
6809					filter_items();
6810				}
6811			}
6812			evt.preventDefault();
6813		});
6814
6815		$filters.each(function(i, buttonGroup) {
6816			var $buttonGroup = $(buttonGroup);
6817			$buttonGroup.on('click', 'a', function() {
6818				$buttonGroup.find('.active').removeClass('active');
6819				$(this).addClass('active');
6820			});
6821
6822			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6823				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6824				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6825			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6826				e.preventDefault();
6827				$cats_filters.slideToggle(400, 'easeInOutCirc');
6828			});
6829		});
6830		window.addEventListener('boxResized', function(e) {
6831			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
6832				prevW = breakPointMe(UNCODE.wwidth);
6833				$.each($('.justified-layout'), function(index, val) {
6834					var gutter = $(this).data('gutter'),
6835						margins = gutterByBreakpoint( prevW, gutter);
6836					$(this).justifiedGallery({
6837						margins: margins
6838					});
6839					$(this).find('.mejs-video,.mejs-audio').each(function() {
6840						$(this).trigger('resize');
6841					});
6842				});
6843			}
6844		}, false);
6845
6846		init_justifiedGallery();
6847	};
6848};
6849
6850UNCODE.cssGrid = function() {
6851	if ($('.cssgrid-layout').length > 0) {
6852		var cssGridContainersArray = [];
6853		var transitionDuration = [];
6854		var $filters = $('.cssgrid-system .cssgrid-filters');
6855
6856		$('[class*="cssgrid-container"]').each(function() {
6857			cssGridContainersArray.push($(this));
6858			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6859		});
6860
6861		var init_cssGridAjax = function() {
6862			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
6863				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
6864					cssGridId = cssGridSystem.attr('id');
6865
6866				cssGridSystem.data('transitionDuration', transitionDuration[i]);
6867
6868				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
6869					$(cssGridContainersArray[i]).infinitescroll({
6870						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
6871						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6872						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
6873						animate: false,
6874						behavior: 'local',
6875						debug: false,
6876						loading: {
6877							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
6878							speed: 0,
6879							finished: undefined,
6880							msg: $('#' + cssGridId + ' .loadmore-button'),
6881						},
6882						errorCallback: function() {
6883							var cssgrid_system = $(this).closest('.cssgrid-system');
6884							$('.loading-button', cssgrid_system).hide();
6885							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
6886						}
6887					},
6888					// append the new items to cssGrid on the infinitescroll callback function.
6889					function(newElements, opts) {
6890						var $cssGrid = $(this),
6891							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
6892							cssGridId = cssGridSystemCont.attr('id'),
6893							filters = new Array(),
6894							$loading_button = cssGridSystemCont.find('.loading-button'),
6895							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
6896							$numPages = $('a', $infinite_button).data('pages'),
6897							$woo_results,
6898							delay = 300;
6899						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6900						$infinite_button.show();
6901						$loading_button.hide();
6902						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6903						$('> li', $cssGrid).remove();
6904						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
6905						$.each($(newElements), function (index, val) {
6906							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
6907								$woo_results = $(val);
6908								delete newElements[index];
6909							} else {
6910								$(val).addClass('tmb-grid');
6911								if ($(val).is("li")) {
6912									filters.push($(val)[0]);
6913								}
6914							}
6915							$(val).addClass('uncode-appended');
6916						});
6917						newElements = newElements.filter(function(x) {
6918							return filters.indexOf(x) < 0
6919						});
6920						$.each($(filters), function(index, val) {
6921							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
6922						});
6923						if ($woo_results && $woo_results.length > 0) {
6924							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
6925							var new_count = $woo_results.find('.woocommerce-result-count').text();
6926							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
6927							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
6928							function replaceMatch(match, p1, p2) {
6929        						return old_start + '–' + new_end;
6930							}
6931							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
6932							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
6933						}
6934
6935						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6936						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
6937						if (filterValue !== undefined && filterValue != '*') {
6938							$(newElements).hide();
6939							var els_to_show = $();
6940							$(newElements).each(function() {
6941								var el = $(this);
6942								if (el.hasClass(filterValue)) {
6943									els_to_show = els_to_show.add(el);
6944									el.show();
6945								}
6946							});
6947							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
6948						} else {
6949							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
6950						}
6951
6952						UNCODE.adaptive();
6953						if (SiteParameters.dynamic_srcset_active === '1') {
6954							UNCODE.refresh_dynamic_srcset_size($cssGrid);
6955						}
6956						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6957							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
6958							if (typeof getLightbox === 'object') {
6959								getLightbox.refresh();
6960							} else {
6961								UNCODE.lightbox();
6962							}
6963						}
6964						if ( typeof twttr !== 'undefined' ) {
6965							twttr.widgets.load(cssGridContainersArray[i]);
6966						}
6967
6968						UNCODE.carousel($(newElements));
6969						requestTimeout(function() {
6970							$cssGrid.trigger('more-items-loaded');
6971							$(window).trigger('more-items-loaded');
6972							window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
6973						}, 1000);
6974
6975					});
6976					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
6977						var $cssgrid_el = $(cssGridContainersArray[i]),
6978							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
6979						$cssgrid_el.infinitescroll('pause');
6980						$infinite_button.on('click', function(event) {
6981							event.preventDefault();
6982							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
6983							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
6984							cssGridId = $cssgrid_system.attr('id');
6985							$(event.currentTarget).html(SiteParameters.loading);
6986							$cssgrid_el.infinitescroll('resume');
6987							$cssgrid_el.infinitescroll('retrieve');
6988							$cssgrid_el.infinitescroll('pause');
6989						});
6990					}
6991				}
6992			}
6993		};
6994
6995		init_cssGridAjax();
6996
6997		if ($('.cssgrid-pagination').length > 0) {
6998			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
6999				evt.preventDefault();
7000
7001				if (SiteParameters.index_pagination_disable_scroll !== '1') {
7002					var container = $(this).closest('.cssgrid-system'),
7003						pagination_disable_scroll = container.attr('data-pagination-scroll'),
7004						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7005
7006					if ( pagination_disable_scroll === 'disabled' ) {
7007						return;
7008					}
7009
7010					calc_scroll -= UNCODE.get_scroll_offset();
7011
7012					var menu_container = $('.menu-sticky');
7013					var menu = menu_container.find('.menu-container');
7014
7015					if (menu_container.length > 0 && menu.length > 0) {
7016						calc_scroll = calc_scroll - menu.outerHeight();
7017					}
7018
7019					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7020						delta = bodyTop - calc_scroll,
7021						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7022					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7023
7024					if ( !UNCODE.isFullPage ) {
7025						if (scrollSpeed == 0) {
7026							$('html, body').scrollTop(calc_scroll);
7027						} else {
7028							$('html, body').animate({
7029								scrollTop: calc_scroll
7030							},{
7031								easing: 'easeInOutQuad',
7032								duration: scrollSpeed,
7033								complete: function(){
7034									UNCODE.scrolling = false;
7035								}
7036							});
7037						}
7038					}
7039				}
7040
7041				loadCssGrid($(this), true);
7042			});
7043		}
7044
7045		$filters.on('click', 'a.grid-nav-link', function(evt) {
7046			if ($(this).hasClass('no-grid-filter')) {
7047				return;
7048			}
7049			var $filter = $(this),
7050				filterContainer = $filter.closest('.cssgrid-filters'),
7051				filterValue = $filter.attr('data-filter'),
7052				containerSystem = $filter.closest('.cssgrid-system'),
7053				container = containerSystem.find($('.cssgrid-layout')),
7054				transitionDuration = containerSystem.data('transitionDuration'),
7055				delay = 300,
7056				filterItems = [],
7057				all_thumbs = container.find('.tmb-grid');
7058
7059			var filter_items = function(){
7060				if (filterValue !== undefined) {
7061					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7062						var parent = $(val).parent(),
7063							objTimeout = parent.data('objTimeout');
7064						if (objTimeout) {
7065							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7066							clearRequestTimeout(objTimeout);
7067						}
7068						if (transitionDuration == 0) {
7069							if ($(val).hasClass('animate_when_almost_visible')) {
7070								$(val).addClass('zoom-reverse').removeClass('start_animation');
7071							} else {
7072								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7073							}
7074						}
7075					});
7076					requestTimeout(function(){
7077						if ( filterValue == '*' ) {
7078							all_thumbs.show();
7079							all_thumbs.each(function(index, val) {
7080								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7081								filterItems.push($(this));
7082							});
7083						} else {
7084							all_thumbs.each(function() {
7085								var _tmb = $(this);
7086								if (_tmb.hasClass(filterValue)) {
7087									_tmb.show();
7088									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
7089									filterItems.push(_tmb);
7090								} else {
7091									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
7092									_tmb.hide();
7093								}
7094							});
7095						}
7096
7097						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
7098
7099						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7100						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
7101						var lightboxElements = $('[data-lbox^=ilightbox]', container);
7102						if (lightboxElements.length) {
7103							container.data('lbox', $(lightboxElements[0]).data('lbox'));
7104							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7105								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
7106								if (typeof getLightbox === 'object') {
7107									getLightbox.refresh();
7108								} else {
7109									UNCODE.lightbox();
7110								}
7111							}
7112						}
7113						container.trigger('more-items-loaded');
7114						$(window).trigger('more-items-loaded');
7115						window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7116					}, delay);
7117				} else {
7118					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
7119						var parent = $(val).parent(),
7120							objTimeout = parent.data('objTimeout');
7121						if (objTimeout) {
7122							$(val).removeClass('zoom-reverse').removeClass('start_animation')
7123							clearRequestTimeout(objTimeout);
7124						}
7125						if (transitionDuration == 0) {
7126							if ($(val).hasClass('animate_when_almost_visible')) {
7127								$(val).addClass('zoom-reverse').removeClass('start_animation');
7128							} else {
7129								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
7130							}
7131						}
7132					});
7133					loadCssGrid($filter);
7134				}
7135			};
7136
7137			if (!$filter.hasClass('active')) {
7138				/** Scroll top with filtering */
7139				if (filterContainer.hasClass('filter-scroll')) {
7140                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
7141                    calc_scroll -= UNCODE.get_scroll_offset();
7142
7143					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7144						delta = bodyTop - calc_scroll,
7145						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
7146						filterTolerance = false,
7147						filter_timeout;
7148					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7149
7150					if ( !UNCODE.isFullPage ) {
7151						if (scrollSpeed == 0) {
7152							$('html, body').scrollTop(calc_scroll);
7153							UNCODE.scrolling = false;
7154							filter_items();
7155						} else {
7156
7157							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
7158								filter_items();
7159								filterTolerance = true;
7160							}
7161
7162							$('html, body').animate({
7163								scrollTop: calc_scroll
7164							},{
7165								easing: 'easeInOutQuad',
7166								duration: scrollSpeed,
7167								complete: function(){
7168									UNCODE.scrolling = false;
7169									if ( !filterTolerance ) {
7170										filter_timeout = setTimeout(function(){
7171											clearTimeout(filter_timeout);
7172											filter_items();
7173										}, 200);
7174									}
7175								}
7176							});
7177						}
7178					}
7179				} else {
7180					filter_items();
7181				}
7182			}
7183			evt.preventDefault();
7184		});
7185
7186		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
7187			var params = UNCODE.getURLParams(window.location);
7188			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
7189
7190			UNCODE.lastURL = window.location.href;
7191
7192			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
7193				return;
7194			}
7195
7196			if (params.id === undefined) {
7197				$.each($('.cssgrid-system'), function(index, val) {
7198					loadCssGrid($(val));
7199				});
7200			} else {
7201				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
7202					loadCssGrid($('#' + params.id));
7203				}
7204			}
7205		});
7206
7207		var loadCssGrid = function($href, $paginating) {
7208			var is_paginating = false;
7209
7210			if (undefined !== $paginating && $paginating) {
7211				var is_paginating = $paginating;
7212			}
7213
7214			var href = ($href.is("a") ? $href.attr('href') : location),
7215				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
7216				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
7217				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
7218				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
7219				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
7220				cssgridId = cssgridSystem.attr('id');
7221			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
7222				UNCODE.lastURL = href;
7223				history.pushState({
7224					myCSSgrid: true
7225				}, document.title, href);
7226			}
7227			cssgridWrapper.addClass('cssgrid-loading');
7228			if (is_paginating) {
7229				cssgridWrapper.addClass('grid-filtering');
7230			}
7231			$.ajax({
7232				url: href
7233			}).done(function(data) {
7234				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
7235					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
7236					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
7237				requestTimeout(function() {
7238					cssgridContainer.html($resultItems);
7239					cssgridWrapper.removeClass('cssgrid-loading');
7240					cssgridWrapper.removeClass('grid-filtering');
7241					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
7242					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
7243					UNCODE.adaptive();
7244					if (SiteParameters.dynamic_srcset_active === '1') {
7245						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
7246					}
7247					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
7248						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
7249						if (typeof getLightbox === 'object') {
7250							getLightbox.refresh();
7251						} else {
7252							UNCODE.lightbox();
7253						}
7254					}
7255					cssgridContainer.trigger('more-items-loaded');
7256					$(window).trigger('more-items-loaded');
7257					window.dispatchEvent(new CustomEvent('uncode-more-items-loaded'));
7258				}, 300);
7259
7260				$('.pagination', cssgridFooter).remove();
7261				cssgridFooter.append($resultPagination);
7262
7263				if (cssgridResultCount.length > 0) {
7264					$('.woocommerce-result-count', cssgridResultCount).remove();
7265					cssgridResultCount.append($resultCount);
7266				}
7267			});
7268		};
7269
7270		$filters.each(function(i, buttonGroup) {
7271			var $buttonGroup = $(buttonGroup);
7272			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
7273				$buttonGroup.find('.active').removeClass('active');
7274				$(this).addClass('active');
7275
7276			});
7277
7278			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7279				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7280				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7281			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7282				e.preventDefault();
7283				$cats_filters.slideToggle(400, 'easeInOutCirc');
7284			});
7285
7286		});
7287	};
7288};
7289
7290UNCODE.linearGrid = function(){
7291	$('.linear-wrapper').each(function(){
7292		var $wrap = $(this),
7293			$system = $wrap.closest('.linear-system'),
7294			$dragger = $('[data-dragger]', $system),
7295			$row = $wrap.closest('.vc_row[data-parent]'),
7296			_row = $row[0],
7297			$cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap),
7298			vertical = $cont.hasClass('linear-or-vertical'),
7299			clone = $wrap.attr('data-infinite') === 'yes' || vertical,
7300			freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop',
7301			freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile',
7302			dataSpeed = parseFloat( $wrap.attr('data-speed') ),
7303			isInViewport = false,
7304			isHover = false,
7305			init = false,
7306			stableHeight = UNCODE.wheight,
7307			wCont, hCont, docH, marqueeTL;
7308
7309		dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
7310		var dataX = dataSpeed;
7311
7312		dataSpeed += 5;
7313
7314		var checkLinearGridSize = function(){
7315			if ( !$wrap.is(':visible') )  {
7316				return;
7317			}
7318			$wrap.find('.cont-appended').remove();
7319
7320			if ( vertical ) {
7321				if ( ! SiteParameters.is_frontend_editor ) {
7322					hCont = $cont.outerHeight();
7323					docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed );
7324					if ( hCont < docH ) {
7325						var res = docH - hCont * 3,
7326							times = 2 * Math.round((res/hCont+1) / 2);
7327					}
7328					for ( var i = 0; i < times; i++ ) {
7329						var $cloneCont = $cont.clone(),
7330							$cloneCont2 = $cont.clone(),
7331							trans = ( (i+2) ) * 100;
7332						$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'}));
7333						$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'}));
7334						$cloneCont.find('a[data-lbox]').each(function(){
7335							var dataLbox = $(this).attr('data-lbox');
7336							$(this).attr('data-lbox', dataLbox + '_' + i);
7337						});
7338						$cloneCont.find('.wp-video-shortcode').each(function(){
7339							var thisID = $(this).attr('id');
7340							$(this).attr('id', thisID + '_' + i);
7341						});
7342						$cloneCont2.find('a[data-lbox]').each(function(){
7343							var dataLbox = $(this).attr('data-lbox');
7344							$(this).attr('data-lbox', dataLbox + '_2' + i);
7345						});
7346						$cloneCont2.find('.wp-video-shortcode').each(function(){
7347							var thisID = $(this).attr('id');
7348							$(this).attr('id', thisID + '__' + i);
7349						});
7350						if ( $('.lbox-trigger-item', $cloneCont).length ) {
7351							UNCODE.lightgallery($cloneCont);
7352							UNCODE.lightgallery($cloneCont2);
7353						}
7354					}
7355                }
7356			} else {
7357				wCont = $cont.outerWidth();
7358				if ( (wCont) < UNCODE.wwidth*2 ) {
7359					var res = UNCODE.wwidth*2 - (wCont),
7360						times = 2 * Math.round((res/wCont+1) / 2);
7361				}
7362				for ( var i = 0; i < times; i++ ) {
7363					var $cloneCont = $cont.clone(),
7364						$cloneCont2 = $cont.clone(),
7365						trans = ( (i+2) ) * 100;
7366					$wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'}));
7367					$wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'}));
7368					$cloneCont.find('a[data-lbox]').each(function(){
7369						var dataLbox = $(this).attr('data-lbox');
7370						$(this).attr('data-lbox', dataLbox + '_' + i);
7371					});
7372					$cloneCont.find('[id]').each(function(){
7373						var thisID = $(this).attr('id');
7374						$(this).attr('id', thisID + '_' + i);
7375					});
7376					$cloneCont2.find('a[data-lbox]').each(function(){
7377						var dataLbox = $(this).attr('data-lbox');
7378						$(this).attr('data-lbox', dataLbox + '_2' + i);
7379					});
7380					$cloneCont2.find('[id]').each(function(){
7381						var thisID = $(this).attr('id');
7382						$(this).attr('id', thisID + '__' + i);
7383					});
7384                    if ( $('.lbox-trigger-item', $cloneCont).length ) {
7385                        UNCODE.lightgallery($cloneCont);
7386                        UNCODE.lightgallery($cloneCont2);
7387                    }
7388                }
7389			}
7390		};
7391		if ( clone ) {
7392			checkLinearGridSize();
7393			$(window).on('resize.linearGrid', function(){
7394				checkLinearGridSize();
7395			});
7396		}
7397
7398		var continuousLinearMarquee = function(_xStrt){
7399			if ( !$wrap.is(':visible') )  {
7400				return;
7401			}
7402			var ease = 'none';
7403			wCont = $cont.outerWidth();
7404			hCont = $cont.outerHeight();
7405
7406			var xStrt = typeof _xStrt === 'undefined' ?  0 : _xStrt,
7407				xEnd = vertical ? hCont : wCont,
7408				direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7409				speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed,
7410				speedSlow = (xEnd + xStrt) / 45,
7411				freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7412
7413			marqueeTL = new TimelineMax({paused:true, reversed:true});
7414
7415			if ( isInViewport && !isHover && !freezed ) {
7416				marqueeTL.play();
7417
7418				if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) {
7419					var $column = $wrap.closest('.wpb_column'),
7420						$col_link = $('.col-link', $column),
7421						$hover_sel = $wrap;
7422
7423					if ( $col_link.length ) {
7424						$hover_sel = $wrap.add($column);
7425					}
7426
7427					$hover_sel.on('mouseover', function(){
7428						if ( $wrap.attr('data-hover') === 'yes' ) {
7429							//speed = ( 10 - dataSpeed ) * 5;
7430							ease = 'power2.out';
7431							marqueeTL.duration( speedSlow );
7432						} else {
7433							marqueeTL.pause();
7434						}
7435						isHover = true;
7436					}).on('mouseout', function(){
7437						if ( $wrap.attr('data-hover') === 'yes' ) {
7438							speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed;
7439							ease = 'power2.in';
7440							marqueeTL.duration( speed );
7441						} else {
7442							marqueeTL.play();
7443						}
7444						isHover = false;
7445					});
7446				}
7447
7448			}
7449	
7450			gsap.killTweensOf($wrap);
7451			if ( vertical ) {
7452				marqueeTL.fromTo( $wrap, {
7453					y: xStrt * direction
7454				},
7455				{
7456					duration: speed,
7457					y: xEnd * direction * -1,
7458					onComplete: function(){
7459						continuousLinearMarquee();
7460					},
7461					ease: ease,
7462					paused: freezed
7463				});
7464			} else {
7465				marqueeTL.fromTo( $wrap, {
7466					x: xStrt * direction
7467				},
7468				{
7469					duration: speed,
7470					x: xEnd * direction * -1,
7471					onComplete: function(){
7472						continuousLinearMarquee();
7473					},
7474					ease: ease,
7475					paused: freezed
7476				});
7477			}
7478		};
7479
7480		var dragLinearContinuous = function(){
7481			if ( !$wrap.is(':visible') )  {
7482				return;
7483			}
7484			var matrix, _x, _y,
7485				dragAction = false;
7486			Draggable.create($wrap[0], {
7487				type: vertical ? "y" : "x",
7488				bounds: document.getElementById("container"),
7489				inertia: false,
7490				onPress: function (e) {
7491				},
7492				onRelease: function (e) {
7493					if ( dragAction === true ) {
7494						matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7495						_x = matrix[12] || matrix[4];
7496						_y = matrix[13] || matrix[5];
7497						if ( vertical ) {
7498							continuousLinearMarquee(_y * -1);
7499						} else {
7500							continuousLinearMarquee(_x * -1);
7501						}
7502						$wrap.removeClass('linear-dragging');
7503					}
7504				},
7505				onDrag: function (e) {
7506					dragAction = true;
7507					$wrap.addClass('linear-dragging');
7508				},
7509				onDragEnd: function (e) {
7510					matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7511					_x = matrix[12] || matrix[4];
7512					_y = matrix[13] || matrix[5];
7513					wCont = $cont.outerWidth();
7514					hCont = $cont.outerHeight();
7515					if ( vertical ) {
7516						if ( Math.abs(_y) > hCont ) {
7517							if ( _y < 0 ) {
7518								_y = hCont + parseFloat( _y );
7519							} else {
7520								_y = parseFloat( _y ) - hCont;
7521							}
7522						}
7523						continuousLinearMarquee(_y * -1);
7524					} else {
7525						if ( Math.abs(_x) > wCont ) {
7526							if ( _x < 0 ) {
7527								_x = wCont + parseFloat( _x );
7528							} else {
7529								_x = parseFloat( _x ) - wCont;
7530							}
7531						}
7532						continuousLinearMarquee(_x * -1);
7533					}
7534					$wrap.removeClass('linear-dragging');
7535					dragAction = false;
7536				},
7537			});
7538		};
7539
7540		var runScrollLinear = function(){
7541			var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery;
7542			if ( !$wrap.is(':visible') || freezed )  {
7543				return;
7544			}
7545			var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1,
7546				dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
7547			
7548			var linearGridScroll = function(){
7549				if ( isInViewport ) {
7550					var bound = _row.getBoundingClientRect();
7551
7552					var bound_top = bound.top,
7553						gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction );
7554
7555					if ( vertical ) {
7556						$wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7557					} else {
7558						$wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'})
7559					}
7560					if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7561						requestAnimationFrame(linearGridScroll);
7562					}
7563				}
7564				if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) {
7565					window.addEventListener("scroll", linearGridScroll);
7566				}
7567			};
7568
7569			$(window).on( 'load wwResize', function(e) {
7570				stableHeight = UNCODE.wheight;
7571				linearGridScroll();
7572			});
7573			if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7574				requestAnimationFrame(linearGridScroll);
7575			}
7576		};
7577		
7578		var dragLinear = function(){
7579			if ( !$wrap.is(':visible') )  {
7580				return;
7581			}
7582			var matrix, _x, _y;
7583			Draggable.create($dragger[0], {
7584				type: vertical ? "y" : "x",
7585				bounds: document.getElementById("container"),
7586				inertia: false,
7587				onPress: function (e) {
7588				},
7589				onRelease: function (e) {
7590				},
7591				onDrag: function (e) {
7592					$wrap.addClass('linear-dragging');
7593				},
7594				onDragEnd: function (e) {
7595					matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(',');
7596					_x = matrix[12] || matrix[4];
7597					_y = matrix[13] || matrix[5];
7598					wCont = $cont.outerWidth();
7599					hCont = $cont.outerHeight();
7600					if ( vertical ) {
7601						if ( Math.abs(_y) > hCont ) {
7602							if ( _y < 0 ) {
7603								_y = hCont + parseFloat( _y );
7604							} else {
7605								_y = parseFloat( _y ) - hCont;
7606							}
7607							gsap.to( $dragger[0], {
7608								duration: 0,
7609								y: _y,
7610							});
7611						}
7612					} else {
7613						if ( Math.abs(_x) > wCont ) {
7614							if ( _x < 0 ) {
7615								_x = wCont + parseFloat( _x );
7616							} else {
7617								_x = parseFloat( _x ) - wCont;
7618							}
7619							gsap.to( $dragger[0], {
7620								duration: 0,
7621								x: _x,
7622							});
7623						}
7624					}
7625					$wrap.removeClass('linear-dragging');
7626				},
7627			});
7628		};
7629
7630		if ( ! $('body').hasClass('compose-mode') ) {
7631			if ( $wrap.attr('data-animation') === 'marquee' ||  $wrap.attr('data-animation') === 'marquee-opposite' ) {
7632				continuousLinearMarquee();
7633				$(window).on( 'wwResize', function(e) {
7634					continuousLinearMarquee();
7635				});	
7636				if ( $wrap.attr('data-draggable') === 'yes' ) {
7637					dragLinearContinuous();
7638				}
7639			}
7640
7641			if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7642				runScrollLinear();
7643				if ( $wrap.attr('data-draggable') === 'yes' ) {
7644					dragLinear();
7645				}
7646			}
7647
7648			if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) {
7649				var observer = new IntersectionObserver(function(entries) {
7650						
7651					entries.forEach(function(entry){
7652						if ( entry.isIntersecting ) {
7653							isInViewport = true;
7654							if ( !init ) {
7655								init = true;
7656								continuousLinearMarquee();
7657							} else {
7658								if ( typeof marqueeTL !== 'undefined' ) {
7659									marqueeTL.play();
7660								}
7661							}
7662							if ( $wrap.attr('data-animation') === 'marquee-scroll' ||  $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) {
7663								requestAnimFrame(runScrollLinear);
7664							}
7665						} else {
7666							isInViewport = false;
7667							if ( typeof marqueeTL !== 'undefined' ) {
7668								marqueeTL.pause();
7669							}
7670						}
7671					});
7672				}, { 
7673					root: document,
7674				});
7675
7676				observer.observe(_row);
7677
7678			} else {
7679
7680				var checkVisible = function( el, off ) {
7681					if (typeof jQuery === "function" && el instanceof jQuery) {
7682						el = el[0];
7683					}
7684			
7685					off = typeof off=='undefined' ? 50 : off;
7686			
7687					var rect = el.getBoundingClientRect();
7688			
7689					return (
7690						(
7691							( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7692							( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7693							( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7694						)
7695					);
7696				};
7697				
7698				var checkVisibility = function(){
7699
7700					if ( checkVisible($row) ) {
7701						isInViewport = true;
7702						if ( typeof marqueeTL !== 'undefined' ) {
7703							marqueeTL.play();
7704						}
7705					} else {
7706						isInViewport = false;
7707						if ( typeof marqueeTL !== 'undefined' ) {
7708							marqueeTL.pause();
7709						}
7710					}
7711				}
7712
7713				window.addEventListener("scroll", checkVisibility);
7714				checkVisibility();
7715
7716			}
7717		}
7718	});
7719};
7720UNCODE.preventDoubleTransition = function() {
7721	$('.sticky-element .animate_when_almost_visible').each(function(){
7722		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
7723			$el.addClass('do_not_reanimate');
7724		});
7725	});
7726};
7727
7728UNCODE.checkScrollForTabs = function(){
7729	var goToSection = window.location.hash.replace('#', ''),
7730		$index;
7731
7732	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
7733	goToSection = encodeURIComponent(goToSection);
7734	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
7735
7736	$index.attr('data-parent', 'parent-' + goToSection);
7737
7738	if (window.location.hash != undefined && window.location.hash != '') {
7739		requestTimeout(function() {
7740			scrollBody('parent-' + goToSection);
7741		}, 500);
7742	}
7743
7744	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
7745		var hash = (e.currentTarget).hash,
7746			index = (e.currentTarget).closest('.uncode-tabs');
7747		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
7748			$('a[href="' + hash + '"][data-tab-history]').click();
7749			scrollBody(index);
7750		}
7751	});
7752
7753	var scrollBody = function(index) {
7754
7755		var getSection = $('a[href="' + index + '"][data-tab-history]'),
7756			scrollTo,
7757			safeGap = 27;
7758
7759		if ( ! getSection.length ) {
7760			getSection = $('div[data-parent="' + index + '"]');
7761
7762			if ( getSection.attr('data-target') == 'row' ) {
7763				getSection = getSection.closest('.vc_row');
7764				safeGap = 0;
7765			}
7766		}
7767
7768		if (typeof getSection === 'undefined' || ! getSection.length ) {
7769			return;
7770		}
7771
7772		var body = $("html, body"),
7773		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7774		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
7775		getOffset = UNCODE.get_scroll_offset();
7776		if ( typeof getSection.offset() === 'undefined' )
7777			return;
7778		scrollTo = getSection.offset().top - safeGap;
7779		scrollTo -= getOffset;
7780
7781		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7782		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7783
7784		if (index != 0) {
7785			UNCODE.scrolling = true;
7786		}
7787
7788		if (scrollSpeed == 0) {
7789			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
7790			UNCODE.scrolling = false;
7791		} else {
7792			body.animate({
7793				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
7794			}, scrollSpeed, 'easeInOutQuad', function() {
7795				requestTimeout(function() {
7796					UNCODE.scrolling = false;
7797					if (getOffset != UNCODE.get_scroll_offset()) {
7798						scrollBody(index);
7799					}
7800				}, 100);
7801			});
7802		}
7803
7804	};
7805};
7806
7807UNCODE.printScreen = function() {
7808	var inlineMediaStyle = null,
7809		setResize;
7810
7811    function changeMediaStyle() {
7812		clearRequestTimeout(setResize);
7813		setResize = requestTimeout(function(){
7814	        var $head = document.getElementsByTagName('head')[0],
7815	        	$newStyle = document.createElement('style'),
7816	        	winW = window.innerWidth,
7817	        	printH = window.innerHeight;
7818
7819	        $newStyle.setAttribute('type', 'text/css');
7820	        $newStyle.setAttribute('media', 'print');
7821	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
7822
7823	        if (inlineMediaStyle != null) {
7824	            $head.replaceChild($newStyle, inlineMediaStyle)
7825	        } else {
7826	            $head.appendChild($newStyle);
7827	        }
7828	        inlineMediaStyle = $newStyle;
7829	    }, 1000);
7830    }
7831
7832    changeMediaStyle();
7833    window.addEventListener('resize', changeMediaStyle);
7834};
7835
7836UNCODE.fullPage = function() {
7837	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
7838		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
7839		return false;
7840	} else {
7841		requestTimeout(function() {
7842			window.scrollTo(0, 0);
7843		}, 10);
7844	}
7845
7846	var $masthead = $('#masthead'),
7847		$logo = $('#logo-container-mobile'),
7848		$logolink = $('[data-minheight]', $logo),
7849		logoMinScale = $logolink.data('minheight'),
7850		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
7851		$container = $('.main-container .post-content'),
7852		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
7853		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
7854		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
7855		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
7856		headerWithOpacity = $('.header-scroll-opacity', $header).length,
7857		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
7858		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
7859		scrollBar = true,
7860		effect,
7861		animationEndTimeOut,
7862		fp_anim_time = 900,
7863		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
7864		is_scrolling = false,
7865		dataNames = [],
7866		is_first = true,
7867		no_history = $('body').hasClass('uncode-scroll-no-history'),
7868		theres_footer = true;
7869
7870	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
7871		$('> div', $footer).each(function(index, el){
7872			if ( $(el).outerHeight() < 2 )
7873				theres_footer = false;
7874			else
7875				theres_footer = true;
7876		});
7877	}
7878
7879	if ( !$footer.length )
7880		theres_footer = false;
7881
7882	if ( !UNCODE.isFullPageSnap ) {
7883
7884		if ( $('body').hasClass('uncode-fullpage-zoom') )
7885			effect = 'scaleDown';
7886		else if ( $('body').hasClass('uncode-fullpage-parallax') )
7887			effect = 'moveparallax';
7888		else
7889			effect = 'movecurtain';
7890	}
7891
7892	if ( $('body').hasClass('uncode-fullpage-trid') )
7893		fp_anim_time = fp_anim_time*2;
7894
7895	if ( $header.length ) {
7896		if ( headerName !== '' )
7897			$header.attr('data-name', headerName);
7898		if ( headerLabel !== '' )
7899			$header.attr('data-label', headerLabel);
7900		$container.prepend($header);
7901	}
7902	if ( theres_footer ) {
7903		$container.append($footer);
7904		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
7905		$('aside.widget ul', $footer).addClass('no-list');
7906	}
7907
7908	var $all = $rows.add($header);
7909
7910	if ( theres_footer )
7911		$all = $all.add($footer);
7912
7913	$all.each(function(index, row) {
7914		if( index === 0 )
7915			$(row).addClass('uncode-scroll-active');
7916	});
7917
7918    var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile;
7919
7920	if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) {
7921		$("<ul class='onepage-pagination'></ul>").prependTo("body");
7922	}
7923
7924	$all.each(function(index, val) {
7925		var getName = $(val).data('name'),
7926			label;
7927
7928		if (typeof getName == 'undefined' || getName == 'undefined')
7929			getName = SiteParameters.slide_name + '-' + index;
7930
7931		//if ( dataNames.includes(getName) ) {
7932		if ( dataNames.indexOf(getName) > 0 ) {
7933			getName += '_' + index;
7934			$(val).data('name', getName);
7935		}
7936
7937		dataNames.push(getName);
7938
7939		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
7940
7941		if (typeof $(val).attr('data-label') !== 'undefined')
7942			label = $(val).attr('data-label');
7943		else label = '';
7944
7945		if ( $(val).is($footer) )
7946			return;
7947
7948		if (label != '' ) {
7949			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
7950			$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + label + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
7951		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
7952			$('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + SiteParameters.uncode_one_dot_label + " " + index + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span></a></li>");
7953		}
7954	});
7955
7956	var checkVisible = function( el, off ) {
7957		if (typeof jQuery === "function" && el instanceof jQuery) {
7958			el = el[0];
7959		}
7960
7961		off = typeof off=='undefined' ? 50 : off;
7962
7963		var rect = el.getBoundingClientRect();
7964
7965		return (
7966			(
7967				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7968				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7969				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7970			)
7971		);
7972	};
7973
7974	var animationEndAction = function( index, nextIndex ) {
7975		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
7976			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7977			player, iframe;
7978
7979		if ( !$nextSlide.is($footer) ) {
7980			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
7981		}
7982
7983		if ( !UNCODE.isFullPageSnap ) {
7984			activateKBurns( nextIndex );
7985		}
7986
7987		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
7988			if ($(this).attr('data-provider') == 'vimeo') {
7989				iframe = $(this).find('iframe');
7990				player = new Vimeo.Player(iframe[0]);
7991				player.pause();
7992			} else if ($(this).attr('data-provider') == 'youtube') {
7993				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
7994			} else {
7995				if ($(this).is('video')) {
7996					$(this)[0].volume = 0;
7997					$(this)[0].pause();
7998				}
7999			}
8000		});
8001
8002		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8003			if ( $nextSlide.is($header) )
8004				$header.removeClass('header-scrolled');
8005		}
8006
8007		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
8008		$otherEl.each(function(){
8009			var $otherThis = $(this),
8010				$bgwrapperOther = $('.background-inner', $otherThis);
8011			if ( !checkVisible($otherThis) )
8012				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
8013
8014		});
8015
8016		if ( !checkVisible($currentSlide) ) {
8017			$currentSlide.removeClass('uncode-scroll-visible');
8018			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
8019			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
8020				currentScroll.scrollTo(0, 0, 0);
8021		}
8022
8023		clearRequestTimeout(animationEndTimeOut);
8024		animationEndTimeOut = requestTimeout(function(){
8025			Waypoint.refreshAll();
8026			$( document.body ).trigger('uncode_waypoints');
8027			var eventFP = new CustomEvent('fp-slide-changed');
8028			window.dispatchEvent(eventFP);
8029			is_scrolling = false;
8030
8031			if ( is_first ) {
8032				$('ul.onepage-pagination a').removeClass('is-selected');
8033				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8034				is_first = false;
8035			}
8036
8037		}, 500);
8038	};
8039
8040	var postLeaveActions = function( nextIndex ){
8041		if ( menuHidden && ! UNCODE.isMobile )
8042			return false;
8043
8044		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8045			$cols = $('.uncol', $el),
8046			anchor = $el.data('anchor');
8047
8048		if ( ! UNCODE.isFullPageSnap ) {
8049			$.each($cols, function(index, val){
8050				if ( $(val).hasClass('style-light') ){
8051					$masthead.removeClass('style-dark-override').addClass('style-light-override');
8052					return false;
8053				} else if ( $(val).hasClass('style-dark') ) {
8054					$masthead.removeClass('style-light-override').addClass('style-dark-override');
8055					return false;
8056				}
8057			});
8058		}
8059
8060		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
8061			$('.menu-item' ).removeClass('active');
8062			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8063		}
8064
8065		if ( !UNCODE.isFullPageSnap ) {
8066			activateBackWash( nextIndex );
8067		}
8068	};
8069
8070	var activateBackWash = function( nextIndex ){
8071		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8072			$bgwrapper;
8073
8074		if ( $el.length ) {
8075			if ( $el.hasClass('with-zoomout') ) {
8076				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8077			} else if ( $('.with-zoomout', $el).length ) {
8078				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
8079			} else {
8080				return false;
8081			}
8082		} else {
8083			return false;
8084		}
8085
8086		$bgwrapper.addClass('uncode-zoomout');
8087
8088	};
8089
8090	var activateKBurns = function( nextIndex ){
8091		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8092			$bgwrapper;
8093
8094		if ( $el.length ) {
8095			if ( $el.hasClass('with-kburns') ) {
8096				$bgwrapper = $('.background-inner:nth-child(1)', $el);
8097			} else if ( $('.with-kburns', $el).length ) {
8098				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
8099			} else {
8100				return false;
8101			}
8102		} else {
8103			return false;
8104		}
8105
8106		$bgwrapper.addClass('uncode-kburns');
8107
8108	};
8109
8110	var activateParallax = function( nextIndex, direction ){
8111
8112		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8113			$cell = $('.fp-tableCell', $el),
8114			animationEnd = 'webkitAnimationEnd animationend',
8115			cellAnim;
8116
8117		switch( direction ) {
8118			case 'up':
8119				cellAnim = 'moveFromTopInner';
8120				break;
8121			default:
8122				cellAnim = 'moveFromBottomInner';
8123		}
8124
8125		$cell.css({
8126			'animation-name': cellAnim,
8127			'animation-duration': fp_anim_time + 'ms',
8128			'animation-delay': '',
8129			'animation-timing-function': fp_easing,
8130			'animation-fill-mode': 'both',
8131		}).off(animationEnd)
8132		.on(animationEnd, function(event) {
8133			if ( event.originalEvent.animationName === cellAnim ) {
8134				$cell
8135					.css({
8136						'animation-name': '',
8137						'animation-duration': '',
8138						'animation-delay': '',
8139						'animation-timing-function': '',
8140						'animation-fill-mode': '',
8141					});
8142			}
8143		});
8144	};
8145
8146	var scrollHashes = function(){
8147		var hash = window.location.hash.replace('#', '').split('/'),
8148			hashInd;
8149		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
8150			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
8151				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
8152				$.fn.fullpage.moveTo(hashInd+1);
8153			}
8154		} else if( hash[0] === '' ) {
8155			$.fn.fullpage.moveTo(1);
8156		}
8157	};
8158
8159	var hideMenu = function( index, nextIndex ){
8160		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
8161			return false;
8162
8163		var hMenu = UNCODE.menuHeight,
8164			transTime = hMenu * 2;
8165
8166		if ( index === 1 && nextIndex > 1 ) {
8167			hMenu = hMenu * -1;
8168		} else if  ( index !== 1 && nextIndex === 1 ) {
8169			hMenu = 0;
8170		} else {
8171			return false;
8172		}
8173
8174		$masthead.css({
8175			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8176			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
8177			'-webkit-transition': 'transform 0.5s ease-in-out',
8178			'transition': 'transform 0.5s ease-in-out'
8179		});
8180	};
8181
8182	var shrinkMenu = function( index, nextIndex ){
8183		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
8184			return false;
8185
8186		if ( index === 1 && nextIndex > 1 ) {
8187			$logo.addClass('shrinked');
8188			$('div', $logo).each(function(index, val){
8189				$(val).css({
8190					'height': logoMinScale,
8191					'line-height': logoMinScale
8192				});
8193				if ($(val).hasClass('text-logo')) {
8194					$(val).css({
8195						'font-size': logoMinScale + 'px'
8196					});
8197				}
8198			});
8199			requestTimeout(function() {
8200				UNCODE.menuMobileHeight = $masthead.outerHeight();
8201			}, 300);
8202		} else if ( index !== 1 && nextIndex === 1 ) {
8203			$logo.removeClass('shrinked');
8204			$('div', $logo).each(function(index, val){
8205				$(val).css({
8206					'height': logoMaxScale,
8207					'line-height': logoMaxScale
8208				});
8209				if ($(val).hasClass('text-logo')) {
8210					$(val).css({
8211						'font-size': logoMaxScale + 'px'
8212					});
8213				}
8214			});
8215			requestTimeout(function() {
8216				UNCODE.menuMobileHeight = $masthead.outerHeight();
8217			}, 300);
8218		} else {
8219			return false;
8220		}
8221
8222	};
8223
8224	var anchorLink = function(){
8225
8226		$container.add('.menu-item').find('a[href*="#"]').on('click', function(e) {
8227			var $this = $(e.currentTarget),
8228				hash = e.currentTarget.href.split('#'),
8229				current = window.location.href.split('#'),
8230				ind,
8231				currentMenuOpened = UNCODE.menuOpened,
8232				go = false;
8233
8234			var hash_url = hash[0].replace(/\/?$/, '/'),
8235				current_url = current[0].replace(/\/?$/, '/');
8236
8237			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
8238				hash = '#'+hash[1];
8239				e.preventDefault();
8240				go = true;
8241			}
8242
8243			if ( go ) {
8244
8245				if ( $(hash).length ) {
8246					ind = $(hash).closest('.fp-section').index();
8247				} else {
8248					hash = hash.slice(1);
8249					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
8250				}
8251
8252				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
8253					ind = $this.closest('.fp-section').index();
8254
8255				UNCODE.menuOpened = false;
8256
8257				$.fn.fullpage.moveTo(ind+1);
8258
8259				UNCODE.menuOpened = currentMenuOpened;
8260				if (UNCODE.menuOpened) {
8261					if (UNCODE.wwidth < UNCODE.mediaQuery) {
8262						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
8263					} else {
8264						$('.mmb-container-overlay .overlay-close').trigger('click');
8265						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
8266					}
8267				}
8268
8269			}
8270
8271		});
8272
8273		$('.header-scrolldown').on('click', function(event) {
8274			event.preventDefault();
8275			var scrollDown = $(this),
8276				ind = scrollDown.closest('.fp-section').index();
8277
8278			$.fn.fullpage.moveTo(ind+2);
8279		});
8280
8281		var anchor = $('.fp-section.active').data('anchor');
8282
8283		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
8284			$('.menu-item').removeClass('active');
8285			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
8286		}
8287
8288	};
8289
8290	var slideLeave = function( index, nextIndex, direction ) {
8291		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
8292			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
8293			animationEnd = 'webkitAnimationEnd animationend',
8294			transitionEnd = 'webkitTransitionEnd transitionend',
8295			animOut = effect != 'scaleDown' ? effect + direction : effect,
8296			animIn,
8297			isFooter = false,
8298			isFooterNext = false,
8299			footerH = $footer.outerHeight(),
8300			timeout,
8301			player, iframe,
8302			footerCoeff;
8303		switch( direction ) {
8304			case 'up':
8305				animIn = 'moveFromTop';
8306				break;
8307			default:
8308				animIn = 'moveFromBottom';
8309		}
8310
8311		if ( $('body').hasClass('uncode-fullpage-trid') ) {
8312			animOut = animIn + 'trid';
8313			animIn = animOut + 'In';
8314		} else if ( UNCODE.isFullPageSnap ) {
8315			animIn = animOut = 'none';
8316		}
8317
8318		hideMenu(index, nextIndex);
8319		shrinkMenu(index, nextIndex);
8320
8321		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
8322			if ($(this).attr('data-provider') == 'vimeo') {
8323				iframe = $(this).find('iframe');
8324				player = new Vimeo.Player(iframe[0]);
8325				player.pause();
8326			} else if ($(this).attr('data-provider') == 'youtube') {
8327				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
8328			} else {
8329				if ($(this).is('video')) {
8330					$(this)[0].volume = 0;
8331					$(this)[0].pause();
8332				}
8333			}
8334		});
8335
8336		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
8337			if ($(this).attr('data-provider') == 'vimeo') {
8338				iframe = $(this).find('iframe');
8339				iframe.on('load', function(){
8340					player = new Vimeo.Player(iframe);
8341					player.setVolume(0);
8342					player.play();
8343				});
8344				player = new Vimeo.Player(iframe);
8345				player.setVolume(0);
8346				player.play();
8347			} else if ($(this).attr('data-provider') == 'youtube') {
8348				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
8349			} else {
8350				if ($(this).is('video')) {
8351					$(this)[0].volume = 0;
8352					$(this)[0].play();
8353				}
8354			}
8355		});
8356
8357		if ( $currentSlide.is($footer) )
8358			isFooter = true;
8359
8360		if ( $nextSlide.is($footer) )
8361			isFooterNext = true;
8362
8363		if ( ! UNCODE.isMobile && headerWithOpacity ) {
8364			if ( $currentSlide.is($header) )
8365				$header.addClass('header-scrolled');
8366		}
8367
8368		footerCoeff = footerH;
8369
8370		if ( UNCODE.isFullPageSnap ) {
8371			postLeaveActions( nextIndex );
8372			activateBackWash( nextIndex );
8373			activateKBurns( nextIndex );
8374			requestTimeout(function(){
8375				animationEndAction( index, nextIndex );
8376			}, fp_anim_time+150);
8377		} else {
8378			if ( isFooterNext ) {
8379
8380				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
8381				$iscrollWrapper.addClass('no-scrolloverflow');
8382
8383				$nextSlide
8384				.add($currentSlide)
8385				.addClass('uncode-scroll-front')
8386				.addClass('uncode-scroll-active')
8387				.addClass('uncode-scroll-visible');
8388				$container.css({
8389					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8390					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
8391					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8392					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8393				}).off(transitionEnd)
8394				.one(transitionEnd, function(){
8395					animationEndAction( index, nextIndex );
8396				});
8397
8398			} else if ( isFooter ) {
8399
8400				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
8401				.add($currentSlide)
8402				.addClass('uncode-scroll-front')
8403				.addClass('uncode-scroll-active')
8404				.addClass('uncode-scroll-visible');
8405				$container.css({
8406					'-webkit-transform': 'translate3d(0, 0, 0)',
8407					'transform': 'translate3d(0, 0, 0)',
8408					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8409					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
8410				})
8411				.one(transitionEnd, function(){
8412					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
8413						clearRequestTimeout(timeout);
8414						timeout = requestTimeout(function(){
8415							$.fn.fullpage.moveTo(nextIndex);
8416							slideLeave( index-1, nextIndex, 'up' );
8417							$container.off(transitionEnd);
8418						}, 50);
8419					}
8420					animationEndAction( index, nextIndex );
8421				});
8422
8423			} else {
8424
8425				postLeaveActions( nextIndex );
8426
8427				if ( !$('body').hasClass('uncode-fullpage-trid') )
8428					activateParallax( nextIndex, direction );
8429
8430				var $outBg = $('.background-wrapper', $currentSlide);
8431
8432				$nextSlide
8433				.addClass('uncode-scroll-front')
8434				.addClass('uncode-scroll-active')
8435				.addClass('uncode-scroll-visible')
8436				.addClass('uncode-scroll-animating-in')
8437				.css({
8438					'z-index':4,
8439					'animation-name': animIn,
8440					'animation-duration': fp_anim_time + 'ms',
8441					'animation-delay': '',
8442					'animation-timing-function': fp_easing,
8443					'animation-fill-mode': 'both',
8444					'transition': 'initial',
8445				}).off(animationEnd)
8446				.on(animationEnd, function(event) {
8447					if ( event.originalEvent.animationName === animIn ) {
8448						$(this)
8449							.addClass('uncode-scroll-already')
8450							.removeClass('uncode-scroll-front')
8451							.removeClass('uncode-scroll-animating-in')
8452							.css({
8453								'animation-name': '',
8454								'animation-duration': '',
8455								'animation-delay': '',
8456								'animation-timing-function': '',
8457								'animation-fill-mode': '',
8458								'transition': 'initial',
8459							});
8460
8461						$currentSlide
8462							.removeClass('uncode-scroll-active')
8463							.add($outBg)
8464							.css({
8465								'animation-name': '',
8466								'animation-duration': '',
8467								'animation-delay': '',
8468								'animation-timing-function': '',
8469								'animation-fill-mode': '',
8470								'transition': 'initial',
8471							});
8472
8473						animationEndAction( index, nextIndex );
8474
8475					}
8476
8477					if ( nextIndex > 1 )
8478						$('body').addClass('window-scrolled');
8479					else
8480						$('body').removeClass('window-scrolled');
8481				});
8482
8483				$currentSlide
8484					.addClass('uncode-scroll-animating-out')
8485					.removeClass('uncode-scroll-front')
8486					.css({
8487						'z-index':'1',
8488						'animation-name': animOut,
8489						'animation-duration': fp_anim_time + 'ms',
8490						'animation-delay': '',
8491						'animation-timing-function': fp_easing,
8492						'animation-fill-mode': 'both',
8493						'transition': 'initial',
8494						'will-change': 'auto'
8495					}).off(animationEnd)
8496					.on(animationEnd, function(event) {
8497						if ( event.originalEvent.animationName === animOut ) {
8498							$currentSlide.removeClass('uncode-scroll-animating-out');
8499						}
8500					});
8501
8502				if ( $('body').hasClass('uncode-fp-opacity') ) {
8503					$currentSlide.find('> div').css({
8504						'animation-name': 'opacityout',
8505						'animation-duration': fp_anim_time + 'ms',
8506						'animation-delay': '',
8507						'animation-timing-function': fp_easing,
8508						'animation-fill-mode': 'both',
8509						'transition': 'initial',
8510					}).off(animationEnd)
8511					.on(animationEnd, function(event) {
8512						if ( event.originalEvent.animationName === 'opacityout' ) {
8513							$(event.currentTarget).css({
8514								'animation-name': '',
8515								'animation-duration': '',
8516								'animation-delay': '',
8517								'animation-timing-function': '',
8518								'animation-fill-mode': '',
8519								'transition': '',
8520							});
8521						}
8522					});
8523				}
8524			}
8525		}
8526
8527		$('.scroll-top').on('click', function(e){
8528			$.fn.fullpage.moveTo(1);
8529			return false;
8530		});
8531
8532	};
8533
8534	var init_fullPage = function(mode){
8535
8536		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
8537		// 	scrollBar = false;
8538		// }
8539
8540		var checkFPeffects;
8541
8542		$container.fullpage({
8543			sectionSelector: '.uncode-scroll-lock',
8544			scrollOverflow: true,
8545			scrollOverflowOptions: {
8546				click: false,
8547				preventDefaultException: { tagName:/.*/ }
8548			},
8549			navigation: false,
8550			scrollBar: scrollBar,
8551			scrollingSpeed: fp_anim_time,
8552			verticalCentered: true,
8553			anchors: no_history ? false : dataNames,
8554			recordHistory: !no_history,
8555			afterRender: function(){
8556				$('body').removeClass('fp-waiting');
8557				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
8558					var $invisible = $(this).addClass('hidden-scroll');//,
8559				});
8560				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
8561					var $visible = $(this).addClass('uncode-scroll-visible'),
8562						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
8563					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
8564				});
8565
8566				$('ul.onepage-pagination a').on('click', function(e){
8567					e.preventDefault();
8568					var $a = $(this),
8569						toIndex = $a.data('index');
8570
8571					$.fn.fullpage.moveTo(toIndex+1);
8572				});
8573
8574				requestTimeout(function(){
8575					scrollHashes();
8576				}, 1000);
8577
8578				$(window).on('hashchange', function(e){
8579					requestTimeout(function(){
8580						scrollHashes();
8581					}, 500);
8582				});
8583
8584				anchorLink();
8585
8586				if ( $('body').hasClass('uncode-fp-opacity') ) {
8587					$all.each(function(index, row) {
8588						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
8589							classBg;
8590
8591						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
8592							classBg = testmatch[0];
8593							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
8594						}
8595					});
8596				}
8597
8598				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
8599					$(window).on('menuOpen gdprOpen', function(){
8600						$.fn.fullpage.setAutoScrolling(false);
8601					}).on('menuClose gdprClose', function(){
8602						$.fn.fullpage.setAutoScrolling(true);
8603					});
8604				}
8605
8606				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
8607					requestTimeout(function(){
8608						$.fn.fullpage.setAutoScrolling(false);
8609					}, 1000);
8610				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
8611					$.fn.fullpage.setAutoScrolling(true);
8612				});
8613
8614				if ( !UNCODE.isFullPageSnap ) {
8615					clearRequestTimeout(checkFPeffects);
8616					checkFPeffects = requestTimeout(function(){
8617						activateBackWash( 1 );
8618						activateKBurns( 1 );
8619					}, 100);
8620				}
8621
8622			},
8623			onLeave: function( index, nextIndex, direction ){
8624
8625				if ( UNCODE.menuOpened || is_scrolling )
8626					return false;
8627
8628				is_scrolling = true;
8629
8630				var event = new CustomEvent('fp-slide-leave');
8631				window.dispatchEvent(event);
8632
8633				slideLeave( index, nextIndex, direction );
8634
8635				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
8636					if ( direction === 'up' ) {
8637						$.fn.fullpage.moveTo(nextIndex-1);
8638					} else {
8639						$.fn.fullpage.moveTo(nextIndex+1);
8640					}
8641					return false;
8642				}
8643
8644				$('ul.onepage-pagination a').removeClass('is-selected');
8645				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
8646
8647			}
8648		});
8649	};
8650
8651	init_fullPage();
8652	$(window).on('load', function(){
8653		requestTimeout(function(){
8654			$.fn.fullpage.reBuild();
8655		}, 3000);
8656	});
8657
8658	var addScrollingClass,
8659		removeScrollingClass;
8660
8661	window.addEventListener("fp-slide-scroll", function(){
8662		addScrollingClass = requestTimeout( function(){
8663			$('body').addClass('fp-slide-scrolling');
8664		}, 10 );
8665
8666		clearRequestTimeout(removeScrollingClass);
8667		removeScrollingClass = requestTimeout( function(){
8668			$('body').removeClass('fp-slide-scrolling');
8669		}, 150 );
8670
8671		Waypoint.refreshAll();
8672	}, false);
8673
8674	var setFPheight = function(){
8675		var $body = document.body,
8676			$footer = document.getElementById('colophon'),
8677			$maincontainer = document.querySelector('.main-wrapper'),
8678			$boxcontainer = document.querySelector('.box-container'),
8679			$sections = document.querySelectorAll('.fp-section'),
8680			rect = $maincontainer.getBoundingClientRect(),
8681			rect2 = $boxcontainer.getBoundingClientRect(),
8682			$masthead = document.getElementById('masthead'),
8683			_hideMenu = false,
8684			menuHeight = UNCODE.menuHeight;
8685		$body.style.height = UNCODE.wheight + 'px';
8686
8687		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
8688			_hideMenu = true;
8689		}
8690		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
8691			menuHeight = 0
8692		}
8693
8694
8695		if ( theres_footer )
8696			$footer.style.top = (rect.height || rect2.height) + 'px';
8697
8698		for (var i = 0; i < $sections.length; i++) {
8699			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
8700		}
8701	};
8702
8703	setFPheight();
8704
8705	window.addEventListener('resize', setFPheight, false);
8706	window.addEventListener('orientationchange', setFPheight, false);
8707
8708};
8709
8710UNCODE.particles = function() {
8711	$(".vc-particles-background").each(function() {
8712		var $particle = $(this);
8713		var $parent = $particle.closest('[data-parent]');
8714
8715		$parent.prepend($particle);
8716		// $(window).trigger('resize');
8717	})
8718};
8719
8720
8721UNCODE.readMoreCol = function( $el ){
8722	if ( typeof $el === 'undefined' || $el === null ) {
8723		$el = $('body');
8724	}
8725	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
8726	$readMoreCols.each(function(){
8727		var $uncont = $(this),
8728			$row = $uncont.closest('.row-container'),
8729			max_h = $uncont.attr('data-ov-height'),
8730			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
8731			actual_max_h = $uncont.outerHeight(),
8732			inner_h,
8733			$read_more = $('+ .btn-more-wrap', $uncont),
8734			read_more_resize = $read_more.hasClass('trigger-resize'),
8735			marginClosedBtn = $uncont.attr('data-margin-closed'),
8736			marginClosed = 0,
8737			marginOpenBtn = $uncont.attr('data-margin-open'),
8738			marginOpen = 0,
8739			anim_t = 250,
8740			resized = false;
8741
8742		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
8743
8744		switch (marginClosedBtn) {
8745			case 'sm':
8746				marginClosed = 18
8747				break;
8748				
8749			case 'std':
8750				marginClosed = 36
8751				break;
8752				
8753			case 'lg':
8754				marginClosed = 72
8755				break;
8756				
8757			case '':
8758			default:
8759				marginClosed = 0
8760				break;
8761				
8762		}
8763
8764		switch (marginOpenBtn) {
8765			case 'sm':
8766				marginOpen = 18
8767				break;
8768				
8769			case 'std':
8770				marginOpen = 36
8771				break;
8772				
8773			case 'lg':
8774				marginOpen = 72
8775				break;
8776				
8777			case 'no':
8778				marginOpen = 0
8779				break;
8780				
8781		}
8782
8783		var checkToggleMobile = function(){
8784			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
8785				resized = true;
8786				if ( $read_more.hasClass('state-closed') ) {
8787					$uncont[0].style.height = '';
8788					$uncont[0].style.maxHeight = max_h_mobile;
8789				}
8790			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
8791				if ( $read_more.hasClass('state-closed') ) {
8792					$uncont[0].style.height = '';
8793					$uncont[0].style.maxHeight = max_h;
8794				}
8795				resized = false;
8796			}
8797		}
8798		checkToggleMobile();
8799		$(window).on('resize', function() {
8800			checkToggleMobile();
8801		});
8802
8803		$('a', $read_more).on('click', function(e){
8804			e.preventDefault();
8805
8806			var $a = $(this);
8807
8808			if ( $read_more.hasClass('state-closed') ) {
8809
8810				$read_more
8811					.removeClass('state-closed')
8812					.addClass('state-open');
8813
8814				$uncont.css({
8815					'max-height': 'none',
8816					'height': 'auto',
8817				});
8818	
8819				inner_h = parseFloat( $uncont.outerHeight() );
8820
8821				$uncont.css({
8822					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8823				});
8824		
8825				anim_t = inner_h - actual_max_h;
8826				if ( anim_t < 250 ) {
8827					anim_t = 250;
8828				} else if ( anim_t > 1000 ) {
8829					anim_t = 1000;
8830				}
8831
8832				$uncont.css({
8833					'transition-duration' : anim_t + 'ms'
8834				}).addClass('overflow-mask-animation').animate({
8835					'height': inner_h
8836				}, anim_t, 'easeInOutCubic', function(){
8837					$uncont.css({
8838						'height' : 'auto'
8839					}).removeClass('overflow-mask');
8840					if ( read_more_resize === true ) {
8841						window.dispatchEvent(new Event('resize'));
8842						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8843							ScrollTrigger.refresh(true);
8844						}
8845					}
8846				});
8847
8848				if ( marginOpen != '' ) {
8849					$read_more.animate({
8850						'margin-top' : marginOpen
8851					}, anim_t, 'easeInOutCubic');
8852				}
8853
8854			} else {
8855				$read_more
8856					.removeClass('state-open')
8857					.addClass('state-closed');
8858
8859				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
8860					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8861				}, anim_t, 'easeInOutCubic', function(){
8862					if ( read_more_resize === true ) {
8863						window.dispatchEvent(new Event('resize'));
8864						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8865							ScrollTrigger.refresh(true);
8866						}
8867					}
8868				});
8869
8870				if ( marginClosed !== '' ) {
8871					$read_more.animate({
8872						'margin-top' : marginClosed
8873					}, anim_t, 'easeInOutCubic');
8874				}
8875
8876				if ( $a.hasClass('toggle-scroll') ) {
8877                    var $masthead = $('#masthead > div:first-child'),
8878                        headH = $masthead.outerHeight(),
8879						rectTop = $row[0].getBoundingClientRect().top,
8880						checkNavBar = $a.hasClass('toggle-navbar'),
8881						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
8882                        offCont = ( $row.offset().top );
8883
8884					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
8885						checkNavBar = checkNavBarMobile;
8886					}
8887
8888					if ( checkNavBar ) {
8889						offCont = offCont - headH;
8890					}
8891			
8892					if ( rectTop < headH ) {
8893						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
8894							$(this).stop();
8895						}).animate({
8896							scrollTop: offCont
8897						}, anim_t, 'easeInOutCubic');
8898					}
8899				}
8900
8901			}
8902		});
8903	});
8904}
8905UNCODE.filters = function() {
8906	var $systems = $('.isotope-system, .cssgrid-system');
8907
8908	$systems.each(function(index, val){
8909		var $system = $(this),
8910			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
8911			$widgets = $('.widgetized-cb-wrapper', $system),
8912			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
8913			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
8914			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
8915			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
8916
8917		if ($system.hasClass('isotope-processed')) {
8918			return;
8919		}
8920
8921		$cats_trigger.on('click', function(e) {
8922			if ( ! $('html').hasClass('screen-sm') ) {
8923				// $widgets.add($sorting_dd).slideUp(400);
8924				e.preventDefault();
8925				$widgets.slideUp(400, 'easeInOutCirc');
8926			}
8927		});
8928
8929		$('.filters-toggle-trigger', $system).on('click', function(e) {
8930			e.preventDefault();
8931			var $filters = $('.isotope-filters .menu-horizontal', $system);
8932			$filters.slideToggle(400, 'easeInOutCirc');
8933			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8934		});
8935
8936		$widget_trgr.on('click', function(e) {
8937			e.preventDefault();
8938			$widgets.slideToggle(400, 'easeInOutCirc');
8939			if (!$('html').hasClass('screen-sm')) {
8940				$cats_filters.slideUp(400, 'easeInOutCirc');
8941			}
8942			window.dispatchEvent(new CustomEvent('boxResized'));
8943		});
8944
8945		$sorting_trgr.on('click', function(e) {
8946			e.preventDefault();
8947			if (!$('html').hasClass('screen-sm')) {
8948				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8949			}
8950		});
8951
8952		$system.addClass('isotope-processed');
8953	});
8954
8955};
8956
8957UNCODE.widgets = function() {
8958	var widget_collapses = $('.widget-collapse');
8959
8960	widget_collapses.each(function(){
8961		var widget_collapse = $(this),
8962			widget_title = widget_collapse.find('.widget-title'),
8963			widget = widget_title.closest('.widget'),
8964			content = widget.children().not('.widget-title'),
8965			setCTA;
8966
8967		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
8968			widget_title.toggleClass('open');
8969		}
8970
8971		widget_title.each(function() {
8972			var _this = $(this);
8973			var content = _this.closest('.widget').find('.widget-collapse-content');
8974
8975			$(window).on('load resize', function(){
8976				clearRequestTimeout(setCTA);
8977				setCTA = requestTimeout( function() {
8978					if ( content.is(':visible') ) {
8979						_this.addClass( 'open' );
8980					} else {
8981						_this.removeClass( 'open' );
8982					}
8983				}, 10 );
8984			})
8985
8986			_this.on( 'click', function(){
8987
8988				// Get content of :after element (+ icon) to check the visibility
8989				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
8990
8991				if (icon_content === 'none' || !icon_content) {
8992					return false;
8993				}
8994
8995				_this.toggleClass('open');
8996				var isOpen = _this.hasClass('open'),
8997					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
8998				content.animate({
8999					height: 'toggle',
9000					padding: 'toggle',
9001					opacity: 'toggle',
9002					top: isOpen ? 0 : hasBorder
9003				}, {
9004					duration: 400,
9005					easing: "easeInOutCirc",
9006				});
9007
9008				return false;
9009
9010			});
9011		});
9012	});
9013
9014	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
9015};
9016
9017UNCODE.unmodal = function() {
9018	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
9019		$('.unmodal-overlay').fadeIn();
9020		$('.unmodal-overlay').addClass('loading');
9021		$('body').addClass('uncode-unmodal-overlay-visible');
9022		$(window).trigger('unmodal-open');
9023	});
9024
9025	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
9026		$('.unmodal-overlay').fadeOut();
9027		$('.unmodal').fadeOut();
9028		$('body').removeClass('uncode-unmodal-overlay-visible');
9029		$('body').removeClass('uncode-unmodal-open');
9030		$('html').removeClass('uncode-unmodal-body-disable-scroll');
9031		$(document).trigger('unmodal-close');
9032		UNCODE.isUnmodalOpen = false;
9033	});
9034
9035	$(document).on('uncode-unmodal-show-content', function() {
9036		$('.unmodal-overlay').removeClass('loading');
9037		$('.unmodal').show();
9038		$('.unmodal').addClass('show-unmodal-with-animation');
9039		$('.unmodal-content')[0].scrollTop = 0;
9040		$('body').addClass('uncode-unmodal-open');
9041		UNCODE.isUnmodalOpen = true;
9042
9043		if ($('body').hasClass('qw-body-scroll-disabled')) {
9044			$('html').addClass('uncode-unmodal-body-disable-scroll');
9045		}
9046
9047		if ($('.unmodal').hasClass('auto-height')) {
9048			set_modal_height();
9049		}
9050	});
9051
9052	var set_modal_height = function() {
9053		var modal = $('.unmodal').css({height: 'auto'});
9054		var window_height = $(window).outerHeight();
9055		var modal_height = modal.outerHeight();
9056
9057		modal.css('height', 'auto');
9058
9059		if (modal_height > window_height) {
9060			modal.outerHeight(window_height);
9061		}
9062	}
9063
9064	if ($('.unmodal').hasClass('auto-height')) {
9065		var setCTA;
9066
9067		$(window).on('resize', function() {
9068			clearRequestTimeout(setCTA);
9069			setCTA = requestTimeout(function() {
9070				set_modal_height();
9071			}, 100);
9072		});
9073	}
9074};
9075
9076UNCODE.bgChanger = function() {
9077	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
9078		$bg_first = $('.vc_row[data-bg-remove]'),
9079		bg_remove = $bg_first.attr('data-bg-remove'),
9080		$first = $bg_changers.first(),
9081		$last = $bg_changers.last(),
9082		$bg_wrapper = $('#changer-back-color'),
9083		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
9084		setCTA, localH = UNCODE.wheight,
9085		isScrolling;
9086
9087	$bg_first.removeClass(bg_remove);
9088
9089	var bgChange = function($col, bgColor, skin, tmbskin){
9090		$bg_wrapper.attr( 'class', bgColor );
9091		var menuskin;
9092		if ( typeof skin !== 'undefined' ) {
9093			menuskin = skin.replace('style', 'menu')
9094		}
9095
9096		if ( $col.length ) {
9097			$('.uncol[data-skin-change]').each(function(){
9098				var $isoFooter = $('.isotope-footer', this);
9099				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
9100				if ( menuskin !== '' ) {
9101					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
9102				}
9103			});
9104
9105			$('.tmb[data-skin-change]').each(function(){
9106				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
9107			});
9108		}
9109	};
9110
9111	var $masthead = $('#masthead'),
9112		transDesktop,
9113		transMobile,
9114		changeSkin,
9115
9116	checkTransparencyAndChange = function( skin ){
9117		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
9118		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
9119		changeSkin = $masthead.hasClass('menu-change-skin');
9120
9121		if ( ! transDesktop && ! transMobile ) {
9122			return false;
9123		}
9124
9125		if ( ! changeSkin ) {
9126			return false;
9127		}
9128
9129		if ( skin === 'style-light' ){
9130			$masthead.removeClass('style-dark-override').addClass('style-light-override');
9131			return false;
9132		} else if ( skin === 'style-dark' ) {
9133			$masthead.removeClass('style-light-override').addClass('style-dark-override');
9134			return false;
9135		}
9136	};
9137
9138	var bg_waypoints = function(){
9139		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
9140
9141			$.each($bg_changers, function(index, row) {
9142
9143				var $row = $(row),
9144					$col = $('.uncol[data-skin-change]', $row).eq(0),
9145					skin,
9146					$tmbs,
9147					tmbskin,
9148					bgColor = $row.attr('data-bg-color');
9149
9150				if ( ! $row.is(':visible') ) {
9151					return false;
9152				}
9153
9154				if ( $col.length ) {
9155					skin = $col.attr('data-skin-change');
9156					$tmbs = $('.tmb[data-skin-change]', $row);
9157					tmbskin = skin.replace('style', 'tmb');
9158				}
9159
9160				if ( ! $row.hasClass('unscroll-horizontal') ) {
9161					$row.waypoint(function( dir ) {
9162						if ( dir === 'down' ) {
9163							bgChange($col, bgColor, skin, tmbskin);
9164							checkTransparencyAndChange(skin);
9165						} else {
9166							return;
9167						}
9168					}, {
9169						offset: '50%'
9170		  			});
9171
9172					$row.waypoint(function( dir ) {
9173						if ( dir === 'up' ) {
9174							bgChange($col, bgColor, skin, tmbskin);
9175							checkTransparencyAndChange(skin);
9176						} else {
9177							return;
9178						}
9179					}, {
9180						offset: function() {
9181							var clH = this.element.clientHeight,
9182								wH = window.innerHeight,
9183								ret = clH > 200 ? -100 : clH * -0.5;
9184							return ( wH / 2 ) - clH;
9185						}
9186					});
9187				}
9188
9189			});
9190
9191			$('body').addClass('bg-changer-init');
9192
9193		}
9194	};
9195
9196	var body = document.body,
9197	edges = false;
9198
9199	var throttle = function(fn, wait) {
9200		var time = Date.now();
9201		return function() {
9202			if ((time + wait - Date.now()) < 0) {
9203				fn();
9204				time = Date.now();
9205			}
9206		}
9207	}
9208
9209	var $wrapper = document.querySelector(".main-wrapper"),
9210		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
9211
9212	var $title = document.querySelector('#rotating');
9213	if ( $title !== null ) {
9214		$title.style.whiteSpace = 'nowrap';
9215		$title.style.transition = 'transform 200ms linear';
9216	}
9217
9218	window.addEventListener( 'scroll', throttle( function() {
9219		window.clearRequestTimeout( isScrolling );
9220
9221		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
9222
9223			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
9224				body = document.body,
9225				html = document.documentElement,
9226				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9227				$row = false,
9228				firstOff,
9229				lastOff;
9230
9231			if ( scrolled < 100 && $first.length ) {
9232				firstOff = $first.offset().top;
9233				if ( firstOff < 100 ) {
9234					var $row = $first;
9235				}
9236			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
9237				lastOff = $last.offset().top + $last.outerHeight();
9238				if ( lastOff > ( docH - 100 ) ) {
9239					var $row = $last;
9240				}
9241			}
9242
9243			if ( $row.length ) {
9244				var $col = $('.uncol[data-skin-change]', $row).eq(0),
9245					skin,
9246					$tmbs,
9247					tmbskin,
9248					bgColor = $row.attr('data-bg-color');
9249
9250				if ( $col.length ) {
9251					skin = $col.attr('data-skin-change');
9252					$tmbs = $('.tmb[data-skin-change]', $row);
9253					tmbskin = skin.replace('style', 'tmb');
9254				}
9255
9256				bgChange($col, bgColor, skin, tmbskin);
9257				checkTransparencyAndChange(skin);
9258				edges = true;
9259			}
9260
9261		}, 150);
9262
9263		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
9264			bg_waypoints();
9265			Waypoint.refreshAll();
9266			edges = false;
9267		}
9268
9269	}, 100), false);
9270
9271	$(window).on('resize', function() {
9272		clearRequestTimeout(setCTA);
9273		setCTA = requestTimeout(function() {
9274			if ( localH != UNCODE.wheight ) {
9275				localH = UNCODE.wheight;
9276				bg_waypoints();
9277				Waypoint.refreshAll();
9278			}
9279		}, 100);
9280	});
9281
9282	bg_waypoints();
9283
9284};
9285
9286UNCODE.skewIt = function() {
9287
9288	if ( $('body').hasClass('compose-mode') ) {
9289		return;
9290	}
9291
9292	var justscrolled = false;
9293
9294	var loadSkewIt = function(){
9295
9296		var $pageHeader = $('#page-header'),
9297			$page_body = $('.page-body'),
9298			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
9299
9300		if ( $header_skew.length ) {
9301			$pageHeader.addClass('uncode-skew').css({
9302				position: 'relative',
9303				zIndex: 1
9304			});
9305			$header_skew.removeClass('uncode-skew');
9306			$page_body.css({
9307				position: 'relative',
9308				zIndex: 0
9309			});
9310		}
9311
9312		var $skew = $('.uncode-skew'),
9313			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
9314			horizontal = $horizontal.length,
9315			stopSkewing,
9316			lastOffset = 0,
9317			lastDate = Date.now();
9318
9319		if ( ! $skew.length ) {
9320			return;
9321		}
9322
9323		var dropSkew = function(){
9324			if ( UNCODE.wwidth < UNCODE.mediaQuery )
9325				return;
9326
9327			$skew.each(function(){
9328				var $this = $(this),
9329					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9330
9331				if ( $drop.length ) {
9332					$this.css({
9333						'transform': 'skew(0)'
9334					});
9335					var bound = $this[0].getBoundingClientRect();
9336					$drop.css({
9337						left: bound.x * -1,
9338						top: bound.y * -1,
9339					});
9340				}
9341			});
9342		};
9343		dropSkew();
9344
9345		$(window).on('resize', dropSkew);
9346
9347		window.addEventListener( 'scroll', function() {
9348
9349			if ( justscrolled !== true ) {
9350				justscrolled = true;
9351				return;
9352			}
9353
9354			window.clearRequestTimeout( stopSkewing );
9355
9356			var now = Date.now(),
9357				delayInMs = now - lastDate,
9358				offset = window.pageYOffset || window.document.documentElement.scrollTop,
9359				newOffset = offset - lastOffset,
9360				speed = Math.pow((newOffset / delayInMs), 3) * -1,
9361				body = document.body,
9362				html = document.documentElement,
9363				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
9364				wait = 50,
9365				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
9366
9367			if ((lastDate + wait - now) < 0) {
9368
9369				lastDate = now;
9370				lastOffset = offset;
9371
9372				if ( speed > 6 ) {
9373					speed = 6;
9374				} else if ( speed < -6 ) {
9375					speed = -6;
9376				}
9377
9378				if ( speed > 2 && offset < UNCODE.wheight ) {
9379					speed = 2;
9380				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
9381					speed = -2;
9382				}
9383
9384				var speedY = speed,
9385					speedX = speed * 1.25;
9386
9387				if ( horizontal ) {
9388					speedY = 0;
9389					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9390						speedX = 0;
9391						return;
9392					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
9393						speedX = 0;
9394						return;
9395					}
9396				} else {
9397					speedX = 0;
9398				}
9399
9400				if ( ! $skew.closest('.enter-st').length ) {
9401					speedX = 0;
9402				}
9403
9404				gsap.killTweensOf($skew);
9405				gsap.to( $skew, {
9406					duration: 0.2,
9407					skewY: (speedY * maxSpeed) + "deg",
9408					skewX: (speedX * maxSpeed) + "deg",
9409					ease: Power0.easeNone,
9410					transformOrigin: 'center',
9411				});
9412
9413			}
9414
9415			stopSkewing = requestTimeout(function() {
9416				gsap.killTweensOf($skew);
9417				gsap.to( $skew, {
9418					duration: 0.5,
9419					skewY: "0deg",
9420					skewX: "0deg",
9421					transformOrigin: 'center',
9422					ease: Expo.easeOut,
9423				});
9424
9425				$skew.each(function(){
9426					var $this = $(this),
9427						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
9428
9429					if ( $drop.length ) {
9430						var bound = $this[0].getBoundingClientRect()
9431						$drop.css({
9432							left: bound.x * -1,
9433							top: bound.y * -1,
9434						});
9435					}
9436				});
9437
9438			}, 200);
9439
9440		}, false);
9441
9442	};
9443
9444	$(window).on('load', loadSkewIt);
9445
9446};
9447
9448UNCODE.rotateIt = function() {
9449
9450	if ( $('body').hasClass('compose-mode') ) {
9451		return;
9452	}
9453
9454	var frameRotate = false;
9455	var loadRotateIt = function(){
9456
9457		var $toRotate = $('.uncode-rotate');
9458
9459		$toRotate.each(function(){
9460			var $rotate = $(this),
9461				deg = 0,
9462				dir = true,
9463				coeff = 1,
9464				lastOffset = 0,
9465				lastDate = Date.now();
9466
9467			var checkScroll = function($rotate){
9468				// if ( ! $rotate.length ) {
9469				// 	return;
9470				// }
9471
9472				var now = Date.now(),
9473					delayInMs = now - lastDate,
9474					offset = window.pageYOffset || window.document.documentElement.scrollTop,
9475					newOffset = offset - lastOffset,
9476					speed = (newOffset / delayInMs) * 5,
9477					body = document.body,
9478					html = document.documentElement,
9479					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
9480
9481				lastDate = now;
9482				lastOffset = offset;
9483
9484				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
9485					deg = 0;
9486				}
9487
9488				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
9489					deg = parseFloat(deg) + parseFloat(speed);
9490				}
9491
9492				if ( $rotate.hasClass('uncode-rotate-hover') ) {
9493					$rotate.hover(function(){
9494						coeff = 1.75;
9495					}, function(){
9496						coeff = 1;
9497					});
9498				}
9499
9500				// if ( speed > 0 ) {
9501				// 	dir = true
9502				// } else if ( speed < 0 ) {
9503				// 	dir = false
9504				// }
9505
9506				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
9507					deg = deg+coeff;
9508					// if ( dir ) {
9509					// 	deg = deg+coeff;
9510					// } else {
9511					// 	deg = deg-coeff;
9512					// }
9513				}
9514
9515				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
9516					return false;
9517				}
9518				
9519				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
9520					var undeg = deg*-1;
9521					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
9522				} else {
9523					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
9524				}
9525
9526				requestAnimationFrame(function() {
9527					if ( frameRotate === true ) {
9528						frameRotate = false;
9529						return;
9530					}
9531					checkScroll($rotate);
9532				});
9533			};
9534
9535			checkScroll($rotate);
9536
9537		});
9538
9539	};
9540
9541	$(window).on('load', loadRotateIt);
9542
9543	var checkRotate;
9544	var resizeRotate = function(){
9545		var $inlineRotates = $('.inline-rotate');
9546		$inlineRotates.each(function(){
9547			$(this).addClass('inline-rotate-standby');
9548		});
9549		clearTimeout(checkRotate);
9550		checkRotate = setTimeout(function(){
9551			$('.inline-rotate').each(function(){
9552				$(this).removeClass('inline-rotate-standby');
9553				frameRotate = true;
9554			});
9555			loadRotateIt();
9556		}, 500);
9557	};
9558
9559	$(window).off('resize.inline-rotate', resizeRotate)
9560	.on('resize.inline-rotate', resizeRotate);
9561
9562};
9563
9564var marqueeAttempts = 0,
9565	marqueeTO,
9566	marqueeCheckResize,
9567	initMarquee;
9568
9569UNCODE.textMarquee = function( $titles ) {
9570
9571	var initTextMarquee = function( $titles ){
9572
9573		if ( typeof $titles == 'undefined' ) {
9574			$titles = $('.un-text-marquee');
9575		}
9576
9577		if ( ! $titles.length ) {
9578			return;
9579		}
9580
9581		var stableHeight = UNCODE.wheight;
9582
9583		$titles.each(function(){
9584			var $title = $(this),
9585				$span = $('> span, > i > span', $title),
9586				txt,
9587				first = true,
9588				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
9589				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
9590				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
9591				hasSticky = false,
9592				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
9593				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
9594				newW = UNCODE.wwidth,
9595				marqueeTL, inview;
9596
9597			if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) {
9598				hasSticky = true;
9599				dataTrigger = 'row';
9600			}
9601
9602			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
9603				dataNavBar = dataNavBarMobile;
9604			}
9605
9606			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
9607			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
9608			var dataX = dataSpeed;
9609
9610			dataSpeed += 5;
9611
9612			$('.marquee-clone-wrap', $title).remove();
9613
9614			txt = $span.html();
9615
9616			if ( ! $('.marquee-original-core', $span).length ) {
9617				txt = $span.html();
9618				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
9619			} else {
9620				txt = $('.marquee-original-core', $span).html();
9621			}
9622
9623			var spanW,
9624				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
9625				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
9626				speed = 10 - dataSpeed;
9627
9628			$span.prepend($prepended);
9629			$span.append($appended);
9630
9631			var continuousTextMarquee = function () {
9632				var bound = $title
9633						.css({
9634							transform: "none",
9635							opacity: 0,
9636						})
9637						.offset(),
9638					ease = "none";
9639
9640				var xStrt =
9641						first || $title.hasClass("un-marquee-infinite")
9642							? 0
9643							: UNCODE.wwidth - bound.left,
9644					xEnd = $title.hasClass("un-marquee-infinite")
9645						? spanW
9646						: spanW + bound.left,
9647					xSpeed =
9648						((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) *
9649						dataSpeed,
9650					direction = $title.hasClass("un-marquee-opposite") ? 1 : -1,
9651					speedSlow = (xEnd + xStrt) / 45,
9652					transFormVal,
9653					translX;
9654
9655				marqueeTL = new TimelineMax({ paused: true, reversed: true });
9656
9657				var inViewElement =
9658						dataTrigger === "row" ? ( hasSticky ? $title.closest('.sticky-trigger, .sticky-element').parent()[0] : $title.closest(".vc_row")[0] ) : $title[0],
9659					wayOff =
9660						dataTrigger === "row" && dataNavBar === "yes"
9661							? UNCODE.menuHeight
9662							: 0;
9663
9664				inview = new Waypoint.Inview({
9665					element: inViewElement,
9666					offset: wayOff,
9667					enter: function (direction) {
9668						marqueeTL.play();
9669					},
9670					exited: function (direction) {
9671						if (!$title.closest(".pin-spacer").length) {
9672							marqueeTL.pause();
9673						}
9674					},
9675				});
9676
9677				if ($title.hasClass("un-marquee-hover")) {
9678					var $column = $title.closest(".wpb_column"),
9679						$col_link = $(".col-link", $column),
9680						$hover_sel = $title;
9681
9682					if ($col_link.length) {
9683						$hover_sel = $title.add($column);
9684					}
9685					$hover_sel
9686						.on("mouseover", function () {
9687							ease = "power2.out";
9688							transFormVal = $title.css("transform").split(/[()]/)[1];
9689							translX = transFormVal.split(",")[4];
9690							speedSlow = (xEnd + (xStrt - translX)) / 45;
9691							marqueeTL.duration(speedSlow);
9692						})
9693						.on("mouseout", function () {
9694							ease = "power2.in";
9695							transFormVal = $title.css("transform").split(/[()]/)[1];
9696							translX = transFormVal.split(",")[4];
9697							speedSlow =
9698								((xEnd + (xStrt - translX)) /
9699									(dataSpeed * dataSpeed * dataSpeed) /
9700									5) *
9701								dataSpeed;
9702							marqueeTL.duration(speedSlow);
9703						});
9704				}
9705		
9706				gsap.killTweensOf($title);
9707				marqueeTL.fromTo( $title, {
9708					opacity: 1,
9709					x: xStrt * direction * -1
9710				},
9711				{
9712					duration: xSpeed,
9713					x: xEnd * direction,
9714					onComplete: function(){
9715						first = false;
9716						continuousTextMarquee();
9717					},
9718					ease: ease
9719				});
9720		
9721			};
9722			
9723			var runTextMarquee = function(){
9724				var time = Date.now();
9725
9726				var textMarqueeScroll = function(){
9727					var $row = $title.closest('.vc_row');
9728					if ( hasSticky ) {
9729						$row = $title.closest('.sticky-trigger, .sticky-element').parent();
9730					}					
9731					var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
9732
9733					if ( !$bound.length ) {
9734						return;
9735					}
9736
9737					var bound = $bound[0].getBoundingClientRect(),
9738						wait = 100,
9739						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
9740						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
9741
9742					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
9743						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
9744						marqueeAttempts < 2 ) {
9745
9746						clearRequestTimeout(marqueeTO);
9747
9748						marqueeTO = requestTimeout(function(){
9749							marqueeAttempts++;
9750							initTextMarquee();
9751						}, 100);
9752					}
9753
9754
9755					var bound_top = bound.top,
9756						gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
9757
9758					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
9759						if ( dataTrigger === 'row-middle' ) {
9760							bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5)
9761						}
9762						if ( dataNavBar === 'yes' ) {
9763							bound_top = bound_top - UNCODE.menuHeight;
9764						}
9765						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
9766					}
9767
9768					gsap.killTweensOf($title);
9769					gsap.to( $title, {
9770						duration: 0.24,
9771						x: gsap_calc,
9772					});
9773				};
9774
9775				textMarqueeScroll();
9776				$(window).on( 'load scroll', function(e) {
9777					textMarqueeScroll();
9778				});
9779
9780			};
9781
9782			var cloneSpan = function($_title, cntnt){
9783
9784				if ( $_title.hasClass('un-marquee-infinite') ) {
9785					$('> span.marquee-clone-wrap', $_title).text('');
9786				}
9787
9788				gsap.to( $_title, {
9789					duration: 0,
9790					x: 0
9791				});
9792				spanW = $span.outerWidth();
9793
9794				if ( !spanW ) {
9795					return;
9796				}
9797
9798				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
9799					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
9800
9801				if ( $_title.hasClass('un-marquee-infinite') ) {
9802
9803					for ( var i = 0; i < part; i++ ) {
9804						$prepended.append(cntnt + spaceSpan);
9805						$appended.append(cntnt + spaceSpan);
9806					}
9807				}
9808
9809				if ( $('body').hasClass('compose-mode') ) {
9810					$('.uncode_fe_safe').remove();
9811					return;
9812				}
9813
9814				if ( $title.closest('.marquee-freezed').length ) {
9815					return;
9816				}
9817
9818				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
9819					continuousTextMarquee();
9820				}
9821
9822				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
9823					runTextMarquee();
9824				}
9825
9826			};
9827
9828			var marqueeResize = function(e){
9829				clearRequestTimeout(marqueeCheckResize);
9830				marqueeCheckResize = requestTimeout(function(){
9831					if ( newW !== UNCODE.wwidth ) {
9832						gsap.killTweensOf($title);
9833						if ( typeof inview !== 'undefined' && inview !== null ) {
9834							inview.destroy();
9835						}
9836						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
9837							marqueeTL.kill();
9838						}
9839						first = true;
9840						initTextMarquee();
9841						newW = UNCODE.wwidth;
9842					}
9843				}, 1000);
9844			};
9845
9846			$(window).off('resize', marqueeResize)
9847			.on( 'resize', marqueeResize);
9848			$(window).off('uncode.re-layout', marqueeResize)
9849			.on( 'uncode.re-layout', marqueeResize);
9850
9851			cloneSpan($title, txt);
9852
9853			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9854				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
9855					var $_titles = $('.un-text-marquee',e.view.$el);
9856					clearRequestTimeout(marqueeCheckResize);
9857					marqueeCheckResize = requestTimeout(function(){
9858						initTextMarquee($_titles);
9859					}, 1000);
9860				});
9861			}
9862		});
9863
9864		$(window).on( 'load wwResize', function(e) {
9865			stableHeight = UNCODE.wheight;
9866		});
9867
9868	};
9869
9870	document.addEventListener("DOMContentLoaded", function() {
9871		initTextMarquee();
9872	});
9873
9874	$(window).on('focus load resize',function(){
9875		clearTimeout(initMarquee);
9876		initMarquee = setTimeout(function(){
9877			initTextMarquee();
9878		}, 500);
9879	});
9880	
9881	$(document).on('pumAfterOpen pumAfterClose', function(args){
9882		initTextMarquee();
9883	});
9884
9885};
9886	
9887UNCODE.parallax = function() {
9888	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
9889		if ($('.parallax-el').length > 0) {
9890			var parallax_elements = new Rellax('.parallax-el');
9891			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
9892			window.addEventListener('boxResized', function(e) {
9893				parallax_elements.refresh();
9894			}, false);
9895			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
9896				requestTimeout(function() {
9897					parallax_elements.refresh();
9898				}, 100);
9899			});
9900
9901			if ( typeof UNCODE.hDoc === 'undefined' ) {
9902				UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
9903					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
9904			}
9905		
9906			function paralraf(time) {
9907				requestAnimationFrame(paralraf)
9908		
9909				var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
9910					document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
9911				
9912				if ( UNCODE.hDoc !== newHdoc ) {
9913					UNCODE.hDoc = newHdoc;
9914					parallax_elements.refresh();
9915				}
9916			}
9917		
9918			requestAnimationFrame(paralraf)
9919		
9920		}
9921	}
9922};
9923
9924UNCODE.magicCursor = function(){
9925	var $customCursor = $('#uncode-custom-cursor'),
9926		$customPilot = $('#uncode-custom-cursor-pilot'),
9927		$tooltip = $('.title-tooltip', $customCursor),
9928		$cursorSpan = $('> span', $tooltip),
9929		currentBg = false,
9930		fromTitle = false,
9931		setTime,
9932		mouseEvent;
9933
9934		var spanW, spanH,
9935		maxW = false;
9936
9937	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
9938		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
9939			$tooltip.css({opacity: 0});
9940			delayt_time += 400;
9941		}
9942		clearRequestTimeout(setTime);
9943		setTime = requestTimeout(function() {
9944
9945			$tooltip.css({opacity: ''});
9946
9947			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
9948
9949			if ( cursorTitle !== '' ) {
9950				if ( fromTitle && dataTitle === 'boing' ) {
9951					setTimeout(function(){
9952						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
9953					}, 5);
9954				}
9955				$cursorSpan.attr('class', fontClass).html( cursorTitle );
9956			} else {
9957				if ( cursorType !== 'auto' ) {
9958					$cursorSpan.html('');
9959				}
9960			}
9961
9962			$cursorSpan.addClass('in-tooltip');
9963
9964			$customCursor.attr('data-cursor', cursorType);
9965
9966			if ( fromTitle ) {
9967				$customCursor.addClass('from-tooltip-title');
9968			} else {
9969				$customCursor.removeClass('from-tooltip-title');
9970			}
9971
9972			if ( cursorBg !== false ) {
9973				$customCursor.attr('data-bg', 'transparent');
9974			} else {
9975				$customCursor.removeAttr('data-bg');
9976			}
9977
9978			currentBg = cursorBg;
9979
9980			if ( cursorTitle !== '' ) {
9981				fromTitle = true;
9982				$customCursor.attr('data-cursor', cursorType);
9983				$customCursor.attr('data-title', 'true');
9984				$cursorSpan.css({width: ''});
9985			} else {
9986				fromTitle = false;
9987				$customCursor.removeAttr('data-title');
9988			}
9989			spanW = $cursorSpan.outerWidth();
9990			
9991			if ( spanW >= maxW && maxW !== false ) {
9992				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
9993				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
9994					width: maxW
9995				});
9996				spanW = maxW;
9997			} else {
9998				$customCursor.find('> span:first-child').removeClass('max-width');
9999			}
10000			spanH = $cursorSpan.outerHeight();
10001			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
10002				$customCursor.find('> span:first-child').add($tooltip).css({
10003					width: spanW,
10004					height: spanH
10005				});
10006			} else {
10007				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
10008			}
10009			if ( $customPilot.length ) {
10010				$customPilot.attr('data-cursor', cursorType);
10011			}
10012		}, delayt_time);
10013	}
10014
10015	function changeCursor($wrap){
10016		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10017		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
10018			$href = $wrap.find(href),
10019			cursorType,
10020			cursorTitle = '',
10021			tooltip_class = '',
10022			cursorBg = false;
10023
10024		$wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) {
10025			var $this = $(this).addClass("cursor-init"),
10026				$tmb = $this.closest('.tmb'),
10027				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
10028				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
10029				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
10030				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
10031				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
10032				$title = $('.t-entry-title', $tmb),
10033				is_frontend_editor = $this.closest('.vc_controls').length,
10034				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
10035				$parent_cursor = $this.closest('[class*="custom-cursor"]');
10036
10037			if ( is_frontend_editor ) {
10038				cursorType = 'auto';
10039			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
10040				cursorType = data_cursor;
10041			} else if ( $parent_cursor.length ) {
10042				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
10043					cursorType = 'icon-light';
10044				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
10045					cursorType = 'icon-diff';
10046				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
10047					cursorType = 'icon-accent';
10048				} else {
10049					cursorType = 'icon-dark';
10050				}
10051			} else {
10052				cursorType = 'pointer';
10053			}
10054
10055			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
10056				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
10057					cursorTitle = custom_text;
10058				} else {
10059					cursorTitle = $title.clone();
10060					$('a', cursorTitle).replaceWith(function() {
10061						return this.childNodes;
10062					});
10063					$('*', cursorTitle).replaceWith(function(){
10064						return $(this).removeAttr('class');
10065					});
10066					cursorTitle = cursorTitle.html();
10067				}
10068			} else {
10069				cursorTitle = '';
10070			}
10071
10072			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
10073				tooltip_class = data_class;
10074			} else {
10075				tooltip_class = '';
10076			}
10077
10078			if ( cursor_bg == 'true' ) {
10079				cursorBg = true;
10080			} else {
10081				cursorBg = false;
10082			}
10083
10084			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
10085		}).on("mouseleave.cursor", href, function(e) {
10086			var outTime = 150;
10087			if ( currentBg !== false && cursorBg === false ) {
10088				outTime = 0;
10089			}
10090			delayChangeCursor('auto', '', false, outTime, false, '');
10091		});
10092
10093		$(window).on('disable-hover', function(event) {
10094			document.addEventListener("mousemove", function(e) {
10095				mouseEvent = e;
10096			});
10097			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
10098		});
10099
10100		$(window).on('enable-hover', function(event) {
10101			if ( typeof mouseEvent !== 'undefined' ) {
10102				var x = mouseEvent.clientX,
10103					y = mouseEvent.clientY;
10104
10105				var elements = document.elementsFromPoint(x, y),
10106					$element = $(elements[0]);
10107
10108				$element.closest(href).trigger('mouseenter');
10109			}
10110		});
10111
10112	}
10113
10114	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10115		changeCursor();
10116	});
10117
10118	$(document).ajaxComplete(function( event, xhr, settings ) {
10119		changeCursor();
10120	});
10121
10122	$('.isotope-container').on('isotope-layout-complete', function() {
10123		var $this = $(this);
10124		changeCursor($this);
10125	});
10126
10127};
10128
10129UNCODE.magneticCursor = function(){
10130	function magneticCursor($wrap){
10131		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
10132		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'));
10133
10134		$magnetics.on('mousemove', function(e){
10135			var $this = $(this),
10136				$el,
10137				bound = e.currentTarget.getBoundingClientRect(),
10138				coeff = 30,
10139				hor = (bound.width / 2) - (e.clientX - bound.left),
10140				ver = (bound.height / 2) - (e.clientY - bound.top),
10141				toX = hor / bound.width * coeff,
10142				toY = ver / bound.height * coeff,
10143				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
10144				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
10145				toScale = Math.max(scaleX, scaleY);
10146
10147			if ( $this.hasClass('magnetic') ) {
10148				$el = $('.background-inner, .header-bg', $this);
10149			} else {
10150				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10151			}
10152
10153			gsap.killTweensOf($el);
10154			gsap.to( $el, {
10155				duration: 0.75,
10156				x: toX,
10157				y: toY,
10158				scale: toScale,
10159				ease: Power1.easeOut,
10160				transformPerspective: 900,
10161				transformOrigin: 'center',
10162				force3D: true
10163			});
10164		}).on('mouseout', function(e){
10165			var $this = $(this),
10166				$el
10167			if ( $this.hasClass('magnetic') ) {
10168				$el = $('.background-inner, .header-bg', $this);
10169			} else {
10170				$el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this);
10171			}
10172			gsap.killTweensOf($el);
10173			gsap.to( $el, {
10174				duration: 0.6,
10175				y: 0,
10176				x: 0,
10177				scale: 1,
10178				ease: Power1.easeOut,
10179				transformPerspective: 900,
10180				transformOrigin: 'center',
10181				force3D: true
10182			});
10183		});
10184	};
10185
10186	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
10187		magneticCursor();
10188	});
10189
10190	$(document).ajaxComplete(function( event, xhr, settings ) {
10191		magneticCursor();
10192	});
10193
10194	$('.isotope-container').on('isotope-layout-complete', function() {
10195		var $this = $(this);
10196		magneticCursor($this);
10197	});
10198
10199};
10200
10201UNCODE.dropImage = function() {
10202
10203	/****************************
10204	 * Image hover *
10205	****************************/
10206	function imageHover(){
10207		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10208			return;
10209		}
10210
10211		var $postLists = $('.uncode-post-titles');
10212		$postLists.each(function(){
10213			var $list = $(this),
10214				timing = parseFloat( $list.attr('data-timing') ),
10215				default_image = $list.hasClass('uncode-post-titles-default-image'),
10216				default_title = $list.hasClass('uncode-post-titles-default-title'),
10217				$tmbs = $('.tmb', $list),
10218				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
10219				clientX,
10220				clientY,
10221				$row_parent = $list.closest('.vc_row'),
10222				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
10223				$col_parent = $list.closest('.uncell'),
10224				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
10225				stoppedScrolling = true,
10226				setCTA;
10227
10228			timing *= 0.001;
10229
10230			var drop_bgs = function(){
10231				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
10232					var $drop = $(this),
10233						srcset = $drop.attr('data-bgset'),
10234						setArr = srcset.split(","),
10235						setArrOrder = [],
10236						biggest = 0,
10237						checkBg = false,
10238						desktopBG = $drop.data('[data-background-image]'),
10239						mobileBG = $drop.data('[data-mobile-background-image]');
10240
10241					if ( $drop.hasClass('srcset-bg-async') ) {
10242
10243						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
10244							return;
10245						}
10246						
10247					}
10248
10249					if ( SiteParameters.uncode_adaptive == true ) {
10250						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
10251							$drop.css({
10252								'background-image' : 'url(' + setArr[0] + ')'
10253							});
10254						}
10255					} else {
10256						for ( var i = 0; i < setArr.length; i++ ) {
10257							var setLoop = setArr[i].trim().split(" ");
10258							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
10259								var parseSet = parseFloat(setLoop[1]);
10260								if ( biggest < parseSet ) {
10261									biggest = parseSet;
10262								}
10263								setArrOrder[parseSet] = setLoop[0];
10264								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
10265									checkBg = true;
10266									$drop.css({
10267										'background-image' : 'url(' + setLoop[0] + ')'
10268									});
10269								}
10270							}
10271						}
10272
10273						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
10274							$drop.css({
10275								'background-image' : 'url(' + setArrOrder[biggest] + ')'
10276							});
10277						}
10278					}
10279
10280				});
10281			};
10282
10283			drop_bgs();
10284
10285			var dropMovesSize = function(){
10286				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
10287					return;
10288				}
10289				$drop_moves.each(function(){
10290					var $drop_move = $(this),
10291						dataW = $drop_move.attr('data-w'),
10292						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
10293					if ( typeof dataW !== 'undefined' && dataW !== null ) {
10294						dataW = screenInfo.width / 12 * parseFloat( dataW );
10295					}
10296					$drop_moves.css({
10297						width: dataW
10298					});
10299
10300					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10301						$anim_parent.on('animationend', function(){
10302							var bound = $anim_parent[0].getBoundingClientRect();
10303							$drop_move.css({
10304								left: bound.x * -1,
10305								top: bound.y * -1,
10306							});
10307						});
10308					}
10309				});
10310
10311
10312			};
10313
10314			dropMovesSize();
10315
10316			$(window).on( 'resize', function(){
10317				clearRequestTimeout(setCTA);
10318				setCTA = requestTimeout( function() {
10319					drop_bgs();
10320					dropMovesSize();
10321				}, 100 );
10322			});
10323
10324			if ( $drop_row_parents.length ) {
10325				$row_parent.addClass( 'drop-added' );
10326			}
10327
10328			$drop_row_parents.each(function(index, val){
10329				var $drop = $(val);
10330				$row_parent.prepend($drop);
10331				manageVideos($drop, false);
10332				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10333					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10334				}
10335				if ( default_image && index == 0 ) {
10336					manageVideos($drop, true);
10337					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10338						image_ph = new Image();
10339					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10340						image_ph.onload = function() {
10341							$drop.addClass('active');
10342							if ( default_title ) {
10343								$list.addClass('drop-hover');
10344								$tmbs.first().addClass('drop-active');
10345							}
10346						};
10347						image_ph.src = bg_img;
10348					}
10349				}
10350			});
10351
10352			if ( $drop_col_parents.length ) {
10353				$col_parent.addClass( 'drop-added' );
10354			}
10355
10356			$drop_col_parents.each(function(index, val){
10357				var $drop = $(this);
10358				$col_parent.prepend($drop);
10359				manageVideos($drop, false);
10360				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
10361					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
10362				}
10363				if ( default_image && index == 0 ) {
10364					manageVideos($drop, true);
10365					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
10366						image_ph = new Image();
10367					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
10368						image_ph.onload = function() {
10369							$drop.addClass('active');
10370							if ( default_title ) {
10371								$list.addClass('drop-hover');
10372								$tmbs.first().addClass('drop-active');
10373							}
10374						};
10375						image_ph.src = bg_img;
10376					}
10377				}
10378			});
10379
10380			function manageVideos( $el, start ) {
10381				var videoElem = $('video', $el),
10382					$iframe = $('iframe', $el),
10383					iframeID = $iframe.attr('id');
10384				if ( videoElem.length ) {
10385					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
10386						if ( start ) {
10387							videoElem[0].setCurrentTime(0);
10388							videoElem[0].play();
10389						} else {
10390							videoElem[0].pause();
10391							videoElem[0].setCurrentTime(0);
10392						}
10393					} else {
10394						if ( start ) {
10395							videoElem[0].currentTime = 0;
10396							videoElem[0].play();
10397						} else {
10398							videoElem[0].pause();
10399							videoElem[0].currentTime = 0;
10400						}
10401					}
10402				}
10403
10404				$el.data('active', start);
10405
10406				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
10407					var iframeIDv = iframeID.replace('okplayer-', ''),
10408						optionsV = $(window).data('okoptions-' + iframeIDv),
10409						vimeo = $iframe[0],
10410						playerV = new Vimeo.Player(vimeo),
10411						timeV = 0;
10412
10413					if (optionsV.time != null) {
10414						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
10415						for ( var i = 0; i < timeArr.length; i++ ) {
10416							if ( timeArr[i] === 'h' ) {
10417								timeV += parseFloat(timeArr[i-1]) * 3600;
10418							} else if ( timeArr[i] === 'm' ) {
10419								timeV += parseFloat(timeArr[i-1]) * 60;
10420							} else if ( timeArr[i] === 's' ) {
10421								timeV += parseFloat(timeArr[i-1]);
10422							}
10423						}
10424					}
10425					playerV.setCurrentTime(timeV);
10426					if ( start ) {
10427						playerV.setVolume(0);
10428						playerV.play();
10429					} else {
10430						playerV.pause();
10431					}
10432				} else if ( $el.attr('data-provider') === 'youtube' ) {
10433					if ( start ) {
10434						$el.trigger('uncode-resume');
10435					} else {
10436						$el.trigger('uncode-pause');
10437					}
10438				}
10439
10440			}
10441
10442			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
10443
10444				document.addEventListener("mousemove", function(e) {
10445					$drop_moves.each(function(){
10446						var $drop_move = $(this),
10447							duration = 0.4;
10448
10449						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
10450							duration = 0.8;
10451						}
10452
10453						clientX = e.clientX;
10454						clientY = e.clientY;
10455
10456						gsap.to( $drop_move, {
10457							duration: duration,
10458							x: clientX,
10459							y: clientY,
10460							ease: Power1.easeOut,
10461						});
10462					});
10463				});
10464
10465			} else {
10466
10467				$(window).on("touchend scroll", function(e) {
10468					$list.removeClass('drop-hover');
10469					$drop_moves.removeClass('active');
10470					$tmbs.removeClass('drop-active');
10471				});
10472
10473				$drop_moves.each(function(){
10474					var $drop_move = $(this),
10475						$tmb = $drop_move.closest('.tmb'),
10476						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
10477
10478					if ( $anim_parent.hasClass('uncode-skew') ) {
10479						$anim_parent.css({
10480							'transform': 'skew(0)'
10481						});
10482					}
10483
10484					$tmb.on('touchend', function(e){
10485						e.stopPropagation();
10486
10487						$drop_moves.removeClass('active');
10488						$tmbs.removeClass('drop-active');
10489
10490						$list.addClass('drop-hover');
10491						$tmb.addClass('drop-active');
10492						$drop_move.addClass('active');
10493						manageVideos($drop_move, true);
10494						clientX = e.changedTouches[0].clientX;
10495						clientY = e.changedTouches[0].clientY;
10496
10497						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10498							var bound = $anim_parent[0].getBoundingClientRect();
10499							clientX = clientX - bound.x;
10500							clientY = clientY - bound.y;
10501						}
10502
10503						$drop_move.css({
10504							left: clientX,
10505							top: clientY
10506						});
10507					});
10508				});
10509
10510			}
10511
10512			$tmbs.each(function(e){
10513				var $tmb = $(this),
10514					// $trgr = $('a', $tmb),
10515					$trgr = $tmb,
10516					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
10517					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
10517(.t-inside), .parallax-el'),
10518					$video = $('video', $tmb),
10519					$iframe = $('iframe', $tmb),
10520					$entryTxt = $('.t-entry-text', $tmb),
10521					stopBounding;
10522
10523				$entryTxt.add($drop_move).css({
10524					'transition-duration': timing + 's'
10525				});
10526
10527				if ( $video.length ) {
10528					var vidH = $video[0].videoHeight,
10529						vidW = $video[0].videoWidth;
10530					$video.css({
10531						'height': vidH,
10532						'width': vidW
10533					});
10534				}
10535
10536				if ( $iframe.length ) {
10537					var vidH = $drop_move.attr('data-height'),
10538						vidW = $drop_move.attr('data-width');
10539					$iframe.css({
10540						'height': vidH,
10541						'width': vidW
10542					});
10543				}
10544
10545				$iframe.each(function(){
10546					var $video = $(this),
10547						vidH = $video[0].videoHeight,
10548						vidW = $video[0].videoWidth;
10549					$video.css({
10550						'height': vidH,
10551						'width': vidW
10552					});
10553				});
10554
10555				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10556					$trgr.on('mouseenter',function(e){
10557
10558						$list.addClass('drop-hover');
10559						$tmbs.removeClass('drop-active');
10560						$tmb.addClass('drop-active');
10561						$drop_move.addClass('active');
10562						manageVideos($drop_move, true);
10563
10564						var clientX = e.clientX,
10565							clientY = e.clientY;
10566						$drop_move.css({
10567							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
10568						});
10569
10570					})
10571					.on('mouseleave', function(e){
10572						$list.removeClass('drop-hover');
10573						$drop_move.css({
10574							'transition-duration': ( timing*1.25 ) + 's'
10575						});
10576						$drop_move.removeClass('active');
10577						$tmb.removeClass('drop-active');
10578						$drop_move.on('transitionend', function(e){
10579							$drop_move.off('transitionend');
10580							$drop_move.css({
10581								'transition-duration': timing + 's'
10582							});
10583							manageVideos($drop_move,false);
10584						});
10585					});
10586
10587					document.addEventListener('visibilitychange', function(){
10588						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
10589							$drop_move.css({
10590								'transition-duration': '0s'
10591							});
10592							$drop_move.removeClass('active');
10593							manageVideos($drop_move, false);
10594						}
10595					});
10596
10597					document.addEventListener('scroll', function(){
10598						window.clearRequestTimeout( stopBounding );
10599						if ( stoppedScrolling ) {
10600							stoppedScrolling = false;
10601							if ( $drop_move.hasClass('active') ) {
10602								$list.removeClass('drop-hover');
10603								$tmbs.removeClass('drop-active');
10604								$drop_move.removeClass('active');
10605								$drop_move.on('transitionend', function(e){
10606									$drop_move.off('transitionend');
10607									$drop_move.css({
10608										'transition-duration': timing + 's'
10609									});
10610									manageVideos($drop_move,false);
10611								});
10612							}
10613						}
10614
10615						stopBounding = requestTimeout(function() {
10616							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
10617								var bound = $anim_parent[0].getBoundingClientRect();
10618								$drop_move.css({
10619									left: bound.x * -1,
10620									top: bound.y * -1,
10621								});
10622							}
10623							stoppedScrolling = true;
10624						}, 500);
10625					});
10626				}
10627
10628				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
10629					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
10630
10631				$drop.css({
10632					'transition-duration': timing + 's'
10633				});
10634
10635				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
10636					$trgr.on('mouseenter',function(e){
10637						$row_parent.add($col_parent).addClass('drop-list-loaded');
10638						$list.addClass('drop-hover');
10639
10640						if ( !$tmb.hasClass('drop-active') ) {
10641							$tmbs.removeClass('drop-active');
10642							$tmb.addClass('drop-active');
10643							if ( default_image && !$drop.hasClass('active') ) {
10644								var $prev = $('[data-drop].active', $row_parent);
10645								$prev.css({
10646									'transition-duration': (timing*1.5) + 's'
10647								});
10648								$prev.removeClass('active');
10649								$prev.on('transitionend', function(e){
10650									$prev.off('transitionend');
10651									manageVideos($prev,false);
10652								});
10653							}
10654							$drop.css({
10655								'transition-duration': timing + 's'
10656							});
10657							$drop.off('transitionend');
10658							$drop.addClass('active');
10659							manageVideos($drop, true);
10660						}
10661					})
10662					.on('mouseleave', function(e){
10663						if ( ( default_image && !default_title ) || !default_image ) {
10664							$list.removeClass('drop-hover');
10665							$tmb.removeClass('drop-active');
10666						}
10667						if ( ! default_image ) {
10668							$drop.css({
10669								'transition-duration': (timing*1.5) + 's'
10670							});
10671							$drop.removeClass('active');
10672
10673							$drop.on('transitionend', function(e){
10674								$drop.off('transitionend');
10675								manageVideos($drop,false);
10676							});
10677						}
10678					});
10679
10680					document.addEventListener('visibilitychange', function(){
10681						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
10682							$drop.css({
10683								'transition-duration': '0s'
10684							});
10685							$drop.removeClass('active');
10686							manageVideos($drop, false);
10687						}
10688					});
10689				}
10690			});
10691
10692		});
10693	};
10694
10695	$(window).on('load', function(event) {
10696		imageHover();
10697	});
10698
10699	var drop_wp_animation = function() {
10700		var $postLists = $('.uncode-post-titles');
10701		$postLists.each(function(){
10702			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10703				new Waypoint({
10704					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10705					element: val,
10706					handler: function() {
10707						var element = $(this.element),
10708							parent = element.closest('.tmb'),
10709							currentIndex = parent.index(),
10710							delay = currentIndex,
10711							delayAttr = parseInt(element.attr('data-delay'));
10712						if (isNaN(delayAttr)) delayAttr = 100;
10713						var objTimeout = requestTimeout(function() {
10714							element.addClass('start_animation');
10715
10716							var nextTimeout = requestTimeout(function() {
10717								$('.drop-image-separator', parent).addClass('start_animation');
10718							}, 50);
10719
10720						}, delay * delayAttr);
10721						if (!UNCODE.isUnmodalOpen) {
10722							this.destroy();
10723						}
10724					},
10725					offset: UNCODE.isFullPage ? '100%' : '90%'
10726				})
10727			});
10728		});
10729	}
10730
10731	var runWaypoints_TO,
10732		runWaypoints_delay = 0;
10733
10734	var runWaypoints = function(){
10735		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10736			runWaypoints_delay = 400;
10737		}
10738		clearRequestTimeout(runWaypoints_TO);
10739		runWaypoints_TO = requestTimeout(function() {
10740			drop_wp_animation();
10741		}, runWaypoints_delay);
10742	};
10743	runWaypoints();
10744	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10745	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10746		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10747			// imageHover();
10748			runWaypoints();
10749		});
10750	}
10751};
10752
10753UNCODE.postTable = function() {
10754
10755	var clickRow = function(){
10756		var $postLists = $('.uncode-post-table');
10757
10758		$postLists.each(function(){
10759			var $postList = $(this),
10760				$tmbClicks = $('.tmb.tmb-click-row', $postList);
10761
10762			$tmbClicks.each(function(){
10763				var $tmb = $(this),
10764					$click = $('.table-click-row', $tmb);
10765				$('*:not(.table-click-row)', $tmb).on('click', function(e){
10766					e.preventDefault();
10767					e.stopPropagation();
10768					$click[0].click();
10769					return false;
10770				});
10771			});
10772
10773		})
10774	};
10775
10776	clickRow();
10777
10778	var hoverRow = function(){
10779		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
10780
10781		$postLists.on('mouseenter', function(){
10782			$(this).addClass('post-table-hover');
10783		});
10784		$postLists.on('mouseleave', function(){
10785			$(this).removeClass('post-table-hover');
10786		});
10787	}
10788
10789	hoverRow();
10790
10791	var drop_wp_animation = function() {
10792		var $postLists = $('.uncode-post-table');
10793		$postLists.each(function(){
10794			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10795				new Waypoint({
10796					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10797					element: val,
10798					handler: function() {
10799						var element = $(this.element),
10800							parent = element.closest('.tmb'),
10801							currentIndex = parent.index(),
10802							delay = currentIndex,
10803							delayAttr = parseInt(element.attr('data-delay'));
10804						if (isNaN(delayAttr)) delayAttr = 100;
10805						var objTimeout = requestTimeout(function() {
10806							element.addClass('start_animation');
10807						}, delay * delayAttr);
10808						if (!UNCODE.isUnmodalOpen) {
10809							this.destroy();
10810						}
10811					},
10812					offset: UNCODE.isFullPage ? '100%' : '90%'
10813				})
10814			});
10815		});
10816	}
10817
10818	var runWaypoints_TO,
10819		runWaypoints_delay = 0;
10820
10821	var runWaypoints = function(){
10822		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10823			runWaypoints_delay = 400;
10824		}
10825		clearRequestTimeout(runWaypoints_TO);
10826		runWaypoints_TO = requestTimeout(function() {
10827			drop_wp_animation();
10828		}, runWaypoints_delay);
10829	};
10830	runWaypoints();
10831	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10832	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10833		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10834			runWaypoints();
10835			// clickRow();
10836		});
10837	}
10838};
10839
10840UNCODE.rotatingTxt = function($ctxt) {
10841
10842	if ( $('body').hasClass('compose-mode') ) {
10843		return;
10844	}
10845
10846	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
10847	var setCTA;
10848
10849	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
10850		var $heading = $(this),
10851			// debug = 0,
10852			cycle = 0,
10853			$trgt,
10854			$toMove,
10855			$highl,
10856			$col = $heading.closest('.uncont'),
10857			txt,
10858			arrTxt,
10859			textFadeIn, textFadeOut,
10860			removeWraps;
10861
10862		var defineObjs = function() {
10863			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
10864				var $rtx = $(this),
10865					fx = $rtx.attr('data-fx'),
10866					wait = $rtx.attr('data-wait'),
10867					$prev = $(this).prev().addClass('prev-rotating-start'),
10868					splitToMove = [],
10869					splitArray = [],
10870					lineArray = [],
10871					lineIndex = 0,
10872					lineStart = true,
10873					lineEnd = false,
10874					startSplit = false,
10875					$line_wrap = $rtx.closest('.heading-line-wrap'),
10876					same_line = true,
10877					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
10878					indexRtx = $splits.index($rtx);
10879
10880				fx = typeof fx === 'undefined' ? '' : fx;
10881				wait = typeof wait === 'undefined' ? '' : wait;
10882
10883				$splits.each(function(key, val){
10884					var $split = $(this),
10885						$new_line_wrap = $split.closest('.heading-line-wrap');
10886
10887					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
10888						splitArray.push( $split );
10889					}
10890
10891					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10892						startSplit = false;
10893					}
10894
10895					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10896						splitArray.push( $split );
10897
10898						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
10899							same_line = true;
10900						} else {
10901							same_line = false;
10902						}
10903					}
10904
10905					if ( key == indexRtx ) {
10906						if ( /\S/.test($split.text()) ) {
10907							startSplit = true;
10908							$line_wrap = $split.closest('.heading-line-wrap');
10909							splitArray.push( $split );
10910						} else {
10911							indexRtx++;
10912						}
10913					}
10914
10915					$line_wrap = $new_line_wrap;
10916				});
10917
10918				$toMove = $($.map(splitToMove, function(el){return el.get();}));
10919				$trgt = $($.map(splitArray, function(el){return el.get();}));
10920
10921				if ( same_line ) {
10922					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
10923					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
10924				}
10925
10926				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
10927					$prev.addClass('empty-span-hidden');
10928				}
10929
10930				$highl = $('.heading-text-highlight-inner', $trgt);
10931
10932				$rtx.attr('data-animated', 'true');
10933				if ( cycle == 0 ) {
10934					$( document.body ).trigger('defer-highlights');
10935					cycle++;
10936					defineObjs();
10937					return;
10938				}
10939				cycle++;
10940
10941				txt = $rtx.attr('data-text');
10942				arrTxt = txt.split("|");
10943
10944				textFadeOut($trgt);
10945
10946			});
10947		};
10948
10949		removeWraps = function(){
10950
10951			// if ( debug == 1 ) return;
10952			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
10953			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
10954
10955
10956				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
10957					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
10958
10959				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
10960
10961				$splitFlow.each(function(){
10962					$(this).append($temp_highl);
10963				});
10964
10965				var $line_wrap = $wraps[wrap_k];
10966				var $parent_wrap = $line_wrap.parentNode;
10967				if ( $parent_wrap !== null ) {
10968					while ( $line_wrap.firstChild ) {
10969						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
10970					}
10971					$parent_wrap.removeChild($line_wrap);
10972				}
10973			}
10974			// debug++;
10975			defineObjs();
10976		};
10977
10978		var loop = 0;
10979		textFadeIn = function($trgt){
10980			var word = arrTxt[loop].split(" "),
10981				worsSpan = '',
10982				$wrap = $trgt.closest('.uncode-rotating-wrap'),
10983				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
10984				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
10985
10986			for (var w = 0; w < word.length; w++) {
10987				var highl;
10988				if ( $highl.length ) {
10989					highl = $highl[0].outerHTML;
10990				} else {
10991					highl = '';
10992				}
10993
10994				if ( w > 0 ) {
10995					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
10996				}
10997				var charachters = word[w].split('');
10998				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
10999				if ( ! SiteParameters.uncode_has_ligatures ) {
11000					for (var c = 0; c < charachters.length; c++) {
11001						worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
11002					}
11003				} else {
11004					worsSpan += word[w];
11005				}
11006				worsSpan += '</span>' + highl + '</span></span>';
11007			}
11008
11009			if ( $wrap.length && $wrap_inner.length ) {
11010				var words_w = $wrap_inner.outerWidth();
11011				$wrap.css({
11012					width: words_w
11013				});
11014
11015				$highl = $('.heading-text-highlight-inner', $wrap);
11016				$highl.prependTo($wrap);
11017
11018				$wrap_inner.css({
11019					opacity: 0
11020				});
11021
11022				$wrap_inner.html(worsSpan);
11023				$('.heading-text-highlight-inner', $wrap_inner).remove();
11024				words_w = $wrap_inner.innerWidth();
11025
11026				var duration = 0.45;
11027
11028				$heading.removeClass('auto-width');
11029				if ( words_w > $col.width() ) {
11030					$heading.addClass('auto-width');
11031					words_w = 'auto';
11032					duration = 0;
11033				}
11034
11035				$wrap.css({
11036					'width': words_w,
11037					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
11038				});
11039
11040				var $word_inner = $('.split-word-inner', $wrap_inner),
11041					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
11042
11043				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11044
11045				if ( !$target_fx.length ) {
11046					return;
11047				}
11048
11049				gsap.killTweensOf($target_fx);
11050
11051				if ( fx !== 'zoom' ) {
11052					gsap.fromTo( $target_fx, {
11053						y: fx === 'opacity' ? '0%' : '-10%'
11054					},{
11055						delay: duration,
11056						duration: 0.25,
11057						y: '0%',
11058						ease: Circ.easeOut,
11059					});
11060
11061					if ( !$wrap_inner.length ) {
11062						return;
11063					}
11064
11065					gsap.fromTo( $wrap_inner, {
11066						opacity: 0,
11067					},{
11068						delay: duration,
11069						duration: 0.25,
11070						opacity: 1,
11071						ease: Circ.easeOut,
11072						onComplete: function(){
11073							$('> .heading-text-highlight-inner', $wrap).remove();
11074							$wrap_inner.html(worsSpan);
11075							removeWraps();
11076						}
11077					})
11078
11079				} else {
11080					gsap.fromTo( $target_fx, {
11081						transformOrigin: '50%',
11082						opacity: 0,
11083						scale: 0.875,
11084					},{
11085						opacity: 1,
11086						delay: duration,
11087						duration: 0.25,
11088						scale: 1,
11089						ease: Circ.easeOut,
11090						onComplete: function(){
11091							$('> .heading-text-highlight-inner', $wrap).remove();
11092							$wrap_inner.html(worsSpan);
11093							removeWraps();
11094						}
11095					});
11096				}
11097
11098			} else {
11099
11100				if ( !$wrap_inner.length ) {
11101					return;
11102				}
11103
11104				gsap.to( $wrap_inner, {
11105					duration: 0.4,
11106					opacity: 0,
11107					ease: Power1.easeOut,
11108					onComplete: function(){
11109						$wrap_inner.html(worsSpan);
11110						words_w = $wrap_inner.innerWidth();
11111
11112						gsap.to( $wrap_inner, {
11113							duration: 0.2,
11114							opacity: 1,
11115							ease: Power1.easeOut,
11116							onComplete: function(){
11117								$('> .heading-text-highlight-inner', $wrap).remove();
11118								$wrap_inner.html(worsSpan);
11119								removeWraps();
11120							}
11121						})
11122					}
11123				});
11124			}
11125
11126			if ( loop < arrTxt.length-1 ) {
11127				loop++;
11128			} else {
11129				loop = 0;
11130			}
11131
11132		};
11133
11134		textFadeOut = function($trgt){
11135			var $word_inner = $('.split-word-inner', $trgt),
11136				$wrap = $trgt.closest('.uncode-rotating-wrap'),
11137				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
11138				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
11139				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
11140
11141			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
11142
11143			var gsap_param = {
11144					delay: wait,
11145					duration: 0.25,
11146					y: fx === '' ? '10%' : '0%',
11147					opacity: 0,
11148					ease: Circ.easeOut,
11149					onStart: function(){
11150						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
11151							$highl = $('.heading-text-highlight-inner', $wrap);
11152							$highl.prependTo($wrap);
11153						}
11154					},
11155					onComplete: textFadeIn,
11156					onCompleteParams: [$trgt]
11157				};
11158
11159			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
11160
11161			if ( fx === '' ) {
11162				gsap_param.y = '10%';
11163			} else if ( fx === 'zoom' ) {
11164				gsap_param.scale = '1.045';
11165			}
11166
11167			if ( !$target_fx.length ) {
11168				return;
11169			}
11170
11171			if ( $heading.data('waypoint') !== true ) {
11172				var textInView = new Waypoint.Inview({
11173					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
11174					element: $heading[0],
11175					enter: function(direction) {
11176						$heading.data('waypoint',true);
11177						gsap.fromTo( $target_fx, {
11178							transformOrigin: '50%'
11179						}, gsap_param );
11180					}
11181				});
11182			} else {
11183				gsap.fromTo( $target_fx, {
11184					transformOrigin: '50%'
11185				}, gsap_param );
11186			}
11187		};
11188
11189		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
11190			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
11191				var $el = model.view.$el,
11192					shortcode = model.attributes.shortcode;
11193
11194				UNCODE.rotatingTxt($el);
11195			});
11196		} else {
11197			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
11198				$heading.on('already-animated', function(){
11199					removeWraps();
11200					window.addEventListener('removeOldLines', function(){
11201						clearRequestTimeout(setCTA);
11202						setCTA = requestTimeout( removeWraps, 150 );
11203					});
11204				});
11205			} else {
11206				$(window).on('load', function(){
11207					removeWraps();
11208					window.addEventListener('removeOldLines', function(){
11209						clearRequestTimeout(setCTA);
11210						setCTA = requestTimeout( removeWraps, 150 );
11211					});
11212				});
11213			}
11214		}
11215	});
11216
11217};
11218
11219UNCODE.verticalText = function() {
11220	$(window).on('menuCanvasOpen', function(){
11221		$('.vertical-text--fixed').fadeOut(500);
11222		$('.horizontal-text--fixed').fadeOut(500);
11223	}).on('menuCanvasClose', function(){
11224		$('.vertical-text--fixed').fadeIn(500);
11225		$('.horizontal-text--fixed').fadeIn(500);
11226	});
11227
11228	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
11229	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
11230	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
11231	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
11232
11233	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
11234		window.addEventListener('scroll', function(e) {
11235			var totalPageHeight = document.body.scrollHeight;
11236			var scrollPoint = window.scrollY + window.innerHeight;
11237
11238			if (window.scrollY > 0) {
11239				showOnTopVerticalTexts.fadeOut();
11240				showOnTopHorizontalTexts.fadeOut();
11241			} else {
11242				showOnTopVerticalTexts.fadeIn();
11243				showOnTopHorizontalTexts.fadeIn();
11244			}
11245
11246			if (scrollPoint >= totalPageHeight) {
11247				hideOnBottomVerticalTexts.fadeOut();
11248				hideOnBottomHorizontalTexts.fadeOut();
11249			} else {
11250				hideOnBottomVerticalTexts.fadeIn();
11251				hideOnBottomHorizontalTexts.fadeIn();
11252			}
11253		}, false);
11254	}
11255};
11256
11257UNCODE.stickyScroll = function( $el ) {
11258	if ( typeof $el === 'undefined' || $el === null ) {
11259		$el = $('body');
11260	}
11261	var checkVisible = function( el, dir ) {
11262		if (typeof jQuery === "function" && el instanceof jQuery) {
11263			el = el[0];
11264		}
11265
11266		var off = 50;
11267		dir = typeof dir=='undefined' ? 'right' : dir;
11268		var rect = el.getBoundingClientRect();
11269
11270		return (
11271			(
11272				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11273				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
11274				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
11275			) &&
11276			(
11277				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11278				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
11279				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
11280				( rect.right <= window.innerWidth && rect.left >= 0 )
11281			)
11282		);
11283	};
11284
11285	var setItemsRelHeight = function(reset) {
11286		var $_el = $el;
11287		if ( $el.is('.index-scroll') ) {
11288			var $_el = $el.closest('.uncont');
11289		}
11290		$('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
11291			$.each($('.tmb', item), function(index, val) {
11292				if ( reset === true ) {
11293					$(val).css( 'visibility', 'hidden' );
11294				} else {
11295					$(val).css( 'visibility', 'visible' );
11296				}
11297			});
11298		});
11299		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
11300			$.each($('.tmb', item), function(index, val) {
11301				if ( reset === true ) {
11302					$(val).css( 'visibility', 'hidden' );
11303					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
11304				} else {
11305					var $rowParent = $(item).closest('.row-parent'),
11306						rowRatio = $rowParent.attr('data-height-ratio'),
11307						$rowInner = $(item).closest('.row-child'),
11308						rowRatioInner = $rowInner.attr('data-height'),
11309						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11310						$colContainer = $(item).closest('.uncell'),
11311						$uncont = $(item).closest('.uncont'),
11312						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
11313						safe_heigth = $(item).data('safe-height'),
11314						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
11315						offSet = $(item).offset().top - $uncont.offset().top,
11316						multiplier_h,
11317						data_viewport_h,
11318						body_border = $('.body-borders .top-border').outerHeight() * 2,
11319						remove_menu = $(item).data('vp-menu');
11320
11321					if ( rowRatio === 'full' || rowRatio === '' ) {
11322						rowRatio = 1;
11323					} else {
11324						rowRatio = rowRatio / 100;
11325					}
11326
11327					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
11328						rowRatio = rowRatio;
11329					} else {
11330						rowRatio = rowRatio * rowRatioInner / 100;
11331					}
11332
11333					winHeight = winHeight * rowRatio;
11334
11335					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11336						multiplier_h = parseInt($(item).attr('data-vp-height'));
11337					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
11338						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
11339					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
11340						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
11341					}
11342
11343					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
11344						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
11345						if ( remove_menu === true ) {
11346							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
11347						}
11348						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
11349					} else {
11350						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
11351					}
11352
11353				}
11354			});
11355		});
11356		$('.index-scroll', $_el).each(function(i, item){
11357			var $uncoltable = $(item).closest('.uncoltable'),
11358				$rowParent = $(item).closest('.row-parent'),
11359				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
11360				body_border = $('.body-borders .top-border').outerHeight() * 2,
11361				$index_row = $('.index-row', item),
11362				safe_heigth = $index_row.data('safe-height'),
11363				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
11364			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
11365				var data_viewport_h = winHeight - ( paddingRow + body_border );
11366				$uncoltable.css({
11367					'min-height': data_viewport_h
11368				});
11369			} else {
11370				$uncoltable.css({
11371					'min-height': 'auto'
11372				});
11373			}
11374		});
11375
11376	}
11377	setItemsRelHeight();
11378
11379	var $index_scrolls = $('.index-scroll', $el);
11380
11381	$index_scrolls.each(function(key, value){
11382		var $index = $(this),
11383			$parent_row = $index.closest('.vc_row[data-parent]'),
11384			$index_row = $('.index-row', $index),
11385			dir = $index_row.attr('data-direction');
11386		dir = typeof dir === 'undefined' ? 'right' : dir;
11387
11388		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
11389	});
11390
11391	var $horScrolls = $('.unscroll-horizontal', $el);
11392
11393	if ( $horScrolls.length ) {
11394
11395		$('body').addClass('scrolling-trigger');
11396
11397		$horScrolls.each(function(key, value){
11398			var $section = $(this),
11399				$index_scroll = $('.index-scroll', $section),
11400				$index_row = $('.index-row', $index_scroll),
11401				dir = $section.attr('data-direction'),
11402				wrap = $index_row.attr('data-wrap'),
11403				$pinWrap,
11404				$pinTrigger;
11405
11406			dir = typeof dir === 'undefined' ? 'right' : dir;
11407			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
11408			$pinWrap = $('<div class="pin-wrap" />');
11409			if ( SiteParameters.is_frontend_editor ) {
11410				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
11411				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
11412			} else {
11413				if ( wrap === 'column' ) {
11414					$index_scroll.wrapInner( $pinWrap );
11415				} else {
11416					$('> .row', $section).wrap( $pinWrap );
11417				}
11418				$section.wrapInner( $pinTrigger );
11419			}
11420
11421		});
11422
11423		var $pinWraps = $('.pin-wrap', $el);
11424
11425		var horScrollSizes = function(){
11426
11427			$pinWraps.each(function(key, val){
11428				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
11429					$pinTrigger = $pinWrap.closest('.pin-trigger'),
11430					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
11431					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
11432					$boxContainer = $('.box-container'),
11433					box_m = $boxContainer.css('margin-left'),
11434					st_active = true;
11435
11436				var setHorW,
11437				horWidth = function(){
11438					$index_scroll.each(function(){
11439						var $this = $(this),
11440							$index_row = $('.index-row', $this),
11441							$rowContainer = $index_row.closest('.vc_row'),
11442							$rowInner = $index_row.closest('.wpb_row'),
11443							$rowParent = $index_row.closest('.row-parent'),
11444							$tmbs = $('.tmb', $index_row),
11445							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
11446							$uncont = $index_row.closest('.uncont'),
11447							$parent_col = $index_row.closest('.wpb_column'),
11448							col_w = $uncont.width(),
11449							data_lg = parseFloat( $index_row.attr('data-lg') ),
11450							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
11451							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
11452							tmb_w;
11453
11454						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
11455						tmb_w = ( col_w + padding_tmb ) / data_lg;
11456
11457						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
11458							tmb_w = ( col_w + padding_tmb ) / data_sm;
11459						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
11460							tmb_w = ( col_w + padding_tmb ) / data_md;
11461						}
11462
11463						if ( !isNaN(tmb_w) ) {
11464							$tmbs.css({
11465								'width': tmb_w
11466							});
11467						}
11468
11469						$tmbs.css({
11470							'visibility': 'visible'
11471						});
11472
11473					});
11474				};
11475
11476				horWidth();
11477				clearRequestTimeout(setHorW);
11478				setHorW = requestTimeout( function(){
11479					setItemsRelHeight();
11480					horWidth();
11481				}, 100 );
11482
11483				if ( SiteParameters.is_frontend_editor ) {
11484					return;
11485				}
11486
11487				var $vmenu = $('body.vmenu .vmenu-container'),
11488					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
11489					winWidth = window.innerWidth - vmenuW,
11490					$tmb = $('.tmb', $index_scroll).eq(0),
11491					paddingRight = parseFloat( $tmb.css('padding-right') ),
11492					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ),
11493					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
11494					scroll_anim;
11495
11496				if ( $('body').hasClass('rtl') ) {
11497					if ( dir === 'left' ) {
11498						scroll_anim = gsap.fromTo( $pinWrap, {
11499							x: stickyScrollLength
11500						},{
11501							x: 0,
11502							ease: "none"
11503						});
11504					} else {
11505						scroll_anim = gsap.fromTo( $pinWrap, {
11506							x: 0
11507						},{
11508							x: stickyScrollLength,
11509							ease: "none"
11510						});
11511					}
11512				} else {
11513					if ( dir === 'left' ) {
11514						scroll_anim = gsap.fromTo( $pinWrap, {
11515							x: -stickyScrollLength
11516						},{
11517							x: 0,
11518							ease: "none"
11519						});
11520					} else {
11521						scroll_anim = gsap.fromTo( $pinWrap, {
11522							x: 0
11523						},{
11524							x: -stickyScrollLength,
11525							ease: "none"
11526						});
11527					}
11528				}
11529
11530				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
11531					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
11532				}
11533
11534				var animationIncrease;
11535
11536				var checkForAnimations = function(){
11537					animationIncrease = 0
11538					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11539						var _this = this;
11540						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
11541							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11542							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11543							requestTimeout(function() {
11544								$(_this).addClass('start_animation');
11545							}, delayAttr + animationIncrease);
11546							animationIncrease += 150;
11547						}
11548					});
11549
11550					var batchTime = 0;
11551
11552					var resetBatch = function(){
11553						batchTime = 0;
11554					}
11555
11556					if (ScrollTrigger.isScrolling()) {
11557						resetBatch();
11558					}
11559					
11560					$('.tmb-mask-reveal', $pinTrigger).each(function(){
11561						var _this = this,
11562							$this = $(_this),
11563							$inside = $('.t-inside', $this),
11564							delay = parseFloat( $inside.attr('data-delay') ),
11565							speed = parseFloat( $inside.attr('data-speed') ),
11566							easing = $inside.attr('data-easing'),
11567							bgDelay = parseFloat( $inside.attr('data-bg-delay') );
11568
11569						delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
11570						speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
11571						easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
11572						bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
11573
11574						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) {
11575							$this.addClass('tmb-mask-init');
11576							if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) {
11577								gsap.to($('.t-entry-visual-tc', $this), speed, {
11578									clipPath: 'inset(0% 0% 0% 0%)',
11579									delay: delay + batchTime,
11580									ease: easing,
11581								});
11582								gsap.to($('.t-entry-visual-cont', $this), speed, {
11583									clipPath: 'inset(0% 0% 0% 0%)',
11584									scale: 1,
11585									delay: delay + batchTime + (speed*bgDelay),
11586									ease: easing,
11587									onComplete: resetBatch,
11588								});
11589							} else {
11590								gsap.to($('.t-entry-visual-cont', $this), speed, {
11591									clipPath: 'inset(0% 0% 0% 0%)',
11592									scale: 1,
11593									delay: delay + batchTime,
11594									ease: easing,
11595									onComplete: resetBatch,
11596								});
11597							}
11598							batchTime += 0.1;
11599						}
11600					});
11601				
11602				};
11603				checkForAnimations();
11604
11605				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
11606				var start = 0;
11607
11608				var horST = ScrollTrigger.create({
11609					id: "stickySectionScrolling" + key,
11610					scrub: true,
11611					trigger: $pinTrigger[0],
11612					pin: true,
11613					anticipatePin: 1,
11614					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
11615					end: function() { return "+="+stickyScrollLength; },
11616					animation: scroll_anim,
11617					ease: Sine.easeOut,
11618					onUpdate: checkForAnimations,
11619					invalidateOnRefresh: true,
11620					onEnter: function(){
11621						$pinTrigger.addClass('enter-st');
11622					},
11623					onEnterBack: function(){
11624						$pinTrigger.addClass('enter-st');
11625					},
11626					onLeave: function(){
11627						$pinTrigger.removeClass('enter-st');
11628					},
11629					onLeaveBack: function(){
11630						$pinTrigger.removeClass('enter-st');
11631					}
11632				});
11633
11634				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
11635				window.dispatchEvent(new CustomEvent('boxResized'));
11636
11637				var testSecondTrigger = function(){
11638					animationIncrease = 0
11639					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
11640						var _this = this;
11641						if ( checkVisible(_this) ) {
11642							var delayAttr = parseFloat( $(_this).attr('data-delay') );
11643							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
11644							requestTimeout(function() {
11645								$(_this).addClass('start_animation');
11646							}, delayAttr + animationIncrease);
11647							animationIncrease += 150;
11648						}
11649					});
11650
11651				};
11652
11653				var verST = ScrollTrigger.create({
11654					id: "verticalSectionScrolling" + key,
11655					trigger: $pinTrigger[0],
11656					start: "top center",
11657					end: function() { return "+="+UNCODE.wheight; },
11658					onUpdate: testSecondTrigger,
11659					invalidateOnRefresh: true
11660				});
11661
11662				var setCTA,
11663
11664				dis_enable_ST = function(){
11665					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
11666						horST.kill();
11667						verST.kill();
11668						$pinTrigger.addClass('disabled');
11669						st_active = false;
11670					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
11671						horST.kill();
11672						verST.kill();
11673						$pinTrigger.addClass('disabled');
11674						st_active = false;
11675					}
11676				};
11677
11678				$(window).on('resize load', function() {
11679					clearRequestTimeout(setCTA);
11680					setCTA = requestTimeout(function() {
11681						dis_enable_ST();
11682						checkForAnimations();
11683					}, 500);
11684				});
11685
11686			});
11687		};
11688
11689		$(window).on( 'load', function(){
11690			horScrollSizes();
11691		});
11692		var setResize,
11693			setReLayout,
11694			doubleResize = true;
11695		$(window).on( 'load', function(){
11696			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
11697				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11698				Array.prototype.forEach.call($row_inners, function(el) {
11699					el.style.height = '';
11700					el.style.marginBottom = '';
11701				});
11702				setItemsRelHeight();
11703				horScrollSizes();
11704				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11705					$(document).trigger('uncode-scrolltrigger-refresh');
11706				}
11707			}
11708			var carousel = document.querySelector(".owl-carousel"),
11709				grid = document.querySelector(".isotope-container"),
11710				stickyAll = document.querySelectorAll(".index-scroll");
11711
11712			if ( stickyAll.length ) {
11713				var sticky = stickyAll[(stickyAll.length-1)];
11714			}
11715
11716			if ( typeof sticky !== "undefined" ) {
11717
11718				if ( typeof carousel !== "undefined" && carousel !== null ) {
11719					var carousel_position = sticky.compareDocumentPosition(carousel);
11720				}
11721				if ( typeof grid !== "undefined" && grid !== null ) {
11722					var grid_position = sticky.compareDocumentPosition(grid);
11723				}
11724
11725				if ( carousel_position === 2 || grid_position === 2 ) {
11726					setTimeout(function(){
11727						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11728							$(document).trigger('uncode-scrolltrigger-refresh');
11729						}
11730					}, 500);
11731				}
11732
11733			}
11734			
11735		});
11736        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
11737            android = /Android/.test(navigator.userAgent) && !window.MSStream;
11738		$(window).on( 'resize orientationchange', function(e){
11739			if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
11740				return;
11741			}
11742			setItemsRelHeight(true);
11743			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
11744			Array.prototype.forEach.call($row_inners, function(el) {
11745				el.style.height = '';
11746				el.style.marginBottom = '';
11747			});
11748			clearRequestTimeout(setResize);
11749			setResize = requestTimeout( function(){
11750				setItemsRelHeight();
11751				horScrollSizes();
11752				if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11753					$(document).trigger('uncode-scrolltrigger-refresh');
11754				}
11755				if ( doubleResize === true ) {
11756					window.dispatchEvent(new Event('resize'));
11757					doubleResize = false;
11758				} else {
11759					doubleResize = true;
11760				}
11761				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
11762			}, 100 );
11763		});
11764
11765		var show_pins = function(){
11766			$('.index-scroll').css({'opacity':'1'});
11767		};
11768		ScrollTrigger.addEventListener("refresh", show_pins);
11769		$(window).on( 'uncode.re-layout', function(){
11770			//$('.index-scroll').css({'opacity':'0'});
11771			$('.pin-spacer').each(function(){
11772				var space_h = $(this).outerHeight(),
11773					$row = $(this).closest('.row-container');
11774				$row.css({
11775					'height': space_h,
11776					'overflow': 'hidden'
11777				});
11778			});
11779			if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
11780				ScrollTrigger.refresh(true);
11781			}
11782			clearRequestTimeout(setReLayout);
11783			setReLayout = requestTimeout( function(){
11784				$('.row-container').each(function(){
11785					$(this).css({
11786						'height': '',
11787						'overflow': ''
11788					});
11789				});
11790			}, 1000);
11791		});
11792	}
11793
11794};
11795
11796UNCODE.stickyTrigger = function( $el ) {
11797    if ( SiteParameters.is_frontend_editor ) {
11798        return false;
11799    }
11800
11801    var stickyTrigger = function(){
11802        var stickyTrick = $('.sticky-trigger').each(function(){
11803            var $sticky = $(this),
11804                $inside = $('> div', $sticky),
11805                insideH = $inside.outerHeight(),
11806                $row = $sticky.closest('.vc_row'),
11807                $uncont = $sticky.closest('.uncont'),
11808                rowBottom,
11809                uncontBottom,
11810                diffBottom;
11811
11812            ScrollTrigger.create({
11813                trigger: $sticky,
11814                start: function(){ return "top center-=" + insideH/2; },
11815                endTrigger: $row,
11816                end:  function(){
11817                    rowBottom = $row.offset().top + $row.outerHeight();
11818                    uncontBottom = $uncont.offset().top + $uncont.outerHeight();
11819                    diffBottom = rowBottom - uncontBottom;
11820                    return "bottom center+=" + ( insideH/2 + diffBottom );
11821                },
11822                anticipatePin: true,
11823                pin: true,
11824                pinSpacing: false,
11825                scrub: true,
11826                invalidateOnRefresh: true,
11827            });
11828
11829        });
11830    },
11831    setResizeSticky;
11832
11833    $(window).on( 'load', function(){
11834        stickyTrigger();
11835        var carousel = document.querySelector(".owl-carousel"),
11836            grid = document.querySelector(".isotope-container"),
11837            stickyAll = document.querySelectorAll(".sticky-trigger");
11838
11839        if ( stickyAll.length ) {
11840            var sticky = stickyAll[(stickyAll.length-1)];
11841        }
11842
11843        if ( typeof sticky !== "undefined" ) {
11844
11845            if ( typeof carousel !== "undefined" && carousel !== null ) {
11846                var carousel_position = sticky.compareDocumentPosition(carousel);
11847            }
11848            if ( typeof grid !== "undefined" && grid !== null ) {
11849                var grid_position = sticky.compareDocumentPosition(grid);
11850            }
11851
11852            if ( carousel_position === 2 || grid_position === 2 ) {
11853                setTimeout(function(){
11854                    $(document).trigger('uncode-scrolltrigger-refresh');
11855                }, 500);
11856            }
11857
11858        }
11859    });
11860
11861    var oldW = UNCODE.wwidth;
11862    $(window).on( 'resize uncode.re-layout', function(e){
11863        clearRequestTimeout(setResizeSticky);
11864        if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
11865            return;
11866        } else {
11867            oldW = UNCODE.wwidth;
11868        }
11869        setResizeSticky = requestTimeout( function(){
11870            stickyTrigger();
11871            $(document).trigger('uncode-scrolltrigger-refresh');
11872        }, 1000 );
11873    });
11874
11875    
11876};
11877
11878UNCODE.areaTextReveal = function() {
11879    if ( ! $('.text-reveal, .scroll-trigger-el').length ) {
11880        return;
11881    }
11882	if ( ! SiteParameters.is_frontend_editor ) {
11883        var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream,
11884            android = /Android/.test(navigator.userAgent) && !window.MSStream,
11885            prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
11886            prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
11887                document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
11888            firstObs = true,
11889            isMobileUsing = false;
11890
11891        var observer = new ResizeObserver(function(){
11892            var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ),
11893                newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
11894                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight ),
11895                set = false;
11896            if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) {
11897                set = true;
11898                prevW = newW;
11899            } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
11900                set = true;
11901                prevH = newH;
11902            }
11903            if ( set || firstObs ) {
11904                window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe'));
11905                firstObs = false;
11906            }
11907        }).observe(document.body);
11908
11909        if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) {
11910            window.scrollTo = function() {
11911                return;
11912            };
11913            isMobileUsing = true;
11914
11915            $('html, body').css({
11916                'overscroll-behavior': 'none'
11917            });
11918        }
11919
11920        var setTriggerObserve;
11921
11922        ScrollTrigger.observe({
11923            trigger: 'body',
11924            type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
11925            onUp: function() { ScrollTrigger.update(); },
11926        });
11927    }
11928
11929    var textReveal = function(){
11930
11931        if ( SiteParameters.is_frontend_editor ) {
11932            return;
11933        }
11934
11935        var setTxtReveal,
11936            txtTrggrStart = false;
11937
11938        function headingReveal($sel){
11939            txtTrggrStart = true;
11940            $('.text-reveal', $sel).each(function(val, key){
11941                var $txtReveal = $(this).attr('data-init-reveal', true),
11942                    $trigger = $txtReveal,
11943                    $rowParent = $txtReveal.closest('.row-container[data-parent]'),
11944                    hReveal = $txtReveal.outerHeight(),
11945                    $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'),
11946                    $sticky = $txtReveal.closest('.sticky-element'),
11947                    dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
11948                    dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
11949                    dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')),
11950                    $lines = $('.heading-line-wrap', $txtReveal),
11951                    $words = $('.split-word-inner', $txtReveal),
11952                    $chars = $('.split-char', $txtReveal),
11953                    $elToReveal = $words;
11954
11955                if ( $pin.length ) {
11956                    return;
11957                } else if ( $sticky.length ) {
11958                    hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop);
11959                    $trigger = $sticky.parent();
11960                }
11961
11962                if ( dataReveal === 'chars' ) {
11963                    $elToReveal = $chars;
11964                } else if ( dataReveal === 'lines' ) {
11965                    $elToReveal = $lines;
11966                }
11967                
11968                var tl = gsap.timeline({
11969                    scrollTrigger: {
11970                        trigger: $trigger,
11971                        start: "top +=" + (window.innerHeight/100*dataTop) + "px",
11972                        end: "+=" + hReveal + "px",
11973                        id: "txt_reveal_" + key,
11974                        scrub: true,
11975                    }
11976                });
11977                gsap.set(
11978                    $elToReveal, {
11979                        opacity: dataRevealOpacity,
11980                    }
11981                )
11982                tl.fromTo($elToReveal, {
11983                    opacity: dataRevealOpacity,
11984                    duration: 1,
11985                }, {
11986                    opacity: 1,
11987                    stagger: 0.05,
11988                    duration: 1,
11989
11990                });
11991                $(window).on('uncode.tl-refresh', function(){
11992                    if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) {
11993                        tl.scrollTrigger.refresh();
11994                    }
11995                });
11996
11997                $rowParent.one( 'uncodeWordLines', function(){
11998                    clearRequestTimeout(setTxtReveal);
11999                    setTxtReveal = requestTimeout( function(){
12000                        gsap.set($elToReveal, {clearProps: true});
12001                        tl.kill(true);
12002                        if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) {
12003                            ScrollTrigger.getById("txt_reveal_" + key).kill(true);
12004                        }
12005                        headingReveal($sel)
12006                    }, 100);
12007                });
12008
12009            });
12010        };
12011
12012        window.addEventListener("load", function (e) {
12013            if (!txtTrggrStart) {
12014                headingReveal($("body"));
12015                $(window).trigger("resize");
12016            }
12017        });
12018
12019        $('.row-container[data-parent]').each(function(){
12020            if (!txtTrggrStart) {
12021                var $this = $(this);
12022                $this.on('uncodeWordLines', function(){
12023                    headingReveal($this);
12024                });
12025            }
12026        });
12027
12028        $(window).on('uncode-sticky-trigger-observe', function(e){
12029            clearRequestTimeout(setTriggerObserve);
12030            setTriggerObserve = requestTimeout( function(){
12031                $(window).trigger('uncode.tl-refresh');
12032            }, 2000 );
12033        });
12034    
12035    };
12036    textReveal();
12037
12038    var areaReveal = function(){
12039        if ( SiteParameters.is_frontend_editor ) {
12040            return;
12041        }
12042
12043        $('.scroll-trigger-el').each(function(){
12044            var $scrollTrgrEl = $(this),
12045                $row = $('> .row', $scrollTrgrEl),
12046                $row_in = $('> .row-inner', $row),
12047                cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length,
12048                stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows',
12049                animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes',
12050                stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false,
12051                $animateTrgrEl = $scrollTrgrEl,
12052                noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes',
12053                noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'),
12054                els = $scrollTrgrEl.attr('data-anim-els'),
12055                sticky = $scrollTrgrEl.attr('data-anim-sticky'),
12056                noSpace = $scrollTrgrEl.attr('data-anim-no-space'),
12057                state = $scrollTrgrEl.attr('data-anim-state'),
12058                target = $scrollTrgrEl.attr('data-anim-target'),
12059                origin = $scrollTrgrEl.attr('data-anim-origin'),
12060                mask = $scrollTrgrEl.attr('data-anim-mask'),
12061                _scale = $scrollTrgrEl.attr('data-anim-scale'),
12062                stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes',
12063                opacity = $scrollTrgrEl.attr('data-anim-opacity'),
12064                radius = $scrollTrgrEl.attr('data-anim-radius'),
12065                radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'),
12066                clip_path = $scrollTrgrEl.attr('data-clip-path'),
12067                animation_x = $scrollTrgrEl.attr('data-anim-x'),
12068                animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'),
12069                animation_y = $scrollTrgrEl.attr('data-anim-y'),
12070                blur = $scrollTrgrEl.attr('data-anim-blur'),
12071                perspective = $scrollTrgrEl.attr('data-anim-perspective'),			
12072                rotate = $scrollTrgrEl.attr('data-anim-rotate'),	
12073                rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'),
12074                topBottom = $scrollTrgrEl.attr('data-anim-start'),	
12075                offTop = $scrollTrgrEl.attr('data-anim-top'),
12076                offBottom = $scrollTrgrEl.attr('data-anim-bottom'),
12077                safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0,
12078                animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'),
12079                easeOut = $scrollTrgrEl.attr('data-anim-ease'),
12080                offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'),
12081                stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards,
12082                $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(),
12083                setTxtReveal,
12084                txtTrggrStart = false,
12085                alreadyareaAnimateScrollTl = false;
12086    
12087            _scale = _scale === '' ? 0 : parseFloat( _scale );
12088            perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001;	
12089            offTop = offTop === '' ? 0 : parseFloat( offTop );
12090            offBottom = offBottom === '' ? 0 : parseFloat( offBottom );
12091            offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard );
12092
12093            function areaAnimateScrollTl($el, id, last) {
12094                alreadyareaAnimateScrollTl = true;
12095
12096                var pTop = parseFloat( $row.css('padding-top') ),
12097                    innerGap = pTop + offSetCard * id,
12098                    scale = _scale;
12099
12100                if ( isMobileUsing ) {
12101                    innerGap = 0;
12102                }
12103
12104                if ( stepScale ) {
12105                    if ( _scale < 100 ) {
12106                        scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) );
12107                    }
12108                }
12109
12110                if ( els === 'content' ) {
12111                    $animateTrgrEl = $('> .row', $scrollTrgrEl);
12112                } else if ( els === 'bg' ) {
12113                    $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl);
12114                } else {
12115                    $animateTrgrEl = $el;
12116                }
12117
12118                if ( rotate_alt === 'yes') {
12119                    rotate *= -1;
12120                    perspective *= -1;
12121                }
12122                
12123                if ( animation_x_alt === 'yes') {
12124                    animation_x *= -1;
12125                }
12126
12127                var $parentDiv = $el.closest('div[data-sticky]');
12128
12129                var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px";
12130
12131                var scrllTrggr = {
12132                    trigger: $parentDiv,
12133                    end: function(){
12134                        return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom)))
12135                    },
12136                    start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
12137                    pin: sticky === 'yes' || stickyCards ? true : false,
12138                    pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0),
12139                    scrub: true,
12140                    id: 'sticky_' + id,
12141                    anticipatePin: 1,
12142                    invalidateOnRefresh: true,
12143                    // markers: {
12144                    //     indent: 150 * id
12145                    // },
12146                    onToggle: function(){
12147                        $scrollTrgrEl.attr('data-revealed', true);
12148                    },
12149                };
12150
12151                if ( !stickyLast && state === 'end' ) {
12152                    last = false;
12153                } 
12154
12155                if ( stickyCards ) {
12156                    if ( state !== 'end' ) {
12157                        if ( animation_rows_start === 'center' ) {
12158                            scrllTrggr.start = "center center";
12159                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight);
12160                        } else if ( animation_rows_start === 'bottom' ) {
12161                            if ( stickyOpts !== 'no' ) {
12162                                scrllTrggr.start = "bottom bottom";
12163                                scrllTrggr.end = "bottom bottom";
12164                            }
12165                        } else {
12166                            scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2);
12167                        } 
12168                        if ( stickyOpts === 'no' ) {
12169                            scrllTrggr.endTrigger = $el;
12170                            scrllTrggr.end = "+=100%";
12171                        } else {
12172                            scrllTrggr.endTrigger = $row;
12173                        }
12174                    } else {
12175                        if ( animation_rows_start === 'center' ) {
12176                            scrllTrggr.start = "center center";
12177                        } else if ( animation_rows_start === 'bottom' ) {
12178                            scrllTrggr.start = "bottom bottom";
12179                        } 
12180                        if ( stickyOpts !== 'no' ) {
12181                            scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1));
12182                            scrllTrggr.endTrigger = $lastEl;
12183                        } else {
12184                            scrllTrggr.end = "bottom bottom";
12185                        }
12186                    }
12187                }
12188                
12189                var tl = gsap.timeline({
12190                    scrollTrigger: scrllTrggr
12191                });
12192
12193                // var mark = last ? {
12194                //         startColor:"blue",
12195                //         endColor:"orange",
12196                //     } : false;
12197
12198                if ( !stickyCards ) {
12199                    var tlConds = tl;
12200                } else {
12201                    var scrllTrggrConds = {
12202                        trigger: $parentDiv,
12203                        end: function(){
12204                            return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom)))
12205                        }, 
12206                        pin: (state === 'end' && last),
12207                        pinSpacing: false,
12208                        scrub: true,
12209                        id: 'card_' + id,
12210                        invalidateOnRefresh: true,
12211                        // markers: true,
12212                    };
12213                    if ( stickyCards ) {
12214                        if ( state !== 'end' ) {
12215                            if ( stickyOpts === '' ) {
12216                                scrllTrggrConds.end = "bottom bottom-=100%";
12217                                scrllTrggrConds.endTrigger = $row_in;
12218                            }
12219
12220                            if ( animation_rows_start === 'bottom' ) {
12221                                if ( stickyOpts !== 'no') {
12222                                    scrllTrggrConds.start = "top top+=" + window.innerHeight;
12223                                    scrllTrggrConds.end = "bottom bottom";
12224                                }
12225                            } else if ( animation_rows_start === 'center' ) {
12226                                scrllTrggrConds.start =  "center center";
12227                            } else {
12228                                scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12229                            }
12230                            
12231                        } else {
12232                            if ( stickyOpts === '' ) {
12233                                if ( animLast ) {
12234                                    scrllTrggrConds.end = "bottom bottom-=100%";
12235                                } else {
12236                                    scrllTrggrConds.end = "bottom bottom";
12237                                }
12238                                scrllTrggrConds.endTrigger = $lastEl;
12239                            }
12240
12241                            if ( animation_rows_start === 'bottom' && stickyOpts !== 'no' ) {
12242                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12243                                    scrllTrggrConds.start = "bottom bottom";
12244                                } else {
12245                                    scrllTrggrConds.start = "top top+=" + $el.outerHeight();
12246                                }
12247                            } else if ( animation_rows_start === 'center' ) {
12248                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12249                                    scrllTrggrConds.start =  "center center";
12250                                } else {
12251                                scrllTrggrConds.start =  "top+=" + ($el.outerHeight()/2) + " top+=" 
12251+ window.innerHeight/2;
12252                                }
12253                            } else {
12254                                if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
12255                                    scrllTrggrConds.start = "top top";
12256                                } else {
12257                                    scrllTrggrConds.start = "top top+=" + (innerGap + 1);
12258                                }
12259                            }
12260
12261                        }
12262
12263                    } else {
12264                        scrllTrggrConds.start =  start_topBottom;
12265                    }
12266
12267                    var tlConds = gsap.timeline({
12268                        scrollTrigger: scrllTrggrConds
12269                    });
12270                }
12271
12272                if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) {
12273                    if ( target === 'mask' ) {
12274                        if ( state !== 'end' ) {
12275                            if ( mask === 'auto' ) {
12276                                gsap.set(
12277                                    $animateTrgrEl, {
12278                                        clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12279                                        opacity: parseFloat(opacity)/100,
12280                                        filter: 'blur(' + blur + 'px)',
12281                                        visibility: 'visible',
12282                                    }
12283                                )
12284                                tlConds.fromTo($animateTrgrEl, {
12285                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12286                                    opacity: parseFloat(opacity)/100,
12287                                    filter: 'blur(' + blur + 'px)',
12288                                    duration: 1,
12289                                }, {
12290                                    opacity: 1,
12291                                    clipPath: 'inset(0% 0px round 0' + radiu
12291s_unit + ')',
12292                                    filter: 'blur(0px)',
12293                                    duration: 1,
12294                                    ease: easeOut,
12295                                    //delay: 0.1
12296                                });	
12297                            } else {
12298                                tlConds.fromTo($animateTrgrEl, {
12299                                    opacity: parseFloat(opacity)/100,
12300                                    clipPath: clip_path,
12301                                    filter: 'blur(' + blur + 'px)',
12302                                    duration: 1,
12303                                }, {
12304                                    opacity: 1,
12305                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12306                                    filter: 'blur(0px)',
12307                                    duration: 1,
12308                                    ease: easeOut,
12309                                    //delay: 0.1
12310                                });	
12311                            }
12312                        } else {
12313                            if ( mask === 'auto' ) {
12314                                tlConds.fromTo($animateTrgrEl, {
12315                                    opacity: 1,
12316                                    clipPath: 'inset(0% 0px round 0' + radiu
12316s_unit + ')',
12317                                    filter: 'blur(0px)',
12318                                    duration: 1,
12319                                },{
12320                                    opacity: parseFloat(opacity)/100,
12321                                    clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')',
12322                                    filter: 'blur(' + blur + 'px)',
12323                                    ease: easeOut,
12324                                    duration: 1,
12325                                    //delay: 0.1
12326                                });	
12327                            } else {
12328                                tlConds.fromTo($animateTrgrEl, {
12329                                    opacity: 1,
12330                                    clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')',
12331                                    filter: 'blur(0px)',
12332                                    duration: 1,
12333                                },{
12334                                    opacity: parseFloat(opacity)/100,
12335                                    clipPath: clip_path,
12336                                    filter: 'blur(' + blur + 'px)',
12337                                    duration: 1,
12338                                    ease: easeOut,
12339                                    //delay: 0.1
12340                                });	
12341                            }
12342                        }
12343                    } else {
12344                        if ( state !== 'end' ) {
12345                            if ( scale === 'auto' ) {
12346                                if ( radius ) {
12347                                    gsap.set(
12348                                        $animateTrgrEl, {
12349                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12350                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12351                                            x: animation_x + 'vw',
12352                                            y: animation_y + 'vh',
12353                                            filter: 'blur(' + blur + 'px)',
12354                                            rotation: rotate,
12355                                            rotationX: rotate == 0 ? perspective : 0,
12356                                            transformPerspective: '100vw',
12357                                            opacity: parseFloat(opacity)/100,
12358                                            transformOrigin: origin,
12359                                            borderRadius: radius + radius_unit,
12360                                            visibility: 'visible',
12361                                        }
12362                                    )
12363                                    tlConds.fromTo($animateTrgrEl, {
12364                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12365                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12366                                        x: animation_x + 'vw',
12367                                        y: animation_y + 'vh',
12368                                        filter: 'blur(' + blur + 'px)',
12369                                        rotation: rotate,
12370                                        rotationX: rotate == 0 ? perspective : 0,
12371                                        transformPerspective: '100vw',
12372                                        opacity: parseFloat(opacity)/100,
12373                                        borderRadius: radius + radius_unit,
12374                                        transformOrigin: origin,
12375                                        duration: 1,
12376                                    }, {
12377                                        scaleX: 1,
12378                                        scaleY: 1,
12379                                        x: 0,
12380                                        y: 0,
12381                                        filter: 'blur(0px)',
12382                                        rotation: 0,
12383                                        rotationX: 0,
12384                                        opacity: 1,
12385                                        borderRadius: 0 + radius_unit,
12386                                        transformOrigin: origin,
12387                                        duration: 1,
12388                                        ease: easeOut,
12389                                        //delay: 0.1
12390                                    });	
12391                                } else {
12392                                    gsap.set(
12393                                        $animateTrgrEl, {
12394                                            scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12395                                            scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12396                                            x: animation_x + 'vw',
12397                                            y: animation_y + 'vh',
12398                                            filter: 'blur(' + blur + 'px)',
12399                                            rotation: rotate,
12400                                            rotationX: rotate == 0 ? perspective : 0,
12401                                            transformPerspective: '100vw',
12402                                            opacity: parseFloat(opacity)/100,
12403                                            transformOrigin: origin,
12404                                            visibility: 'visible',
12405                                        }
12406                                    )
12407                                    tlConds.fromTo($animateTrgrEl, {
12408                                        scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12409                                        scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12410                                        x: animation_x + 'vw',
12411                                        y: animation_y + 'vh',
12412                                        filter: 'blur(' + blur + 'px)',
12413                                        rotation: rotate,
12414                                        rotationX: rotate == 0 ? perspective : 0,
12415                                        transformPerspective: '100vw',
12416                                        opacity: parseFloat(opacity)/100,
12417                                        transformOrigin: origin,
12418                                        duration: 1,
12419                                    }, {
12420                                        scaleX: 1,
12421                                        scaleY: 1,
12422                                        x: 0,
12423                                        y: 0,
12424                                        filter: 'blur(0px)',
12425                                        rotation: 0,
12426                                        rotationX: 0,
12427                                        opacity: 1,
12428                                        transformOrigin: origin,
12429                                        duration: 1,
12430                                        ease: easeOut,
12431                                        //delay: 0.1
12432                                    });	
12433                                }
12434                            } else {
12435                                if ( radius ) {
12436                                    gsap.set(
12437                                        $animateTrgrEl, {
12438                                            scaleX: parseFloat( scale ) / 100,
12439                                            scaleY: parseFloat( scale ) / 100,
12440                                            opacity: parseFloat(opacity)/100,
12441                                            x: animation_x + 'vw',
12442                                            y: animation_y + 'vh',
12443                                            filter: 'blur(' + blur + 'px)',
12444                                            rotation: rotate,
12445                                            rotationX: rotate == 0 ? perspective : 0,
12446                                            transformPerspective: '100vw',
12447                                            transformOrigin: origin,
12448                                            borderRadius: radius + radius_unit,
12449                                            visibility: 'visible',
12450                                        }
12451                                    )
12452                                    tlConds.fromTo($animateTrgrEl, {
12453                                        scaleX: parseFloat( scale ) / 100,
12454                                        scaleY: parseFloat( scale ) / 100,
12455                                        opacity: parseFloat(opacity)/100,
12456                                        x: animation_x + 'vw',
12457                                        y: animation_y + 'vh',
12458                                        filter: 'blur(' + blur + 'px)',
12459                                        rotation: rotate,
12460                                        rotationX: rotate == 0 ? perspective : 0,
12461                                        transformPerspective: '100vw',
12462                                        borderRadius: radius + radius_unit,
12463                                        transformOrigin: origin,
12464                                        duration: 1,
12465                                    }, {
12466                                        scaleX: 1,
12467                                        scaleY: 1,
12468                                        opacity: 1,
12469                                        x: 0,
12470                                        y: 0,
12471                                        filter: 'blur(0px)',
12472                                        rotation: 0,
12473                                        rotationX: 0,
12474                                        transformOrigin: origin,
12475                                        ease: easeOut,
12476                                        duration: 1,
12477                                        borderRadius: 0 + radius_unit,
12478                                        //delay: 0.1
12479                                    });	
12480                                } else {
12481                                    gsap.set(
12482                                        $animateTrgrEl, {
12483                                            scaleX: parseFloat( scale ) / 100,
12484                                            scaleY: parseFloat( scale ) / 100,
12485                                            opacity: parseFloat(opacity)/100,
12486                                            x: animation_x + 'vw',
12487                                            y: animation_y + 'vh',
12488                                            filter: 'blur(' + blur + 'px)',
12489                                            rotation: rotate,
12490                                            rotationX: rotate == 0 ? perspective : 0,
12491                                            transformPerspective: '100vw',
12492                                            transformOrigin: origin,
12493                                            visibility: 'visible',
12494                                        }
12495                                    )
12496                                    tlConds.fromTo($animateTrgrEl, {
12497                                        scaleX: parseFloat( scale ) / 100,
12498                                        scaleY: parseFloat( scale ) / 100,
12499                                        opacity: parseFloat(opacity)/100,
12500                                        x: animation_x + 'vw',
12501                                        y: animation_y + 'vh',
12502                                        filter: 'blur(' + blur + 'px)',
12503                                        rotation: rotate,
12504                                        rotationX: rotate == 0 ? perspective : 0,
12505                                        transformPerspective: '100vw',
12506                                        transformOrigin: origin,
12507                                        duration: 1,
12508                                    }, {
12509                                        scaleX: 1,
12510                                        scaleY: 1,
12511                                        opacity: 1,
12512                                        x: 0,
12513                                        y: 0,
12514                                        filter: 'blur(0px)',
12515                                        rotation: 0,
12516                                        rotationX: 0,
12517                                        transformOrigin: origin,
12518                                        duration: 1,
12519                                        ease: easeOut,
12520                                        //delay: 0.1
12521                                    });
12522                                }
12523                            }
12524                        } else {
12525                            if ( scale === 'auto' ) {
12526                                tlConds.fromTo($animateTrgrEl, {
12527                                    scaleX: 1,
12528                                    scaleY: 1,
12529                                    opacity: 1,
12530                                    x: 0,
12531                                    y: 0,
12532                                    filter: 'blur(0px)',
12533                                    rotation: 0,
12534                                    rotationX: 0,
12535                                    transformOrigin: origin,
12536                                    duration: 1,
12537                                }, {
12538                                    scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12539                                    scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ),
12540                                    opacity: parseFloat(opacity)/100,
12541                                    x: animation_x + 'vw',
12542                                    y: animation_y + 'vh',
12543                                    filter: 'blur(' + blur + 'px)',
12544                                    rotation: rotate,
12545                                    rotationX: rotate == 0 ? perspective : 0,
12546                                    transformPerspective: '100vw',
12547                                    transformOrigin: origin,
12548                                    duration: 1,
12549                                    ease: easeOut,
12550                                    //delay: 0.1
12551                                })
12552                            } else {
12553                                tlConds.fromTo($animateTrgrEl, {
12554                                    scaleX: 1,
12555                                    scaleY: 1,
12556                                    opacity: 1,
12557                                    x: 0,
12558                                    y: 0,
12559                                    filter: 'blur(0px)',
12560                                    rotation: 0,
12561                                    rotationX: 0,
12562                                    transformPerspective: '100vw',
12563                                    transformOrigin: origin,
12564                                    borderRadius: 0 + radius_unit,
12565                                    duration: 1,
12566                                }, {
12567                                    scaleX: parseFloat( scale ) / 100,
12568                                    scaleY: parseFloat( scale ) / 100,
12569                                    opacity: parseFloat(opacity)/100,
12570                                    x: animation_x + 'vw',
12571                                    y: animation_y + 'vh',
12572                                    filter: 'blur(' + blur + 'px)',
12573                                    rotation: rotate,
12574                                    rotationX: rotate == 0 ? perspective : 0,
12575                                    transformPerspective: '100vw',
12576                                    transformOrigin: origin,
12577                                    borderRadius: radius + radius_unit,
12578                                    duration: 1,
12579                                    ease: easeOut,
12580                                    //delay: 0.1
12581                                })
12582                            }
12583                        }
12584                    }
12585                }
12586
12587                function headingReveal($el){
12588                    txtTrggrStart = true;
12589                    $('.text-reveal', $el).each(function(_key, _val){
12590                        var $txtReveal = $(_val),
12591                            dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'),
12592                            dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'),
12593                            $lines = $('.heading-line-wrap', $txtReveal),
12594                            $words = $('.split-word-inner', $txtReveal),
12595                            $chars = $('.split-char', $txtReveal),
12596                            _setTxtReveal,
12597                            $elToReveal = $words;
12598
12599                        if ( !(sticky === 'yes' || stickyCards) ) {
12600                            return;
12601                        }
12602            
12603                        easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut;
12604
12605                        if ( dataReveal === 'chars' ) {
12606                            $elToReveal = $chars;
12607                        } else if ( dataReveal === 'lines' ) {
12608                            $elToReveal = $lines;
12609                        }
12610
12611                        var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr;
12612                        scrllTrggrTxt.id = "txt_reveal_" + _key; 
12613                        scrllTrggrTxt.pin = false;
12614
12615                        gsap.set($elToReveal, {opacity: dataRevealOpacity});
12616                        var _tl = gsap.timeline({
12617                            scrollTrigger: scrllTrggrTxt
12618                        });
12619                        _tl.fromTo($elToReveal, {
12620                            opacity: dataRevealOpacity,
12621                        }, {
12622                            opacity: 1,
12623                            stagger: 0.05
12624                        });
12625
12626                        $scrollTrgrEl.one( 'uncodeWordLines', function(){
12627                            clearRequestTimeout(_setTxtReveal);
12628                            _setTxtReveal = requestTimeout( function(){
12629                                gsap.set($elToReveal, {clearProps: true});
12630                                _tl.kill(true);
12631                                if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) {
12632                                    ScrollTrigger.getById("txt_reveal_" + _key).kill(true);
12633                                }
12634                                headingReveal($el)
12635                            }, 100);
12636                        });
12637
12638                    });
12639                };
12640
12641                if (!txtTrggrStart) {
12642                    headingReveal($el);
12643                }
12644
12645                $scrollTrgrEl.one( 'uncodeWordLines', function(){
12646                    if (!txtTrggrStart) {
12647                        headingReveal($el);
12648                    }
12649                });
12650                
12651                var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 
12652                    document.documentElement.clientHeight,  document.documentElement.scrollHeight,  document.documentElement.offsetHeight );
12653                var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 
12654                    document.documentElement.clientWidth,  document.documentElement.scrollWidth,  document.documentElement.offsetWidth );
12655                    
12656                $(window).on('uncode-sticky-trigger-observe', function(e){
12657                    var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
12658                    var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth );
12659                    $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false});
12660                    //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style');
12661                    if ( stickyCards ) {
12662                        $('.tmb', $scrollTrgrEl).removeAttr('style');
12663                    }
12664                    var scrollnow = document.body.scrollTop || document.documentElement.scrollTop;
12665                    clearRequestTimeout(setTxtReveal);
12666                    setTxtReveal = requestTimeout( function(){
12667                        $(document).trigger('uncode-scrolltrigger-refresh');
12668                        if ( isMobileUsing ) {
12669                            if ( typeof tl !== 'undefined' ) {
12670                                tl.scrollTrigger.refresh();
12671                            }
12672                            if ( typeof tlConds !== 'undefined' ) {
12673                                tlConds.scrollTrigger.refresh();
12674                            }
12675                            $(window).trigger('scroll');
12676                            _width = __width;
12677                        } else if ( _width !== __width && ( isMobileUsing ) ) {
12678                            window.dispatchEvent(new CustomEvent('vc-resize'));
12679                            if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) {
12680                                window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){
12681                                    if ( typeof tl !== 'undefined' ) {
12682                                        tl.scrollTrigger.refresh();
12683                                    }
12684                                    if ( typeof tlConds !== 'undefined' ) {
12685                                        tlConds.scrollTrigger.refresh();
12686                                    }
12687                                    window.lenis.scrollTo(scrollnow, {duration: 0.01});
12688                                }});
12689                            } else {
12690                                if ( typeof tl !== 'undefined' ) {
12691                                    tl.scrollTrigger.refresh();
12692                                }
12693                                if ( typeof tlConds !== 'undefined' ) {
12694                                    tlConds.scrollTrigger.refresh();
12695                                }
12696                                $(window).trigger('scroll');
12697                            }
12698                            _height = __height;
12699                        }
12700                    }, 500);
12701                });
12702
12703
12704                $(window).on('load ', function(e){
12705                    var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight );
12706                    if ( _height !== ___height ) {
12707                        $scrollTrgrEl.attr('data-toggled', true);
12708                        $(window).trigger('resize');
12709                        if ( typeof tl !== 'undefined' ) {
12710                            tl.scrollTrigger.refresh();
12711                        }
12712                        if ( typeof tlConds !== 'undefined' ) {
12713                            tlConds.scrollTrigger.refresh();
12714                        }
12715                        _height = ___height;
12716                    }
12717
12718                    
12719                    
12720                    $(document).trigger('uncode-scrolltrigger-refresh');
12721
12722                });
12723
12724            };
12725
12726            var callAreaAnimateScrollTl = function() {
12727                if ( stickyCards ) {
12728                    $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){
12729                        if ( key+1 < cardL || animLast || state !== 'end' ) {
12730                            var $this = $(val),
12731                                last = key+1===cardL;
12732                            areaAnimateScrollTl($this, key, last);
12733                        }
12734                    });
12735                } else {
12736                    areaAnimateScrollTl($scrollTrgrEl, 0, false);
12737                }    
12738            };
12739
12740            $(window).on('wwResize', function(){
12741                if ( !alreadyareaAnimateScrollTl ) {
12742                    if ( noMobile ) {
12743                        if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
12744                            return;
12745                        } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12746                            return;
12747                        }
12748                    }
12749                    
12750                    callAreaAnimateScrollTl();
12751                }
12752            })
12753
12754            if ( noMobile ) {
12755                if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) {
12756                    return;
12757                } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12758                    return;
12759                }
12760            }
12761
12762            callAreaAnimateScrollTl();
12763
12764        });
12765
12766    };
12767
12768    areaReveal();
12769
12770};
12771
12772UNCODE.thumbsReveal = function() {
12773    var revealThumbs = function( $el ){
12774        if ( typeof $el === 'undefined' || $el === null || !$el.length ) {
12775            $el = $('body');
12776        }
12777        $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){
12778            var $container = $(this),
12779                $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container),
12780                isContainer = false;
12781
12782            if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) {
12783                $stickys.each(function(){
12784                    var $sticky = $(this).addClass('tmb-mask-init'),
12785                        $inside = $('.t-inside', $sticky),
12786                        $media = $('img, video, .fluid-object', $sticky),
12787                        val = parseFloat( $inside.attr('data-scroll-val') );
12788
12789                    val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val;
12790                    
12791                    if ( $sticky.hasClass('tmb-mask-scroll') ) {
12792
12793                        var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both'))
12794                        ? val*0.05 : 0;
12795                        var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both'))
12796                            ? val*4 : 0;
12797                        var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) ? parax*0.01 : 0;
12798
12799                        var tl = gsap.timeline({
12800                            scrollTrigger: {
12801                                trigger: $sticky,
12802                                scrub: true,
12803                            }
12804                        });
12805
12806                        tl.fromTo($media, {
12807                            yPercent: -(parax),
12808                            scale: 1 + zoom + extra,
12809                        }, {
12810                            yPercent: parax,
12811                            scale: 1 + extra,
12812                            ease: "none",
12813                        });
12814                    }
12815                });
12816            }
12817
12818            if ( $container.has('.tmb-mask-reveal') ) {
12819                var $markTrigger = ".tmb-mask-reveal .t-entry-visual",
12820                staggerTime = 0.1;
12821
12822                $('.t-inside', $container).each(function(){
12823                    var checkEasing = $(this).attr('data-easing');
12824                    if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') {
12825                        gsap.registerPlugin(CustomEase);
12826                        return false;
12827                    }
12828                });
12829
12830                if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) {
12831                    $markTrigger = $container;
12832                    isContainer = true;
12833                    staggerTime = 0;
12834                }
12835
12836                ScrollTrigger.batch( $markTrigger, {
12837                    start: function( el ){
12838                        /*if ( el.trigger.offsetHeight < (window.innerHeight/2) ) {
12839                            return "bottom bottom";
12840                        } else {*/
12841                            return  "top 96%";
12842                        //}
12843                    },
12844                    onEnter: function(batch){
12845                        var $inside = $(batch).closest('.t-inside');
12846
12847                        if ( isContainer ) {
12848                            var $inside = $(batch).find('.t-inside').first();
12849                        }
12850
12851                        var delay = parseFloat( $inside.attr('data-delay') ),
12852                            speed = parseFloat( $inside.attr('data-speed') ),
12853                            easing = $inside.attr('data-easing'),
12854                            bgDelay = parseFloat( $inside.attr('data-bg-delay') );
12855
12856                        delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000;
12857                        speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000;
12858                        easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing;
12859                        bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay;
12860
12861                        if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) {
12862                            gsap.to($('.t-entry-visual-tc', batch), speed, {
12863                                clipPath: 'inset(0% 0% 0% 0%)',
12864                                stagger: staggerTime,
12865                                delay: delay,
12866                                ease: easing,
12867                            });
12868                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
12869                                clipPath: 'inset(0% 0% 0% 0%)',
12870                                stagger: staggerTime,
12871                                scale: 1,
12872                                delay: delay + (speed*bgDelay),
12873                                ease: easing,
12874                            });
12875                        } else {
12876                            gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, {
12877                                clipPath: 'inset(0% 0% 0% 0%)',
12878                                stagger: staggerTime,
12879                                scale: 1,
12880                                delay: delay,
12881                                ease: easing,
12882                            });
12883                        }
12884                                                    
12885                    }
12886                });
12887            }
12888
12889        });
12890
12891    };
12892    $(window).on( 'load more-items-loaded', function(){
12893        revealThumbs();
12894    });
12895
12896    if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
12897        window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
12898            var $el = model.view.$el,
12899                shortcode = model.attributes.shortcode;
12900
12901            if ( $el.is('.custom-grid-container') ) {
12902                $el = $el.parent();
12903            }
12904
12905            if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') {
12906                revealThumbs($el);
12907            }
12908        });
12909    }
12910
12911};
12912
12913UNCODE.revslider = function() {
12914	var revSlider6In = function(){
12915		$('rs-module').each(function(){
12916			var $slider = $(this);
12917
12918			$slider.on('revolution.slide.onloaded', function(e, data){
12919				if ( $(e.currentTarget).closest(".header-revslider").length ) {
12920					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
12921						scrolltop = $(document).scrollTop();
12922					if ( style != undefined ) {
12923						UNCODE.switchColorsMenu(scrolltop, style);
12924					}
12925				}
12926			});
12927
12928			$slider.on('revolution.slide.onchange', function(e, data){
12929				if ( $(e.currentTarget).closest(".header-revslider").length ) {
12930					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
12931						scrolltop = $(document).scrollTop();
12932					if ( style != undefined ) {
12933						UNCODE.switchColorsMenu(scrolltop, style);
12934					}
12935				}
12936			});
12937
12938		});
12939
12940	};
12941	revSlider6In();
12942	$(window).on("load", revSlider6In );
12943
12944	document.addEventListener("sr.module.ready", function(e) { 
12945		var $slider = $('#'+e.id),
12946			settings = SR7.JSON[e.id];
12947
12948		if ( typeof settings !== 'undefined' && settings !== null ) {
12949			if ( $slider.closest(".header-revslider").length ) {
12950				var style = settings.slides[1].slide.attr.data,
12951					scrolltop = $(document).scrollTop();
12952				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
12953				style = style[1];
12954				if ( style[1] != undefined ) {
12955					UNCODE.switchColorsMenu(scrolltop, style);
12956				}
12957			}
12958		}
12959	});
12960
12961	document.addEventListener("sr.slide.afterChange", function(e) {
12962		var $slider = $('#'+e.id),
12963			settings = SR7.JSON[e.id];
12964
12965		if ( typeof settings !== 'undefined' && settings !== null ) {
12966			if ( $slider.closest(".header-revslider").length ) {
12967				var style = settings.slides[e.current.id].slide.attr.data,
12968					scrolltop = $(document).scrollTop();
12969				style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/);
12970				style = style[1];
12971				if ( style != undefined ) {
12972					UNCODE.switchColorsMenu(scrolltop, style);
12973				}
12974			}
12975		}
12976	});
12977
12978};
12979UNCODE.layerslider = function() {
12980	$(window).on("load", function() {
12981
12982		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
12983
12984			var slideData = slider.slides.current.data,
12985				scrolltop = $(document).scrollTop();
12986			if( slideData && slideData.skin ) {
12987
12988				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
12989
12990			}
12991		});
12992
12993	});
12994};
12995
12996UNCODE.ajax_filters = function () {
12997	var isAjaxing = false;
12998
12999/*************************
13000 *
13001 * Filters Menu and Widgets Area
13002 *
13003 ************************/
13004
13005 	var clear_clicked = false;
13006
13007 	var init_ajax_grid = function(){
13008
13009		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
13010		$grids.each(function(index, val){
13011			var $body = $('body'),
13012				$grid = $(val).addClass('init-ajax-grid'),
13013				starting_point = $grid.attr('data-toggle'),
13014				$trigger = $('.uncode-toggle-ajax-filters', $grid),
13015				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
13016				$isotope_wrapper = $('.isotope-wrapper', $grid),
13017				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
13018				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
13019				$footprint = $('.ajax-filter-footprint', $grid),
13020				sidebar_w,
13021				data_w = parseFloat( $sidebar.attr('data-max-width') ),
13022				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
13023				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
13024				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
13025				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13026				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
13027				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
13028				sidew,
13029				$inside_row = $('> .row-parent', $vc_row),
13030				bg_row,
13031				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
13032				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
13033				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
13034				sidebar_overlay = false,
13035				sidebar_hover = false,
13036				switchMobile = false,
13037				scrollTop;
13038
13039			if ( $vc_row.attr('class') ) {
13040				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
13041			}
13042
13043			if ( bg_row != null ) {
13044				$side_header.add($side_footer).addClass(bg_row[0]);
13045			}
13046
13047			$trigger.add($apply_filters).on('click', function(e){
13048				e.preventDefault();
13049				e.stopPropagation();
13050				$grid = $('.ajax-grid-system').eq(0);
13051				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13052				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
13053				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13054				sidebar_w = $sidebar_wrapper.width();
13055				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13056				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
13057					$(this).trigger('uncode-ajax-clear-filters');
13058				}
13059				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13060					$grid.toggleClass('ajax-hide-filters-blanks');
13061					$sidebar.slideToggle({
13062						duration: 400,
13063						easing: 'easeOutQuad',
13064					});
13065				} else {
13066					$grid.removeClass('ajax-hide-filters-blanks');
13067					$grid.toggleClass('ajax-hide-filters');
13068					if ( $grid.hasClass('ajax-hide-filters') ) {
13069						$body.addClass('ajax-hide-filters');
13070					} else {
13071						scrollTop = $('html, body').scrollTop();
13072						$body.removeClass('ajax-hide-filters');
13073					}
13074				}
13075				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13076					$('html, body').scrollTop(scrollTop);
13077				}
13078				return false;
13079			});
13080
13081			$close_btn.on('click', function(e){
13082				e.preventDefault();
13083				$grid = $('.ajax-grid-system').eq(0);
13084				$grid.addClass('ajax-hide-filters');
13085				if ( $grid.hasClass('ajax-hide-filters') ) {
13086					$body.addClass('ajax-hide-filters');
13087				} else {
13088					scrollTop = $('html, body').scrollTop();
13089					$body.removeClass('ajax-hide-filters');
13090				}
13091				$('html, body').scrollTop(scrollTop);
13092			});
13093
13094			$sidebar_wrapper.on('mouseover',function(){
13095				sidebar_hover = true;
13096			}).on('mouseout', function(){
13097				sidebar_hover = false;
13098			});
13099
13100			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
13101				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
13102					return;
13103				}
13104				if (undefined !== from && from === 'select_active_attributes') {
13105					return;
13106				}
13107				if ($(e.target).closest('.select2-container--open').length ) {
13108					return;
13109				}
13110				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
13111					$grid.add($body).addClass('ajax-hide-filters');
13112				}
13113			});
13114
13115			$sorting_trgr.on('click', function(e) {
13116				e.preventDefault();
13117			});
13118
13119			var inside_width = function(){
13120				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13121				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13122				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13123				$inside_row = $('> .row-parent', $vc_row);
13124				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
13125					sidew = $sidebar.width();
13126					$inside_row.css({
13127						width: sidew
13128					});
13129				} else {
13130					$inside_row.css({
13131						width: ''
13132					});
13133				}
13134			};
13135			inside_width();
13136
13137			var ajax_sidebar_position = function(e, f_editor){
13138				$grid = $('.ajax-grid-system').eq(0);
13139				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
13140				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
13141				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
13142				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
13143				$inside_row = $('> .row-parent', $vc_row);
13144				scrollTop = $('html, body').scrollTop();
13145				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
13146					$grid.add($body).addClass('ajax-hide-filters');
13147					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
13148					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
13149					sidebar_overlay = true;
13150					$body.addClass('ajax-filter-sidebar-overlay');
13151					$sidebar_wrapper.addClass(skin);
13152					var sideHeadH = $side_header.outerHeight(),
13153						sideFooterH = $side_footer.outerHeight();
13154					if ( data_w !== '' && data_w > 0 ) {
13155						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
13156							$sidebar.css({
13157								'max-width': data_w
13158							});
13159						} else {
13160							$sidebar.css({
13161								'max-width':'none'
13162							});
13163						}
13164					}
13165					$vc_row.css({
13166						'padding-top':sideHeadH,
13167						'padding-bottom':sideFooterH
13168					});
13169					var sidew = $sidebar.width();
13170					$inside_row.css({
13171						width: sidew
13172					});
13173					switchMobile = true;
13174				} else {
13175					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
13176						scrollTop = $('html, body').scrollTop();
13177						$grid.add($body).removeClass('ajax-hide-filters');
13178					}
13179					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
13180						$grid.addClass('ajax-hide-filters-blanks');
13181						$sidebar.hide();
13182					}
13183					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
13184					$('.ajax-sidebar-placeholder', $grid).remove();
13185					sidebar_overlay = false;
13186					$body.removeClass('ajax-filter-sidebar-overlay');
13187					$sidebar_wrapper.removeClass(skin);
13188					if ( data_w !== '' && data_w > 0 ) {
13189						$sidebar.css({
13190							'max-width':'none'
13191						});
13192					}
13193					$vc_row.css({
13194						'padding-top':0,
13195						'padding-bottom':0,
13196					});
13197
13198					$inside_row.css({
13199						width: ''
13200					});
13201
13202					if ( f_editor === true ) {
13203						UNCODE.ajax_filters();
13204					}
13205
13206					switchMobile = false;
13207				}
13208				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
13209					$('html, body').scrollTop(scrollTop);
13210				}
13211			};
13212
13213			var sidebar_width = function(){
13214				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
13215					sidebar_w = $footprint.width();
13216					$sidebar.css({ width: sidebar_w });
13217				} else {
13218					$sidebar.css({ width: '' });
13219				}
13220			};
13221			sidebar_width();
13222
13223			if ( SiteParameters.is_frontend_editor ) {
13224				ajax_sidebar_position();
13225			}
13226
13227			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
13228				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
13229					ajax_sidebar_position(e);
13230				}
13231				sidebar_width();
13232			});
13233
13234			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
13235				ajax_sidebar_position(e, true);
13236			});
13237
13238			$isotope_wrapper.on('transitionend', function(e){
13239				if ( $(e.target).hasClass('isotope-wrapper') ) {
13240					window.dispatchEvent(new CustomEvent('boxResized'));
13241				}
13242				return false;
13243			});
13244
13245			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
13246				var $grid = $('.ajax-grid-system').eq(0);
13247				$grid.addClass('ajax-hide-filters');
13248			}
13249
13250		});
13251	};
13252
13253	init_ajax_grid();
13254	$(document).on('uncode-ajax-filtered', init_ajax_grid);
13255
13256/*************************
13257 *
13258 * Hover hack
13259 *
13260 ************************/
13261 	var widget_hover_hack = function() {
13262 		$('.widget, .uncode_widget').each(function(){
13263			var $widget = $(this),
13264				class_w = $widget.attr('class'),
13265				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
13266				$footer = $widget.closest('#colophon');
13267
13268			if ( class_w.indexOf('widget_yith') > 0 ) {
13269				return true;
13270			}
13271
13272			$lis.each(function(){
13273 				var $li = $(this),
13274 					$a = $('a', $li),
13275 					$label = $a.closest('label');
13276
13277				if ( !$footer.length ) {
13278					$li.addClass('no-evts');
13279				}
13280
13281				if ( ! $('span', $a).length ) {
13282 					$li.addClass( 'li-hover' );
13283 				}
13284
13285 				$('li', $li).hover(function(e){
13286 					$(e.target).parents('li').each(function(){
13287 						$(this).addClass( 'parent-li-hover' );
13288 					});
13289					}, function (e) {
13290 					$(e.target).parents('li').each(function(key, val){
13291 						if ( key === 0) {
13292	 						$(val).removeClass( 'parent-li-hover' );
13293	 					}
13294 					});
13295 				});
13296
13297				$li.off('mouseup').on('mouseup', function (e) {
13298					if (e.which !== 3) {
13299						e.stopPropagation();
13300						var $a = $('a', this).first();
13301						$a[0].click();
13302					}
13303	 			});
13304 			});
13305 		});
13306 	}
13307	if (SiteParameters.disable_hover_hack !== '1') {
13308		widget_hover_hack();
13309		$(document).on('uncode-ajax-filtered', widget_hover_hack);
13310	}
13311
13312/*************************
13313 *
13314 * Init Filters
13315 *
13316 ************************/
13317
13318	function init_filters() {
13319		$(document).on('click', '.term-filter-link', function(e) {
13320			var _this = $(this);
13321			var widget = _this.closest('.uncode_widget');
13322			var container = get_filters_container();
13323
13324			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13325				return true;
13326			}
13327
13328			e.preventDefault();
13329
13330			if (widget.hasClass('widget-ajax-filters--checkbox')) {
13331				_this.parent().find('input[type="checkbox"]').trigger('click');
13332			} else {
13333				if (_this.hasClass('term-filter-link--active')) {
13334					_this.removeClass('term-filter-link--active');
13335				} else {
13336					_this.addClass('term-filter-link--active');
13337
13338					if (widget.hasClass('widget-ajax-filters--single')) {
13339						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
13340					}
13341				}
13342
13343				var url = _this.attr('href');
13344
13345				reload_items(container, url, true);
13346			}
13347		});
13348
13349		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
13350			var _this = $(this);
13351			var widget = _this.closest('.uncode_widget');
13352			var link = _this.closest('.term-filter').find('.term-filter-link');
13353			var url = link.attr('href');
13354			var container = get_filters_container();
13355
13356			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13357				window.location = url;
13358				return;
13359			}
13360
13361			if (widget.hasClass('widget-ajax-filters--single')) {
13362				widget.find('input[type="checkbox"]').each(function() {
13363					if (_this.attr('id') !== $(this).attr('id')) {
13364						$(this).prop('checked', false);
13365						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
13366					}
13367				});
13368			}
13369
13370			if (_this.prop('checked')) {
13371				link.addClass('term-filter-link--active');
13372			} else {
13373				link.removeClass('term-filter-link--active');
13374			}
13375
13376			reload_items(container, url, true);
13377		});
13378
13379		$(document).on('change', 'select.select--term-filters', function(e) {
13380			var _this = $(this);
13381			var selected = _this.find('option:selected');
13382			var option = $(selected);
13383			var url = option.attr('data-term-filter-url');
13384			var container = get_filters_container();
13385			var widget = _this.closest('.uncode_widget');
13386
13387			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
13388				window.location = url;
13389			} else {
13390				reload_items(container, url, true);
13391			}
13392		});
13393
13394		$(document).on('click', '.filter-list__link', function(e) {
13395			if (SiteParameters.is_frontend_editor) {
13396				return false;
13397			}
13398
13399			e.preventDefault();
13400
13401			var _this = $(this);
13402			var container = get_filters_container();
13403			var url = _this.attr('href');
13404			reload_items(container, url, true);
13405		});
13406
13407		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
13408			var _this = $(this);
13409			var container = get_filters_container();
13410			var url = _this.attr('href');
13411			reload_items(container, url, true);
13412		});
13413
13414		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
13415
13416			var _this = $(this);
13417			var container = get_filters_container();
13418			var url = _this.attr('href');
13419
13420			if ( container.length ) {
13421				e.preventDefault();
13422				reload_items(container, url, true);
13423			}
13424		});
13425
13426		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
13427			var _this = $(this);
13428			var container = get_filters_container();
13429
13430			if (container.length > 0) {
13431				e.preventDefault();
13432
13433				var min_price = $('#min_price').val();
13434				var max_price = $('#max_price').val();
13435				var location = window.location;
13436				var url = location.href;
13437				var page_uri = location.origin + location.pathname;
13438				var is_filtered = page_uri !== url;
13439
13440				if (is_filtered) {
13441					url = remove_parameter_from_url(url, 'min_price');
13442					url = remove_parameter_from_url(url, 'max_price');
13443				}
13444
13445				var concat = page_uri === url ? '?' : '&';
13446				var params = {'min_price': min_price, 'max_price': max_price};
13447
13448				url = url + concat + $.param(params);
13449
13450				reload_items(container, url, true);
13451			}
13452		});
13453
13454		var search_timer;
13455
13456		$(document).on('keyup', '.term-filters-search-input', function(e) {
13457			var _this = $(this);
13458			var container = get_filters_container();
13459			var value = _this.val();
13460
13461			if (search_timer) {
13462				clearTimeout(search_timer);
13463			}
13464
13465			search_timer = setTimeout(function() {
13466				update_search_url(container, value);
13467			}, 500);
13468		});
13469	}
13470
13471	function update_search_url(container, search_value) {
13472		var location = window.location;
13473		var url = location.href;
13474		var page_uri = location.origin + location.pathname;
13475		var is_filtered = page_uri !== url;
13476		var key_search = SiteParameters.ajax_filter_key_search;
13477		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
13478
13479		if (is_filtered) {
13480			url = remove_parameter_from_url(url, key_search);
13481			url = remove_parameter_from_url(url, key_unfilter);
13482		}
13483
13484		if (search_value) {
13485			var concat = page_uri === url ? '?' : '&';
13486			var params = {};
13487
13488			params[key_search] = search_value;
13489			params[key_unfilter] = 1;
13490			url = url + concat + $.param(params);
13491		} else {
13492			url = remove_parameter_from_url(url, key_search);
13493		}
13494
13495		reload_items(container, url, true);
13496	}
13497
13498	function remove_parameter_from_url(url, parameter) {
13499		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
13500	}
13501
13502	function get_filters_container() {
13503		var container = $('.ajax-grid-system');
13504
13505		if (container.length == 0) {
13506			container = $('.ajax-filters');
13507		}
13508
13509		return container;
13510	}
13511
13512	function update_widgets_state(widgets_states, container) {
13513		for (var i = widgets_states.length - 1; i >= 0; i--) {
13514			var state = widgets_states[i];
13515
13516			if (!state.collapse) {
13517				continue;
13518			}
13519
13520			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
13521
13522			if (state.open) {
13523				new_widget.find('.widget-title').addClass('open');
13524				if (state.css) {
13525					new_widget.find('.widget-collapse-content').attr('style', state.css);
13526				}
13527			} else {
13528				new_widget.find('.widget-title').removeClass('open');
13529				if (state.css) {
13530					new_widget.find('.widget-collapse-content').attr('style', state.css);
13531				}
13532			}
13533		}
13534	}
13535
13536	// Reload items via AJAX
13537	function reload_items(container, url, push) {
13538		if (isAjaxing) {
13539			return
13540		};
13541
13542		isAjaxing = true;
13543
13544		container.addClass('grid-filtering');
13545
13546		$.ajax({
13547			url     : url,
13548			success : function(response) {
13549				if (!response) {
13550					return;
13551				}
13552
13553				$(document).trigger('uncode-ajax-pre-filtered');
13554
13555				var container_id = container.attr('id');
13556				var pagination = $('.row-navigation');
13557
13558				if (container_id) {
13559					var container_to_append = $(response).find('#' + container_id);
13560					var pagination_to_append = $(response).find('.row-navigation');
13561					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
13562
13563					// Remember open/closed widgets
13564					var widgets = $('.uncode_widget');
13565					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
13566					var widgets_states = [];
13567
13568					widgets.each(function() {
13569						var widget = $(this);
13570						var id = widget.attr('data-id');
13571						var state = {
13572							'id': id,
13573							'collapse': false,
13574							'open': false,
13575							'css': false,
13576						};
13577
13578						var collapse_wrapper = widget.find('.widget-collapse-content');
13579
13580						if (collapse_wrapper.length > 0) {
13581							state.collapse = true;
13582
13583							var collapse_wrapper_css = collapse_wrapper.attr('style');
13584							var title = widget.find('.widget-title');
13585
13586							state.css = collapse_wrapper_css;
13587
13588							if (title.hasClass('open')) {
13589								state.open = true;
13590							} else {
13591								state.open = false;
13592							}
13593						}
13594
13595						widgets_states.push(state);
13596					});
13597
13598					// Update widgets state
13599					if (offcanvas_sidebar_wrapper.length === 0) {
13600						update_widgets_state(widgets_states, container_to_append);
13601					}
13602
13603					// Update default sidebar state
13604					if (!container.hasClass('ajax-hide-filters')) {
13605						container_to_append.removeClass('ajax-hide-filters');
13606					}
13607
13608					// Update horizontal sidebar
13609					if (!container.hasClass('ajax-hide-filters-blanks')) {
13610						container_to_append.removeClass('ajax-hide-filters-blanks');
13611					}
13612					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
13613					if (horizontal_sidebar_wrapper.length > 0) {
13614						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
13615						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
13616						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
13617						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
13618
13619						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
13620						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
13621					}
13622
13623					// Append container
13624					container.replaceWith(container_to_append);
13625
13626					// Hide first thumbnail until the new srcset is loaded
13627					if (SiteParameters.dynamic_srcset_active === '1') {
13628						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
13629					}
13630
13631					// Remove loading attribute to images
13632					container_to_append.find('img').attr('loading', '');
13633
13634					// Append pagination
13635					if (pagination.length > 0) {
13636						if (pagination_to_append.length > 0) {
13637							pagination.html(pagination_to_append.html());
13638						} else {
13639							pagination.html('');
13640						}
13641					} else {
13642						if (pagination_to_append.length > 0) {
13643							$('.post-wrapper').append(pagination_to_append);
13644						}
13645					}
13646
13647					// Update off canvas sidebar (mobile and overlay)
13648					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
13649
13650					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
13651						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
13652						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
13653						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
13654						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
13655
13656						// Update widgets state
13657						update_widgets_state(widgets_states, sidebar_to_append);
13658
13659						// Update sidebar
13660						sidebar_container.html(sidebar_to_append.html());
13661					}
13662
13663					if (push) {
13664						UNCODE.lastURL = url;
13665						window.history.pushState(
13666							{ pageTitle: document.title },
13667							'',
13668							url
13669						);
13670					}
13671
13672					if (typeof UNCODE.isotopeLayout !== 'undefined') {
13673						UNCODE.isotopeLayout();
13674					}
13675					if (typeof UNCODE.justifiedGallery !== 'undefined') {
13676						UNCODE.justifiedGallery();
13677					}
13678					if (typeof UNCODE.cssGrid !== 'undefined') {
13679						UNCODE.cssGrid();
13680					}
13681					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
13682						UNCODE.lightbox();
13683					}
13684					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
13685						UNCODE.lightgallery();
13686					}
13687					if (typeof UNCODE.carousel !== 'undefined') {
13688						UNCODE.carousel($('body'));
13689					}
13690					UNCODE.animations();
13691					if (typeof UNCODE.filters !== 'undefined') {
13692						UNCODE.filters();
13693					}
13694					if (typeof UNCODE.widgets !== 'undefined') {
13695						UNCODE.widgets();
13696					}
13697
13698					if (SiteParameters.dynamic_srcset_active === '1') {
13699						UNCODE.refresh_dynamic_srcset_size();
13700					}
13701
13702					if (typeof UNCODE.menuSmartInit !== 'undefined') {
13703						UNCODE.menuSmartInit();
13704					}
13705
13706					if (typeof UNCODE.parallax !== 'undefined') {
13707						UNCODE.parallax();
13708					}
13709
13710					maybe_scroll_to_top();
13711
13712					var woo_select2_cats = $('.dropdown_product_cat');
13713
13714					if (woo_select2_cats.length > 0) {
13715						woo_select2_cats.on( 'change', function() {
13716							if ( $(this).val() != '' ) {
13717								var this_page = '';
13718								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
13719								if ( home_url.indexOf( '?' ) > 0 ) {
13720									this_page = home_url + '&product_cat=' + $(this).val();
13721								} else {
13722									this_page = home_url + '?product_cat=' + $(this).val();
13723								}
13724								location.href = this_page;
13725							} else {
13726								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
13727							}
13728						});
13729
13730						if ( $().selectWoo ) {
13731							var wc_product_cat_select = function() {
13732								woo_select2_cats.selectWoo( {
13733									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
13734									minimumResultsForSearch: 5,
13735									width: '100%',
13736									allowClear: true,
13737									language: {
13738										noResults: function() {
13739											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
13740										}
13741									}
13742								} );
13743							};
13744							wc_product_cat_select();
13745						}
13746					}
13747
13748					$(document).trigger('uncode-ajax-filtered');
13749					$(document.body).trigger('init_price_filter');
13750					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
13751					window.document.dispatchEvent(new Event("DOMContentLoaded", {
13752						bubbles: true,
13753						cancelable: true
13754					}));
13755
13756					isAjaxing = false;
13757				}
13758			},
13759			error: function() {
13760				container.removeClass('grid-filtering');
13761
13762				isAjaxing = false;
13763
13764				if (SiteParameters.enable_debug == true) {
13765					// This console log is disabled by default
13766					// So nothing is printed in a typical installation
13767					//
13768					// It can be enabled for debugging purposes setting
13769					// the 'uncode_enable_debug_on_js_scripts' filter to true
13770					console.log('There was an error retrieving the products');
13771				}
13772			}
13773		});
13774	}
13775
13776	// Scroll to top after filtering
13777	function maybe_scroll_to_top() {
13778		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
13779
13780		if (offcanvas_sidebar_wrapper.length > 0) {
13781			return;
13782		}
13783
13784		var container = get_filters_container();
13785		var bound = container[0].getBoundingClientRect();
13786
13787		if (bound.y < 0) {
13788			$(window).scrollTop(container.offset().top);
13789		}
13790	}
13791
13792	// Back/forward browser buttons
13793	$(window).on("popstate.ajaxfilters", function(e) {
13794		var location = window.location;
13795		var url = location.href;
13796		var params = UNCODE.getURLParams(window.location);
13797		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
13798
13799		UNCODE.lastURL = url;
13800
13801		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) {
13802			return;
13803		}
13804
13805		var container = get_filters_container();
13806
13807		reload_items(container, url, false);
13808	});
13809
13810	// Destroy load more before to init a new one
13811	$(window).on('uncode-ajax-pre-filtered', function() {
13812		if ($.fn.infinitescroll) {
13813			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
13814		}
13815	});
13816
13817	init_filters();
13818};
13819
13820UNCODE.videoThumbs = function() {
13821	var checkResize,
13822		newW = UNCODE.wwidth;
13823	var checkForVideos = function(){
13824
13825		$(window).on('okevents.y.change', function(e, y){
13826			var $video = $(y.target.g),
13827				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
13828				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
13829				restart = !$video_wrap.hasClass('play-pause'),
13830				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
13831				setTime;
13832			if ( newW >= UNCODE.mediaQuery ) {
13833
13834				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
13835					$video_wrap.data('hovered', true);
13836					$video_wrap.addClass('played-on');
13837					y.target.pauseVideo();
13838					$tmb.on('mouseenter', function(){
13839						if ( restart ) {
13840							y.target.seekTo(0);
13841						}
13842						y.target.playVideo();
13843					}).on('mouseleave', function(){
13844						clearTimeout(setTime);
13845						setTime = setTimeout(function(){
13846							y.target.pauseVideo();
13847						}, 300);
13848					});
13849				}
13850
13851			} else {
13852				if( $mobile_video_wrap.length ) {
13853					$video_wrap.addClass('played-on');
13854					y.target.playVideo();
13855				}
13856			}
13857
13858		});
13859
13860		$(window).on('okevents.v.loaded', function(e, playerV){
13861			var $video = $(playerV.element),
13862				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
13863				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
13864				restart = !$video_wrap.hasClass('play-pause'),
13865				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
13866				setTime;
13867
13868			if ( newW >= UNCODE.mediaQuery ) {
13869				
13870				if( $video_wrap.length ) {
13871
13872					var playPromise = playerV.play();
13873					if (playPromise !== undefined) {
13874						playPromise.then(function( value ) {
13875							playerV.pause();
13876						});
13877					}
13878					$video_wrap.addClass('played-on');
13879					$tmb.on('mouseenter', function(){
13880						if ( restart ) {
13881							playerV.setCurrentTime(0)
13882						}
13883						playerV.play();
13884					}).on('mouseleave', function(){
13885						clearTimeout(setTime);
13886						setTime = setTimeout(function(){
13887							playerV.pause();
13888						}, 300);
13889					});
13890				}
13891
13892			} else {
13893
13894				if( $mobile_video_wrap.length ) {
13895					var playPromise = playerV.play();
13896					if (playPromise !== undefined) {
13897						playPromise.then(function( value ) {
13898							playerV.play();
13899						});
13900					}
13901					$video_wrap.addClass('played-on');
13902				}
13903			}
13904		});
13905
13906		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
13907			var $video = $(video),
13908				$noscript = $('noscript', $video),
13909				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
13910				restart = !$video_wrap.hasClass('play-pause'),
13911				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
13912				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
13912: $video.closest('.t-entry-visual, .un-inline-image'),
13913				setTime,
13914			manageVideo = function(){
13915				video.currentTime = 0;
13916				video.pause();
13917				if ( newW >= UNCODE.mediaQuery ) {
13918					if ( $video_wrap.length ) {
13919						$video_wrap.addClass('played-on');
13920						$tmb.on('mouseenter', function(){
13921							if ( restart ) {
13922								video.currentTime = 0;
13923							}
13924							video.play();
13925						}).on('mouseleave', function(){
13926							clearTimeout(setTime);
13927							setTime = setTimeout(function(){
13928								video.pause();
13929							}, 300);
13930						});
13931					} else {
13932						video.play();
13933					}
13934				} else {
13935					if ( $mobile_video_wrap.length ) {
13936						$mobile_video_wrap.addClass('played-on');
13937						video.play();
13938					}
13939				}
13940
13941			};
13942			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
13943				$noscript.each(function(key, val){
13944					$noscript.after(val.textContent || val.innerText || val.innerHTML);
13945					$noscript.remove();
13946				});
13947			}
13948
13949			if (typeof MediaElement === "function") {
13950				$video.has('source[src]').mediaelementplayer({
13951					pauseOtherPlayers: false,
13952				});
13953			}
13954			if (video.readyState > 0) {
13955				manageVideo();
13956			} else {
13957				$video.on("loadedmetadata", function(_event) {
13958					manageVideo();
13959				});
13960			};
13961		});
13962	
13963	};
13964	
13965	checkForVideos();
13966
13967	var checkVideoResize = function(){
13968		clearRequestTimeout(checkResize);
13969		checkResize = requestTimeout(function(){
13970			if ( newW !== UNCODE.wwidth ) {
13971				checkForVideos();
13972				newW = UNCODE.wwidth;
13973			}
13974		}, 1000);
13975	};
13976
13977	$(window).off('resize.videos', checkVideoResize)
13978	.on( 'resize.videos', checkVideoResize);
13979
13980	$(window).off('more-items-loaded.videos', checkForVideos)
13981	.on('more-items-loaded.videos', checkForVideos);
13982
13983	$(document).off('uncode-ajax-filtered.videos', checkForVideos)
13984	.on('uncode-ajax-filtered.videos', checkForVideos);
13985
13986};
13987UNCODE.inlineImgs = function() {
13988    var linkInlineImgs = function(){
13989        $('.un-inline-image').each(function(){
13990            var $img = $(this),
13991                href = $(this).attr('data-link-href'),
13992                dataImg = $img.data();
13993			if ( dataImg != '' && href != null && href !== '' ) {
13994                var class_stra_a = 'unline-image-link';
13995                if ( $(this).hasClass('un-inline-space-over') ) {
13996                    class_stra_a += ' un-inline-space-over';
13997                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
13998                    class_stra_a += ' un-inline-space-gutter';
13999                }
14000                var str_a = '<a class="' + class_stra_a + '" ';
14001                for (var key in dataImg) {
14002                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
14003                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
14004                    }
14005                }
14006                str_a += ' />';
14007                $img.wrap(str_a);
14008			}
14009        });
14010    };
14011    $(window).on('load', linkInlineImgs );
14012};
14013UNCODE.lottie = function() {
14014    if ( SiteParameters.is_frontend_editor ) {
14015        var $lottie_wraps = $('div.uncode-lottie-wrap');
14016        $lottie_wraps.each(function(){
14017            var $lottie_wrap = $(this),
14018                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
14019                $player_clone = $div_player.clone(),
14020                player_id = $div_player.attr('data-id'),
14021                $lottie_players = $('lottie-player', $lottie_wrap).remove();
14022            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
14023                if ( $('#'+player_id).length ) {
14024                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
14025                }
14026                $player_clone.attr('id', player_id);
14027                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
14028                $div_player.after($player_clone);
14029                $div_player.attr('data-init',true);
14030            }
14031        });
14032    }
14033    var $players = $('.uncode-lottie-wrap lottie-player');
14034    $players.each(function(){
14035        var player = this,
14036            this_id = $(player).attr('id'),
14037            _player = document.getElementById(this_id),
14038            trigger = $(player).attr('data-trigger'),
14039            pFrames = $(player).attr('data-frames').split(','),
14040            srcPlayer = $(player).attr('src');
14041
14042        _player.load(srcPlayer);
14043
14044        _player.addEventListener("ready", function() {
14045
14046            var $_shadow = _player.shadowRoot;
14047            $($_shadow).find('.error').remove();
14048
14049            var tFrames = _player.getLottie().totalFrames / 100,
14050                pFrame_from = Math.round(tFrames * pFrames[0]),
14051                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
14052                loop = $(player).attr('loop'),
14053                mode,
14054                actions;
14055
14056            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
14057                if ( trigger === 'scroll' ) {
14058                    mode = 'scroll';
14059                    actions = [
14060                        {
14061                            visibility:[0, 1.0],
14062                            type: "seek",
14063                            frames: [pFrame_from, pFrame_to],
14064                        }
14065                    ];
14066                } else if ( trigger === 'viewport') {
14067                    mode = 'scroll';
14068                    actions = [
14069                        {
14070                            visibility: [0.20, 1.0],
14071                            frames: [pFrame_from, pFrame_to],
14072                            type: loop ? "loop" : "play"
14073                        }
14074                    ];
14075                } else if ( trigger === 'hover') {
14076                    $(player).on('mouseenter', function(){
14077                        _player.play();
14078                    }).on('mouseleave', function(){
14079                        _player.pause();
14080                    });
14081                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
14082                        _player.seek(pFrame_from);
14083                        _player.addEventListener("frame", function(){
14084                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
14085                                _player.seek(pFrame_from);
14086                            }
14087                        });
14088                    }
14089                }
14090                LottieInteractivity.create({
14091                    player: '#' + this_id,
14092                    mode: mode,
14093                    actions: actions
14094                });
14095            } else {
14096                if ( pFrame_from > 0 && pFrame_from < 99 ) {
14097                    _player.seek(pFrame_from);
14098                    _player.addEventListener("frame", function(){
14099                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
14100                            _player.seek(pFrame_from);
14101                        }
14102                    });
14103                }
14104            }
14105        });
14106
14107        $(window).on('unlottie-destroy', function(){
14108            _player.destroy();
14109        });
14110    });
14111};
14112
14113UNCODE.animatedBgGradient = function( _el ) {
14114
14115    var ev;
14116
14117	if ( typeof _el === 'undefined' || _el === null ) {
14118        _el = document;
14119        ev = false;
14120	} else {
14121        _el = _el[0];
14122        ev = 'shortcode:update';
14123    }
14124
14125    var simplex = new SimplexNoise();
14126
14127    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
14128		this.block = blockOverlay;
14129		this.wrap = canvasWrap;
14130		this.config();
14131		this.checker();
14132		this.loopRAF();
14133        this.animLoader();
14134    };
14135
14136    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
14137
14138    AnimGradient.config = function() {
14139        this.canvas = document.createElement('canvas');
14140        this.wrap.appendChild(this.canvas);
14141        this.ctx = this.canvas.getContext('2d');
14142        this.count = 0;        
14143        this.isOrientationChanged = false;
14144        this.res = UNCODE.isMobile ? 90 : 110;
14145        this.resPercent = 100/this.res;
14146        this.resAround = this.resPercent/100;
14147        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;
14148
14149        this.canvas.classList.add('uncode-bg-animated-gradient');
14150        this.canvas.setAttribute('height', this.res);
14151        this.canvas.setAttribute('width', this.res);
14152        this.canvas.style = 'height: 100%; position: relative; width:100%;';
14153
14154        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
14155
14156        this.cx = this.canvas.width/2;
14157        this.cy = this.canvas.height/2;
14158        this.data = this.imgdata.data;
14159
14160        this.opts = {
14161            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,
14162            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,
14163            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
14164        };
14165
14166        this.lavaTime = 1;
14167        this.bg_colors = [];
14168
14169        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
14170            return;
14171        }
14172
14173        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
14174            this.singleColor = true;
14175        }
14176
14177        if( this.opts.col_1st ) {
14178
14179            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
14180
14181            this.bg_colors.push({
14182                r: rgbColor1.r,
14183                g: rgbColor1.g,
14184                b: rgbColor1.b
14185            });
14186        }
14187
14188        if( this.opts.col_2nd ) {
14189
14190            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
14191
14192            this.bg_colors.push({
14193                r: rgbColor2.r,
14194                g: rgbColor2.g,
14195                b: rgbColor2.b
14196            });
14197        }
14198
14199    };
14200
14201    AnimGradient.checker = function() {
14202        var scope = this;
14203        this.checkInViewPort();
14204      
14205        window.addEventListener('resize', function() {
14206            if(UNCODE.isMobile && !scope.isOrientationChanged) {
14207                return;
14208            }
14209            scope.ratioCalc();
14210        });
14211
14212        window.addEventListener("orientationchange", function() {
14213            scope.isOrientationChanged = true;
14214        });
14215
14216        this.ratioCalc();
14217    }; 
14218
14219    AnimGradient.ratioCalc = function() {
14220      
14221        var blockW = this.block.clientWidth,
14222            blockH = this.block.clientHeight;
14223
14224        var blockRatio = blockH/blockW;
14225
14226        if(blockRatio < 1) {
14227            this.ratioParam = {
14228                x: 1.4,
14229                y: blockRatio*1.4
14230            }
14231        } else {
14232            this.ratioParam = {
14233                x: blockRatio/3,
14234                y: 1
14235            }
14236        }
14237         
14238    };
14239
14240    AnimGradient.checkInViewPort = function() {
14241		if( 'IntersectionObserver' in window ) {
14242		    var scope = this,
14243                observer = new IntersectionObserver(function(entries) {
14244  
14245                entries.forEach(function(entry){
14246                    if ( entry.isIntersecting ) {
14247                        scope.isInViewport = true;
14248                    } else {
14249                        scope.isInViewport = false;
14250                    }
14251                });
14252  
14253		    }, { 
14254			root: document,
14255		  });
14256  
14257		  observer.observe(this.block);
14258		}
14259	};
14260	
14261    AnimGradient.hexToRGB = function(hexval) {
14262        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
14263        if (!hexecuted) {
14264            return false;
14265        }
14266        return {
14267            r: parseInt(hexecuted[1], 16),
14268            g: parseInt(hexecuted[2], 16),
14269            b: parseInt(hexecuted[3], 16)
14270        }
14271    };
14272
14273    AnimGradient.factor = function(val_1, val_2, lava) { 
14274        return val_1 * (1 - lava) + val_2 * lava;
14275    };
14276
14277    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
14278        if (this.singleColor) {
14279            return this.bg_colors[0][wave_l];
14280        }
14281        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 );
14282        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
14283    };
14284
14285    AnimGradient.lava = function(x, y, grade) {
14286        var radians = (Math.PI / 180) * grade,
14287        cos = Math.cos(radians),
14288        sin = Math.sin(radians),
14289        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
14290        return nx;
14291    };
14292    
14293    AnimGradient.loopRAF = function() {
14294
14295      var scope = this;
14296
14297        if( this.isInViewport ) {
14298            for (var x = 0; x < this.res; x++) {
14299                for (var y = 0; y < this.res; y++) {
14300                    
14301                    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
14302        
14303                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
14304                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
14305                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
14306                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
14307                  
14308                }
14309            }
14310   
14311            this.count++;
14312          
14313            this.ctx.putImageData(this.imgdata, 0, 0);
14314         
14315        }
14316
14317        requestAnimationFrame(function() {
14318            scope.loopRAF();
14319        });
14320    };
14321
14322    AnimGradient.animLoader = function() {
14323        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
14324    };
14325
14326    var anim_init = function() {
14327        var bgs = _el.querySelectorAll('.block-bg-overlay');
14328      
14329        bgs.forEach(function(blockOverlay) {
14330            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
14331            if( !blockOverlay || !canvasWrap ) {
14332                return;
14333            }
14334            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
14335        });
14336    }
14337
14338    $(window).on('load', function(){
14339        anim_init();
14340    });
14341
14342    if ( ev === 'shortcode:update' ) {
14343        anim_init();
14344    }
14345
14346};
14347UNCODE.multibg = function(){
14348	var $bgsWraps = $('.uncode-multi-bgs'),
14349		$body = $('body');
14350	$bgsWraps.each(function(){
14351		var $bgWrap = $(this),
14352			transition = $bgWrap.attr('data-transition'),
14353			transitionTime = $bgWrap.attr('data-transition-time'),
14354			dataPace = $bgWrap.attr('data-transition-pace'),
14355			dataThreshold = $bgWrap.attr('data-transition-threshold'),
14356			dataTime = $bgWrap.attr('data-carousel-time'),
14357			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
14358			random = $bgWrap.attr('data-multi-random'),
14359			_bgWrap = $bgWrap[0],
14360			$multiBgs = $('.multi-background', $bgWrap),
14361			imgFirst,
14362			bgAmount = $multiBgs.length,
14363			isInViewport = false,
14364			lastScrollTop = 0,
14365			counter = 0,
14366			totMove = 0,
14367			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
14368			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
14369			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
14370			offX, offY,
14371			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
14372			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
14373			requestCarousel,
14374			is_header = $bgWrap.closest('#page-header').length,
14375			startTime = new Date();
14376
14377		transition = typeof transition === 'undefined' ? '' : transition;
14378
14379		if ( random === 'true' ) {
14380			UNCODE.shuffle($multiBgs);
14381		}
14382
14383		imgFirst = $multiBgs.first().find('.background-inner').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
14384
14385		var loadFirst = function(){
14386			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
14387				opacity: 1
14388			}, 250, 'easeInQuad').css({
14389				zIndex: 1
14390			});	
14391		}
14392
14393		var loadError = function(){
14394			console.log('Multi BG loading error');
14395		}
14396
14397		UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
14398
14399		var loadSlides = function( $thisBg ){
14400			$thisBg.attr('data-load', 'loaded');	
14401		}
14402
14403		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
14404			var $thisBg = $(val);
14405
14406			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
14407
14408				var _imgBg = $(val).find('.background-inner').css('background-image');
14409
14410				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
14411					$thisBg.attr('data-load', 'loaded');
14412				} else {
14413					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
14414					if ( typeof _imgBg !== 'undefined' ) {
14415						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
14416					}
14417				}
14418			}
14419		});
14420					
14421		var multiCarousel = function(e) {
14422
14423			clearRequestTimeout(requestCarousel);
14424
14425			var checkTime = new Date();
14426			if ( checkTime - startTime >= carouselTime && isInViewport ) {
14427				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
14428
14429				if ( $checkEl.attr('data-load') !== 'loaded' ) {
14430					requestTimeout(function(){
14431						multiCarousel();
14432					}, 100);
14433					return;
14434				}
14435
14436				counter++;
14437
14438				$multiBgs.each(function(ind, val){
14439					if ( ind === counter%bgAmount ) {
14440						$(val).stop(true,false).animate({
14441							opacity: 1
14442						}, wait, 'easeInQuad').css({
14443							zIndex: 1
14444						});
14445					} else {
14446						$(val).stop(true,false).animate({
14447							opacity: 0
14448						}, wait, 'easeInQuad').css({
14449							zIndex: 0
14450						});
14451					}
14452				});
14453
14454			}
14455
14456			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
14457				requestCarousel = requestTimeout(multiCarousel, carouselTime);
14458			}
14459	
14460		};
14461
14462		var multiMove = function(e) {
14463			if ( $body.hasClass('navbar-hover') ) {
14464				return;
14465			}
14466			var checkTime = new Date(),
14467                bound = $bgWrap[0].getBoundingClientRect(),
14468                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
14469			if (offX) {
14470				totMove += Math.sqrt(
14471					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
14472				);
14473			}
14474			if (
14475                totMove >= pace && 
14476                checkTime - startTime >= wait &&
14477                e.clientX <= (bound.left + bound.width) &&
14478                e.clientX >= bound.left &&
14479                e.clientY <= (bound.top + bound.height) &&
14480                e.clientY >= bound.top
14481            ) {
14482				counter++;
14483				startTime = checkTime;
14484				$multiBgs.each(function(ind, val){
14485					if ( ind === counter%bgAmount ) {
14486						$(val).stop(true,false).animate({
14487							opacity: 1
14488						}, wait, 'easeInQuad').css({
14489							zIndex: 1
14490						});
14491					} else {
14492						$(val).stop(true,false).animate({
14493							opacity: 0
14494						}, wait, 'easeInQuad').css({
14495							zIndex: 0
14496						});
14497					}
14498				});
14499
14500				totMove = 0;
14501			}
14502			
14503			offX = e.clientX;
14504			offY = e.clientY;
14505			
14506		};
14507
14508		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
14509			document.addEventListener("mousemove", multiMove);
14510		}
14511
14512		window.addEventListener('resize', function() {
14513			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
14514				document.removeEventListener("mousemove", multiMove);
14515				document.addEventListener("mousemove", multiMove);
14516			}
14517		});
14518
14519		var lightLoopRAF = function() {
14520
14521			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
14522				checkTime = new Date(),
14523				bound = $bgWrap[0].getBoundingClientRect(),
14524				thresholdHeader = is_header ? 100 : threshold,
14525				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
14526			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
14527				counter++;
14528				lastScrollTop = scrollTop;
14529				startTime = checkTime;
14530
14531				$multiBgs.each(function(ind, val){
14532					if ( ind === counter%bgAmount ) {
14533						$(val).stop(true,false).animate({
14534							opacity: 1
14535						}, wait, 'easeInQuad').css({
14536							zIndex: 1
14537						});
14538					} else {
14539						$(val).stop(true,false).animate({
14540							opacity: 0
14541						}, wait, 'easeInQuad').css({
14542							zIndex: 0
14543						});
14544					}
14545				});
14546
14547			}
14548
14549			requestAnimationFrame(function() {
14550				if ( isInViewport ) {
14551					lightLoopRAF();
14552				}
14553			});
14554		};
14555
14556		var currentInd = 0;
14557
14558		var loopRAF = function() {
14559
14560			var multiBgRotate = function(slideInd){
14561				currentInd = slideInd;
14562				$multiBgs.each(function(ind, val){
14563					if ( ind === slideInd ) {
14564						$(val).stop(true,false).animate({
14565							opacity: 1
14566						}, wait, 'easeInQuad').css({
14567							zIndex: 1
14568						});
14569					} else {
14570						$(val).stop(true,false).animate({
14571							opacity: 0
14572						}, wait, 'easeInQuad').css({
14573							zIndex: 0
14574						});
14575					}
14576				});
14577			};
14578			var bound = $bgWrap[0].getBoundingClientRect(),
14579				thresholdPX = UNCODE.wheight * threshold / 100,
14580				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
14581				movePX = totMove / bgAmount,
14582				moving = UNCODE.wheight - (bound.top + thresholdPX),
14583				slideInd = 0;
14584
14585			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
14586				multiBgRotate(0);
14587			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
14588				multiBgRotate(bgAmount-1);
14589			} else {
14590				slideInd = Math.ceil(moving/movePX) - 1;
14591				if ( slideInd < 0 ) {
14592					slideInd = 0;
14593				} else if ( slideInd >= bgAmount ) {
14594					slideInd = bgAmount-1;
14595				}
14596				if ( slideInd !== currentInd ) {
14597					multiBgRotate(slideInd);
14598				}
14599			}
14600
14601			requestAnimationFrame(function() {
14602				if ( isInViewport ) {
14603					loopRAF();
14604				}
14605			});
14606		};
14607
14608		if( 'IntersectionObserver' in window ) {
14609		    var observer = new IntersectionObserver(function(entries) {
14610  
14611                entries.forEach(function(entry){
14612                    if ( entry.isIntersecting ) {
14613                        isInViewport = true;
14614						if ( transition === 'scroll' ) {
14615							if ( autoScroll ) {
14616								loopRAF();
14617							} else {
14618								lightLoopRAF();
14619							}
14620						} else {
14621							multiCarousel();
14622						}
14623                    } else {
14624                        isInViewport = false;
14625                   }
14626                });
14627  
14628		    }, { 
14629				root: document,
14630				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
14631		  	});
14632
14633			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
14634		  		observer.observe(_bgWrap);
14635			}
14636
14637			window.addEventListener('resize', function() {
14638				observer.unobserve(_bgWrap);
14639				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
14640					observer.observe(_bgWrap);
14641				}
14642			});
14643	
14644		}
14645
14646	});
14647}
14648
14649UNCODE.owlNav = function(target, ev) {
14650    target = target.replace(/#\S+/g, '');
14651    var $carousel = $('#'+target),
14652        $slider = $carousel.closest('.uncode-slider'),
14653        $checkNavs = $('.uncode-owl-nav');
14654    if ( !$checkNavs.length ) {
14655        return;
14656    }
14657
14658    if ( $slider.length ){
14659        target = $slider.attr('id');
14660    }
14661
14662    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
14663        $row;
14664
14665    if ( ! $navs.length ) {
14666        $row = $carousel.closest('.vc_row.row-container');
14667        $navs = $('.uncode-owl-nav:not([data-target])', $row);
14668    }
14669        
14670    if ( ! $navs.length ) {
14671        return;
14672    }
14673
14674    $navs.each(function(){
14675        var $nav = $(this),
14676            $outer = $nav.closest('.uncode-owl-nav-out'),
14677            $inner = $nav.find('.uncode-owl-nav-in'),
14678            $navDots = $('.uncode-nav-dots', $nav),
14679            $navCounter = $('.uncode-nav-counter', $nav),
14680            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
14681            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
14682            skinInherit = $nav.hasClass('skin-inherit'),
14683            digit = parseFloat($nav.attr('data-digit')),
14684            counterDigit = parseFloat($nav.attr('data-counter-digit')),
14685            navSpeed = parseFloat($carousel.attr('data-navspeed'));
14686        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
14687
14688        if ( $nav.hasClass('pos-abs') ){
14689            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
14690                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
14691            }
14692            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
14693        } 
14694
14695        $carousel.on('refreshed.owl.carousel', counter);
14696        $carousel.on('resized.owl.carousel', counter);
14697        $carousel.on('changed.owl.carousel', counter);
14698
14699        var totalSlides = 0;
14700
14701        function counter(event) {
14702            if (!event.namespace) {
14703                return;
14704            }
14705            var slides = event.relatedTarget,
14706                current = slides._current,
14707                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
14708                item = event.item,
14709                page = event.page,
14710                countPages = Math.ceil(item.count / page.size),
14711                $currentSlide = $carousel.find('.owl-item').eq(current),
14712                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
14713                activeSlide = Math.ceil(itemIndex / page.size),
14714                $prev = $nav.find('.uncode-nav-prev'),
14715                $next = $nav.find('.uncode-nav-next'),
14716                $col = $currentSlide.find('.uncol').first();
14717
14718            if ( totalSlides != countPages ) {
14719                totalSlides = countPages;
14720                $navDots.html('');
14721                var nav_html = '';
14722                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
14723                    var padN = sl_ind+1;
14724                    if ( digit && digit > 1 ) {
14725                        padN = String(padN).padStart(digit, '0');
14726                    }
14727                    nav_html += '<span class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '"><span>' + padN + '</span></span>';
14728                }
14729                $navDots.html(nav_html);
14730
14731                var totalSlidesDigit = totalSlides;
14732
14733                if ( counterDigit && counterDigit > 1 ) {
14734                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
14735                }
14736                $counterTotal.html(totalSlidesDigit);
14737            }
14738
14739            if ( loop !== true ) {
14740                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
14741                if ( itemIndex === 1 ) {
14742                    $prev.addClass('uncode-nav-disabled');
14743                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
14744                    $next.addClass('uncode-nav-disabled');
14745                    activeSlide = Math.ceil(item.count / page.size);
14746                }
14747            }
14748
14749            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
14750            var activeSlideDigit = activeSlide;
14751
14752            if ( counterDigit && counterDigit > 1 ) {
14753                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
14754            }
14755            $counterIndex.html(activeSlideDigit);
14756
14757            if ( skinInherit ) {
14758                if ( $col.hasClass('style-light') ){
14759                    $nav.removeClass('style-dark').addClass('style-light');
14760                } else if ( $col.hasClass('style-dark') ) {
14761                    $nav.removeClass('style-light').addClass('style-dark');
14762                }
14763            }
14764
14765            $inner.removeClass('uncode-owl-nav-waiting');
14766
14767            if ( $nav.hasClass('outer-width') ) {
14768                var navW = $nav.outerWidth(),
14769                    nexW = $next.outerWidth(),
14770                    prevW = $prev.outerWidth(),
14771                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
14772
14773                if ( $nav.hasClass('h-align-justify') ) {
14774                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
14775                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
14776                        $inner.css({'margin': 'auto'});
14777                    } else {
14778                        $inner.css({'margin': ''});
14779                    }
14780                } else {
14781                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
14782                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
14783                        $inner.css({'margin': 'auto'});
14784                    } else {
14785                        $inner.css({'margin': ''});
14786                    }
14787                }
14788            }
14789        }
14790
14791        $nav.on('click', '.uncode-nav-index', function(){
14792            var $bullet = $(this),
14793                slide_index = parseFloat( $bullet.attr('data-key') );
14794            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
14795        });
14796        $nav.on('click', '.uncode-nav-prev', function(){
14797            $carousel.trigger('prev.owl.carousel', [navSpeed]);
14798        });
14799        $nav.on('click', '.uncode-nav-next', function(){
14800            $carousel.trigger('next.owl.carousel', [navSpeed]);
14801        });
14802
14803        if ( $nav.hasClass('animated-arrows') ) {
14804            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
14805                $(this).addClass("hover"); 
14806            }).on('animationend', function(){
14807                $(this).removeClass("hover");  
14808            });
14809        }
14810
14811        var positionNav = function(){
14812            if ( $nav.hasClass('window-width') ) {
14813                var navOff = parseFloat( $nav.offset().left ) * -1;
14814                if ( navOff > 0 ) {
14815                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
14816                } else {
14817                    $inner.css({ transform: 'none' });
14818                }
14819            }
14820        }
14821        positionNav();
14822        $(window).on('resize', positionNav);
14823    });
14824
14825    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
14826};
14827
14828	UNCODE.init = function() {
14829		var wfl_check = false, wfl_request, waypoint_request;
14830		UNCODE.preventDoubleTransition();
14831		UNCODE.betterResize();
14832		UNCODE.utils();
14833		UNCODE.magnetic();
14834		if (typeof UNCODE.accessibility !== 'undefined') {
14835			UNCODE.accessibility();
14836		}
14837		if (typeof UNCODE.rowParallax !== 'undefined') {
14838			UNCODE.rowParallax();
14839		}
14840		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
14841			UNCODE.changeSkinOnScroll();
14842		}
14843		if (typeof UNCODE.share !== 'undefined') {
14844			UNCODE.share();
14845		}
14846		if (typeof UNCODE.tooltip !== 'undefined') {
14847			UNCODE.tooltip();
14848		}
14849		if (typeof UNCODE.counters !== 'undefined') {
14850			UNCODE.counters();
14851		}
14852		if (typeof UNCODE.countdowns !== 'undefined') {
14853			UNCODE.countdowns();
14854		}
14855		if (typeof UNCODE.tabs !== 'undefined') {
14856			UNCODE.tabs();
14857		}
14858		if (typeof UNCODE.collapse !== 'undefined') {
14859			UNCODE.collapse();
14860		}
14861		if (typeof UNCODE.bigText !== 'undefined') {
14862			UNCODE.bigText();
14863		}
14864		UNCODE.menuSystem();
14865		if (typeof UNCODE.bgChanger !== 'undefined') {
14866			UNCODE.bgChanger();
14867		}
14868		if (typeof UNCODE.magicCursor !== 'undefined') {
14869			UNCODE.magicCursor();
14870		}
14871		if (typeof UNCODE.magneticCursor !== 'undefined') {
14872			UNCODE.magneticCursor();
14873		}
14874		if (typeof UNCODE.dropImage !== 'undefined') {
14875			UNCODE.dropImage();
14876		}
14877		if (typeof UNCODE.postTable !== 'undefined') {
14878			UNCODE.postTable();
14879		}
14880		if (typeof UNCODE.rotatingTxt !== 'undefined') {
14881			UNCODE.rotatingTxt();
14882		}
14883		if (typeof UNCODE.okvideo !== 'undefined') {
14884			UNCODE.okvideo();
14885			window.addEventListener( "uncode-more-items-loaded", function() {
14886				UNCODE.okvideo("uncode-more-items-loaded");
14887			});
14888		}
14889		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
14890			UNCODE.backgroundSelfVideos();
14891		}
14892		UNCODE.tapHover();
14893		if (typeof UNCODE.isotopeLayout !== 'undefined') {
14894			UNCODE.isotopeLayout();
14895		}
14896		if (typeof UNCODE.justifiedGallery !== 'undefined') {
14897			UNCODE.justifiedGallery();
14898		}
14899		if (typeof UNCODE.cssGrid !== 'undefined') {
14900			UNCODE.cssGrid();
14901		}
14902		if (typeof UNCODE.linearGrid !== 'undefined') {
14903			UNCODE.linearGrid();
14904		}
14905		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
14906			UNCODE.lightbox();
14907		}
14908		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
14909			$(window).on('load more-items-loaded',function(){
14910				UNCODE.lightgallery();
14911			});
14912		}
14913		if (typeof UNCODE.carousel !== 'undefined') {
14914			UNCODE.carousel($('body'));
14915		}
14916		if (typeof UNCODE.lettering !== 'undefined') {
14917			UNCODE.lettering();
14918		}
14919		UNCODE.animations();
14920		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
14921			UNCODE.stickyElements();
14922		}
14923		if (typeof UNCODE.twentytwenty !== 'undefined') {
14924			UNCODE.twentytwenty();
14925		}
14926		UNCODE.disableHoverScroll();
14927		UNCODE.printScreen();
14928		if (typeof UNCODE.particles !== 'undefined') {
14929			UNCODE.particles();
14930		}
14931		if (typeof UNCODE.filters !== 'undefined') {
14932			UNCODE.filters();
14933		}
14934		if (typeof UNCODE.ajax_filters !== 'undefined') {
14935			UNCODE.ajax_filters();
14936		}
14937		if (typeof UNCODE.widgets !== 'undefined') {
14938			UNCODE.widgets();
14939		}
14940		if (typeof UNCODE.unmodal !== 'undefined') {
14941			UNCODE.unmodal();
14942		}
14943		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
14944			if ( !UNCODE.isFullPage ) {
14945				UNCODE.checkScrollForTabs();
14946			}
14947		}
14948		if (typeof UNCODE.onePage !== 'undefined') {
14949			UNCODE.onePage(UNCODE.isMobile);
14950		}
14951		if (typeof UNCODE.fullPage !== 'undefined') {
14952			$(document).ready(function(){
14953				UNCODE.fullPage();
14954			});
14955		}
14956		if (typeof UNCODE.skewIt !== 'undefined') {
14957			UNCODE.skewIt();
14958		}
14959		if (typeof UNCODE.rotateIt !== 'undefined') {
14960			UNCODE.rotateIt();
14961		}
14962		if (typeof UNCODE.textMarquee !== 'undefined') {
14963			UNCODE.textMarquee();
14964		}
14965		if (typeof UNCODE.stickyScroll !== 'undefined') {
14966			UNCODE.stickyScroll();
14967		}
14968		if (typeof UNCODE.stickyTrigger !== 'undefined') {
14969			UNCODE.stickyTrigger();
14970		}
14971		if (typeof UNCODE.areaTextReveal !== 'undefined') {
14972			UNCODE.areaTextReveal();
14973		}
14974		if (typeof UNCODE.thumbsReveal !== 'undefined') {
14975			UNCODE.thumbsReveal();
14976		}
14977		if (typeof UNCODE.verticalText !== 'undefined') {
14978			UNCODE.verticalText();
14979		}
14980		if (typeof UNCODE.videoThumbs !== 'undefined') {
14981			UNCODE.videoThumbs();
14982		}
14983		if (typeof UNCODE.revslider !== 'undefined') {
14984			UNCODE.revslider();
14985		}
14986		if (typeof UNCODE.layerslider !== 'undefined') {
14987			UNCODE.layerslider();
14988		}
14989		if (typeof UNCODE.lottie !== 'undefined') {
14990			UNCODE.lottie();
14991		}
14992		if (typeof UNCODE.inlineImgs !== 'undefined') {
14993			UNCODE.inlineImgs();
14994		}
14995		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
14996			UNCODE.animatedBgGradient();
14997		}
14998		if (typeof UNCODE.readMoreCol !== 'undefined') {
14999			UNCODE.readMoreCol();
15000		}
15001		if (typeof UNCODE.multibg !== 'undefined') {
15002			UNCODE.multibg();
15003		}
15004		if (typeof UNCODE.flexEqual !== 'undefined') {
15005			UNCODE.flexEqual();
15006		}
15007		$(window).on('load',function(){
15008			clearRequestTimeout(waypoint_request);
15009			waypoint_request = requestTimeout( function(){
15010				Waypoint.refreshAll();
15011			}, 1000);
15012		});
15013		$(window).one('load',function(){
15014			if (typeof UNCODE.parallax !== 'undefined') {
15015				UNCODE.parallax();
15016			}
15017		});
15018	}
15019
15020	if ( ! SiteParameters.is_frontend_editor ) {
15021		UNCODE.init();
15022	}
15023
15024
15025})(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.