PageSourceSearch

https://www.recollectcms.com/wp-content/themes/uncode/library/js/app.js?ver=301734251

js recollectcms.com collected 2026-10-02 04:12:11 UTC 418,176 bytes, 13,078 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
55UNCODE.checkImgLoad = function( src, cb, err, el ) {
56	var img = new Image();
57	img.onload = function () {
58		var result = (img.width > 0) && (img.height > 0);
59		cb(el);
60	};
61	img.onerror = function () {
62		err();
63	};
64	img.src = src
65};
66
67UNCODE.betterResize = function() {
68	var setResize,
69		doubleResize = true,
70		oldW = UNCODE.wwidth;
71	$(window).on( 'resize orientationchange', function(){
72		if ( oldW === UNCODE.wwidth ) {
73			return;
74		} else {
75			oldW = UNCODE.wwidth;
76			$(window).trigger('wwResize');
77		}
78	});
79};
80
81UNCODE.shuffle = function(array) {
82	var currentIndex = array.length,
83		randomIndex;
84  
85	while (currentIndex > 0) {
86		randomIndex = Math.floor(Math.random() * currentIndex);
87		currentIndex--;
88		[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
89	}
90  
91	return array;
92};
93
94Number.isInteger = Number.isInteger || function(value) {
95    return typeof value === "number" &&
96           isFinite(value) &&
97           Math.floor(value) === value;
98};
99
100UNCODE.utils = function() {
101	$(document).on('mouseover', 'a', function () {
102		if (!$(this).hasClass('star')) {
103			$(this).attr('data-title', $(this).attr('title'));
104			$(this).removeAttr('title');
105		}
106	});
107	$(document).on('mouseout', 'a', function () {
108		if (!$(this).hasClass('star')) {
109			$(this).attr('title', $(this).attr('data-title'));
110			$(this).removeAttr('data-title');
111		}
112	});
113
114	this.get_scroll_offset = function(e) {
115
116		var scroll_offset = 0,
117			target,
118			trigger;
119
120		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
121			target = e.target;
122			trigger = e.currentTarget;
123		}
124
125		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
126			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
127				UNCODE.hideMenu(100);
128			}
129		}
130
131		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery  ) {
132			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
133			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
134				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) {
135					if ( !$('.menu-hided').length ) {
136						if ( $('body').hasClass('hmenu-center') ) {
137							scroll_offset += $('.menu-sticky .menu-container').outerHeight();
138						} else {
139							scroll_offset += $('.logo-container:visible').outerHeight();
140						}
141					}
142				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
143					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
144					scroll_offset += $('.menu-sticky .menu-container').outerHeight() - ( $('.navbar-brand').data('minheight') + shrink );
145				} else {
146					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
147						scroll_offset += UNCODE.menuMobileHeight;
148					} else {
149						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 ) {
150							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
151						} else {
152							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
153								scroll_offset += UNCODE.menuMobileHeight;
154							}
155						}
156					}
157				}
158			}
159
160		}
161
162		scroll_offset += UNCODE.bodyBorder;
163
164		return scroll_offset;
165	}
166
167	if ( !UNCODE.isFullPage ) {
168		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
169
170			var hash = (e.currentTarget).hash,
171			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
172			anchor = '';
173			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
174			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
175				e.preventDefault();
176				if (!$('#tab-reviews').is(':visible')) {
177					$('a[href="#tab-reviews"]').trigger('click');
178				}
179				var calc_scroll = $('.wootabs .tab-content').offset().top;
180				calc_scroll -= UNCODE.get_scroll_offset(e);
181
182				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
183					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
184
185					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
186						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
187					}
188				}
189
190				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
191					delta = bodyTop - calc_scroll,
192					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
193				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
194
195				requestTimeout(function(){
196					if (scrollSpeed == 0) {
197						$('html, body').scrollTop(calc_scroll);
198						UNCODE.scrolling = false;
199					} else {
200   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
201							$(this).stop();
202						}).animate({
203								scrollTop: calc_scroll
204							}, scrollSpeed, 'easeInOutCubic', function() {
205								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
206								UNCODE.scrolling = false;
207							}
208						);
209					}
210				}, 200);
211				return;
212			}
213			if (hash != undefined) {
214				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
215				var anchor = this.hash.slice(1);
216				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
217			  		if ( !specialFormat.test(hash) ) {
218			  			if ( $(hash).length )
219			  				anchor = $(hash);
220			  		}
221				}
222			}
223
224			if (is_scrolltop || anchor != '') {
225				if (is_scrolltop) {
226					e.preventDefault();
227					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
228					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
229					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
230
231					if (scrollSpeed == 0) {
232						$('html, body').scrollTop(0);
233						UNCODE.scrolling = false;
234					} else {
235   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
236							$(this).stop();
237						}).animate({
238							scrollTop: 0
239						}, scrollSpeed, 'easeInOutCubic', function() {
240							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
241							UNCODE.scrolling = false;
242						});
243					}
244				} else {
245					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
246					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
247						var get_href = $(val).attr('href');
248						if (get_href != undefined) {
249							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
250							else $(val).parent().removeClass('active');
251						}
252					});
253					if (scrollSection.length) {
254						if ( $('body').hasClass('uncode-scroll-no-history') ) {
255							e.preventDefault();
256						}
257
258						if (UNCODE.menuOpened) {
259							if (UNCODE.wwidth < UNCODE.mediaQuery) {
260								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
261							} else {
262								$('.mmb-container-overlay .overlay-close').trigger('click');
263								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
264							}
265						}
266
267						var calc_scroll = scrollSection.offset().top,
268							getOffset = UNCODE.get_scroll_offset(e),
269							$logo = $('.logo-container:visible'),
270							logoH,
271							$menu = $('#masthead .menu-container'),
272							menuH;
273
274						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
275
276						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
277							delta = bodyTop - calc_scroll,
278							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
279						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
280
281						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
282							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
283								logoH = $logo.outerHeight(),
284								menuH = $menu.outerHeight();
285								if ( calc_scroll < ( logoH + menuH ) ) {
286									calc_scroll = 0;
287								}
288							}
289						}
290
291						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
292							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
293						}
294
295						if (scrollSpeed == 0) {
296							$('html, body').scrollTop(calc_scroll);
297							UNCODE.scrolling = false;
298						} else {
299	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
300								$(this).stop();
301							}).animate({
302								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
303							}, scrollSpeed, 'easeInOutCubic', function() {
304								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
305								UNCODE.scrolling = false;
306								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
307								||
308								$('.menu-hided').length ) {
309									calc_scroll = scrollSection.offset().top;
310									getOffset = UNCODE.get_scroll_offset(e);
311									calc_scroll -= getOffset;
312									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
313										$(this).stop();
314									}).animate({
315										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
316										}, scrollSpeed, 'easeInOutCubic', function() {
317											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
318											UNCODE.scrolling = false;
319										}
320									);
321								}
322							});
323						}
324					}
325				}
326			}
327		});
328		$('.header-scrolldown').on('click', function(event) {
329
330			event.preventDefault();
331
332			var pageHeader = $(event.target).closest('#page-header'),
333				pageHeaderTop = pageHeader.offset().top,
334				pageHeaderHeight = pageHeader.outerHeight(),
335				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
336			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
337
338			var calc_scroll = pageHeaderTop + pageHeaderHeight,
339			getOffset = UNCODE.get_scroll_offset(event);
340			calc_scroll -= getOffset;
341
342			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
343				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
344
345				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
346					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
347				}
348			}
349
350			if (scrollSpeed == 0) {
351				$('html, body').scrollTop(calc_scroll);
352				UNCODE.scrolling = false;
353			} else {
354					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
355						$(this).stop();
356					}).animate({
357						scrollTop: calc_scroll
358					}, scrollSpeed, 'easeInOutCubic', function() {
359						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
360						UNCODE.scrolling = false;
361						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
362							calc_scroll = pageHeaderTop + pageHeaderHeight;
363							getOffset = UNCODE.get_scroll_offset(event);
364							calc_scroll -= getOffset;
365								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
366									$(this).stop();
367								}).animate({
368									scrollTop: calc_scroll
369								}, scrollSpeed, 'easeInOutCubic', function() {
370									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
371									UNCODE.scrolling = false;
372								}
373							);
374						}
375					}
376				);
377			}
378		});
379	}
380
381	// Colomun hover effect
382	// =================
383	$(document).on('mouseenter', '.col-link', function(e) {
384		var uncol = $(e.target).prev('.uncol'),
385		el = uncol.find('.column-background');
386		if (el) {
387			$('.btn-container .btn', uncol).toggleClass('active');
388			var elOverlay = $(el[0]).find('.block-bg-overlay');
389			if (elOverlay.length) {
390				var getOpacity = $(elOverlay).css('opacity');
391				if (getOpacity != 1) {
392					getOpacity = Math.round(getOpacity * 100) / 100;
393					var newOpacity = getOpacity + .1;
394					$(elOverlay).data('data-opacity', getOpacity);
395					$(elOverlay).css('opacity', newOpacity);
396				}
397			}
398		}
399	}).on('mouseleave', '.col-link', function(e) {
400		var uncol = $(e.target).prev('.uncol'),
401		el = uncol.find('.column-background');
402		$('.btn-container .btn', uncol).toggleClass('active');
403		if (el) {
404			var elOverlay = $(el[0]).find('.block-bg-overlay');
405			if (elOverlay.length) {
406				var getOpacity = $(elOverlay).data('data-opacity');
407				$(elOverlay).css('opacity', getOpacity);
408			}
409		}
410	});
411
412	// Admin bar
413	// ============
414	var fixAdminBar = function() {
415		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
416			var getAdminBar = $('#wpadminbar');
417			if (getAdminBar.length) {
418				if (getAdminBar.css('position') !== 'hidden') {
419					var getAdminBarHeight = getAdminBar.height();
420					if (getAdminBar.css('position') === 'fixed') {
421						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
422						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
423					} else {
424						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
425						$('.body-borders .top-border').css({'margin-top':'0px'});
426					}
427				}
428			}
429		}
430	};
431	window.addEventListener('load', fixAdminBar);
432	window.addEventListener('resize', fixAdminBar);
433	// Print
434	// ===========
435	var beforePrint = function() {
436		window.dispatchEvent(new CustomEvent('resize'));
437		window.dispatchEvent(UNCODE.boxEvent);
438	};
439
440	if (window.matchMedia) {
441		var mediaQueryList = window.matchMedia('print');
442		mediaQueryList.addListener(function(mql) {
443			if (mql.matches) {
444				beforePrint();
445			}
446		});
447	}
448
449	window.onbeforeprint = beforePrint;
450
451	// Safari srcset
452	var safariSrcSet = function(){
453		if ( !SiteParameters.is_frontend_editor ) {
454			$('html.safari img[sizes]').each(function(){
455				var $img = $(this),
456					sizeImg = parseInt($img.attr('sizes'));
457				if ( typeof(sizeImg) === 'number' ) {
458					$img.attr('sizes', (sizeImg) + 'px');
459				}
460			});
461		}
462	};
463	window.addEventListener('load', safariSrcSet);
464}
465
466UNCODE.lettering = function() {
467
468	var setCTA;
469	var highlightStill = function(){
470
471		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
472
473		$.each($heading_texts, function(key, el) {
474			var $heading = $(el);
475
476			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
477				return;
478			}
479
480			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
481				return;
482			}
483
484			var waypoint = new Waypoint({
485				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
486				element: el,
487				handler: function() {
488					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
489						anims_l = $anims.length;
490					$anims.each(function(_key_, _el_){
491						var $anim = $(_el_);
492
493						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
494							$anim.addClass('heading-text-highlight-animated');
495
496							if ( $heading.data('animate') === true ) {
497								$anim.css({
498									'-webkit-transition-duration': '0ms',
499									'-moz-transition-duration': '0ms',
500									'-o-transition-duration': '0ms',
501									'transition-duration': '0ms',
502								});
503							} else {
504								$anim.css({
505									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
506									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
507									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
508									'transition-delay': ((_key_ + 2) * 200) + 'ms',
509								});
510							}
511						}
512
513					});
514					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
515						$heading.data('animate', true);
516					});
517					$anims.removeAttr('data-animated');
518				},
519				offset: '100%'
520			});
521
522		});
523
524		Waypoint.refreshAll();
525		$( document.body ).trigger('uncode_waypoints');
526
527	}
528
529	requestTimeout(function(){
530		highlightStill();
531		$(window).on( 'resize', function(){
532			clearRequestTimeout(setCTA);
533			setCTA = requestTimeout( highlightStill, 100 );
534		});
535	}, 400);
536
537};
538
539UNCODE.isUnmodalOpen = false;
540
541var manageVideoSize = function(){
542
543	var setVideoFit;
544	$('.wp-block-embed').each(function(){
545
546		var $this = $(this);
547
548		if ( $('iframe', $this).length ) {
549
550			var $iframe = $('> iframe, > a > iframe', $this),
551				w = parseFloat($iframe.attr('width')),
552				h = parseFloat($iframe.attr('height')),
553				url = $iframe.attr('src'),
554				ratio, frW;
555
556			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
557
558				ratio = h / w;
559				var setResizeiFto,
560					resizeiFrame = function(){
561					frW = $iframe.width();
562					$iframe.css({
563						height: frW * ratio
564					});
565				};
566				resizeiFrame();
567				$(window).on( 'resize load', function(){
568					clearRequestTimeout(setResizeiFto);
569					setResizeiFto = requestTimeout( function() {
570						resizeiFrame();
571					}, 10 );
572				});
573
574			}
575
576		}
577
578	});
579
580};
581
582manageVideoSize();
583
584UNCODE.vivus = function(icon, time, delay, file) {
585	if (typeof Vivus !== 'undefined') {
586		var icon_options = {
587			type: 'delayed',
588			pathTimingFunction: Vivus.EASE_OUT,
589			animTimingFunction: Vivus.LINEAR,
590			duration: time,
591		}
592
593		if (delay) {
594			icon_options.delayStart = delay;
595		}
596
597		if (file) {
598			icon_options.file = file;
599		}
600
601		new Vivus(icon, icon_options);
602	}
603};
604
605UNCODE.lastURL = '';
606
607UNCODE.getURLParams = function(current_location, is_string) {
608	var params = {};
609	if (is_string) {
610		var url = current_location.split('?')[1];
611	} else {
612		var url = current_location.search;
613		url = url.substring(1);
614	}
615	if (url) {
616		var parts = url.split('&');
617		for (var i = 0; i < parts.length; i++) {
618			var nv = parts[i].split('=');
619			if (!nv[0]) {
620				continue;
621			}
622			params[nv[0]] = nv[1] || true;
623		}
624	}
625	return params;
626}
627
628UNCODE.hasEqualURLParams = function(obj1, obj2) {
629	for (var i in obj1) {
630		if (obj1.hasOwnProperty(i)) {
631			if (!obj2.hasOwnProperty(i)) {
632				return false;
633			}
634			if (obj1[i] != obj2[i]) {
635				return false;
636			}
637		}
638	}
639	for (var i in obj2) {
640		if (obj2.hasOwnProperty(i)) {
641			if (!obj1.hasOwnProperty(i)) {
642				return false;
643			}
644			if (obj1[i] != obj2[i]) {
645				return false;
646			}
647		}
648	}
649    return true;
650}
651
652UNCODE.magnetic = function(){
653	
654	$(document).on('mousemove', '.un-magnetic-zone', function(e){
655
656		var $zone = $(this),
657			zoneOff = $zone.offset(),
658			$mgntcEl = $('.un-magnetic-el', this),
659			elBound = this.getBoundingClientRect(),
660			maxSize = Math.max($zone.outerWidth(), $zone.outerHeight());
661
662		var Xvalue = e.pageX - (zoneOff.left + maxSize / 2),
663	  		Yvalue = e.pageY - (zoneOff.top + maxSize / 2);
664	  
665		$mgntcEl.each(function(key, val){
666			var magneticValue = $(val).attr('data-mgntc') || 0.5;
667		
668			val.animate({
669				transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)',
670			},{
671				duration: 500,
672				fill: 'forwards',
673			})
674	  	});
675	})
676	
677	$(document).on('mouseleave', '.un-magnetic-zone', function(e){
678		var $mgntcEl = $('.un-magnetic-el', this);
679
680		$mgntcEl.each(function(key, val){
681			val.animate({
682		  		transform: 'translate(0)',
683			},{
684		  		duration: 500,
685		  		fill: 'forwards',
686			})
687	  	});
688	})
689};
690
691UNCODE.changeSkinOnScroll = function(){
692	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
693		return;
694	}
695	var $masthead = $('#masthead'),
696		transDesktop,
697		transMobile,
698		changeSkin,
699
700	checkTransparencyAndChange = function( $col ){
701		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
702		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
703		changeSkin = $masthead.hasClass('menu-change-skin');
704
705		if ( ! transDesktop && ! transMobile ) {
706			return false;
707		}
708
709		if ( ! changeSkin ) {
710			return false;
711		}
712
713		if ( $col.hasClass('style-light') ){
714			$masthead.removeClass('style-dark-override').addClass('style-light-override');
715			return false;
716		} else if ( $col.hasClass('style-dark') ) {
717			$masthead.removeClass('style-light-override').addClass('style-dark-override');
718			return false;
719		}
720	};
721
722	var prev_row = 'normal',
723		odd = true,
724		$rows = $('.vc_row[data-parent]:visible');
725	$.each($rows, function(index, row){
726		var $row = $(row),
727			$col = $('.uncol', $row).first(),
728			$slider = $('.uncode-slider', $row);
729
730		var wayDown = new Waypoint({
731			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
732			element: row,
733			handler: function(direction) {
734				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
735					if ( $slider.length ) {
736						$col = $('.owl-item.index-active .uncol', $slider).first();
737					}
738					checkTransparencyAndChange($col);
739				}
740				if ( odd === false ) {
741					if ( row.hasAttribute('data-bg-changer') ) {
742						prev_row = 'bg-changer';
743					} else {
744						prev_row = 'normal';
745					}
746					odd = true;
747				} else {
748					odd = false;
749				}
750			},
751			offset: function() {
752				return UNCODE.menuHeight / 2
753			}
754		});
755		var wayUp = new Waypoint({
756			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
757			element: row,
758			handler: function(direction) {
759				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
760					if ( $slider.length ) {
761						$col = $('.owl-item.index-active .uncol', $slider).first();
762					}
763					checkTransparencyAndChange($col);
764				}
765				if ( odd === false ) {
766					if ( row.hasAttribute('data-bg-changer') ) {
767						prev_row = 'bg-changer';
768					} else {
769						prev_row = 'normal';
770					}
771					odd = true;
772				} else {
773					odd = false;
774				}
775			},
776			offset: function() {
777				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
778			}
779		});
780	});
781
782};
783
784UNCODE.share = function() {
785	if (typeof Share !== 'undefined') {
786		var share_button_element = $('.share-button');
787		var share_button_url = share_button_element.data('url');
788
789		var share_button_config = {
790			ui: {
791				flyout: "top center",
792				button_font: false,
793				button_text: '',
794				icon_font: false
795			}
796		};
797
798		if (share_button_url) {
799			share_button_config.url = share_button_url.replace("&", "%26");
800		}
801
802		var share_button_top = new Share('.share-button', share_button_config);
803	}
804};
805
806UNCODE.tooltip = function() {
807	if (typeof jQuery.fn.tooltip !== 'undefined') {
808		$('.btn-tooltip').tooltip();
809	}
810};
811
812UNCODE.counters = function() {
813	var $counters = $('.uncode-counter:not(.counter-init)');
814	$counters.each(function(){
815		var $counter = $(this).addClass('counter-init');
816		if ( SiteParameters.is_frontend_editor ) {
817			$counter.addClass('started');
818		}
819		if ( $counter.closest( '.owl-carousel' ).length ) {
820			return;
821		}
822		$counter.addClass('started').counterUp({
823			delay: 10,
824			time: 1500
825		});
826	});
827};
828
829UNCODE.countdowns = function() {
830	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
831	$countdowns.each(function() {
832		var $this = $(this).addClass('counter-init'),
833			finalDate = $(this).data('uncode-countdown');
834		$this.countdown(finalDate, function(event) {
835			$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>'));
836		});
837	});
838};
839
840UNCODE.tabs = function() {
841
842	var tabSwitcher = function($el){
843		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vertical):not(.tab-switch)', $el).each(function(key, value){
844			var $navs = $(value),
845				$active = $('li.active', $navs),
846				$active_a = $('> a', $active),
847				$active_span = $('> span', $active_a),
848				vertical = $navs.closest('.vertical-tab-menu').length;
849			
850			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
851				$navs.append('<span class="switcher-cursor" />');
852			}
853
854			var $cursor = $('.switcher-cursor', $navs),
855				active_w = $('a', $active).outerWidth(),
856				span_w = $active_span.outerWidth(),
857				active_pos = $active.position(),
858				active_a_pos = $active_a.position(),
859				span_pos = $active_span.position(),
860				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
861				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
862
863			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
864
865			if ( ! vertical ) {
866				$cursor.css({
867					left: cursor_left,
868					width: cursor_w
869				});
870			}
871
872			$navs.addClass('switch-init');
873		});
874	};
875
876	var $body = $('body');
877	tabSwitcher($body);
878
879	var tabHoverIntent = function(){
880		var setHover;
881		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
882			.on('mouseover', function(e){
883				var $this = $(e.target);
884				setHover = requestTimeout(function() {
885					$this.trigger('hover-int');
886				}, 50);
887			})
888			.on('mouseout', function(){
889				clearRequestTimeout(setHover);
890			});
891	};
892	tabHoverIntent();
893
894	var tabInit = function(){
895		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
896			e.preventDefault()
897			var $el = $(this);
898			$el.tab('show');
899			var $container = $el.closest('.uncode-tabs');
900			tabSwitcher($container);
901			requestTimeout(function() {
902				window.dispatchEvent(UNCODE.boxEvent);
903				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
904
905				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
906					window.dispatchEvent(new CustomEvent('boxResized'));
907				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
908					window.dispatchEvent(new Event('resize'));
909					$(window).trigger('uncode.re-layout');
910				} 
911
912				var $active_panel = $('.tab-pane.active', $tabs);
913
914				$.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) {
915					var element = $(val),
916						delayAttr = element.attr('data-delay');
917					if (delayAttr == undefined) delayAttr = 0;
918					requestTimeout(function() {
919						element.addClass('start_animation');
920					}, delayAttr);
921				});
922
923			}, 300);
924
925			var $li = $el.closest('li'),
926				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
927			$('li', $container).not($li).find('.tab-pane').slideUp(250)
928			$('.tab-pane', $li).slideDown(250);
929			var completeSlideDown = requestTimeout(function(){
930				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
931					var pos = $el.offset(),
932						rect = $el[0].getBoundingClientRect(),
933						$masthead = $('#masthead > .menu-container'),
934						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
935
936					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
937						$('html, body').animate({
938							scrollTop: ( pos.top ) - considerMenu
939						},{
940							easing: 'easeInOutQuad',
941							duration: 250
942						});
943					}
944				}
945			}, 260);
946		});
947	}
948	tabInit();
949
950	var tabResponsive = function(){
951		if ( SiteParameters.is_frontend_editor ) {
952			return true;
953		}
954		var $tabContainers = $('.tab-container.tabs-breakpoint');
955		$tabContainers.each(function(){
956			var $tabContainer = $(this),
957				$tabContent = $('.tab-content', $tabContainer),
958				$nav = $('.nav-tabs', $tabContainer),
959				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
960
961			$('> li', $nav).each(function(){
962				var $li = $(this),
963					dataID = $li.attr('data-tab-id');
964
965				if ( UNCODE.wwidth <= mQuery ) {
966					if ( ! $('.tab-pane', $li ).length ) {
967						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
968						$tabContainer.addClass('tabs-appended');
969						$li.append($append_pane);
970					}
971
972					if ( $li.hasClass('active') ) {
973						$('> a', $li).click();
974					}
975				} else {
976					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
977						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
978						$tabContainer.removeClass('tabs-appended');
979						$tabContent.prepend($append_pane.removeAttr('style'));
980					}
981				}
982			});
983		});
984
985	}
986	tabResponsive();
987
988	$(window).on('wwResize', function(){
989		tabHoverIntent();
990		tabSwitcher($body);
991	});
992
993	var setCTA;
994	$(window).on( 'resize', function(){
995		clearRequestTimeout(setCTA);
996		setCTA = requestTimeout( tabResponsive, 100 );
997	});
998
999	$('.nav-tabs').each(function(){
1000		var $nav = $(this),
1001			$lis = $('> li:not(.active)', $nav),
1002			$links = $('.tab-excerpt-link', $nav);
1003		$('.tab-excerpt', $lis).slideUp(400, function(){
1004			$(this).addClass('init');
1005		});
1006
1007		$links.each(function(){
1008			var $link = $(this),
1009				$par_a = $link.closest('a'),
1010				href = $link.attr('data-href'),
1011				target = $link.attr('data-target');
1012			$par_a.addClass('inner-link');
1013			$link.on('click', function(){
1014				var _link = document.createElement('a');
1015				_link.href = href;
1016				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
1017				_link.click();
1018			});
1019		});
1020		$nav.addClass('tab-init');
1021	});
1022
1023	$('.uncode-tabs.tabs-no-lazy').each(function(){
1024		var $tabs = $(this),
1025			$panes = $('.tab-pane:not(.active)', $tabs);
1026		$panes.each(function(){
1027			var $pane = $(this),
1028				$imgs = $('img[loading="lazy"]', $pane);
1029			$imgs.removeAttr('loading');
1030			$imgs.removeAttr('decoding');
1031		});
1032	});
1033
1034};
1035UNCODE.collapse = function() {
1036	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
1037		var $this = $(this),
1038			href
1039		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
1040		var $target = $(target)
1041		var parent = $this.attr('data-parent')
1042		var $parent = parent && $(parent)
1043		var $title = $(this).parent()
1044		var $accordion = $(e.target).closest('.uncode-accordion')
1045		var $group = $this.closest('.group')
1046		var $panel_group = $this.closest('.panel-group')
1047		if ($parent) {
1048			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
1049			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
1050				$title.removeClass('active');
1051				$group.removeClass('active-group');
1052			} else {
1053				if ( $panel_group.attr('data-no-toggle') != true ) {
1054					$parent.find('.panel-title').removeClass('active')
1055					$parent.find('.group').removeClass('active-group')
1056				}
1057				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
1058				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
1059			}
1060		}
1061		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
1062		requestTimeout(function() {
1063			var $accordion = $(e.target).closest('.uncode-accordion');
1064			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
1065			  window.dispatchEvent(new CustomEvent('boxResized'));
1066			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
1067				window.dispatchEvent(new Event('resize'));
1068				$(window).trigger('uncode.re-layout');
1069			} 
1070
1071			var $active_panel = $('.panel.active-group', $parent);
1072
1073			$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) {
1074				var element = $(val),
1075					delayAttr = element.attr('data-delay');
1076				if (delayAttr == undefined) delayAttr = 0;
1077				requestTimeout(function() {
1078					element.addClass('start_animation');
1079				}, delayAttr);
1080			});
1081
1082		}, 500);
1083	});
1084
1085	$('.uncode-accordion.tabs-no-lazy').each(function(){
1086		var $accordion = $(this),
1087			$panes = $('.panel:not(.active-group)', $accordion);
1088		$panes.each(function(){
1089			var $pane = $(this),
1090				$imgs = $('img[loading="lazy"]', $pane);
1091			$imgs.removeAttr('loading');
1092			$imgs.removeAttr('decoding');
1093		});
1094	});
1095};
1096
1097UNCODE.bigText = function(el) {
1098	var bigTextLaunch = function(){
1099		if (el == undefined) {
1100			el = $('body');
1101		}
1102		$.each($('.bigtext', el), function(index, val) {
1103			$(val).bigtext({
1104				minfontsize: 24
1105			});
1106			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1107				opacity: 1
1108			});
1109			requestTimeout(function() {
1110				if ($(val).find('.animate_when_almost_visible').length != 0) {
1111					$(val).css({opacity: 1});
1112				}
1113			}, 400);
1114		});
1115	};
1116
1117	if ( UNCODE.wwidth > UNCODE.mediaQuery ) {
1118		bigTextLaunch();
1119	}
1120	$(window).on( 'load', bigTextLaunch );
1121};
1122
1123UNCODE.process_shortpixel_image = function(image) {
1124	var data = {
1125		action: 'shortpixel_manual_optimization',
1126		image_id: image,
1127		cleanup: true
1128	};
1129
1130	$.get(SiteParameters.ajax_url, data);
1131};
1132
1133UNCODE.menuSystem = function() {
1134
1135	function menuMobile() {
1136		var $body = $('body'),
1137			scrolltop,
1138			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'),
1139			$masthead = $('#masthead'),
1140			$box,
1141			$el,
1142			$el_transp,
1143			elHeight,
1144			offCanvasAnim,
1145			check,
1146			animating = false,
1147			stickyMobile = false,
1148			menuClose = new CustomEvent('menuMobileClose'),
1149			menuOpen = new CustomEvent('menuMobileOpen');
1150		UNCODE.menuOpened = false;
1151		$mobileToggleButton.on('click', function(event) {
1152			event.stopPropagation();
1153			var btn = this;
1154			if ($(btn).hasClass('overlay-close')) return;
1155			event.preventDefault();
1156			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1157			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1158				$box = $(this).closest('.box-container').find('.main-menu-container');
1159				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
1160				$el_transp = $('.menu-absolute.menu-transparent');
1161				if (UNCODE.isMobile) {
1162					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 ) {
1163						stickyMobile = true;
1164						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1165					} else {
1166						elHeight = 0;
1167						$.each($box.find('> div'), function(index, val) {
1168							elHeight += $(val).outerHeight();
1169						});
1170					}
1171				} else {
1172					elHeight = 0;
1173					$.each($el, function(index, val) {
1174						elHeight += $(val).outerHeight();
1175					});
1176				}
1177				var open = function() {
1178					clearTimeout(offCanvasAnim);
1179					if (!animating) {
1180						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1181						scrolltop = $(window).scrollTop();
1182						window.dispatchEvent(menuOpen);
1183						animating = true;
1184						UNCODE.menuOpened = true;
1185						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {
1186							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1187								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1188							}
1189							if ($('body.menu-offcanvas').length) {
1190								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1191								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1192							} else {
1193								if ( $('.menu-hide, .menu-sticky').length ) {
1194									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1195										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1196									}
1197								}
1198							}
1199						}
1200						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1201							//$("#masthead")[0].scrollIntoView();
1202							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1203						}
1204						$box.addClass('open-items');
1205						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1206							$el_transp.addClass('is_mobile_open');
1207						}
1208						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1209							btn.classList.add('close');
1210							$box.animate({
1211								height: elHeight
1212							}, 600, "easeInOutCirc", function() {
1213								animating = false;
1214								if (!stickyMobile) $box.css('height', 'auto');
1215							});
1216						} else {
1217							animating = false;
1218						}
1219					}
1220				};
1221
1222				var close = function() {
1223					clearTimeout(offCanvasAnim);
1224					if (!animating) {
1225						window.dispatchEvent(menuClose);
1226						animating = true;
1227						UNCODE.menuOpened = false;
1228						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1229							btn.classList.remove('close');
1230							btn.classList.add('closing');
1231						}
1232						$box.addClass('close');
1233						requestTimeout(function() {
1234							$box.removeClass('close');
1235							$box.removeClass('open-items');
1236							btn.classList.remove('closing');
1237							if ($el_transp.length) {
1238								$el_transp.removeClass('is_mobile_open');
1239							}
1240						}, 500);
1241						$body.removeClass('opening-overlay-menu');
1242						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1243							$box.animate({
1244								height: 0
1245							}, {
1246								duration: 600,
1247								easing: "easeInOutCirc",
1248								complete: function(elements) {
1249									$(elements).css('height', '');
1250									animating = false;
1251									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1252										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1253									}
1254									$body.removeClass('open-overlay-menu');
1255								}
1256							});
1257						} else {
1258							animating = false;
1259							offCanvasAnim = setTimeout(function(){
1260								$body.removeClass('open-overlay-menu');
1261							}, 1000);
1262						}
1263					}
1264				};
1265				check = (!UNCODE.menuOpened) ? open() : close();
1266			}
1267		});
1268
1269		$('html').on('click', function(event){
1270			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1271				$('.uncode-close-offcanvas-mobile').trigger('click');
1272			}
1273		});
1274
1275		window.addEventListener('menuMobileTrigged', function(e) {
1276			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1277		});
1278		window.addEventListener('orientationchange', function(e) {
1279			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1280		});
1281		window.addEventListener("resize", function() {
1282			if ($(window).width() < UNCODE.mediaQuery) {
1283				if (UNCODE.isMobile) {
1284					var $box = $('.box-container .main-menu-container'),
1285						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
1286					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1287						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1288							elHeight = 0;
1289							$.each($el, function(index, val) {
1290								elHeight += $(val).outerHeight();
1291							});
1292							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;
1293							$($box).css('height', elHeight + 'px');
1294						}
1295					}
1296				}
1297			} else {
1298				$('.menu-hide-vertical').removeAttr('style');
1299				$('.menu-container-mobile').removeAttr('style');
1300				$('.vmenu-container.menu-container').removeAttr('style');
1301			}
1302		});
1303
1304		$(window).on('scroll', function(){
1305			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1306				$(window).scrollTop(scrolltop);
1307				return false;
1308			}
1309		});
1310
1311	};
1312
1313	function menuOffCanvas() {
1314		var menuClose = new CustomEvent('menuCanvasClose'),
1315			menuOpen = new CustomEvent('menuCanvasOpen');
1316		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1317			if ($(window).width() > UNCODE.mediaQuery) {
1318				if ( $('body.vmenu-offcanvas-overlay').length ) {
1319					if ($(event.currentTarget).hasClass('off-close')) {
1320						$(event.currentTarget).removeClass('off-close');
1321						requestTimeout(function() {
1322							window.dispatchEvent(menuClose);
1323						}, 500);
1324
1325					} else {
1326						$(event.currentTarget).addClass('off-close');
1327						window.dispatchEvent(menuOpen);
1328					}
1329				} else {
1330					if ($(event.currentTarget).hasClass('close')) {
1331						$(event.currentTarget).removeClass('close');
1332						$(event.currentTarget).addClass('closing');
1333						requestTimeout(function() {
1334							$(event.currentTarget).removeClass('closing');
1335							window.dispatchEvent(menuClose);
1336						}, 500);
1337
1338					} else {
1339						$(event.currentTarget).addClass('close');
1340						window.dispatchEvent(menuOpen);
1341					}
1342				}
1343			}
1344
1345			$('body').toggleClass('off-opened');
1346		});
1347
1348		$('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){
1349			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1350				var $vMenuCont = $('#masthead .vmenu-container'),
1351					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1352
1353					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1354					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1355					vmenu_off = $vMenuCont.offset(),
1356					vmenu_l = parseFloat(vmenu_off.left),
1357					vmenu_t = parseFloat(vmenu_off.top),
1358					vmenu_r = vmenu_l + vmenu_w,
1359					vmenu_b = vmenu_t + vmenu_h,
1360
1361					close_h = parseFloat( $close_menu.outerHeight() ),
1362					close_w = parseFloat( $close_menu.outerWidth() ),
1363					close_off = $close_menu.offset(),
1364					close_l = parseFloat(close_off.left),
1365					close_t = parseFloat(close_off.top),
1366					close_r = close_l + close_w,
1367					close_b = close_t + close_h;
1368				if (
1369					!(
1370						e.clientX > vmenu_l &&
1371						e.clientX < vmenu_r &&
1372						e.clientY > vmenu_t &&
1373						e.clientY < vmenu_b
1374					)
1375					||
1376					(
1377						e.clientX > close_l &&
1378						e.clientX < close_r &&
1379						e.clientY > close_t &&
1380						e.clientY < close_b
1381					)
1382				) {
1383					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1384				}
1385			}
1386		});
1387	};
1388
1389	function menuOverlay() {
1390		if ( $('.overlay').length ) {
1391			$('.overlay').removeClass('hidden');
1392		}
1393		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1394			$('.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) {
1395				var transDelay = (index / 20) + 0.1;
1396				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1397					transDelay = transDelay + 0.3;
1398				$(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');
1399			});
1400		}
1401
1402	};
1403	var $secondary_parent;
1404	function menuAppend() {
1405		var $body = $('body'),
1406			$menuCont = $('.menu-container:not(.vmenu-container)'),
1407			$vMenuCont = $('.menu-container.vmenu-container'),
1408			$cta = $('.navbar-cta'),
1409			$socials = $('.navbar-social:not(.appended-navbar)'),
1410			$ul = $('.navbar-main ul.menu-primary-inner'),
1411			$ulCta,
1412			$ulSocials,
1413			$navLast,
1414			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1415			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1416			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1417			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1418			$ulFirst = $('> ul', $firstNav),
1419			$ulSecond = $('> ul', $secondNav),
1420			setCTA,
1421			appendCTA = function(){
1422				return true;
1423			},
1424			appendSocials = function(){
1425				return true;
1426			},
1427			appendSplit = function(){
1428				return true;
1429			};
1430
1431		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1432			$ulCta = $('> ul', $cta);
1433			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1434
1435			appendCTA = function(){
1436				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1437
1438					$ul.after($ulCta);
1439				} else {
1440					$cta.append($ulCta);
1441				}
1442			}
1443		}
1444
1445		if ( ! $body.hasClass('cta-not-appended') ) {
1446			appendCTA();
1447		}
1448
1449		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1450		$smartSocial.each(function(){
1451			var $_smartSocial = $(this);
1452			$('> li', $_smartSocial).each(function(){
1453				var $li = $(this);
1454				if ( $li.hasClass('mobile-hidden') ) {
1455					$_smartSocial.addClass('mobile-hidden');
1456				} else {
1457					$_smartSocial.removeClass('mobile-hidden');
1458					return false;
1459				}
1460			});
1461
1462			$('> li', $_smartSocial).each(function(){
1463				var $li = $(this);
1464				if ( $li.hasClass('tablet-hidden') ) {
1465					$_smartSocial.addClass('tablet-hidden');
1466				} else {
1467					$_smartSocial.removeClass('tablet-hidden');
1468					return false;
1469				}
1470			});
1471		});
1472
1473		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1474			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1475			if ( $body.hasClass('hmenu-center-split') ) {
1476				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1477			} else {
1478				$navLast = $('.navbar-nav-last', $vMenuCont);
1479			}
1480
1481			if ( ! $navLast.length ) {
1482				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1483				if ( $body.hasClass('hmenu-center-split') ) {
1484					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1485					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1486				} else {
1487					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1488					$navLast = $('.navbar-nav-last', $vMenuCont);
1489				}
1490			}
1491
1492			appendSocials = function(){
1493				if ( !$body.hasClass('menu-overlay-center') ) {
1494				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1495				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1496				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1497				// 		$ulSocials.each(function(){
1498				// 			var $li_social = $(this);
1499				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1500				// 		});
1501				// 	}
1502				// } else {
1503					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1504						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1505						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1506							$('> ul.menu-smart-social li', $socials).remove();
1507						}
1508						$navLast.append($ulSocials);
1509					} else {
1510						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1511							$('> ul.menu-smart-social li', $navLast).remove();
1512						}
1513						$socials.append($ulSocials);
1514					}
1515				}
1516			}
1517			appendSocials();
1518		}
1519
1520		if ( $vMenuCont.length ) {
1521			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1522		} else {
1523			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1524		}
1525		if ( $accordion_secondary.length ) {
1526			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1527			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1528				if ( !$accordion_secondary_ph.length ) {
1529					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1530				}
1531				if ( $vMenuCont.length ) {
1532					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1533				} else {
1534					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1535						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1536					} else {
1537						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1538					}
1539				}
1540			} else {
1541				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1542					$accordion_secondary_ph.before($accordion_secondary);
1543				}
1544			}
1545		}
1546
1547		if ( $vMenuCont.length ) {
1548			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1549		} else {
1550			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1551		}
1552
1553		if ( $extra_icons.length ) {
1554			if ( $vMenuCont.length ) {
1555				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1556					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1557						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1558							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1559						$not_social.each(function(){
1560							if ( ! $primary_after.length ) {
1561								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1562								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1563								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1564							}
1565							var $extra_li = $(this);
1566							$primary_after.find('> ul').append($extra_li);
1567						});
1568					} else {
1569						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1570							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1571						$not_social.each(function(){
1572							var $extra_li = $(this);
1573							$extra_icons.find('> ul').append($extra_li);
1574						});
1575					}
1576				} /*else {
1577					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1578					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1579						if ( !$extra_icons_ph.length ) {
1580							$extra_icons.after('<span class="extra-icons-ph" />');
1581						}
1582						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1583							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1584						} else {
1585							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1586						}
1587					} else {
1588						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1589							$extra_icons_ph.before($extra_icons);
1590						}
1591					}
1592				}*/
1593			} else {
1594				if ( ! $body.hasClass('hmenu-center-double') ) {
1595					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1596						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1597							$primary_after = $('.nav.navbar-main-after', $menuCont);
1598
1599						if ( ! $primary_after.length && $not_social.length ) {
1600							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1601								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1602							} else {
1603								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1604							}
1605							$primary_after = $('.nav.navbar-main-after', $menuCont);
1606							$primary_after.append('<ul class="menu-smart sm menu-smart-social" />');
1607						}
1608						var tablet_hidden = true,
1609							mobile_hidden = true;
1610						$not_social.each(function(){
1611							var $extra_li = $(this);
1612							$primary_after.find('> ul').append($extra_li);
1613							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1614								tablet_hidden = false;
1615							}
1616							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1617								mobile_hidden = false;
1618							}
1619						});
1620						if ( tablet_hidden === true && $not_social.length ) {
1621							$primary_after.addClass('tablet-hidden');
1622						}
1623						if ( mobile_hidden === true && $not_social.length ) {
1624							$primary_after.addClass('mobile-hidden');
1625						}
1626					} else {
1627						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1628
1629						if ( $primary_after.length ) {
1630							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1631							$not_social.each(function(){
1632								var $extra_li = $(this);
1633								$extra_icons.find('> ul').append($extra_li);
1634							});
1635							$primary_after.remove();
1636						}
1637					}
1638				}
1639			}
1640		}
1641
1642		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1643			appendSplit = function(){
1644				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1645					if ( $extra_icons.length ) {
1646						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1647							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1648								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1649							$not_social.each(function(){
1650								var $extra_li = $(this);
1651								$append_ul.append($extra_li);
1652							});
1653							if ( $secondNav.length ) {
1654								$secondNav.append($append_ul);
1655							} else {
1656								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1657							}
1658						}
1659					}
1660					if ( $secondNav.length ) {
1661						$secondNav.prepend($ulFirst);
1662					} else {
1663						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1664					}
1665					$firstMenu.hide();
1666				} else {
1667					$firstNav.append($ulFirst);
1668					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1669					if ( $append_ul.length ) {
1670						var $not_social = $('> li:not(.social-icon)', $append_ul);
1671						$not_social.each(function(){
1672							var $extra_li = $(this);
1673							$extra_icons.find('> ul').append($extra_li);
1674						});
1675					}
1676					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1677					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1678					$firstMenu.css({
1679						'display': 'table-cell'
1680					});
1681				}
1682			}
1683		}
1684		appendSplit();
1685
1686		$(window).on( 'resize', function(){
1687			clearRequestTimeout(setCTA);
1688			setCTA = requestTimeout( function() {
1689				appendCTA();
1690				appendSocials();
1691				appendSplit();
1692			}, 10 );
1693		});
1694	}
1695	//menuMobileButton();
1696	menuMobile();
1697	menuOffCanvas();
1698	menuAppend();
1699	menuOverlay();
1700
1701	var stickyDropdownSearch = function(){
1702		var $masthead = $('#masthead'),
1703			$ddSearch = $('.overlay.overlay-search', $masthead),
1704			$styles = $('#stickyDropdownSearch').remove();
1705		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1706			var $menuWrapper = $('.menu-wrapper'),
1707				$navbar = $('.menu-container-mobile', $menuWrapper),
1708				navbarH = $navbar.outerHeight(),
1709				//$topbar = $('.top-menu', $menuWrapper),
1710				//topbarH = $topbar.outerHeight(),
1711				_css;
1712
1713			_css = '<style id="stickyDropdownSearch">';
1714			_css += '@media (max-width: 959px) {';
1715			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
1716			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
1717			_css += '}';
1718			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
1719			_css += 'position: fixed;';
1720			_css += 'top: 0;';
1721			_css += '}';
1722			_css += '</style>';
1723
1724			$(_css).appendTo($('head'));
1725		}
1726	}
1727	stickyDropdownSearch();
1728
1729	var setMenuOverlay;
1730	$(window).on( 'resize', function(){
1731		if ( $('.overlay').length && $(window).width() > 1024 ) {
1732			$('.overlay').addClass('hidden');
1733		}
1734		clearRequestTimeout(setMenuOverlay);
1735		setMenuOverlay = requestTimeout( function(){
1736			menuOverlay();
1737			menuAppend();
1738			stickyDropdownSearch();
1739		}, 150 );
1740	});
1741	UNCODE.menuSmartInit();
1742};
1743
1744UNCODE.menuSmartInit = function() {
1745	var $menusmart = $('[class*="menu-smart"]'),
1746		$masthead = $('#masthead'),
1747		$hMenu = $('.menu-horizontal-inner', $masthead),
1748		$focus = $('.overlay-menu-focus'),
1749		showTimeout = 50,
1750		hideTimeout = 50,
1751		showTimeoutFunc, hideTimeoutFunc;
1752
1753	$('> li.menu-item-has-children', $menusmart).hover(function(){
1754		$(this).data('hover', true);
1755	}, function(){
1756		$(this).data('hover', false);
1757	});
1758
1759	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
1760		e.preventDefault();
1761	});
1762
1763	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
1764		var $notLis = $('> .nav > ul > li a', $hMenu),
1765			$menuA = $('a', $masthead).not($notLis),
1766			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
1767			showFuncCond = function() { return true };
1768
1769		if ( $('body').hasClass('focus-megamenu') ) {
1770			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner');
1771			showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') };
1772		} else if ( $('body').hasClass('focus-links') ) {
1773			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
1774		}
1775
1776		$hoverSelector.hover(function(){
1777			clearRequestTimeout(hideTimeoutFunc);
1778			showTimeoutFunc = requestTimeout(function(){
1779				$('body').addClass('navbar-hover');
1780			}, showTimeout*2);
1781		}, function(){
1782			hideTimeoutFunc = requestTimeout(function(){
1783				if ( ! $('.overlay-search.open', $masthead).length ) {
1784					$('body').removeClass('navbar-hover');
1785				}
1786			}, hideTimeout*2);
1787		});
1788	} else {
1789		showFuncCond = function() { return false };
1790	}
1791
1792	if ($menusmart.length > 0) {
1793		$menusmart.smartmenus({
1794			subIndicators: false,
1795			subIndicatorsPos: 'append',
1796			//subMenusMinWidth: '13em',
1797			subIndicatorsText: '',
1798			showTimeout: showTimeout,
1799			hideTimeout: hideTimeout,
1800			scrollStep: 8,
1801			showFunction: function($ul, complete) {
1802				clearRequestTimeout(showTimeoutFunc);
1803				$ul.fadeIn(0, 'linear', function(){
1804					complete();
1805					if ( $ul.hasClass('vc_row') ) {
1806						$ul.css({
1807							'display': 'table'
1808						});
1809					}
1810					if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) {
1811						$('body').addClass('open-megamenu');
1812					}
1813					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
1814						$('body').addClass('navbar-hover');
1815					}
1816				}).addClass('open-animated');
1817			},
1818			hideFunction: function($ul, complete) {
1819				if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) {
1820					$('body').removeClass('open-megamenu');
1821				}
1822				var fixIE = $('html.ie').length;
1823				if (fixIE) {
1824					var $rowParent = $($ul).closest('.main-menu-container');
1825					$rowParent.height('auto');
1826				}
1827				$ul.fadeOut(0, 'linear', function(){
1828					complete();
1829					$ul.removeClass('open-animated');
1830					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
1831						$('body').removeClass('open-submenu');
1832					}
1833				});
1834			},
1835			collapsibleShowFunction: function($ul, complete) {
1836				$ul.slideDown(400, 'easeInOutCirc', complete);
1837			},
1838			collapsibleHideFunction: function($ul, complete) {
1839				$ul.slideUp(200, 'easeInOutCirc', complete);
1840			},
1841			hideOnClick: SiteParameters.menuHideOnClick,
1842		});
1843
1844		if ( $('body').hasClass('menu-accordion-active') ) {
1845			requestTimeout(function(){
1846				$menusmart.addClass('menu-smart-init');
1847				$menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) );
1848			}, 1000);
1849		}
1850
1851		$(document).on( 'uncode.smartmenu-appended', function(){
1852			requestTimeout(function(){
1853				$menusmart.smartmenus( 'refresh' );
1854			}, 1000);
1855		});
1856	}
1857
1858	$('.main-menu-container').each(function(){
1859		var $main_cont = $(this),
1860			$uls = $('ul', $main_cont);
1861
1862		$uls.each(function(){
1863			var $ul = $(this),
1864				mobile_hidden = true,
1865				tablet_hidden = true;
1866			$('> li:not(.hidden)', $ul).each(function(){
1867				if ( !$(this).hasClass('mobile-hidden') ) {
1868					mobile_hidden = false;
1869					return false;
1870				}
1871			});
1872			$('> li:not(.hidden)', $ul).each(function(){
1873				if ( !$(this).hasClass('tablet-hidden') ) {
1874					tablet_hidden = false;
1875					return false;
1876				}
1877			});
1878			if ( mobile_hidden ) {
1879				$ul.addClass('mobile-hidden');
1880			}
1881			if ( tablet_hidden ) {
1882				$ul.addClass('tablet-hidden');
1883			}
1884		});
1885
1886		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
1887
1888		$divUlsMB.each(function(){
1889			var $divUlMB = $(this),
1890				div_mobile_hidden = true,
1891				div_tablet_hidden = true;
1892
1893			$('> ul:not(.hidden)', $divUlMB).each(function(){
1894				if ( !$(this).hasClass('mobile-hidden') ) {
1895					div_mobile_hidden = false;
1896					return false;
1897				}
1898			});
1899			$('> ul:not(.hidden)', $divUlMB).each(function(){
1900				if ( !$(this).hasClass('tablet-hidden') ) {
1901					div_tablet_hidden = false;
1902					return false;
1903				}
1904			});
1905			if ( div_mobile_hidden ) {
1906				$divUlMB.addClass('mobile-hidden');
1907			}
1908			if ( div_tablet_hidden ) {
1909				$divUlMB.addClass('tablet-hidden');
1910			}
1911		});
1912	});
1913
1914	var overlaySearchButton = function(){
1915		var $search_wrap = $('.overlay.overlay-search, .widget_search');
1916
1917		$search_wrap.each(function(){
1918			var $form = $('form', this),
1919				$icon = $('i', $form);
1920
1921			$icon.on('click', function(){
1922				$form.submit();
1923			});
1924		});
1925	};
1926	overlaySearchButton();
1927}
1928
1929UNCODE.okvideo = function() {
1930	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
1931	$.okvideo = function(options) {
1932		// if the option var was just a string, turn it into an object
1933		if (typeof options !== 'object') options = {
1934			'video': options
1935		};
1936		var base = this;
1937		// kick things off
1938		base.init = function() {
1939			base.options = $.extend({}, $.okvideo.options, options);
1940			// support older versions of okvideo
1941			if (base.options.video === null) base.options.video = base.options.source;
1942			base.setOptions();
1943			var target = base.options.target || $('body');
1944			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
1945			var zIndex = base.options.controls === 3 ? -999 : "auto";
1946			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
1947				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>';
1948				if (OKEvents.utils.isMobile()) {
1949					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>');
1950				} else {
1951					if (base.options.controls === 3) {
1952						target.append(mask)
1953					}
1954					if (base.options.adproof === 1) {
1955						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>');
1956					} else {
1957						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>');
1958					}
1959				}
1960				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
1961				if (base.options.playlist.list === null) {
1962					if (base.options.video.provider === 'youtube') {
1963						base.loadYouTubeAPI();
1964					} else if (base.options.video.provider === 'vimeo') {
1965						base.options.volume /= 100;
1966						base.loadVimeoAPI();
1967					}
1968				} else {
1969					base.loadYouTubeAPI();
1970				}
1971			}
1972		};
1973		// clean the options
1974		base.setOptions = function() {
1975			// exchange 'true' for '1' and 'false' for 3
1976			for (var key in this.options) {
1977				if (this.options[key] === true) this.options[key] = 1;
1978				if (this.options[key] === false) this.options[key] = 3;
1979			}
1980			if (base.options.playlist.list === null) {
1981				base.options.video = base.determineProvider();
1982			}
1983			// pass options to the window
1984			$(window).data('okoptions-' + base.options.id, base.options);
1985		};
1986		// insert js into the head and exectue a callback function
1987		base.insertJS = function(src, callback){
1988			var tag;
1989			if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
1990				tag = UNCODE.insertedSripts[src];
1991				if (callback){
1992					if (tag.readyState){  //IE
1993						tag.onreadystatechange = function(){
1994							if (tag.readyState === "loaded" ||
1995								tag.readyState === "complete"){
1996								tag.onreadystatechange = null;
1997								callback();
1998							}
1999						};
2000					} else {
2001						$(tag).on('load', callback);
2002					}
2003				}
2004				return;
2005			}
2006			tag = document.createElement('script');
2007			if (callback){
2008				if (tag.readyState){  //IE
2009					tag.onreadystatechange = function(){
2010						if (tag.readyState === "loaded" || tag.readyState === "complete"){
2011							tag.onreadystatechange = null;
2012							callback();
2013						}
2014					};
2015				} else {
2016					tag.onload = function() {
2017						callback();
2018					};
2019				}
2020			}
2021			tag.src = src;
2022			var firstScriptTag = document.getElementsByTagName('script')[0];
2023			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2024			if ( ! UNCODE.insertedSripts ) {
2025				UNCODE.insertedSripts = [];
2026			}
2027			UNCODE.insertedSripts[src] = tag;
2028		};
2029		// load the youtube api
2030		base.loadYouTubeAPI = function(callback) {
2031			base.insertJS('https://www.youtube.com/player_api');
2032		};
2033		base.loadYouTubePlaylist = function() {
2034			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
2035		};
2036		// load the vimeo api by replacing the div with an iframe and loading js
2037		base.loadVimeoAPI = function() {
2038			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',
2039			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
2040			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
2041			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
2042			base.insertJS('//player.vimeo.com/api/player.js', function() {
2043				vimeoPlayerReady(base.options.id);
2044			});
2045		};
2046		// is it from youtube or vimeo?
2047		base.determineProvider = function() {
2048			var a = document.createElement('a');
2049			a.href = base.options.video;
2050			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
2051				var videoid = a.href.split('/')[3].toString();
2052				var query = videoid.substring(videoid.indexOf('?') + 1);
2053				if (query != '') {
2054					var vars = query.split('&');
2055					for (var i = 0; i < vars.length; i++) {
2056						var pair = vars[i].split('=');
2057						if (pair[0] == 'v') {
2058							videoid = pair[1];
2059						}
2060					}
2061				}
2062				return {
2063					"provider": "youtube",
2064					"id": videoid
2065				};
2066			} else if (/vimeo.com/.test(base.options.video)) {
2067				return {
2068					"provider": "vimeo",
2069					"id": (a.href.split('/')[3].toString()).split('#')[0],
2070				};
2071			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
2072				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
2073				if (id.length == 11) {
2074					return {
2075						"provider": "youtube",
2076						"id": id.toString()
2077					};
2078				} else {
2079					for (var i = 0; i < base.options.video.length; i++) {
2080						if (typeof parseInt(base.options.video[i]) !== "number") {
2081							throw 'not vimeo but thought it was for a sec';
2082						}
2083					}
2084					return {
2085						"provider": "vimeo",
2086						"id": base.options.video
2087					};
2088				}
2089			} else {
2090				throw "OKVideo: Invalid video source";
2091			}
2092		};
2093		base.init();
2094	};
2095
2096	var checkResize,
2097		newW = UNCODE.wwidth;
2098
2099	$.okvideo.options = {
2100		id: null,
2101		source: null, // Deprecate dis l8r
2102		video: null,
2103		playlist: { // eat ur heart out @brokyo
2104			list: null,
2105			index: 0,
2106			startSeconds: 0,
2107			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2108		},
2109		disableKeyControl: 1,
2110		captions: 0,
2111		loop: 1,
2112		hd: 1,
2113		volume: 0,
2114		adproof: false,
2115		unstarted: null,
2116		onFinished: null,
2117		onReady: null,
2118		onPlay: null,
2119		onPause: null,
2120		buffering: null,
2121		controls: false,
2122		autoplay: true,
2123		annotations: true,
2124		cued: null
2125	};
2126	$.fn.okvideo = function(options) {
2127		options.target = this;
2128		return this.each(function() {
2129			(new $.okvideo(options));
2130		});
2131	};
2132
2133	var checkForVideos = function(){
2134		$(".uncode-video-container.video").each(function(index, el) {
2135			var $this = $(this),
2136				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2137				url = $this.attr('data-video'),
2138				id = $this.attr('data-id'),
2139				cloned = $this.closest('.owl-item');
2140
2141			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2142				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2143					$this.okvideo({
2144						id: id,
2145						source: url.split('#')[0],
2146						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2147						autoplay: 1,
2148						controls: 0,
2149						volume: 0,
2150						adproof: 0,
2151						caller: $this,
2152						hd: 1,
2153						onReady: function(player) {
2154							var getPlayer = player.c || player.h || player,
2155							$iframe,
2156							getContainer = $(getPlayer).closest('.background-element');
2157							if (getContainer.length) {
2158								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2159							}
2160
2161							if ( $this.hasClass('drop-move') ) {
2162
2163								var $iframe = $(getPlayer),
2164									w = parseFloat($iframe.attr('width')),
2165									h = parseFloat($iframe.attr('height')),
2166									ratio = h / w,
2167									setResizeiFto,
2168								resizeiFrame = function(){
2169									var dataW = $this.attr('data-w'),
2170										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2171										newH = newW * ratio;
2172									$iframe.css({
2173										width: newW,
2174										height: newH
2175									});
2176								};
2177								resizeiFrame();
2178								$(window).on( 'load', resizeiFrame );
2179								$(window).on( 'resize', function(){
2180									clearRequestTimeout(setResizeiFto);
2181									setResizeiFto = requestTimeout( function() {
2182										resizeiFrame();
2183									}, 10 );
2184								});
2185
2186							}
2187
2188						}
2189					});
2190				}
2191			}
2192		});
2193	};
2194
2195	checkForVideos();
2196
2197	$(window).on('load', function(){
2198		$('.mejs-fullscreen-button button').on('click', function(){
2199			var $button = $(this),
2200				$stuck = $button.closest('.is_stucked');
2201
2202			if ( $stuck.length ) {
2203				$stuck = $(this).trigger("sticky_kit:detach");
2204				window.scrollTo(0, 0);
2205			}
2206		});
2207	});
2208
2209	var checkVideoResize = function(){
2210		clearRequestTimeout(checkResize);
2211		checkResize = requestTimeout(function(){
2212			if ( newW !== UNCODE.wwidth ) {
2213				newW = UNCODE.wwidth;
2214				checkForVideos();
2215			}
2216		}, 1000);
2217	};
2218
2219	$(window).off('resize', checkVideoResize)
2220	.on( 'resize', checkVideoResize);
2221
2222};
2223
2224UNCODE.backgroundSelfVideos = function( $ctx ) {
2225
2226	var backgroundSelfVideosInit = function( $ctx ) {
2227		if ( SiteParameters.block_mobile_videos === true ) {
2228			return false;
2229		}
2230		if (typeof MediaElement === "function") {
2231			if ( typeof $ctx === 'undefined' ) {
2232				$ctx = document;
2233			}
2234		
2235			$(".background-video-shortcode", $ctx).each(function(index, el) {
2236				if ( $(this).closest('mediaelementwrapper').length ) {
2237					return true;
2238				}
2239				var $video_el = $(this),
2240					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2241					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2242					video_id = $video_el.attr('id');
2243
2244				if ( SiteParameters.is_frontend_editor ) {
2245					video_id = video_id + '_' + index;
2246					$video_el.attr('id', video_id);
2247				}
2248
2249				var media = new MediaElement(video_id, {
2250					startVolume: 0,
2251					loop: true,
2252					success: function(mediaElement, domObject) {
2253						domObject.volume = 0;
2254						$(mediaElement).data('started', false);
2255						mediaElement.addEventListener('timeupdate', function(e) {
2256							if (!$(e.target).data('started')) {
2257								$(mediaElement).data('started', true);
2258							}
2259						});
2260						mediaElement.addEventListener('loadedmetadata', function(e) {
2261							$('body').removeClass('video-not-supported');
2262							mediaElement.play();
2263						});
2264						if (!UNCODE.isMobile) {
2265							requestTimeout(function() {
2266								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2267							}, 100);
2268						}
2269						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2270							mediaElement.play();
2271						}
2272
2273						if ( $parent_drop_move.length ) {
2274							var setResizeMEto,
2275								resizeMediaElement = function(){
2276								var dataW = $parent_drop_move.attr('data-w'),
2277									videoW = domObject.width,
2278									videoH = domObject.height,
2279									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2280									newH = newW / ( videoW / videoH );
2281
2282								$(domObject).css({
2283									'height': newH,
2284									'width': newW
2285								});
2286							};
2287							$(window).on( 'resize load', function(){
2288								clearRequestTimeout(setResizeMEto);
2289								setResizeMEto = requestTimeout( function() {
2290									resizeMediaElement();
2291								}, 10 );
2292							});
2293						}
2294
2295						mediaElement.addEventListener('play', function() {
2296							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2297							$(mediaElement).closest('#page-header').addClass('video-started');
2298							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2299						}, true);
2300
2301					},
2302					// fires when a problem is detected
2303					error: function() {}
2304				});
2305			});
2306		} else {
2307
2308			if ( typeof $ctx === 'undefined' ) {
2309				$ctx = document;
2310			}
2311		
2312			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2313			Array.from(videos).forEach(function(video_el) {
2314				video_el.addEventListener('loadedmetadata', function(e) {
2315					$('body').removeClass('video-not-supported');
2316					video_el.play();
2317				});
2318				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2319					video_el.muted = true;
2320					video_el.loop = true;
2321					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2322					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2323					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2324					$('body').removeClass('video-not-supported');
2325					video_el.play();
2326				} else {
2327					requestTimeout(function(){
2328                         backgroundSelfVideosInit( $ctx );
2329					}, 1000);
2330				}
2331			});
2332		}
2333	};
2334
2335	backgroundSelfVideosInit( $ctx );
2336
2337	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2338		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2339			var $el = model.view.$el,
2340				shortcode = model.attributes.shortcode;
2341
2342			if (typeof MediaElement === "function") {
2343				backgroundSelfVideosInit( $el );
2344			} else {
2345				backgroundSelfVideosInit( $el[0] );
2346			}
2347		});
2348	}
2349};
2350
2351UNCODE.is_scrolling = false;
2352
2353UNCODE.disableHoverScroll = function() {
2354
2355	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor) {
2356		var body = document.body,
2357		timer;
2358
2359		window.addEventListener('scroll', function() {
2360			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2361			clearRequestTimeout(timer);
2362			if ( body.classList && !body.classList.contains('disable-hover') ) {
2363				body.classList.add('disable-hover');
2364				window.dispatchEvent(new CustomEvent('disable-hover'));
2365			}
2366			UNCODE.is_scrolling = true;
2367
2368			timer = requestTimeout(function() {
2369				if ( body.classList ) {
2370					body.classList.remove('disable-hover');
2371					window.dispatchEvent(new CustomEvent('enable-hover'));
2372				}
2373				UNCODE.is_scrolling = false;
2374			}, delay);
2375		}, false);
2376	}
2377};
2378
2379UNCODE.isotopeLayout = function() {
2380	if ($('.isotope-layout').length > 0) {
2381		var isotopeContainersArray = [],
2382			typeGridArray = [],
2383			layoutGridArray = [],
2384			screenLgArray = [],
2385			screenMdArray = [],
2386			screenSmArray = [],
2387			transitionDuration = [],
2388			$filterItems = [],
2389			$filters = $('.isotope-system .isotope-filters'),
2390			$itemSelector = '.tmb-iso',
2391			$items,
2392			itemMargin,
2393			correctionFactor = 0,
2394			firstLoad = true,
2395			isOriginLeft = $('body').hasClass('rtl') ? false : true;
2396		$('[class*="isotope-container"]').each(function(index) {
2397			var _this = $(this);
2398			var isoData = _this.data(),
2399			$data_lg,
2400			$data_md,
2401			$data_sm;
2402			_this.children('.tmb').addClass('tmb-iso');
2403			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
2404			else $data_lg = '1000';
2405			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
2406			else $data_md = '600';
2407			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
2408			else $data_sm = '480';
2409			screenLgArray.push($data_lg);
2410			screenMdArray.push($data_md);
2411			screenSmArray.push($data_sm);
2412			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
2413			if (isoData.type == 'metro') typeGridArray.push(true);
2414			else typeGridArray.push(false);
2415			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
2416			else layoutGridArray.push('masonry');
2417			isotopeContainersArray.push(_this);
2418			_this.attr('data-iso-index', index);
2419		});
2420		var colWidth = function(index) {
2421				$(isotopeContainersArray[index]).width('');
2422				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
2423					widthAvailable = $(isotopeContainersArray[index]).width(),
2424					columnNum = 12,
2425					columnWidth = 0,
2426					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
2427					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
2428					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
2429					$rowContainer,
2430					paddingRow,
2431					$colContainer,
2432					paddingCol;
2433
2434				if ( consider_menu )
2435					winHeight = winHeight - UNCODE.menuHeight;
2436
2437				if ( data_vp_height === '1' ) {
2438					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
2439					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
2440					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
2441					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
2442					winHeight = winHeight - ( paddingRow + paddingCol );
2443				}
2444
2445				if (isPx) {
2446					columnWidth = Math.ceil(widthAvailable / columnNum);
2447					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
2448				} else {
2449					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
2450				}
2451				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
2452				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
2453				for (var i = 0, len = $items.length; i < len; i++) {
2454					var $item = $($items[i]),
2455						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
2456						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
2457						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
2458
2459
2460					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
2461						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
2462					}
2463
2464					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
2465						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
2466					}
2467
2468					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
2469						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2470							switch (parseInt(multiplier_w[1])) {
2471								case (5):
2472								case (4):
2473								case (3):
2474									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2475									multiplier_w[1] = 6;
2476									break;
2477								case (2):
2478								case (1):
2479									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
2480									multiplier_w[1] = 3;
2481									break;
2482								default:
2483									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2484									multiplier_w[1] = 12;
2485									break;
2486							}
2487
2488							if (multiplier_w[1] == 2.4) { // 5 columns
2489								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2490								multiplier_w[1] = 6;
2491							}
2492						}
2493					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
2494						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2495							switch (parseInt(multiplier_w[1])) {
2496								case (5):
2497								case (4):
2498								case (3):
2499								case (2):
2500								case (1):
2501									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2502									multiplier_w[1] = 6;
2503									break;
2504								default:
2505									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2506									multiplier_w[1] = 12;
2507									break;
2508							}
2509
2510							if (multiplier_w[1] == 2.4) { // 5 columns
2511								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2512								multiplier_w[1] = 6;
2513							}
2514						}
2515					} else if (widthAvailable < screenSmArray[index]) {
2516						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2517							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2518							multiplier_w[1] = 12;
2519							if (typeGridArray[index]) multiplier_h[1] = 12;
2520						}
2521					}
2522					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
2523						height;
2524
2525					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
2526						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
2527						if ( widthAvailable < screenSmArray[index] ) {
2528							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
2529						}
2530					} else {
2531						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
2532					}
2533
2534					if (width >= widthAvailable) {
2535						$item.css({
2536							width: widthAvailable
2537						});
2538						if (typeGridArray[index]) {
2539							$item.children().add($item.find('.backimg')).css({
2540								height: height
2541							});
2542						}
2543					} else {
2544						$item.css({
2545							width: width
2546						});
2547						if (typeGridArray[index]) {
2548							$item.children().add($item.find('.backimg')).css({
2549								height: height
2550							});
2551						}
2552					}
2553				}
2554				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
2555					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
2556				} else {
2557					return columnWidth;
2558				}
2559			},
2560			init_isotope = function() {
2561				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
2562					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
2563						isotopeId = isotopeSystem.attr('id'),
2564						$layoutMode = layoutGridArray[i],
2565						setIsotopeFirstRowTimeOut,
2566					setIsotopeFirstRow = function(items){
2567						var firstRow = true;
2568						$(items).each(function(index, val){
2569							var el = items[index].element,
2570								el_top = items[index].position.y,
2571								$el = $(el);
2572							if ( index > 0 && el_top > 0 && firstRow ) {
2573								firstRow = false;
2574							} else if ( index == 0 && el_top == 0 ) {
2575								firstRow = true;
2576							}
2577							if ( firstRow ) {
2578								$el.removeClass('tmb-isotope-further-row');
2579							} else {
2580								$el.addClass('tmb-isotope-further-row');
2581							}
2582						});
2583					};
2584					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
2585						//resizable: true,
2586						itemSelector: $itemSelector,
2587						layoutMode: $layoutMode,
2588						transitionDuration: transitionDuration[i],
2589						masonry: {
2590							columnWidth: colWidth(i)
2591						},
2592						vertical: {
2593							horizontalAlignment: 0.5,
2594						},
2595						sortBy: 'original-order',
2596						isOriginLeft: isOriginLeft
2597					})
2598					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
2599					.on('layoutComplete', function( event, items ){
2600						if ( typeof items[0] !== 'undefined' ) {
2601							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2602								setIsotopeFirstRow(items);
2603							}
2604						}
2605					})
2606					.on('arrangeComplete', function( event, items ){
2607						if ( typeof items[0] !== 'undefined' ) {
2608							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2609								clearRequestTimeout(setIsotopeFirstRowTimeOut);
2610								setIsotopeFirstRowTimeOut = requestTimeout(function(){
2611									setIsotopeFirstRow(items);
2612								}, 100);
2613							}
2614						}
2615					});
2616					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
2617						$(isotopeContainersArray[i]).infinitescroll({
2618								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
2619								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
2620								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
2621								animate: false,
2622								behavior: 'local',
2623								debug: false,
2624								loading: {
2625									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
2626									speed: 0,
2627									finished: undefined,
2628									msg: $('#' + isotopeId + ' .loadmore-button'),
2629								},
2630								errorCallback: function() {
2631									var isotope_system = $(this).closest('.isotope-system');
2632									$('.loading-button', isotope_system).hide();
2633									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
2634								}
2635							},
2636							// append the new items to isotope on the infinitescroll callback function.
2637							function(newElements, opts) {
2638								var $isotope = $(this),
2639									isotope_system = $isotope.closest('.isotope-system'),
2640									isotopeId = isotope_system.attr('id'),
2641									filters = new Array(),
2642									$loading_button = isotope_system.find('.loading-button'),
2643									$infinite_button = isotope_system.find('.loadmore-button'),
2644									$numPages = $('a', $infinite_button).data('pages'),
2645									$woo_results,
2646									delay = 300;
2647								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
2648								$infinite_button.show();
2649								$loading_button.hide();
2650								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
2651								$('> li', $isotope).remove();
2652								$('.isotope-container').find('.woocommerce-result-count-wrapper').remove();
2653								$.each($(newElements), function (index, val) {
2654									if ($(val).hasClass('woocommerce-result-count-wrapper')) {
2655										$woo_results = $(val);
2656										delete newElements[index];
2657									} else {
2658										$(val).addClass('tmb-iso');
2659										if ($(val).is("li")) {
2660											filters.push($(val)[0]);
2661										}
2662									}
2663								});
2664								newElements = newElements.filter(function(x) {
2665									return filters.indexOf(x) < 0
2666								});
2667								$.each($(filters), function(index, val) {
2668									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
2669								});
2670								if ($woo_results && $woo_results.length > 0) {
2671									var old_count = isotope_system.find('.woocommerce-result-count').text();
2672									var new_count = $woo_results.find('.woocommerce-result-count').text();
2673									var old_start = old_count.match(/(\d+)–(\d+)/)[1];
2674									var new_end = new_count.match(/(\d+)–(\d+)/)[2];
2675									function replaceMatch(match, p1, p2) {
2676        								return old_start + '–' + new_end;
2677									}
2678									var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
2679									isotope_system.find('.woocommerce-result-count').text(new_count_text);
2680								}
2681								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
2682								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2683									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
2684									if (typeof getLightbox === 'object') {
2685										getLightbox.refresh();
2686									} else {
2687										UNCODE.lightbox();
2688									}
2689								}
2690								if ( typeof twttr !== 'undefined' )
2691									twttr.widgets.load(isotopeContainersArray[i]);
2692
2693								requestTimeout(function() {
2694									Waypoint.refreshAll();
2695									$isotope.trigger('more-items-loaded');
2696									$(window).trigger('more-items-loaded');
2697								}, 1000);
2698
2699							});
2700						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
2701							var $infinite_isotope = $(isotopeContainersArray[i]),
2702								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
2703							$infinite_isotope.infinitescroll('pause');
2704							$infinite_button.on('click', function(event) {
2705								event.preventDefault();
2706								var $infinite_system = $(event.target).closest('.isotope-system'),
2707								$infinite_isotope = $infinite_system.find('.isotope-container'),
2708								isotopeId = $infinite_system.attr('id');
2709								$(event.currentTarget).html(SiteParameters.loading);
2710								$infinite_isotope.infinitescroll('resume');
2711								$infinite_isotope.infinitescroll('retrieve');
2712								$infinite_isotope.infinitescroll('pause');
2713							});
2714						}
2715					}
2716				}
2717			},
2718			onLayout = function(isotopeObj, startIndex, needsReload) {
2719				var needsReload = needsReload ? true : false;
2720
2721				if (typeof UNCODE.bigText !== 'undefined') {
2722					UNCODE.bigText();
2723				}
2724				isotopeObj.css('opacity', 1);
2725				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
2726
2727				requestTimeout(function() {
2728					if (startIndex > 0) {
2729						reloadIsotope(isotopeObj);
2730						if (SiteParameters.dynamic_srcset_active === '1') {
2731							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2732							UNCODE.adaptive_srcset(isotopeObj);
2733						}
2734						// window.dispatchEvent(UNCODE.boxEvent);
2735					} else if (needsReload) {
2736						reloadIsotope(isotopeObj);
2737					}
2738
2739					UNCODE.adaptive();
2740					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
2741						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2742					}
2743					if (typeof MediaElement === "function") {
2744						$(isotopeObj).find('audio,video').each(function() {
2745							$(this).mediaelementplayer({
2746	 							pauseOtherPlayers: false,
2747							});
2748						});
2749					}
2750					if ($(isotopeObj).find('.nested-carousel').length) {
2751						if (typeof UNCODE.carousel !== 'undefined') {
2752							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
2753						}
2754						requestTimeout(function() {
2755							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2756						}, 200);
2757					} else {
2758						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2759					}
2760					isotopeObj.trigger('isotope-layout-complete');
2761
2762				}, 100);
2763
2764			},
2765			boxAnimation = function(items, startIndex, sequential, container) {
2766				var $allItems = items.length - startIndex,
2767					showed = 0,
2768					index = 0;
2769				if (container.closest('.owl-item').length == 1) return false;
2770				$.each(items, function(index, val) {
2771					var $this = $(val),
2772						elInner = $('> .t-inside', val);
2773					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
2774						return;
2775					}
2776					if (val[0]) val = val[0];
2777					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
2778						new Waypoint({
2779							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
2780							element: val,
2781							handler: function() {
2782								var element = $('> .t-inside', this.element),
2783									parent = $(this.element),
2784									currentIndex = parent.index();
2785								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
2786									delayAttr = parseInt(element.attr('data-delay'));
2787								if (isNaN(delayAttr)) delayAttr = 100;
2788								delay -= showed;
2789								var objTimeout = requestTimeout(function() {
2790									element.removeClass('zoom-reverse').addClass('start_animation');
2791									showed = parent.index();
2792									if ( container.data('isotope') ) {
2793										container.isotope('layout');
2794									}
2795								}, delay * delayAttr)
2796								parent.data('objTimeout', objTimeout);
2797								if (!UNCODE.isUnmodalOpen) {
2798									this.destroy();
2799								}
2800							},
2801							offset: '100%'
2802						})
2803					} else {
2804						if (elInner.hasClass('force-anim')) {
2805							elInner.addClass('start_animation');
2806						} else {
2807							elInner.css('opacity', 1);
2808						}
2809						container.isotope('layout');
2810					}
2811
2812					index++;
2813				});
2814			},
2815			reloadIsotope = function(isotopeObj) {
2816				var isoIndex = $(isotopeObj).attr('data-iso-index');
2817				var $layoutMode = ($(isotopeObj).data('layout'));
2818				if ($layoutMode === undefined) {
2819					$layoutMode = 'masonry';
2820				}
2821				if (isotopeObj.data('isotope')) {
2822					isotopeObj.isotope({
2823						itemSelector: $itemSelector,
2824						layoutMode: $layoutMode,
2825						transitionDuration: transitionDuration[isoIndex],
2826						masonry: {
2827							columnWidth: colWidth(isoIndex)
2828						},
2829						vertical: {
2830							horizontalAlignment: 0.5,
2831						},
2832						sortBy: 'original-order',
2833						isOriginLeft: isOriginLeft
2834					});
2835				}
2836			}
2837			;
2838		if ($('.isotope-pagination').length > 0) {
2839			$('.isotope-system').on('click', '.pagination a', function(evt) {
2840				evt.preventDefault();
2841
2842				if (SiteParameters.index_pagination_disable_scroll !== '1') {
2843					var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
2844						container = $(this).closest('.isotope-system'),
2845						calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
2846					calc_scroll -= UNCODE.get_scroll_offset();
2847
2848					var menu_container = $('.menu-sticky');
2849					var menu = menu_container.find('.menu-container');
2850
2851					if (menu_container.length > 0 && menu.length > 0) {
2852						calc_scroll = calc_scroll - menu.outerHeight();
2853					}
2854
2855					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2856						delta = bodyTop - calc_scroll,
2857						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
2858					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2859
2860					if (!UNCODE.isFullPage) {
2861						if (scrollSpeed == 0) {
2862							$('html, body').scrollTop(calc_scroll);
2863						} else {
2864							$('html, body').animate({
2865								scrollTop: calc_scroll
2866							}, {
2867								easing: 'easeInOutQuad',
2868								duration: scrollSpeed,
2869								complete: function () {
2870									UNCODE.scrolling = false;
2871								}
2872							});
2873						}
2874					}
2875				}
2876
2877				loadIsotope($(this), true);
2878			});
2879		}
2880		$filters.on('click', 'a.isotope-nav-link', function(evt) {
2881			if ($(this).hasClass('no-isotope-filter')) {
2882				return;
2883			}
2884			var $filter = $(this),
2885				filterContainer = $filter.closest('.isotope-filters'),
2886				filterValue = $filter.attr('data-filter'),
2887				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
2888				transitionDuration = container.data().isotope.options.transitionDuration,
2889				delay = 300,
2890				filterItems = [];
2891
2892			var filter_items = function(){
2893				if (filterValue !== undefined) {
2894					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2895						var parent = $(val).parent(),
2896							objTimeout = parent.data('objTimeout');
2897						if (objTimeout) {
2898							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2899							clearRequestTimeout(objTimeout);
2900						}
2901						if (transitionDuration == 0) {
2902							if ($(val).hasClass('animate_when_almost_visible')) {
2903								$(val).addClass('zoom-reverse').removeClass('start_animation');
2904							} else {
2905								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2906							}
2907						}
2908					});
2909					requestTimeout(function(){
2910						if ( filterValue == '*' ) {
2911							container.removeClass('isotope-filtered');
2912						} else {
2913							container.addClass('isotope-filtered');
2914						}
2915						container.isotope({
2916							filter: function() {
2917								var block = $(this),
2918								filterable = (filterValue == '*') || block.hasClass(filterValue),
2919								lightboxElements = $('[data-lbox^=ilightbox]', block);
2920								if (filterable) {
2921									if (lightboxElements.length) {
2922										lightboxElements.removeClass('lb-disabled');
2923										container.data('lbox', $(lightboxElements[0]).data('lbox'));
2924									}
2925									filterItems.push(block);
2926								} else {
2927									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
2928								}
2929								container.trigger('more-items-loaded');
2930								$(window).trigger('more-items-loaded');
2931								return filterable;
2932							}
2933						});
2934						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
2935
2936					}, delay);
2937
2938					/** once filtered - start **/
2939					container.isotope('once', 'arrangeComplete', function() {
2940						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2941							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
2942							if (typeof getLightbox === 'object') {
2943								getLightbox.refresh();
2944							} else {
2945								UNCODE.lightbox();
2946							}
2947						}
2948						if (transitionDuration == 0) {
2949							requestTimeout(function() {
2950								boxAnimation(filterItems, 0, false, container);
2951							}, 100);
2952						}
2953						requestTimeout(function() {
2954							Waypoint.refreshAll();
2955						}, 2000);
2956					});
2957					/** once filtered - end **/
2958				} else {
2959					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2960						$.each(UNCODE.lightboxArray, function(index, val) {
2961							UNCODE.lightboxArray[index].destroy();
2962						});
2963					}
2964					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2965						var parent = $(val).parent(),
2966							objTimeout = parent.data('objTimeout');
2967						if (objTimeout) {
2968							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2969							clearRequestTimeout(objTimeout);
2970						}
2971						if (transitionDuration == 0) {
2972							if ($(val).hasClass('animate_when_almost_visible')) {
2973								$(val).addClass('zoom-reverse').removeClass('start_animation');
2974							} else {
2975								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2976							}
2977						}
2978					});
2979					container.parent().addClass('grid-loading');
2980					loadIsotope($filter);
2981				}
2982			};
2983
2984			if (!$filter.hasClass('active')) {
2985				/** Scroll top with filtering */
2986				if (filterContainer.hasClass('filter-scroll')) {
2987                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
2988                    calc_scroll -= UNCODE.get_scroll_offset();
2989
2990					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2991						delta = bodyTop - calc_scroll,
2992						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
2993						filterTolerance = false,
2994						filter_timeout;
2995					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2996
2997					if ( !UNCODE.isFullPage ) {
2998						if (scrollSpeed == 0) {
2999							$('html, body').scrollTop(calc_scroll);
3000							UNCODE.scrolling = false;
3001							filter_items();
3002						} else {
3003
3004							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
3005								filter_items();
3006								filterTolerance = true;
3007							}
3008
3009							$('html, body').animate({
3010								scrollTop: calc_scroll
3011							},{
3012								easing: 'easeInOutQuad',
3013								duration: scrollSpeed,
3014								complete: function(){
3015									UNCODE.scrolling = false;
3016									if ( !filterTolerance ) {
3017										filter_timeout = setTimeout(function(){
3018											clearTimeout(filter_timeout);
3019											filter_items();
3020										}, 200);
3021									}
3022								}
3023							});
3024						}
3025					}
3026				} else {
3027					filter_items();
3028				}
3029			}
3030			evt.preventDefault();
3031		});
3032
3033		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
3034			var params = UNCODE.getURLParams(window.location);
3035			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
3036
3037			UNCODE.lastURL = window.location.href;
3038
3039			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
3040				return;
3041			}
3042
3043			if (params.id === undefined) {
3044				$.each($('.isotope-system'), function(index, val) {
3045					loadIsotope($(val));
3046				});
3047			} else {
3048				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
3049					loadIsotope($('#' + params.id));
3050				}
3051			}
3052		});
3053
3054		var loadIsotope = function($href, $paginating) {
3055			var is_paginating = false;
3056
3057			if (undefined !== $paginating && $paginating) {
3058				var is_paginating = $paginating;
3059			}
3060
3061			var href = ($href.is("a") ? $href.attr('href') : location),
3062				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
3063				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
3064				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
3065				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
3066				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
3067				isotopeId = isotopeSystem.attr('id');
3068			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
3069				UNCODE.lastURL = href;
3070				history.pushState({
3071					myIsotope: true
3072				}, document.title, href);
3073			}
3074			if (is_paginating) {
3075				isotopeWrapper.addClass('grid-filtering');
3076			}
3077			$.ajax({
3078				url: href
3079			}).done(function(data) {
3080				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
3081					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
3082					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
3083				isotopeWrapper.addClass('isotope-reloaded');
3084				requestTimeout(function() {
3085					isotopeWrapper.removeClass('grid-loading');
3086					isotopeWrapper.removeClass('isotope-reloaded');
3087					isotopeWrapper.removeClass('grid-filtering');
3088				}, 500);
3089				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
3090					var parent = $(val).parent(),
3091						objTimeout = parent.data('objTimeout');
3092					if (objTimeout) {
3093						$(val).removeClass('zoom-reverse').removeClass('start_animation')
3094						clearRequestTimeout(objTimeout);
3095					}
3096					if ($(val).hasClass('animate_when_almost_visible')) {
3097						$(val).addClass('zoom-reverse').removeClass('start_animation');
3098					} else {
3099						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
3100					}
3101				});
3102				requestTimeout(function() {
3103					if (isotopeContainer.data('isotope')) {
3104						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
3105						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
3106						UNCODE.adaptive();
3107						if (SiteParameters.dynamic_srcset_active === '1') {
3108							UNCODE.adaptive_srcset(isotopeContainer);
3109						}
3110						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
3111							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3112							if (typeof getLightbox === 'object') {
3113								getLightbox.refresh();
3114							} else {
3115								UNCODE.lightbox();
3116							}
3117						}
3118					}
3119					isotopeContainer.trigger('more-items-loaded');
3120					$(window).trigger('more-items-loaded');
3121				}, 300);
3122				$('.pagination', isotopeFooter).remove();
3123				isotopeFooter.append($resultPagination);
3124
3125				if (isotopeResultCount.length > 0) {
3126					$('.woocommerce-result-count', isotopeResultCount).remove();
3127					isotopeResultCount.append($resultCount);
3128				}
3129			});
3130		};
3131		$filters.each(function(i, buttonGroup) {
3132			var $buttonGroup = $(buttonGroup);
3133			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3134				$buttonGroup.find('.active').removeClass('active');
3135				$(this).addClass('active');
3136
3137			});
3138
3139			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3140				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3141				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3142			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3143				e.preventDefault();
3144				$cats_filters.slideToggle(400, 'easeInOutCirc');
3145			});
3146
3147		});
3148		window.addEventListener('boxResized', function(e) {
3149			if (UNCODE.printDialogOpen !== false) {
3150				return false;
3151			}
3152			$.each($('.isotope-layout'), function(index, val) {
3153				var $layoutMode = ($(this).data('layout'));
3154				if ($layoutMode === undefined) $layoutMode = 'masonry';
3155				if ($(this).data('isotope')) {
3156					$(this).isotope({
3157						itemSelector: $itemSelector,
3158						layoutMode: $layoutMode,
3159						transitionDuration: transitionDuration[index],
3160						masonry: {
3161							columnWidth: colWidth(index)
3162						},
3163						vertical: {
3164							horizontalAlignment: 0.5,
3165						},
3166						sortBy: 'original-order',
3167						isOriginLeft: isOriginLeft
3168					});
3169					$(this).isotope('unbindResize');
3170					if (SiteParameters.dynamic_srcset_active === '1') {
3171						UNCODE.refresh_dynamic_srcset_size($(this));
3172					}
3173				}
3174				$(this).find('.mejs-video,.mejs-audio').each(function() {
3175					$(this).trigger('resize');
3176				});
3177			});
3178		}, false);
3179
3180		init_isotope();
3181	};
3182}
3183
3184UNCODE.lightbox = function() {
3185	if ( SiteParameters.lbox_enhanced ) {
3186		return true;
3187	}
3188	UNCODE.lightboxArray = {};
3189	requestTimeout(function() {
3190		var groupsArr = {};
3191		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3192			var group = this.getAttribute("data-lbox"),
3193				values = $(this).data();
3194			$(this).attr('data-lbox-init','true')
3195			groupsArr[group] = values;
3196		});
3197		for (var i in groupsArr) {
3198			var skin = groupsArr[i].skin || 'black',
3199				path = groupsArr[i].dir || 'horizontal',
3200				thumbs = !groupsArr[i].notmb || false,
3201				arrows = !groupsArr[i].noarr || false,
3202				social = groupsArr[i].social || false,
3203				deeplink = groupsArr[i].deep || false,
3204				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3205				counter = $els.length,
3206				dataAlbum = $els.attr('data-album');
3207			if (social) social = {
3208				facebook: true,
3209				twitter: true,
3210				reddit: true,
3211				digg: true
3212			};
3213			UNCODE.lightboxArray[i] = $els.iLightBox({
3214				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3215				skin: skin,
3216				path: path,
3217				linkId: deeplink,
3218				infinite: false,
3219				//fullViewPort: 'fit',
3220				smartRecognition: false,
3221				fullAlone: true,
3222				maxScale: 1,
3223				minScale: .02,
3224				//fullStretchTypes: 'flash, video',
3225				overlay: {
3226					opacity: .94
3227				},
3228				controls: {
3229					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3230					fullscreen: true,
3231					thumbnail: thumbs,
3232					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3233				},
3234				show: {
3235					speed: 200
3236				},
3237				hide: {
3238					speed: 200
3239				},
3240				social: {
3241					start: false,
3242					buttons: social
3243				},
3244				caption: {
3245					start: false
3246				},
3247				styles: {
3248					nextOpacity: 1,
3249					nextScale: 1,
3250					prevOpacity: 1,
3251					prevScale: 1
3252				},
3253				effects: {
3254					switchSpeed: 400
3255				},
3256				slideshow: {
3257					pauseTime: 5000
3258				},
3259				thumbnails: {
3260					maxWidth: 60,
3261					maxHeight: 60,
3262					activeOpacity: .2
3263				},
3264				html5video: {
3265					preload: true
3266				},
3267				callback: {
3268					onOpen: function(){
3269						$(window).trigger('uncode-custom-cursor');
3270						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3271							iNoBounce.enable();
3272						}
3273					},
3274					onHide: function(){
3275						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3276							iNoBounce.disable()
3277						}
3278					},
3279				}
3280			});
3281
3282			$(document).on('infinite-loaded', function(){
3283				UNCODE.lightboxArray[i].refresh();
3284			});
3285
3286			$(window).on('gdprOpen', function(){
3287				UNCODE.lightboxArray[i].close();
3288			});
3289		};
3290	}, 100);
3291
3292	$(document).on('click', '.lb-disabled', function(e){
3293		e.preventDefault();
3294	});
3295};
3296
3297UNCODE.lightgallery = function( $el ) {
3298	var createSelectors = function(){
3299		$('a[data-lbox]:not([data-lbox-init]):not([data-album])').each(function(){
3300			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3301				$(this).addClass('lbox-trigger-item');
3302			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3303				$(this).addClass('lbox-nested-item');
3304			} else {
3305				$(this).removeClass('lbox-trigger-item');
3306				$(this).removeClass('lbox-nested-item');
3307			}
3308		});
3309	};
3310
3311	createSelectors();
3312
3313	var galleries = [],
3314		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3315			return !$(this).closest('.nested-carousel').length;
3316		}),
3317		$_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]), .btn-container').has('.lbox-trigger-item').not('.isotope-container *, .owl-carousel *, .index-scroll-wrapper *, .justified-gallery *, .woocommerce-product-gallery *, .grid-container *'),
3318		$galleries = $_galleries.filter(function( index ) {
3319			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3320		}),
3321		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3322
3323	if ( typeof $el === 'undefined' ) {
3324		$el = $galleries.add( $nested );
3325	}
3326
3327	var $disabled = $('a.lb-disabled');
3328	$disabled.on('click', function(e){
3329		e.preventDefault();
3330	});
3331
3332	var beforeSlide = function(event) {
3333		var detail = event.detail,
3334			info = detail.info,
3335			item = detail.item,
3336			$slide = $(detail.currentSlide.selector),
3337			$video = $('video', $slide),
3338			$previous = $(detail.previousSlide.selector),
3339			$prevVideo = $('video', $previous),
3340			isAudio = false;
3341
3342		if ( typeof info.src !== 'undefined' ) {
3343			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3344		}
3345
3346		if ( ! $video.length && ( info.video || isAudio ) ) {
3347			if ( info.video ) {
3348				if ( typeof info.video === 'object' ) {
3349					var infoJson = info.video;
3350				} else {
3351					var infoJson = JSON.parse(info.video);
3352				}
3353				var src = infoJson.source[0].src,
3354					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3355					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3356					loop = $(item).attr('data-loop');
3357
3358			} else if ( isAudio ) {
3359				var src = info.src,
3360					autoplay = true,
3361					loop = false;
3362			}
3363			if ( typeof src !== 'undefined' ) {
3364				$slide.addClass('has-html5');
3365				var video = document.createElement('video');
3366				video.src = src;
3367				video.preload = 'auto';
3368				video.controls = 'controls';
3369				video.controlsList = 'nodownload';
3370				if ( autoplay ) {
3371					video.autoplay = 'autoplay';
3372				}
3373				if ( muted ) {
3374					video.muted = 'muted';
3375				}
3376				if ( loop ) {
3377					video.loop = 'loop';
3378				}
3379				$(video).appendTo($slide);
3380			}
3381		} else {
3382			var $video = $('video', $slide);
3383			if ( $video.length ) {
3384				$video[0].currentTime = 0;
3385				if ( $video[0].autoplay ) {
3386					$video[0].play();
3387				}
3388			}
3389		}
3390		if ( $prevVideo.length ) {
3391			$prevVideo[0].currentTime = 0;
3392			$prevVideo[0].pause();
3393		}
3394	};
3395
3396	var beforeOpen = function(event) {
3397		var detail = event.detail,
3398			items = detail.items,
3399			galleryItems = detail.galleryItems,
3400			outer = detail.outer.selector,
3401			i, ii;
3402		for ( i = 0; i < galleryItems.length; i++ ) {
3403			var item = galleryItems[i];
3404			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
3405				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
3406			}
3407		}
3408		for ( ii = 0; ii < items.length; ii++ ) {
3409			var item = items[ii];
3410			if ( $(item).attr('data-icon') === 'video' ) {
3411				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
3412			}
3413		}
3414
3415	};
3416
3417	//caption builder
3418	var captionBuilder = function($el){
3419		$el.each( function( index, val ) {
3420			var $gallery = $(this).attr('data-lbox-init','true'),
3421				$_a = '.lbox-trigger-item',
3422				$_nested_a = '.lbox-nested-item';
3423
3424			$gallery.find($_a, $_nested_a).each(function(){
3425				var $a = $(this),
3426					$img = $('img', $a).first(),
3427					imgw = $img.attr('data-width'),
3428					imgh = $img.attr('data-height'),
3429					caption = $a.attr('data-caption'),
3430					title = $a.attr('data-title');
3431
3432				if ( $img.length && $img.attr('data-crop') != true ) {
3433					if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
3434						$a.attr('data-external-thumb-image', $img.attr('data-guid'));
3435					} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
3436						$a.attr('data-external-thumb-image', $img[0].src);
3437					}
3438				}
3439
3440				if ( typeof title !== 'undefined' && title !== '' ) {
3441					title = '<h6>' + title + '</h6>';
3442				} else {
3443					title = '';
3444				}
3445
3446				if ( typeof caption !== 'undefined' && caption !== '' ) {
3447					caption = '<p>' + caption + '</p>';
3448					title += caption;
3449				}
3450
3451				if ( title !== '' ) {
3452					$a.attr( 'title', title );
3453				}
3454
3455				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') ) ) {
3456					$a.attr('data-lg-size', imgw + '-' + imgh);
3457				}
3458			});
3459		});
3460	};
3461	captionBuilder($el);
3462
3463	//regular galleries
3464	$el.each( function( index, val ) {
3465		var $gallery = $(this),
3466			$_a = '.lbox-trigger-item',
3467			$_nested_a = '.lbox-nested-item',
3468			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
3469			galleryID = $_first.attr('data-lbox'),
3470			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
3471			tmb = $_first.attr('data-notmb'),
3472			social = $_first.attr('data-social'),
3473			deep = $_first.attr('data-deep'),
3474			zoom = $_first.attr('data-zoom-origin'),
3475			actual = $_first.attr('data-actual-size'),
3476			download = $_first.attr('data-download'),
3477			controls = $_first.attr('data-arrows') !== 'no',
3478			fullScreen = $_first.attr('data-full'),
3479			counter = $_first.attr('data-counter'),
3480			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
3481			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3482			connect = $_first.attr('data-connect'),
3483			lgPlugins = [lgVideo],
3484			itemsLoadedTimeOut;
3485
3486		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3487		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3488
3489		if ( typeof tmb == 'undefined' || !tmb ) {
3490			lgPlugins.push(lgThumbnail);
3491		}
3492		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
3493			lgPlugins.push(lgZoom);
3494		}
3495		if ( typeof deep != 'undefined' && deep != '' ) {
3496			lgPlugins.push(lgHash);
3497		}
3498		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3499			lgPlugins.push(lgFullscreen);
3500		}
3501		if ( social ) {
3502			lgPlugins.push(lgShare);
3503		}
3504
3505		if ( galleries.indexOf( galleryID ) !== -1 ) {
3506			return true;
3507		}
3508
3509		galleries.push( galleryID );
3510		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
3511			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
3512		var gallery = lightGallery( $triggerGal[0], {
3513			addClass: containerClass,
3514			plugins: lgPlugins,
3515			mode: transition,
3516			selector: $selector,
3517			galleryId: galleryID,
3518			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3519			iframeWidth: '848px',
3520			iframeMaxWidth: '90%',
3521			iframeMaxHeight: '90%',
3522			exThumbImage: 'data-external-thumb-image',
3523			loadYouTubeThumbnail: false,
3524			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ),
3525			// autoplayFirstVideo: false,
3526			pager: false,
3527			startClass: 'lg-start-opacity',
3528			zoomFromOrigin: zoom,
3529			controls: controls,
3530			download: ( typeof download != 'undefined' && download != '' ),
3531			thumbWidth: 50,
3532			thumbHeight: '50px',
3533			counter: $triggerGal.find($selector).length > 1 ? counter : false,
3534			loadYouTubePoster: false,
3535			enableDrag: $triggerGal.find($selector).length > 1,
3536			mobileSettings: {
3537				showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3538			},
3539		});
3540
3541		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
3542			e.preventDefault();
3543			var index = $(this).closest('.owl-item.cloned').attr('data-index');
3544			gallery.openGallery(index-1);
3545		});
3546
3547		clearRequestTimeout(itemsLoadedTimeOut);
3548		$triggerGal.on('more-items-loaded', function(e, items) {
3549			itemsLoadedTimeOut = requestTimeout(function(){
3550				createSelectors();
3551				captionBuilder($triggerGal);
3552				gallery.refresh();
3553			}, 100);
3554		});
3555
3556		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3557			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3558				$el = model.view.$el;
3559				if ( $el.find($triggerGal).length ) {
3560					gallery.destroy();
3561				}
3562			});
3563		}
3564
3565		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
3566		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
3567		$triggerGal[0].addEventListener('lgAfterOpen', function(){
3568			$(window).trigger('uncode-custom-cursor');
3569		});
3570
3571	});
3572
3573	if ( typeof $el !== 'undefined' ) {
3574
3575		//album galleries
3576		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
3577			var album = val,
3578				galleryID = index,
3579				$album = $(album),
3580				params = $album.attr('data-album'),
3581				tmb = $(val).attr('data-notmb'),
3582				social = $(val).attr('data-social'),
3583				deep = $(val).attr('data-deep'),
3584				actual = $(val).attr('data-actual-size'),
3585				download = $(val).attr('data-download'),
3586				controls = $(val).attr('data-arrows') !== 'no',
3587				fullScreen = $(val).attr('data-full'),
3588				counter = $(val).attr('data-counter'),
3589				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
3590				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3591				lgPlugins = [lgVideo];
3592
3593			$(val).attr('data-lbox-init','true');
3594
3595			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3596			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3597
3598			if ( typeof tmb == 'undefined' || !tmb ) {
3599				lgPlugins.push(lgThumbnail);
3600			}
3601			if ( typeof actual != 'undefined' && actual != '' ) {
3602				lgPlugins.push(lgZoom);
3603			}
3604			if ( typeof deep != 'undefined' && deep != '' ) {
3605				lgPlugins.push(lgHash);
3606			}
3607			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3608				lgPlugins.push(lgFullscreen);
3609			}
3610			if ( social ) {
3611				lgPlugins.push(lgShare);
3612			}
3613
3614			var gallery = window.lightGallery(album, {
3615				dynamic: true,
3616				plugins: lgPlugins,
3617				dynamicEl: JSON.parse(params),
3618				galleryId: galleryID,
3619				addClass: containerClass,
3620				mode: transition,
3621				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3622				iframeWidth: '848px',
3623				iframeMaxWidth: '90%',
3624				iframeMaxHeight: '90%',
3625				loadYouTubeThumbnail: false,
3626				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
3627				// autoplayFirstVideo: false,
3628				pager: false,
3629				startClass: 'lg-start-opacity',
3630				zoomFromOrigin: false,
3631				controls: controls,
3632				download: ( typeof download != 'undefined' && download != '' ),
3633				thumbWidth: 50,
3634				thumbHeight: '50px',
3635				loadYouTubePoster: false,
3636				counter: counter,
3637				exThumbImage: 'data-external-thumb-image',
3638				loadYouTubePoster: false,
3639				mobileSettings: {
3640					showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true,
3641				},
3642			});
3643
3644			$album.on('click', function(){
3645				gallery.openGallery(0);
3646			});
3647
3648			album.addEventListener('lgBeforeSlide', beforeSlide);
3649			album.addEventListener('lgBeforeOpen', beforeOpen);
3650			album.addEventListener('lgAfterOpen', function(){
3651				$(window).trigger('uncode-custom-cursor');
3652			});
3653
3654			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3655				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3656					$el = model.view.$el;
3657					if ( $el.find($album).length ) {
3658						gallery.destroy();
3659					}
3660				});
3661			}
3662
3663		});
3664
3665		//single images
3666		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
3667			var gallery = lightGallery( $('.page-wrapper')[0], {
3668				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
3669				iframeWidth: '848px',
3670				iframeMaxWidth: '90%',
3671				iframeMaxHeight: '90%',
3672				loadYouTubeThumbnail: false,
3673				// autoplayFirstVideo: false,
3674				startClass: 'lg-start-opacity',
3675				thumbWidth: 50,
3676				thumbHeight: '50px',
3677				download: false,
3678				loadYouTubePoster: false,
3679				counter: false
3680			});
3681
3682			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
3683			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
3684		});
3685	}
3686
3687	var onGalleryEsc = function(e){
3688		if (e.keyCode === 27 || e.key === 'Escape' || e.keyCode === 90 || e.key === 'z') {
3689			if (document.fullscreenElement) {
3690				document.exitFullscreen()
3691			} else {
3692				document.documentElement.requestFullscreen();
3693			}
3694		}
3695	};
3696	window.addEventListener('keydown', onGalleryEsc, { once: true });
3697
3698	$(document).on(
3699		'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange',
3700		function(e){
3701			if ( e.target.tagName === 'IFRAME' ) {
3702				window.addEventListener('keydown', onGalleryEsc, { once: true });
3703			}
3704		}
3705	);
3706};
3707
3708UNCODE.carousel = function(container) {
3709	var $owlContainers = $('.owl-carousel-container', container);
3710	$owlContainers.each(function() {
3711		var $owlContainer = $(this),
3712			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
3713			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
3714			values = {},
3715			tempTimeStamp,
3716			newWidth = UNCODE.wwidth,
3717			$owlInsideEqual = [];
3718		$owlSelector.each(function() {
3719			var itemID = $(this).attr('id'),
3720				$elSelector = $(('#' + itemID).toString());
3721			values['id'] = itemID;
3722			values['items'] = 1;
3723			values['columns'] = 3;
3724			values['fade'] = false;
3725			values['nav'] = false;
3726			values['navmobile'] = false;
3727			values['navskin'] = 'light';
3728			values['navspeed'] = 400;
3729			values['dots'] = false;
3730			values['dotsmobile'] = false;
3731			values['loop'] = false;
3732			values['autoplay'] = false;
3733			values['timeout'] = 3000;
3734			values['autoheight'] = false;
3735			values['stagepadding'] = 0;
3736			values['margin'] = 0;
3737			values['lg'] = 1;
3738			values['md'] = 1;
3739			values['sm'] = 1;
3740			$.each($(this).data(), function(i, v) {
3741				values[i] = v;
3742			});
3743
3744			if ($(this).closest('.uncode-slider').length) {
3745				values['navskin'] = '';
3746				values['navmobile'] = false;
3747				//values['dotsmobile'] = true;
3748			} else {
3749				values['navskin'] = ' style-'+values['navskin']+' style-override';
3750			}
3751
3752			var setIndexActive = function(event, init){
3753				var init = typeof init === 'undefined' ? false : init,
3754					thiis = $(event.currentTarget);
3755				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
3756					var scrolltop = $(document).scrollTop(),
3757						size = event.page.size,
3758						i;
3759					var setIndex = requestTimeout(function() {
3760						for ( i = 0; i < size; i++ ) {
3761							var itemCont = event.item.index != null ? (event.item.index + i) : i;
3762							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
3763							if (thiis.closest('.row-slider').length) {
3764								if (currentItem == undefined) {
3765									currentItem = thiis.children()[i];
3766								}
3767								if ($(currentItem).closest('#page-header').length) {
3768									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
3769										UNCODE.switchColorsMenu(scrolltop, 'dark');
3770									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
3771										UNCODE.switchColorsMenu(scrolltop, 'light');
3772									}
3773								}
3774								var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit');
3775								if (owlCustomNav.length) {
3776									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
3777										owlCustomNav.addClass('style-dark').removeClass('style-light');
3778									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
3779										owlCustomNav.addClass('style-light').removeClass('style-dark');
3780									}
3781								}
3782							}
3783							var itendIndex = $(currentItem).attr('data-index');
3784							if ( isNaN(itendIndex) ) {
3785								itendIndex = 1;
3786							}
3787							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
3788							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
3789							if ($.fn.counterUp) {
3790								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
3791									var $counter = $(this);
3792									$counter.addClass('started').counterUp({
3793										delay: 10,
3794										time: 1500
3795									});
3796								});
3797							}
3798						}
3799						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
3800					}, 200);
3801				}
3802				tempTimeStamp = event.timeStamp;
3803			}
3804
3805			/** Initialize */
3806			$elSelector.on('initialize.owl.carousel', function(event) {
3807				if (typeof UNCODE.owlNav !== 'undefined') {
3808					UNCODE.owlNav(itemID, event);
3809				}
3810
3811				if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3812					window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) {
3813						var shortcode = model.attributes.shortcode,
3814							$el = model.view.$el,
3815							$row_wrap = $el.closest('.row');
3816						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
3817							$row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove();
3818						}
3819					});
3820					window.parent.vc.events.on('shortcodeView:updated', function(model) {
3821						var shortcode = model.attributes.shortcode;
3822						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
3823							tempTimeStamp = Math.floor(Date.now() / 1000);
3824						}
3825					});
3826					window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) {
3827						var shortcode = model.attributes.shortcode;
3828						if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') {
3829							UNCODE.owlNav(itemID, event);
3830							$elSelector.trigger('refresh.owl.carousel');
3831						}
3832					});
3833				}
3834			});
3835
3836			/** Initialized */
3837			$elSelector.on('initialized.owl.carousel', function(event) {
3838
3839				if ( $('.isotope-container', event.currentTarget).length ) {
3840					window.dispatchEvent(UNCODE.boxEvent);
3841				}
3842
3843				$('.owl-dot.active', $elSelector).on('click', function(){
3844					return false;
3845				});
3846
3847				var thiis = $(event.currentTarget),
3848					// get the time from the data method
3849					time = thiis.data("timer-id"),
3850					rowParent = thiis.closest('.row-parent');
3851
3852				if ( typeof rowParent[0] !== 'undefined' ) {
3853					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
3854				}
3855
3856				if (time) {
3857					clearRequestTimeout(time);
3858				}
3859
3860				thiis.addClass('showControls');
3861				var new_time = requestTimeout(function() {
3862					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
3863					if (thiis.hasClass('owl-height-viewport'))
3864						setItemsRelHeight(thiis);
3865					if (thiis.hasClass('owl-height-equal'))
3866						setItemsHeight(thiis);
3867					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
3868					if (thiis.closest('.unequal, .unexpand').length) {
3869						UNCODE.setRowHeight(rowParent[0], true);
3870					}
3871					if (SiteParameters.dynamic_srcset_active === '1') {
3872						UNCODE.refresh_dynamic_srcset_size(thiis);
3873					}
3874				}, 350);
3875				// save the new time
3876				thiis.data("timer-id", new_time);
3877
3878				var scrolltop = $(document).scrollTop();
3879				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
3880
3881				//if (!UNCODE.isMobile) {
3882					/** fix autoplay when visible **/
3883				$(window).on('load', function(){
3884					if (thiis.data('autoplay')) {
3885						if ( !thiis.closest('.sticky-element').length ) {
3886							thiis.trigger('stop.autoplay.owl');
3887						} else {
3888							thiis.trigger('play.owl.autoplay');
3889						}
3890					}
3891					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
3892						return;
3893					}
3894					if ( ! thiis.closest('.sticky-element').length ) {
3895						var carouselInView = new Waypoint.Inview({
3896							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3897							element: thiis[0],
3898							exited: function() {
3899								var el = $(this.element);
3900								if (el.data('autoplay') ) {
3901									el.trigger('stop.owl.autoplay');
3902									el.data('stopped','true');
3903								}
3904							},
3905							enter: function(direction) {
3906								var el = $(this.element);
3907								requestTimeout(function() {
3908									if (el.data('autoplay')) {
3909										el.trigger('play.owl.autoplay');
3910										el.data('stopped','false');
3911									}
3912								}, 100);
3913							}
3914						});
3915					}
3916				});
3917				//}
3918
3919				// $(window).on('frontend:carousel_updated', function(){
3920				// 	Waypoint.refreshAll();
3921				// });
3922
3923				if (!thiis.closest('.isotope-system').length) {
3924					requestTimeout(function() {
3925						animate_thumb($('.t-inside', el), event);
3926					}, 400);
3927				} else {
3928					requestTimeout(function() {
3929						thiis.closest('.isotope-container').isotope('layout');
3930					}, 400);
3931				}
3932
3933				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
3934				currentIndex = $(currentItem).attr('data-index');
3935
3936				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
3937					if ($(val).closest('.uncode-slider').length) {
3938						$(val).removeClass('start_animation');
3939					}
3940				});
3941				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
3942					if ($(val).closest('.uncode-slider').length) {
3943						$(val).removeClass('already-animated');
3944					}
3945				});
3946
3947				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
3948					if ($(val).closest('.uncode-slider').length) {
3949						$(val).removeAttr('data-animated');
3950					}
3951				});
3952
3953				$.each($('.owl-item.cloned', thiis), function(index, val) {
3954					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
3955				});
3956
3957				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
3958					if ($(val).attr('data-index') != currentIndex) {
3959						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
3960						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
3961					}
3962					if ($(val).attr('data-index') != currentIndex) {
3963						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
3964					}
3965					if ($(val).attr('data-index') == currentIndex) {
3966						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
3967					}
3968				});
3969
3970				if (thiis.closest('.uncode-slider').length) {
3971					var el = thiis.closest('.row-parent')[0];
3972					if ($(el).data('imgready')) {
3973						firstLoaded(el, event);
3974					} else {
3975						el.addEventListener("imgLoaded", function(el) {
3976							firstLoaded(el.target, event);
3977						}, false);
3978					}
3979					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
3980					if (transHeight != null) {
3981						requestTimeout(function() {
3982							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
3983						}, 100);
3984					}
3985				} else {
3986					var el = thiis;
3987					el.closest('.uncode-slider').addClass('slider-loaded');
3988				}
3989
3990				requestTimeout(function() {
3991					if (typeof UNCODE.bigText !== 'undefined') {
3992						UNCODE.bigText(thiis);
3993					}
3994					if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) {
3995						if (thiis.data('autoplay')) pauseOnHover(thiis);
3996					}
3997				}, 500);
3998
3999				if (thiis.closest('.unequal').length) {
4000					$owlInsideEqual.push(thiis.closest('.row-parent'));
4001				}
4002
4003				var containerClasses = '',
4004					containerStyle = '';
4005				if ( $('.owl-dots-classes', $owlContainer).length ) {
4006					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
4007					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
4008					$('.owl-dots-classes', $owlContainer).remove();
4009				}
4010
4011				if ( containerClasses !== '' ) {
4012					requestTimeout(function() {
4013						if ( containerClasses !== '' )
4014							$('.owl-dots', $owlContainer).attr('style', containerStyle);
4015						if ( containerStyle !== '' )
4016							$('.owl-dots', $owlContainer).addClass(containerClasses);
4017					}, 100);
4018				}
4019
4020				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
4021					$(val).closest('.row-inner').css({
4022						'margin-top': '-1px'
4023					});
4024				});
4025
4026				if ($.fn.isotope) {
4027					if ( thiis.closest('.isotope-container').length ) {
4028						if (thiis.closest('.isotope-container').data('isotope')) {
4029							requestTimeout(function(){
4030								thiis.closest('.isotope-container').isotope('layout');
4031							}, 300);
4032						}
4033						$(window).on('load', function(){
4034							if (thiis.closest('.isotope-container').data('isotope')) {
4035								thiis.closest('.isotope-container').isotope('layout');
4036							}
4037						});
4038					}
4039				}
4040
4041				if (thiis.data('autoplay')) {
4042					$(window).on('menuOpen', function(){
4043						thiis.trigger('stop.owl.autoplay');
4044						thiis.data('stopped','true');
4045					}).on('menuClose', function(){
4046
4047					});
4048				}
4049				$(window).on('menuClose', function(){
4050					if (thiis.data('autoplay')) {
4051						thiis.trigger('play.owl.autoplay');
4052						thiis.data('stopped','false');
4053					}
4054				});
4055
4056				setIndexActive(event, true);
4057
4058				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
4059						return !$(this).closest('.nested-carousel').length;
4060					}),
4061					$_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),
4062					$galleries = $_galleries.filter(function( index ) {
4063						return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
4064					});
4065
4066				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
4067					UNCODE.lightgallery( $galleries );
4068				}
4069
4070
4071			});
4072
4073			$elSelector.on('resized.owl.carousel', function(event) {
4074				var thiis = $(event.currentTarget);
4075				// if ($(this).closest('.nested-carousel').length) {
4076				// 	requestTimeout(function() {
4077				// 		window.dispatchEvent(UNCODE.boxEvent);
4078				// 	}, 200);
4079				// }
4080				if ( thiis.hasClass('owl-height-equal') )
4081					setItemsHeight(thiis);
4082
4083				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4084					newWidth = UNCODE.wwidth;
4085					setItemsRelHeight($elSelector);
4086				}
4087
4088				setIndexActive(event);
4089
4090				if (SiteParameters.dynamic_srcset_active === '1') {
4091					UNCODE.refresh_dynamic_srcset_size(thiis);
4092				}
4093
4094				if ($.fn.isotope) {
4095					$(window).on('load', function(){
4096						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
4097							$(event.currentTarget).closest('.isotope-container').isotope('layout');
4098						}
4099					});
4100				}
4101			});
4102
4103			$elSelector.on('refreshed.owl.carousel', function(event) {
4104				setIndexActive(event);
4105			});
4106
4107			/** detect resize window for fluid height layout */
4108			var setFluidResize;
4109			function manageFluidCarouseHeight() {
4110				clearRequestTimeout(setFluidResize);
4111				setFluidResize = requestTimeout(function(){
4112					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
4113						newWidth = UNCODE.wwidth;
4114						setItemsRelHeight($elSelector);
4115					}
4116				}, 100);
4117			}
4118			window.addEventListener('resize', manageFluidCarouseHeight);
4119
4120			/** Change */
4121			$elSelector.on('change.owl.carousel', function(event) {
4122				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
4123			});
4124
4125			/** Changed */
4126			$elSelector.on('changed.owl.carousel', function(event) {
4127				var $row = $elSelector.parents('.row')[0];
4128				if ( typeof $row !== 'undefined' ) {
4129					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
4130				}
4131				setIndexActive(event);
4132			});
4133
4134			var checkDrag = function(e) {
4135				$elSelector.addClass('owl-dragging');
4136			};
4137			$elSelector.on('drag.owl.carousel', function(event) {
4138				document.addEventListener("mousemove", checkDrag);
4139			});
4140
4141			$elSelector.on('dragged.owl.carousel', function(event) {
4142				$elSelector.removeClass('owl-dragging');
4143				document.removeEventListener("mousemove", checkDrag);
4144			});
4145
4146			$elSelector.on('translate.owl.carousel', function(event) {
4147				if (UNCODE.isMobile) {
4148					$(event.currentTarget).addClass('owl-translating');
4149				}
4150			});
4151
4152			/** Translated */
4153			$elSelector.on('translated.owl.carousel', function(event) {
4154
4155				var thiis = $(event.currentTarget),
4156					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
4157					currentIndex = $(currentItem).attr('data-index'),
4158					stagePadding = thiis.data('stagepadding');
4159
4160				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4161
4162				if (!UNCODE.isMobile) {
4163					UNCODE.owlPlayVideo(thiis);
4164				}
4165
4166				requestTimeout(function(){
4167					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
4168					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
4169					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
4170						if (lastDelayElems == undefined) lastDelayElems = 0;
4171						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4172						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4173						thiis.trigger('stop.owl.autoplay');
4174						requestTimeout(function() {
4175							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
4176						}, maxDelay);
4177					}
4178				}, 200);
4179
4180				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
4181					if ($(val).closest('.uncode-slider').length) {
4182						$(val).removeClass('start_animation');
4183					}
4184				});
4185
4186				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
4187					if ($(val).closest('.uncode-slider').length) {
4188						$(val).removeClass('already-animated');
4189					}
4190				});
4191
4192				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4193					if ($(val).closest('.uncode-slider').length) {
4194						$(val).removeAttr('data-animated');
4195					}
4196				});
4197
4198				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4199					if ($(val).attr('data-index') != currentIndex) {
4200						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4201						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4202					}
4203					if ($(val).attr('data-index') != currentIndex) {
4204						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4205					}
4206					if ($(val).attr('data-index') == currentIndex) {
4207						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4208					}
4209				});
4210
4211				if (UNCODE.isMobile) {
4212					thiis.removeClass('owl-translating');
4213				}
4214
4215				setIndexActive(event);
4216			});
4217
4218			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4219
4220			/** Init carousel */
4221			$elSelector.not('.showControls').owlCarousel({
4222				items: values['items'],
4223				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4224				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4225				nav: values['nav'],
4226				dots: values['dots'],
4227				loop: values['loop'],
4228				stagePadding: values['stagepadding'],
4229				margin: 0,
4230				video: true,
4231				autoWidth: false,
4232				autoplay: false,
4233				autoplayTimeout: values['timeout'],
4234				autoplaySpeed: values['navspeed'],
4235				autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
4236				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4237				rtl: $('body').hasClass('rtl') ? true : false,
4238				fluidSpeed: true,
4239				navSpeed: values['navspeed'],
4240				dotsSpeed: values['navspeed'] / values['items'],
4241				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4242				navText: ['<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-right"></i></div>'],
4243				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4244				responsiveClass: true,
4245				responsiveBaseElement: '.box-container',
4246				responsive: {
4247					0: {
4248						items: values['sm'],
4249						nav: values['navmobile'],
4250						dots: values['dotsmobile'],
4251						dotsSpeed: values['navspeed'] / values['sm'],
4252					},
4253					480: {
4254						items: values['sm'],
4255						nav: values['navmobile'],
4256						dots: values['dotsmobile'],
4257						dotsSpeed: values['navspeed'] / values['sm'],
4258					},
4259					570: {
4260						items: values['md'],
4261						nav: values['navmobile'],
4262						dots: values['dotsmobile'],
4263						dotsSpeed: values['navspeed'] / values['md'],
4264					},
4265					960: {
4266						items: values['lg'],
4267						dotsSpeed: values['navspeed'] / values['lg'],
4268					}
4269				}
4270			});
4271
4272			var transDuration = parseFloat(values['navspeed']) * 0.3;
4273			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
4274
4275			$('.owl-item .tmb', $elSelector).css({
4276				'-webkit-transition-delay': transDuration + 'ms',
4277				'-moz-transition-delay': transDuration + 'ms',
4278				'-o-transition-delay': transDuration + 'ms',
4279				'transition-delay': transDuration + 'ms',
4280				'-webkit-transition-duration': transDuration2 + 'ms',
4281				'-moz-transition-duration': transDuration2 + 'ms',
4282				'-o-transition-duration': transDuration2 + 'ms',
4283				'transition-duration': transDuration2 + 'ms',
4284			});
4285
4286			requestTimeout(function() {
4287				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4288					UNCODE.setRowHeight($owlInsideEqual[i]);
4289				};
4290			}, 300);
4291
4292			$(window).on('load', function(){
4293				var $elCarousel = $elSelector.data('owl.carousel');
4294				if ( typeof $elCarousel !== 'undefined' ) {
4295					$elCarousel.trigger('refreshed');
4296					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4297						UNCODE.setRowHeight($owlInsideEqual[i]);
4298					};
4299				}
4300			});
4301
4302			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
4303				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4304					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
4305					$('#' + carousel_id).find('.owl-item').each( function() {
4306						var $item = $(this),
4307							index = ( $item.index() + 1 );
4308						$item.attr('data-index', index);
4309					});
4310				}
4311			});
4312
4313			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4314				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
4315					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4316						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
4317						$('#' + carousel_id).find('.owl-item').each( function() {
4318							var $item = $(this),
4319								index = ( $item.index() + 1 );
4320							$item.attr('data-index', index);
4321						});
4322					}
4323				});
4324			}
4325
4326		});
4327
4328		function firstLoaded(el, event) {
4329			var el = $(el),
4330			uncode_slider = el.find('.uncode-slider');
4331			el.find('.owl-carousel').css('opacity', 1);
4332			uncode_slider.addClass('slider-loaded');
4333			if (typeof UNCODE.bigText !== 'undefined') {
4334				UNCODE.bigText(el.find('.owl-item.active'));
4335			}
4336			//if (!UNCODE.isMobile) {
4337				requestTimeout(function() {
4338					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
4339					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
4340					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
4341						if (lastDelayElems == undefined) lastDelayElems = 0;
4342						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4343						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4344						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
4345						requestTimeout(function() {
4346							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
4347						}, maxDelay);
4348					}
4349				}, 500);
4350
4351			//}
4352		}
4353
4354		function navHover(el) {
4355			var $owlCont = el,
4356				$owlPrev = $owlCont.find('.owl-prev'),
4357				$owlNext = $owlCont.find('.owl-next'),
4358				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
4359				$owlPagination = $owlCont.next(),
4360				owlPrevW = $owlPrev.outerWidth(),
4361				owlNextW = $owlNext.outerWidth(),
4362				owlDotsH = $owlDots.innerHeight(),
4363				owlTime = 400,
4364				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4365			if ( $('body').hasClass('rtl') ) {
4366				$owlPrev.css("margin-right", -owlPrevW);
4367				$owlNext.css("margin-left", -owlNextW);
4368			} else {
4369				$owlPrev.css("margin-left", -owlPrevW);
4370				$owlNext.css("margin-right", -owlNextW);
4371			}
4372			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
4373			$owlCont.mouseenter(function() {
4374				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4375				$owlPrev.add($owlNext).css({
4376					marginLeft: 0,
4377					marginRight: 0
4378				});
4379				if (!owlNested) {
4380					$owlDots.css({
4381						opacity: 1,
4382						bottom: 0
4383					});
4384				}
4385			}).mouseleave(function() {
4386				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4387				if ( $('body').hasClass('rtl') ) {
4388					$owlPrev.css("margin-right", -owlPrevW);
4389					$owlNext.css("margin-left", -owlNextW);
4390				} else {
4391					$owlPrev.css("margin-left", -owlPrevW);
4392					$owlNext.css("margin-right", -owlNextW);
4393				}
4394				if (!owlNested) {
4395					$owlDots.css({
4396						opacity: 1,
4397						bottom: -owlDotsH
4398					});
4399				}
4400			});
4401		};
4402
4403		function animate_elems($this) {
4404			var lastDelay;
4405			$.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) {
4406				var element = $(val),
4407					delayAttr = element.attr('data-delay'),
4408					$first_item = element.closest('.owl-item[data-index="1"]');
4409
4410				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
4411					return false;
4412				}
4413
4414				if (delayAttr == undefined) delayAttr = 0;
4415				requestTimeout(function() {
4416					element.addClass('start_animation');
4417				}, delayAttr);
4418				lastDelay = delayAttr;
4419			});
4420			return lastDelay;
4421		}
4422
4423		function animate_thumb(items, event) {
4424			var lastDelay,
4425				itemIndex,
4426				thiis = $(event.currentTarget),
4427				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
4428				numActives = $('.owl-item.active', thiis).length,
4429				stagePadding = thiis.data('stagepadding');
4430
4431			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4432
4433			thiis.data('tempIndex', event.item.index);
4434				$.each(items, function(index, val) {
4435					var parent = $(val).closest('.owl-item');
4436					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4437						return;
4438					}
4439					if (!$(val).hasClass('start_animation')) {
4440						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
4441							var thumbInView = new Waypoint.Inview({
4442							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4443							  element: val,
4444							  enter: function(direction) {
4445								var element = $(this.element),
4446										delayAttr = parseInt(element.attr('data-delay')),
4447										itemIndex = element.closest('.owl-item').index() + 1,
4448										diffItem = Math.abs(itemIndex - tempIndex) - 1;
4449									if (itemIndex > tempIndex) {
4450										thiis.data('tempIndex', itemIndex);
4451									}
4452									if (isNaN(delayAttr)) delayAttr = 100;
4453									if (stagePadding) {
4454										var objTimeout = requestTimeout(function() {
4455											element.addClass('start_animation');
4456										}, index * delayAttr);
4457										lastDelay = index * delayAttr;
4458									} else {
4459										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
4460										var objTimeout = requestTimeout(function() {
4461											element.addClass('start_animation');
4462										}, diffItem * delayAttr);
4463										lastDelay = diffItem * delayAttr;
4464									}
4465									parent.data('objTimeout', objTimeout);
4466									if (!UNCODE.isUnmodalOpen) {
4467										this.destroy();
4468									}
4469								}
4470							});
4471						}
4472					}
4473				});
4474				return lastDelay;
4475			}
4476
4477		function setItemsHeight(item) {
4478			$.each($('.owl-item', item), function(index, val) {
4479				var availableThumbHeight = $('.t-inside', $(val)).height(),
4480				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
4481				difference = availableThumbHeight - innerThumbHeight;
4482				if ($('.tmb-content-under', val).length) {
4483					var visualPart = $('.t-entry-visual', val);
4484					if (visualPart.length) {
4485						difference -= $('.t-entry-visual', val).height();
4486					}
4487				}
4488				if (! $('.tmb-content-lateral', val).length)
4489					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
4490			});
4491		}
4492
4493		function setItemsRelHeight(item) {
4494			$.each($('.owl-item', item), function(index, val) {
4495				var $rowContainer = $(item).parents('.row-parent').eq(0),
4496					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
4497					$colContainer = $(item).parents('.uncell').eq(0),
4498					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
4499					winHeight = UNCODE.wheight,
4500					multiplier_h = parseInt($(item).attr('data-vp-height')),
4501					data_viewport_h,
4502					consider_menu = $(item).data('vp-menu');
4503
4504				if ( consider_menu ) {
4505					winHeight = winHeight - UNCODE.menuHeight;
4506				}
4507
4508				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
4509				$('.t-inside', val).css( 'height', data_viewport_h );
4510			});
4511		}
4512
4513		function pauseOnHover(slider) {
4514			var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next');
4515			$('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({
4516				mouseenter: function () {
4517					$(slider).addClass('owl-mouseenter');
4518					$(slider).trigger('stop.owl.autoplay');
4519				},
4520				mouseleave: function () {
4521					$(slider).removeClass('owl-mouseenter');
4522					$(slider).trigger('play.owl.autoplay');
4523				}
4524			});
4525		}
4526	});
4527};
4528
4529UNCODE.owlPlayVideo = function(carousel) {
4530	var player, iframe;
4531	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
4532		var content = $(val).html();
4533		if (content == '') {
4534			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
4535			$(val).append(getCloned);
4536		}
4537		if ($(this).attr('data-provider') == 'vimeo') {
4538			iframe = $(this).find('iframe');
4539			player = new Vimeo.Player(iframe[0]);
4540			player.play();
4541		} else if ($(this).attr('data-provider') == 'youtube') {
4542			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
4543		} else {
4544			var player = $(this).find('video');
4545			if (player.length) {
4546				$(this).find('video')[0].volume = 0;
4547				$(this).find('video')[0].play();
4548				$(val).css('opacity', 1);
4549			}
4550		}
4551	});
4552};
4553
4554UNCODE.owlStopVideo = function(carousel) {
4555	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
4556		var player, iframe;
4557		if ($(this).attr('data-provider') == 'vimeo') {
4558			iframe = $(this).find('iframe');
4559			player = new Vimeo.Player(iframe[0]);
4560			player.pause();
4561		} else if ($(this).attr('data-provider') == 'youtube') {
4562			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
4563		} else {
4564			var player = $(this).find('video');
4565			if (player.length) {
4566				$(this).find('video')[0].volume = 0;
4567				$(this).find('video')[0].play();
4568			}
4569		}
4570	});
4571};
4572
4573UNCODE.animations = function() {
4574
4575	var runWaypoints_TO,
4576		runWaypoints_carousel_TO,
4577		runWaypoints_delay = 0,
4578	highlightComplexFunc = function($wrap, ev){
4579
4580		var $lines = $('.heading-line-wrap', $wrap),
4581			not_animate = false;
4582
4583		if ( $wrap.data('animate') === true ) {
4584			not_animate = true;
4585		}
4586
4587		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
4588		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
4589			return;
4590		}
4591
4592		$lines.each(function(_key, _value){
4593			var $line = $(_value),
4594				$inners = $('.split-word-inner', $line),
4595				$highlights = $('.heading-text-highlight-inner', $line);
4596
4597			var highlitInnerFunc = function(ev){
4598				var delay = 0;
4599				$highlights.each(function(h_key, high){
4600					var $highlight = $(high),
4601						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
4602						$nextSplit = $split.nextUntil(),
4603						$next = $('.heading-text-highlight-inner', $nextSplit),
4604						countCh = $split.text().length;
4605
4606					$highlight.css({
4607						'-webkit-transition-duration': (30 * countCh) + 'ms',
4608						'-moz-transition-duration': (30 * countCh) + 'ms',
4609						'-o-transition-duration': (30 * countCh) + 'ms',
4610						'transition-duration': (30 * countCh) + 'ms',
4611					});
4612
4613					delay += (30 * countCh);
4614
4615					$next.css({
4616						'-webkit-transition-delay': delay + 'ms',
4617						'-moz-transition-delay': delay + 'ms',
4618						'-o-transition-delay': delay + 'ms',
4619						'transition-delay': delay + 'ms',
4620					});
4621				});
4622				$highlights.removeAttr('data-animated');
4623				if ( _key+1 === $lines.length ) {
4624					$wrap.data('animate', true);
4625				}
4626			};
4627
4628			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
4629				if ( not_animate ) {
4630					$highlights.each(function(h_key, high){
4631						var $highlight = $(high);
4632						$highlight.css({
4633							'-webkit-transition-duration': '0ms',
4634							'-moz-transition-duration': '0ms',
4635							'-o-transition-duration': '0ms',
4636							'transition-duration': '0ms',
4637						});
4638					});
4639					$highlights.removeAttr('data-animated');
4640				} else {
4641					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
4642						highlitInnerFunc();
4643					} else {
4644						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
4645					}
4646				}
4647			}
4648		});
4649	};
4650
4651	$.each($('.header-content-inner'), function(index, val) {
4652		var element = $(val),
4653			transition = '';
4654		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
4655		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
4656		if (element.hasClass('left-t-right')) transition = 'left-t-right';
4657		if (element.hasClass('right-t-left')) transition = 'right-t-left';
4658		if (element.hasClass('zoom-in')) transition = 'zoom-in';
4659		if (element.hasClass('zoom-out')) transition = 'zoom-out';
4660		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
4661		if (transition != '') {
4662			$(val).removeClass(transition);
4663			var container = element,
4664				containerDelay = container.attr('data-delay'),
4665				containerSpeed = container.attr('data-speed'),
4666				items = $('.header-title > *, .post-info', container);
4667			$.each(items, function(index, val) {
4668				var element = $(val),
4669					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
4670					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
4671				if (!element.hasClass('animate_when_almost_visible')) {
4672					delayAttr = Number(delayAttr) + (400 * index);
4673					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
4674					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
4675				}
4676			});
4677			container.css('opacity', 1);
4678		}
4679	});
4680
4681	function animate_css_grids_on_load() {
4682		$('.cssgrid-system').each(function() {
4683			var grid = $(this);
4684			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
4685			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
4686		});
4687	}
4688
4689	window.waypoint_animation = function(ev) {
4690		$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
4691			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 ) ) {
4692				return true;
4693			}
4694			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4695				return;
4696			}
4697			var run = true,
4698				$carousel = $(val).closest('.owl-carousel');
4699			if ( $carousel.length ) {
4700				run = false;
4701			}
4702			if (run) {
4703				new Waypoint({
4704					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4705					element: val,
4706					handler: function() {
4707						var element = $(this.element),
4708							index = element.index(),
4709							delayAttr = element.attr('data-delay');
4710						if (delayAttr == undefined) delayAttr = 0;
4711						requestTimeout(function() {
4712							element.addClass('start_animation');
4713						}, delayAttr);
4714						if (!UNCODE.isUnmodalOpen) {
4715							this.destroy();
4716						}
4717					},
4718					offset: UNCODE.isFullPage ? '100%' : '90%'
4719				});
4720			}
4721		});
4722		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
4723			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4724				return;
4725			}
4726			var run = true,
4727				$carousel = $(val).closest('.owl-carousel');
4728			if ( $carousel.length ) {
4729				run = false;
4730			}
4731			if (run) {
4732				new Waypoint({
4733					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4734					element: val,
4735					handler: function() {
4736						var $element = $(this.element),
4737							$childs = $('.animate_when_parent_almost_visible', $element);
4738						$childs.each(function(key,el){
4739							var $child = $(el),
4740								delaySpeed = $child.attr('data-speed'),
4741								delayAttr = $child.attr('data-delay'),
4742								intervalAttr = $child.attr('data-interval');
4743							if (delayAttr == undefined) {
4744								delayAttr = 50*key;
4745							}
4746							requestTimeout(function() {
4747								$child.addClass('start_animation');
4748								if ( $child.hasClass('anim-line-checker') ) {
4749									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4750										var $line = $child.closest('.heading-line-wrap');
4751									});
4752								}
4753								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
4754								highlightComplexFunc($wrapText, ev);
4755								if ( $child.hasClass('anim-tot-checker') ) {
4756									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4757										if ( $child.hasClass('anim-tot-checker') ) {
4758											$wrapText.addClass('already-animated');
4759											$element.trigger('already-animated');
4760										}
4761									});
4762								}
4763							}, delayAttr );
4764						});
4765						$element.addClass('start_animation');
4766						if (!UNCODE.isUnmodalOpen) {
4767							this.destroy();
4768						}
4769					},
4770					offset: UNCODE.isFullPage ? '100%' : '90%'
4771				});
4772			}
4773		});
4774	}
4775	window.waypoint_carousel_animation = function(ev) {
4776		$.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) {
4777			if ( $(val).hasClass('el-text-split') ) {
4778				return true;
4779			}
4780			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4781				return;
4782			}
4783			var run = true,
4784				$carousel = $(val).closest('.owl-carousel'),
4785				$first_item = $(val).closest('.owl-item[data-index="1"]'),
4786				$all_first = $('.owl-item[data-index="1"]', $carousel);
4787			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
4788				run = false;
4789			}
4790			if (run) {
4791				new Waypoint({
4792					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4793					element: val,
4794					handler: function() {
4795						var element = $(this.element),
4796							index = element.index(),
4797							delayAttr = element.attr('data-delay');
4798						if (delayAttr == undefined) delayAttr = 0;
4799						requestTimeout(function() {
4800							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
4801								$all_first.attr('data-already-reached', 'true');
4802							}
4803							element.addClass('start_animation');
4804						}, delayAttr);
4805						if (!UNCODE.isUnmodalOpen) {
4806							this.destroy();
4807						}
4808					},
4809					offset: UNCODE.isFullPage ? '100%' : '90%'
4810				});
4811			}
4812		});
4813		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
4814			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4815				return;
4816			}
4817			var run = true,
4818				$carousel = $(val).closest('.owl-carousel'),
4819				$first_item = $(val).closest('.owl-item[data-index="1"]'),
4820				$all_first = $('.owl-item[data-index="1"]', $carousel);
4821			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
4822				run = false;
4823			}
4824			if (run) {
4825				new Waypoint({
4826					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4827					element: val,
4828					handler: function() {
4829						var $element = $(this.element),
4830							$childs = $('.animate_when_parent_almost_visible', $element);
4831						$childs.each(function(key,el){
4832							var $child = $(el),
4833								delaySpeed = $child.attr('data-speed'),
4834								delayAttr = $child.attr('data-delay'),
4835								intervalAttr = $child.attr('data-interval');
4836							if (delayAttr == undefined) {
4837								delayAttr = 50*key;
4838							}
4839							requestTimeout(function() {
4840								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
4841									$all_first.attr('data-already-reached', 'true');
4842								}
4843								$child.addClass('start_animation');
4844								if ( $child.hasClass('anim-line-checker') ) {
4845									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4846										var $line = $child.closest('.heading-line-wrap');
4847									});
4848								}
4849								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
4850								highlightComplexFunc($wrapText, ev);
4851								if ( $child.hasClass('anim-tot-checker') ) {
4852									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4853										if ( $child.hasClass('anim-tot-checker') ) {
4854											$wrapText.addClass('already-animated');
4855										}
4856									});
4857								}
4858							}, delayAttr );
4859						});
4860						$element.addClass('start_animation');
4861						if (!UNCODE.isUnmodalOpen) {
4862							this.destroy();
4863						}
4864					},
4865					offset: UNCODE.isFullPage ? '100%' : '90%'
4866				});
4867			}
4868		});
4869	}
4870
4871	var runWaypoints = function(ev){
4872		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
4873			runWaypoints_delay = 400;
4874		}
4875		clearRequestTimeout(runWaypoints_TO);
4876		runWaypoints_TO = requestTimeout(function() {
4877			window.waypoint_animation(ev);
4878		}, runWaypoints_delay);
4879
4880		clearRequestTimeout(runWaypoints_carousel_TO);
4881		runWaypoints_carousel_TO = requestTimeout(function() {
4882			window.waypoint_carousel_animation(ev);
4883		}, 400);
4884	};
4885	runWaypoints();
4886	animate_css_grids_on_load();
4887
4888	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
4889		runWaypoints(ev);
4890	});
4891	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4892		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
4893	}
4894};
4895
4896UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
4897	var $allItems = elements.length - startIndex,
4898		showed = 0,
4899		index = 0,
4900		use_index = false
4901		;
4902
4903	if (filtering) {
4904		if (sequential) {
4905			use_index = true;
4906		}
4907		sequential = false;
4908	}
4909
4910	$.each(elements, function(index, val) {
4911		var $this = $(val),
4912			elInner = $('> .t-inside', val);
4913
4914		if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4915			return;
4916		}
4917		if (val[0]) val = val[0];
4918
4919		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
4920			new Waypoint({
4921				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4922				element: val,
4923				handler: function() {
4924					var element = $('> .t-inside', this.element),
4925						parent = $(this.element);
4926					var _index = use_index? index : 0;
4927
4928					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
4929						delayAttr = parseInt(element.attr('data-delay'));
4930					if (isNaN(delayAttr)) delayAttr = 100;
4931					if (sequential || use_index) {
4932						delay -= showed;
4933					}
4934					var objTimeout = requestTimeout(function() {
4935						element.removeClass('zoom-reverse').addClass('start_animation');
4936						showed = index;
4937					}, delay * delayAttr);
4938					parent.data('objTimeout', objTimeout);
4939					if (!UNCODE.isUnmodalOpen) {
4940						this.destroy();
4941					}
4942				},
4943				offset: UNCODE.isFullPage ? '100%' : '90%'
4944			});
4945		}
4946
4947		index++;
4948	});
4949};
4950
4951UNCODE.tapHover = function() {
4952
4953	var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn
4954		elClass = "hover";
4955
4956	$(window).on('click', function() {
4957		$el.removeClass(elClass);
4958	});
4959
4960	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
4961		e.stopPropagation();
4962		var link = $(this);
4963		if ( ! link.hasClass(elClass)) {
4964			e.preventDefault();
4965			link.addClass("hover");
4966			$el.not(this).removeClass(elClass);
4967			return false;
4968		}
4969	});
4970};
4971
4972UNCODE.onePage = function(isMobile) {
4973	var current = 0,
4974		last = 0,
4975		lastScrollTop = 0,
4976		forceScroll = false,
4977		lastScrolled = 0,
4978		isSectionscroller = ($('.main-onepage').length) ? true : false,
4979		isOnePage = false,
4980		getOffset = function () {
4981			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);
4982			return calculateOffset;
4983		}
4984
4985	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
4986	// 	return false;
4987
4988	function init_onepage() {
4989		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
4990			$("<ul class='onepage-pagination'></ul>").prependTo("body");
4991		}
4992		last = $('.onepage-pagination li').last().find('a').data('index');
4993		$.each($('div[data-parent="true"]'), function(index, val) {
4994			$(this).attr('data-section', index);
4995			if (isMobile) return;
4996			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4997				return;
4998			}
4999			var sectionDown = new Waypoint({
5000				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5001				element: val,
5002				handler: function(direction) {
5003					if (direction == 'down') {
5004						changeMenuActive(this.element, index);
5005					}
5006				},
5007				offset: function() {
5008					return 5 + getOffset()
5009				}
5010			});
5011			var sectionUp = new Waypoint({
5012				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
5013				element: val,
5014				handler: function(direction) {
5015					if (direction == 'up') {
5016						changeMenuActive(this.element, index);
5017					}
5018				},
5019				offset: function() {
5020					return -5 - getOffset()
5021				}
5022			});
5023
5024			if (isSectionscroller) {
5025				var label;
5026				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
5027				else label = '';
5028				var getName = $(this).attr('data-name');
5029				if (getName == undefined) getName = index;
5030				if (label != '') {
5031					isOnePage = true;
5032					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
5033					$('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
5034				}
5035			}
5036		});
5037
5038		if (isSectionscroller) {
5039			$.each($('ul.onepage-pagination li'), function(index, val) {
5040				var $this = $(val),
5041					$a = ('a', $this);
5042				$a.on('click', function(evt) {
5043					if ( $('.is-selected', $this).length ) {
5044						return false;
5045					}
5046					if ( $('body').hasClass('uncode-scroll-no-history') ) {
5047						evt.preventDefault();
5048					}
5049					Waypoint.refreshAll();
5050					var el = $('a', evt.currentTarget);
5051					current = lastScrolled = parseInt(el.attr('data-index'));
5052					lastScrolled += 1;
5053					scrollBody(current);
5054				});
5055			});
5056		}
5057
5058		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
5059		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
5060			goToSection = String(window.location.hash).replace(/^#/, "");
5061			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
5062		}
5063
5064		if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) {
5065			current = lastScrolled = goToSection;
5066			$(window).on('load', function(){
5067				if ( $('.owl-carousel').length ) {
5068					requestTimeout(function(){
5069						scrollBody(goToSection);
5070					}, 400);
5071				} else {
5072					scrollBody(goToSection);
5073				}
5074			});
5075		}
5076
5077	}
5078
5079	function changeMenuActive(section, index) {
5080		current = lastScrolled = parseInt($(section).attr('data-section'));
5081		if (isOnePage) {
5082			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
5083			if (newSection.length) {
5084				$('ul.onepage-pagination li a').removeClass('is-selected');
5085				newSection.addClass('is-selected');
5086			}
5087			var getName = $('[data-section="' + index + '"]').attr('data-name');
5088			if (getName != undefined && getName !== '') {
5089				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
5090					var get_href = $(val).attr('href');
5091					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5092						$(val).closest('.menu-smart').find('.active').removeClass('active');
5093						$(val).parent().addClass('active');
5094					}
5095				});
5096			}
5097		}
5098	}
5099
5100	if (isOnePage) {
5101		$(window).on('scroll', function() {
5102			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
5103			if (bodyTop == 0) {
5104				$('ul.onepage-pagination li a').removeClass('is-selected');
5105				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
5106				var getName = $('[data-section=0]').attr('data-name');
5107				if (getName != undefined && getName !== '') {
5108					$.each($('.menu-container .menu-item > a'), function(i, val) {
5109						var get_href = $(val).attr('href');
5110						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
5111							$(val).closest('ul').find('.active').removeClass('active');
5112							$(val).parent().addClass('active');
5113						}
5114					});
5115				}
5116			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
5117				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
5118				if (lastSection.length) {
5119					$('ul.onepage-pagination li a').removeClass('is-selected');
5120					lastSection.addClass('is-selected');
5121				}
5122			}
5123		});
5124	}
5125
5126	var scrollBody = function(index) {
5127		$('ul.onepage-pagination li a').removeClass('is-selected');
5128		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
5129
5130		var getSection = $('[data-section=' + index + ']'),
5131			scrollTo;
5132
5133		if (getSection == undefined) return;
5134
5135		var body = $("html, body"),
5136			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
5137			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
5138			getOffset = UNCODE.get_scroll_offset(index);
5139		if ( typeof getSection.offset() === 'undefined' )
5140			return;
5141		scrollTo = getSection.offset().top;
5142
5143		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
5144		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
5145			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
5146			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
5147				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
5148			}
5149
5150			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
5151				if ( index === 0 ) {
5152					scrollTo = 0;
5153				} else {
5154					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
5155				}
5156			} else {
5157				scrollTo -= getOffset;
5158			}
5159		}
5160
5161		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
5162		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
5163
5164		if (index != 0) {
5165			UNCODE.scrolling = true;
5166		}
5167
5168		if (scrollSpeed == 0) {
5169			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
5170			UNCODE.scrolling = false;
5171		} else {
5172			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5173				$(this).stop();
5174			}).animate({
5175				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5176			}, scrollSpeed, 'easeInOutCubic', function() {
5177				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5178				UNCODE.scrolling = false;
5179				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
5180				||
5181				$('.menu-hided').length ) {
5182					scrollTo = getSection.offset().top;
5183					getOffset = UNCODE.get_scroll_offset(index);
5184					scrollTo -= getOffset;
5185					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
5186						$(this).stop();
5187					}).animate({
5188						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
5189						}, scrollSpeed, 'easeInOutCubic', function() {
5190							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5191							UNCODE.scrolling = false;
5192						}
5193					);
5194				}
5195			});
5196		}
5197
5198	};
5199
5200	init_onepage();
5201};
5202
5203UNCODE.stickyElements = function() {
5204	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5205	if (!isMobile_wide ) {
5206
5207		var $pageHeader = $('#page-header'),
5208			$headerRow = $('.vc_row', $pageHeader),
5209			startSticky = false;
5210
5211		if ( $headerRow.hasClass('sticky-element') ) {
5212			$headerRow.removeClass('sticky-element');
5213			$pageHeader.addClass('sticky-element');
5214			startSticky = true;
5215		}
5216
5217		var calculateOffset = function(el) {
5218			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5219				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5220				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0,
5221				elTop = window.pageYOffset + el.getBoundingClientRect().top;
5222
5223			sideOffset += UNCODE.bodyBorder;
5224
5225			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5226			if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) {
5227				if ($('.menu-shrink').length) {
5228					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5229				} else {
5230					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5231				}
5232			}
5233
5234			return sideOffset;
5235
5236		},
5237
5238		initStickyElement = function($els) {
5239			if ( $('body').hasClass('vc-safe-mode') ) {
5240				return true;
5241			}
5242			if ( typeof $els === 'undefined' ) {
5243				$els = $('.sticky-element');
5244			}
5245			$.each($els, function(index, element) {
5246				if ($(element).closest('.tab-pane').length) {
5247					var $paneParent = $(element).closest('.tab-pane');
5248					if ( !$paneParent.hasClass('active') ) {
5249						return true;
5250					}
5251				}
5252				$(element).stick_in_parent({
5253					sticky_class: 'is_stucked',
5254					offset_top: calculateOffset(element),
5255					bottoming: true,
5256					inner_scrolling: SiteParameters.sticky_elements === 'on'
5257				});
5258			});
5259		};
5260
5261		var oldW = UNCODE.wwidth,
5262			oldH = UNCODE.wHeight;
5263
5264		requestTimeout(function() {
5265			if ($('.sticky-element').length) {
5266
5267				if ($(window).width() > UNCODE.mediaQuery) {
5268					initStickyElement();
5269
5270					if ( startSticky === true ) {
5271						$('#page-header').trigger('sticky_kit:recalc');
5272					}
5273				}
5274
5275				$(window).on('resize lateral_resize', function(event) {
5276					if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) {
5277						$(".sticky-element").trigger("sticky_kit:detach");
5278						if ($(window).width() > UNCODE.mediaQuery) {
5279							initStickyElement();
5280						}
5281						oldW = UNCODE.wwidth;
5282						oldH = UNCODE.wHeight;
5283					}
5284				});
5285			}
5286		}, 1000);
5287
5288		if ($('.sticky-element').length) {
5289			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
5290				requestTimeout(function() {
5291					$(document.body).trigger("sticky_kit:recalc");
5292				}, 100);
5293			});
5294		}
5295
5296		var $panels = $('.panel-collapse');
5297		if ( $panels.length ) {
5298			$panels.each(function(){
5299				var $panel = $(this);
5300				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
5301					$(document.body).trigger("sticky_kit:recalc");
5302				});
5303			});
5304		}
5305
5306		$('.nav-tabs a').on('shown.bs.tab', function(e){
5307			var $tabs = $(e.target).closest('.tab-container'),
5308				$panel = $('.tab-pane.active', $tabs),
5309				$els = $(e.target).nextAll(".sticky-element");
5310
5311			$els.trigger("sticky_kit:detach");
5312			initStickyElement($els);
5313		});
5314
5315		$(window).on('vc-safe-mode-on', function(){
5316			$(".sticky-element").trigger("sticky_kit:detach");
5317		});
5318
5319		$(window).on('vc-safe-mode-off', function(){
5320			initStickyElement();
5321		});
5322	}
5323};
5324
5325UNCODE.twentytwenty = function() {
5326
5327  if (!$('.twentytwenty-container').length) return;
5328
5329// DOM.event.move
5330//
5331// 2.0.0
5332//
5333// Stephen Band
5334//
5335// Triggers 'movestart', 'move' and 'moveend' events after
5336// mousemoves following a mousedown cross a distance threshold,
5337// similar to the native 'dragstart', 'drag' and 'dragend' events.
5338// Move events are throttled to animation frames. Move event objects
5339// have the properties:
5340//
5341// pageX:
5342// pageY:     Page coordinates of pointer.
5343// startX:
5344// startY:    Page coordinates of pointer at movestart.
5345// distX:
5346// distY:     Distance the pointer has moved since movestart.
5347// deltaX:
5348// deltaY:    Distance the finger has moved since last event.
5349// velocityX:
5350// velocityY: Average velocity over last few events.
5351
5352
5353(function(fn) {
5354	if (typeof define === 'function' && define.amd) {
5355        define([], fn);
5356    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
5357        module.exports = fn;
5358	} else {
5359		fn();
5360	}
5361})(function(){
5362	var assign = Object.assign || window.jQuery && jQuery.extend;
5363
5364	// Number of pixels a pressed pointer travels before movestart
5365	// event is fired.
5366	var threshold = 8;
5367
5368	// Shim for requestAnimationFrame, falling back to timer. See:
5369	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
5370	var requestFrame = (function(){
5371		return (
5372			window.requestAnimationFrame ||
5373			window.webkitRequestAnimationFrame ||
5374			window.mozRequestAnimationFrame ||
5375			window.oRequestAnimationFrame ||
5376			window.msRequestAnimationFrame ||
5377			function(fn, element){
5378				return window.setTimeout(function(){
5379					fn();
5380				}, 25);
5381			}
5382		);
5383	})();
5384
5385	// Shim for customEvent
5386	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
5387	(function () {
5388		if ( typeof window.CustomEvent === "function" ) return false;
5389		function CustomEvent ( event, params ) {
5390			params = params || { bubbles: false, cancelable: false, detail: undefined };
5391			var evt = document.createEvent( 'CustomEvent' );
5392			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
5393			return evt;
5394		}
5395
5396		CustomEvent.prototype = window.Event.prototype;
5397		window.CustomEvent = CustomEvent;
5398	})();
5399
5400	var ignoreTags = {
5401			textarea: true,
5402			input: true,
5403			select: true,
5404			button: true
5405		};
5406
5407	var mouseevents = {
5408		move:   'mousemove',
5409		cancel: 'mouseup dragstart',
5410		end:    'mouseup'
5411	};
5412
5413	var touchevents = {
5414		move:   'touchmove',
5415		cancel: 'touchend',
5416		end:    'touchend'
5417	};
5418
5419	var rspaces = /\s+/;
5420
5421
5422	// DOM Events
5423
5424	var eventOptions = { bubbles: true, cancelable: true };
5425
5426	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
5427
5428	function createEvent(type) {
5429		return new CustomEvent(type, eventOptions);
5430	}
5431
5432	function getEvents(node) {
5433		return node[eventsSymbol] || (node[eventsSymbol] = {});
5434	}
5435
5436	function on(node, types, fn, data, selector) {
5437		types = types.split(rspaces);
5438
5439		var events = getEvents(node);
5440		var i = types.length;
5441		var handlers, type;
5442
5443		function handler(e) { fn(e, data); }
5444
5445		while (i--) {
5446			type = types[i];
5447			handlers = events[type] || (events[type] = []);
5448			handlers.push([fn, handler]);
5449			node.addEventListener(type, handler);
5450		}
5451	}
5452
5453	function off(node, types, fn, selector) {
5454		types = types.split(rspaces);
5455
5456		var events = getEvents(node);
5457		var i = types.length;
5458		var type, handlers, k;
5459
5460		if (!events) { return; }
5461
5462		while (i--) {
5463			type = types[i];
5464			handlers = events[type];
5465			if (!handlers) { continue; }
5466			k = handlers.length;
5467			while (k--) {
5468				if (handlers[k][0] === fn) {
5469					node.removeEventListener(type, handlers[k][1]);
5470					handlers.splice(k, 1);
5471				}
5472			}
5473		}
5474	}
5475
5476	function trigger(node, type, properties) {
5477		// Don't cache events. It prevents you from triggering an event of a
5478		// given type from inside the handler of another event of that type.
5479		var event = createEvent(type);
5480		if (properties) { assign(event, properties); }
5481		node.dispatchEvent(event);
5482	}
5483
5484
5485	// Constructors
5486
5487	function Timer(fn){
5488		var callback = fn,
5489		    active = false,
5490		    running = false;
5491
5492		function trigger(time) {
5493			if (active){
5494				callback();
5495				requestFrame(trigger);
5496				running = true;
5497				active = false;
5498			}
5499			else {
5500				running = false;
5501			}
5502		}
5503
5504		this.kick = function(fn) {
5505			active = true;
5506			if (!running) { trigger(); }
5507		};
5508
5509		this.end = function(fn) {
5510			var cb = callback;
5511
5512			if (!fn) { return; }
5513
5514			// If the timer is not running, simply call the end callback.
5515			if (!running) {
5516				fn();
5517			}
5518			// If the timer is running, and has been kicked lately, then
5519			// queue up the current callback and the end callback, otherwise
5520			// just the end callback.
5521			else {
5522				callback = active ?
5523					function(){ cb(); fn(); } :
5524					fn ;
5525
5526				active = true;
5527			}
5528		};
5529	}
5530
5531
5532	// Functions
5533
5534	function noop() {}
5535
5536	function preventDefault(e) {
5537		e.preventDefault();
5538	}
5539
5540	function isIgnoreTag(e) {
5541		return !!ignoreTags[e.target.tagName.toLowerCase()];
5542	}
5543
5544	function isPrimaryButton(e) {
5545		// Ignore mousedowns on any button other than the left (or primary)
5546		// mouse button, or when a modifier key is pressed.
5547		return (e.which === 1 && !e.ctrlKey && !e.altKey);
5548	}
5549
5550	function identifiedTouch(touchList, id) {
5551		var i, l;
5552
5553		if (touchList.identifiedTouch) {
5554			return touchList.identifiedTouch(id);
5555		}
5556
5557		// touchList.identifiedTouch() does not exist in
5558		// webkit yet… we must do the search ourselves...
5559
5560		i = -1;
5561		l = touchList.length;
5562
5563		while (++i < l) {
5564			if (touchList[i].identifier === id) {
5565				return touchList[i];
5566			}
5567		}
5568	}
5569
5570	function changedTouch(e, data) {
5571		var touch = identifiedTouch(e.changedTouches, data.identifier);
5572
5573		// This isn't the touch you're looking for.
5574		if (!touch) { return; }
5575
5576		// Chrome Android (at least) includes touches that have not
5577		// changed in e.changedTouches. That's a bit annoying. Check
5578		// that this touch has changed.
5579		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
5580
5581		return touch;
5582	}
5583
5584
5585	// Handlers that decide when the first movestart is triggered
5586
5587	function mousedown(e){
5588		// Ignore non-primary buttons
5589		if (!isPrimaryButton(e)) { return; }
5590
5591		// Ignore form and interactive elements
5592		if (isIgnoreTag(e)) { return; }
5593
5594		on(document, mouseevents.move, mousemove, e);
5595		on(document, mouseevents.cancel, mouseend, e);
5596	}
5597
5598	function mousemove(e, data){
5599		checkThreshold(e, data, e, removeMouse);
5600	}
5601
5602	function mouseend(e, data) {
5603		removeMouse();
5604	}
5605
5606	function removeMouse() {
5607		off(document, mouseevents.move, mousemove);
5608		off(document, mouseevents.cancel, mouseend);
5609	}
5610
5611	function touchstart(e) {
5612		// Don't get in the way of interaction with form elements
5613		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
5614
5615		var touch = e.changedTouches[0];
5616
5617		// iOS live updates the touch objects whereas Android gives us copies.
5618		// That means we can't trust the touchstart object to stay the same,
5619		// so we must copy the data. This object acts as a template for
5620		// movestart, move and moveend event objects.
5621		var data = {
5622			target:     touch.target,
5623			pageX:      touch.pageX,
5624			pageY:      touch.pageY,
5625			identifier: touch.identifier,
5626
5627			// The only way to make handlers individually unbindable is by
5628			// making them unique.
5629			touchmove:  function(e, data) { touchmove(e, data); },
5630			touchend:   function(e, data) { touchend(e, data); }
5631		};
5632
5633		on(document, touchevents.move, data.touchmove, data);
5634		on(document, touchevents.cancel, data.touchend, data);
5635	}
5636
5637	function touchmove(e, data) {
5638		var touch = changedTouch(e, data);
5639		if (!touch) { return; }
5640		checkThreshold(e, data, touch, removeTouch);
5641	}
5642
5643	function touchend(e, data) {
5644		var touch = identifiedTouch(e.changedTouches, data.identifier);
5645		if (!touch) { return; }
5646		removeTouch(data);
5647	}
5648
5649	function removeTouch(data) {
5650		off(document, touchevents.move, data.touchmove);
5651		off(document, touchevents.cancel, data.touchend);
5652	}
5653
5654	function checkThreshold(e, data, touch, fn) {
5655		var distX = touch.pageX - data.pageX;
5656		var distY = touch.pageY - data.pageY;
5657
5658		// Do nothing if the threshold has not been crossed.
5659		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
5660
5661		triggerStart(e, data, touch, distX, distY, fn);
5662	}
5663
5664	function triggerStart(e, data, touch, distX, distY, fn) {
5665		var touches = e.targetTouches;
5666		var time = e.timeStamp - data.timeStamp;
5667
5668		// Create a movestart object with some special properties that
5669		// are passed only to the movestart handlers.
5670		var template = {
5671			altKey:     e.altKey,
5672			ctrlKey:    e.ctrlKey,
5673			shiftKey:   e.shiftKey,
5674			startX:     data.pageX,
5675			startY:     data.pageY,
5676			distX:      distX,
5677			distY:      distY,
5678			deltaX:     distX,
5679			deltaY:     distY,
5680			pageX:      touch.pageX,
5681			pageY:      touch.pageY,
5682			velocityX:  distX / time,
5683			velocityY:  distY / time,
5684			identifier: data.identifier,
5685			targetTouches: touches,
5686			finger: touches ? touches.length : 1,
5687			enableMove: function() {
5688				this.moveEnabled = true;
5689				this.enableMove = noop;
5690				e.preventDefault();
5691			}
5692		};
5693
5694		// Trigger the movestart event.
5695		trigger(data.target, 'movestart', template);
5696
5697		// Unbind handlers that tracked the touch or mouse up till now.
5698		fn(data);
5699	}
5700
5701
5702	// Handlers that control what happens following a movestart
5703
5704	function activeMousemove(e, data) {
5705		var timer  = data.timer;
5706
5707		data.touch = e;
5708		data.timeStamp = e.timeStamp;
5709		timer.kick();
5710	}
5711
5712	function activeMouseend(e, data) {
5713		var target = data.target;
5714		var event  = data.event;
5715		var timer  = data.timer;
5716
5717		removeActiveMouse();
5718
5719		endEvent(target, event, timer, function() {
5720			// Unbind the click suppressor, waiting until after mouseup
5721			// has been handled.
5722			setTimeout(function(){
5723				off(target, 'click', preventDefault);
5724			}, 0);
5725		});
5726	}
5727
5728	function removeActiveMouse() {
5729		off(document, mouseevents.move, activeMousemove);
5730		off(document, mouseevents.end, activeMouseend);
5731	}
5732
5733	function activeTouchmove(e, data) {
5734		var event = data.event;
5735		var timer = data.timer;
5736		var touch = changedTouch(e, event);
5737
5738		if (!touch) { return; }
5739
5740		// Stop the interface from gesturing
5741		e.preventDefault();
5742
5743		event.targetTouches = e.targetTouches;
5744		data.touch = touch;
5745		data.timeStamp = e.timeStamp;
5746
5747		timer.kick();
5748	}
5749
5750	function activeTouchend(e, data) {
5751		var target = data.target;
5752		var event  = data.event;
5753		var timer  = data.timer;
5754		var touch  = identifiedTouch(e.changedTouches, event.identifier);
5755
5756		// This isn't the touch you're looking for.
5757		if (!touch) { return; }
5758
5759		removeActiveTouch(data);
5760		endEvent(target, event, timer);
5761	}
5762
5763	function removeActiveTouch(data) {
5764		off(document, touchevents.move, data.activeTouchmove);
5765		off(document, touchevents.end, data.activeTouchend);
5766	}
5767
5768
5769	// Logic for triggering move and moveend events
5770
5771	function updateEvent(event, touch, timeStamp) {
5772		var time = timeStamp - event.timeStamp;
5773
5774		event.distX =  touch.pageX - event.startX;
5775		event.distY =  touch.pageY - event.startY;
5776		event.deltaX = touch.pageX - event.pageX;
5777		event.deltaY = touch.pageY - event.pageY;
5778
5779		// Average the velocity of the last few events using a decay
5780		// curve to even out spurious jumps in values.
5781		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
5782		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
5783		event.pageX =  touch.pageX;
5784		event.pageY =  touch.pageY;
5785	}
5786
5787	function endEvent(target, event, timer, fn) {
5788		timer.end(function(){
5789			trigger(target, 'moveend', event);
5790			return fn && fn();
5791		});
5792	}
5793
5794
5795	// Set up the DOM
5796
5797	function movestart(e) {
5798		if (e.defaultPrevented) { return; }
5799		if (!e.moveEnabled) { return; }
5800
5801		var event = {
5802			startX:        e.startX,
5803			startY:        e.startY,
5804			pageX:         e.pageX,
5805			pageY:         e.pageY,
5806			distX:         e.distX,
5807			distY:         e.distY,
5808			deltaX:        e.deltaX,
5809			deltaY:        e.deltaY,
5810			velocityX:     e.velocityX,
5811			velocityY:     e.velocityY,
5812			identifier:    e.identifier,
5813			targetTouches: e.targetTouches,
5814			finger:        e.finger
5815		};
5816
5817		var data = {
5818			target:    e.target,
5819			event:     event,
5820			timer:     new Timer(update),
5821			touch:     undefined,
5822			timeStamp: e.timeStamp
5823		};
5824
5825		function update(time) {
5826			updateEvent(event, data.touch, data.timeStamp);
5827			trigger(data.target, 'move', event);
5828		}
5829
5830		if (e.identifier === undefined) {
5831			// We're dealing with a mouse event.
5832			// Stop clicks from propagating during a move
5833			on(e.target, 'click', preventDefault);
5834			on(document, mouseevents.move, activeMousemove, data);
5835			on(document, mouseevents.end, activeMouseend, data);
5836		}
5837		else {
5838			// In order to unbind correct handlers they have to be unique
5839			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
5840			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
5841
5842			// We're dealing with a touch.
5843			on(document, touchevents.move, data.activeTouchmove, data);
5844			on(document, touchevents.end, data.activeTouchend, data);
5845		}
5846	}
5847
5848	on(document, 'mousedown', mousedown);
5849	on(document, 'touchstart', touchstart);
5850	on(document, 'movestart', movestart);
5851
5852
5853	// jQuery special events
5854	//
5855	// jQuery event objects are copies of DOM event objects. They need
5856	// a little help copying the move properties across.
5857
5858	if (!window.jQuery) { return; }
5859
5860	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
5861
5862	function enableMove1(e) { e.enableMove(); }
5863	function enableMove2(e) { e.enableMove(); }
5864	function enableMove3(e) { e.enableMove(); }
5865
5866	function add(handleObj) {
5867		var handler = handleObj.handler;
5868
5869		handleObj.handler = function(e) {
5870			// Copy move properties across from originalEvent
5871			var i = properties.length;
5872			var property;
5873
5874			while(i--) {
5875				property = properties[i];
5876				e[property] = e.originalEvent[property];
5877			}
5878
5879			handler.apply(this, arguments);
5880		};
5881	}
5882
5883	jQuery.event.special.movestart = {
5884		setup: function() {
5885			// Movestart must be enabled to allow other move events
5886			on(this, 'movestart', enableMove1);
5887
5888			// Do listen to DOM events
5889			return false;
5890		},
5891
5892		teardown: function() {
5893			off(this, 'movestart', enableMove1);
5894			return false;
5895		},
5896
5897		add: add
5898	};
5899
5900	jQuery.event.special.move = {
5901		setup: function() {
5902			on(this, 'movestart', enableMove2);
5903			return false;
5904		},
5905
5906		teardown: function() {
5907			off(this, 'movestart', enableMove2);
5908			return false;
5909		},
5910
5911		add: add
5912	};
5913
5914	jQuery.event.special.moveend = {
5915		setup: function() {
5916			on(this, 'movestart', enableMove3);
5917			return false;
5918		},
5919
5920		teardown: function() {
5921			off(this, 'movestart', enableMove3);
5922			return false;
5923		},
5924
5925		add: add
5926	};
5927});
5928
5929  $.fn.twentytwenty = function(options) {
5930    var options = $.extend({
5931      default_offset_pct: 0.5,
5932      orientation: 'horizontal',
5933      before_label: 'Before',
5934      after_label: 'After',
5935      no_overlay: false,
5936      move_slider_on_hover: false,
5937      move_with_handle_only: true,
5938      click_to_move: false
5939    }, options);
5940
5941    return this.each(function() {
5942
5943      var sliderPct = options.default_offset_pct;
5944      var container = $(this);
5945      var sliderOrientation = options.orientation;
5946      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
5947      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
5948
5949
5950      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
5951      if(!options.no_overlay) {
5952        container.append("<div class='twentytwenty-overlay'></div>");
5953        var overlay = container.find(".twentytwenty-overlay");
5954        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
5955        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
5956      }
5957      var beforeImg = container.find("img:first");
5958      var afterImg = container.find("img:last");
5959      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
5960      var slider = container.find(".twentytwenty-handle");
5961      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
5962      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
5963      container.addClass("twentytwenty-container");
5964      beforeImg.addClass("twentytwenty-before");
5965      afterImg.addClass("twentytwenty-after");
5966
5967      var calcOffset = function(dimensionPct) {
5968        var w = beforeImg.width();
5969        var h = beforeImg.height();
5970        return {
5971          w: w+"px",
5972          h: h+"px",
5973          cw: (dimensionPct*w)+"px",
5974          ch: (dimensionPct*h)+"px"
5975        };
5976      };
5977
5978      var adjustContainer = function(offset) {
5979      	if (sliderOrientation === 'vertical') {
5980          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
5981          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
5982      	}
5983      	else {
5984          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
5985          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
5986    	}
5987        container.css("height", offset.h);
5988      };
5989
5990      var adjustSlider = function(pct) {
5991        var offset = calcOffset(pct);
5992        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
5993        adjustContainer(offset);
5994      };
5995
5996      // Return the number specified or the min/max number if it outside the range given.
5997      var minMaxNumber = function(num, min, max) {
5998        return Math.max(min, Math.min(max, num));
5999      };
6000
6001      // Calculate the slider percentage based on the position.
6002      var getSliderPercentage = function(positionX, positionY) {
6003        var sliderPercentage = (sliderOrientation === 'vertical') ?
6004          (positionY-offsetY)/imgHeight :
6005          (positionX-offsetX)/imgWidth;
6006
6007        return minMaxNumber(sliderPercentage, 0, 1);
6008      };
6009
6010
6011      $(window).on("resize.twentytwenty", function(e) {
6012        adjustSlider(sliderPct);
6013      });
6014
6015      var offsetX = 0;
6016      var offsetY = 0;
6017      var imgWidth = 0;
6018      var imgHeight = 0;
6019      var onMoveStart = function(e) {
6020        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
6021          e.preventDefault();
6022        }
6023        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
6024          e.preventDefault();
6025        }
6026        container.addClass("active");
6027        offsetX = container.offset().left;
6028        offsetY = container.offset().top;
6029        imgWidth = beforeImg.width();
6030        imgHeight = beforeImg.height();
6031      };
6032      var onMove = function(e) {
6033        if (container.hasClass("active")) {
6034          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6035          adjustSlider(sliderPct);
6036        }
6037      };
6038      var onMoveEnd = function() {
6039          container.removeClass("active");
6040      };
6041
6042      var moveTarget = options.move_with_handle_only ? slider : container;
6043      moveTarget.on("movestart",onMoveStart);
6044      moveTarget.on("move",onMove);
6045      moveTarget.on("moveend",onMoveEnd);
6046
6047      if (options.move_slider_on_hover) {
6048        container.on("mouseenter", onMoveStart);
6049        container.on("mousemove", onMove);
6050        container.on("mouseleave", onMoveEnd);
6051      }
6052
6053      slider.on("touchmove", function(e) {
6054        e.preventDefault();
6055      });
6056
6057      container.find("img").on("mousedown", function(event) {
6058        event.preventDefault();
6059      });
6060
6061      if (options.click_to_move) {
6062        container.on('click', function(e) {
6063          offsetX = container.offset().left;
6064          offsetY = container.offset().top;
6065          imgWidth = beforeImg.width();
6066          imgHeight = beforeImg.height();
6067
6068          sliderPct = getSliderPercentage(e.pageX, e.pageY);
6069          adjustSlider(sliderPct);
6070        });
6071      }
6072
6073      $(window).trigger("resize.twentytwenty");
6074    });
6075  };
6076
6077
6078  $(window).on("load", function(e) {
6079  	$('.twentytwenty-container').each(function(){
6080  		var $container = $(this);
6081  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6082  			$container.twentytwenty();
6083  		}
6084  		$('img', $container).on('async-done', function(){
6085	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
6086	  			$container.twentytwenty();
6087	  		}
6088	    });
6089  	});
6090  });
6091}
6092
6093UNCODE.justifiedGallery = function() {
6094
6095	var breakPointMe = function( val ) {
6096		val = parseInt( val );
6097		if ( isNaN(val) ) {
6098			return false;
6099		}
6100		if ( val >= 1500 ) {
6101			return 1;
6102		} else if ( val < 1500 && val >= 960 ) {
6103			return 2;
6104		} else if ( val < 960 && val >= 570 ) {
6105			return 3;
6106		} else if ( val < 570 ) {
6107			return 4;
6108		}
6109	}
6110
6111	var gutterByBreakpoint = function( bp, gutter ) {
6112		var ret;
6113		switch(gutter) {
6114		    case 'no-gutter':
6115		    	ret = 0;
6116		        break;
6117		    case 'px-gutter':
6118		    	ret = 1;
6119		        break;
6120		    case 'half-gutter':
6121		    	ret = 18;
6122		        break;
6123		    case 'double-gutter':
6124				switch(bp) {
6125				    case 3:
6126				    case 4:
6127				    	ret = 36;
6128				        break;
6129				    default:
6130				    	ret = 72;
6131				        break;
6132				}
6133		        break;
6134		    case 'triple-gutter':
6135				switch(bp) {
6136				    case 3:
6137				    case 4:
6138				    	ret = 36;
6139				        break;
6140				    default:
6141				    	ret = 108;
6142				        break;
6143				}
6144		        break;
6145		    case 'quad-gutter':
6146				switch(bp) {
6147				    case 2:
6148				    	ret = 108;
6149				        break;
6150				    case 3:
6151				    	ret = 72;
6152				        break;
6153				    case 4:
6154				    	ret = 36;
6155				        break;
6156				    default:
6157				    	ret = 144;
6158				        break;
6159				}
6160		        break;
6161		    default:
6162		    	ret = 36;//single-gutter
6163		}
6164		return ret;
6165	}
6166
6167	if ($('.justified-layout').length > 0) {
6168		var justifiedContainersArray = [],
6169			typeGridArray = [],
6170			layoutGridArray = [],
6171			transitionDuration = [],
6172			$filterItems = [],
6173			$filters = $('.justified-system .isotope-filters'),
6174			$itemSelector = '.tmb',
6175			$items,
6176			itemMargin,
6177			correctionFactor = 0,
6178			firstLoad = true,
6179			isOriginLeft = $('body').hasClass('rtl') ? false : true,
6180			prevW = breakPointMe(UNCODE.wwidth);
6181		$('[class*="justified-container"]').each(function() {
6182			var isoData = $(this).data();
6183			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6184			if (isoData.type == 'metro') typeGridArray.push(true);
6185			else typeGridArray.push(false);
6186			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
6187			else layoutGridArray.push('justified');
6188			justifiedContainersArray.push($(this));
6189		});
6190		var init_justifiedGallery = function() {
6191			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
6192				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
6193					justifiedId = justifiedSystem.attr('id'),
6194					$layoutMode = layoutGridArray[i],
6195					gutter = $(justifiedContainersArray[i]).data('gutter'),
6196					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
6197					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
6198					lastRow = $(justifiedContainersArray[i]).data('last-row'),
6199					margins;
6200
6201				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
6202				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
6203				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6204
6205				margins = gutterByBreakpoint(prevW, gutter);
6206
6207				$(justifiedContainersArray[i]).justifiedGallery({
6208					rowHeight: rowHeight,
6209					maxRowHeight: maxRowHeight,
6210					margins: margins,
6211					cssAnimation: true,
6212					lastRow: lastRow,
6213					waitThumbnailsLoad: false
6214				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6215
6216				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6217					$(justifiedContainersArray[i]).infinitescroll({
6218							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6219							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6220							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6221							animate: false,
6222							behavior: 'local',
6223							debug: false,
6224							loading: {
6225								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6226								speed: 0,
6227								finished: undefined,
6228								msg: $('#' + justifiedId + ' .loadmore-button'),
6229							},
6230							errorCallback: function() {
6231								var justified_system = $(this).closest('.justified-system');
6232								$('.loading-button', justified_system).hide();
6233								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
6234							}
6235						},
6236						// append the new items to galleryJustified on the infinitescroll callback function.
6237						function(newElements, opts) {
6238							var $galleryJustified = $(this),
6239								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
6240								filters = new Array(),
6241								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
6242								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
6243								$numPages = $('a', $infinite_button).data('pages'),
6244								delay = 300;
6245							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6246							$infinite_button.show();
6247							$loading_button.hide();
6248							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6249							$('> li', $galleryJustified).remove();
6250							$.each($(newElements), function(index, val) {
6251								$(val).addClass('tmb-iso');
6252								if ($(val).is("li")) {
6253									filters.push($(val)[0]);
6254								}
6255							});
6256							newElements = newElements.filter(function(x) {
6257								return filters.indexOf(x) < 0
6258							});
6259							$.each($(filters), function(index, val) {
6260								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
6261							});
6262							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
6263							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6264								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
6265								if (typeof getLightbox === 'object') {
6266									getLightbox.refresh();
6267								} else {
6268									UNCODE.lightbox();
6269								}
6270							}
6271							if ( typeof twttr !== 'undefined' )
6272								twttr.widgets.load(justifiedContainersArray[i]);
6273
6274							requestTimeout(function() {
6275								$galleryJustified.trigger('more-items-loaded');
6276								$(window).trigger('more-items-loaded');
6277							}, 1000);
6278						});
6279					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
6280						var $infinite_justified = $(justifiedContainersArray[i]),
6281							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
6282						$infinite_justified.infinitescroll('pause');
6283						$infinite_button.on('click', function(event) {
6284							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6285								$.each(UNCODE.lightboxArray, function(index, val) {
6286									UNCODE.lightboxArray[index].destroy();
6287								});
6288							}
6289							event.preventDefault();
6290							var $justified_system = $(event.target).closest('.justified-system'),
6291							$infinite_justified = $justified_system.find('.justified-container'),
6292							justifiedId = $justified_system.attr('id');
6293							$(event.currentTarget).html(SiteParameters.loading);
6294							$infinite_justified.infinitescroll('resume');
6295							$infinite_justified.infinitescroll('retrieve');
6296							$infinite_justified.infinitescroll('pause');
6297							$infinite_justified.trigger('more-items-loaded');
6298							$(window).trigger('more-items-loaded');
6299						});
6300					}
6301				}
6302			}
6303		},
6304		onLayout = function(justifiedObj, startIndex) {
6305			justifiedObj.css('opacity', 1);
6306			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
6307			$('.tmb', justifiedObj).addClass('justified-object-loaded');
6308
6309			requestTimeout(function() {
6310				// window.dispatchEvent(UNCODE.boxEvent);
6311				UNCODE.adaptive();
6312				if (SiteParameters.dynamic_srcset_active === '1') {
6313					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
6314				}
6315				if (typeof MediaElement === "function") {
6316					$(justifiedObj).find('audio,video').each(function() {
6317						$(this).mediaelementplayer({
6318								pauseOtherPlayers: false,
6319						});
6320					});
6321				}
6322				if ($(justifiedObj).find('.nested-carousel').length) {
6323					if (typeof UNCODE.carousel !== 'undefined') {
6324						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
6325					}
6326					requestTimeout(function() {
6327						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6328						justifiedObj.addClass('justified-gallery-finished')
6329						Waypoint.refreshAll();
6330					}, 200);
6331				} else {
6332					requestTimeout(function() {
6333						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6334						justifiedObj.addClass('justified-gallery-finished')
6335						Waypoint.refreshAll();
6336					}, 300);
6337				}
6338			}, 100);
6339
6340		},
6341		boxAnimation = function(items, startIndex, sequential, container) {
6342			var $allItems = items.length - startIndex,
6343				showed = 0,
6344				index = 0;
6345			if (container.closest('.owl-item').length == 1) return false;
6346			$.each(items, function(index, val) {
6347				var elInner = $('> .t-inside', val);
6348				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
6349					return;
6350				}
6351				if (val[0]) val = val[0];
6352				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
6353					new Waypoint({
6354						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
6355						element: val,
6356						handler: function() {
6357							var element = $('> .t-inside', this.element),
6358								parent = $(this.element),
6359								currentIndex = parent.index();
6360							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
6361								delayAttr = parseInt(element.attr('data-delay'));
6362							if (isNaN(delayAttr)) delayAttr = 100;
6363							delay -= showed;
6364							var objTimeout = requestTimeout(function() {
6365								element.removeClass('zoom-reverse').addClass('start_animation');
6366								showed = parent.index();
6367							}, delay * delayAttr);
6368							parent.data('objTimeout', objTimeout);
6369							if (!UNCODE.isUnmodalOpen) {
6370								this.destroy();
6371							}
6372						},
6373						offset: '100%'
6374					})
6375				} else {
6376					elInner.removeClass('animate_when_almost_visible');
6377					$(val).addClass('no-waypoint-animation');
6378					/*if (elInner.hasClass('force-anim')) {
6379						elInner.addClass('start_animation');
6380					} else {
6381						elInner.css('opacity', 1);
6382					}*/
6383				}
6384				index++;
6385			});
6386		};
6387		$filters.on('click', 'a[data-filter]', function(evt) {
6388			var $filter = $(this),
6389				filterContainer = $filter.closest('.isotope-filters'),
6390				filterValue = $filter.attr('data-filter'),
6391				container = $filter.closest('.justified-system').find($('.justified-layout')),
6392				lastRow = container.data('last-row'),
6393				transitionDuration = 0,
6394				delay = 300,
6395				filterItems = [];
6396
6397			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6398
6399			var filter_items = function(){
6400				if (filterValue !== undefined) {
6401					$.each($('> .tmb > .t-inside', container), function(index, val) {
6402						var parent = $(val).parent(),
6403							objTimeout = parent.data('objTimeout');
6404						if (objTimeout) {
6405							$(val).removeClass('zoom-reverse');
6406							clearRequestTimeout(objTimeout);
6407						}
6408						if (transitionDuration == 0) {
6409							if ($(val).hasClass('animate_when_almost_visible')) {
6410								$(val).addClass('zoom-reverse').removeClass('start_animation');
6411							} else {
6412								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6413							}
6414						}
6415					});
6416
6417					requestTimeout(function() {
6418						var $block,
6419							selector,
6420							lightboxElements,
6421							$boxes;
6422
6423						if ( filterValue !== '' && filterValue !== '*' ) {
6424							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
6425							selector = '.' + filterValue;
6426							$.each($(selector, container), function(index, block) {
6427								lightboxElements = $('[data-lbox^=ilightbox]', block);
6428								if (lightboxElements.length) {
6429									lightboxElements.removeClass('lb-disabled');
6430									container.data('lbox', $(lightboxElements[0]).data('lbox'));
6431								}
6432								filterItems.push(block);
6433							});
6434							container.justifiedGallery({
6435								filter: selector,
6436								lastRow: 'nojustify'
6437							});
6438						} else {
6439							container.justifiedGallery({
6440								filter: false,
6441								lastRow: lastRow
6442							});
6443							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
6444							filterItems = $('> .tmb', container);
6445						}
6446						container.trigger('more-items-loaded');
6447						$(window).trigger('more-items-loaded');
6448
6449						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6450						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6451							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
6452							if (typeof getLightbox === 'object') {
6453								getLightbox.refresh();
6454							} else {
6455								UNCODE.lightbox();
6456							}
6457						}
6458
6459						if (transitionDuration == 0) {
6460							requestTimeout(function() {
6461								boxAnimation(filterItems, 0, false, container);
6462							}, 100);
6463						}
6464						requestTimeout(function() {
6465							Waypoint.refreshAll();
6466							container.trigger('more-items-loaded');
6467							$(window).trigger('more-items-loaded');
6468						}, 2000);
6469
6470					}, delay);
6471				} else {
6472					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6473						$.each(UNCODE.lightboxArray, function(index, val) {
6474							UNCODE.lightboxArray[index].destroy();
6475						});
6476					}
6477					$.each($('> .tmb > .t-inside', container), function(index, val) {
6478						var parent = $(val).parent(),
6479							objTimeout = parent.data('objTimeout');
6480						if (objTimeout) {
6481							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6482							clearRequestTimeout(objTimeout);
6483						}
6484						if (transitionDuration == 0) {
6485							if ($(val).hasClass('animate_when_almost_visible')) {
6486								$(val).addClass('zoom-reverse').removeClass('start_animation');
6487							} else {
6488								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6489							}
6490						}
6491					});
6492					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6493						UNCODE.lightbox();
6494					}
6495					container.parent().addClass('justified-loading');
6496					container.trigger('more-items-loaded');
6497					$(window).trigger('more-items-loaded');
6498				}
6499			};
6500
6501			if (!$filter.hasClass('active')) {
6502				/** Scroll top with filtering */
6503				if (filterContainer.hasClass('filter-scroll')) {
6504                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6505                    calc_scroll -= UNCODE.get_scroll_offset();
6506
6507					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6508						delta = bodyTop - calc_scroll,
6509						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6510						filterTolerance = false,
6511						filter_timeout;
6512					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6513
6514					if ( !UNCODE.isFullPage ) {
6515						if (scrollSpeed == 0) {
6516							$('html, body').scrollTop(calc_scroll);
6517							UNCODE.scrolling = false;
6518							filter_items();
6519						} else {
6520
6521							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6522								filter_items();
6523								filterTolerance = true;
6524							}
6525
6526							$('html, body').animate({
6527								scrollTop: calc_scroll
6528							},{
6529								easing: 'easeInOutQuad',
6530								duration: scrollSpeed,
6531								complete: function(){
6532									UNCODE.scrolling = false;
6533									if ( !filterTolerance ) {
6534										filter_timeout = setTimeout(function(){
6535											clearTimeout(filter_timeout);
6536											filter_items();
6537										}, 200);
6538									}
6539								}
6540							});
6541						}
6542					}
6543				} else {
6544					filter_items();
6545				}
6546			}
6547			evt.preventDefault();
6548		});
6549
6550		$filters.each(function(i, buttonGroup) {
6551			var $buttonGroup = $(buttonGroup);
6552			$buttonGroup.on('click', 'a', function() {
6553				$buttonGroup.find('.active').removeClass('active');
6554				$(this).addClass('active');
6555			});
6556
6557			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6558				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6559				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6560			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6561				e.preventDefault();
6562				$cats_filters.slideToggle(400, 'easeInOutCirc');
6563			});
6564		});
6565		window.addEventListener('boxResized', function(e) {
6566			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
6567				prevW = breakPointMe(UNCODE.wwidth);
6568				$.each($('.justified-layout'), function(index, val) {
6569					var gutter = $(this).data('gutter'),
6570						margins = gutterByBreakpoint( prevW, gutter);
6571					$(this).justifiedGallery({
6572						margins: margins
6573					});
6574					$(this).find('.mejs-video,.mejs-audio').each(function() {
6575						$(this).trigger('resize');
6576					});
6577				});
6578			}
6579		}, false);
6580
6581		init_justifiedGallery();
6582	};
6583};
6584
6585UNCODE.cssGrid = function() {
6586	if ($('.cssgrid-layout').length > 0) {
6587		var cssGridContainersArray = [];
6588		var transitionDuration = [];
6589		var $filters = $('.cssgrid-system .cssgrid-filters');
6590
6591		$('[class*="cssgrid-container"]').each(function() {
6592			cssGridContainersArray.push($(this));
6593			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6594		});
6595
6596		var init_cssGridAjax = function() {
6597			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
6598				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
6599					cssGridId = cssGridSystem.attr('id');
6600
6601				cssGridSystem.data('transitionDuration', transitionDuration[i]);
6602
6603				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
6604					$(cssGridContainersArray[i]).infinitescroll({
6605						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
6606						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6607						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve
6608						animate: false,
6609						behavior: 'local',
6610						debug: false,
6611						loading: {
6612							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
6613							speed: 0,
6614							finished: undefined,
6615							msg: $('#' + cssGridId + ' .loadmore-button'),
6616						},
6617						errorCallback: function() {
6618							var cssgrid_system = $(this).closest('.cssgrid-system');
6619							$('.loading-button', cssgrid_system).hide();
6620							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
6621						}
6622					},
6623					// append the new items to cssGrid on the infinitescroll callback function.
6624					function(newElements, opts) {
6625						var $cssGrid = $(this),
6626							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
6627							cssGridId = cssGridSystemCont.attr('id'),
6628							filters = new Array(),
6629							$loading_button = cssGridSystemCont.find('.loading-button'),
6630							$infinite_button = cssGridSystemCont.find('.loadmore-button'),
6631							$numPages = $('a', $infinite_button).data('pages'),
6632							$woo_results,
6633							delay = 300;
6634						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6635						$infinite_button.show();
6636						$loading_button.hide();
6637						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6638						$('> li', $cssGrid).remove();
6639						$('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove();
6640						$.each($(newElements), function (index, val) {
6641							if ($(val).hasClass('woocommerce-result-count-wrapper')) {
6642								$woo_results = $(val);
6643								delete newElements[index];
6644							} else {
6645								$(val).addClass('tmb-grid');
6646								if ($(val).is("li")) {
6647									filters.push($(val)[0]);
6648								}
6649							}
6650						});
6651						newElements = newElements.filter(function(x) {
6652							return filters.indexOf(x) < 0
6653						});
6654						$.each($(filters), function(index, val) {
6655							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
6656						});
6657						if ($woo_results && $woo_results.length > 0) {
6658							var old_count = cssGridSystemCont.find('.woocommerce-result-count').text();
6659							var new_count = $woo_results.find('.woocommerce-result-count').text();
6660							var old_start = old_count.match(/(\d+)–(\d+)/)[1];
6661							var new_end = new_count.match(/(\d+)–(\d+)/)[2];
6662							function replaceMatch(match, p1, p2) {
6663        						return old_start + '–' + new_end;
6664							}
6665							var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch);
6666							cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text);
6667						}
6668
6669						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6670						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
6671						if (filterValue !== undefined && filterValue != '*') {
6672							$(newElements).hide();
6673							var els_to_show = $();
6674							$(newElements).each(function() {
6675								var el = $(this);
6676								if (el.hasClass(filterValue)) {
6677									els_to_show = els_to_show.add(el);
6678									el.show();
6679								}
6680							});
6681							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
6682						} else {
6683							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
6684						}
6685
6686						UNCODE.adaptive();
6687						if (SiteParameters.dynamic_srcset_active === '1') {
6688							UNCODE.refresh_dynamic_srcset_size($cssGrid);
6689						}
6690						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6691							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
6692							if (typeof getLightbox === 'object') {
6693								getLightbox.refresh();
6694							} else {
6695								UNCODE.lightbox();
6696							}
6697						}
6698						if ( typeof twttr !== 'undefined' ) {
6699							twttr.widgets.load(cssGridContainersArray[i]);
6700						}
6701
6702						UNCODE.carousel($(newElements));
6703						requestTimeout(function() {
6704							$cssGrid.trigger('more-items-loaded');
6705							$(window).trigger('more-items-loaded');
6706						}, 1000);
6707
6708					});
6709					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
6710						var $cssgrid_el = $(cssGridContainersArray[i]),
6711							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
6712						$cssgrid_el.infinitescroll('pause');
6713						$infinite_button.on('click', function(event) {
6714							event.preventDefault();
6715							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
6716							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
6717							cssGridId = $cssgrid_system.attr('id');
6718							$(event.currentTarget).html(SiteParameters.loading);
6719							$cssgrid_el.infinitescroll('resume');
6720							$cssgrid_el.infinitescroll('retrieve');
6721							$cssgrid_el.infinitescroll('pause');
6722						});
6723					}
6724				}
6725			}
6726		};
6727
6728		init_cssGridAjax();
6729
6730		if ($('.cssgrid-pagination').length > 0) {
6731			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
6732				evt.preventDefault();
6733
6734				if (SiteParameters.index_pagination_disable_scroll !== '1') {
6735					var container = $(this).closest('.cssgrid-system'),
6736					calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6737
6738					calc_scroll -= UNCODE.get_scroll_offset();
6739
6740					var menu_container = $('.menu-sticky');
6741					var menu = menu_container.find('.menu-container');
6742
6743					if (menu_container.length > 0 && menu.length > 0) {
6744						calc_scroll = calc_scroll - menu.outerHeight();
6745					}
6746
6747					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6748						delta = bodyTop - calc_scroll,
6749						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6750					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6751
6752					if ( !UNCODE.isFullPage ) {
6753						if (scrollSpeed == 0) {
6754							$('html, body').scrollTop(calc_scroll);
6755						} else {
6756							$('html, body').animate({
6757								scrollTop: calc_scroll
6758							},{
6759								easing: 'easeInOutQuad',
6760								duration: scrollSpeed,
6761								complete: function(){
6762									UNCODE.scrolling = false;
6763								}
6764							});
6765						}
6766					}
6767				}
6768
6769				loadCssGrid($(this), true);
6770			});
6771		}
6772
6773		$filters.on('click', 'a.grid-nav-link', function(evt) {
6774			if ($(this).hasClass('no-grid-filter')) {
6775				return;
6776			}
6777			var $filter = $(this),
6778				filterContainer = $filter.closest('.cssgrid-filters'),
6779				filterValue = $filter.attr('data-filter'),
6780				containerSystem = $filter.closest('.cssgrid-system'),
6781				container = containerSystem.find($('.cssgrid-layout')),
6782				transitionDuration = containerSystem.data('transitionDuration'),
6783				delay = 300,
6784				filterItems = [],
6785				all_thumbs = container.find('.tmb-grid');
6786
6787			var filter_items = function(){
6788				if (filterValue !== undefined) {
6789					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
6790						var parent = $(val).parent(),
6791							objTimeout = parent.data('objTimeout');
6792						if (objTimeout) {
6793							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6794							clearRequestTimeout(objTimeout);
6795						}
6796						if (transitionDuration == 0) {
6797							if ($(val).hasClass('animate_when_almost_visible')) {
6798								$(val).addClass('zoom-reverse').removeClass('start_animation');
6799							} else {
6800								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6801							}
6802						}
6803					});
6804					requestTimeout(function(){
6805						if ( filterValue == '*' ) {
6806							all_thumbs.show();
6807							all_thumbs.each(function(index, val) {
6808								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
6809								filterItems.push($(this));
6810							});
6811						} else {
6812							all_thumbs.each(function() {
6813								var _tmb = $(this);
6814								if (_tmb.hasClass(filterValue)) {
6815									_tmb.show();
6816									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
6817									filterItems.push(_tmb);
6818								} else {
6819									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
6820									_tmb.hide();
6821								}
6822							});
6823						}
6824
6825						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6826
6827						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
6828						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
6829						var lightboxElements = $('[data-lbox^=ilightbox]', container);
6830						if (lightboxElements.length) {
6831							container.data('lbox', $(lightboxElements[0]).data('lbox'));
6832							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6833								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
6834								if (typeof getLightbox === 'object') {
6835									getLightbox.refresh();
6836								} else {
6837									UNCODE.lightbox();
6838								}
6839							}
6840						}
6841						container.trigger('more-items-loaded');
6842						$(window).trigger('more-items-loaded');
6843					}, delay);
6844				} else {
6845					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
6846						var parent = $(val).parent(),
6847							objTimeout = parent.data('objTimeout');
6848						if (objTimeout) {
6849							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6850							clearRequestTimeout(objTimeout);
6851						}
6852						if (transitionDuration == 0) {
6853							if ($(val).hasClass('animate_when_almost_visible')) {
6854								$(val).addClass('zoom-reverse').removeClass('start_animation');
6855							} else {
6856								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6857							}
6858						}
6859					});
6860					loadCssGrid($filter);
6861				}
6862			};
6863
6864			if (!$filter.hasClass('active')) {
6865				/** Scroll top with filtering */
6866				if (filterContainer.hasClass('filter-scroll')) {
6867                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6868                    calc_scroll -= UNCODE.get_scroll_offset();
6869
6870					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6871						delta = bodyTop - calc_scroll,
6872						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6873						filterTolerance = false,
6874						filter_timeout;
6875					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6876
6877					if ( !UNCODE.isFullPage ) {
6878						if (scrollSpeed == 0) {
6879							$('html, body').scrollTop(calc_scroll);
6880							UNCODE.scrolling = false;
6881							filter_items();
6882						} else {
6883
6884							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6885								filter_items();
6886								filterTolerance = true;
6887							}
6888
6889							$('html, body').animate({
6890								scrollTop: calc_scroll
6891							},{
6892								easing: 'easeInOutQuad',
6893								duration: scrollSpeed,
6894								complete: function(){
6895									UNCODE.scrolling = false;
6896									if ( !filterTolerance ) {
6897										filter_timeout = setTimeout(function(){
6898											clearTimeout(filter_timeout);
6899											filter_items();
6900										}, 200);
6901									}
6902								}
6903							});
6904						}
6905					}
6906				} else {
6907					filter_items();
6908				}
6909			}
6910			evt.preventDefault();
6911		});
6912
6913		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
6914			var params = UNCODE.getURLParams(window.location);
6915			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
6916
6917			UNCODE.lastURL = window.location.href;
6918
6919			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
6920				return;
6921			}
6922
6923			if (params.id === undefined) {
6924				$.each($('.cssgrid-system'), function(index, val) {
6925					loadCssGrid($(val));
6926				});
6927			} else {
6928				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
6929					loadCssGrid($('#' + params.id));
6930				}
6931			}
6932		});
6933
6934		var loadCssGrid = function($href, $paginating) {
6935			var is_paginating = false;
6936
6937			if (undefined !== $paginating && $paginating) {
6938				var is_paginating = $paginating;
6939			}
6940
6941			var href = ($href.is("a") ? $href.attr('href') : location),
6942				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
6943				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
6944				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
6945				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
6946				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
6947				cssgridId = cssgridSystem.attr('id');
6948			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
6949				UNCODE.lastURL = href;
6950				history.pushState({
6951					myCSSgrid: true
6952				}, document.title, href);
6953			}
6954			cssgridWrapper.addClass('cssgrid-loading');
6955			if (is_paginating) {
6956				cssgridWrapper.addClass('grid-filtering');
6957			}
6958			$.ajax({
6959				url: href
6960			}).done(function(data) {
6961				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
6962					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
6963					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
6964				requestTimeout(function() {
6965					cssgridContainer.html($resultItems);
6966					cssgridWrapper.removeClass('cssgrid-loading');
6967					cssgridWrapper.removeClass('grid-filtering');
6968					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
6969					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
6970					UNCODE.adaptive();
6971					if (SiteParameters.dynamic_srcset_active === '1') {
6972						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
6973					}
6974					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6975						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
6976						if (typeof getLightbox === 'object') {
6977							getLightbox.refresh();
6978						} else {
6979							UNCODE.lightbox();
6980						}
6981					}
6982					cssgridContainer.trigger('more-items-loaded');
6983					$(window).trigger('more-items-loaded');
6984				}, 300);
6985
6986				$('.pagination', cssgridFooter).remove();
6987				cssgridFooter.append($resultPagination);
6988
6989				if (cssgridResultCount.length > 0) {
6990					$('.woocommerce-result-count', cssgridResultCount).remove();
6991					cssgridResultCount.append($resultCount);
6992				}
6993			});
6994		};
6995
6996		$filters.each(function(i, buttonGroup) {
6997			var $buttonGroup = $(buttonGroup);
6998			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
6999				$buttonGroup.find('.active').removeClass('active');
7000				$(this).addClass('active');
7001
7002			});
7003
7004			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
7005				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
7006				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
7007			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
7008				e.preventDefault();
7009				$cats_filters.slideToggle(400, 'easeInOutCirc');
7010			});
7011
7012		});
7013	};
7014};
7015
7016UNCODE.preventDoubleTransition = function() {
7017	$('.sticky-element .animate_when_almost_visible').each(function(){
7018		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
7019			$el.addClass('do_not_reanimate');
7020		});
7021	});
7022};
7023
7024UNCODE.checkScrollForTabs = function(){
7025	var goToSection = window.location.hash.replace('#', ''),
7026		$index;
7027
7028	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
7029	goToSection = encodeURIComponent(goToSection);
7030	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
7031
7032	$index.attr('data-parent', 'parent-' + goToSection);
7033
7034	if (window.location.hash != undefined && window.location.hash != '') {
7035		requestTimeout(function() {
7036			scrollBody('parent-' + goToSection);
7037		}, 500);
7038	}
7039
7040	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
7041		var hash = (e.currentTarget).hash,
7042			index = (e.currentTarget).closest('.uncode-tabs');
7043		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
7044			$('a[href="' + hash + '"][data-tab-history]').click();
7045			scrollBody(index);
7046		}
7047	});
7048
7049	var scrollBody = function(index) {
7050
7051		var getSection = $('a[href="' + index + '"][data-tab-history]'),
7052			scrollTo,
7053			safeGap = 27;
7054
7055		if ( ! getSection.length ) {
7056			getSection = $('div[data-parent="' + index + '"]');
7057
7058			if ( getSection.attr('data-target') == 'row' ) {
7059				getSection = getSection.closest('.vc_row');
7060				safeGap = 0;
7061			}
7062		}
7063
7064		if (typeof getSection === 'undefined' || ! getSection.length ) {
7065			return;
7066		}
7067
7068		var body = $("html, body"),
7069		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
7070		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
7071		getOffset = UNCODE.get_scroll_offset();
7072		if ( typeof getSection.offset() === 'undefined' )
7073			return;
7074		scrollTo = getSection.offset().top - safeGap;
7075		scrollTo -= getOffset;
7076
7077		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
7078		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
7079
7080		if (index != 0) {
7081			UNCODE.scrolling = true;
7082		}
7083
7084		if (scrollSpeed == 0) {
7085			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
7086			UNCODE.scrolling = false;
7087		} else {
7088			body.animate({
7089				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
7090			}, scrollSpeed, 'easeInOutQuad', function() {
7091				requestTimeout(function() {
7092					UNCODE.scrolling = false;
7093					if (getOffset != UNCODE.get_scroll_offset()) {
7094						scrollBody(index);
7095					}
7096				}, 100);
7097			});
7098		}
7099
7100	};
7101};
7102
7103UNCODE.printScreen = function() {
7104	var inlineMediaStyle = null,
7105		setResize;
7106
7107    function changeMediaStyle() {
7108		clearRequestTimeout(setResize);
7109		setResize = requestTimeout(function(){
7110	        var $head = document.getElementsByTagName('head')[0],
7111	        	$newStyle = document.createElement('style'),
7112	        	winW = window.innerWidth,
7113	        	printH = window.innerHeight;
7114
7115	        $newStyle.setAttribute('type', 'text/css');
7116	        $newStyle.setAttribute('media', 'print');
7117	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
7118
7119	        if (inlineMediaStyle != null) {
7120	            $head.replaceChild($newStyle, inlineMediaStyle)
7121	        } else {
7122	            $head.appendChild($newStyle);
7123	        }
7124	        inlineMediaStyle = $newStyle;
7125	    }, 1000);
7126    }
7127
7128    changeMediaStyle();
7129    window.addEventListener('resize', changeMediaStyle);
7130};
7131
7132UNCODE.fullPage = function() {
7133	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
7134		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
7135		return false;
7136	} else {
7137		requestTimeout(function() {
7138			window.scrollTo(0, 0);
7139		}, 10);
7140	}
7141
7142	var $masthead = $('#masthead'),
7143		$logo = $('#logo-container-mobile'),
7144		$logolink = $('[data-minheight]', $logo),
7145		logoMinScale = $logolink.data('minheight'),
7146		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
7147		$container = $('.main-container .post-content'),
7148		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
7149		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
7150		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
7151		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
7152		headerWithOpacity = $('.header-scroll-opacity', $header).length,
7153		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
7154		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
7155		scrollBar = true,
7156		effect,
7157		animationEndTimeOut,
7158		fp_anim_time = 900,
7159		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
7160		is_scrolling = false,
7161		dataNames = [],
7162		is_first = true,
7163		no_history = $('body').hasClass('uncode-scroll-no-history'),
7164		theres_footer = true;
7165
7166	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
7167		$('> div', $footer).each(function(index, el){
7168			if ( $(el).outerHeight() < 2 )
7169				theres_footer = false;
7170			else
7171				theres_footer = true;
7172		});
7173	}
7174
7175	if ( !$footer.length )
7176		theres_footer = false;
7177
7178	if ( !UNCODE.isFullPageSnap ) {
7179
7180		if ( $('body').hasClass('uncode-fullpage-zoom') )
7181			effect = 'scaleDown';
7182		else if ( $('body').hasClass('uncode-fullpage-parallax') )
7183			effect = 'moveparallax';
7184		else
7185			effect = 'movecurtain';
7186	}
7187
7188	if ( $('body').hasClass('uncode-fullpage-trid') )
7189		fp_anim_time = fp_anim_time*2;
7190
7191	if ( $header.length ) {
7192		if ( headerName !== '' )
7193			$header.attr('data-name', headerName);
7194		if ( headerLabel !== '' )
7195			$header.attr('data-label', headerLabel);
7196		$container.prepend($header);
7197	}
7198	if ( theres_footer ) {
7199		$container.append($footer);
7200		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
7201		$('aside.widget ul', $footer).addClass('no-list');
7202	}
7203
7204	var $all = $rows.add($header);
7205
7206	if ( theres_footer )
7207		$all = $all.add($footer);
7208
7209	$all.each(function(index, row) {
7210		if( index === 0 )
7211			$(row).addClass('uncode-scroll-active');
7212	});
7213
7214	if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') )
7215		$("<ul class='onepage-pagination'></ul>").prependTo("body");
7216
7217	$all.each(function(index, val) {
7218		var getName = $(val).data('name'),
7219			label;
7220
7221		if (typeof getName == 'undefined' || getName == 'undefined')
7222			getName = SiteParameters.slide_name + '-' + index;
7223
7224		//if ( dataNames.includes(getName) ) {
7225		if ( dataNames.indexOf(getName) > 0 ) {
7226			getName += '_' + index;
7227			$(val).data('name', getName);
7228		}
7229
7230		dataNames.push(getName);
7231
7232		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
7233
7234		if (typeof $(val).attr('data-label') !== 'undefined')
7235			label = $(val).attr('data-label');
7236		else label = '';
7237
7238		if ( $(val).is($footer) )
7239			return;
7240
7241		if (label != '' ) {
7242			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
7243			$('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
7244		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
7245			$('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span></a></li>");
7246		}
7247	});
7248
7249	var checkVisible = function( el, off ) {
7250		if (typeof jQuery === "function" && el instanceof jQuery) {
7251			el = el[0];
7252		}
7253
7254		off = typeof off=='undefined' ? 50 : off;
7255
7256		var rect = el.getBoundingClientRect();
7257
7258		return (
7259			(
7260				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7261				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7262				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7263			)
7264		);
7265	};
7266
7267	var animationEndAction = function( index, nextIndex ) {
7268		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
7269			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7270			player, iframe;
7271
7272		if ( !$nextSlide.is($footer) ) {
7273			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
7274		}
7275
7276		if ( !UNCODE.isFullPageSnap ) {
7277			activateKBurns( nextIndex );
7278		}
7279
7280		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
7281			if ($(this).attr('data-provider') == 'vimeo') {
7282				iframe = $(this).find('iframe');
7283				player = new Vimeo.Player(iframe[0]);
7284				player.pause();
7285			} else if ($(this).attr('data-provider') == 'youtube') {
7286				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
7287			} else {
7288				if ($(this).is('video')) {
7289					$(this)[0].volume = 0;
7290					$(this)[0].pause();
7291				}
7292			}
7293		});
7294
7295		if ( ! UNCODE.isMobile && headerWithOpacity ) {
7296			if ( $nextSlide.is($header) )
7297				$header.removeClass('header-scrolled');
7298		}
7299
7300		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
7301		$otherEl.each(function(){
7302			var $otherThis = $(this),
7303				$bgwrapperOther = $('.background-inner', $otherThis);
7304			if ( !checkVisible($otherThis) )
7305				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
7306
7307		});
7308
7309		if ( !checkVisible($currentSlide) ) {
7310			$currentSlide.removeClass('uncode-scroll-visible');
7311			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
7312			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
7313				currentScroll.scrollTo(0, 0, 0);
7314		}
7315
7316		clearRequestTimeout(animationEndTimeOut);
7317		animationEndTimeOut = requestTimeout(function(){
7318			Waypoint.refreshAll();
7319			$( document.body ).trigger('uncode_waypoints');
7320			var eventFP = new CustomEvent('fp-slide-changed');
7321			window.dispatchEvent(eventFP);
7322			is_scrolling = false;
7323
7324			if ( is_first ) {
7325				$('ul.onepage-pagination a').removeClass('is-selected');
7326				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
7327				is_first = false;
7328			}
7329
7330		}, 500);
7331	};
7332
7333	var postLeaveActions = function( nextIndex ){
7334		if ( menuHidden && ! UNCODE.isMobile )
7335			return false;
7336
7337		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7338			$cols = $('.uncol', $el),
7339			anchor = $el.data('anchor');
7340
7341		if ( ! UNCODE.isFullPageSnap ) {
7342			$.each($cols, function(index, val){
7343				if ( $(val).hasClass('style-light') ){
7344					$masthead.removeClass('style-dark-override').addClass('style-light-override');
7345					return false;
7346				} else if ( $(val).hasClass('style-dark') ) {
7347					$masthead.removeClass('style-light-override').addClass('style-dark-override');
7348					return false;
7349				}
7350			});
7351		}
7352
7353		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
7354			$('.menu-item' ).removeClass('active');
7355			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
7356		}
7357
7358		if ( !UNCODE.isFullPageSnap ) {
7359			activateBackWash( nextIndex );
7360		}
7361	};
7362
7363	var activateBackWash = function( nextIndex ){
7364		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7365			$bgwrapper;
7366
7367		if ( $el.length ) {
7368			if ( $el.hasClass('with-zoomout') ) {
7369				$bgwrapper = $('.background-inner:nth-child(1)', $el);
7370			} else if ( $('.with-zoomout', $el).length ) {
7371				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
7372			} else {
7373				return false;
7374			}
7375		} else {
7376			return false;
7377		}
7378
7379		$bgwrapper.addClass('uncode-zoomout');
7380
7381	};
7382
7383	var activateKBurns = function( nextIndex ){
7384		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7385			$bgwrapper;
7386
7387		if ( $el.length ) {
7388			if ( $el.hasClass('with-kburns') ) {
7389				$bgwrapper = $('.background-inner:nth-child(1)', $el);
7390			} else if ( $('.with-kburns', $el).length ) {
7391				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
7392			} else {
7393				return false;
7394			}
7395		} else {
7396			return false;
7397		}
7398
7399		$bgwrapper.addClass('uncode-kburns');
7400
7401	};
7402
7403	var activateParallax = function( nextIndex, direction ){
7404
7405		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7406			$cell = $('.fp-tableCell', $el),
7407			animationEnd = 'webkitAnimationEnd animationend',
7408			cellAnim;
7409
7410		switch( direction ) {
7411			case 'up':
7412				cellAnim = 'moveFromTopInner';
7413				break;
7414			default:
7415				cellAnim = 'moveFromBottomInner';
7416		}
7417
7418		$cell.css({
7419			'animation-name': cellAnim,
7420			'animation-duration': fp_anim_time + 'ms',
7421			'animation-delay': '',
7422			'animation-timing-function': fp_easing,
7423			'animation-fill-mode': 'both',
7424		}).off(animationEnd)
7425		.on(animationEnd, function(event) {
7426			if ( event.originalEvent.animationName === cellAnim ) {
7427				$cell
7428					.css({
7429						'animation-name': '',
7430						'animation-duration': '',
7431						'animation-delay': '',
7432						'animation-timing-function': '',
7433						'animation-fill-mode': '',
7434					});
7435			}
7436		});
7437	};
7438
7439	var scrollHashes = function(){
7440		var hash = window.location.hash.replace('#', '').split('/'),
7441			hashInd;
7442		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
7443			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
7444				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
7445				$.fn.fullpage.moveTo(hashInd+1);
7446			}
7447		} else if( hash[0] === '' ) {
7448			$.fn.fullpage.moveTo(1);
7449		}
7450	};
7451
7452	var hideMenu = function( index, nextIndex ){
7453		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
7454			return false;
7455
7456		var hMenu = UNCODE.menuHeight,
7457			transTime = hMenu * 2;
7458
7459		if ( index === 1 && nextIndex > 1 ) {
7460			hMenu = hMenu * -1;
7461		} else if  ( index !== 1 && nextIndex === 1 ) {
7462			hMenu = 0;
7463		} else {
7464			return false;
7465		}
7466
7467		$masthead.css({
7468			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
7469			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
7470			'-webkit-transition': 'transform 0.5s ease-in-out',
7471			'transition': 'transform 0.5s ease-in-out'
7472		});
7473	};
7474
7475	var shrinkMenu = function( index, nextIndex ){
7476		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
7477			return false;
7478
7479		if ( index === 1 && nextIndex > 1 ) {
7480			$logo.addClass('shrinked');
7481			$('div', $logo).each(function(index, val){
7482				$(val).css({
7483					'height': logoMinScale,
7484					'line-height': logoMinScale
7485				});
7486				if ($(val).hasClass('text-logo')) {
7487					$(val).css({
7488						'font-size': logoMinScale + 'px'
7489					});
7490				}
7491			});
7492			requestTimeout(function() {
7493				UNCODE.menuMobileHeight = $masthead.outerHeight();
7494			}, 300);
7495		} else if ( index !== 1 && nextIndex === 1 ) {
7496			$logo.removeClass('shrinked');
7497			$('div', $logo).each(function(index, val){
7498				$(val).css({
7499					'height': logoMaxScale,
7500					'line-height': logoMaxScale
7501				});
7502				if ($(val).hasClass('text-logo')) {
7503					$(val).css({
7504						'font-size': logoMaxScale + 'px'
7505					});
7506				}
7507			});
7508			requestTimeout(function() {
7509				UNCODE.menuMobileHeight = $masthead.outerHeight();
7510			}, 300);
7511		} else {
7512			return false;
7513		}
7514
7515	};
7516
7517	var anchorLink = function(){
7518
7519		$container.add('.menu-item').find('a[href*="#"]').click(function(e) {
7520			var $this = $(e.currentTarget),
7521				hash = e.currentTarget.href.split('#'),
7522				current = window.location.href.split('#'),
7523				ind,
7524				currentMenuOpened = UNCODE.menuOpened,
7525				go = false;
7526
7527			var hash_url = hash[0].replace(/\/?$/, '/'),
7528				current_url = current[0].replace(/\/?$/, '/');
7529
7530			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
7531				hash = '#'+hash[1];
7532				e.preventDefault();
7533				go = true;
7534			}
7535
7536			if ( go ) {
7537
7538				if ( $(hash).length ) {
7539					ind = $(hash).closest('.fp-section').index();
7540				} else {
7541					hash = hash.slice(1);
7542					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
7543				}
7544
7545				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
7546					ind = $this.closest('.fp-section').index();
7547
7548				UNCODE.menuOpened = false;
7549
7550				$.fn.fullpage.moveTo(ind+1);
7551
7552				UNCODE.menuOpened = currentMenuOpened;
7553				if (UNCODE.menuOpened) {
7554					if (UNCODE.wwidth < UNCODE.mediaQuery) {
7555						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
7556					} else {
7557						$('.mmb-container-overlay .overlay-close').trigger('click');
7558						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
7559					}
7560				}
7561
7562			}
7563
7564		});
7565
7566		$('.header-scrolldown').on('click', function(event) {
7567			event.preventDefault();
7568			var scrollDown = $(this),
7569				ind = scrollDown.closest('.fp-section').index();
7570
7571			$.fn.fullpage.moveTo(ind+2);
7572		});
7573
7574		var anchor = $('.fp-section.active').data('anchor');
7575
7576		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
7577			$('.menu-item').removeClass('active');
7578			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
7579		}
7580
7581	};
7582
7583	var slideLeave = function( index, nextIndex, direction ) {
7584		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
7585			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7586			animationEnd = 'webkitAnimationEnd animationend',
7587			transitionEnd = 'webkitTransitionEnd transitionend',
7588			animOut = effect != 'scaleDown' ? effect + direction : effect,
7589			animIn,
7590			isFooter = false,
7591			isFooterNext = false,
7592			footerH = $footer.outerHeight(),
7593			timeout,
7594			player, iframe,
7595			footerCoeff;
7596		switch( direction ) {
7597			case 'up':
7598				animIn = 'moveFromTop';
7599				break;
7600			default:
7601				animIn = 'moveFromBottom';
7602		}
7603
7604		if ( $('body').hasClass('uncode-fullpage-trid') ) {
7605			animOut = animIn + 'trid';
7606			animIn = animOut + 'In';
7607		} else if ( UNCODE.isFullPageSnap ) {
7608			animIn = animOut = 'none';
7609		}
7610
7611		hideMenu(index, nextIndex);
7612		shrinkMenu(index, nextIndex);
7613
7614		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
7615			if ($(this).attr('data-provider') == 'vimeo') {
7616				iframe = $(this).find('iframe');
7617				player = new Vimeo.Player(iframe[0]);
7618				player.pause();
7619			} else if ($(this).attr('data-provider') == 'youtube') {
7620				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
7621			} else {
7622				if ($(this).is('video')) {
7623					$(this)[0].volume = 0;
7624					$(this)[0].pause();
7625				}
7626			}
7627		});
7628
7629		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
7630			if ($(this).attr('data-provider') == 'vimeo') {
7631				iframe = $(this).find('iframe');
7632				iframe.on('load', function(){
7633					player = new Vimeo.Player(iframe);
7634					player.setVolume(0);
7635					player.play();
7636				});
7637				player = new Vimeo.Player(iframe);
7638				player.setVolume(0);
7639				player.play();
7640			} else if ($(this).attr('data-provider') == 'youtube') {
7641				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
7642			} else {
7643				if ($(this).is('video')) {
7644					$(this)[0].volume = 0;
7645					$(this)[0].play();
7646				}
7647			}
7648		});
7649
7650		if ( $currentSlide.is($footer) )
7651			isFooter = true;
7652
7653		if ( $nextSlide.is($footer) )
7654			isFooterNext = true;
7655
7656		if ( ! UNCODE.isMobile && headerWithOpacity ) {
7657			if ( $currentSlide.is($header) )
7658				$header.addClass('header-scrolled');
7659		}
7660
7661		footerCoeff = footerH;
7662
7663		if ( UNCODE.isFullPageSnap ) {
7664			postLeaveActions( nextIndex );
7665			activateBackWash( nextIndex );
7666			activateKBurns( nextIndex );
7667			requestTimeout(function(){
7668				animationEndAction( index, nextIndex );
7669			}, fp_anim_time+150);
7670		} else {
7671			if ( isFooterNext ) {
7672
7673				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
7674				$iscrollWrapper.addClass('no-scrolloverflow');
7675
7676				$nextSlide
7677				.add($currentSlide)
7678				.addClass('uncode-scroll-front')
7679				.addClass('uncode-scroll-active')
7680				.addClass('uncode-scroll-visible');
7681				$container.css({
7682					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
7683					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
7684					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7685					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7686				}).off(transitionEnd)
7687				.one(transitionEnd, function(){
7688					animationEndAction( index, nextIndex );
7689				});
7690
7691			} else if ( isFooter ) {
7692
7693				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
7694				.add($currentSlide)
7695				.addClass('uncode-scroll-front')
7696				.addClass('uncode-scroll-active')
7697				.addClass('uncode-scroll-visible');
7698				$container.css({
7699					'-webkit-transform': 'translate3d(0, 0, 0)',
7700					'transform': 'translate3d(0, 0, 0)',
7701					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7702					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7703				})
7704				.one(transitionEnd, function(){
7705					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
7706						clearRequestTimeout(timeout);
7707						timeout = requestTimeout(function(){
7708							$.fn.fullpage.moveTo(nextIndex);
7709							slideLeave( index-1, nextIndex, 'up' );
7710							$container.off(transitionEnd);
7711						}, 50);
7712					}
7713					animationEndAction( index, nextIndex );
7714				});
7715
7716			} else {
7717
7718				postLeaveActions( nextIndex );
7719
7720				if ( !$('body').hasClass('uncode-fullpage-trid') )
7721					activateParallax( nextIndex, direction );
7722
7723				var $outBg = $('.background-wrapper', $currentSlide);
7724
7725				$nextSlide
7726				.addClass('uncode-scroll-front')
7727				.addClass('uncode-scroll-active')
7728				.addClass('uncode-scroll-visible')
7729				.addClass('uncode-scroll-animating-in')
7730				.css({
7731					'z-index':4,
7732					'animation-name': animIn,
7733					'animation-duration': fp_anim_time + 'ms',
7734					'animation-delay': '',
7735					'animation-timing-function': fp_easing,
7736					'animation-fill-mode': 'both',
7737					'transition': 'initial',
7738				}).off(animationEnd)
7739				.on(animationEnd, function(event) {
7740					if ( event.originalEvent.animationName === animIn ) {
7741						$(this)
7742							.addClass('uncode-scroll-already')
7743							.removeClass('uncode-scroll-front')
7744							.removeClass('uncode-scroll-animating-in')
7745							.css({
7746								'animation-name': '',
7747								'animation-duration': '',
7748								'animation-delay': '',
7749								'animation-timing-function': '',
7750								'animation-fill-mode': '',
7751								'transition': 'initial',
7752							});
7753
7754						$currentSlide
7755							.removeClass('uncode-scroll-active')
7756							.add($outBg)
7757							.css({
7758								'animation-name': '',
7759								'animation-duration': '',
7760								'animation-delay': '',
7761								'animation-timing-function': '',
7762								'animation-fill-mode': '',
7763								'transition': 'initial',
7764							});
7765
7766						animationEndAction( index, nextIndex );
7767
7768					}
7769
7770					if ( nextIndex > 1 )
7771						$('body').addClass('window-scrolled');
7772					else
7773						$('body').removeClass('window-scrolled');
7774				});
7775
7776				$currentSlide
7777					.addClass('uncode-scroll-animating-out')
7778					.removeClass('uncode-scroll-front')
7779					.css({
7780						'z-index':'1',
7781						'animation-name': animOut,
7782						'animation-duration': fp_anim_time + 'ms',
7783						'animation-delay': '',
7784						'animation-timing-function': fp_easing,
7785						'animation-fill-mode': 'both',
7786						'transition': 'initial',
7787						'will-change': 'auto'
7788					}).off(animationEnd)
7789					.on(animationEnd, function(event) {
7790						if ( event.originalEvent.animationName === animOut ) {
7791							$currentSlide.removeClass('uncode-scroll-animating-out');
7792						}
7793					});
7794
7795				if ( $('body').hasClass('uncode-fp-opacity') ) {
7796					$currentSlide.find('> div').css({
7797						'animation-name': 'opacityout',
7798						'animation-duration': fp_anim_time + 'ms',
7799						'animation-delay': '',
7800						'animation-timing-function': fp_easing,
7801						'animation-fill-mode': 'both',
7802						'transition': 'initial',
7803					}).off(animationEnd)
7804					.on(animationEnd, function(event) {
7805						if ( event.originalEvent.animationName === 'opacityout' ) {
7806							$(event.currentTarget).css({
7807								'animation-name': '',
7808								'animation-duration': '',
7809								'animation-delay': '',
7810								'animation-timing-function': '',
7811								'animation-fill-mode': '',
7812								'transition': '',
7813							});
7814						}
7815					});
7816				}
7817			}
7818		}
7819
7820		$('.scroll-top').on('click', function(e){
7821			$.fn.fullpage.moveTo(1);
7822			return false;
7823		});
7824
7825	};
7826
7827	var init_fullPage = function(mode){
7828
7829		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
7830		// 	scrollBar = false;
7831		// }
7832
7833		var checkFPeffects;
7834
7835		$container.fullpage({
7836			sectionSelector: '.uncode-scroll-lock',
7837			scrollOverflow: true,
7838			scrollOverflowOptions: {
7839				click: false,
7840				preventDefaultException: { tagName:/.*/ }
7841			},
7842			navigation: false,
7843			scrollBar: scrollBar,
7844			scrollingSpeed: fp_anim_time,
7845			verticalCentered: true,
7846			anchors: no_history ? false : dataNames,
7847			recordHistory: !no_history,
7848			afterRender: function(){
7849				$('body').removeClass('fp-waiting');
7850				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
7851					var $invisible = $(this).addClass('hidden-scroll');//,
7852				});
7853				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
7854					var $visible = $(this).addClass('uncode-scroll-visible'),
7855						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
7856					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
7857				});
7858
7859				$('ul.onepage-pagination a').on('click', function(e){
7860					e.preventDefault();
7861					var $a = $(this),
7862						toIndex = $a.data('index');
7863
7864					$.fn.fullpage.moveTo(toIndex+1);
7865				});
7866
7867				requestTimeout(function(){
7868					scrollHashes();
7869				}, 1000);
7870
7871				$(window).on('hashchange', function(e){
7872					requestTimeout(function(){
7873						scrollHashes();
7874					}, 500);
7875				});
7876
7877				anchorLink();
7878
7879				if ( $('body').hasClass('uncode-fp-opacity') ) {
7880					$all.each(function(index, row) {
7881						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
7882							classBg;
7883
7884						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
7885							classBg = testmatch[0];
7886							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
7887						}
7888					});
7889				}
7890
7891				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
7892					$(window).on('menuOpen gdprOpen', function(){
7893						$.fn.fullpage.setAutoScrolling(false);
7894					}).on('menuClose gdprClose', function(){
7895						$.fn.fullpage.setAutoScrolling(true);
7896					});
7897				}
7898
7899				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
7900					requestTimeout(function(){
7901						$.fn.fullpage.setAutoScrolling(false);
7902					}, 1000);
7903				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
7904					$.fn.fullpage.setAutoScrolling(true);
7905				});
7906
7907				if ( !UNCODE.isFullPageSnap ) {
7908					clearRequestTimeout(checkFPeffects);
7909					checkFPeffects = requestTimeout(function(){
7910						activateBackWash( 1 );
7911						activateKBurns( 1 );
7912					}, 100);
7913				}
7914
7915			},
7916			onLeave: function( index, nextIndex, direction ){
7917
7918				if ( UNCODE.menuOpened || is_scrolling )
7919					return false;
7920
7921				is_scrolling = true;
7922
7923				var event = new CustomEvent('fp-slide-leave');
7924				window.dispatchEvent(event);
7925
7926				slideLeave( index, nextIndex, direction );
7927
7928				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
7929					if ( direction === 'up' ) {
7930						$.fn.fullpage.moveTo(nextIndex-1);
7931					} else {
7932						$.fn.fullpage.moveTo(nextIndex+1);
7933					}
7934					return false;
7935				}
7936
7937				$('ul.onepage-pagination a').removeClass('is-selected');
7938				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
7939
7940			}
7941		});
7942	};
7943
7944	init_fullPage();
7945	$(window).on('load', function(){
7946		requestTimeout(function(){
7947			$.fn.fullpage.reBuild();
7948		}, 3000);
7949	});
7950
7951	var addScrollingClass,
7952		removeScrollingClass;
7953
7954	window.addEventListener("fp-slide-scroll", function(){
7955		addScrollingClass = requestTimeout( function(){
7956			$('body').addClass('fp-slide-scrolling');
7957		}, 10 );
7958
7959		clearRequestTimeout(removeScrollingClass);
7960		removeScrollingClass = requestTimeout( function(){
7961			$('body').removeClass('fp-slide-scrolling');
7962		}, 150 );
7963
7964		Waypoint.refreshAll();
7965	}, false);
7966
7967	var setFPheight = function(){
7968		var $body = document.body,
7969			$footer = document.getElementById('colophon'),
7970			$maincontainer = document.querySelector('.main-wrapper'),
7971			$boxcontainer = document.querySelector('.box-container'),
7972			$sections = document.querySelectorAll('.fp-section'),
7973			rect = $maincontainer.getBoundingClientRect(),
7974			rect2 = $boxcontainer.getBoundingClientRect(),
7975			$masthead = document.getElementById('masthead'),
7976			_hideMenu = false,
7977			menuHeight = UNCODE.menuHeight;
7978		$body.style.height = UNCODE.wheight + 'px';
7979
7980		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
7981			_hideMenu = true;
7982		}
7983		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
7984			menuHeight = 0
7985		}
7986
7987
7988		if ( theres_footer )
7989			$footer.style.top = (rect.height || rect2.height) + 'px';
7990
7991		for (var i = 0; i < $sections.length; i++) {
7992			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
7993		}
7994	};
7995
7996	setFPheight();
7997
7998	window.addEventListener('resize', setFPheight, false);
7999	window.addEventListener('orientationchange', setFPheight, false);
8000
8001};
8002
8003UNCODE.particles = function() {
8004	$(".vc-particles-background").each(function() {
8005		var $particle = $(this);
8006		var $parent = $particle.closest('[data-parent]');
8007
8008		$parent.prepend($particle);
8009		// $(window).trigger('resize');
8010	})
8011};
8012
8013
8014UNCODE.readMoreCol = function( $el ){
8015	if ( typeof $el === 'undefined' || $el === null ) {
8016		$el = $('body');
8017	}
8018	var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el);
8019	$readMoreCols.each(function(){
8020		var $uncont = $(this),
8021			$row = $uncont.closest('.row-container'),
8022			max_h = $uncont.attr('data-ov-height'),
8023			max_h_mobile = $uncont.attr('data-ov-height-mobile'),
8024			actual_max_h = $uncont.outerHeight(),
8025			inner_h,
8026			$read_more = $('+ .btn-more-wrap', $uncont),
8027			read_more_resize = $read_more.hasClass('trigger-resize'),
8028			marginClosedBtn = $uncont.attr('data-margin-closed'),
8029			marginClosed = 0,
8030			marginOpenBtn = $uncont.attr('data-margin-open'),
8031			marginOpen = 0,
8032			anim_t = 250,
8033			resized = false;
8034
8035		max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile;
8036
8037		switch (marginClosedBtn) {
8038			case 'sm':
8039				marginClosed = 18
8040				break;
8041				
8042			case 'std':
8043				marginClosed = 36
8044				break;
8045				
8046			case 'lg':
8047				marginClosed = 72
8048				break;
8049				
8050			case '':
8051			default:
8052				marginClosed = 0
8053				break;
8054				
8055		}
8056
8057		switch (marginOpenBtn) {
8058			case 'sm':
8059				marginOpen = 18
8060				break;
8061				
8062			case 'std':
8063				marginOpen = 36
8064				break;
8065				
8066			case 'lg':
8067				marginOpen = 72
8068				break;
8069				
8070			case 'no':
8071				marginOpen = 0
8072				break;
8073				
8074		}
8075
8076		var checkToggleMobile = function(){
8077			if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) {
8078				resized = true;
8079				if ( $read_more.hasClass('state-closed') ) {
8080					$uncont[0].style.height = '';
8081					$uncont[0].style.maxHeight = max_h_mobile;
8082				}
8083			} if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) {
8084				if ( $read_more.hasClass('state-closed') ) {
8085					$uncont[0].style.height = '';
8086					$uncont[0].style.maxHeight = max_h;
8087				}
8088				resized = false;
8089			}
8090		}
8091		checkToggleMobile();
8092		$(window).on('resize', function() {
8093			checkToggleMobile();
8094		});
8095
8096		$('a', $read_more).on('click', function(e){
8097			e.preventDefault();
8098
8099			var $a = $(this);
8100
8101			if ( $read_more.hasClass('state-closed') ) {
8102
8103				$read_more
8104					.removeClass('state-closed')
8105					.addClass('state-open');
8106
8107				$uncont.css({
8108					'max-height': 'none',
8109					'height': 'auto',
8110				});
8111	
8112				inner_h = parseFloat( $uncont.outerHeight() );
8113
8114				$uncont.css({
8115					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8116				});
8117		
8118				anim_t = inner_h - actual_max_h;
8119				if ( anim_t < 250 ) {
8120					anim_t = 250;
8121				} else if ( anim_t > 1000 ) {
8122					anim_t = 1000;
8123				}
8124
8125				$uncont.css({
8126					'transition-duration' : anim_t + 'ms'
8127				}).addClass('overflow-mask-animation').animate({
8128					'height': inner_h
8129				}, anim_t, 'easeInOutCubic', function(){
8130					$uncont.css({
8131						'height' : 'auto'
8132					}).removeClass('overflow-mask');
8133					if ( read_more_resize === true ) {
8134						window.dispatchEvent(new Event('resize'));
8135						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8136							ScrollTrigger.refresh(true);
8137						}
8138					}
8139				});
8140
8141				if ( marginOpen != '' ) {
8142					$read_more.animate({
8143						'margin-top' : marginOpen
8144					}, anim_t, 'easeInOutCubic');
8145				}
8146
8147			} else {
8148				$read_more
8149					.removeClass('state-open')
8150					.addClass('state-closed');
8151
8152				$uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({
8153					'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h
8154				}, anim_t, 'easeInOutCubic', function(){
8155					if ( read_more_resize === true ) {
8156						window.dispatchEvent(new Event('resize'));
8157						if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) {
8158							ScrollTrigger.refresh(true);
8159						}
8160					}
8161				});
8162
8163				if ( marginClosed !== '' ) {
8164					$read_more.animate({
8165						'margin-top' : marginClosed
8166					}, anim_t, 'easeInOutCubic');
8167				}
8168
8169				if ( $a.hasClass('toggle-scroll') ) {
8170                    var $masthead = $('#masthead > div:first-child'),
8171                        headH = $masthead.outerHeight(),
8172						rectTop = $row[0].getBoundingClientRect().top,
8173						checkNavBar = $a.hasClass('toggle-navbar'),
8174						checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'),
8175                        offCont = ( $row.offset().top );
8176
8177					if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
8178						checkNavBar = checkNavBarMobile;
8179					}
8180
8181					if ( checkNavBar ) {
8182						offCont = offCont - headH;
8183					}
8184			
8185					if ( rectTop < headH ) {
8186						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
8187							$(this).stop();
8188						}).animate({
8189							scrollTop: offCont
8190						}, anim_t, 'easeInOutCubic');
8191					}
8192				}
8193
8194			}
8195		});
8196	});
8197}
8198UNCODE.filters = function() {
8199	var $systems = $('.isotope-system, .cssgrid-system');
8200
8201	$systems.each(function(index, val){
8202		var $system = $(this),
8203			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
8204			$widgets = $('.widgetized-cb-wrapper', $system),
8205			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
8206			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
8207			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
8208			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
8209
8210		if ($system.hasClass('isotope-processed')) {
8211			return;
8212		}
8213
8214		$cats_trigger.on('click', function(e) {
8215			if ( ! $('html').hasClass('screen-sm') ) {
8216				// $widgets.add($sorting_dd).slideUp(400);
8217				e.preventDefault();
8218				$widgets.slideUp(400, 'easeInOutCirc');
8219			}
8220		});
8221
8222		$('.filters-toggle-trigger', $system).on('click', function(e) {
8223			e.preventDefault();
8224			var $filters = $('.isotope-filters .menu-horizontal', $system);
8225			$filters.slideToggle(400, 'easeInOutCirc');
8226			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8227		});
8228
8229		$widget_trgr.on('click', function(e) {
8230			e.preventDefault();
8231			$widgets.slideToggle(400, 'easeInOutCirc');
8232			if (!$('html').hasClass('screen-sm')) {
8233				$cats_filters.slideUp(400, 'easeInOutCirc');
8234			}
8235			window.dispatchEvent(new CustomEvent('boxResized'));
8236		});
8237
8238		$sorting_trgr.on('click', function(e) {
8239			e.preventDefault();
8240			if (!$('html').hasClass('screen-sm')) {
8241				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
8242			}
8243		});
8244
8245		$system.addClass('isotope-processed');
8246	});
8247
8248};
8249
8250UNCODE.widgets = function() {
8251	var widget_collapses = $('.widget-collapse');
8252
8253	widget_collapses.each(function(){
8254		var widget_collapse = $(this),
8255			widget_title = widget_collapse.find('.widget-title'),
8256			widget = widget_title.closest('.widget'),
8257			content = widget.children().not('.widget-title'),
8258			setCTA;
8259
8260		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
8261			widget_title.toggleClass('open');
8262		}
8263
8264		widget_title.each(function() {
8265			var _this = $(this);
8266			var content = _this.closest('.widget').find('.widget-collapse-content');
8267
8268			$(window).on('load resize', function(){
8269				clearRequestTimeout(setCTA);
8270				setCTA = requestTimeout( function() {
8271					if ( content.is(':visible') ) {
8272						_this.addClass( 'open' );
8273					} else {
8274						_this.removeClass( 'open' );
8275					}
8276				}, 10 );
8277			})
8278
8279			_this.on( 'click', function(){
8280
8281				// Get content of :after element (+ icon) to check the visibility
8282				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
8283
8284				if (icon_content === 'none' || !icon_content) {
8285					return false;
8286				}
8287
8288				_this.toggleClass('open');
8289				var isOpen = _this.hasClass('open'),
8290					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
8291				content.animate({
8292					height: 'toggle',
8293					padding: 'toggle',
8294					opacity: 'toggle',
8295					top: isOpen ? 0 : hasBorder
8296				}, {
8297					duration: 400,
8298					easing: "easeInOutCirc",
8299				});
8300
8301				return false;
8302
8303			});
8304		});
8305	});
8306
8307	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
8308};
8309
8310UNCODE.unmodal = function() {
8311	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
8312		$('.unmodal-overlay').fadeIn();
8313		$('.unmodal-overlay').addClass('loading');
8314		$('body').addClass('uncode-unmodal-overlay-visible');
8315		$(window).trigger('unmodal-open');
8316	});
8317
8318	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
8319		$('.unmodal-overlay').fadeOut();
8320		$('.unmodal').fadeOut();
8321		$('body').removeClass('uncode-unmodal-overlay-visible');
8322		$('body').removeClass('uncode-unmodal-open');
8323		$('html').removeClass('uncode-unmodal-body-disable-scroll');
8324		$(document).trigger('unmodal-close');
8325		UNCODE.isUnmodalOpen = false;
8326	});
8327
8328	$(document).on('uncode-unmodal-show-content', function() {
8329		$('.unmodal-overlay').removeClass('loading');
8330		$('.unmodal').show();
8331		$('.unmodal').addClass('show-unmodal-with-animation');
8332		$('.unmodal-content')[0].scrollTop = 0;
8333		$('body').addClass('uncode-unmodal-open');
8334		UNCODE.isUnmodalOpen = true;
8335
8336		if ($('body').hasClass('qw-body-scroll-disabled')) {
8337			$('html').addClass('uncode-unmodal-body-disable-scroll');
8338		}
8339
8340		if ($('.unmodal').hasClass('auto-height')) {
8341			set_modal_height();
8342		}
8343	});
8344
8345	var set_modal_height = function() {
8346		var modal = $('.unmodal');
8347		var window_height = $(window).outerHeight();
8348		var modal_height = modal.outerHeight();
8349
8350		modal.css('height', 'auto');
8351
8352		if (modal_height > window_height) {
8353			modal.outerHeight(window_height);
8354		}
8355	}
8356
8357	if ($('.unmodal').hasClass('auto-height')) {
8358		var setCTA;
8359
8360		$(window).on('resize', function() {
8361			clearRequestTimeout(setCTA);
8362			setCTA = requestTimeout(function() {
8363				set_modal_height();
8364			}, 100);
8365		});
8366	}
8367};
8368
8369UNCODE.bgChanger = function() {
8370	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
8371		$bg_first = $('.vc_row[data-bg-remove]'),
8372		bg_remove = $bg_first.attr('data-bg-remove'),
8373		$first = $bg_changers.first(),
8374		$last = $bg_changers.last(),
8375		$bg_wrapper = $('#changer-back-color'),
8376		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
8377		setCTA, localH = UNCODE.wheight,
8378		isScrolling;
8379
8380	$bg_first.removeClass(bg_remove);
8381
8382	var bgChange = function($col, bgColor, skin, tmbskin){
8383		$bg_wrapper.attr( 'class', bgColor );
8384		var menuskin;
8385		if ( typeof skin !== 'undefined' ) {
8386			menuskin = skin.replace('style', 'menu')
8387		}
8388
8389		if ( $col.length ) {
8390			$('.uncol[data-skin-change]').each(function(){
8391				var $isoFooter = $('.isotope-footer', this);
8392				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
8393				if ( menuskin !== '' ) {
8394					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
8395				}
8396			});
8397
8398			$('.tmb[data-skin-change]').each(function(){
8399				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
8400			});
8401		}
8402	};
8403
8404	var $masthead = $('#masthead'),
8405		transDesktop,
8406		transMobile,
8407		changeSkin,
8408
8409	checkTransparencyAndChange = function( skin ){
8410		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
8411		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
8412		changeSkin = $masthead.hasClass('menu-change-skin');
8413
8414		if ( ! transDesktop && ! transMobile ) {
8415			return false;
8416		}
8417
8418		if ( ! changeSkin ) {
8419			return false;
8420		}
8421
8422		if ( skin === 'style-light' ){
8423			$masthead.removeClass('style-dark-override').addClass('style-light-override');
8424			return false;
8425		} else if ( skin === 'style-dark' ) {
8426			$masthead.removeClass('style-light-override').addClass('style-dark-override');
8427			return false;
8428		}
8429	};
8430
8431	var bg_waypoints = function(){
8432		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
8433
8434			$.each($bg_changers, function(index, row) {
8435
8436				var $row = $(row),
8437					$col = $('.uncol[data-skin-change]', $row).eq(0),
8438					skin,
8439					$tmbs,
8440					tmbskin,
8441					bgColor = $row.attr('data-bg-color');
8442
8443				if ( ! $row.is(':visible') ) {
8444					return false;
8445				}
8446
8447				if ( $col.length ) {
8448					skin = $col.attr('data-skin-change');
8449					$tmbs = $('.tmb[data-skin-change]', $row);
8450					tmbskin = skin.replace('style', 'tmb');
8451				}
8452
8453				if ( ! $row.hasClass('unscroll-horizontal') ) {
8454					$row.waypoint(function( dir ) {
8455						if ( dir === 'down' ) {
8456							bgChange($col, bgColor, skin, tmbskin);
8457							checkTransparencyAndChange(skin);
8458						} else {
8459							return;
8460						}
8461					}, {
8462						offset: '50%'
8463		  			});
8464
8465					$row.waypoint(function( dir ) {
8466						if ( dir === 'up' ) {
8467							bgChange($col, bgColor, skin, tmbskin);
8468							checkTransparencyAndChange(skin);
8469						} else {
8470							return;
8471						}
8472					}, {
8473						offset: function() {
8474							var clH = this.element.clientHeight,
8475								wH = window.innerHeight,
8476								ret = clH > 200 ? -100 : clH * -0.5;
8477							return ( wH / 2 ) - clH;
8478						}
8479					});
8480				}
8481
8482			});
8483
8484			$('body').addClass('bg-changer-init');
8485
8486		}
8487	};
8488
8489	var body = document.body,
8490	edges = false;
8491
8492	var throttle = function(fn, wait) {
8493		var time = Date.now();
8494		return function() {
8495			if ((time + wait - Date.now()) < 0) {
8496				fn();
8497				time = Date.now();
8498			}
8499		}
8500	}
8501
8502	var $wrapper = document.querySelector(".main-wrapper"),
8503		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
8504
8505	var $title = document.querySelector('#rotating');
8506	if ( $title !== null ) {
8507		$title.style.whiteSpace = 'nowrap';
8508		$title.style.transition = 'transform 200ms linear';
8509	}
8510
8511	window.addEventListener( 'scroll', throttle( function() {
8512		window.clearRequestTimeout( isScrolling );
8513
8514		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
8515
8516			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
8517				body = document.body,
8518				html = document.documentElement,
8519				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
8520				$row = false,
8521				firstOff,
8522				lastOff;
8523
8524			if ( scrolled < 100 && $first.length ) {
8525				firstOff = $first.offset().top;
8526				if ( firstOff < 100 ) {
8527					var $row = $first;
8528				}
8529			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
8530				lastOff = $last.offset().top + $last.outerHeight();
8531				if ( lastOff > ( docH - 100 ) ) {
8532					var $row = $last;
8533				}
8534			}
8535
8536			if ( $row.length ) {
8537				var $col = $('.uncol[data-skin-change]', $row).eq(0),
8538					skin,
8539					$tmbs,
8540					tmbskin,
8541					bgColor = $row.attr('data-bg-color');
8542
8543				if ( $col.length ) {
8544					skin = $col.attr('data-skin-change');
8545					$tmbs = $('.tmb[data-skin-change]', $row);
8546					tmbskin = skin.replace('style', 'tmb');
8547				}
8548
8549				bgChange($col, bgColor, skin, tmbskin);
8550				checkTransparencyAndChange(skin);
8551				edges = true;
8552			}
8553
8554		}, 150);
8555
8556		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
8557			bg_waypoints();
8558			Waypoint.refreshAll();
8559			edges = false;
8560		}
8561
8562	}, 100), false);
8563
8564	$(window).on('resize', function() {
8565		clearRequestTimeout(setCTA);
8566		setCTA = requestTimeout(function() {
8567			if ( localH != UNCODE.wheight ) {
8568				localH = UNCODE.wheight;
8569				bg_waypoints();
8570				Waypoint.refreshAll();
8571			}
8572		}, 100);
8573	});
8574
8575	bg_waypoints();
8576
8577};
8578
8579UNCODE.skewIt = function() {
8580
8581	if ( $('body').hasClass('compose-mode') ) {
8582		return;
8583	}
8584
8585	var justscrolled = false;
8586
8587	var loadSkewIt = function(){
8588
8589		var $pageHeader = $('#page-header'),
8590			$page_body = $('.page-body'),
8591			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
8592
8593		if ( $header_skew.length ) {
8594			$pageHeader.addClass('uncode-skew').css({
8595				position: 'relative',
8596				zIndex: 1
8597			});
8598			$header_skew.removeClass('uncode-skew');
8599			$page_body.css({
8600				position: 'relative',
8601				zIndex: 0
8602			});
8603		}
8604
8605		var $skew = $('.uncode-skew'),
8606			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
8607			horizontal = $horizontal.length,
8608			stopSkewing,
8609			lastOffset = 0,
8610			lastDate = Date.now();
8611
8612		if ( ! $skew.length ) {
8613			return;
8614		}
8615
8616		var dropSkew = function(){
8617			if ( UNCODE.wwidth < UNCODE.mediaQuery )
8618				return;
8619
8620			$skew.each(function(){
8621				var $this = $(this),
8622					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
8623
8624				if ( $drop.length ) {
8625					$this.css({
8626						'transform': 'skew(0)'
8627					});
8628					var bound = $this[0].getBoundingClientRect();
8629					$drop.css({
8630						left: bound.x * -1,
8631						top: bound.y * -1,
8632					});
8633				}
8634			});
8635		};
8636		dropSkew();
8637
8638		$(window).on('resize', dropSkew);
8639
8640		window.addEventListener( 'scroll', function() {
8641
8642			if ( justscrolled !== true ) {
8643				justscrolled = true;
8644				return;
8645			}
8646
8647			window.clearRequestTimeout( stopSkewing );
8648
8649			var now = Date.now(),
8650				delayInMs = now - lastDate,
8651				offset = window.pageYOffset || window.document.documentElement.scrollTop,
8652				newOffset = offset - lastOffset,
8653				speed = Math.pow((newOffset / delayInMs), 3) * -1,
8654				body = document.body,
8655				html = document.documentElement,
8656				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
8657				wait = 50,
8658				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
8659
8660			if ((lastDate + wait - now) < 0) {
8661
8662				lastDate = now;
8663				lastOffset = offset;
8664
8665				if ( speed > 6 ) {
8666					speed = 6;
8667				} else if ( speed < -6 ) {
8668					speed = -6;
8669				}
8670
8671				if ( speed > 2 && offset < UNCODE.wheight ) {
8672					speed = 2;
8673				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
8674					speed = -2;
8675				}
8676
8677				var speedY = speed,
8678					speedX = speed * 1.25;
8679
8680				if ( horizontal ) {
8681					speedY = 0;
8682					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
8683						speedX = 0;
8684						return;
8685					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
8686						speedX = 0;
8687						return;
8688					}
8689				} else {
8690					speedX = 0;
8691				}
8692
8693				if ( ! $skew.closest('.enter-st').length ) {
8694					speedX = 0;
8695				}
8696
8697				gsap.killTweensOf($skew);
8698				gsap.to( $skew, {
8699					duration: 0.2,
8700					skewY: (speedY * maxSpeed) + "deg",
8701					skewX: (speedX * maxSpeed) + "deg",
8702					ease: Power0.easeNone,
8703					transformOrigin: 'center',
8704				});
8705
8706			}
8707
8708			stopSkewing = requestTimeout(function() {
8709				gsap.killTweensOf($skew);
8710				gsap.to( $skew, {
8711					duration: 0.5,
8712					skewY: "0deg",
8713					skewX: "0deg",
8714					transformOrigin: 'center',
8715					ease: Expo.easeOut,
8716				});
8717
8718				$skew.each(function(){
8719					var $this = $(this),
8720						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
8721
8722					if ( $drop.length ) {
8723						var bound = $this[0].getBoundingClientRect()
8724						$drop.css({
8725							left: bound.x * -1,
8726							top: bound.y * -1,
8727						});
8728					}
8729				});
8730
8731			}, 200);
8732
8733		}, false);
8734
8735	};
8736
8737	$(window).on('load', loadSkewIt);
8738
8739};
8740
8741UNCODE.rotateIt = function() {
8742
8743	if ( $('body').hasClass('compose-mode') ) {
8744		return;
8745	}
8746
8747	var frameRotate = false;
8748	var loadRotateIt = function(){
8749
8750		var $toRotate = $('.uncode-rotate');
8751
8752		$toRotate.each(function(){
8753			var $rotate = $(this),
8754				deg = 0,
8755				dir = true,
8756				coeff = 1,
8757				lastOffset = 0,
8758				lastDate = Date.now();
8759
8760			var checkScroll = function($rotate){
8761				// if ( ! $rotate.length ) {
8762				// 	return;
8763				// }
8764
8765				var now = Date.now(),
8766					delayInMs = now - lastDate,
8767					offset = window.pageYOffset || window.document.documentElement.scrollTop,
8768					newOffset = offset - lastOffset,
8769					speed = (newOffset / delayInMs) * 5,
8770					body = document.body,
8771					html = document.documentElement,
8772					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
8773
8774				lastDate = now;
8775				lastOffset = offset;
8776
8777				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
8778					deg = 0;
8779				}
8780
8781				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
8782					deg = parseFloat(deg) + parseFloat(speed);
8783				}
8784
8785				if ( $rotate.hasClass('uncode-rotate-hover') ) {
8786					$rotate.hover(function(){
8787						coeff = 1.75;
8788					}, function(){
8789						coeff = 1;
8790					});
8791				}
8792
8793				// if ( speed > 0 ) {
8794				// 	dir = true
8795				// } else if ( speed < 0 ) {
8796				// 	dir = false
8797				// }
8798
8799				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
8800					deg = deg+coeff;
8801					// if ( dir ) {
8802					// 	deg = deg+coeff;
8803					// } else {
8804					// 	deg = deg-coeff;
8805					// }
8806				}
8807
8808				if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
8809					return false;
8810				}
8811				
8812				if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) {
8813					var undeg = deg*-1;
8814					$rotate[0].style.transform = 'rotate(' + undeg + 'deg)';
8815				} else {
8816					$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
8817				}
8818
8819				requestAnimationFrame(function() {
8820					if ( frameRotate === true ) {
8821						frameRotate = false;
8822						return;
8823					}
8824					checkScroll($rotate);
8825				});
8826			};
8827
8828			checkScroll($rotate);
8829
8830		});
8831
8832	};
8833
8834	$(window).on('load', loadRotateIt);
8835
8836	var checkRotate;
8837	var resizeRotate = function(){
8838		var $inlineRotates = $('.inline-rotate');
8839		$inlineRotates.each(function(){
8840			$(this).addClass('inline-rotate-standby');
8841		});
8842		clearTimeout(checkRotate);
8843		checkRotate = setTimeout(function(){
8844			$('.inline-rotate').each(function(){
8845				$(this).removeClass('inline-rotate-standby');
8846				frameRotate = true;
8847			});
8848			loadRotateIt();
8849		}, 500);
8850	};
8851
8852	$(window).off('resize.inline-rotate', resizeRotate)
8853	.on('resize.inline-rotate', resizeRotate);
8854
8855};
8856
8857var marqueeAttempts = 0,
8858	marqueeTO,
8859	marqueeCheckResize;
8860
8861UNCODE.textMarquee = function( $titles ) {
8862
8863	var initTextMarquee = function( $titles ){
8864
8865		if ( typeof $titles == 'undefined' ) {
8866			$titles = $('.un-text-marquee');
8867		}
8868
8869		if ( ! $titles.length ) {
8870			return;
8871		}
8872
8873		$titles.each(function(){
8874			var $title = $(this),
8875				$span = $('> span, > i > span', $title),
8876				txt,
8877				first = true,
8878				dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ),
8879				dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ),
8880				dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'),
8881				dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'),
8882				dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'),
8883				newW = UNCODE.wwidth,
8884				marqueeTL, inview;
8885
8886			if ( $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ) {
8887				dataTrigger = 'row';
8888			}
8889
8890			if ( UNCODE.wwidth <= UNCODE.mediaQuery ) {
8891				dataNavBar = dataNavBarMobile;
8892			}
8893
8894			dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed;
8895			dataSpace = isNaN(dataSpace) ? 'default' : dataSpace;
8896			var dataX = dataSpeed;
8897
8898			if ( dataSpeed < 0 ) {
8899				dataSpeed -= 1;
8900			} else if ( dataSpeed > 0 ) {
8901				dataSpeed += 1;
8902			}
8903
8904			if ( dataSpeed <= 0 ) {
8905				dataSpeed = (dataSpeed * 10);
8906			} else {
8907				dataSpeed = ( dataSpeed * 2 ) - 1;
8908			}
8909
8910			$('.marquee-clone-wrap', $title).remove();
8911
8912			txt = $span.html();
8913
8914			if ( ! $('.marquee-original-core', $span).length ) {
8915				txt = $span.html();
8916				$span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
8917			} else {
8918				txt = $('.marquee-original-core', $span).html();
8919			}
8920
8921			var spanW,
8922				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
8923				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
8924				speed = 10 - dataSpeed;
8925
8926			$span.prepend($prepended);
8927			$span.append($appended);
8928
8929			var continuousTextMarquee = function(){
8930				var bound = $title.css({
8931						'transform': 'none',
8932						'opacity': 0
8933					}).offset(),
8934					ease = 'none';
8935
8936				var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left,
8937					xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ),
8938					xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ),
8939					direction = $title.hasClass('un-marquee-opposite') ? 1 : -1;
8940
8941				marqueeTL = new TimelineMax({paused:true, reversed:true});
8942
8943				var inViewElement = (dataTrigger === 'row') ? $title.closest('.vc_row')[0] : $title[0],
8944					wayOff = dataTrigger === 'row' && dataNavBar === 'yes' ? UNCODE.menuHeight : 0;
8945
8946				inview = new Waypoint.Inview({
8947					element: inViewElement,
8948					offset: wayOff,
8949					enter: function(direction) {
8950						marqueeTL.play();
8951					},
8952					exited: function(direction) {
8953						if ( ! $title.closest('.pin-spacer').length ) {
8954							marqueeTL.pause();
8955						}
8956					},
8957				});
8958
8959				if ( $title.hasClass('un-marquee-hover') ) {
8960					var $column = $title.closest('.wpb_column'),
8961						$col_link = $('.col-link', $column),
8962						$hover_sel = $title;
8963
8964					if ( $col_link.length ) {
8965						$hover_sel = $title.add($column);
8966					}
8967					$hover_sel.on('mouseover', function(){
8968						speed = ( 10 - dataSpeed ) * 5;
8969						ease = 'power2.out';
8970						marqueeTL.duration( xSpeed / UNCODE.wwidth * speed );
8971					}).on('mouseout', function(){
8972						speed = ( 10 - dataSpeed );
8973						ease = 'power2.in';
8974						marqueeTL.duration( xSpeed / UNCODE.wwidth * speed );
8975					});
8976				}
8977		
8978				gsap.killTweensOf($title);
8979				marqueeTL.fromTo( $title, {
8980					opacity: 1,
8981					x: xStrt * direction * -1
8982				},
8983				{
8984					duration: xSpeed / UNCODE.wwidth * speed,
8985					x: xEnd * direction,
8986					onComplete: function(){
8987						first = false;
8988						continuousTextMarquee();
8989					},
8990					ease: ease
8991				});
8992		
8993			};
8994			
8995			var runTextMarquee = function(){
8996				var time = Date.now();
8997
8998				var textMarqueeScroll = function(){
8999					var $row = $title.closest('.vc_row'),
9000						$bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title;
9001
9002					if ( !$bound.length ) {
9003						return;
9004					}
9005
9006					var bound = $bound[0].getBoundingClientRect(),
9007						wait = 100,
9008						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1,
9009						dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25);
9010
9011					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
9012						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
9013						marqueeAttempts < 2 ) {
9014
9015						clearRequestTimeout(marqueeTO);
9016
9017						marqueeTO = requestTimeout(function(){
9018							marqueeAttempts++;
9019							initTextMarquee();
9020						}, 100);
9021					}
9022
9023
9024					var bound_top = bound.top,
9025						gsap_calc = ( ( UNCODE.wheight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction;
9026
9027					if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) {
9028						if ( dataTrigger === 'row-middle' ) {
9029							bound_top = (bound.top + bound.height*0.5) - (UNCODE.wheight * 0.5)
9030						}
9031						if ( dataNavBar === 'yes' ) {
9032							bound_top = bound_top - UNCODE.menuHeight;
9033						}
9034						gsap_calc = ( bound_top * dataMove ) * 0.5 * direction;
9035					}
9036
9037					gsap.killTweensOf($title);
9038					gsap.to( $title, {
9039						duration: 0.24,
9040						x: gsap_calc,
9041					});
9042				};
9043
9044				textMarqueeScroll();
9045				$(window).on( 'load scroll', function(e) {
9046					textMarqueeScroll();
9047				});
9048
9049			};
9050
9051			var cloneSpan = function($_title, cntnt){
9052
9053				if ( $_title.hasClass('un-marquee-infinite') ) {
9054					$('> span.marquee-clone-wrap', $_title).text('');
9055				}
9056
9057				gsap.to( $_title, {
9058					duration: 0,
9059					x: 0
9060				});
9061				spanW = $span.outerWidth();
9062
9063				if ( !spanW ) {
9064					return;
9065				}
9066
9067				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2,
9068					spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0";
9069
9070				if ( $_title.hasClass('un-marquee-infinite') ) {
9071
9072					for ( var i = 0; i < part; i++ ) {
9073						$prepended.append(cntnt + spaceSpan);
9074						$appended.append(cntnt + spaceSpan);
9075					}
9076				}
9077
9078				if ( $('body').hasClass('compose-mode') ) {
9079					$('.uncode_fe_safe').remove();
9080					return;
9081				}
9082
9083				if ( $title.closest('.marquee-freezed').length ) {
9084					return;
9085				}
9086
9087				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
9088					continuousTextMarquee();
9089				}
9090
9091				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
9092					runTextMarquee();
9093				}
9094
9095			};
9096
9097			var marqueeResize = function(e){
9098				clearRequestTimeout(marqueeCheckResize);
9099				marqueeCheckResize = requestTimeout(function(){
9100					if ( newW !== UNCODE.wwidth ) {
9101						gsap.killTweensOf($title);
9102						if ( typeof inview !== 'undefined' && inview !== null ) {
9103							inview.destroy();
9104						}
9105						if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) {
9106							marqueeTL.kill();
9107						}
9108						first = true;
9109						initTextMarquee();
9110						newW = UNCODE.wwidth;
9111					}
9112				}, 1000);
9113			};
9114
9115			$(window).off('resize uncode.re-layout', marqueeResize)
9116			.on( 'resize uncode.re-layout', marqueeResize);
9117
9118			cloneSpan($title, txt);
9119
9120			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9121				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
9122					var $_titles = $('.un-text-marquee',e.view.$el);
9123					clearRequestTimeout(marqueeCheckResize);
9124					marqueeCheckResize = requestTimeout(function(){
9125						initTextMarquee($_titles);
9126					}, 1000);
9127				});
9128			}
9129		});
9130	};
9131
9132	$(document).on('ready', function(){
9133		initTextMarquee();
9134	});
9135
9136	$(window).on('focus',function(){
9137		setTimeout(function(){
9138			initTextMarquee();
9139		},500);
9140	});
9141
9142	$(document).on('pumAfterOpen pumAfterClose', function(args){
9143		initTextMarquee();
9144	});
9145
9146};
9147
9148UNCODE.parallax = function() {
9149	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
9150		if ($('.parallax-el').length > 0) {
9151			var parallax_elements = new Rellax('.parallax-el');
9152			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
9153			window.addEventListener('boxResized', function(e) {
9154				parallax_elements.refresh();
9155			}, false);
9156			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
9157				requestTimeout(function() {
9158					parallax_elements.refresh();
9159				}, 100);
9160			});
9161
9162		}
9163	}
9164};
9165
9166UNCODE.magicCursor = function(){
9167	var $customCursor = $('#uncode-custom-cursor'),
9168		$customPilot = $('#uncode-custom-cursor-pilot'),
9169		$tooltip = $('.title-tooltip', $customCursor),
9170		$cursorSpan = $('> span', $tooltip),
9171		currentBg = false,
9172		fromTitle = false,
9173		setTime,
9174		mouseEvent;
9175
9176		var spanW, spanH,
9177		maxW = false;
9178
9179	function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){
9180		if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) {
9181			$tooltip.css({opacity: 0});
9182			delayt_time += 400;
9183		}
9184		clearRequestTimeout(setTime);
9185		setTime = requestTimeout(function() {
9186
9187			$tooltip.css({opacity: ''});
9188
9189			$customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing');
9190
9191			if ( cursorTitle !== '' ) {
9192				if ( fromTitle && dataTitle === 'boing' ) {
9193					setTimeout(function(){
9194						$customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing');
9195					}, 5);
9196				}
9197				$cursorSpan.attr('class', fontClass).html( cursorTitle );
9198			} else {
9199				if ( cursorType !== 'auto' ) {
9200					$cursorSpan.html('');
9201				}
9202			}
9203
9204			$cursorSpan.addClass('in-tooltip');
9205
9206			$customCursor.attr('data-cursor', cursorType);
9207
9208			if ( fromTitle ) {
9209				$customCursor.addClass('from-tooltip-title');
9210			} else {
9211				$customCursor.removeClass('from-tooltip-title');
9212			}
9213
9214			if ( cursorBg !== false ) {
9215				$customCursor.attr('data-bg', 'transparent');
9216			} else {
9217				$customCursor.removeAttr('data-bg');
9218			}
9219
9220			currentBg = cursorBg;
9221
9222			if ( cursorTitle !== '' ) {
9223				fromTitle = true;
9224				$customCursor.attr('data-cursor', cursorType);
9225				$customCursor.attr('data-title', 'true');
9226				$cursorSpan.css({width: ''});
9227			} else {
9228				fromTitle = false;
9229				$customCursor.removeAttr('data-title');
9230			}
9231			spanW = $cursorSpan.outerWidth();
9232			
9233			if ( spanW >= maxW && maxW !== false ) {
9234				$customCursor.find('> span:first-child').add($tooltip).addClass('max-width');	
9235				$customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({
9236					width: maxW
9237				});
9238				spanW = maxW;
9239			} else {
9240				$customCursor.find('> span:first-child').removeClass('max-width');
9241			}
9242			spanH = $cursorSpan.outerHeight();
9243			if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) {
9244				$customCursor.find('> span:first-child').add($tooltip).css({
9245					width: spanW,
9246					height: spanH
9247				});
9248			} else {
9249				$customCursor.find('> span:first-child').add($tooltip).removeAttr("style");
9250			}
9251			if ( $customPilot.length ) {
9252				$customPilot.attr('data-cursor', cursorType);
9253			}
9254		}, delayt_time);
9255	}
9256
9257	function changeCursor($wrap){
9258		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
9259		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
9260			$href = $wrap.find(href),
9261			cursorType,
9262			cursorTitle = '',
9263			tooltip_class = '',
9264			cursorBg = false;
9265
9266		$href.filter(':not(.cursor-init)').on('mouseenter.cursor',function(e) {
9267			var $this = $(this).addClass('cursor-init'),
9268				$tmb = $this.closest('.tmb'),
9269				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
9270				cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'),
9271				data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'),
9272				data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'),
9273				custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')),
9274				$title = $('.t-entry-title', $tmb),
9275				is_frontend_editor = $this.closest('.vc_controls').length,
9276				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
9277				$parent_cursor = $this.closest('[class*="custom-cursor"]');
9278
9279			if ( is_frontend_editor ) {
9280				cursorType = 'auto';
9281			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
9282				cursorType = data_cursor;
9283			} else if ( $parent_cursor.length ) {
9284				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
9285					cursorType = 'icon-light';
9286				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
9287					cursorType = 'icon-diff';
9288				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
9289					cursorType = 'icon-accent';
9290				} else {
9291					cursorType = 'icon-dark';
9292				}
9293			} else {
9294				cursorType = 'pointer';
9295			}
9296
9297			if ( typeof data_title !== 'undefined' && data_title !== '' ) {
9298				if ( typeof custom_text !== 'undefined' && custom_text !== '' ) {
9299					cursorTitle = custom_text;
9300				} else {
9301					cursorTitle = $title.clone();
9302					$('a', cursorTitle).replaceWith(function() {
9303						return this.childNodes;
9304					});
9305					$('*', cursorTitle).replaceWith(function(){
9306						return $(this).removeAttr('class');
9307					});
9308					cursorTitle = cursorTitle.html();
9309				}
9310			} else {
9311				cursorTitle = '';
9312			}
9313
9314			if ( typeof data_class !== 'undefined' && data_class !== '' ) {
9315				tooltip_class = data_class;
9316			} else {
9317				tooltip_class = '';
9318			}
9319
9320			if ( cursor_bg == 'true' ) {
9321				cursorBg = true;
9322			} else {
9323				cursorBg = false;
9324			}
9325
9326			delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class);
9327		}).on('mouseleave.cursor', function(){
9328			var outTime = 150;
9329			if ( currentBg !== false && cursorBg === false ) {
9330				outTime = 0;
9331			}
9332			delayChangeCursor('auto', '', false, outTime, false, '');
9333		});
9334
9335		$(window).on('disable-hover', function(event) {
9336			document.addEventListener("mousemove", function(e) {
9337				mouseEvent = e;
9338			});
9339			delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, '');
9340		});
9341
9342		$(window).on('enable-hover', function(event) {
9343			if ( typeof mouseEvent !== 'undefined' ) {
9344				var x = mouseEvent.clientX,
9345					y = mouseEvent.clientY;
9346
9347				var elements = document.elementsFromPoint(x, y),
9348					$element = $(elements[0]);
9349
9350				$element.closest(href).trigger('mouseenter');
9351			}
9352		});
9353
9354	}
9355
9356	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
9357		changeCursor();
9358	});
9359
9360	$(document).ajaxComplete(function( event, xhr, settings ) {
9361		changeCursor();
9362	});
9363
9364	$('.isotope-container').on('isotope-layout-complete', function() {
9365		var $this = $(this);
9366		changeCursor($this);
9367	});
9368
9369};
9370
9371UNCODE.magneticCursor = function(){
9372	function magneticCursor($wrap){
9373		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
9374		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'));
9375
9376		$magnetics.on('mousemove', function(e){
9377			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this),
9378				bound = e.currentTarget.getBoundingClientRect(),
9379				coeff = 30,
9380				hor = (bound.width / 2) - (e.clientX - bound.left),
9381				ver = (bound.height / 2) - (e.clientY - bound.top),
9382				toX = hor / bound.width * coeff,
9383				toY = ver / bound.height * coeff,
9384				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
9385				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
9386				toScale = Math.max(scaleX, scaleY);
9387
9388			gsap.killTweensOf($el);
9389			gsap.to( $el, {
9390				duration: 0.75,
9391				x: toX,
9392				y: toY,
9393				scale: toScale,
9394				ease: Power1.easeOut,
9395				transformPerspective: 900,
9396				transformOrigin: 'center',
9397				force3D: true
9398			});
9399		}).on('mouseout', function(e){
9400			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this);
9401			gsap.killTweensOf($el);
9402			gsap.to( $el, {
9403				duration: 0.6,
9404				y: 0,
9405				x: 0,
9406				scale: 1,
9407				ease: Power1.easeOut,
9408				transformPerspective: 900,
9409				transformOrigin: 'center',
9410				force3D: true
9411			});
9412		});
9413	};
9414
9415	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
9416		magneticCursor();
9417	});
9418
9419	$(document).ajaxComplete(function( event, xhr, settings ) {
9420		magneticCursor();
9421	});
9422
9423	$('.isotope-container').on('isotope-layout-complete', function() {
9424		var $this = $(this);
9425		magneticCursor($this);
9426	});
9427
9428};
9429
9430UNCODE.dropImage = function() {
9431
9432	/****************************
9433	 * Image hover *
9434	****************************/
9435	function imageHover(){
9436		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9437			return;
9438		}
9439
9440		var $postLists = $('.uncode-post-titles');
9441		$postLists.each(function(){
9442			var $list = $(this),
9443				timing = parseFloat( $list.attr('data-timing') ),
9444				default_image = $list.hasClass('uncode-post-titles-default-image'),
9445				default_title = $list.hasClass('uncode-post-titles-default-title'),
9446				$tmbs = $('.tmb', $list),
9447				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
9448				clientX,
9449				clientY,
9450				$row_parent = $list.closest('.vc_row'),
9451				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
9452				$col_parent = $list.closest('.uncell'),
9453				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
9454				setCTA;
9455
9456			timing *= 0.001;
9457
9458			var drop_bgs = function(){
9459				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
9460					var $drop = $(this),
9461						srcset = $drop.attr('data-bgset'),
9462						setArr = srcset.split(","),
9463						setArrOrder = [],
9464						biggest = 0,
9465						checkBg = false,
9466						desktopBG = $drop.data('[data-background-image]'),
9467						mobileBG = $drop.data('[data-mobile-background-image]');
9468
9469					if ( $drop.hasClass('srcset-bg-async') ) {
9470
9471						if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) {
9472							return;
9473						}
9474						
9475					}
9476
9477					if ( SiteParameters.uncode_adaptive == true ) {
9478						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
9479							$drop.css({
9480								'background-image' : 'url(' + setArr[0] + ')'
9481							});
9482						}
9483					} else {
9484						for ( var i = 0; i < setArr.length; i++ ) {
9485							var setLoop = setArr[i].trim().split(" ");
9486							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
9487								var parseSet = parseFloat(setLoop[1]);
9488								if ( biggest < parseSet ) {
9489									biggest = parseSet;
9490								}
9491								setArrOrder[parseSet] = setLoop[0];
9492								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
9493									checkBg = true;
9494									$drop.css({
9495										'background-image' : 'url(' + setLoop[0] + ')'
9496									});
9497								}
9498							}
9499						}
9500
9501						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
9502							$drop.css({
9503								'background-image' : 'url(' + setArrOrder[biggest] + ')'
9504							});
9505						}
9506					}
9507
9508				});
9509			};
9510
9511			drop_bgs();
9512
9513			var dropMovesSize = function(){
9514				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
9515					return;
9516				}
9517				$drop_moves.each(function(){
9518					var $drop_move = $(this),
9519						dataW = $drop_move.attr('data-w'),
9520						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
9521					if ( typeof dataW !== 'undefined' && dataW !== null ) {
9522						dataW = screenInfo.width / 12 * parseFloat( dataW );
9523					}
9524					$drop_moves.css({
9525						width: dataW
9526					});
9527
9528					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
9529						$anim_parent.on('animationend', function(){
9530							var bound = $anim_parent[0].getBoundingClientRect();
9531							$drop_move.css({
9532								left: bound.x * -1,
9533								top: bound.y * -1,
9534							});
9535						});
9536					}
9537				});
9538
9539
9540			};
9541
9542			dropMovesSize();
9543
9544			$(window).on( 'resize', function(){
9545				clearRequestTimeout(setCTA);
9546				setCTA = requestTimeout( function() {
9547					drop_bgs();
9548					dropMovesSize();
9549				}, 100 );
9550			});
9551
9552			if ( $drop_row_parents.length ) {
9553				$row_parent.addClass( 'drop-added' );
9554			}
9555
9556			$drop_row_parents.each(function(index, val){
9557				var $drop = $(val);
9558				$row_parent.prepend($drop);
9559				manageVideos($drop, false);
9560				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
9561					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
9562				}
9563				if ( default_image && index == 0 ) {
9564					manageVideos($drop, true);
9565					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
9566						image_ph = new Image();
9567					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
9568						image_ph.onload = function() {
9569							$drop.addClass('active');
9570							if ( default_title ) {
9571								$list.addClass('drop-hover');
9572								$tmbs.first().addClass('drop-active');
9573							}
9574						};
9575						image_ph.src = bg_img;
9576					}
9577				}
9578			});
9579
9580			if ( $drop_col_parents.length ) {
9581				$col_parent.addClass( 'drop-added' );
9582			}
9583
9584			$drop_col_parents.each(function(index, val){
9585				var $drop = $(this);
9586				$col_parent.prepend($drop);
9587				manageVideos($drop, false);
9588				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
9589					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
9590				}
9591				if ( default_image && index == 0 ) {
9592					manageVideos($drop, true);
9593					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
9594						image_ph = new Image();
9595					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
9596						image_ph.onload = function() {
9597							$drop.addClass('active');
9598							if ( default_title ) {
9599								$list.addClass('drop-hover');
9600								$tmbs.first().addClass('drop-active');
9601							}
9602						};
9603						image_ph.src = bg_img;
9604					}
9605				}
9606			});
9607
9608			function manageVideos( $el, start ) {
9609				var videoElem = $('video', $el),
9610					$iframe = $('iframe', $el),
9611					iframeID = $iframe.attr('id');
9612				if ( videoElem.length ) {
9613					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
9614						if ( start ) {
9615							videoElem[0].setCurrentTime(0);
9616							videoElem[0].play();
9617						} else {
9618							videoElem[0].pause();
9619							videoElem[0].setCurrentTime(0);
9620						}
9621					} else {
9622						if ( start ) {
9623							videoElem[0].currentTime = 0;
9624							videoElem[0].play();
9625						} else {
9626							videoElem[0].pause();
9627							videoElem[0].currentTime = 0;
9628						}
9629					}
9630				}
9631
9632				$el.data('active', start);
9633
9634				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
9635					var iframeIDv = iframeID.replace('okplayer-', ''),
9636						optionsV = $(window).data('okoptions-' + iframeIDv),
9637						vimeo = $iframe[0],
9638						playerV = new Vimeo.Player(vimeo),
9639						timeV = 0;
9640
9641					if (optionsV.time != null) {
9642						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
9643						for ( var i = 0; i < timeArr.length; i++ ) {
9644							if ( timeArr[i] === 'h' ) {
9645								timeV += parseFloat(timeArr[i-1]) * 3600;
9646							} else if ( timeArr[i] === 'm' ) {
9647								timeV += parseFloat(timeArr[i-1]) * 60;
9648							} else if ( timeArr[i] === 's' ) {
9649								timeV += parseFloat(timeArr[i-1]);
9650							}
9651						}
9652					}
9653					playerV.setCurrentTime(timeV);
9654					if ( start ) {
9655						playerV.setVolume(0);
9656						playerV.play();
9657					} else {
9658						playerV.pause();
9659					}
9660				} else if ( $el.attr('data-provider') === 'youtube' ) {
9661					if ( start ) {
9662						$el.trigger('uncode-resume');
9663					} else {
9664						$el.trigger('uncode-pause');
9665					}
9666				}
9667
9668			}
9669
9670			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
9671
9672				document.addEventListener("mousemove", function(e) {
9673					$drop_moves.each(function(){
9674						var $drop_move = $(this),
9675							duration = 0.4;
9676
9677						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
9678							duration = 0.8;
9679						}
9680
9681						clientX = e.clientX;
9682						clientY = e.clientY;
9683
9684						gsap.to( $drop_move, {
9685							duration: duration,
9686							x: clientX,
9687							y: clientY,
9688							ease: Power1.easeOut,
9689						});
9690					});
9691				});
9692
9693			} else {
9694
9695				$(window).on("touchend scroll", function(e) {
9696					$list.removeClass('drop-hover');
9697					$drop_moves.removeClass('active');
9698					$tmbs.removeClass('drop-active');
9699				});
9700
9701				$drop_moves.each(function(){
9702					var $drop_move = $(this),
9703						$tmb = $drop_move.closest('.tmb'),
9704						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
9705
9706					if ( $anim_parent.hasClass('uncode-skew') ) {
9707						$anim_parent.css({
9708							'transform': 'skew(0)'
9709						});
9710					}
9711
9712					$tmb.on('touchend', function(e){
9713						e.stopPropagation();
9714
9715						$drop_moves.removeClass('active');
9716						$tmbs.removeClass('drop-active');
9717
9718						$list.addClass('drop-hover');
9719						$tmb.addClass('drop-active');
9720						$drop_move.addClass('active');
9721						manageVideos($drop_move, true);
9722						clientX = e.changedTouches[0].clientX;
9723						clientY = e.changedTouches[0].clientY;
9724
9725						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
9726							var bound = $anim_parent[0].getBoundingClientRect();
9727							clientX = clientX - bound.x;
9728							clientY = clientY - bound.y;
9729						}
9730
9731						$drop_move.css({
9732							left: clientX,
9733							top: clientY
9734						});
9735					});
9736				});
9737
9738			}
9739
9740			$tmbs.each(function(e){
9741				var $tmb = $(this),
9742					// $trgr = $('a', $tmb),
9743					$trgr = $tmb,
9744					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
9745					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
9745(.t-inside), .parallax-el'),
9746					$video = $('video', $tmb),
9747					$iframe = $('iframe', $tmb),
9748					$entryTxt = $('.t-entry-text', $tmb),
9749					stopBounding;
9750
9751				$entryTxt.add($drop_move).css({
9752					'transition-duration': timing + 's'
9753				});
9754
9755				if ( $video.length ) {
9756					var vidH = $video[0].videoHeight,
9757						vidW = $video[0].videoWidth;
9758					$video.css({
9759						'height': vidH,
9760						'width': vidW
9761					});
9762				}
9763
9764				if ( $iframe.length ) {
9765					var vidH = $drop_move.attr('data-height'),
9766						vidW = $drop_move.attr('data-width');
9767					$iframe.css({
9768						'height': vidH,
9769						'width': vidW
9770					});
9771				}
9772
9773				$iframe.each(function(){
9774					var $video = $(this),
9775						vidH = $video[0].videoHeight,
9776						vidW = $video[0].videoWidth;
9777					$video.css({
9778						'height': vidH,
9779						'width': vidW
9780					});
9781				});
9782
9783				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
9784					$trgr.on('mouseenter',function(e){
9785						$list.addClass('drop-hover');
9786						$tmbs.removeClass('drop-active');
9787						$tmb.addClass('drop-active');
9788						$drop_move.addClass('active');
9789						manageVideos($drop_move, true);
9790
9791						var clientX = e.clientX,
9792							clientY = e.clientY;
9793						$drop_move.css({
9794							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
9795						});
9796
9797					})
9798					.on('mouseleave', function(e){
9799						$list.removeClass('drop-hover');
9800						$drop_move.css({
9801							'transition-duration': ( timing*1.25 ) + 's'
9802						});
9803						$drop_move.removeClass('active');
9804						$tmb.removeClass('drop-active');
9805						$drop_move.on('transitionend', function(e){
9806							$drop_move.off('transitionend');
9807							$drop_move.css({
9808								'transition-duration': timing + 's'
9809							});
9810							manageVideos($drop_move,false);
9811						});
9812					});
9813
9814					document.addEventListener('visibilitychange', function(){
9815						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
9816							$drop_move.css({
9817								'transition-duration': '0s'
9818							});
9819							$drop_move.removeClass('active');
9820							manageVideos($drop_move, false);
9821						}
9822					});
9823
9824					document.addEventListener('scroll', function(){
9825						window.clearRequestTimeout( stopBounding );
9826
9827						if ( $drop_move.hasClass('active') ) {
9828							$list.removeClass('drop-hover');
9829							$tmbs.removeClass('drop-active');
9830							$drop_move.removeClass('active');
9831							$drop_move.on('transitionend', function(e){
9832								$drop_move.off('transitionend');
9833								$drop_move.css({
9834									'transition-duration': timing + 's'
9835								});
9836								manageVideos($drop_move,false);
9837							});
9838						}
9839
9840						stopBounding = requestTimeout(function() {
9841							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
9842								var bound = $anim_parent[0].getBoundingClientRect();
9843								$drop_move.css({
9844									left: bound.x * -1,
9845									top: bound.y * -1,
9846								});
9847							}
9848						}, 200);
9849
9850					});
9851				}
9852
9853				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
9854					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
9855
9856				$drop.css({
9857					'transition-duration': timing + 's'
9858				});
9859
9860				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
9861					$trgr.on('mouseenter',function(e){
9862						$row_parent.add($col_parent).addClass('drop-list-loaded');
9863						$list.addClass('drop-hover');
9864
9865						if ( !$tmb.hasClass('drop-active') ) {
9866							$tmbs.removeClass('drop-active');
9867							$tmb.addClass('drop-active');
9868							if ( default_image && !$drop.hasClass('active') ) {
9869								var $prev = $('[data-drop].active', $row_parent);
9870								$prev.css({
9871									'transition-duration': (timing*1.5) + 's'
9872								});
9873								$prev.removeClass('active');
9874								$prev.on('transitionend', function(e){
9875									$prev.off('transitionend');
9876									manageVideos($prev,false);
9877								});
9878							}
9879							$drop.css({
9880								'transition-duration': timing + 's'
9881							});
9882							$drop.off('transitionend');
9883							$drop.addClass('active');
9884							manageVideos($drop, true);
9885						}
9886					})
9887					.on('mouseleave', function(e){
9888						if ( ( default_image && !default_title ) || !default_image ) {
9889							$list.removeClass('drop-hover');
9890							$tmb.removeClass('drop-active');
9891						}
9892						if ( ! default_image ) {
9893							$drop.css({
9894								'transition-duration': (timing*1.5) + 's'
9895							});
9896							$drop.removeClass('active');
9897
9898							$drop.on('transitionend', function(e){
9899								$drop.off('transitionend');
9900								manageVideos($drop,false);
9901							});
9902						}
9903					});
9904
9905					document.addEventListener('visibilitychange', function(){
9906						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
9907							$drop.css({
9908								'transition-duration': '0s'
9909							});
9910							$drop.removeClass('active');
9911							manageVideos($drop, false);
9912						}
9913					});
9914				}
9915			});
9916
9917		});
9918	};
9919
9920	$(window).on('load', function(event) {
9921		imageHover();
9922	});
9923
9924	var drop_wp_animation = function() {
9925		var $postLists = $('.uncode-post-titles');
9926		$postLists.each(function(){
9927			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
9928				new Waypoint({
9929					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
9930					element: val,
9931					handler: function() {
9932						var element = $(this.element),
9933							parent = element.closest('.tmb'),
9934							currentIndex = parent.index(),
9935							delay = currentIndex,
9936							delayAttr = parseInt(element.attr('data-delay'));
9937						if (isNaN(delayAttr)) delayAttr = 100;
9938						var objTimeout = requestTimeout(function() {
9939							element.addClass('start_animation');
9940
9941							var nextTimeout = requestTimeout(function() {
9942								$('.drop-image-separator', parent).addClass('start_animation');
9943							}, 50);
9944
9945						}, delay * delayAttr);
9946						if (!UNCODE.isUnmodalOpen) {
9947							this.destroy();
9948						}
9949					},
9950					offset: UNCODE.isFullPage ? '100%' : '90%'
9951				})
9952			});
9953		});
9954	}
9955
9956	var runWaypoints_TO,
9957		runWaypoints_delay = 0;
9958
9959	var runWaypoints = function(){
9960		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
9961			runWaypoints_delay = 400;
9962		}
9963		clearRequestTimeout(runWaypoints_TO);
9964		runWaypoints_TO = requestTimeout(function() {
9965			drop_wp_animation();
9966		}, runWaypoints_delay);
9967	};
9968	runWaypoints();
9969	$( document.body ).on( 'uncode_waypoints', runWaypoints );
9970	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9971		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
9972			// imageHover();
9973			runWaypoints();
9974		});
9975	}
9976};
9977
9978UNCODE.postTable = function() {
9979
9980	var clickRow = function(){
9981		var $postLists = $('.uncode-post-table');
9982
9983		$postLists.each(function(){
9984			var $postList = $(this),
9985				$tmbClicks = $('.tmb.tmb-click-row', $postList);
9986
9987			$tmbClicks.each(function(){
9988				var $tmb = $(this),
9989					$click = $('.table-click-row', $tmb);
9990				$('*:not(.table-click-row)', $tmb).on('click', function(e){
9991					e.preventDefault();
9992					e.stopPropagation();
9993					$click[0].click();
9994					return false;
9995				});
9996			});
9997
9998		})
9999	};
10000
10001	clickRow();
10002
10003	var hoverRow = function(){
10004		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
10005
10006		$postLists.on('mouseenter', function(){
10007			$(this).addClass('post-table-hover');
10008		});
10009		$postLists.on('mouseleave', function(){
10010			$(this).removeClass('post-table-hover');
10011		});
10012	}
10013
10014	hoverRow();
10015
10016	var drop_wp_animation = function() {
10017		var $postLists = $('.uncode-post-table');
10018		$postLists.each(function(){
10019			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
10020				new Waypoint({
10021					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10022					element: val,
10023					handler: function() {
10024						var element = $(this.element),
10025							parent = element.closest('.tmb'),
10026							currentIndex = parent.index(),
10027							delay = currentIndex,
10028							delayAttr = parseInt(element.attr('data-delay'));
10029						if (isNaN(delayAttr)) delayAttr = 100;
10030						var objTimeout = requestTimeout(function() {
10031							element.addClass('start_animation');
10032						}, delay * delayAttr);
10033						if (!UNCODE.isUnmodalOpen) {
10034							this.destroy();
10035						}
10036					},
10037					offset: UNCODE.isFullPage ? '100%' : '90%'
10038				})
10039			});
10040		});
10041	}
10042
10043	var runWaypoints_TO,
10044		runWaypoints_delay = 0;
10045
10046	var runWaypoints = function(){
10047		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
10048			runWaypoints_delay = 400;
10049		}
10050		clearRequestTimeout(runWaypoints_TO);
10051		runWaypoints_TO = requestTimeout(function() {
10052			drop_wp_animation();
10053		}, runWaypoints_delay);
10054	};
10055	runWaypoints();
10056	$( document.body ).on( 'uncode_waypoints', runWaypoints );
10057	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10058		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
10059			runWaypoints();
10060			// clickRow();
10061		});
10062	}
10063};
10064
10065UNCODE.rotatingTxt = function($ctxt) {
10066
10067	if ( $('body').hasClass('compose-mode') ) {
10068		return;
10069	}
10070
10071	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
10072	var setCTA;
10073
10074	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
10075		var $heading = $(this),
10076			// debug = 0,
10077			cycle = 0,
10078			$trgt,
10079			$toMove,
10080			$highl,
10081			$col = $heading.closest('.uncont'),
10082			txt,
10083			arrTxt,
10084			textFadeIn, textFadeOut,
10085			removeWraps;
10086
10087		var defineObjs = function() {
10088			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
10089				var $rtx = $(this),
10090					fx = $rtx.attr('data-fx'),
10091					wait = $rtx.attr('data-wait'),
10092					$prev = $(this).prev().addClass('prev-rotating-start'),
10093					splitToMove = [],
10094					splitArray = [],
10095					lineArray = [],
10096					lineIndex = 0,
10097					lineStart = true,
10098					lineEnd = false,
10099					startSplit = false,
10100					$line_wrap = $rtx.closest('.heading-line-wrap'),
10101					same_line = true,
10102					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
10103					indexRtx = $splits.index($rtx);
10104
10105				fx = typeof fx === 'undefined' ? '' : fx;
10106				wait = typeof wait === 'undefined' ? '' : wait;
10107
10108				$splits.each(function(key, val){
10109					var $split = $(this),
10110						$new_line_wrap = $split.closest('.heading-line-wrap');
10111
10112					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
10113						splitArray.push( $split );
10114					}
10115
10116					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10117						startSplit = false;
10118					}
10119
10120					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
10121						splitArray.push( $split );
10122
10123						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
10124							same_line = true;
10125						} else {
10126							same_line = false;
10127						}
10128					}
10129
10130					if ( key == indexRtx ) {
10131						if ( /\S/.test($split.text()) ) {
10132							startSplit = true;
10133							$line_wrap = $split.closest('.heading-line-wrap');
10134							splitArray.push( $split );
10135						} else {
10136							indexRtx++;
10137						}
10138					}
10139
10140					$line_wrap = $new_line_wrap;
10141				});
10142
10143				$toMove = $($.map(splitToMove, function(el){return el.get();}));
10144				$trgt = $($.map(splitArray, function(el){return el.get();}));
10145
10146				if ( same_line ) {
10147					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
10148					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
10149				}
10150
10151				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
10152					$prev.addClass('empty-span-hidden');
10153				}
10154
10155				$highl = $('.heading-text-highlight-inner', $trgt);
10156
10157				$rtx.attr('data-animated', 'true');
10158				if ( cycle == 0 ) {
10159					$( document.body ).trigger('defer-highlights');
10160					cycle++;
10161					defineObjs();
10162					return;
10163				}
10164				cycle++;
10165
10166				txt = $rtx.attr('data-text');
10167				arrTxt = txt.split("|");
10168
10169				textFadeOut($trgt);
10170
10171			});
10172		};
10173
10174		removeWraps = function(){
10175
10176			// if ( debug == 1 ) return;
10177			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
10178			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
10179
10180
10181				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
10182					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
10183
10184				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
10185
10186				$splitFlow.each(function(){
10187					$(this).append($temp_highl);
10188				});
10189
10190				var $line_wrap = $wraps[wrap_k];
10191				var $parent_wrap = $line_wrap.parentNode;
10192				if ( $parent_wrap !== null ) {
10193					while ( $line_wrap.firstChild ) {
10194						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
10195					}
10196					$parent_wrap.removeChild($line_wrap);
10197				}
10198			}
10199			// debug++;
10200			defineObjs();
10201		};
10202
10203		var loop = 0;
10204		textFadeIn = function($trgt){
10205			var word = arrTxt[loop].split(" "),
10206				worsSpan = '',
10207				$wrap = $trgt.closest('.uncode-rotating-wrap'),
10208				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
10209				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
10210
10211			for (var w = 0; w < word.length; w++) {
10212				var highl;
10213				if ( $highl.length ) {
10214					highl = $highl[0].outerHTML;
10215				} else {
10216					highl = '';
10217				}
10218
10219				if ( w > 0 ) {
10220					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
10221				}
10222				var charachters = word[w].split('');
10223				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
10224				for (var c = 0; c < charachters.length; c++) {
10225					worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
10226				}
10227				worsSpan += '</span>' + highl + '</span></span>';
10228			}
10229
10230			if ( $wrap.length && $wrap_inner.length ) {
10231				var words_w = $wrap_inner.outerWidth();
10232				$wrap.css({
10233					width: words_w
10234				});
10235
10236				$highl = $('.heading-text-highlight-inner', $wrap);
10237				$highl.prependTo($wrap);
10238
10239				$wrap_inner.css({
10240					opacity: 0
10241				});
10242
10243				$wrap_inner.html(worsSpan);
10244				$('.heading-text-highlight-inner', $wrap_inner).remove();
10245				words_w = $wrap_inner.innerWidth();
10246
10247				var duration = 0.45;
10248
10249				$heading.removeClass('auto-width');
10250				if ( words_w > $col.width() ) {
10251					$heading.addClass('auto-width');
10252					words_w = 'auto';
10253					duration = 0;
10254				}
10255
10256				$wrap.css({
10257					'width': words_w,
10258					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
10259				});
10260
10261				var $word_inner = $('.split-word-inner', $wrap_inner),
10262					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
10263
10264				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
10265
10266				if ( !$target_fx.length ) {
10267					return;
10268				}
10269
10270				gsap.killTweensOf($target_fx);
10271
10272				if ( fx !== 'zoom' ) {
10273					gsap.fromTo( $target_fx, {
10274						y: fx === 'opacity' ? '0%' : '-10%'
10275					},{
10276						delay: duration,
10277						duration: 0.25,
10278						y: '0%',
10279						ease: Circ.easeOut,
10280					});
10281
10282					if ( !$wrap_inner.length ) {
10283						return;
10284					}
10285
10286					gsap.fromTo( $wrap_inner, {
10287						opacity: 0,
10288					},{
10289						delay: duration,
10290						duration: 0.25,
10291						opacity: 1,
10292						ease: Circ.easeOut,
10293						onComplete: function(){
10294							$('> .heading-text-highlight-inner', $wrap).remove();
10295							$wrap_inner.html(worsSpan);
10296							removeWraps();
10297						}
10298					})
10299
10300				} else {
10301					gsap.fromTo( $target_fx, {
10302						transformOrigin: '50%',
10303						opacity: 0,
10304						scale: 0.875,
10305					},{
10306						opacity: 1,
10307						delay: duration,
10308						duration: 0.25,
10309						scale: 1,
10310						ease: Circ.easeOut,
10311						onComplete: function(){
10312							$('> .heading-text-highlight-inner', $wrap).remove();
10313							$wrap_inner.html(worsSpan);
10314							removeWraps();
10315						}
10316					});
10317				}
10318
10319			} else {
10320
10321				if ( !$wrap_inner.length ) {
10322					return;
10323				}
10324
10325				gsap.to( $wrap_inner, {
10326					duration: 0.4,
10327					opacity: 0,
10328					ease: Power1.easeOut,
10329					onComplete: function(){
10330						$wrap_inner.html(worsSpan);
10331						words_w = $wrap_inner.innerWidth();
10332
10333						gsap.to( $wrap_inner, {
10334							duration: 0.2,
10335							opacity: 1,
10336							ease: Power1.easeOut,
10337							onComplete: function(){
10338								$('> .heading-text-highlight-inner', $wrap).remove();
10339								$wrap_inner.html(worsSpan);
10340								removeWraps();
10341							}
10342						})
10343					}
10344				});
10345			}
10346
10347			if ( loop < arrTxt.length-1 ) {
10348				loop++;
10349			} else {
10350				loop = 0;
10351			}
10352
10353		};
10354
10355		textFadeOut = function($trgt){
10356			var $word_inner = $('.split-word-inner', $trgt),
10357				$wrap = $trgt.closest('.uncode-rotating-wrap'),
10358				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
10359				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
10360				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
10361
10362			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
10363
10364			var gsap_param = {
10365					delay: wait,
10366					duration: 0.25,
10367					y: fx === '' ? '10%' : '0%',
10368					opacity: 0,
10369					ease: Circ.easeOut,
10370					onStart: function(){
10371						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
10372							$highl = $('.heading-text-highlight-inner', $wrap);
10373							$highl.prependTo($wrap);
10374						}
10375					},
10376					onComplete: textFadeIn,
10377					onCompleteParams: [$trgt]
10378				};
10379
10380			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
10381
10382			if ( fx === '' ) {
10383				gsap_param.y = '10%';
10384			} else if ( fx === 'zoom' ) {
10385				gsap_param.scale = '1.045';
10386			}
10387
10388			if ( !$target_fx.length ) {
10389				return;
10390			}
10391
10392			if ( $heading.data('waypoint') !== true ) {
10393				var textInView = new Waypoint.Inview({
10394					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
10395					element: $heading[0],
10396					enter: function(direction) {
10397						$heading.data('waypoint',true);
10398						gsap.fromTo( $target_fx, {
10399							transformOrigin: '50%'
10400						}, gsap_param );
10401					}
10402				});
10403			} else {
10404				gsap.fromTo( $target_fx, {
10405					transformOrigin: '50%'
10406				}, gsap_param );
10407			}
10408		};
10409
10410		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
10411			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
10412				var $el = model.view.$el,
10413					shortcode = model.attributes.shortcode;
10414
10415				UNCODE.rotatingTxt($el);
10416			});
10417		} else {
10418			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
10419				$heading.on('already-animated', function(){
10420					removeWraps();
10421					window.addEventListener('removeOldLines', function(){
10422						clearRequestTimeout(setCTA);
10423						setCTA = requestTimeout( removeWraps, 150 );
10424					});
10425				});
10426			} else {
10427				$(window).on('load', function(){
10428					removeWraps();
10429					window.addEventListener('removeOldLines', function(){
10430						clearRequestTimeout(setCTA);
10431						setCTA = requestTimeout( removeWraps, 150 );
10432					});
10433				});
10434			}
10435		}
10436	});
10437
10438};
10439
10440UNCODE.verticalText = function() {
10441	$(window).on('menuCanvasOpen', function(){
10442		$('.vertical-text--fixed').fadeOut(500);
10443		$('.horizontal-text--fixed').fadeOut(500);
10444	}).on('menuCanvasClose', function(){
10445		$('.vertical-text--fixed').fadeIn(500);
10446		$('.horizontal-text--fixed').fadeIn(500);
10447	});
10448
10449	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
10450	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
10451	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
10452	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
10453
10454	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
10455		window.addEventListener('scroll', function(e) {
10456			var totalPageHeight = document.body.scrollHeight;
10457			var scrollPoint = window.scrollY + window.innerHeight;
10458
10459			if (window.scrollY > 0) {
10460				showOnTopVerticalTexts.fadeOut();
10461				showOnTopHorizontalTexts.fadeOut();
10462			} else {
10463				showOnTopVerticalTexts.fadeIn();
10464				showOnTopHorizontalTexts.fadeIn();
10465			}
10466
10467			if (scrollPoint >= totalPageHeight) {
10468				hideOnBottomVerticalTexts.fadeOut();
10469				hideOnBottomHorizontalTexts.fadeOut();
10470			} else {
10471				hideOnBottomVerticalTexts.fadeIn();
10472				hideOnBottomHorizontalTexts.fadeIn();
10473			}
10474		}, false);
10475	}
10476};
10477
10478UNCODE.stickyScroll = function( $el ) {
10479	if ( typeof $el === 'undefined' || $el === null ) {
10480		$el = $('body');
10481	}
10482	var checkVisible = function( el, dir ) {
10483		if (typeof jQuery === "function" && el instanceof jQuery) {
10484			el = el[0];
10485		}
10486
10487		var off = 50;
10488		dir = typeof dir=='undefined' ? 'right' : dir;
10489		var rect = el.getBoundingClientRect();
10490
10491		return (
10492			(
10493				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
10494				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
10495				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
10496			) &&
10497			(
10498				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
10499				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
10500				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
10501				( rect.right <= window.innerWidth && rect.left >= 0 )
10502			)
10503		);
10504	};
10505
10506	var setItemsRelHeight = function(reset) {
10507		var $_el = $el;
10508		if ( $el.is('.index-scroll') ) {
10509			var $_el = $el.closest('.uncont');
10510		}
10511		$('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
10512			$.each($('.tmb', item), function(index, val) {
10513				if ( reset === true ) {
10514					$(val).css( 'visibility', 'hidden' );
10515				} else {
10516					$(val).css( 'visibility', 'visible' );
10517				}
10518			});
10519		});
10520		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
10521			$.each($('.tmb', item), function(index, val) {
10522				if ( reset === true ) {
10523					$(val).css( 'visibility', 'hidden' );
10524					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
10525				} else {
10526					var $rowParent = $(item).closest('.row-parent'),
10527						rowRatio = $rowParent.attr('data-height-ratio'),
10528						$rowInner = $(item).closest('.row-child'),
10529						rowRatioInner = $rowInner.attr('data-height'),
10530						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
10531						$colContainer = $(item).closest('.uncell'),
10532						$uncont = $(item).closest('.uncont'),
10533						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
10534						safe_heigth = $(item).data('safe-height'),
10535						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
10536						offSet = $(item).offset().top - $uncont.offset().top,
10537						multiplier_h,
10538						data_viewport_h,
10539						body_border = $('.body-borders .top-border').outerHeight() * 2,
10540						remove_menu = $(item).data('vp-menu');
10541
10542					if ( rowRatio === 'full' || rowRatio === '' ) {
10543						rowRatio = 1;
10544					} else {
10545						rowRatio = rowRatio / 100;
10546					}
10547
10548					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
10549						rowRatio = rowRatio;
10550					} else {
10551						rowRatio = rowRatio * rowRatioInner / 100;
10552					}
10553
10554					winHeight = winHeight * rowRatio;
10555
10556					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
10557						multiplier_h = parseInt($(item).attr('data-vp-height'));
10558					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
10559						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
10560					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
10561						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
10562					}
10563
10564					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
10565						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
10566						if ( remove_menu === true ) {
10567							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
10568						}
10569						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
10570					} else {
10571						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
10572					}
10573
10574				}
10575			});
10576		});
10577		$('.index-scroll', $_el).each(function(i, item){
10578			var $uncoltable = $(item).closest('.uncoltable'),
10579				$rowParent = $(item).closest('.row-parent'),
10580				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
10581				body_border = $('.body-borders .top-border').outerHeight() * 2,
10582				$index_row = $('.index-row', item),
10583				safe_heigth = $index_row.data('safe-height'),
10584				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
10585			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
10586				var data_viewport_h = winHeight - ( paddingRow + body_border );
10587				$uncoltable.css({
10588					'min-height': data_viewport_h
10589				});
10590			} else {
10591				$uncoltable.css({
10592					'min-height': 'auto'
10593				});
10594			}
10595		});
10596
10597	}
10598	setItemsRelHeight();
10599
10600	var $index_scrolls = $('.index-scroll', $el);
10601
10602	$index_scrolls.each(function(key, value){
10603		var $index = $(this),
10604			$parent_row = $index.closest('.vc_row[data-parent]'),
10605			$index_row = $('.index-row', $index),
10606			dir = $index_row.attr('data-direction');
10607		dir = typeof dir === 'undefined' ? 'right' : dir;
10608
10609		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
10610	});
10611
10612	var $horScrolls = $('.unscroll-horizontal', $el);
10613
10614	if ( $horScrolls.length ) {
10615
10616		$('body').addClass('scrolling-trigger');
10617
10618		$horScrolls.each(function(key, value){
10619			var $section = $(this),
10620				$index_scroll = $('.index-scroll', $section),
10621				$index_row = $('.index-row', $index_scroll),
10622				dir = $section.attr('data-direction'),
10623				wrap = $index_row.attr('data-wrap'),
10624				$pinWrap,
10625				$pinTrigger;
10626
10627			dir = typeof dir === 'undefined' ? 'right' : dir;
10628			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
10629			$pinWrap = $('<div class="pin-wrap" />');
10630			if ( SiteParameters.is_frontend_editor ) {
10631				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
10632				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
10633			} else {
10634				if ( wrap === 'column' ) {
10635					$index_scroll.wrapInner( $pinWrap );
10636				} else {
10637					$('> .row', $section).wrap( $pinWrap );
10638				}
10639				$section.wrapInner( $pinTrigger );
10640			}
10641
10642		});
10643
10644		var $pinWraps = $('.pin-wrap', $el);
10645
10646		var horScrollSizes = function(){
10647
10648			$pinWraps.each(function(key, val){
10649				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
10650					$pinTrigger = $pinWrap.closest('.pin-trigger'),
10651					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
10652					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
10653					$boxContainer = $('.box-container'),
10654					box_m = $boxContainer.css('margin-left'),
10655					st_active = true;
10656
10657				var setHorW,
10658				horWidth = function(){
10659					$index_scroll.each(function(){
10660						var $this = $(this),
10661							$index_row = $('.index-row', $this),
10662							$rowContainer = $index_row.closest('.vc_row'),
10663							$rowInner = $index_row.closest('.wpb_row'),
10664							$rowParent = $index_row.closest('.row-parent'),
10665							$tmbs = $('.tmb', $index_row),
10666							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
10667							$uncont = $index_row.closest('.uncont'),
10668							$parent_col = $index_row.closest('.wpb_column'),
10669							col_w = $uncont.width(),
10670							data_lg = parseFloat( $index_row.attr('data-lg') ),
10671							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
10672							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
10673							tmb_w;
10674
10675						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
10676						tmb_w = ( col_w + padding_tmb ) / data_lg;
10677
10678						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
10679							tmb_w = ( col_w + padding_tmb ) / data_sm;
10680						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
10681							tmb_w = ( col_w + padding_tmb ) / data_md;
10682						}
10683
10684						if ( !isNaN(tmb_w) ) {
10685							$tmbs.css({
10686								'width': tmb_w
10687							});
10688						}
10689
10690						$tmbs.css({
10691							'visibility': 'visible'
10692						});
10693
10694					});
10695				};
10696
10697				horWidth();
10698				clearRequestTimeout(setHorW);
10699				setHorW = requestTimeout( function(){
10700					setItemsRelHeight();
10701					horWidth();
10702				}, 100 );
10703
10704				if ( SiteParameters.is_frontend_editor ) {
10705					return;
10706				}
10707
10708				var $vmenu = $('body.vmenu .vmenu-container'),
10709					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
10710					winWidth = window.innerWidth - vmenuW,
10711					$tmb = $('.tmb', $index_scroll).eq(0),
10712					paddingRight = parseFloat( $tmb.css('padding-right') ),
10713					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ),
10714					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
10715					scroll_anim;
10716
10717				if ( $('body').hasClass('rtl') ) {
10718					if ( dir === 'left' ) {
10719						scroll_anim = gsap.fromTo( $pinWrap, {
10720							x: stickyScrollLength
10721						},{
10722							x: 0,
10723							ease: "none"
10724						});
10725					} else {
10726						scroll_anim = gsap.fromTo( $pinWrap, {
10727							x: 0
10728						},{
10729							x: stickyScrollLength,
10730							ease: "none"
10731						});
10732					}
10733				} else {
10734					if ( dir === 'left' ) {
10735						scroll_anim = gsap.fromTo( $pinWrap, {
10736							x: -stickyScrollLength
10737						},{
10738							x: 0,
10739							ease: "none"
10740						});
10741					} else {
10742						scroll_anim = gsap.fromTo( $pinWrap, {
10743							x: 0
10744						},{
10745							x: -stickyScrollLength,
10746							ease: "none"
10747						});
10748					}
10749				}
10750
10751				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
10752					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
10753				}
10754
10755				var animationIncrease;
10756
10757				var checkForAnimations = function(){
10758					animationIncrease = 0
10759					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
10760						var _this = this,
10761							isScrolling;
10762						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
10763							var delayAttr = parseFloat( $(_this).attr('data-delay') );
10764							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
10765							requestTimeout(function() {
10766								$(_this).addClass('start_animation');
10767							}, delayAttr + animationIncrease);
10768							animationIncrease += 150;
10769						}
10770					});
10771				};
10772				checkForAnimations();
10773
10774				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
10775				var start = 0;
10776
10777				var horST = ScrollTrigger.create({
10778					id: "stickySectionScrolling" + key,
10779					scrub: true,
10780					trigger: $pinTrigger[0],
10781					pin: true,
10782					anticipatePin: 1,
10783					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
10784					end: function() { return "+="+stickyScrollLength; },
10785					animation: scroll_anim,
10786					ease: Sine.easeOut,
10787					onUpdate: checkForAnimations,
10788					invalidateOnRefresh: true,
10789					onEnter: function(){
10790						$pinTrigger.addClass('enter-st');
10791					},
10792					onEnterBack: function(){
10793						$pinTrigger.addClass('enter-st');
10794					},
10795					onLeave: function(){
10796						$pinTrigger.removeClass('enter-st');
10797					},
10798					onLeaveBack: function(){
10799						$pinTrigger.removeClass('enter-st');
10800					}
10801				});
10802
10803				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
10804				window.dispatchEvent(new CustomEvent('boxResized'));
10805
10806				var testSecondTrigger = function(){
10807					animationIncrease = 0
10808					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
10809						var _this = this;
10810						if ( checkVisible(_this) ) {
10811							var delayAttr = parseFloat( $(_this).attr('data-delay') );
10812							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
10813							requestTimeout(function() {
10814								$(_this).addClass('start_animation');
10815							}, delayAttr + animationIncrease);
10816							animationIncrease += 150;
10817						}
10818					});
10819
10820				};
10821
10822				var verST = ScrollTrigger.create({
10823					id: "verticalSectionScrolling" + key,
10824					trigger: $pinTrigger[0],
10825					start: "top center",
10826					end: function() { return "+="+UNCODE.wheight; },
10827					onUpdate: testSecondTrigger,
10828					invalidateOnRefresh: true
10829				});
10830
10831				var setCTA,
10832
10833				dis_enable_ST = function(){
10834					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
10835						horST.kill();
10836						verST.kill();
10837						$pinTrigger.addClass('disabled');
10838						st_active = false;
10839					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
10840						horST.kill();
10841						verST.kill();
10842						$pinTrigger.addClass('disabled');
10843						st_active = false;
10844					}
10845				};
10846
10847				$(window).on('resize load', function() {
10848					clearRequestTimeout(setCTA);
10849					setCTA = requestTimeout(function() {
10850						dis_enable_ST();
10851						checkForAnimations();
10852					}, 500);
10853				});
10854
10855			});
10856		};
10857
10858		$(window).on( 'load', function(){
10859			horScrollSizes();
10860		});
10861		var setResize,
10862			setReLayout,
10863			doubleResize = true,
10864			oldW = UNCODE.wwidth,
10865			isResized = true;
10866		$(window).on( 'load', function(){
10867			if ( $('.body-borders .top-border').outerHeight() > 0 ) {
10868				var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
10869				Array.prototype.forEach.call($row_inners, function(el) {
10870					el.style.height = '';
10871					el.style.marginBottom = '';
10872				});
10873				setItemsRelHeight();
10874				horScrollSizes();
10875				ScrollTrigger.refresh();
10876			}
10877			var carousel = document.querySelector(".owl-carousel"),
10878				grid = document.querySelector(".isotope-container"),
10879				stickyAll = document.querySelectorAll(".index-scroll");
10880
10881			if ( stickyAll.length ) {
10882				var sticky = stickyAll[(stickyAll.length-1)];
10883			}
10884
10885			if ( typeof sticky !== "undefined" ) {
10886
10887				if ( typeof carousel !== "undefined" && carousel !== null ) {
10888					var carousel_position = sticky.compareDocumentPosition(carousel);
10889				}
10890				if ( typeof grid !== "undefined" && grid !== null ) {
10891					var grid_position = sticky.compareDocumentPosition(grid);
10892				}
10893
10894				if ( carousel_position === 2 || grid_position === 2 ) {
10895					setTimeout(function(){
10896						ScrollTrigger.refresh();
10897					}, 500);
10898				}
10899
10900			}
10901			
10902		});
10903		$(window).on( 'resize orientationchange', function(){
10904			isResized = (oldW !== UNCODE.wwidth);
10905			if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) {
10906				return;
10907			} else {
10908				oldW = UNCODE.wwidth;
10909			}
10910			setItemsRelHeight(true);
10911			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
10912			Array.prototype.forEach.call($row_inners, function(el) {
10913				el.style.height = '';
10914				el.style.marginBottom = '';
10915			});
10916			clearRequestTimeout(setResize);
10917			setResize = requestTimeout( function(){
10918				setItemsRelHeight();
10919				horScrollSizes();
10920				ScrollTrigger.refresh();
10921				if ( doubleResize === true ) {
10922					window.dispatchEvent(new Event('resize'));
10923					doubleResize = false;
10924				} else {
10925					doubleResize = true;
10926				}
10927				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, isResized);
10928			}, 100 );
10929		});
10930
10931		var show_pins = function(){
10932			$('.index-scroll').css({'opacity':'1'});
10933		};
10934		ScrollTrigger.addEventListener("refresh", show_pins);
10935		$(window).on( 'uncode.re-layout', function(){
10936			//$('.index-scroll').css({'opacity':'0'});
10937			$('.pin-spacer').each(function(){
10938				var space_h = $(this).outerHeight(),
10939					$row = $(this).closest('.row-container');
10940				$row.css({
10941					'height': space_h,
10942					'overflow': 'hidden'
10943				});
10944			});
10945			ScrollTrigger.refresh(true);
10946			clearRequestTimeout(setReLayout);
10947			setReLayout = requestTimeout( function(){
10948				$('.row-container').each(function(){
10949					$(this).css({
10950						'height': '',
10951						'overflow': ''
10952					});
10953				});
10954			}, 1000);
10955		});
10956	}
10957
10958};
10959
10960UNCODE.stickyTrigger = function( $el ) {
10961	if ( SiteParameters.is_frontend_editor ) {
10962		return false;
10963	}
10964
10965	var stickyTrigger = function(){
10966		var stickyTrick = $('.sticky-trigger').each(function(){
10967			var $sticky = $(this),
10968				$inside = $('> div', $sticky),
10969				insideH = $inside.outerHeight(),
10970				$row = $sticky.closest('.vc_row'),
10971				$uncont = $sticky.closest('.uncont'),
10972				rowBottom,
10973				uncontBottom ,
10974				diffBottom;
10975
10976			ScrollTrigger.create({
10977				trigger: $sticky,
10978				start: function(){ return "top center-=" + insideH/2; },
10979				endTrigger: $row,
10980				end:  function(){
10981					rowBottom = $row.offset().top + $row.outerHeight();
10982					uncontBottom = $uncont.offset().top + $uncont.outerHeight();
10983					diffBottom = rowBottom - uncontBottom;
10984					return "bottom center+=" + ( insideH/2 + diffBottom );
10985				},
10986				anticipatePin: true,
10987				pin: true,
10988				pinSpacing: false,
10989				scrub: true,
10990				invalidateOnRefresh: true,
10991			});
10992
10993		});
10994	},
10995	setResizeSticky;
10996
10997	$(window).on( 'load', function(){
10998		stickyTrigger();
10999		var carousel = document.querySelector(".owl-carousel"),
11000			grid = document.querySelector(".isotope-container"),
11001			stickyAll = document.querySelectorAll(".sticky-trigger");
11002
11003		if ( stickyAll.length ) {
11004			var sticky = stickyAll[(stickyAll.length-1)];
11005		}
11006
11007		if ( typeof sticky !== "undefined" ) {
11008
11009			if ( typeof carousel !== "undefined" && carousel !== null ) {
11010				var carousel_position = sticky.compareDocumentPosition(carousel);
11011			}
11012			if ( typeof grid !== "undefined" && grid !== null ) {
11013				var grid_position = sticky.compareDocumentPosition(grid);
11014			}
11015
11016			if ( carousel_position === 2 || grid_position === 2 ) {
11017				setTimeout(function(){
11018					ScrollTrigger.refresh();
11019				}, 500);
11020			}
11021
11022		}
11023	});
11024
11025	var oldW = UNCODE.wwidth;
11026	$(window).on( 'resize uncode.re-layout', function(e){
11027		clearRequestTimeout(setResizeSticky);
11028		if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
11029			return;
11030		} else {
11031			oldW = UNCODE.wwidth;
11032		}
11033		setResizeSticky = requestTimeout( function(){
11034			stickyTrigger();
11035			ScrollTrigger.refresh();
11036		}, 1000 );
11037	});
11038
11039};
11040
11041UNCODE.revslider = function() {
11042	var revSliderIn = function(){
11043		$('rs-module').each(function(){
11044			var $slider = $(this);
11045
11046			$slider.on('revolution.slide.onloaded', function(e, data){
11047				if ( $(e.currentTarget).closest(".header-revslider").length ) {
11048					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
11049						scrolltop = $(document).scrollTop();
11050					if ( style != undefined ) {
11051						UNCODE.switchColorsMenu(scrolltop, style);
11052					}
11053				}
11054			});
11055
11056			$slider.on('revolution.slide.onchange', function(e, data){
11057				if ( $(e.currentTarget).closest(".header-revslider").length ) {
11058					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
11059						scrolltop = $(document).scrollTop();
11060					if ( style != undefined ) {
11061						UNCODE.switchColorsMenu(scrolltop, style);
11062					}
11063				}
11064			});
11065
11066		});
11067	};
11068	revSliderIn();
11069	$(window).on("load", revSliderIn );
11070};
11071UNCODE.layerslider = function() {
11072	$(window).on("load", function() {
11073
11074		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
11075
11076			var slideData = slider.slides.current.data,
11077				scrolltop = $(document).scrollTop();
11078			if( slideData && slideData.skin ) {
11079
11080				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
11081
11082			}
11083		});
11084
11085	});
11086};
11087
11088UNCODE.ajax_filters = function() {
11089
11090/*************************
11091 *
11092 * Filters Menu and Widgets Area
11093 *
11094 ************************/
11095
11096 	var clear_clicked = false;
11097
11098 	var init_ajax_grid = function(){
11099
11100		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
11101		$grids.each(function(index, val){
11102			var $body = $('body'),
11103				$grid = $(val).addClass('init-ajax-grid'),
11104				starting_point = $grid.attr('data-toggle'),
11105				$trigger = $('.uncode-toggle-ajax-filters', $grid),
11106				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
11107				$isotope_wrapper = $('.isotope-wrapper', $grid),
11108				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
11109				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
11110				$footprint = $('.ajax-filter-footprint', $grid),
11111				sidebar_w,
11112				data_w = parseFloat( $sidebar.attr('data-max-width') ),
11113				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
11114				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
11115				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
11116				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
11117				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
11118				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
11119				sidew,
11120				$inside_row = $('> .row-parent', $vc_row),
11121				bg_row,
11122				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
11123				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
11124				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
11125				sidebar_overlay = false,
11126				sidebar_hover = false,
11127				switchMobile = false,
11128				scrollTop;
11129
11130			if ( $vc_row.attr('class') ) {
11131				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
11132			}
11133
11134			if ( bg_row != null ) {
11135				$side_header.add($side_footer).addClass(bg_row[0]);
11136			}
11137
11138			$trigger.add($apply_filters).on('click', function(e){
11139				e.preventDefault();
11140				e.stopPropagation();
11141				$grid = $('.ajax-grid-system').eq(0);
11142				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
11143				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
11144				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
11145				sidebar_w = $sidebar_wrapper.width();
11146				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
11147				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
11148					$(this).trigger('uncode-ajax-clear-filters');
11149				}
11150				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
11151					$grid.toggleClass('ajax-hide-filters-blanks');
11152					$sidebar.slideToggle({
11153						duration: 400,
11154						easing: 'easeOutQuad',
11155					});
11156				} else {
11157					$grid.removeClass('ajax-hide-filters-blanks');
11158					$grid.toggleClass('ajax-hide-filters');
11159					if ( $grid.hasClass('ajax-hide-filters') ) {
11160						$body.addClass('ajax-hide-filters');
11161					} else {
11162						scrollTop = $('html, body').scrollTop();
11163						$body.removeClass('ajax-hide-filters');
11164					}
11165				}
11166				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
11167					$('html, body').scrollTop(scrollTop);
11168				}
11169				return false;
11170			});
11171
11172			$close_btn.on('click', function(e){
11173				e.preventDefault();
11174				$grid = $('.ajax-grid-system').eq(0);
11175				$grid.addClass('ajax-hide-filters');
11176				if ( $grid.hasClass('ajax-hide-filters') ) {
11177					$body.addClass('ajax-hide-filters');
11178				} else {
11179					scrollTop = $('html, body').scrollTop();
11180					$body.removeClass('ajax-hide-filters');
11181				}
11182				$('html, body').scrollTop(scrollTop);
11183			});
11184
11185			$sidebar_wrapper.on('mouseover',function(){
11186				sidebar_hover = true;
11187			}).on('mouseout', function(){
11188				sidebar_hover = false;
11189			});
11190
11191			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
11192				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
11193					return;
11194				}
11195				if (undefined !== from && from === 'select_active_attributes') {
11196					return;
11197				}
11198				if ($(e.target).closest('.select2-container--open').length ) {
11199					return;
11200				}
11201				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
11202					$grid.add($body).addClass('ajax-hide-filters');
11203				}
11204			});
11205
11206			$sorting_trgr.on('click', function(e) {
11207				e.preventDefault();
11208			});
11209
11210			var inside_width = function(){
11211				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
11212				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
11213				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
11214				$inside_row = $('> .row-parent', $vc_row);
11215				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
11216					sidew = $sidebar.width();
11217					$inside_row.css({
11218						width: sidew
11219					});
11220				} else {
11221					$inside_row.css({
11222						width: ''
11223					});
11224				}
11225			};
11226			inside_width();
11227
11228			var ajax_sidebar_position = function(e, f_editor){
11229				$grid = $('.ajax-grid-system').eq(0);
11230				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
11231				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
11232				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
11233				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
11234				$inside_row = $('> .row-parent', $vc_row);
11235				scrollTop = $('html, body').scrollTop();
11236				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
11237					$grid.add($body).addClass('ajax-hide-filters');
11238					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
11239					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
11240					sidebar_overlay = true;
11241					$body.addClass('ajax-filter-sidebar-overlay');
11242					$sidebar_wrapper.addClass(skin);
11243					var sideHeadH = $side_header.outerHeight(),
11244						sideFooterH = $side_footer.outerHeight();
11245					if ( data_w !== '' && data_w > 0 ) {
11246						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
11247							$sidebar.css({
11248								'max-width': data_w
11249							});
11250						} else {
11251							$sidebar.css({
11252								'max-width':'none'
11253							});
11254						}
11255					}
11256					$vc_row.css({
11257						'padding-top':sideHeadH,
11258						'padding-bottom':sideFooterH
11259					});
11260					var sidew = $sidebar.width();
11261					$inside_row.css({
11262						width: sidew
11263					});
11264					switchMobile = true;
11265				} else {
11266					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
11267						scrollTop = $('html, body').scrollTop();
11268						$grid.add($body).removeClass('ajax-hide-filters');
11269					}
11270					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
11271						$grid.addClass('ajax-hide-filters-blanks');
11272						$sidebar.hide();
11273					}
11274					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
11275					$('.ajax-sidebar-placeholder', $grid).remove();
11276					sidebar_overlay = false;
11277					$body.removeClass('ajax-filter-sidebar-overlay');
11278					$sidebar_wrapper.removeClass(skin);
11279					if ( data_w !== '' && data_w > 0 ) {
11280						$sidebar.css({
11281							'max-width':'none'
11282						});
11283					}
11284					$vc_row.css({
11285						'padding-top':0,
11286						'padding-bottom':0,
11287					});
11288
11289					$inside_row.css({
11290						width: ''
11291					});
11292
11293					if ( f_editor === true ) {
11294						UNCODE.ajax_filters();
11295					}
11296
11297					switchMobile = false;
11298				}
11299				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
11300					$('html, body').scrollTop(scrollTop);
11301				}
11302			};
11303
11304			var sidebar_width = function(){
11305				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
11306					sidebar_w = $footprint.width();
11307					$sidebar.css({ width: sidebar_w });
11308				} else {
11309					$sidebar.css({ width: '' });
11310				}
11311			};
11312			sidebar_width();
11313
11314			if ( SiteParameters.is_frontend_editor ) {
11315				ajax_sidebar_position();
11316			}
11317
11318			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
11319				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
11320					ajax_sidebar_position(e);
11321				}
11322				sidebar_width();
11323			});
11324
11325			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
11326				ajax_sidebar_position(e, true);
11327			});
11328
11329			$isotope_wrapper.on('transitionend', function(e){
11330				if ( $(e.target).hasClass('isotope-wrapper') ) {
11331					window.dispatchEvent(new CustomEvent('boxResized'));
11332				}
11333				return false;
11334			});
11335
11336			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
11337				var $grid = $('.ajax-grid-system').eq(0);
11338				$grid.addClass('ajax-hide-filters');
11339			}
11340
11341		});
11342	};
11343
11344	init_ajax_grid();
11345	$(document).on('uncode-ajax-filtered', init_ajax_grid);
11346
11347/*************************
11348 *
11349 * Hover hack
11350 *
11351 ************************/
11352 	var widget_hover_hack = function() {
11353 		$('.widget, .uncode_widget').each(function(){
11354			var $widget = $(this),
11355				class_w = $widget.attr('class'),
11356				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
11357				$footer = $widget.closest('#colophon');
11358
11359			if ( class_w.indexOf('widget_yith') > 0 ) {
11360				return true;
11361			}
11362
11363			$lis.each(function(){
11364 				var $li = $(this),
11365 					$a = $('a', $li),
11366 					$label = $a.closest('label');
11367
11368				if ( !$footer.length ) {
11369					$li.addClass('no-evts');
11370				}
11371
11372				if ( ! $('span', $a).length ) {
11373 					$li.addClass( 'li-hover' );
11374 				}
11375
11376 				$('li', $li).hover(function(e){
11377 					$(e.target).parents('li').each(function(){
11378 						$(this).addClass( 'parent-li-hover' );
11379 					});
11380					}, function (e) {
11381 					$(e.target).parents('li').each(function(key, val){
11382 						if ( key === 0) {
11383	 						$(val).removeClass( 'parent-li-hover' );
11384	 					}
11385 					});
11386 				});
11387
11388				$li.off('mouseup').on('mouseup', function (e) {
11389					if (e.which !== 3) {
11390						e.stopPropagation();
11391						var $a = $('a', this).first();
11392						$a[0].click();
11393					}
11394	 			});
11395 			});
11396 		});
11397 	}
11398	if (SiteParameters.disable_hover_hack !== '1') {
11399		widget_hover_hack();
11400		$(document).on('uncode-ajax-filtered', widget_hover_hack);
11401	}
11402
11403/*************************
11404 *
11405 * Init Filters
11406 *
11407 ************************/
11408
11409	function init_filters() {
11410		$(document).on('click', '.term-filter-link', function(e) {
11411			var _this = $(this);
11412			var widget = _this.closest('.uncode_widget');
11413			var container = get_filters_container();
11414
11415			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
11416				return true;
11417			}
11418
11419			e.preventDefault();
11420
11421			if (widget.hasClass('widget-ajax-filters--checkbox')) {
11422				_this.parent().find('input[type="checkbox"]').trigger('click');
11423			} else {
11424				if (_this.hasClass('term-filter-link--active')) {
11425					_this.removeClass('term-filter-link--active');
11426				} else {
11427					_this.addClass('term-filter-link--active');
11428
11429					if (widget.hasClass('widget-ajax-filters--single')) {
11430						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
11431					}
11432				}
11433
11434				var url = _this.attr('href');
11435
11436				reload_items(container, url, true);
11437			}
11438		});
11439
11440		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
11441			var _this = $(this);
11442			var widget = _this.closest('.uncode_widget');
11443			var link = _this.closest('.term-filter').find('.term-filter-link');
11444			var url = link.attr('href');
11445			var container = get_filters_container();
11446
11447			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
11448				window.location = url;
11449				return;
11450			}
11451
11452			if (widget.hasClass('widget-ajax-filters--single')) {
11453				widget.find('input[type="checkbox"]').each(function() {
11454					if (_this.attr('id') !== $(this).attr('id')) {
11455						$(this).prop('checked', false);
11456						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
11457					}
11458				});
11459			}
11460
11461			if (_this.prop('checked')) {
11462				link.addClass('term-filter-link--active');
11463			} else {
11464				link.removeClass('term-filter-link--active');
11465			}
11466
11467			reload_items(container, url, true);
11468		});
11469
11470		$(document).on('change', 'select.select--term-filters', function(e) {
11471			var _this = $(this);
11472			var selected = _this.find('option:selected');
11473			var option = $(selected);
11474			var url = option.attr('data-term-filter-url');
11475			var container = get_filters_container();
11476			var widget = _this.closest('.uncode_widget');
11477
11478			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
11479				window.location = url;
11480			} else {
11481				reload_items(container, url, true);
11482			}
11483		});
11484
11485		$(document).on('click', '.filter-list__link', function(e) {
11486			if (SiteParameters.is_frontend_editor) {
11487				return false;
11488			}
11489
11490			e.preventDefault();
11491
11492			var _this = $(this);
11493			var container = get_filters_container();
11494			var url = _this.attr('href');
11495			reload_items(container, url, true);
11496		});
11497
11498		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
11499			var _this = $(this);
11500			var container = get_filters_container();
11501			var url = _this.attr('href');
11502			reload_items(container, url, true);
11503		});
11504
11505		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
11506
11507			var _this = $(this);
11508			var container = get_filters_container();
11509			var url = _this.attr('href');
11510
11511			if ( container.length ) {
11512				e.preventDefault();
11513				reload_items(container, url, true);
11514			}
11515		});
11516
11517		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
11518			var _this = $(this);
11519			var container = get_filters_container();
11520
11521			if (container.length > 0) {
11522				e.preventDefault();
11523
11524				var min_price = $('#min_price').val();
11525				var max_price = $('#max_price').val();
11526				var location = window.location;
11527				var url = location.href;
11528				var page_uri = location.origin + location.pathname;
11529				var is_filtered = page_uri !== url;
11530
11531				if (is_filtered) {
11532					url = remove_parameter_from_url(url, 'min_price');
11533					url = remove_parameter_from_url(url, 'max_price');
11534				}
11535
11536				var concat = page_uri === url ? '?' : '&';
11537				var params = {'min_price': min_price, 'max_price': max_price};
11538
11539				url = url + concat + $.param(params);
11540
11541				reload_items(container, url, true);
11542			}
11543		});
11544
11545		var search_timer;
11546
11547		$(document).on('keyup', '.term-filters-search-input', function(e) {
11548			var _this = $(this);
11549			var container = get_filters_container();
11550			var value = _this.val();
11551
11552			if (search_timer) {
11553				clearTimeout(search_timer);
11554			}
11555
11556			search_timer = setTimeout(function() {
11557				update_search_url(container, value);
11558			}, 500);
11559		});
11560	}
11561
11562	function update_search_url(container, search_value) {
11563		var location = window.location;
11564		var url = location.href;
11565		var page_uri = location.origin + location.pathname;
11566		var is_filtered = page_uri !== url;
11567		var key_search = SiteParameters.ajax_filter_key_search;
11568		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
11569
11570		if (is_filtered) {
11571			url = remove_parameter_from_url(url, key_search);
11572			url = remove_parameter_from_url(url, key_unfilter);
11573		}
11574
11575		if (search_value) {
11576			var concat = page_uri === url ? '?' : '&';
11577			var params = {};
11578
11579			params[key_search] = search_value;
11580			params[key_unfilter] = 1;
11581			url = url + concat + $.param(params);
11582		} else {
11583			url = remove_parameter_from_url(url, key_search);
11584		}
11585
11586		reload_items(container, url, true);
11587	}
11588
11589	function remove_parameter_from_url(url, parameter) {
11590		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
11591	}
11592
11593	function get_filters_container() {
11594		var container = $('.ajax-grid-system');
11595
11596		if (container.length == 0) {
11597			container = $('.ajax-filters');
11598		}
11599
11600		return container;
11601	}
11602
11603	function update_widgets_state(widgets_states, container) {
11604		for (var i = widgets_states.length - 1; i >= 0; i--) {
11605			var state = widgets_states[i];
11606
11607			if (!state.collapse) {
11608				continue;
11609			}
11610
11611			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
11612
11613			if (state.open) {
11614				new_widget.find('.widget-title').addClass('open');
11615				if (state.css) {
11616					new_widget.find('.widget-collapse-content').attr('style', state.css);
11617				}
11618			} else {
11619				new_widget.find('.widget-title').removeClass('open');
11620				if (state.css) {
11621					new_widget.find('.widget-collapse-content').attr('style', state.css);
11622				}
11623			}
11624		}
11625	}
11626
11627	// Reload items via AJAX
11628	function reload_items(container, url, push) {
11629		container.addClass('grid-filtering');
11630
11631		$.ajax({
11632			url     : url,
11633			success : function(response) {
11634				if (!response) {
11635					return;
11636				}
11637
11638				$(document).trigger('uncode-ajax-pre-filtered');
11639
11640				var container_id = container.attr('id');
11641				var pagination = $('.row-navigation');
11642
11643				if (container_id) {
11644					var container_to_append = $(response).find('#' + container_id);
11645					var pagination_to_append = $(response).find('.row-navigation');
11646					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
11647
11648					// Remember open/closed widgets
11649					var widgets = $('.uncode_widget');
11650					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
11651					var widgets_states = [];
11652
11653					widgets.each(function() {
11654						var widget = $(this);
11655						var id = widget.attr('data-id');
11656						var state = {
11657							'id': id,
11658							'collapse': false,
11659							'open': false,
11660							'css': false,
11661						};
11662
11663						var collapse_wrapper = widget.find('.widget-collapse-content');
11664
11665						if (collapse_wrapper.length > 0) {
11666							state.collapse = true;
11667
11668							var collapse_wrapper_css = collapse_wrapper.attr('style');
11669							var title = widget.find('.widget-title');
11670
11671							state.css = collapse_wrapper_css;
11672
11673							if (title.hasClass('open')) {
11674								state.open = true;
11675							} else {
11676								state.open = false;
11677							}
11678						}
11679
11680						widgets_states.push(state);
11681					});
11682
11683					// Update widgets state
11684					if (offcanvas_sidebar_wrapper.length === 0) {
11685						update_widgets_state(widgets_states, container_to_append);
11686					}
11687
11688					// Update default sidebar state
11689					if (!container.hasClass('ajax-hide-filters')) {
11690						container_to_append.removeClass('ajax-hide-filters');
11691					}
11692
11693					// Update horizontal sidebar
11694					if (!container.hasClass('ajax-hide-filters-blanks')) {
11695						container_to_append.removeClass('ajax-hide-filters-blanks');
11696					}
11697					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
11698					if (horizontal_sidebar_wrapper.length > 0) {
11699						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
11700						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
11701						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
11702						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
11703
11704						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
11705						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
11706					}
11707
11708					// Append container
11709					container.replaceWith(container_to_append);
11710
11711					// Hide first thumbnail until the new srcset is loaded
11712					if (SiteParameters.dynamic_srcset_active === '1') {
11713						container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations');
11714					}
11715
11716					// Remove loading attribute to images
11717					container_to_append.find('img').attr('loading', '');
11718
11719					// Append pagination
11720					if (pagination.length > 0) {
11721						if (pagination_to_append.length > 0) {
11722							pagination.html(pagination_to_append.html());
11723						} else {
11724							pagination.html('');
11725						}
11726					} else {
11727						if (pagination_to_append.length > 0) {
11728							$('.post-wrapper').append(pagination_to_append);
11729						}
11730					}
11731
11732					// Update off canvas sidebar (mobile and overlay)
11733					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
11734
11735					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
11736						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
11737						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
11738						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
11739						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
11740
11741						// Update widgets state
11742						update_widgets_state(widgets_states, sidebar_to_append);
11743
11744						// Update sidebar
11745						sidebar_container.html(sidebar_to_append.html());
11746					}
11747
11748					if (push) {
11749						UNCODE.lastURL = url;
11750						window.history.pushState(
11751							{ pageTitle: document.title },
11752							'',
11753							url
11754						);
11755					}
11756
11757					if (typeof UNCODE.isotopeLayout !== 'undefined') {
11758						UNCODE.isotopeLayout();
11759					}
11760					if (typeof UNCODE.justifiedGallery !== 'undefined') {
11761						UNCODE.justifiedGallery();
11762					}
11763					if (typeof UNCODE.cssGrid !== 'undefined') {
11764						UNCODE.cssGrid();
11765					}
11766					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
11767						UNCODE.lightbox();
11768					}
11769					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
11770						UNCODE.lightgallery();
11771					}
11772					if (typeof UNCODE.carousel !== 'undefined') {
11773						UNCODE.carousel($('body'));
11774					}
11775					UNCODE.animations();
11776					if (typeof UNCODE.filters !== 'undefined') {
11777						UNCODE.filters();
11778					}
11779					if (typeof UNCODE.widgets !== 'undefined') {
11780						UNCODE.widgets();
11781					}
11782
11783					if (SiteParameters.dynamic_srcset_active === '1') {
11784						UNCODE.refresh_dynamic_srcset_size();
11785					}
11786
11787					if (typeof UNCODE.menuSmartInit !== 'undefined') {
11788						UNCODE.menuSmartInit();
11789					}
11790
11791					if (typeof UNCODE.parallax !== 'undefined') {
11792						UNCODE.parallax();
11793					}
11794
11795					maybe_scroll_to_top();
11796
11797					var woo_select2_cats = $('.dropdown_product_cat');
11798
11799					if (woo_select2_cats.length > 0) {
11800						woo_select2_cats.on( 'change', function() {
11801							if ( $(this).val() != '' ) {
11802								var this_page = '';
11803								var home_url  = UncodeWCParameters.uncode_wc_widget_product_categories_home_url;
11804								if ( home_url.indexOf( '?' ) > 0 ) {
11805									this_page = home_url + '&product_cat=' + $(this).val();
11806								} else {
11807									this_page = home_url + '?product_cat=' + $(this).val();
11808								}
11809								location.href = this_page;
11810							} else {
11811								location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url;
11812							}
11813						});
11814
11815						if ( $().selectWoo ) {
11816							var wc_product_cat_select = function() {
11817								woo_select2_cats.selectWoo( {
11818									placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder,
11819									minimumResultsForSearch: 5,
11820									width: '100%',
11821									allowClear: true,
11822									language: {
11823										noResults: function() {
11824											return UncodeWCParameters.uncode_wc_widget_product_categories_no_results;
11825										}
11826									}
11827								} );
11828							};
11829							wc_product_cat_select();
11830						}
11831					}
11832
11833					$(document).trigger('uncode-ajax-filtered');
11834					$(document.body).trigger('init_price_filter');
11835					window.dispatchEvent(new CustomEvent('uncode-ajax-filtered'));
11836				}
11837			},
11838			error: function() {
11839				container.removeClass('grid-filtering');
11840
11841				if (SiteParameters.enable_debug == true) {
11842					// This console log is disabled by default
11843					// So nothing is printed in a typical installation
11844					//
11845					// It can be enabled for debugging purposes setting
11846					// the 'uncode_enable_debug_on_js_scripts' filter to true
11847					console.log('There was an error retrieving the products');
11848				}
11849			}
11850		});
11851	}
11852
11853	// Scroll to top after filtering
11854	function maybe_scroll_to_top() {
11855		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
11856
11857		if (offcanvas_sidebar_wrapper.length > 0) {
11858			return;
11859		}
11860
11861		var container = get_filters_container();
11862		var bound = container[0].getBoundingClientRect();
11863
11864		if (bound.y < 0) {
11865			$(window).scrollTop(container.offset().top);
11866		}
11867	}
11868
11869	// Back/forward browser buttons
11870	$(window).on("popstate.ajaxfilters", function(e) {
11871		var location = window.location;
11872		var url = location.href;
11873		var params = UNCODE.getURLParams(window.location);
11874		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
11875
11876		UNCODE.lastURL = url;
11877
11878		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
11879			return;
11880		}
11881
11882		var container = get_filters_container();
11883
11884		reload_items(container, url, false);
11885	});
11886
11887	// Destroy load more before to init a new one
11888	$(window).on('uncode-ajax-pre-filtered', function() {
11889		if ($.fn.infinitescroll) {
11890			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
11891		}
11892	});
11893
11894	init_filters();
11895};
11896
11897UNCODE.videoThumbs = function() {
11898	var checkResize,
11899		newW = UNCODE.wwidth;
11900	var checkForVideos = function(){
11901
11902		$(window).on('okevents.y.change', function(e, y){
11903			var $video = $(y.target.g),
11904				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11905				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11906				restart = !$video_wrap.hasClass('play-pause'),
11907				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
11908				setTime;
11909			if ( newW >= UNCODE.mediaQuery ) {
11910
11911				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
11912					$video_wrap.data('hovered', true);
11913					$video_wrap.addClass('played-on');
11914					y.target.pauseVideo();
11915					$tmb.on('mouseenter', function(){
11916						if ( restart ) {
11917							y.target.seekTo(0);
11918						}
11919						y.target.playVideo();
11920					}).on('mouseleave', function(){
11921						clearTimeout(setTime);
11922						setTime = setTimeout(function(){
11923							y.target.pauseVideo();
11924						}, 300);
11925					});
11926				}
11927
11928			} else {
11929				if( $mobile_video_wrap.length ) {
11930					$video_wrap.addClass('played-on');
11931					y.target.playVideo();
11932				}
11933			}
11934
11935		});
11936
11937		$(window).on('okevents.v.loaded', function(e, playerV){
11938			var $video = $(playerV.element),
11939				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11940				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11941				restart = !$video_wrap.hasClass('play-pause'),
11942				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'),
11943				setTime;
11944
11945			if ( newW >= UNCODE.mediaQuery ) {
11946				
11947				if( $video_wrap.length ) {
11948
11949					var playPromise = playerV.play();
11950					if (playPromise !== undefined) {
11951						playPromise.then(function( value ) {
11952							playerV.pause();
11953						});
11954					}
11955					$video_wrap.addClass('played-on');
11956					$tmb.on('mouseenter', function(){
11957						if ( restart ) {
11958							playerV.setCurrentTime(0)
11959						}
11960						playerV.play();
11961					}).on('mouseleave', function(){
11962						clearTimeout(setTime);
11963						setTime = setTimeout(function(){
11964							playerV.pause();
11965						}, 300);
11966					});
11967				}
11968
11969			} else {
11970
11971				if( $mobile_video_wrap.length ) {
11972					var playPromise = playerV.play();
11973					if (playPromise !== undefined) {
11974						playPromise.then(function( value ) {
11975							playerV.play();
11976						});
11977					}
11978					$video_wrap.addClass('played-on');
11979				}
11980			}
11981		});
11982
11983		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
11984			var $video = $(video),
11985				$noscript = $('noscript', $video),
11986				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11987				restart = !$video_wrap.hasClass('play-pause'),
11988				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11989				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
11989: $video.closest('.t-entry-visual, .un-inline-image'),
11990				setTime,
11991			manageVideo = function(){
11992				video.currentTime = 0;
11993				video.pause();
11994				if ( newW >= UNCODE.mediaQuery ) {
11995					if ( $video_wrap.length ) {
11996						$video_wrap.addClass('played-on');
11997						$tmb.on('mouseenter', function(){
11998							if ( restart ) {
11999								video.currentTime = 0;
12000							}
12001							video.play();
12002						}).on('mouseleave', function(){
12003							clearTimeout(setTime);
12004							setTime = setTimeout(function(){
12005								video.pause();
12006							}, 300);
12007						});
12008					} else {
12009						video.play();
12010					}
12011				} else {
12012					if ( $mobile_video_wrap.length ) {
12013						$mobile_video_wrap.addClass('played-on');
12014						video.play();
12015					}
12016				}
12017
12018			};
12019			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
12020				$noscript.each(function(key, val){
12021					$noscript.after(val.textContent || val.innerText);
12022					$noscript.remove();
12023				});
12024			}
12025
12026			if (typeof MediaElement === "function") {
12027				$video.has('source[src]').mediaelementplayer({
12028					pauseOtherPlayers: false,
12029				});
12030			}
12031			if (video.readyState > 0) {
12032				manageVideo();
12033			} else {
12034				$video.on("loadedmetadata", function(_event) {
12035					manageVideo();
12036				});
12037			};
12038		});
12039	
12040	};
12041	
12042	checkForVideos();
12043
12044	var checkVideoResize = function(){
12045		clearRequestTimeout(checkResize);
12046		checkResize = requestTimeout(function(){
12047			if ( newW !== UNCODE.wwidth ) {
12048				checkForVideos();
12049				newW = UNCODE.wwidth;
12050			}
12051		}, 1000);
12052	};
12053
12054	$(window).off('resize.videos', checkVideoResize)
12055	.on( 'resize.videos', checkVideoResize);
12056
12057};
12058UNCODE.inlineImgs = function() {
12059    var linkInlineImgs = function(){
12060        $('.un-inline-image').each(function(){
12061            var $img = $(this),
12062                href = $(this).attr('data-link-href'),
12063                dataImg = $img.data();
12064			if ( dataImg != '' && href != null && href !== '' ) {
12065                var class_stra_a = 'unline-image-link';
12066                if ( $(this).hasClass('un-inline-space-over') ) {
12067                    class_stra_a += ' un-inline-space-over';
12068                } else if ( $(this).hasClass('un-inline-space-gutter') ) {
12069                    class_stra_a += ' un-inline-space-gutter';
12070                }
12071                var str_a = '<a class="' + class_stra_a + '" ';
12072                for (var key in dataImg) {
12073                    if (dataImg.hasOwnProperty(key) && key.startsWith("link")) {
12074                        str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\"";
12075                    }
12076                }
12077                str_a += ' />';
12078                $img.wrap(str_a);
12079			}
12080        });
12081    };
12082    $(window).on('load', linkInlineImgs );
12083};
12084UNCODE.lottie = function() {
12085    if ( SiteParameters.is_frontend_editor ) {
12086        var $lottie_wraps = $('div.uncode-lottie-wrap');
12087        $lottie_wraps.each(function(){
12088            var $lottie_wrap = $(this),
12089                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
12090                $player_clone = $div_player.clone(),
12091                player_id = $div_player.attr('data-id'),
12092                $lottie_players = $('lottie-player', $lottie_wrap).remove();
12093            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
12094                if ( $('#'+player_id).length ) {
12095                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
12096                }
12097                $player_clone.attr('id', player_id);
12098                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
12099                $div_player.after($player_clone);
12100                $div_player.attr('data-init',true);
12101            }
12102        });
12103    }
12104    var $players = $('.uncode-lottie-wrap lottie-player');
12105    $players.each(function(){
12106        var player = this,
12107            this_id = $(player).attr('id'),
12108            _player = document.getElementById(this_id),
12109            trigger = $(player).attr('data-trigger'),
12110            pFrames = $(player).attr('data-frames').split(','),
12111            srcPlayer = $(player).attr('src');
12112
12113        _player.load(srcPlayer);
12114
12115        _player.addEventListener("ready", function() {
12116
12117            var $_shadow = _player.shadowRoot;
12118            $($_shadow).find('.error').remove();
12119
12120            var tFrames = _player.getLottie().totalFrames / 100,
12121                pFrame_from = Math.round(tFrames * pFrames[0]),
12122                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
12123                loop = $(player).attr('loop'),
12124                mode,
12125                actions;
12126
12127            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
12128                if ( trigger === 'scroll' ) {
12129                    mode = 'scroll';
12130                    actions = [
12131                        {
12132                            visibility:[0, 1.0],
12133                            type: "seek",
12134                            frames: [pFrame_from, pFrame_to],
12135                        }
12136                    ];
12137                } else if ( trigger === 'viewport') {
12138                    mode = 'scroll';
12139                    actions = [
12140                        {
12141                            visibility: [0.20, 1.0],
12142                            frames: [pFrame_from, pFrame_to],
12143                            type: loop ? "loop" : "play"
12144                        }
12145                    ];
12146                } else if ( trigger === 'hover') {
12147                    $(player).on('mouseenter', function(){
12148                        _player.play();
12149                    }).on('mouseleave', function(){
12150                        _player.pause();
12151                    });
12152                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
12153                        _player.seek(pFrame_from);
12154                        _player.addEventListener("frame", function(){
12155                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
12156                                _player.seek(pFrame_from);
12157                            }
12158                        });
12159                    }
12160                }
12161                LottieInteractivity.create({
12162                    player: '#' + this_id,
12163                    mode: mode,
12164                    actions: actions
12165                });
12166            } else {
12167                if ( pFrame_from > 0 && pFrame_from < 99 ) {
12168                    _player.seek(pFrame_from);
12169                    _player.addEventListener("frame", function(){
12170                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
12171                            _player.seek(pFrame_from);
12172                        }
12173                    });
12174                }
12175            }
12176        });
12177
12178        $(window).on('unlottie-destroy', function(){
12179            _player.destroy();
12180        });
12181    });
12182};
12183
12184UNCODE.animatedBgGradient = function( _el ) {
12185
12186    var ev;
12187
12188	if ( typeof _el === 'undefined' || _el === null ) {
12189        _el = document;
12190        ev = false;
12191	} else {
12192        _el = _el[0];
12193        ev = 'shortcode:update';
12194    }
12195
12196    var simplex = new SimplexNoise();
12197
12198    var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) {
12199		this.block = blockOverlay;
12200		this.wrap = canvasWrap;
12201		this.config();
12202		this.checker();
12203		this.loopRAF();
12204        this.animLoader();
12205    };
12206
12207    var AnimGradient = Uncode_BG_Animated_Gradient.prototype;
12208
12209    AnimGradient.config = function() {
12210        this.canvas = document.createElement('canvas');
12211        this.wrap.appendChild(this.canvas);
12212        this.ctx = this.canvas.getContext('2d');
12213        this.count = 0;        
12214        this.isOrientationChanged = false;
12215        this.res = UNCODE.isMobile ? 90 : 110;
12216        this.resPercent = 100/this.res;
12217        this.resAround = this.resPercent/100;
12218        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;
12219
12220        this.canvas.classList.add('uncode-bg-animated-gradient');
12221        this.canvas.setAttribute('height', this.res);
12222        this.canvas.setAttribute('width', this.res);
12223        this.canvas.style = 'height: 100%; position: relative; width:100%;';
12224
12225        this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height);
12226
12227        this.cx = this.canvas.width/2;
12228        this.cy = this.canvas.height/2;
12229        this.data = this.imgdata.data;
12230
12231        this.opts = {
12232            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,
12233            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,
12234            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
12235        };
12236
12237        this.lavaTime = 1;
12238        this.bg_colors = [];
12239
12240        if ( this.opts.col_1st === false && this.opts.col_2nd === false ) {
12241            return;
12242        }
12243
12244        if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) {
12245            this.singleColor = true;
12246        }
12247
12248        if( this.opts.col_1st ) {
12249
12250            var rgbColor1 = this.hexToRGB(this.opts.col_1st);
12251
12252            this.bg_colors.push({
12253                r: rgbColor1.r,
12254                g: rgbColor1.g,
12255                b: rgbColor1.b
12256            });
12257        }
12258
12259        if( this.opts.col_2nd ) {
12260
12261            var rgbColor2 = this.hexToRGB(this.opts.col_2nd);
12262
12263            this.bg_colors.push({
12264                r: rgbColor2.r,
12265                g: rgbColor2.g,
12266                b: rgbColor2.b
12267            });
12268        }
12269
12270    };
12271
12272    AnimGradient.checker = function() {
12273        var scope = this;
12274        this.checkInViewPort();
12275      
12276        window.addEventListener('resize', function() {
12277            if(UNCODE.isMobile && !scope.isOrientationChanged) {
12278                return;
12279            }
12280            scope.ratioCalc();
12281        });
12282
12283        window.addEventListener("orientationchange", function() {
12284            scope.isOrientationChanged = true;
12285        });
12286
12287        this.ratioCalc();
12288    }; 
12289
12290    AnimGradient.ratioCalc = function() {
12291      
12292        var blockW = this.block.clientWidth,
12293            blockH = this.block.clientHeight;
12294
12295        var blockRatio = blockH/blockW;
12296
12297        if(blockRatio < 1) {
12298            this.ratioParam = {
12299                x: 1.4,
12300                y: blockRatio*1.4
12301            }
12302        } else {
12303            this.ratioParam = {
12304                x: blockRatio/3,
12305                y: 1
12306            }
12307        }
12308         
12309    };
12310
12311    AnimGradient.checkInViewPort = function() {
12312		if( 'IntersectionObserver' in window ) {
12313		    var scope = this,
12314                observer = new IntersectionObserver(function(entries) {
12315  
12316                entries.forEach(function(entry){
12317                    if ( entry.isIntersecting ) {
12318                        scope.isInViewport = true;
12319                    } else {
12320                        scope.isInViewport = false;
12321                    }
12322                });
12323  
12324		    }, { 
12325			root: document,
12326		  });
12327  
12328		  observer.observe(this.block);
12329		}
12330	};
12331	
12332    AnimGradient.hexToRGB = function(hexval) {
12333        var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval);
12334        if (!hexecuted) {
12335            return false;
12336        }
12337        return {
12338            r: parseInt(hexecuted[1], 16),
12339            g: parseInt(hexecuted[2], 16),
12340            b: parseInt(hexecuted[3], 16)
12341        }
12342    };
12343
12344    AnimGradient.factor = function(val_1, val_2, lava) { 
12345        return val_1 * (1 - lava) + val_2 * lava;
12346    };
12347
12348    AnimGradient.factorNoise = function(wave_l, x, y, noise) {
12349        if (this.singleColor) {
12350            return this.bg_colors[0][wave_l];
12351        }
12352        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 );
12353        // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) );
12354    };
12355
12356    AnimGradient.lava = function(x, y, grade) {
12357        var radians = (Math.PI / 180) * grade,
12358        cos = Math.cos(radians),
12359        sin = Math.sin(radians),
12360        nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx;
12361        return nx;
12362    };
12363    
12364    AnimGradient.loopRAF = function() {
12365
12366      var scope = this;
12367
12368        if( this.isInViewport ) {
12369            for (var x = 0; x < this.res; x++) {
12370                for (var y = 0; y < this.res; y++) {
12371                    
12372                    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
12373        
12374                    this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise);
12375                    this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise);
12376                    this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise);
12377                    this.data[(x + y * this.res) * 4 + 3] = noise*265;
12378                  
12379                }
12380            }
12381   
12382            this.count++;
12383          
12384            this.ctx.putImageData(this.imgdata, 0, 0);
12385         
12386        }
12387
12388        requestAnimationFrame(function() {
12389            scope.loopRAF();
12390        });
12391    };
12392
12393    AnimGradient.animLoader = function() {
12394        this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded');
12395    };
12396
12397    var anim_init = function() {
12398        var bgs = _el.querySelectorAll('.block-bg-overlay');
12399      
12400        bgs.forEach(function(blockOverlay) {
12401            var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap');
12402            if( !blockOverlay || !canvasWrap ) {
12403                return;
12404            }
12405            new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap);
12406        });
12407    }
12408
12409    $(window).on('load', function(){
12410        anim_init();
12411    });
12412
12413    if ( ev === 'shortcode:update' ) {
12414        anim_init();
12415    }
12416
12417};
12418UNCODE.multibg = function(){
12419	var $bgsWraps = $('.uncode-multi-bgs'),
12420		$body = $('body');
12421	$bgsWraps.each(function(){
12422		var $bgWrap = $(this),
12423			transition = $bgWrap.attr('data-transition'),
12424			transitionTime = $bgWrap.attr('data-transition-time'),
12425			dataPace = $bgWrap.attr('data-transition-pace'),
12426			dataThreshold = $bgWrap.attr('data-transition-threshold'),
12427			dataTime = $bgWrap.attr('data-carousel-time'),
12428			dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'),
12429			random = $bgWrap.attr('data-multi-random'),
12430			_bgWrap = $bgWrap[0],
12431			$multiBgs = $('.multi-background', $bgWrap),
12432			imgFirst,
12433			bgAmount = $multiBgs.length,
12434			isInViewport = false,
12435			lastScrollTop = 0,
12436			counter = 0,
12437			totMove = 0,
12438			autoScroll = typeof dataPace === 'undefined' && transition === 'scroll',
12439			pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ),
12440			threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0,
12441			offX, offY,
12442			wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250,
12443			carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000,
12444			requestCarousel,
12445			is_header = $bgWrap.closest('#page-header').length,
12446			startTime = new Date();
12447
12448		transition = typeof transition === 'undefined' ? '' : transition;
12449
12450		if ( random === 'true' ) {
12451			UNCODE.shuffle($multiBgs);
12452		}
12453
12454		imgFirst = $multiBgs.first().find('.background-inner').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, "");
12455
12456		var loadFirst = function(){
12457			$multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({
12458				opacity: 1
12459			}, 250, 'easeInQuad').css({
12460				zIndex: 1
12461			});	
12462		}
12463
12464		var loadError = function(){
12465			console.log('Multi BG loading error');
12466		}
12467
12468		UNCODE.checkImgLoad( imgFirst, loadFirst, loadError );
12469
12470		var loadSlides = function( $thisBg ){
12471			$thisBg.attr('data-load', 'loaded');	
12472		}
12473
12474		$multiBgs.not('[data-load="loaded"]').each(function(ind, val){
12475			var $thisBg = $(val);
12476
12477			if ( typeof $thisBg !== 'undefined' && $thisBg.length ) {
12478
12479				var _imgBg = $(val).find('.background-inner').css('background-image');
12480
12481				if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) {
12482					$thisBg.attr('data-load', 'loaded');
12483				} else {
12484					_imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, "");
12485					if ( typeof _imgBg !== 'undefined' ) {
12486						UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg );
12487					}
12488				}
12489			}
12490		});
12491					
12492		var multiCarousel = function(e) {
12493
12494			clearRequestTimeout(requestCarousel);
12495
12496			var checkTime = new Date();
12497			if ( checkTime - startTime >= carouselTime && isInViewport ) {
12498				var $checkEl = $multiBgs.eq((counter+1)%bgAmount);
12499
12500				if ( $checkEl.attr('data-load') !== 'loaded' ) {
12501					requestTimeout(function(){
12502						multiCarousel();
12503					}, 100);
12504					return;
12505				}
12506
12507				counter++;
12508
12509				$multiBgs.each(function(ind, val){
12510					if ( ind === counter%bgAmount ) {
12511						$(val).stop(true,false).animate({
12512							opacity: 1
12513						}, wait, 'easeInQuad').css({
12514							zIndex: 1
12515						});
12516					} else {
12517						$(val).stop(true,false).animate({
12518							opacity: 0
12519						}, wait, 'easeInQuad').css({
12520							zIndex: 0
12521						});
12522					}
12523				});
12524
12525			}
12526
12527			if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
12528				requestCarousel = requestTimeout(multiCarousel, carouselTime);
12529			}
12530	
12531		};
12532
12533		var multiMove = function(e) {
12534			if ( $body.hasClass('navbar-hover') ) {
12535				return;
12536			}
12537			var checkTime = new Date(),
12538                bound = $bgWrap[0].getBoundingClientRect(),
12539                windowTop = (window.clientYOffset || document.documentElement.scrollTop);
12540			if (offX) {
12541				totMove += Math.sqrt(
12542					Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2)
12543				);
12544			}
12545			if (
12546                totMove >= pace && 
12547                checkTime - startTime >= wait &&
12548                e.clientX <= (bound.left + bound.width) &&
12549                e.clientX >= bound.left &&
12550                e.clientY <= (bound.top + bound.height) &&
12551                e.clientY >= bound.top
12552            ) {
12553				counter++;
12554				startTime = checkTime;
12555				$multiBgs.each(function(ind, val){
12556					if ( ind === counter%bgAmount ) {
12557						$(val).stop(true,false).animate({
12558							opacity: 1
12559						}, wait, 'easeInQuad').css({
12560							zIndex: 1
12561						});
12562					} else {
12563						$(val).stop(true,false).animate({
12564							opacity: 0
12565						}, wait, 'easeInQuad').css({
12566							zIndex: 0
12567						});
12568					}
12569				});
12570
12571				totMove = 0;
12572			}
12573			
12574			offX = e.clientX;
12575			offY = e.clientY;
12576			
12577		};
12578
12579		if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
12580			document.addEventListener("mousemove", multiMove);
12581		}
12582
12583		window.addEventListener('resize', function() {
12584			if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
12585				document.removeEventListener("mousemove", multiMove);
12586				document.addEventListener("mousemove", multiMove);
12587			}
12588		});
12589
12590		var lightLoopRAF = function() {
12591
12592			var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),
12593				checkTime = new Date(),
12594				bound = $bgWrap[0].getBoundingClientRect(),
12595				thresholdHeader = is_header ? 100 : threshold,
12596				rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace);
12597			if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) {
12598				counter++;
12599				lastScrollTop = scrollTop;
12600				startTime = checkTime;
12601
12602				$multiBgs.each(function(ind, val){
12603					if ( ind === counter%bgAmount ) {
12604						$(val).stop(true,false).animate({
12605							opacity: 1
12606						}, wait, 'easeInQuad').css({
12607							zIndex: 1
12608						});
12609					} else {
12610						$(val).stop(true,false).animate({
12611							opacity: 0
12612						}, wait, 'easeInQuad').css({
12613							zIndex: 0
12614						});
12615					}
12616				});
12617
12618			}
12619
12620			requestAnimationFrame(function() {
12621				if ( isInViewport ) {
12622					lightLoopRAF();
12623				}
12624			});
12625		};
12626
12627		var currentInd = 0;
12628
12629		var loopRAF = function() {
12630
12631			var multiBgRotate = function(slideInd){
12632				currentInd = slideInd;
12633				$multiBgs.each(function(ind, val){
12634					if ( ind === slideInd ) {
12635						$(val).stop(true,false).animate({
12636							opacity: 1
12637						}, wait, 'easeInQuad').css({
12638							zIndex: 1
12639						});
12640					} else {
12641						$(val).stop(true,false).animate({
12642							opacity: 0
12643						}, wait, 'easeInQuad').css({
12644							zIndex: 0
12645						});
12646					}
12647				});
12648			};
12649			var bound = $bgWrap[0].getBoundingClientRect(),
12650				thresholdPX = UNCODE.wheight * threshold / 100,
12651				totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))),
12652				movePX = totMove / bgAmount,
12653				moving = UNCODE.wheight - (bound.top + thresholdPX),
12654				slideInd = 0;
12655
12656			if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) {
12657				multiBgRotate(0);
12658			} else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) {
12659				multiBgRotate(bgAmount-1);
12660			} else {
12661				slideInd = Math.ceil(moving/movePX) - 1;
12662				if ( slideInd < 0 ) {
12663					slideInd = 0;
12664				} else if ( slideInd >= bgAmount ) {
12665					slideInd = bgAmount-1;
12666				}
12667				if ( slideInd !== currentInd ) {
12668					multiBgRotate(slideInd);
12669				}
12670			}
12671
12672			requestAnimationFrame(function() {
12673				if ( isInViewport ) {
12674					loopRAF();
12675				}
12676			});
12677		};
12678
12679		if( 'IntersectionObserver' in window ) {
12680		    var observer = new IntersectionObserver(function(entries) {
12681  
12682                entries.forEach(function(entry){
12683                    if ( entry.isIntersecting ) {
12684                        isInViewport = true;
12685						if ( transition === 'scroll' ) {
12686							if ( autoScroll ) {
12687								loopRAF();
12688							} else {
12689								lightLoopRAF();
12690							}
12691						} else {
12692							multiCarousel();
12693						}
12694                    } else {
12695                        isInViewport = false;
12696                   }
12697                });
12698  
12699		    }, { 
12700				root: document,
12701				rootMargin: is_header ?  '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px'
12702		  	});
12703
12704			if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
12705		  		observer.observe(_bgWrap);
12706			}
12707
12708			window.addEventListener('resize', function() {
12709				observer.unobserve(_bgWrap);
12710				if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) {
12711					observer.observe(_bgWrap);
12712				}
12713			});
12714	
12715		}
12716
12717	});
12718}
12719
12720UNCODE.owlNav = function(target, ev) {
12721    target = target.replace(/#\S+/g, '');
12722    var $carousel = $('#'+target),
12723        $slider = $carousel.closest('.uncode-slider'),
12724        $checkNavs = $('.uncode-owl-nav');
12725    if ( !$checkNavs.length ) {
12726        return;
12727    }
12728
12729    if ( $slider.length ){
12730        target = $slider.attr('id');
12731    }
12732
12733    var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'),
12734        $row;
12735
12736    if ( ! $navs.length ) {
12737        $row = $carousel.closest('.vc_row.row-container');
12738        $navs = $('.uncode-owl-nav:not([data-target])', $row);
12739    }
12740        
12741    if ( ! $navs.length ) {
12742        return;
12743    }
12744
12745    $navs.each(function(){
12746        var $nav = $(this),
12747            $outer = $nav.closest('.uncode-owl-nav-out'),
12748            $inner = $nav.find('.uncode-owl-nav-in'),
12749            $navDots = $('.uncode-nav-dots', $nav),
12750            $navCounter = $('.uncode-nav-counter', $nav),
12751            $counterIndex = $('.uncode-nav-counter-index', $navCounter),
12752            $counterTotal = $('.uncode-nav-counter-total', $navCounter),
12753            skinInherit = $nav.hasClass('skin-inherit'),
12754            digit = parseFloat($nav.attr('data-digit')),
12755            counterDigit = parseFloat($nav.attr('data-counter-digit')),
12756            navSpeed = parseFloat($carousel.attr('data-navspeed'));
12757        navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400;
12758
12759        if ( $nav.hasClass('pos-abs') ){
12760            if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) {
12761                $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />');
12762            }
12763            $carousel.closest('.owl-carousel-wrapper-nav').append($outer);
12764        } 
12765
12766        $carousel.on('refreshed.owl.carousel', counter);
12767        $carousel.on('resized.owl.carousel', counter);
12768        $carousel.on('changed.owl.carousel', counter);
12769
12770        var totalSlides = 0;
12771
12772        function counter(event) {
12773            if (!event.namespace) {
12774                return;
12775            }
12776            var slides = event.relatedTarget,
12777                current = slides._current,
12778                loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop,
12779                item = event.item,
12780                page = event.page,
12781                countPages = Math.ceil(item.count / page.size),
12782                $currentSlide = $carousel.find('.owl-item').eq(current),
12783                itemIndex = Math.floor($currentSlide.attr('data-index')) ,
12784                activeSlide = Math.ceil(itemIndex / page.size),
12785                $prev = $nav.find('.uncode-nav-prev'),
12786                $next = $nav.find('.uncode-nav-next'),
12787                $col = $currentSlide.find('.uncol').first();
12788
12789            if ( totalSlides != countPages ) {
12790                totalSlides = countPages;
12791                $navDots.html('');
12792                var nav_html = '';
12793                for (var sl_ind = 0; sl_ind < countPages; sl_ind++) {
12794                    var padN = sl_ind+1;
12795                    if ( digit && digit > 1 ) {
12796                        padN = String(padN).padStart(digit, '0');
12797                    }
12798                    nav_html += '<span class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '"><span>' + padN + '</span></span>';
12799                }
12800                $navDots.html(nav_html);
12801
12802                var totalSlidesDigit = totalSlides;
12803
12804                if ( counterDigit && counterDigit > 1 ) {
12805                    totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0');
12806                }
12807                $counterTotal.html(totalSlidesDigit);
12808            }
12809
12810            if ( loop !== true ) {
12811                $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled');
12812                if ( itemIndex === 1 ) {
12813                    $prev.addClass('uncode-nav-disabled');
12814                } else if ( ( itemIndex - 1 + page.size ) >= item.count ) {
12815                    $next.addClass('uncode-nav-disabled');
12816                    activeSlide = Math.ceil(item.count / page.size);
12817                }
12818            }
12819
12820            $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index');
12821            var activeSlideDigit = activeSlide;
12822
12823            if ( counterDigit && counterDigit > 1 ) {
12824                activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0');
12825            }
12826            $counterIndex.html(activeSlideDigit);
12827
12828            if ( skinInherit ) {
12829                if ( $col.hasClass('style-light') ){
12830                    $nav.removeClass('style-dark').addClass('style-light');
12831                } else if ( $col.hasClass('style-dark') ) {
12832                    $nav.removeClass('style-light').addClass('style-dark');
12833                }
12834            }
12835
12836            $inner.removeClass('uncode-owl-nav-waiting');
12837
12838            if ( $nav.hasClass('outer-width') ) {
12839                var navW = $nav.outerWidth(),
12840                    nexW = $next.outerWidth(),
12841                    prevW = $prev.outerWidth(),
12842                    margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) );
12843
12844                if ( $nav.hasClass('h-align-justify') ) {
12845                    $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'});
12846                    if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) {
12847                        $inner.css({'margin': 'auto'});
12848                    } else {
12849                        $inner.css({'margin': ''});
12850                    }
12851                } else {
12852                    $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'});
12853                    if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) {
12854                        $inner.css({'margin': 'auto'});
12855                    } else {
12856                        $inner.css({'margin': ''});
12857                    }
12858                }
12859            }
12860        }
12861
12862        $nav.off('click', '.uncode-nav-index');
12863        $nav.on('click', '.uncode-nav-index', function(){
12864                var $bullet = $(this),
12865                slide_index = parseFloat( $bullet.attr('data-key') );
12866            $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]);
12867        });
12868        $nav.off('click', '.uncode-nav-prev');
12869        $nav.on('click', '.uncode-nav-prev', function(){
12870            $carousel.trigger('prev.owl.carousel', [navSpeed]);
12871        });
12872        $nav.off('click', '.uncode-nav-next');
12873        $nav.on('click', '.uncode-nav-next', function(){
12874            $carousel.trigger('next.owl.carousel', [navSpeed]);
12875        });
12876
12877        if ( $nav.hasClass('animated-arrows') ) {
12878            $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){
12879                $(this).addClass("hover"); 
12880            }).on('animationend', function(){
12881                $(this).removeClass("hover");  
12882            });
12883        }
12884
12885        var positionNav = function(){
12886            if ( $nav.hasClass('window-width') ) {
12887                var navOff = parseFloat( $nav.offset().left ) * -1;
12888                if ( navOff > 0 ) {
12889                    $inner.css({ transform: 'translateX(' + navOff + 'px)' });
12890                } else {
12891                    $inner.css({ transform: 'none' });
12892                }
12893            }
12894        }
12895        positionNav();
12896        $(window).on('resize', positionNav);
12897    });
12898
12899    $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended');
12900};
12901
12902	UNCODE.init = function() {
12903		var wfl_check = false, wfl_request, waypoint_request;
12904		UNCODE.preventDoubleTransition();
12905		UNCODE.betterResize();
12906		UNCODE.utils();
12907		UNCODE.magnetic();
12908		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
12909			UNCODE.changeSkinOnScroll();
12910		}
12911		if (typeof UNCODE.share !== 'undefined') {
12912			UNCODE.share();
12913		}
12914		if (typeof UNCODE.tooltip !== 'undefined') {
12915			UNCODE.tooltip();
12916		}
12917		if (typeof UNCODE.counters !== 'undefined') {
12918			UNCODE.counters();
12919		}
12920		if (typeof UNCODE.countdowns !== 'undefined') {
12921			UNCODE.countdowns();
12922		}
12923		if (typeof UNCODE.tabs !== 'undefined') {
12924			UNCODE.tabs();
12925		}
12926		if (typeof UNCODE.collapse !== 'undefined') {
12927			UNCODE.collapse();
12928		}
12929		if (typeof UNCODE.bigText !== 'undefined') {
12930			UNCODE.bigText();
12931		}
12932		UNCODE.menuSystem();
12933		if (typeof UNCODE.bgChanger !== 'undefined') {
12934			UNCODE.bgChanger();
12935		}
12936		if (typeof UNCODE.magicCursor !== 'undefined') {
12937			UNCODE.magicCursor();
12938		}
12939		if (typeof UNCODE.magneticCursor !== 'undefined') {
12940			UNCODE.magneticCursor();
12941		}
12942		if (typeof UNCODE.dropImage !== 'undefined') {
12943			UNCODE.dropImage();
12944		}
12945		if (typeof UNCODE.postTable !== 'undefined') {
12946			UNCODE.postTable();
12947		}
12948		if (typeof UNCODE.rotatingTxt !== 'undefined') {
12949			UNCODE.rotatingTxt();
12950		}
12951		if (typeof UNCODE.okvideo !== 'undefined') {
12952			UNCODE.okvideo();
12953		}
12954		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
12955			UNCODE.backgroundSelfVideos();
12956		}
12957		UNCODE.tapHover();
12958		if (typeof UNCODE.isotopeLayout !== 'undefined') {
12959			UNCODE.isotopeLayout();
12960		}
12961		if (typeof UNCODE.justifiedGallery !== 'undefined') {
12962			UNCODE.justifiedGallery();
12963		}
12964		if (typeof UNCODE.cssGrid !== 'undefined') {
12965			UNCODE.cssGrid();
12966		}
12967		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
12968			UNCODE.lightbox();
12969		}
12970		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
12971			$(window).on('load more-items-loaded',function(){
12972				UNCODE.lightgallery();
12973			});
12974		}
12975		if (typeof UNCODE.carousel !== 'undefined') {
12976			UNCODE.carousel($('body'));
12977		}
12978		if (typeof UNCODE.lettering !== 'undefined') {
12979			UNCODE.lettering();
12980		}
12981		UNCODE.animations();
12982		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
12983			UNCODE.stickyElements();
12984		}
12985		if (typeof UNCODE.twentytwenty !== 'undefined') {
12986			UNCODE.twentytwenty();
12987		}
12988		UNCODE.disableHoverScroll();
12989		UNCODE.printScreen();
12990		if (typeof UNCODE.particles !== 'undefined') {
12991			UNCODE.particles();
12992		}
12993		if (typeof UNCODE.filters !== 'undefined') {
12994			UNCODE.filters();
12995		}
12996		if (typeof UNCODE.ajax_filters !== 'undefined') {
12997			UNCODE.ajax_filters();
12998		}
12999		if (typeof UNCODE.widgets !== 'undefined') {
13000			UNCODE.widgets();
13001		}
13002		if (typeof UNCODE.unmodal !== 'undefined') {
13003			UNCODE.unmodal();
13004		}
13005		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
13006			if ( !UNCODE.isFullPage ) {
13007				UNCODE.checkScrollForTabs();
13008			}
13009		}
13010		if (typeof UNCODE.onePage !== 'undefined') {
13011			UNCODE.onePage(UNCODE.isMobile);
13012		}
13013		if (typeof UNCODE.fullPage !== 'undefined') {
13014			$(document).ready(function(){
13015				UNCODE.fullPage();
13016			});
13017		}
13018		if (typeof UNCODE.skewIt !== 'undefined') {
13019			UNCODE.skewIt();
13020		}
13021		if (typeof UNCODE.rotateIt !== 'undefined') {
13022			UNCODE.rotateIt();
13023		}
13024		if (typeof UNCODE.textMarquee !== 'undefined') {
13025			UNCODE.textMarquee();
13026		}
13027		if (typeof UNCODE.stickyScroll !== 'undefined') {
13028			UNCODE.stickyScroll();
13029		}
13030		if (typeof UNCODE.stickyTrigger !== 'undefined') {
13031			UNCODE.stickyTrigger();
13032		}
13033		if (typeof UNCODE.verticalText !== 'undefined') {
13034			UNCODE.verticalText();
13035		}
13036		if (typeof UNCODE.videoThumbs !== 'undefined') {
13037			UNCODE.videoThumbs();
13038		}
13039		if (typeof UNCODE.revslider !== 'undefined') {
13040			UNCODE.revslider();
13041		}
13042		if (typeof UNCODE.layerslider !== 'undefined') {
13043			UNCODE.layerslider();
13044		}
13045		if (typeof UNCODE.lottie !== 'undefined') {
13046			UNCODE.lottie();
13047		}
13048		if (typeof UNCODE.inlineImgs !== 'undefined') {
13049			UNCODE.inlineImgs();
13050		}
13051		if (typeof UNCODE.animatedBgGradient !== 'undefined') {
13052			UNCODE.animatedBgGradient();
13053		}
13054		if (typeof UNCODE.readMoreCol !== 'undefined') {
13055			UNCODE.readMoreCol();
13056		}
13057		if (typeof UNCODE.multibg !== 'undefined') {
13058			UNCODE.multibg();
13059		}
13060		$(window).on('load',function(){
13061			clearRequestTimeout(waypoint_request);
13062			waypoint_request = requestTimeout( function(){
13063				Waypoint.refreshAll();
13064			}, 1000);
13065		});
13066		$(window).one('load',function(){
13067			if (typeof UNCODE.parallax !== 'undefined') {
13068				UNCODE.parallax();
13069			}
13070		});
13071	}
13072
13073	if ( ! SiteParameters.is_frontend_editor ) {
13074		UNCODE.init();
13075	}
13076
13077
13078})(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.