PageSourceSearch

https://cascpa.org/wp-content/themes/uncode/library/js/app.js?ver=329377602

js cascpa.org collected 2026-10-07 15:02:32 UTC 367,951 bytes, 11,533 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.betterResize = function() {
56	var setResize,
57		doubleResize = true,
58		oldW = UNCODE.wwidth;
59	$(window).on( 'resize orientationchange', function(){
60		if ( oldW === UNCODE.wwidth ) {
61			return;
62		} else {
63			oldW = UNCODE.wwidth;
64			$(window).trigger('wwResize');
65		}
66	});
67};
68
69Number.isInteger = Number.isInteger || function(value) {
70    return typeof value === "number" &&
71           isFinite(value) &&
72           Math.floor(value) === value;
73};
74
75UNCODE.utils = function() {
76	$(document).on('mouseover', 'a', function() {
77		$(this).attr('data-title', $(this).attr('title'));
78		$(this).removeAttr('title');
79	});
80	$(document).on('mouseout', 'a', function() {
81		$(this).attr('title', $(this).attr('data-title'));
82		$(this).removeAttr('data-title');
83	});
84
85	this.get_scroll_offset = function(e) {
86
87		var scroll_offset = 0,
88			target,
89			trigger;
90
91		if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) {
92			target = e.target;
93			trigger = e.currentTarget;
94		}
95
96		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
97			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
98				UNCODE.hideMenu(100);
99			}
100		}
101
102		if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery  ) {
103			// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
104			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
105				if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) {
106					if ( !$('.menu-hided').length ) {
107						scroll_offset += $('.logo-container:visible').outerHeight();
108					}
109				} else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) {
110					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
111					scroll_offset += $('.menu-sticky .menu-container').outerHeight() - ( $('.navbar-brand').data('minheight') + shrink );
112				} else {
113					if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) {
114						scroll_offset += UNCODE.menuMobileHeight;
115					} else {
116						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 ) {
117							//scroll_offset += $('.main-menu-container > div:first-child()').height() - 2;
118						} else {
119							if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) {
120								scroll_offset += UNCODE.menuMobileHeight;
121							}
122						}
123					}
124				}
125			}
126	
127		}
128
129		scroll_offset += UNCODE.bodyBorder;
130
131		return scroll_offset;
132	}
133
134	if ( !UNCODE.isFullPage ) {
135		$(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) {
136
137			var hash = (e.currentTarget).hash,
138			is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
139			anchor = '';
140			if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
141			if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) {
142				e.preventDefault();
143				if (!$('#tab-reviews').is(':visible')) {
144					$('a[href="#tab-reviews"]').trigger('click');
145				}
146				var calc_scroll = $('.wootabs .tab-content').offset().top;
147				calc_scroll -= UNCODE.get_scroll_offset(e);
148
149				if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
150					var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
151
152					if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
153						scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
154					}
155				}
156
157				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
158					delta = bodyTop - calc_scroll,
159					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
160				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
161
162				requestTimeout(function(){
163					if (scrollSpeed == 0) {
164						$('html, body').scrollTop(calc_scroll);
165						UNCODE.scrolling = false;
166					} else {
167   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
168							$(this).stop();
169						}).animate({
170								scrollTop: calc_scroll
171							}, scrollSpeed, 'easeInOutCubic', function() {
172								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
173								UNCODE.scrolling = false;
174							}
175						);
176					}
177				}, 200);
178				return;
179			}
180			if (hash != undefined) {
181				var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/;
182				var anchor = this.hash.slice(1);
183				if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
184			  		if ( !specialFormat.test(hash) ) {
185			  			if ( $(hash).length )
186			  				anchor = $(hash);
187			  		}
188				}
189			}
190
191			if (is_scrolltop || anchor != '') {
192				if (is_scrolltop) {
193					e.preventDefault();
194					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
195					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
196					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
197
198					if (scrollSpeed == 0) {
199						$('html, body').scrollTop(0);
200						UNCODE.scrolling = false;
201					} else {
202   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
203							$(this).stop();
204						}).animate({
205							scrollTop: 0
206						}, scrollSpeed, 'easeInOutCubic', function() {
207							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
208							UNCODE.scrolling = false;
209						});
210					}
211				} else {
212					var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor;
213					$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
214						var get_href = $(val).attr('href');
215						if (get_href != undefined) {
216							if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
217							else $(val).parent().removeClass('active');
218						}
219					});
220					if (scrollSection.length) {
221						if ( $('body').hasClass('uncode-scroll-no-history') ) {
222							e.preventDefault();
223						}
224
225						if (UNCODE.menuOpened) {
226							if (UNCODE.wwidth < UNCODE.mediaQuery) {
227								window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
228							} else {
229								$('.mmb-container-overlay .overlay-close').trigger('click');
230								$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
231							}
232						}
233
234						var calc_scroll = scrollSection.offset().top,
235							getOffset = UNCODE.get_scroll_offset(e),
236							$logo = $('.logo-container:visible'),
237							logoH,
238							$menu = $('#masthead .menu-container'),
239							menuH;
240
241						calc_scroll -= isNaN(getOffset) ? 0 : getOffset;
242
243						var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
244							delta = bodyTop - calc_scroll,
245							scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
246						if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
247
248						if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
249							if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) {
250								logoH = $logo.outerHeight(),
251								menuH = $menu.outerHeight();
252								if ( calc_scroll < ( logoH + menuH ) ) {
253									calc_scroll = 0;
254								}
255							}
256						}
257
258						if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) {
259							calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() );
260						}
261						
262						if (scrollSpeed == 0) {
263							$('html, body').scrollTop(calc_scroll);
264							UNCODE.scrolling = false;
265						} else {
266	   						$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
267								$(this).stop();
268							}).animate({
269								scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
270							}, scrollSpeed, 'easeInOutCubic', function() {
271								$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
272								UNCODE.scrolling = false;
273								if  ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
274								||
275								$('.menu-hided').length ) {
276									calc_scroll = scrollSection.offset().top;
277									getOffset = UNCODE.get_scroll_offset(e);
278									calc_scroll -= getOffset;
279									$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
280										$(this).stop();
281									}).animate({
282										scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll
283										}, scrollSpeed, 'easeInOutCubic', function() {
284											$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
285											UNCODE.scrolling = false;
286										}
287									);
288								}
289							});
290						}
291					}
292				}
293			}
294		});
295		$('.header-scrolldown').on('click', function(event) {
296
297			event.preventDefault();
298
299			var pageHeader = $(event.target).closest('#page-header'),
300				pageHeaderTop = pageHeader.offset().top,
301				pageHeaderHeight = pageHeader.outerHeight(),
302				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
303			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
304
305			var calc_scroll = pageHeaderTop + pageHeaderHeight,
306			getOffset = UNCODE.get_scroll_offset(event);
307			calc_scroll -= getOffset;
308
309			if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
310				var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
311
312				if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
313					scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
314				}
315			}
316
317			if (scrollSpeed == 0) {
318				$('html, body').scrollTop(calc_scroll);
319				UNCODE.scrolling = false;
320			} else {
321					$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
322						$(this).stop();
323					}).animate({
324						scrollTop: calc_scroll
325					}, scrollSpeed, 'easeInOutCubic', function() {
326						$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
327						UNCODE.scrolling = false;
328						if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) {
329							calc_scroll = pageHeaderTop + pageHeaderHeight;
330							getOffset = UNCODE.get_scroll_offset(event);
331							calc_scroll -= getOffset;
332								$('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
333									$(this).stop();
334								}).animate({
335									scrollTop: calc_scroll
336								}, scrollSpeed, 'easeInOutCubic', function() {
337									$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
338									UNCODE.scrolling = false;
339								}
340							);
341						}
342					}
343				);
344			}
345		});
346	}
347
348	// Colomun hover effect
349	// =================
350	$(document).on('mouseenter', '.col-link', function(e) {
351		var uncol = $(e.target).prev('.uncol'),
352		el = uncol.find('.column-background');
353		if (el) {
354			$('.btn-container .btn', uncol).toggleClass('active');
355			var elOverlay = $(el[0]).find('.block-bg-overlay');
356			if (elOverlay.length) {
357				var getOpacity = $(elOverlay).css('opacity');
358				if (getOpacity != 1) {
359					getOpacity = Math.round(getOpacity * 100) / 100;
360					var newOpacity = getOpacity + .1;
361					$(elOverlay).data('data-opacity', getOpacity);
362					$(elOverlay).css('opacity', newOpacity);
363				}
364			}
365		}
366	}).on('mouseleave', '.col-link', function(e) {
367		var uncol = $(e.target).prev('.uncol'),
368		el = uncol.find('.column-background');
369		$('.btn-container .btn', uncol).toggleClass('active');
370		if (el) {
371			var elOverlay = $(el[0]).find('.block-bg-overlay');
372			if (elOverlay.length) {
373				var getOpacity = $(elOverlay).data('data-opacity');
374				$(elOverlay).css('opacity', getOpacity);
375			}
376		}
377	});
378
379	// Admin bar
380	// ============
381	var fixAdminBar = function() {
382		if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) {
383			var getAdminBar = $('#wpadminbar');
384			if (getAdminBar.length) {
385				if (getAdminBar.css('position') !== 'hidden') {
386					var getAdminBarHeight = getAdminBar.height();
387					if (getAdminBar.css('position') === 'fixed') {
388						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
389						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
390					} else {
391						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
392						$('.body-borders .top-border').css({'margin-top':'0px'});
393					}
394				}
395			}
396		}
397	};
398	window.addEventListener('load', fixAdminBar);
399	window.addEventListener('resize', fixAdminBar);
400	// Print
401	// ===========
402	var beforePrint = function() {
403		window.dispatchEvent(new CustomEvent('resize'));
404		window.dispatchEvent(UNCODE.boxEvent);
405	};
406
407	if (window.matchMedia) {
408		var mediaQueryList = window.matchMedia('print');
409		mediaQueryList.addListener(function(mql) {
410			if (mql.matches) {
411				beforePrint();
412			}
413		});
414	}
415
416	window.onbeforeprint = beforePrint;
417
418	// Safari srcset
419	var safariSrcSet = function(){
420		if ( !SiteParameters.is_frontend_editor ) {
421			$('html.safari img[sizes]').each(function(){
422				var $img = $(this),
423					sizeImg = parseInt($img.attr('sizes'));
424				if ( typeof(sizeImg) === 'number' ) {
425					$img.attr('sizes', (sizeImg) + 'px');
426				}
427			});
428		}
429	};
430	window.addEventListener('load', safariSrcSet);
431}
432
433UNCODE.lettering = function() {
434
435	var setCTA;
436	var highlightStill = function(){
437
438		var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)');
439
440		$.each($heading_texts, function(key, el) {
441			var $heading = $(el);
442
443			if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) {
444				return;
445			}
446
447			if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) {
448				return;
449			}
450
451			var waypoint = new Waypoint({
452				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
453				element: el,
454				handler: function() {
455					var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element),
456						anims_l = $anims.length;
457					$anims.each(function(_key_, _el_){
458						var $anim = $(_el_);
459
460						if ( ! $anim.hasClass('heading-text-highlight-animated') ) {
461							$anim.addClass('heading-text-highlight-animated');
462
463							if ( $heading.data('animate') === true ) {
464								$anim.css({
465									'-webkit-transition-duration': '0ms',
466									'-moz-transition-duration': '0ms',
467									'-o-transition-duration': '0ms',
468									'transition-duration': '0ms',
469								});
470							} else {
471								$anim.css({
472									'-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms',
473									'-moz-transition-delay': ((_key_ + 2) * 200) + 'ms',
474									'-o-transition-delay': ((_key_ + 2) * 200) + 'ms',
475									'transition-delay': ((_key_ + 2) * 200) + 'ms',
476								});
477							}
478						}
479
480					});
481					$anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) {
482						$heading.data('animate', true);
483					});
484					$anims.removeAttr('data-animated');
485				},
486				offset: '100%'
487			});
488
489		});
490
491		Waypoint.refreshAll();
492		$( document.body ).trigger('uncode_waypoints');
493
494	}
495
496	requestTimeout(function(){
497		highlightStill();
498		$(window).on( 'resize', function(){
499			clearRequestTimeout(setCTA);
500			setCTA = requestTimeout( highlightStill, 100 );
501		});
502	}, 400);
503
504};
505
506UNCODE.isUnmodalOpen = false;
507
508var manageVideoSize = function(){
509
510	var setVideoFit;
511	$('.wp-block-embed').each(function(){
512
513		var $this = $(this);
514
515		if ( $('iframe', $this).length ) {
516
517			var $iframe = $('> iframe, > a > iframe', $this),
518				w = parseFloat($iframe.attr('width')),
519				h = parseFloat($iframe.attr('height')),
520				url = $iframe.attr('src'),
521				ratio, frW;
522
523			if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0  ) {
524
525				ratio = h / w;
526				var setResizeiFto,
527					resizeiFrame = function(){
528					frW = $iframe.width();
529					$iframe.css({
530						height: frW * ratio
531					});
532				};
533				resizeiFrame();
534				$(window).on( 'resize load', function(){
535					clearRequestTimeout(setResizeiFto);
536					setResizeiFto = requestTimeout( function() {
537						resizeiFrame();
538					}, 10 );
539				});
540
541			}
542
543		}
544
545	});
546
547};
548
549manageVideoSize();
550
551UNCODE.vivus = function(icon, time, delay, file) {
552	if (typeof Vivus !== 'undefined') {
553		var icon_options = {
554			type: 'delayed',
555			pathTimingFunction: Vivus.EASE_OUT,
556			animTimingFunction: Vivus.LINEAR,
557			duration: time,
558		}
559
560		if (delay) {
561			icon_options.delayStart = delay;
562		}
563
564		if (file) {
565			icon_options.file = file;
566		}
567
568		new Vivus(icon, icon_options);
569	}
570};
571
572UNCODE.lastURL = '';
573
574UNCODE.getURLParams = function(current_location, is_string) {
575	var params = {};
576	if (is_string) {
577		var url = current_location.split('?')[1];
578	} else {
579		var url = current_location.search;
580		url = url.substring(1);
581	}
582	if (url) {
583		var parts = url.split('&');
584		for (var i = 0; i < parts.length; i++) {
585			var nv = parts[i].split('=');
586			if (!nv[0]) {
587				continue;
588			}
589			params[nv[0]] = nv[1] || true;
590		}
591	}
592	return params;
593}
594
595UNCODE.hasEqualURLParams = function(obj1, obj2) {
596	for (var i in obj1) {
597		if (obj1.hasOwnProperty(i)) {
598			if (!obj2.hasOwnProperty(i)) {
599				return false;
600			}
601			if (obj1[i] != obj2[i]) {
602				return false;
603			}
604		}
605	}
606	for (var i in obj2) {
607		if (obj2.hasOwnProperty(i)) {
608			if (!obj1.hasOwnProperty(i)) {
609				return false;
610			}
611			if (obj1[i] != obj2[i]) {
612				return false;
613			}
614		}
615	}
616    return true;
617}
618
619UNCODE.changeSkinOnScroll = function(){
620	if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) {
621		return;
622	}
623	var $masthead = $('#masthead'),
624		transDesktop,
625		transMobile,
626		changeSkin,
627
628	checkTransparencyAndChange = function( $col ){
629		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
630		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
631		changeSkin = $masthead.hasClass('menu-change-skin');
632
633		if ( ! transDesktop && ! transMobile ) {
634			return false;
635		}
636
637		if ( ! changeSkin ) {
638			return false;
639		}
640
641		if ( $col.hasClass('style-light') ){
642			$masthead.removeClass('style-dark-override').addClass('style-light-override');
643			return false;
644		} else if ( $col.hasClass('style-dark') ) {
645			$masthead.removeClass('style-light-override').addClass('style-dark-override');
646			return false;
647		}
648	};
649
650	var prev_row = 'normal',
651		odd = true,
652		$rows = $('.vc_row[data-parent]:visible');
653	$.each($rows, function(index, row){
654		var $row = $(row),
655			$col = $('.uncol', $row).first(),
656			$slider = $('.uncode-slider', $row);
657
658		var wayDown = new Waypoint({
659			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
660			element: row,
661			handler: function(direction) {
662				if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
663					if ( $slider.length ) {
664						$col = $('.owl-item.index-active .uncol', $slider).first();
665					}
666					checkTransparencyAndChange($col);
667				}
668				if ( odd === false ) {
669					if ( row.hasAttribute('data-bg-changer') ) {
670						prev_row = 'bg-changer';
671					} else {
672						prev_row = 'normal';
673					}
674					odd = true;
675				} else {
676					odd = false;
677				}
678			},
679			offset: function() {
680				return UNCODE.menuHeight / 2
681			}
682		});
683		var wayUp = new Waypoint({
684			context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
685			element: row,
686			handler: function(direction) {
687				if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) {
688					if ( $slider.length ) {
689						$col = $('.owl-item.index-active .uncol', $slider).first();
690					}
691					checkTransparencyAndChange($col);
692				}
693				if ( odd === false ) {
694					if ( row.hasAttribute('data-bg-changer') ) {
695						prev_row = 'bg-changer';
696					} else {
697						prev_row = 'normal';
698					}
699					odd = true;
700				} else {
701					odd = false;
702				}
703			},
704			offset: function() {
705				return -row.clientHeight + ( UNCODE.menuHeight / 2 )
706			}
707		});
708	});
709
710};
711
712UNCODE.share = function() {
713	if (typeof Share !== 'undefined') {
714		var share_button_element = $('.share-button');
715		var share_button_url = share_button_element.data('url');
716
717		var share_button_config = {
718			ui: {
719				flyout: "top center",
720				button_font: false,
721				button_text: '',
722				icon_font: false
723			}
724		};
725
726		if (share_button_url) {
727			share_button_config.url = share_button_url.replace("&", "%26");
728		}
729
730		var share_button_top = new Share('.share-button', share_button_config);
731	}
732};
733
734UNCODE.tooltip = function() {
735	if (typeof jQuery.fn.tooltip !== 'undefined') {
736		$('.btn-tooltip').tooltip();
737	}
738};
739
740UNCODE.counters = function() {
741	var $counters = $('.uncode-counter:not(.counter-init)');
742	$counters.each(function(){
743		var $counter = $(this).addClass('counter-init');
744		if ( $counter.closest( '.owl-carousel' ).length ) {
745			return;
746		}
747		$counter.addClass('started').counterUp({
748			delay: 10,
749			time: 1500
750		});
751	});
752};
753
754UNCODE.countdowns = function() {
755	var $countdowns = $('[data-uncode-countdown]:not(.counter-init)');
756	$countdowns.each(function() {
757		var $this = $(this).addClass('counter-init'),
758			finalDate = $(this).data('uncode-countdown');
759		$this.countdown(finalDate, function(event) {
760			$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>'));
761		});
762	});
763};
764
765UNCODE.tabs = function() {
766
767	var tabSwitcher = function($el){
768		$('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vertical):not(.tab-switch)', $el).each(function(key, value){
769			var $navs = $(value),
770				$active = $('li.active', $navs),
771				$active_a = $('> a', $active),
772				$active_span = $('> span', $active_a),
773				vertical = $navs.closest('.vertical-tab-menu').length;
774			
775			if ( ! $('.switcher-cursor', $navs).length && ! vertical ) {
776				$navs.append('<span class="switcher-cursor" />');
777			}
778
779			var $cursor = $('.switcher-cursor', $navs),
780				active_w = $('a', $active).outerWidth(),
781				span_w = $active_span.outerWidth(),
782				active_pos = $active.position(),
783				active_a_pos = $active_a.position(),
784				span_pos = $active_span.position(),
785				cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
786				cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left;
787
788			cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10);
789
790			if ( ! vertical ) {
791				$cursor.css({
792					left: cursor_left,
793					width: cursor_w
794				});
795			}
796
797			$navs.addClass('switch-init');
798		});
799	};
800
801	var $body = $('body');
802	tabSwitcher($body);
803
804	var tabHoverIntent = function(){
805		var setHover;
806		$('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]')
807			.on('mouseover', function(e){
808				var $this = $(e.target);
809				setHover = requestTimeout(function() {
810					$this.trigger('hover-int');
811				}, 50);
812			})
813			.on('mouseout', function(){
814				clearRequestTimeout(setHover);
815			});
816	};
817	tabHoverIntent();
818
819	var tabInit = function(){
820		$('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) {
821			e.preventDefault()
822			var $el = $(this);
823			$el.tab('show');
824			var $container = $el.closest('.uncode-tabs');
825			tabSwitcher($container);
826			requestTimeout(function() {
827				window.dispatchEvent(UNCODE.boxEvent);
828				var $tabs = $(e.currentTarget).closest('.uncode-tabs');
829
830				if ( $tabs.hasClass('tabs-trigger-box-resized') ) {
831				window.dispatchEvent(new CustomEvent('boxResized'));
832				} else if ( $tabs.hasClass('tabs-trigger-window-resize') ) {
833					window.dispatchEvent(new Event('resize'));
834					$(window).trigger('uncode.re-layout');
835				} 
836
837				var $active_panel = $('.tab-pane.active', $tabs);
838
839				$.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) {
840					var element = $(val),
841						delayAttr = element.attr('data-delay');
842					if (delayAttr == undefined) delayAttr = 0;
843					requestTimeout(function() {
844						element.addClass('start_animation');
845					}, delayAttr);
846				});
847
848			}, 300);
849
850			var $li = $el.closest('li'),
851				mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
852			$('li', $container).not($li).find('.tab-pane').slideUp(250)
853			$('.tab-pane', $li).slideDown(250);
854			var completeSlideDown = requestTimeout(function(){
855				if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) {
856					var pos = $el.offset(),
857						rect = $el[0].getBoundingClientRect(),
858						$masthead = $('#masthead > .menu-container'),
859						considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0;
860
861					if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) {
862						$('html, body').animate({
863							scrollTop: ( pos.top ) - considerMenu
864						},{
865							easing: 'easeInOutQuad',
866							duration: 250
867						});
868					}
869				}
870			}, 260);
871		});
872	}
873	tabInit();
874
875	var tabResponsive = function(){
876		if ( SiteParameters.is_frontend_editor ) {
877			return true;
878		}
879		var $tabContainers = $('.tab-container.tabs-breakpoint');
880		$tabContainers.each(function(){
881			var $tabContainer = $(this),
882				$tabContent = $('.tab-content', $tabContainer),
883				$nav = $('.nav-tabs', $tabContainer),
884				mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile;
885
886			$('> li', $nav).each(function(){
887				var $li = $(this),
888					dataID = $li.attr('data-tab-id');
889
890				if ( UNCODE.wwidth <= mQuery ) {
891					if ( ! $('.tab-pane', $li ).length ) {
892						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent);
893						$li.append($append_pane);
894					}
895
896					if ( $li.hasClass('active') ) {
897						$('> a', $li).click();
898					}
899				} else {
900					if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) {
901						var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav);
902						$tabContent.prepend($append_pane.removeAttr('style'));
903					}
904				}
905			});
906		});
907
908	}
909	tabResponsive();
910
911	$(window).on('wwResize', function(){
912		tabHoverIntent();
913		tabSwitcher($body);
914	});
915
916	var setCTA;
917	$(window).on( 'resize', function(){
918		clearRequestTimeout(setCTA);
919		setCTA = requestTimeout( tabResponsive, 100 );
920	});
921
922	$('.nav-tabs').each(function(){
923		var $nav = $(this),
924			$lis = $('> li:not(.active)', $nav),
925			$links = $('.tab-excerpt-link', $nav);
926		$('.tab-excerpt', $lis).slideUp(400, function(){
927			$(this).addClass('init');
928		});
929
930		$links.each(function(){
931			var $link = $(this),
932				$par_a = $link.closest('a'),
933				href = $link.attr('data-href'),
934				target = $link.attr('data-target');
935			$par_a.addClass('inner-link');
936			$link.on('click', function(){
937				var _link = document.createElement('a');
938				_link.href = href;
939				_link.target = typeof target === 'undefined' || target === '' ? '_self' : target;
940				_link.click();
941			});
942		});
943		$nav.addClass('tab-init');
944	});
945
946	$('.uncode-tabs.tabs-no-lazy').each(function(){
947		var $tabs = $(this),
948			$panes = $('.tab-pane:not(.active)', $tabs);
949		$panes.each(function(){
950			var $pane = $(this),
951				$imgs = $('img[loading="lazy"]', $pane);
952			$imgs.removeAttr('loading');
953			$imgs.removeAttr('decoding');
954		});
955	});
956
957};
958UNCODE.collapse = function() {
959	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
960		var $this = $(this),
961			href
962		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
963		var $target = $(target)
964		var parent = $this.attr('data-parent')
965		var $parent = parent && $(parent)
966		var $title = $(this).parent()
967		var $accordion = $(e.target).closest('.uncode-accordion')
968		var $group = $this.closest('.group')
969		var $panel_group = $this.closest('.panel-group')
970		if ($parent) {
971			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
972			if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) {
973				$title.removeClass('active');
974				$group.removeClass('active-group');
975			} else {
976				if ( $panel_group.attr('data-no-toggle') != true ) {
977					$parent.find('.panel-title').removeClass('active')
978					$parent.find('.group').removeClass('active-group')
979				}
980				$title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active')
981				$group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group')
982			}
983		}
984		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
985		requestTimeout(function() {
986			var $accordion = $(e.target).closest('.uncode-accordion');
987			if ( $accordion.hasClass('tabs-trigger-box-resized') ) {
988			  window.dispatchEvent(new CustomEvent('boxResized'));
989			} else if ( $accordion.hasClass('tabs-trigger-window-resize') ) {
990				window.dispatchEvent(new Event('resize'));
991				$(window).trigger('uncode.re-layout');
992			} 
993
994			var $active_panel = $('.panel.active-group', $parent);
995
996			$.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) {
997				var element = $(val),
998					delayAttr = element.attr('data-delay');
999				if (delayAttr == undefined) delayAttr = 0;
1000				requestTimeout(function() {
1001					element.addClass('start_animation');
1002				}, delayAttr);
1003			});
1004
1005		}, 500);
1006	});
1007
1008	$('.uncode-accordion.tabs-no-lazy').each(function(){
1009		var $accordion = $(this),
1010			$panes = $('.panel:not(.active-group)', $accordion);
1011		$panes.each(function(){
1012			var $pane = $(this),
1013				$imgs = $('img[loading="lazy"]', $pane);
1014			$imgs.removeAttr('loading');
1015			$imgs.removeAttr('decoding');
1016		});
1017	});
1018};
1019
1020UNCODE.bigText = function(el) {
1021	if (el == undefined) {
1022		el = $('body');
1023	}
1024	$.each($('.bigtext', el), function(index, val) {
1025		$(val).bigtext({
1026			minfontsize: 24
1027		});
1028		if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
1029			opacity: 1
1030		});
1031		requestTimeout(function() {
1032			if ($(val).find('.animate_when_almost_visible').length != 0) {
1033				$(val).css({opacity: 1});
1034			}
1035		}, 400);
1036	});
1037};
1038
1039UNCODE.process_shortpixel_image = function(image) {
1040	var data = {
1041		action: 'shortpixel_manual_optimization',
1042		image_id: image,
1043		cleanup: true
1044	};
1045
1046	$.get(SiteParameters.ajax_url, data);
1047};
1048
1049UNCODE.menuSystem = function() {
1050
1051	function menuMobile() {
1052		var $body = $('body'),
1053			scrolltop,
1054			$mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'),
1055			$masthead = $('#masthead'),
1056			$box,
1057			$el,
1058			$el_transp,
1059			elHeight,
1060			offCanvasAnim,
1061			check,
1062			animating = false,
1063			stickyMobile = false,
1064			menuClose = new CustomEvent('menuMobileClose'),
1065			menuOpen = new CustomEvent('menuMobileOpen');
1066		UNCODE.menuOpened = false;
1067		$mobileToggleButton.on('click', function(event) {
1068			event.stopPropagation();
1069			var btn = this;
1070			if ($(btn).hasClass('overlay-close')) return;
1071			event.preventDefault();
1072			$('.overlay-search.open .menu-close-dd', $masthead).trigger('click');
1073			if (UNCODE.wwidth <= UNCODE.mediaQuery) {
1074				$box = $(this).closest('.box-container').find('.main-menu-container');
1075				$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
1076				$el_transp = $('.menu-absolute.menu-transparent');
1077				if (UNCODE.isMobile) {
1078					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 ) {
1079						stickyMobile = true;
1080						elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
1081					} else {
1082						elHeight = 0;
1083						$.each($box.find('> div'), function(index, val) {
1084							elHeight += $(val).outerHeight();
1085						});
1086					}
1087				} else {
1088					elHeight = 0;
1089					$.each($el, function(index, val) {
1090						elHeight += $(val).outerHeight();
1091					});
1092				}
1093				var open = function() {
1094					clearTimeout(offCanvasAnim);
1095					if (!animating) {
1096						$body.addClass('open-overlay-menu').addClass('opening-overlay-menu');
1097						scrolltop = $(window).scrollTop();
1098						window.dispatchEvent(menuOpen);
1099						animating = true;
1100						UNCODE.menuOpened = true;
1101						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) {			
1102							if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) {
1103								$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1104							}
1105							if ($('body.menu-offcanvas').length) {
1106								$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1107								$('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1108							} else {
1109								if ( $('.menu-hide, .menu-sticky').length ) {
1110									if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length  ) {
1111										$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'});
1112									}
1113								}
1114							}
1115						}
1116						if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) {
1117							//$("#masthead")[0].scrollIntoView();
1118							$('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
1119						}
1120						$box.addClass('open-items');
1121						if ($el_transp.length && $('body.menu-mobile-transparent').length) {
1122							$el_transp.addClass('is_mobile_open');
1123						}
1124						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1125							btn.classList.add('close');
1126							$box.animate({
1127								height: elHeight
1128							}, 600, "easeInOutCirc", function() {
1129								animating = false;
1130								if (!stickyMobile) $box.css('height', 'auto');
1131							});
1132						} else {
1133							animating = false;
1134						}
1135					}
1136				};
1137
1138				var close = function() {
1139					clearTimeout(offCanvasAnim);
1140					if (!animating) {
1141						window.dispatchEvent(menuClose);
1142						animating = true;
1143						UNCODE.menuOpened = false;
1144						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1145							btn.classList.remove('close');
1146							btn.classList.add('closing');
1147						}
1148						$box.addClass('close');
1149						requestTimeout(function() {
1150							$box.removeClass('close');
1151							$box.removeClass('open-items');
1152							btn.classList.remove('closing');
1153							if ($el_transp.length) {
1154								$el_transp.removeClass('is_mobile_open');
1155							}
1156						}, 500);
1157						$body.removeClass('opening-overlay-menu');
1158						if ( ! $('body').hasClass('menu-mobile-off-canvas') ) {
1159							$box.animate({
1160								height: 0
1161							}, {
1162								duration: 600,
1163								easing: "easeInOutCirc",
1164								complete: function(elements) {
1165									$(elements).css('height', '');
1166									animating = false;
1167									if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) {
1168										$('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative');
1169									}
1170									$body.removeClass('open-overlay-menu');
1171								}
1172							});
1173						} else {
1174							animating = false;
1175							offCanvasAnim = setTimeout(function(){
1176								$body.removeClass('open-overlay-menu');
1177							}, 1000);
1178						}
1179					}
1180				};
1181				check = (!UNCODE.menuOpened) ? open() : close();
1182			}
1183		});
1184
1185		$('html').on('click', function(event){
1186			if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) {
1187				$('.uncode-close-offcanvas-mobile').trigger('click');
1188			}
1189		});
1190
1191		window.addEventListener('menuMobileTrigged', function(e) {
1192			$('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click');
1193		});
1194		window.addEventListener('orientationchange', function(e) {
1195			$('#logo-container-mobile .mobile-menu-button.close').trigger('click');
1196		});
1197		window.addEventListener("resize", function() {
1198			if ($(window).width() < UNCODE.mediaQuery) {
1199				if (UNCODE.isMobile) {
1200					var $box = $('.box-container .main-menu-container'),
1201						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
1202					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) {
1203						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
1204							elHeight = 0;
1205							$.each($el, function(index, val) {
1206								elHeight += $(val).outerHeight();
1207							});
1208							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;
1209							$($box).css('height', elHeight + 'px');
1210						}
1211					}
1212				}
1213			} else {
1214				$('.menu-hide-vertical').removeAttr('style');
1215				$('.menu-container-mobile').removeAttr('style');
1216				$('.vmenu-container.menu-container').removeAttr('style');
1217			}
1218		});
1219
1220		$(window).on('scroll', function(){
1221			if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) {
1222				$(window).scrollTop(scrolltop);
1223				return false;
1224			}
1225		});
1226	
1227	};
1228
1229	function menuOffCanvas() {
1230		var menuClose = new CustomEvent('menuCanvasClose'),
1231			menuOpen = new CustomEvent('menuCanvasOpen');
1232		$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) {
1233			if ($(window).width() > UNCODE.mediaQuery) {
1234				if ( $('body.vmenu-offcanvas-overlay').length ) {
1235					if ($(event.currentTarget).hasClass('off-close')) {
1236						$(event.currentTarget).removeClass('off-close');
1237						requestTimeout(function() {
1238							window.dispatchEvent(menuClose);
1239						}, 500);
1240
1241					} else {
1242						$(event.currentTarget).addClass('off-close');
1243						window.dispatchEvent(menuOpen);
1244					}
1245				} else {
1246					if ($(event.currentTarget).hasClass('close')) {
1247						$(event.currentTarget).removeClass('close');
1248						$(event.currentTarget).addClass('closing');
1249						requestTimeout(function() {
1250							$(event.currentTarget).removeClass('closing');
1251							window.dispatchEvent(menuClose);
1252						}, 500);
1253
1254					} else {
1255						$(event.currentTarget).addClass('close');
1256						window.dispatchEvent(menuOpen);
1257					}
1258				}
1259			}
1260
1261			$('body').toggleClass('off-opened');
1262		});
1263
1264		$('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){
1265			if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) {
1266				var $vMenuCont = $('#masthead .vmenu-container'),
1267					$close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont),
1268
1269					vmenu_h = parseFloat( $vMenuCont.outerHeight() ),
1270					vmenu_w = parseFloat( $vMenuCont.outerWidth() ),
1271					vmenu_off = $vMenuCont.offset(),
1272					vmenu_l = parseFloat(vmenu_off.left),
1273					vmenu_t = parseFloat(vmenu_off.top),
1274					vmenu_r = vmenu_l + vmenu_w,
1275					vmenu_b = vmenu_t + vmenu_h,
1276
1277					close_h = parseFloat( $close_menu.outerHeight() ),
1278					close_w = parseFloat( $close_menu.outerWidth() ),
1279					close_off = $close_menu.offset(),
1280					close_l = parseFloat(close_off.left),
1281					close_t = parseFloat(close_off.top),
1282					close_r = close_l + close_w,
1283					close_b = close_t + close_h;
1284				if (
1285					!(
1286						e.clientX > vmenu_l &&
1287						e.clientX < vmenu_r &&
1288						e.clientY > vmenu_t &&
1289						e.clientY < vmenu_b
1290					)
1291					||
1292					(
1293						e.clientX > close_l &&
1294						e.clientX < close_r &&
1295						e.clientY > close_t &&
1296						e.clientY < close_b
1297					)
1298				) {
1299					$('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click');
1300				}
1301			}
1302		});
1303	};
1304
1305	function menuOverlay() {
1306		if ( $('.overlay').length ) {
1307			$('.overlay').removeClass('hidden');
1308		}
1309		if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) {
1310			$('.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) {
1311				var transDelay = (index / 20) + 0.1;
1312				if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery )
1313					transDelay = transDelay + 0.3;
1314				$(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');
1315			});
1316		}
1317		
1318	};
1319	var $secondary_parent;
1320	function menuAppend() {
1321		var $body = $('body'),
1322			$menuCont = $('.menu-container:not(.vmenu-container)'),
1323			$vMenuCont = $('.menu-container.vmenu-container'),
1324			$cta = $('.navbar-cta'),
1325			$socials = $('.navbar-social:not(.appended-navbar)'),
1326			$ul = $('.navbar-main ul.menu-primary-inner'),
1327			$ulCta,
1328			$ulSocials,
1329			$navLast,
1330			$firstMenu = $('.main-menu-container:first-child', $menuCont),
1331			$secondMenu = $('.main-menu-container:last-child', $menuCont),
1332			$firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu),
1333			$secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu),
1334			$ulFirst = $('> ul', $firstNav),
1335			$ulSecond = $('> ul', $secondNav),
1336			setCTA,
1337			appendCTA = function(){
1338				return true;
1339			},
1340			appendSocials = function(){
1341				return true;
1342			},
1343			appendSplit = function(){
1344				return true;
1345			};
1346
1347		if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) {
1348			$ulCta = $('> ul', $cta);
1349			$ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden');
1350
1351			appendCTA = function(){
1352				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1353					
1354					$ul.after($ulCta);
1355				} else {
1356					$cta.append($ulCta);
1357				}
1358			}
1359		}
1360
1361		if ( ! $body.hasClass('cta-not-appended') ) {
1362			appendCTA();
1363		}
1364
1365		var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social');
1366		$smartSocial.each(function(){
1367			var $_smartSocial = $(this);
1368			$('> li', $_smartSocial).each(function(){
1369				var $li = $(this);
1370				if ( $li.hasClass('mobile-hidden') ) {
1371					$_smartSocial.addClass('mobile-hidden');
1372				} else {
1373					$_smartSocial.removeClass('mobile-hidden');
1374					return false;
1375				}
1376			});
1377
1378			$('> li', $_smartSocial).each(function(){
1379				var $li = $(this);
1380				if ( $li.hasClass('tablet-hidden') ) {
1381					$_smartSocial.addClass('tablet-hidden');
1382				} else {
1383					$_smartSocial.removeClass('tablet-hidden');
1384					return false;
1385				}
1386			});
1387		});
1388
1389		if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) {
1390			$ulSocials = $('> ul', $socials).addClass('menu-smart-social');
1391			if ( $body.hasClass('hmenu-center-split') ) {
1392				$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1393			} else {
1394				$navLast = $('.navbar-nav-last', $vMenuCont);
1395			}
1396
1397			if ( ! $navLast.length ) {
1398				var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />');
1399				if ( $body.hasClass('hmenu-center-split') ) {
1400					$('.menu-horizontal-inner', $menuCont).append(_navLast);
1401					$navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont);
1402				} else {
1403					$('.menu-sidebar-inner', $vMenuCont).last().append(_navLast);
1404					$navLast = $('.navbar-nav-last', $vMenuCont);
1405				}
1406			}
1407
1408			appendSocials = function(){
1409				if ( !$body.hasClass('menu-overlay-center') ) {
1410				// 	if ( !$navLast.find('ul.menu-smart-social').length ) {
1411				// 		$ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont);
1412				// 		$navLast.append('<ul class="menu-smart menu-smart-social" />');
1413				// 		$ulSocials.each(function(){
1414				// 			var $li_social = $(this);
1415				// 			$navLast.find('ul.menu-smart-social').append($li_social);
1416				// 		});
1417				// 	}
1418				// } else {
1419					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1420						$socials.addClass('mobile-hidden').addClass('tablet-hidden')
1421						if ( ! $('> ul.menu-smart-social li', $socials).length ) {
1422							$('> ul.menu-smart-social li', $socials).remove();
1423						}
1424						$navLast.append($ulSocials);
1425					} else {
1426						if ( ! $('> ul.menu-smart-social li', $navLast).length ) {
1427							$('> ul.menu-smart-social li', $navLast).remove();
1428						}
1429						$socials.append($ulSocials);
1430					}
1431				}
1432			}
1433			appendSocials();
1434		}
1435
1436		if ( $vMenuCont.length ) {
1437			var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont);
1438		} else {
1439			var $accordion_secondary = $('.menu-accordion-secondary', $menuCont);
1440		}
1441		if ( $accordion_secondary.length ) {
1442			var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph');
1443			if (UNCODE.wwidth < UNCODE.mediaQuery) {
1444				if ( !$accordion_secondary_ph.length ) {
1445					$accordion_secondary.after('<span class="accordion-secondary-ph" />');
1446				}
1447				if ( $vMenuCont.length ) {
1448					$('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary);
1449				} else {
1450					if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1451						$('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary);
1452					} else {
1453						$('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary);
1454					}
1455				}
1456			} else {
1457				if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) {
1458					$accordion_secondary_ph.before($accordion_secondary);
1459				}
1460			}
1461		}
1462
1463		if ( $vMenuCont.length ) {
1464			var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont);
1465		} else {
1466			var $extra_icons = $('.navbar-extra-icons', $menuCont);
1467		}
1468
1469		if ( $extra_icons.length ) {
1470			if ( $vMenuCont.length ) {
1471				if ( $('li:not(.social-icon)', $extra_icons).length ) {
1472					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1473						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1474							$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1475						$not_social.each(function(){
1476							if ( ! $primary_after.length ) {
1477								$('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />');
1478								$primary_after = $('.menu-accordion-primary-after', $vMenuCont);
1479								$primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />');
1480							}
1481							var $extra_li = $(this);
1482							$primary_after.find('> ul').append($extra_li);
1483						});
1484					} else {
1485						var $primary_after = $('.menu-accordion-primary-after', $vMenuCont),
1486							$not_social = $('> ul > li:not(.social-icon)', $primary_after);
1487						$not_social.each(function(){
1488							var $extra_li = $(this);
1489							$extra_icons.find('> ul').append($extra_li);
1490						});
1491					}
1492				} /*else {
1493					var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph');
1494					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1495						if ( !$extra_icons_ph.length ) {
1496							$extra_icons.after('<span class="extra-icons-ph" />');
1497						}
1498						if ( $('.navbar-accordion-cta', $vMenuCont).length ) {
1499							$('.navbar-accordion-cta', $vMenuCont).after($extra_icons);
1500						} else {
1501							$('.menu-accordion-primary', $vMenuCont).after($extra_icons);
1502						}
1503					} else {
1504						if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) {
1505							$extra_icons_ph.before($extra_icons);
1506						}
1507					}
1508				}*/
1509			} else {
1510				if ( ! $body.hasClass('hmenu-center-double') ) {
1511					if (UNCODE.wwidth < UNCODE.mediaQuery) {
1512						var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1513							$primary_after = $('.nav.navbar-main-after', $menuCont);
1514
1515						if ( ! $primary_after.length && $not_social.length ) {
1516							if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) {
1517								$('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />');
1518							} else {
1519								$('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />');
1520							}
1521							$primary_after = $('.nav.navbar-main-after', $menuCont);
1522							$primary_after.append('<ul class="menu-smart sm menu-smart-social" />');
1523						}
1524						var tablet_hidden = true,
1525							mobile_hidden = true;
1526						$not_social.each(function(){
1527							var $extra_li = $(this);
1528							$primary_after.find('> ul').append($extra_li);
1529							if ( ! $extra_li.hasClass('tablet-hidden') ) {
1530								tablet_hidden = false;
1531							}
1532							if ( ! $extra_li.hasClass('mobile-hidden') ) {
1533								mobile_hidden = false;
1534							}
1535						});
1536						if ( tablet_hidden === true && $not_social.length ) {
1537							$primary_after.addClass('tablet-hidden'); 
1538						}
1539						if ( mobile_hidden === true && $not_social.length ) {
1540							$primary_after.addClass('mobile-hidden'); 
1541						}
1542					} else {
1543						var $primary_after = $('.nav.navbar-main-after', $menuCont);
1544
1545						if ( $primary_after.length ) {
1546							var $not_social = $('> ul > li:not(.social-icon)', $primary_after);
1547							$not_social.each(function(){
1548								var $extra_li = $(this);
1549								$extra_icons.find('> ul').append($extra_li);
1550							});
1551							$primary_after.remove();
1552						}
1553					}
1554				}
1555			}
1556		}
1557
1558		if ( ( $body.hasClass('hmenu-center-double') ) ) {
1559			appendSplit = function(){
1560				if (UNCODE.wwidth < UNCODE.mediaQuery) {
1561					if ( $extra_icons.length ) {
1562						if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) {
1563							var $not_social = $('> ul > li:not(.social-icon)', $extra_icons),
1564								$append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />');
1565							$not_social.each(function(){
1566								var $extra_li = $(this);
1567								$append_ul.append($extra_li);
1568							});
1569							if ( $secondNav.length ) {
1570								$secondNav.append($append_ul);
1571							} else {
1572								$('.menu-horizontal-inner', $menuCont).prepend($append_ul);
1573							}
1574						}
1575					}
1576					if ( $secondNav.length ) {
1577						$secondNav.prepend($ulFirst);
1578					} else {
1579						$('.menu-horizontal-inner', $menuCont).prepend($ulFirst);
1580					}
1581					$firstMenu.hide();
1582				} else {
1583					$firstNav.append($ulFirst);
1584					var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0);
1585					if ( $append_ul.length ) {
1586						var $not_social = $('> li:not(.social-icon)', $append_ul);
1587						$not_social.each(function(){
1588							var $extra_li = $(this);
1589							$extra_icons.find('> ul').append($extra_li);
1590						});
1591					}
1592					$('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove();
1593					$('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove();
1594					$firstMenu.css({
1595						'display': 'table-cell'
1596					});
1597				}
1598			}
1599		}
1600		appendSplit();
1601
1602		$(window).on( 'resize', function(){
1603			clearRequestTimeout(setCTA);
1604			setCTA = requestTimeout( function() {
1605				appendCTA();
1606				appendSocials();
1607				appendSplit();
1608			}, 10 );
1609		});
1610	}
1611	//menuMobileButton();
1612	menuMobile();
1613	menuOffCanvas();
1614	menuAppend();
1615	menuOverlay();
1616
1617	var stickyDropdownSearch = function(){
1618		var $masthead = $('#masthead'),
1619			$ddSearch = $('.overlay.overlay-search', $masthead),
1620			$styles = $('#stickyDropdownSearch').remove();
1621		if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) {
1622			var $menuWrapper = $('.menu-wrapper'),
1623				$navbar = $('.menu-container-mobile', $menuWrapper),
1624				navbarH = $navbar.outerHeight(),
1625				//$topbar = $('.top-menu', $menuWrapper),
1626				//topbarH = $topbar.outerHeight(),
1627				_css;
1628
1629			_css = '<style type="text/css" id="stickyDropdownSearch">';
1630			_css += '@media (max-width: 959px) {';
1631			_css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {';
1632			_css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;';
1633			_css += '}';
1634			_css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {';
1635			_css += 'position: fixed;';
1636			_css += 'top: 0;';
1637			_css += '}';
1638			_css += '</style>';
1639
1640			$(_css).appendTo($('head'));
1641		}
1642	}
1643	stickyDropdownSearch();
1644
1645	var setMenuOverlay;
1646	$(window).on( 'resize', function(){
1647		if ( $('.overlay').length && $(window).width() > 1024 ) {
1648			$('.overlay').addClass('hidden');
1649		}
1650		clearRequestTimeout(setMenuOverlay);
1651		setMenuOverlay = requestTimeout( function(){
1652			menuOverlay();
1653			menuAppend();
1654			stickyDropdownSearch();
1655		}, 150 );
1656	});
1657	UNCODE.menuSmartInit();
1658};
1659
1660UNCODE.menuSmartInit = function() {
1661	var $menusmart = $('[class*="menu-smart"]'),
1662		$masthead = $('#masthead'),
1663		$hMenu = $('.menu-horizontal-inner', $masthead),
1664		$focus = $('.overlay-menu-focus'),
1665		showTimeout = 50,
1666		hideTimeout = 50,
1667		showTimeoutFunc, hideTimeoutFunc;
1668
1669	$('> li.menu-item-has-children', $menusmart).hover(function(){
1670		$(this).data('hover', true);
1671	}, function(){
1672		$(this).data('hover', false);
1673	});
1674
1675	$('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){
1676		e.preventDefault();
1677	});
1678
1679	if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) {
1680		var $notLis = $('> .nav > ul > li a', $hMenu),
1681			$menuA = $('a', $masthead).not($notLis),
1682			$hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'),
1683			showFuncCond = function() { return true };
1684
1685		if ( $('body').hasClass('focus-megamenu') ) {
1686			$hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner');
1687			showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') };
1688		} else if ( $('body').hasClass('focus-links') ) {
1689			$hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA);
1690		}
1691
1692		$hoverSelector.hover(function(){
1693			clearRequestTimeout(hideTimeoutFunc);
1694			showTimeoutFunc = requestTimeout(function(){
1695				$('body').addClass('navbar-hover');
1696			}, showTimeout*2);
1697		}, function(){
1698			hideTimeoutFunc = requestTimeout(function(){
1699				if ( ! $('.overlay-search.open', $masthead).length ) {
1700					$('body').removeClass('navbar-hover');
1701				}
1702			}, hideTimeout*2);
1703		});
1704	} else {
1705		showFuncCond = function() { return false };
1706	}
1707
1708	if ($menusmart.length > 0) {
1709		$menusmart.smartmenus({
1710			subIndicators: false,
1711			subIndicatorsPos: 'append',
1712			//subMenusMinWidth: '13em',
1713			subIndicatorsText: '',
1714			showTimeout: showTimeout,
1715			hideTimeout: hideTimeout,
1716			showFunction: function($ul, complete) {
1717				clearRequestTimeout(showTimeoutFunc);
1718				$ul.fadeIn(0, 'linear', function(){
1719					complete();
1720					if ( $ul.hasClass('vc_row') ) {
1721						$ul.css({
1722							'display': 'table'
1723						});
1724					}
1725					if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) {
1726						$('body').addClass('open-megamenu');
1727					}
1728					if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) {
1729						$('body').addClass('navbar-hover');
1730					}
1731				}).addClass('open-animated');
1732			},
1733			hideFunction: function($ul, complete) {
1734				if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) {
1735					$('body').removeClass('open-megamenu');
1736				}
1737				var fixIE = $('html.ie').length;
1738				if (fixIE) {
1739					var $rowParent = $($ul).closest('.main-menu-container');
1740					$rowParent.height('auto');
1741				}
1742				$ul.fadeOut(0, 'linear', function(){
1743					complete();
1744					$ul.removeClass('open-animated');
1745					if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) {
1746						$('body').removeClass('open-submenu');
1747					}
1748				});
1749			},
1750			collapsibleShowFunction: function($ul, complete) {
1751				$ul.slideDown(400, 'easeInOutCirc', complete);
1752			},
1753			collapsibleHideFunction: function($ul, complete) {
1754				$ul.slideUp(200, 'easeInOutCirc', complete);
1755			},
1756			hideOnClick: true
1757		});
1758
1759		if ( $('body').hasClass('menu-accordion-active') ) {
1760			requestTimeout(function(){
1761				$menusmart.addClass('menu-smart-init');
1762				$menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) );
1763			}, 1000);
1764		}
1765
1766		$(document).on( 'uncode.smartmenu-appended', function(){
1767			requestTimeout(function(){
1768				$menusmart.smartmenus( 'refresh' );
1769			}, 1000);
1770		});
1771	}
1772
1773	$('.main-menu-container').each(function(){
1774		var $main_cont = $(this),
1775			$uls = $('ul', $main_cont);
1776
1777		$uls.each(function(){
1778			var $ul = $(this),
1779				mobile_hidden = true,
1780				tablet_hidden = true;
1781			$('> li:not(.hidden)', $ul).each(function(){
1782				if ( !$(this).hasClass('mobile-hidden') ) {
1783					mobile_hidden = false;
1784					return false;
1785				}
1786			});
1787			$('> li:not(.hidden)', $ul).each(function(){
1788				if ( !$(this).hasClass('tablet-hidden') ) {
1789					tablet_hidden = false;
1790					return false;
1791				}
1792			});
1793			if ( mobile_hidden ) {
1794				$ul.addClass('mobile-hidden');
1795			}
1796			if ( tablet_hidden ) {
1797				$ul.addClass('tablet-hidden');
1798			}
1799		});
1800		
1801		var $divUlsMB = $('div:has(>ul.mobile-hidden)');
1802
1803		$divUlsMB.each(function(){
1804			var $divUlMB = $(this),
1805				div_mobile_hidden = true,
1806				div_tablet_hidden = true;
1807
1808			$('> ul:not(.hidden)', $divUlMB).each(function(){
1809				if ( !$(this).hasClass('mobile-hidden') ) {
1810					div_mobile_hidden = false;
1811					return false;
1812				}
1813			});
1814			$('> ul:not(.hidden)', $divUlMB).each(function(){
1815				if ( !$(this).hasClass('tablet-hidden') ) {
1816					div_tablet_hidden = false;
1817					return false;
1818				}
1819			});
1820			if ( div_mobile_hidden ) {
1821				$divUlMB.addClass('mobile-hidden');
1822			}
1823			if ( div_tablet_hidden ) {
1824				$divUlMB.addClass('tablet-hidden');
1825			}
1826		});
1827	});
1828
1829	var overlaySearchButton = function(){
1830		var $search_wrap = $('.overlay.overlay-search, .widget_search');
1831
1832		$search_wrap.each(function(){
1833			var $form = $('form', this),
1834				$icon = $('i', $form);
1835				
1836			$icon.on('click', function(){
1837				$form.submit();
1838			});
1839		});
1840	};
1841	overlaySearchButton();
1842}
1843
1844UNCODE.okvideo = function() {
1845	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
1846	$.okvideo = function(options) {
1847		// if the option var was just a string, turn it into an object
1848		if (typeof options !== 'object') options = {
1849			'video': options
1850		};
1851		var base = this;
1852		// kick things off
1853		base.init = function() {
1854			base.options = $.extend({}, $.okvideo.options, options);
1855			// support older versions of okvideo
1856			if (base.options.video === null) base.options.video = base.options.source;
1857			base.setOptions();
1858			var target = base.options.target || $('body');
1859			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
1860			var zIndex = base.options.controls === 3 ? -999 : "auto";
1861			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
1862				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>';
1863				if (OKEvents.utils.isMobile()) {
1864					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>');
1865				} else {
1866					if (base.options.controls === 3) {
1867						target.append(mask)
1868					}
1869					if (base.options.adproof === 1) {
1870						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>');
1871					} else {
1872						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>');
1873					}
1874				}
1875				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
1876				if (base.options.playlist.list === null) {
1877					if (base.options.video.provider === 'youtube') {
1878						base.loadYouTubeAPI();
1879					} else if (base.options.video.provider === 'vimeo') {
1880						base.options.volume /= 100;
1881						base.loadVimeoAPI();
1882					}
1883				} else {
1884					base.loadYouTubeAPI();
1885				}
1886			}
1887		};
1888		// clean the options
1889		base.setOptions = function() {
1890			// exchange 'true' for '1' and 'false' for 3
1891			for (var key in this.options) {
1892				if (this.options[key] === true) this.options[key] = 1;
1893				if (this.options[key] === false) this.options[key] = 3;
1894			}
1895			if (base.options.playlist.list === null) {
1896				base.options.video = base.determineProvider();
1897			}
1898			// pass options to the window
1899			$(window).data('okoptions-' + base.options.id, base.options);
1900		};
1901		// insert js into the head and exectue a callback function
1902		base.insertJS = function(src, callback){
1903			var tag;
1904			if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) {
1905				tag = UNCODE.insertedSripts[src];
1906				if (callback){
1907					if (tag.readyState){  //IE
1908						tag.onreadystatechange = function(){
1909							if (tag.readyState === "loaded" ||
1910								tag.readyState === "complete"){
1911								tag.onreadystatechange = null;
1912								callback();
1913							}
1914						};
1915					} else {
1916						$(tag).on('load', callback);
1917					}
1918				}
1919				return;
1920			}
1921			tag = document.createElement('script');
1922			if (callback){
1923				if (tag.readyState){  //IE
1924					tag.onreadystatechange = function(){
1925						if (tag.readyState === "loaded" || tag.readyState === "complete"){
1926							tag.onreadystatechange = null;
1927							callback();
1928						}
1929					};
1930				} else {
1931					tag.onload = function() {
1932						callback();
1933					};
1934				}
1935			}
1936			tag.src = src;
1937			var firstScriptTag = document.getElementsByTagName('script')[0];
1938			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
1939			if ( ! UNCODE.insertedSripts ) {
1940				UNCODE.insertedSripts = [];
1941			}
1942			UNCODE.insertedSripts[src] = tag;
1943		};
1944		// load the youtube api
1945		base.loadYouTubeAPI = function(callback) {
1946			base.insertJS('https://www.youtube.com/player_api');
1947		};
1948		base.loadYouTubePlaylist = function() {
1949			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
1950		};
1951		// load the vimeo api by replacing the div with an iframe and loading js
1952		base.loadVimeoAPI = function() {
1953			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',
1954			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >');
1955			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
1956			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
1957			base.insertJS('//player.vimeo.com/api/player.js', function() {
1958				vimeoPlayerReady(base.options.id);
1959			});
1960		};
1961		// is it from youtube or vimeo?
1962		base.determineProvider = function() {
1963			var a = document.createElement('a');
1964			a.href = base.options.video;
1965			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
1966				var videoid = a.href.split('/')[3].toString();
1967				var query = videoid.substring(videoid.indexOf('?') + 1);
1968				if (query != '') {
1969					var vars = query.split('&');
1970					for (var i = 0; i < vars.length; i++) {
1971						var pair = vars[i].split('=');
1972						if (pair[0] == 'v') {
1973							videoid = pair[1];
1974						}
1975					}
1976				}
1977				return {
1978					"provider": "youtube",
1979					"id": videoid
1980				};
1981			} else if (/vimeo.com/.test(base.options.video)) {
1982				return {
1983					"provider": "vimeo",
1984					"id": (a.href.split('/')[3].toString()).split('#')[0],
1985				};
1986			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
1987				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
1988				if (id.length == 11) {
1989					return {
1990						"provider": "youtube",
1991						"id": id.toString()
1992					};
1993				} else {
1994					for (var i = 0; i < base.options.video.length; i++) {
1995						if (typeof parseInt(base.options.video[i]) !== "number") {
1996							throw 'not vimeo but thought it was for a sec';
1997						}
1998					}
1999					return {
2000						"provider": "vimeo",
2001						"id": base.options.video
2002					};
2003				}
2004			} else {
2005				throw "OKVideo: Invalid video source";
2006			}
2007		};
2008		base.init();
2009	};
2010
2011	var checkResize,
2012		newW = UNCODE.wwidth;
2013
2014	$.okvideo.options = {
2015		id: null,
2016		source: null, // Deprecate dis l8r
2017		video: null,
2018		playlist: { // eat ur heart out @brokyo
2019			list: null,
2020			index: 0,
2021			startSeconds: 0,
2022			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
2023		},
2024		disableKeyControl: 1,
2025		captions: 0,
2026		loop: 1,
2027		hd: 1,
2028		volume: 0,
2029		adproof: false,
2030		unstarted: null,
2031		onFinished: null,
2032		onReady: null,
2033		onPlay: null,
2034		onPause: null,
2035		buffering: null,
2036		controls: false,
2037		autoplay: true,
2038		annotations: true,
2039		cued: null
2040	};
2041	$.fn.okvideo = function(options) {
2042		options.target = this;
2043		return this.each(function() {
2044			(new $.okvideo(options));
2045		});
2046	};
2047
2048	var checkForVideos = function(){
2049		$(".uncode-video-container.video").each(function(index, el) {
2050			var $this = $(this),
2051				mobile_ready = $this.hasClass('no-control-mobile-autoplay'),
2052				url = $this.attr('data-video'),
2053				id = $this.attr('data-id'),
2054				cloned = $this.closest('.owl-item');
2055
2056			if ( mobile_ready || newW >= UNCODE.mediaQuery ) {
2057				if (!cloned.hasClass('cloned') || cloned.length == 0) {
2058					$this.okvideo({
2059						id: id,
2060						source: url.split('#')[0],
2061						time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
2062						autoplay: 1,
2063						controls: 0,
2064						volume: 0,
2065						adproof: 0,
2066						caller: $this,
2067						hd: 1,
2068						onReady: function(player) {
2069							var getPlayer = player.c || player.h || player,
2070							$iframe,
2071							getContainer = $(getPlayer).closest('.background-element');
2072							if (getContainer.length) {
2073								UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)');
2074							}
2075
2076							if ( $this.hasClass('drop-move') ) {
2077
2078								var $iframe = $(getPlayer),
2079									w = parseFloat($iframe.attr('width')),
2080									h = parseFloat($iframe.attr('height')),
2081									ratio = h / w,
2082									setResizeiFto,
2083								resizeiFrame = function(){
2084									var dataW = $this.attr('data-w'),
2085										newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2086										newH = newW * ratio;
2087									$iframe.css({
2088										width: newW,
2089										height: newH
2090									});
2091								};
2092								resizeiFrame();
2093								$(window).on( 'load', resizeiFrame );
2094								$(window).on( 'resize', function(){
2095									clearRequestTimeout(setResizeiFto);
2096									setResizeiFto = requestTimeout( function() {
2097										resizeiFrame();
2098									}, 10 );
2099								});
2100
2101							}
2102
2103						}
2104					});
2105				}
2106			}
2107		});
2108	};
2109
2110	checkForVideos();
2111
2112	$(window).on('load', function(){
2113		$('.mejs-fullscreen-button button').on('click', function(){
2114			var $button = $(this),
2115				$stuck = $button.closest('.is_stucked');
2116
2117			if ( $stuck.length ) {
2118				$stuck = $(this).trigger("sticky_kit:detach");
2119				window.scrollTo(0, 0);
2120			}
2121		});
2122	});
2123
2124	var checkVideoResize = function(){
2125		clearRequestTimeout(checkResize);
2126		checkResize = requestTimeout(function(){
2127			if ( newW !== UNCODE.wwidth ) {
2128				newW = UNCODE.wwidth;
2129				checkForVideos();
2130			}
2131		}, 1000);
2132	};
2133
2134	$(window).off('resize', checkVideoResize)
2135	.on( 'resize', checkVideoResize);
2136
2137};
2138
2139UNCODE.backgroundSelfVideos = function( $ctx ) {
2140
2141	var backgroundSelfVideosInit = function( $ctx ) {
2142		if ( SiteParameters.block_mobile_videos === true ) {
2143			return false;
2144		}
2145		if (typeof MediaElement === "function") {
2146			if ( typeof $ctx === 'undefined' ) {
2147				$ctx = document;
2148			}
2149		
2150			$(".background-video-shortcode", $ctx).each(function(index, el) {
2151				if ( $(this).closest('mediaelementwrapper').length ) {
2152					return true;
2153				}
2154				var $video_el = $(this),
2155					$parent_carousel = $video_el.parents('.uncode-slider').eq(0),
2156					$parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'),
2157					video_id = $video_el.attr('id');
2158
2159				if ( SiteParameters.is_frontend_editor ) {
2160					video_id = video_id + '_' + index;
2161					$video_el.attr('id', video_id);
2162				}
2163
2164				var media = new MediaElement(video_id, {
2165					startVolume: 0,
2166					loop: true,
2167					success: function(mediaElement, domObject) {
2168						domObject.volume = 0;
2169						$(mediaElement).data('started', false);
2170						mediaElement.addEventListener('timeupdate', function(e) {
2171							if (!$(e.target).data('started')) {
2172								$(mediaElement).data('started', true);
2173							}
2174						});
2175						mediaElement.addEventListener('loadedmetadata', function(e) {
2176							$('body').removeClass('video-not-supported');
2177							mediaElement.play();
2178						});
2179						if (!UNCODE.isMobile) {
2180							requestTimeout(function() {
2181								UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)');
2182							}, 100);
2183						}
2184						if ( ($('html.firefox').length) && !$parent_carousel.length  ) {
2185							mediaElement.play();
2186						}
2187
2188						if ( $parent_drop_move.length ) {
2189							var setResizeMEto,
2190								resizeMediaElement = function(){
2191								var dataW = $parent_drop_move.attr('data-w'),
2192									videoW = domObject.width,
2193									videoH = domObject.height,
2194									newW = UNCODE.wwidth / 12 * parseFloat( dataW ),
2195									newH = newW / ( videoW / videoH );
2196
2197								$(domObject).css({
2198									'height': newH,
2199									'width': newW
2200								});
2201							};
2202							$(window).on( 'resize load', function(){
2203								clearRequestTimeout(setResizeMEto);
2204								setResizeMEto = requestTimeout( function() {
2205									resizeMediaElement();
2206								}, 10 );
2207							});
2208						}
2209
2210						mediaElement.addEventListener('play', function() {
2211							$(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2212							$(mediaElement).closest('#page-header').addClass('video-started');
2213							$(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2214						}, true);
2215
2216					},
2217					// fires when a problem is detected
2218					error: function() {}
2219				});
2220			});
2221		} else {
2222
2223			if ( typeof $ctx === 'undefined' ) {
2224				$ctx = document;
2225			}
2226		
2227			const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)");
2228			Array.from(videos).forEach(function(video_el) {
2229				video_el.play();
2230				if ( video_el.currentTime > 0 && video_el.readyState > 2 ) {
2231					video_el.muted = true;
2232					video_el.loop = true;
2233					$(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1');
2234					$(video_el).addClass('started').closest('#page-header').addClass('video-started');
2235					$(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1');
2236				} else {
2237					requestTimeout(function(){
2238                         backgroundSelfVideosInit( $ctx );
2239					}, 1000);
2240				}
2241			});
2242		}
2243	};
2244
2245	backgroundSelfVideosInit( $ctx );
2246
2247	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
2248		window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
2249			var $el = model.view.$el,
2250				shortcode = model.attributes.shortcode;
2251
2252			if (typeof MediaElement === "function") {
2253				backgroundSelfVideosInit( $el );
2254			} else {
2255				backgroundSelfVideosInit( $el[0] );
2256			}
2257		});
2258	}
2259};
2260
2261UNCODE.is_scrolling = false;
2262
2263UNCODE.disableHoverScroll = function() {
2264
2265	if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor) {
2266		var body = document.body,
2267		timer;
2268
2269		window.addEventListener('scroll', function() {
2270			var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300;
2271			clearRequestTimeout(timer);
2272			if ( body.classList && !body.classList.contains('disable-hover') ) {
2273				body.classList.add('disable-hover');
2274				window.dispatchEvent(new CustomEvent('disable-hover'));
2275			}
2276			UNCODE.is_scrolling = true;
2277
2278			timer = requestTimeout(function() {
2279				if ( body.classList ) {
2280					body.classList.remove('disable-hover');
2281					window.dispatchEvent(new CustomEvent('enable-hover'));
2282				}
2283				UNCODE.is_scrolling = false;
2284			}, delay);
2285		}, false);
2286	}
2287};
2288
2289UNCODE.isotopeLayout = function() {
2290	if ($('.isotope-layout').length > 0) {
2291		var isotopeContainersArray = [],
2292			typeGridArray = [],
2293			layoutGridArray = [],
2294			screenLgArray = [],
2295			screenMdArray = [],
2296			screenSmArray = [],
2297			transitionDuration = [],
2298			$filterItems = [],
2299			$filters = $('.isotope-system .isotope-filters'),
2300			$itemSelector = '.tmb-iso',
2301			$items,
2302			itemMargin,
2303			correctionFactor = 0,
2304			firstLoad = true,
2305			isOriginLeft = $('body').hasClass('rtl') ? false : true;
2306		$('[class*="isotope-container"]').each(function(index) {
2307			var _this = $(this);
2308			var isoData = _this.data(),
2309			$data_lg,
2310			$data_md,
2311			$data_sm;
2312			_this.children('.tmb').addClass('tmb-iso');
2313			if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg');
2314			else $data_lg = '1000';
2315			if (isoData.md !== undefined) $data_md = _this.attr('data-md');
2316			else $data_md = '600';
2317			if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm');
2318			else $data_sm = '480';
2319			screenLgArray.push($data_lg);
2320			screenMdArray.push($data_md);
2321			screenSmArray.push($data_sm);
2322			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
2323			if (isoData.type == 'metro') typeGridArray.push(true);
2324			else typeGridArray.push(false);
2325			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
2326			else layoutGridArray.push('masonry');
2327			isotopeContainersArray.push(_this);
2328			_this.attr('data-iso-index', index);
2329		});
2330		var colWidth = function(index) {
2331				$(isotopeContainersArray[index]).width('');
2332				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
2333					widthAvailable = $(isotopeContainersArray[index]).width(),
2334					columnNum = 12,
2335					columnWidth = 0,
2336					data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'),
2337					consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'),
2338					winHeight = UNCODE.wheight - UNCODE.adminBarHeight,
2339					$rowContainer,
2340					paddingRow,
2341					$colContainer,
2342					paddingCol;
2343
2344				if ( consider_menu )
2345					winHeight = winHeight - UNCODE.menuHeight;
2346
2347				if ( data_vp_height === '1' ) {
2348					$rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0),
2349					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
2350					$colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0),
2351					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom'));
2352					winHeight = winHeight - ( paddingRow + paddingCol );
2353				}
2354
2355				if (isPx) {
2356					columnWidth = Math.ceil(widthAvailable / columnNum);
2357					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
2358				} else {
2359					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
2360				}
2361				$items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)');
2362				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
2363				for (var i = 0, len = $items.length; i < len; i++) {
2364					var $item = $($items[i]),
2365						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
2366						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/),
2367						multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1;
2368
2369
2370					if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) {
2371						multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns
2372					}
2373
2374					if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) {
2375						multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns
2376					}
2377
2378					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
2379						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2380							switch (parseInt(multiplier_w[1])) {
2381								case (5):
2382								case (4):
2383								case (3):
2384									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2385									multiplier_w[1] = 6;
2386									break;
2387								case (2):
2388								case (1):
2389									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
2390									multiplier_w[1] = 3;
2391									break;
2392								default:
2393									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2394									multiplier_w[1] = 12;
2395									break;
2396							}
2397
2398							if (multiplier_w[1] == 2.4) { // 5 columns
2399								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2400								multiplier_w[1] = 6;
2401							}
2402						}
2403					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
2404						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2405							switch (parseInt(multiplier_w[1])) {
2406								case (5):
2407								case (4):
2408								case (3):
2409								case (2):
2410								case (1):
2411									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2412									multiplier_w[1] = 6;
2413									break;
2414								default:
2415									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2416									multiplier_w[1] = 12;
2417									break;
2418							}
2419
2420							if (multiplier_w[1] == 2.4) { // 5 columns
2421								if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
2422								multiplier_w[1] = 6;
2423							}
2424						}
2425					} else if (widthAvailable < screenSmArray[index]) {
2426						if (multiplier_w != null && multiplier_w[1] !== undefined) {
2427							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
2428							multiplier_w[1] = 12;
2429							if (typeGridArray[index]) multiplier_h[1] = 12;
2430						}
2431					}
2432					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
2433						height;
2434
2435					if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) {
2436						height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth;
2437						if ( widthAvailable < screenSmArray[index] ) {
2438							height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin;
2439						}
2440					} else {
2441						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
2442					}
2443
2444					if (width >= widthAvailable) {
2445						$item.css({
2446							width: widthAvailable
2447						});
2448						if (typeGridArray[index]) {
2449							$item.children().add($item.find('.backimg')).css({
2450								height: height
2451							});
2452						}
2453					} else {
2454						$item.css({
2455							width: width
2456						});
2457						if (typeGridArray[index]) {
2458							$item.children().add($item.find('.backimg')).css({
2459								height: height
2460							});
2461						}
2462					}
2463				}
2464				if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns
2465					return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns)
2466				} else {
2467					return columnWidth;
2468				}
2469			},
2470			init_isotope = function() {
2471				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
2472					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
2473						isotopeId = isotopeSystem.attr('id'),
2474						$layoutMode = layoutGridArray[i],
2475						setIsotopeFirstRowTimeOut,
2476					setIsotopeFirstRow = function(items){
2477						var firstRow = true;
2478						$(items).each(function(index, val){
2479							var el = items[index].element,
2480								el_top = items[index].position.y,
2481								$el = $(el);
2482							if ( index > 0 && el_top > 0 && firstRow ) {
2483								firstRow = false;
2484							} else if ( index == 0 && el_top == 0 ) {
2485								firstRow = true;
2486							}
2487							if ( firstRow ) {
2488								$el.removeClass('tmb-isotope-further-row');
2489							} else {
2490								$el.addClass('tmb-isotope-further-row');
2491							}
2492						});
2493					};
2494					$(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({
2495						//resizable: true,
2496						itemSelector: $itemSelector,
2497						layoutMode: $layoutMode,
2498						transitionDuration: transitionDuration[i],
2499						masonry: {
2500							columnWidth: colWidth(i)
2501						},
2502						vertical: {
2503							horizontalAlignment: 0.5,
2504						},
2505						sortBy: 'original-order',
2506						isOriginLeft: isOriginLeft
2507					})
2508					.on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0))
2509					.on('layoutComplete', function( event, items ){
2510						if ( typeof items[0] !== 'undefined' ) {
2511							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2512								setIsotopeFirstRow(items);
2513							}
2514						}
2515					})
2516					.on('arrangeComplete', function( event, items ){
2517						if ( typeof items[0] !== 'undefined' ) {
2518							if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) {
2519								clearRequestTimeout(setIsotopeFirstRowTimeOut);
2520								setIsotopeFirstRowTimeOut = requestTimeout(function(){
2521									setIsotopeFirstRow(items);
2522								}, 100);
2523							}
2524						}
2525					});
2526					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
2527						$(isotopeContainersArray[i]).infinitescroll({
2528								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
2529								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
2530								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat', // selector for all items you'll retrieve
2531								animate: false,
2532								behavior: 'local',
2533								debug: false,
2534								loading: {
2535									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
2536									speed: 0,
2537									finished: undefined,
2538									msg: $('#' + isotopeId + ' .loadmore-button'),
2539								},
2540								errorCallback: function() {
2541									var isotope_system = $(this).closest('.isotope-system');
2542									$('.loading-button', isotope_system).hide();
2543									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
2544								}
2545							},
2546							// append the new items to isotope on the infinitescroll callback function.
2547							function(newElements, opts) {
2548								var $isotope = $(this),
2549									isotopeId = $isotope.closest('.isotope-system').attr('id'),
2550									filters = new Array(),
2551									$loading_button = $isotope.closest('.isotope-system').find('.loading-button'),
2552									$infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'),
2553									$numPages = $('a', $infinite_button).data('pages'),
2554									delay = 300;
2555								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
2556								$infinite_button.show();
2557								$loading_button.hide();
2558								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
2559								$('> li', $isotope).remove();
2560								$.each($(newElements), function(index, val) {
2561									$(val).addClass('tmb-iso');
2562									if ($(val).is("li")) {
2563										filters.push($(val)[0]);
2564									}
2565								});
2566								newElements = newElements.filter(function(x) {
2567									return filters.indexOf(x) < 0
2568								});
2569								$.each($(filters), function(index, val) {
2570									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
2571								});
2572								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
2573								if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2574									var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId];
2575									if (typeof getLightbox === 'object') {
2576										getLightbox.refresh();
2577									} else {
2578										UNCODE.lightbox();
2579									}
2580								}
2581								if ( typeof twttr !== 'undefined' )
2582									twttr.widgets.load(isotopeContainersArray[i]);
2583
2584								requestTimeout(function() {
2585									Waypoint.refreshAll();
2586									$isotope.trigger('more-items-loaded');
2587								}, 1000);
2588
2589							});
2590						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
2591							var $infinite_isotope = $(isotopeContainersArray[i]),
2592								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
2593							$infinite_isotope.infinitescroll('pause');
2594							$infinite_button.on('click', function(event) {
2595								event.preventDefault();
2596								var $infinite_system = $(event.target).closest('.isotope-system'),
2597								$infinite_isotope = $infinite_system.find('.isotope-container'),
2598								isotopeId = $infinite_system.attr('id');
2599								$(event.currentTarget).html(SiteParameters.loading);
2600								$infinite_isotope.infinitescroll('resume');
2601								$infinite_isotope.infinitescroll('retrieve');
2602								$infinite_isotope.infinitescroll('pause');
2603							});
2604						}
2605					}
2606				}
2607			},
2608			onLayout = function(isotopeObj, startIndex, needsReload) {
2609				var needsReload = needsReload ? true : false;
2610
2611				if (typeof UNCODE.bigText !== 'undefined') {
2612					UNCODE.bigText();
2613				}
2614				isotopeObj.css('opacity', 1);
2615				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
2616
2617				requestTimeout(function() {
2618					if (startIndex > 0) {
2619						reloadIsotope(isotopeObj);
2620						if (SiteParameters.dynamic_srcset_active === '1') {
2621							UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2622							UNCODE.adaptive_srcset(isotopeObj);
2623						}
2624						// window.dispatchEvent(UNCODE.boxEvent);
2625					} else if (needsReload) {
2626						reloadIsotope(isotopeObj);
2627					}
2628
2629					UNCODE.adaptive();
2630					if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) {
2631						UNCODE.refresh_dynamic_srcset_size(isotopeObj);
2632					}
2633					if (typeof MediaElement === "function") {
2634						$(isotopeObj).find('audio,video').each(function() {
2635							$(this).mediaelementplayer({
2636	 							pauseOtherPlayers: false,
2637							});
2638						});
2639					}
2640					if ($(isotopeObj).find('.nested-carousel').length) {
2641						if (typeof UNCODE.carousel !== 'undefined') {
2642							UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
2643						}
2644						requestTimeout(function() {
2645							boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2646						}, 200);
2647					} else {
2648						boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj);
2649					}
2650					isotopeObj.trigger('isotope-layout-complete');
2651
2652				}, 100);
2653
2654			},
2655			boxAnimation = function(items, startIndex, sequential, container) {
2656				var $allItems = items.length - startIndex,
2657					showed = 0,
2658					index = 0;
2659				if (container.closest('.owl-item').length == 1) return false;
2660				$.each(items, function(index, val) {
2661					var $this = $(val),
2662						elInner = $('> .t-inside', val);
2663					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
2664						return;
2665					}
2666					if (val[0]) val = val[0];
2667					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
2668						new Waypoint({
2669							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
2670							element: val,
2671							handler: function() {
2672								var element = $('> .t-inside', this.element),
2673									parent = $(this.element),
2674									currentIndex = parent.index();
2675								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
2676									delayAttr = parseInt(element.attr('data-delay'));
2677								if (isNaN(delayAttr)) delayAttr = 100;
2678								delay -= showed;
2679								var objTimeout = requestTimeout(function() {
2680									element.removeClass('zoom-reverse').addClass('start_animation');
2681									showed = parent.index();
2682									if ( container.data('isotope') ) {
2683										container.isotope('layout');
2684									}
2685								}, delay * delayAttr)
2686								parent.data('objTimeout', objTimeout);
2687								if (!UNCODE.isUnmodalOpen) {
2688									this.destroy();
2689								}
2690							},
2691							offset: '100%'
2692						})
2693					} else {
2694						if (elInner.hasClass('force-anim')) {
2695							elInner.addClass('start_animation');
2696						} else {
2697							elInner.css('opacity', 1);
2698						}
2699						container.isotope('layout');
2700					}
2701
2702					index++;
2703				});
2704			},
2705			reloadIsotope = function(isotopeObj) {
2706				var isoIndex = $(isotopeObj).attr('data-iso-index');
2707				var $layoutMode = ($(isotopeObj).data('layout'));
2708				if ($layoutMode === undefined) {
2709					$layoutMode = 'masonry';
2710				}
2711				if (isotopeObj.data('isotope')) {
2712					isotopeObj.isotope({
2713						itemSelector: $itemSelector,
2714						layoutMode: $layoutMode,
2715						transitionDuration: transitionDuration[isoIndex],
2716						masonry: {
2717							columnWidth: colWidth(isoIndex)
2718						},
2719						vertical: {
2720							horizontalAlignment: 0.5,
2721						},
2722						sortBy: 'original-order',
2723						isOriginLeft: isOriginLeft
2724					});
2725				}
2726			}
2727			;
2728		if ($('.isotope-pagination').length > 0) {
2729			$('.isotope-system').on('click', '.pagination a', function(evt) {
2730				evt.preventDefault();
2731
2732                var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
2733					container = $(this).closest('.isotope-system'),
2734                    calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
2735                calc_scroll -= UNCODE.get_scroll_offset();
2736
2737                var menu_container = $('.menu-sticky');
2738				var menu = menu_container.find('.menu-container');
2739
2740				if (menu_container.length > 0 && menu.length > 0) {
2741					calc_scroll = calc_scroll - menu.outerHeight();
2742				}
2743
2744				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2745					delta = bodyTop - calc_scroll,
2746					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
2747				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2748
2749				if ( !UNCODE.isFullPage ) {
2750					if (scrollSpeed == 0) {
2751						$('html, body').scrollTop(calc_scroll);
2752					} else {
2753						$('html, body').animate({
2754							scrollTop: calc_scroll
2755						},{
2756							easing: 'easeInOutQuad',
2757							duration: scrollSpeed,
2758							complete: function(){
2759								UNCODE.scrolling = false;
2760							}
2761						});
2762					}
2763				}
2764
2765				loadIsotope($(this), true);
2766				evt.preventDefault();
2767			});
2768		}
2769		$filters.on('click', 'a.isotope-nav-link', function(evt) {
2770			if ($(this).hasClass('no-isotope-filter')) {
2771				return;
2772			}
2773			var $filter = $(this),
2774				filterContainer = $filter.closest('.isotope-filters'),
2775				filterValue = $filter.attr('data-filter'),
2776				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
2777				transitionDuration = container.data().isotope.options.transitionDuration,
2778				delay = 300,
2779				filterItems = [];
2780
2781			var filter_items = function(){
2782				if (filterValue !== undefined) {
2783					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2784						var parent = $(val).parent(),
2785							objTimeout = parent.data('objTimeout');
2786						if (objTimeout) {
2787							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2788							clearRequestTimeout(objTimeout);
2789						}
2790						if (transitionDuration == 0) {
2791							if ($(val).hasClass('animate_when_almost_visible')) {
2792								$(val).addClass('zoom-reverse').removeClass('start_animation');
2793							} else {
2794								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2795							}
2796						}
2797					});
2798					requestTimeout(function(){
2799						if ( filterValue == '*' ) {
2800							container.removeClass('isotope-filtered');
2801						} else {
2802							container.addClass('isotope-filtered');
2803						}
2804						container.isotope({
2805							filter: function() {
2806								var block = $(this),
2807								filterable = (filterValue == '*') || block.hasClass(filterValue),
2808								lightboxElements = $('[data-lbox^=ilightbox]', block);
2809								if (filterable) {
2810									if (lightboxElements.length) {
2811										lightboxElements.removeClass('lb-disabled');
2812										container.data('lbox', $(lightboxElements[0]).data('lbox'));
2813									}
2814									filterItems.push(block);
2815								} else {
2816									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
2817								}
2818								container.trigger('more-items-loaded');
2819								return filterable;
2820							}
2821						});
2822						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
2823
2824					}, delay);
2825
2826					/** once filtered - start **/
2827					container.isotope('once', 'arrangeComplete', function() {
2828						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2829							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
2830							if (typeof getLightbox === 'object') {
2831								getLightbox.refresh();
2832							} else {
2833								UNCODE.lightbox();
2834							}
2835						}
2836						if (transitionDuration == 0) {
2837							requestTimeout(function() {
2838								boxAnimation(filterItems, 0, false, container);
2839							}, 100);
2840						}
2841						requestTimeout(function() {
2842							Waypoint.refreshAll();
2843						}, 2000);
2844					});
2845					/** once filtered - end **/
2846				} else {
2847					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2848						$.each(UNCODE.lightboxArray, function(index, val) {
2849							UNCODE.lightboxArray[index].destroy();
2850						});
2851					}
2852					$.each($('> .tmb-iso > .t-inside', container), function(index, val) {
2853						var parent = $(val).parent(),
2854							objTimeout = parent.data('objTimeout');
2855						if (objTimeout) {
2856							$(val).removeClass('zoom-reverse').removeClass('start_animation')
2857							clearRequestTimeout(objTimeout);
2858						}
2859						if (transitionDuration == 0) {
2860							if ($(val).hasClass('animate_when_almost_visible')) {
2861								$(val).addClass('zoom-reverse').removeClass('start_animation');
2862							} else {
2863								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
2864							}
2865						}
2866					});
2867					container.parent().addClass('grid-loading');
2868					loadIsotope($filter);
2869				}
2870			};
2871
2872			if (!$filter.hasClass('active')) {
2873				/** Scroll top with filtering */
2874				if (filterContainer.hasClass('filter-scroll')) {
2875                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
2876                    calc_scroll -= UNCODE.get_scroll_offset();
2877
2878					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2879						delta = bodyTop - calc_scroll,
2880						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
2881						filterTolerance = false,
2882						filter_timeout;
2883					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2884
2885					if ( !UNCODE.isFullPage ) {
2886						if (scrollSpeed == 0) {
2887							$('html, body').scrollTop(calc_scroll);
2888							UNCODE.scrolling = false;
2889							filter_items();
2890						} else {
2891
2892							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
2893								filter_items();
2894								filterTolerance = true;
2895							}
2896
2897							$('html, body').animate({
2898								scrollTop: calc_scroll
2899							},{
2900								easing: 'easeInOutQuad',
2901								duration: scrollSpeed,
2902								complete: function(){
2903									UNCODE.scrolling = false;
2904									if ( !filterTolerance ) {
2905										filter_timeout = setTimeout(function(){
2906											clearTimeout(filter_timeout);
2907											filter_items();
2908										}, 200);
2909									}
2910								}
2911							});
2912						}
2913					}
2914				} else {
2915					filter_items();
2916				}
2917			}
2918			evt.preventDefault();
2919		});
2920
2921		$(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) {
2922			var params = UNCODE.getURLParams(window.location);
2923			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
2924
2925			UNCODE.lastURL = window.location.href;
2926
2927			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
2928				return;
2929			}
2930
2931			if (params.id === undefined) {
2932				$.each($('.isotope-system'), function(index, val) {
2933					loadIsotope($(val));
2934				});
2935			} else {
2936				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
2937					loadIsotope($('#' + params.id));
2938				}
2939			}
2940		});
2941
2942		var loadIsotope = function($href, $paginating) {
2943			var is_paginating = false;
2944
2945			if (undefined !== $paginating && $paginating) {
2946				var is_paginating = $paginating;
2947			}
2948
2949			var href = ($href.is("a") ? $href.attr('href') : location),
2950				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
2951				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
2952				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
2953				isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')),
2954				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
2955				isotopeId = isotopeSystem.attr('id');
2956			if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) {
2957				UNCODE.lastURL = href;
2958				history.pushState({
2959					myIsotope: true
2960				}, document.title, href);
2961			}
2962			if (is_paginating) {
2963				isotopeWrapper.addClass('grid-filtering');
2964			}
2965			$.ajax({
2966				url: href
2967			}).done(function(data) {
2968				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
2969					$resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0],
2970					$resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0];
2971				isotopeWrapper.addClass('isotope-reloaded');
2972				requestTimeout(function() {
2973					isotopeWrapper.removeClass('grid-loading');
2974					isotopeWrapper.removeClass('isotope-reloaded');
2975					isotopeWrapper.removeClass('grid-filtering');
2976				}, 500);
2977				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
2978					var parent = $(val).parent(),
2979						objTimeout = parent.data('objTimeout');
2980					if (objTimeout) {
2981						$(val).removeClass('zoom-reverse').removeClass('start_animation')
2982						clearRequestTimeout(objTimeout);
2983					}
2984					if ($(val).hasClass('animate_when_almost_visible')) {
2985						$(val).addClass('zoom-reverse').removeClass('start_animation');
2986					} else {
2987						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
2988					}
2989				});
2990				requestTimeout(function() {
2991					if (isotopeContainer.data('isotope')) {
2992						isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso');
2993						isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true));
2994						UNCODE.adaptive();
2995						if (SiteParameters.dynamic_srcset_active === '1') {
2996							UNCODE.adaptive_srcset(isotopeContainer);
2997						}
2998						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
2999							var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
3000							if (typeof getLightbox === 'object') {
3001								getLightbox.refresh();
3002							} else {
3003								UNCODE.lightbox();
3004							}
3005						}
3006					}
3007					isotopeContainer.trigger('more-items-loaded');
3008				}, 300);
3009				$('.pagination', isotopeFooter).remove();
3010				isotopeFooter.append($resultPagination);
3011
3012				if (isotopeResultCount.length > 0) {
3013					$('.woocommerce-result-count', isotopeResultCount).remove();
3014					isotopeResultCount.append($resultCount);
3015				}
3016			});
3017		};
3018		$filters.each(function(i, buttonGroup) {
3019			var $buttonGroup = $(buttonGroup);
3020			$buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() {
3021				$buttonGroup.find('.active').removeClass('active');
3022				$(this).addClass('active');
3023
3024			});
3025
3026			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
3027				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
3028				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
3029			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
3030				e.preventDefault();
3031				$cats_filters.slideToggle(400, 'easeInOutCirc');
3032			});
3033
3034		});
3035		window.addEventListener('boxResized', function(e) {
3036			if (UNCODE.printDialogOpen !== false) {
3037				return false;
3038			}
3039			$.each($('.isotope-layout'), function(index, val) {
3040				var $layoutMode = ($(this).data('layout'));
3041				if ($layoutMode === undefined) $layoutMode = 'masonry';
3042				if ($(this).data('isotope')) {
3043					$(this).isotope({
3044						itemSelector: $itemSelector,
3045						layoutMode: $layoutMode,
3046						transitionDuration: transitionDuration[index],
3047						masonry: {
3048							columnWidth: colWidth(index)
3049						},
3050						vertical: {
3051							horizontalAlignment: 0.5,
3052						},
3053						sortBy: 'original-order',
3054						isOriginLeft: isOriginLeft
3055					});
3056					$(this).isotope('unbindResize');
3057					if (SiteParameters.dynamic_srcset_active === '1') {
3058						UNCODE.refresh_dynamic_srcset_size($(this));
3059					}
3060				}
3061				$(this).find('.mejs-video,.mejs-audio').each(function() {
3062					$(this).trigger('resize');
3063				});
3064			});
3065		}, false);
3066
3067		init_isotope();
3068	};
3069}
3070
3071UNCODE.lightbox = function() {
3072	if ( SiteParameters.lbox_enhanced ) {
3073		return true;
3074	}
3075	UNCODE.lightboxArray = {};
3076	requestTimeout(function() {
3077		var groupsArr = {};
3078		$('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() {
3079			var group = this.getAttribute("data-lbox"),
3080				values = $(this).data();
3081			$(this).attr('data-lbox-init','true')
3082			groupsArr[group] = values;
3083		});
3084		for (var i in groupsArr) {
3085			var skin = groupsArr[i].skin || 'black',
3086				path = groupsArr[i].dir || 'horizontal',
3087				thumbs = !groupsArr[i].notmb || false,
3088				arrows = !groupsArr[i].noarr || false,
3089				social = groupsArr[i].social || false,
3090				deeplink = groupsArr[i].deep || false,
3091				$els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'),
3092				counter = $els.length,
3093				dataAlbum = $els.attr('data-album');
3094			if (social) social = {
3095				facebook: true,
3096				twitter: true,
3097				reddit: true,
3098				digg: true
3099			};
3100			UNCODE.lightboxArray[i] = $els.iLightBox({
3101				selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)',
3102				skin: skin,
3103				path: path,
3104				linkId: deeplink,
3105				infinite: false,
3106				//fullViewPort: 'fit',
3107				smartRecognition: false,
3108				fullAlone: true,
3109				maxScale: 1,
3110				minScale: .02,
3111				//fullStretchTypes: 'flash, video',
3112				overlay: {
3113					opacity: .94
3114				},
3115				controls: {
3116					arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false),
3117					fullscreen: true,
3118					thumbnail: thumbs,
3119					slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false)
3120				},
3121				show: {
3122					speed: 200
3123				},
3124				hide: {
3125					speed: 200
3126				},
3127				social: {
3128					start: false,
3129					buttons: social
3130				},
3131				caption: {
3132					start: false
3133				},
3134				styles: {
3135					nextOpacity: 1,
3136					nextScale: 1,
3137					prevOpacity: 1,
3138					prevScale: 1
3139				},
3140				effects: {
3141					switchSpeed: 400
3142				},
3143				slideshow: {
3144					pauseTime: 5000
3145				},
3146				thumbnails: {
3147					maxWidth: 60,
3148					maxHeight: 60,
3149					activeOpacity: .2
3150				},
3151				html5video: {
3152					preload: true
3153				},
3154				callback: {
3155					onOpen: function(){
3156						$(window).trigger('uncode-custom-cursor');
3157						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3158							iNoBounce.enable();
3159						}
3160					},
3161					onHide: function(){
3162						if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) {
3163							iNoBounce.disable()
3164						}
3165					},
3166				}
3167			});
3168
3169			$(document).on('infinite-loaded', function(){
3170				UNCODE.lightboxArray[i].refresh();
3171			});
3172
3173			$(window).on('gdprOpen', function(){
3174				UNCODE.lightboxArray[i].close();
3175			});
3176		};
3177	}, 100);
3178
3179	$(document).on('click', '.lb-disabled', function(e){
3180		e.preventDefault();
3181	});
3182};
3183
3184UNCODE.lightgallery = function( $el ) {
3185	var createSelectors = function(){
3186		$('a[data-lbox]:not([data-lbox-init]):not([data-album])').each(function(){
3187			if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3188				$(this).addClass('lbox-trigger-item');
3189			} else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) {
3190				$(this).addClass('lbox-nested-item');
3191			} else {
3192				$(this).removeClass('lbox-trigger-item');
3193				$(this).removeClass('lbox-nested-item');
3194			}
3195		});
3196	};
3197
3198	createSelectors();
3199
3200	var galleries = [],
3201		nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3202			return !$(this).closest('.nested-carousel').length;
3203		}),
3204		$_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 *'),
3205		$galleries = $_galleries.filter(function( index ) {
3206			return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel');
3207		}),
3208		$nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item');
3209
3210	if ( typeof $el === 'undefined' ) {
3211		$el = $galleries.add( $nested );
3212	}
3213
3214	var $disabled = $('a.lb-disabled');
3215	$disabled.on('click', function(e){
3216		e.preventDefault();
3217	});
3218
3219	var beforeSlide = function(event) {
3220		var detail = event.detail,
3221			info = detail.info,
3222			item = detail.item,
3223			$slide = $(detail.currentSlide.selector),
3224			$video = $('video', $slide),
3225			$previous = $(detail.previousSlide.selector),
3226			$prevVideo = $('video', $previous),
3227			isAudio = false;
3228
3229		if ( typeof info.src !== 'undefined' ) {
3230			isAudio = info.src.search(/.mp3|.m4a/i) > -1;
3231		}
3232
3233		if ( ! $video.length && ( info.video || isAudio ) ) {
3234			if ( info.video ) {
3235				if ( typeof info.video === 'object' ) {
3236					var infoJson = info.video;
3237				} else {
3238					var infoJson = JSON.parse(info.video);
3239				}
3240				var src = infoJson.source[0].src,
3241					autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes',
3242					muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes',
3243					loop = $(item).attr('data-loop');
3244
3245			} else if ( isAudio ) {
3246				var src = info.src,
3247					autoplay = true,
3248					loop = false;
3249			}
3250			if ( typeof src !== 'undefined' ) {
3251				$slide.addClass('has-html5');
3252				var video = document.createElement('video');
3253				video.src = src;
3254				video.preload = 'auto';
3255				video.controls = 'controls';
3256				video.controlsList = 'nodownload';
3257				if ( autoplay ) {
3258					video.autoplay = 'autoplay';
3259				}
3260				if ( muted ) {
3261					video.muted = 'muted';
3262				}
3263				if ( loop ) {
3264					video.loop = 'loop';
3265				}
3266				$(video).appendTo($slide);
3267			}
3268		} else {
3269			var $video = $('video', $slide);
3270			if ( $video.length ) {
3271				$video[0].currentTime = 0;
3272				if ( $video[0].autoplay ) {
3273					$video[0].play();
3274				}
3275			}
3276		}
3277		if ( $prevVideo.length ) {
3278			$prevVideo[0].currentTime = 0;
3279			$prevVideo[0].pause();
3280		}
3281	};
3282
3283	var beforeOpen = function(event) {
3284		var detail = event.detail,
3285			items = detail.items,
3286			galleryItems = detail.galleryItems,
3287			outer = detail.outer.selector,
3288			i, ii;
3289		for ( i = 0; i < galleryItems.length; i++ ) {
3290			var item = galleryItems[i];
3291			if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) {
3292				$(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video');
3293			}
3294		}
3295		for ( ii = 0; ii < items.length; ii++ ) {
3296			var item = items[ii];
3297			if ( $(item).attr('data-icon') === 'video' ) {
3298				$(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video');
3299			}
3300		}
3301
3302	};
3303
3304	//caption builder
3305	$el.each( function( index, val ) {
3306		var $gallery = $(this).attr('data-lbox-init','true'),
3307			$_a = '.lbox-trigger-item',
3308			$_nested_a = '.lbox-nested-item';
3309
3310		$gallery.find($_a, $_nested_a).each(function(){
3311			var $a = $(this),
3312				$img = $('img', $a).first(),
3313				imgw = $img.attr('data-width'),
3314				imgh = $img.attr('data-height'),
3315				caption = $a.attr('data-caption'),
3316				title = $a.attr('data-title');
3317
3318			if ( $img.length && $img.attr('data-crop') != true ) {
3319				if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) {
3320					$a.attr('data-external-thumb-image', $img.attr('data-guid'));
3321				} else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) {
3322					$a.attr('data-external-thumb-image', $img[0].src);
3323				}
3324			}
3325
3326			if ( typeof title !== 'undefined' && title !== '' ) {
3327				title = '<h6>' + title + '</h6>';
3328			} else {
3329				title = '';
3330			}
3331
3332			if ( typeof caption !== 'undefined' && caption !== '' ) {
3333				caption = '<p>' + caption + '</p>';
3334				title += caption;
3335			}
3336
3337			if ( title !== '' ) {
3338				$a.attr( 'title', title );
3339			}
3340
3341			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') ) ) {
3342				$a.attr('data-lg-size', imgw + '-' + imgh);
3343			}
3344		});
3345	});
3346
3347	//regular galleries
3348	$el.each( function( index, val ) {
3349		var $gallery = $(this),
3350			$_a = '.lbox-trigger-item',
3351			$_nested_a = '.lbox-nested-item',
3352			$_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(),
3353			galleryID = $_first.attr('data-lbox'),
3354			$_connected_a = $_a + '[data-lbox="' + galleryID + '"]',
3355			tmb = $_first.attr('data-notmb'),
3356			social = $_first.attr('data-social'),
3357			deep = $_first.attr('data-deep'),
3358			zoom = $_first.attr('data-zoom-origin'),
3359			actual = $_first.attr('data-actual-size'),
3360			download = $_first.attr('data-download'),
3361			controls = $_first.attr('data-arrows') !== 'no',
3362			fullScreen = $_first.attr('data-full'),
3363			counter = $_first.attr('data-counter'),
3364			transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide',
3365			containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3366			connect = $_first.attr('data-connect'),
3367			lgPlugins = [lgVideo],
3368			itemsLoadedTimeOut;
3369
3370		containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3371		containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3372
3373		if ( typeof tmb == 'undefined' || !tmb ) {
3374			lgPlugins.push(lgThumbnail);
3375		}
3376		if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) {
3377			lgPlugins.push(lgZoom);
3378		}
3379		if ( typeof deep != 'undefined' && deep != '' ) {
3380			lgPlugins.push(lgHash);
3381		}
3382		if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3383			lgPlugins.push(lgFullscreen);
3384		}
3385		if ( social ) {
3386			lgPlugins.push(lgShare);
3387		}
3388
3389		if ( galleries.indexOf( galleryID ) !== -1 ) {
3390			return true;
3391		}
3392
3393		galleries.push( galleryID );
3394		var $triggerGal = connect ? $('.page-wrapper') : $gallery,
3395			$selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a;
3396		var gallery = lightGallery( $triggerGal[0], {
3397			addClass: containerClass,
3398			plugins: lgPlugins,
3399			mode: transition,
3400			selector: $selector,
3401			galleryId: galleryID,
3402			thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3403			iframeWidth: '848px',
3404			iframeMaxWidth: '90%',
3405			iframeMaxHeight: '90%',
3406			exThumbImage: 'data-external-thumb-image',
3407			loadYouTubeThumbnail: false,
3408			autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ),
3409			// autoplayFirstVideo: false,
3410			pager: false,
3411			startClass: 'lg-start-opacity',
3412			zoomFromOrigin: zoom,
3413			controls: controls,
3414			download: ( typeof download != 'undefined' && download != '' ),
3415			thumbWidth: 50,
3416			thumbHeight: '50px',
3417			counter: $triggerGal.find($selector).length > 1 ? counter : false,
3418			loadYouTubePoster: false,
3419			enableDrag: $triggerGal.find($selector).length > 1
3420		});
3421
3422		$('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){
3423			e.preventDefault();
3424			var index = $(this).closest('.owl-item.cloned').attr('data-index');
3425			gallery.openGallery(index-1);
3426		});
3427
3428		$triggerGal.on('more-items-loaded', function(e, items) {
3429			clearRequestTimeout(itemsLoadedTimeOut);
3430			itemsLoadedTimeOut = requestTimeout(function(){
3431				createSelectors();
3432				gallery.refresh();
3433			}, 100);
3434		});
3435
3436		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3437			window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3438				$el = model.view.$el;
3439				if ( $el.find($triggerGal).length ) {
3440					gallery.destroy();
3441				}
3442			});
3443		}
3444
3445		$triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide);
3446		$triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen);
3447		$triggerGal[0].addEventListener('lgAfterOpen', function(){
3448			$(window).trigger('uncode-custom-cursor');
3449		});
3450
3451	});
3452
3453	if ( typeof $el !== 'undefined' ) {
3454
3455		//album galleries
3456		$('a[data-album]:not([data-lbox-init])').each(function(index, val) {
3457			var album = val,
3458				galleryID = index,
3459				$album = $(album),
3460				params = $album.attr('data-album'),
3461				tmb = $(val).attr('data-notmb'),
3462				social = $(val).attr('data-social'),
3463				deep = $(val).attr('data-deep'),
3464				actual = $(val).attr('data-actual-size'),
3465				download = $(val).attr('data-download'),
3466				controls = $(val).attr('data-arrows') !== 'no',
3467				fullScreen = $(val).attr('data-full'),
3468				counter = $(val).attr('data-counter'),
3469				transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide',
3470				containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '',
3471				lgPlugins = [lgVideo];
3472
3473			$(val).attr('data-lbox-init','true');
3474
3475			containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3476			containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : '';
3477
3478			if ( typeof tmb == 'undefined' || !tmb ) {
3479				lgPlugins.push(lgThumbnail);
3480			}
3481			if ( typeof actual != 'undefined' && actual != '' ) {
3482				lgPlugins.push(lgZoom);
3483			}
3484			if ( typeof deep != 'undefined' && deep != '' ) {
3485				lgPlugins.push(lgHash);
3486			}
3487			if ( typeof fullScreen != 'undefined' && fullScreen != '' ) {
3488				lgPlugins.push(lgFullscreen);
3489			}
3490			if ( social ) {
3491				lgPlugins.push(lgShare);
3492			}
3493
3494			var gallery = window.lightGallery(album, {
3495				dynamic: true,
3496				plugins: lgPlugins,
3497				dynamicEl: JSON.parse(params),
3498				galleryId: galleryID,
3499				addClass: containerClass,
3500				mode: transition,
3501				thumbnail: ( typeof tmb == 'undefined' || !tmb ),
3502				iframeWidth: '848px',
3503				iframeMaxWidth: '90%',
3504				iframeMaxHeight: '90%',
3505				loadYouTubeThumbnail: false,
3506				autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ),
3507				// autoplayFirstVideo: false,
3508				pager: false,
3509				startClass: 'lg-start-opacity',
3510				zoomFromOrigin: false,
3511				controls: controls,
3512				download: ( typeof download != 'undefined' && download != '' ),
3513				thumbWidth: 50,
3514				thumbHeight: '50px',
3515				loadYouTubePoster: false,
3516				counter: counter
3517			});
3518
3519			$album.on('click', function(){
3520				gallery.openGallery(0);
3521			});
3522
3523			album.addEventListener('lgBeforeSlide', beforeSlide);
3524			album.addEventListener('lgBeforeOpen', beforeOpen);
3525			album.addEventListener('lgAfterOpen', function(){
3526				$(window).trigger('uncode-custom-cursor');
3527			});
3528
3529			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
3530				window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) {
3531					$el = model.view.$el;
3532					if ( $el.find($album).length ) {
3533						gallery.destroy();
3534					}
3535				});
3536			}
3537
3538		});
3539
3540		//single images
3541		$('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) {
3542			var gallery = lightGallery( $('.page-wrapper')[0], {
3543				selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])',
3544				iframeWidth: '848px',
3545				iframeMaxWidth: '90%',
3546				iframeMaxHeight: '90%',
3547				loadYouTubeThumbnail: false,
3548				// autoplayFirstVideo: false,
3549				startClass: 'lg-start-opacity',
3550				thumbWidth: 50,
3551				thumbHeight: '50px',
3552				download: false,
3553				loadYouTubePoster: false,
3554				counter: false
3555			});
3556
3557			$('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide);
3558			$('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen);
3559		});
3560	}
3561};
3562
3563UNCODE.carousel = function(container) {
3564	var $owlContainers = $('.owl-carousel-container', container);
3565	$owlContainers.each(function() {
3566		var $owlContainer = $(this),
3567			$owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'),
3568			$owlSelector = $('> [class*="owl-carousel"]', $owlContainer),
3569			values = {},
3570			tempTimeStamp,
3571			newWidth = UNCODE.wwidth,
3572			$owlInsideEqual = [];
3573		$owlSelector.each(function() {
3574			var itemID = $(this).attr('id'),
3575				$elSelector = $(('#' + itemID).toString());
3576			values['id'] = itemID;
3577			values['items'] = 1;
3578			values['columns'] = 3;
3579			values['fade'] = false;
3580			values['nav'] = false;
3581			values['navmobile'] = false;
3582			values['navskin'] = 'light';
3583			values['navspeed'] = 400;
3584			values['dots'] = false;
3585			values['dotsmobile'] = false;
3586			values['loop'] = false;
3587			values['autoplay'] = false;
3588			values['timeout'] = 3000;
3589			values['autoheight'] = false;
3590			values['stagepadding'] = 0;
3591			values['margin'] = 0;
3592			values['lg'] = 1;
3593			values['md'] = 1;
3594			values['sm'] = 1;
3595			$.each($(this).data(), function(i, v) {
3596				values[i] = v;
3597			});
3598
3599			if ($(this).closest('.uncode-slider').length) {
3600				values['navskin'] = '';
3601				values['navmobile'] = false;
3602				//values['dotsmobile'] = true;
3603			} else {
3604				values['navskin'] = ' style-'+values['navskin']+' style-override';
3605			}
3606
3607			var setIndexActive = function(event, init){
3608				var init = typeof init === 'undefined' ? false : init,
3609					thiis = $(event.currentTarget);
3610				if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) {
3611					var scrolltop = $(document).scrollTop(),
3612						size = event.page.size,
3613						i;
3614					var setIndex = requestTimeout(function() {
3615						for ( i = 0; i < size; i++ ) {
3616							var itemCont = event.item.index != null ? (event.item.index + i) : i;
3617							var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont];
3618							if (thiis.closest('.row-slider').length) {
3619								if (currentItem == undefined) {
3620									currentItem = thiis.children()[i];
3621								}
3622								if ($(currentItem).closest('#page-header').length) {
3623									if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
3624										UNCODE.switchColorsMenu(scrolltop, 'dark');
3625									} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
3626										UNCODE.switchColorsMenu(scrolltop, 'light');
3627									}
3628								}
3629							}
3630							var itendIndex = $(currentItem).attr('data-index');
3631							if ( isNaN(itendIndex) ) {
3632								itendIndex = 1;
3633							}
3634							$elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active');
3635							$elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed');
3636							if ($.fn.counterUp) {
3637								$elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){
3638									var $counter = $(this);
3639									$counter.addClass('started').counterUp({
3640										delay: 10,
3641										time: 1500
3642									});
3643								});
3644							}
3645						}
3646						$elSelector.find('.owl-item.new-indexed').removeClass('new-indexed');
3647					}, 200);
3648				}
3649				tempTimeStamp = event.timeStamp;
3650			}
3651
3652			/** Initialized */
3653			$elSelector.on('initialized.owl.carousel', function(event) {
3654
3655				if ( $('.isotope-container', event.currentTarget).length ) {
3656					window.dispatchEvent(UNCODE.boxEvent);
3657				}
3658
3659				$('.owl-dot.active', $elSelector).on('click', function(){
3660					return false;
3661				});
3662
3663				var thiis = $(event.currentTarget),
3664					// get the time from the data method
3665					time = thiis.data("timer-id"),
3666					rowParent = thiis.closest('.row-parent');
3667
3668				if ( typeof rowParent[0] !== 'undefined' ) {
3669					rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized'));
3670				}
3671
3672				if (time) {
3673					clearRequestTimeout(time);
3674				}
3675
3676				thiis.addClass('showControls');
3677				var new_time = requestTimeout(function() {
3678					thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
3679					if (thiis.hasClass('owl-height-viewport'))
3680						setItemsRelHeight(thiis);
3681					if (thiis.hasClass('owl-height-equal'))
3682						setItemsHeight(thiis);
3683					if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
3684					if (thiis.closest('.unequal, .unexpand').length) {
3685						UNCODE.setRowHeight(rowParent[0], true);
3686					}
3687					if (SiteParameters.dynamic_srcset_active === '1') {
3688						UNCODE.refresh_dynamic_srcset_size(thiis);
3689					}
3690				}, 350);
3691				// save the new time
3692				thiis.data("timer-id", new_time);
3693
3694				var scrolltop = $(document).scrollTop();
3695				thiis.closest('.uncode-slider').find('video').removeAttr('poster');
3696
3697				//if (!UNCODE.isMobile) {
3698					/** fix autoplay when visible **/
3699				$(window).on('load', function(){
3700					if (thiis.data('autoplay')) {
3701						if ( !thiis.closest('.sticky-element').length ) {
3702							thiis.trigger('stop.autoplay.owl');
3703						} else {
3704							thiis.trigger('play.owl.autoplay');
3705						}
3706					}
3707					if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) {
3708						return;
3709					}
3710					if ( ! thiis.closest('.sticky-element').length ) {
3711						var carouselInView = new Waypoint.Inview({
3712							context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
3713							element: thiis[0],
3714							exited: function() {
3715								var el = $(this.element);
3716								if (el.data('autoplay') ) {
3717									el.trigger('stop.owl.autoplay');
3718									el.data('stopped','true');
3719								}
3720							},
3721							enter: function(direction) {
3722								var el = $(this.element);
3723								requestTimeout(function() {
3724									if (el.data('autoplay')) {
3725										el.trigger('play.owl.autoplay');
3726										el.data('stopped','false');
3727									}
3728								}, 100);
3729							}
3730						});
3731					}
3732				});
3733				//}
3734
3735				// $(window).on('frontend:carousel_updated', function(){
3736				// 	Waypoint.refreshAll();
3737				// });
3738
3739				if (!thiis.closest('.isotope-system').length) {
3740					requestTimeout(function() {
3741						animate_thumb($('.t-inside', el), event);
3742					}, 400);
3743				} else {
3744					requestTimeout(function() {
3745						thiis.closest('.isotope-container').isotope('layout');
3746					}, 400);
3747				}
3748
3749				var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
3750				currentIndex = $(currentItem).attr('data-index');
3751
3752				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
3753					if ($(val).closest('.uncode-slider').length) {
3754						$(val).removeClass('start_animation');
3755					}
3756				});
3757				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
3758					if ($(val).closest('.uncode-slider').length) {
3759						$(val).removeClass('already-animated');
3760					}
3761				});
3762
3763				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
3764					if ($(val).closest('.uncode-slider').length) {
3765						$(val).removeAttr('data-animated');
3766					}
3767				});
3768
3769				$.each($('.owl-item.cloned', thiis), function(index, val) {
3770					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
3771				});
3772
3773				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
3774					if ($(val).attr('data-index') != currentIndex) {
3775						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
3776						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
3777					}
3778					if ($(val).attr('data-index') != currentIndex) {
3779						$('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated');
3780					}
3781					if ($(val).attr('data-index') == currentIndex) {
3782						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
3783					}
3784				});
3785
3786				if (thiis.closest('.uncode-slider').length) {
3787					var el = thiis.closest('.row-parent')[0];
3788					if ($(el).data('imgready')) {
3789						firstLoaded(el, event);
3790					} else {
3791						el.addEventListener("imgLoaded", function(el) {
3792							firstLoaded(el.target, event);
3793						}, false);
3794					}
3795					var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
3796					if (transHeight != null) {
3797						requestTimeout(function() {
3798							thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
3799						}, 100);
3800					}
3801				} else {
3802					var el = thiis;
3803					el.closest('.uncode-slider').addClass('slider-loaded');
3804				}
3805
3806				requestTimeout(function() {
3807					if (typeof UNCODE.bigText !== 'undefined') {
3808						UNCODE.bigText(thiis);
3809					}
3810					if (thiis.closest('.uncode-slider').length) {
3811						if (thiis.data('autoplay')) pauseOnHover(thiis);
3812					}
3813				}, 500);
3814
3815				if (thiis.closest('.unequal').length) {
3816					$owlInsideEqual.push(thiis.closest('.row-parent'));
3817				}
3818
3819				var containerClasses = '',
3820					containerStyle = '';
3821				if ( $('.owl-dots-classes', $owlContainer).length ) {
3822					containerClasses = $('.owl-dots-classes', $owlContainer).attr('class');
3823					containerStyle = $('.owl-dots-classes', $owlContainer).attr('style');
3824					$('.owl-dots-classes', $owlContainer).remove();
3825				}
3826
3827				if ( containerClasses !== '' ) {
3828					requestTimeout(function() {
3829						if ( containerClasses !== '' )
3830							$('.owl-dots', $owlContainer).attr('style', containerStyle);
3831						if ( containerStyle !== '' )
3832							$('.owl-dots', $owlContainer).addClass(containerClasses);
3833					}, 100);
3834				}
3835
3836				$.each($('.column_child.pos-bottom', thiis), function(index, val) {
3837					$(val).closest('.row-inner').css({
3838						'margin-top': '-1px'
3839					});
3840				});
3841
3842				if ($.fn.isotope) {
3843					if ( thiis.closest('.isotope-container').length ) {
3844						if (thiis.closest('.isotope-container').data('isotope')) {
3845							requestTimeout(function(){
3846								thiis.closest('.isotope-container').isotope('layout');
3847							}, 300);
3848						}
3849						$(window).on('load', function(){
3850							if (thiis.closest('.isotope-container').data('isotope')) {
3851								thiis.closest('.isotope-container').isotope('layout');
3852							}
3853						});
3854					}
3855				}
3856
3857				if (thiis.data('autoplay')) {
3858					$(window).on('menuOpen', function(){
3859						thiis.trigger('stop.owl.autoplay');
3860						thiis.data('stopped','true');
3861					}).on('menuClose', function(){
3862
3863					});
3864				}
3865				$(window).on('menuClose', function(){
3866					if (thiis.data('autoplay')) {
3867						thiis.trigger('play.owl.autoplay');
3868						thiis.data('stopped','false');
3869					}
3870				});
3871
3872				setIndexActive(event, true);
3873
3874				var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) {
3875						return !$(this).closest('.nested-carousel').length;
3876					}),
3877					$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);
3878
3879
3880				if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
3881					UNCODE.lightgallery( $galleries );
3882				}
3883
3884
3885			});
3886
3887			$elSelector.on('resized.owl.carousel', function(event) {
3888				var thiis = $(event.currentTarget);
3889				// if ($(this).closest('.nested-carousel').length) {
3890				// 	requestTimeout(function() {
3891				// 		window.dispatchEvent(UNCODE.boxEvent);
3892				// 	}, 200);
3893				// }
3894				if ( thiis.hasClass('owl-height-equal') )
3895					setItemsHeight(thiis);
3896
3897				if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
3898					newWidth = UNCODE.wwidth;
3899					setItemsRelHeight($elSelector);
3900				}
3901
3902				setIndexActive(event);
3903
3904				if (SiteParameters.dynamic_srcset_active === '1') {
3905					UNCODE.refresh_dynamic_srcset_size(thiis);
3906				}
3907
3908				if ($.fn.isotope) {
3909					$(window).on('load', function(){
3910						if ($(event.currentTarget).closest('.isotope-container').data('isotope')) {
3911							$(event.currentTarget).closest('.isotope-container').isotope('layout');
3912						}
3913					});
3914				}
3915			});
3916
3917			/** detect resize window for fluid height layout */
3918			var setFluidResize;
3919			function manageFluidCarouseHeight() {
3920				clearRequestTimeout(setFluidResize);
3921				setFluidResize = requestTimeout(function(){
3922					if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) {
3923						newWidth = UNCODE.wwidth;
3924						setItemsRelHeight($elSelector);
3925					}
3926				}, 100);
3927			}
3928			window.addEventListener('resize', manageFluidCarouseHeight);
3929
3930			/** Change */
3931			$elSelector.on('change.owl.carousel', function(event) {
3932				if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
3933			});
3934
3935			/** Changed */
3936			$elSelector.on('changed.owl.carousel', function(event) {
3937				var $row = $elSelector.parents('.row')[0];
3938				if ( typeof $row !== 'undefined' ) {
3939					$row.dispatchEvent(new CustomEvent('owl-carousel-changed'));
3940				}
3941				setIndexActive(event);
3942			});
3943
3944			var checkDrag = function(e) {
3945				$elSelector.addClass('owl-dragging');
3946			};
3947			$elSelector.on('drag.owl.carousel', function(event) {
3948				document.addEventListener("mousemove", checkDrag);
3949			});
3950
3951			$elSelector.on('dragged.owl.carousel', function(event) {
3952				$elSelector.removeClass('owl-dragging');
3953				document.removeEventListener("mousemove", checkDrag);
3954			});
3955
3956			$elSelector.on('translate.owl.carousel', function(event) {
3957				if (UNCODE.isMobile) {
3958					$(event.currentTarget).addClass('owl-translating');
3959				}
3960			});
3961
3962			/** Translated */
3963			$elSelector.on('translated.owl.carousel', function(event) {
3964
3965				var thiis = $(event.currentTarget),
3966					currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
3967					currentIndex = $(currentItem).attr('data-index'),
3968					stagePadding = thiis.data('stagepadding');
3969
3970				stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
3971
3972				if (!UNCODE.isMobile) {
3973					UNCODE.owlPlayVideo(thiis);
3974				}
3975
3976				requestTimeout(function(){
3977					var lastDelayElems = animate_elems($('.owl-item.index-active', thiis));
3978					var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event);
3979					if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) {
3980						if (lastDelayElems == undefined) lastDelayElems = 0;
3981						if (lastDelayThumb == undefined) lastDelayThumb = 0;
3982						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
3983						thiis.trigger('stop.owl.autoplay');
3984						requestTimeout(function() {
3985							if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay');
3986						}, maxDelay);
3987					}
3988				}, 200);
3989
3990				$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
3991					if ($(val).closest('.uncode-slider').length) {
3992						$(val).removeClass('start_animation');
3993					}
3994				});
3995
3996				$.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) {
3997					if ($(val).closest('.uncode-slider').length) {
3998						$(val).removeClass('already-animated');
3999					}
4000				});
4001
4002				$.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) {
4003					if ($(val).closest('.uncode-slider').length) {
4004						$(val).removeAttr('data-animated');
4005					}
4006				});
4007
4008				$.each($('.owl-item:not(.active)', thiis), function(index, val) {
4009					if ($(val).attr('data-index') != currentIndex) {
4010						$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
4011						$('.already-animated:not(.t-inside)', val).removeClass('already-animated');
4012					}
4013					if ($(val).attr('data-index') != currentIndex) {
4014						$('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation');
4015					}
4016					if ($(val).attr('data-index') == currentIndex) {
4017						$('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
4018					}
4019				});
4020
4021				if (UNCODE.isMobile) {
4022					thiis.removeClass('owl-translating');
4023				}
4024
4025				setIndexActive(event);
4026			});
4027
4028			if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25;
4029
4030			/** Init carousel */
4031			$elSelector.not('.showControls').owlCarousel({
4032				items: values['items'],
4033				animateIn: (values['fade'] == true) ? 'fadeIn' : null,
4034				animateOut: (values['fade'] == true) ? 'fadeOut' : null,
4035				nav: values['nav'],
4036				dots: values['dots'],
4037				loop: values['loop'],
4038				stagePadding: values['stagepadding'],
4039				margin: 0,
4040				video: true,
4041				autoWidth: false,
4042				autoplay: false,
4043				autoplayTimeout: values['timeout'],
4044				autoplaySpeed: values['navspeed'],
4045				autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
4046				autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ),
4047				rtl: $('body').hasClass('rtl') ? true : false,
4048				fluidSpeed: true,
4049				navSpeed: values['navspeed'],
4050				dotsSpeed: values['navspeed'] / values['items'],
4051				navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
4052				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>'],
4053				navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false,
4054				responsiveClass: true,
4055				responsiveBaseElement: '.box-container',
4056				responsive: {
4057					0: {
4058						items: values['sm'],
4059						nav: values['navmobile'],
4060						dots: values['dotsmobile'],
4061						dotsSpeed: values['navspeed'] / values['sm'],
4062					},
4063					480: {
4064						items: values['sm'],
4065						nav: values['navmobile'],
4066						dots: values['dotsmobile'],
4067						dotsSpeed: values['navspeed'] / values['sm'],
4068					},
4069					570: {
4070						items: values['md'],
4071						nav: values['navmobile'],
4072						dots: values['dotsmobile'],
4073						dotsSpeed: values['navspeed'] / values['md'],
4074					},
4075					960: {
4076						items: values['lg'],
4077						dotsSpeed: values['navspeed'] / values['lg'],
4078					}
4079				}
4080			});
4081
4082			var transDuration = parseFloat(values['navspeed']) * 0.3;
4083			var transDuration2 = parseFloat(values['navspeed']) * 0.8;
4084
4085			$('.owl-item .tmb', $elSelector).css({
4086				'-webkit-transition-delay': transDuration + 'ms',
4087				'-moz-transition-delay': transDuration + 'ms',
4088				'-o-transition-delay': transDuration + 'ms',
4089				'transition-delay': transDuration + 'ms',
4090				'-webkit-transition-duration': transDuration2 + 'ms',
4091				'-moz-transition-duration': transDuration2 + 'ms',
4092				'-o-transition-duration': transDuration2 + 'ms',
4093				'transition-duration': transDuration2 + 'ms',
4094			});
4095
4096			requestTimeout(function() {
4097				for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4098					UNCODE.setRowHeight($owlInsideEqual[i]);
4099				};
4100			}, 300);
4101
4102			$(window).on('load', function(){
4103				var $elCarousel = $elSelector.data('owl.carousel');
4104				if ( typeof $elCarousel !== 'undefined' ) {
4105					$elCarousel.trigger('refreshed');
4106					for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
4107						UNCODE.setRowHeight($owlInsideEqual[i]);
4108					};
4109				}
4110			});
4111
4112			$( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) {
4113				if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4114					$('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel');
4115					$('#' + carousel_id).find('.owl-item').each( function() {
4116						var $item = $(this),
4117							index = ( $item.index() + 1 );
4118						$item.attr('data-index', index);
4119					});
4120				}
4121			});
4122
4123			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4124				window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) {
4125					if ( $('#' + carousel_id).data( 'added-id' ) != randId ) {
4126						$('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel');
4127						$('#' + carousel_id).find('.owl-item').each( function() {
4128							var $item = $(this),
4129								index = ( $item.index() + 1 );
4130							$item.attr('data-index', index);
4131						});
4132					}
4133				});
4134			}
4135
4136		});
4137
4138		function firstLoaded(el, event) {
4139			var el = $(el),
4140			uncode_slider = el.find('.uncode-slider');
4141			el.find('.owl-carousel').css('opacity', 1);
4142			uncode_slider.addClass('slider-loaded');
4143			if (typeof UNCODE.bigText !== 'undefined') {
4144				UNCODE.bigText(el.find('.owl-item.active'));
4145			}
4146			//if (!UNCODE.isMobile) {
4147				requestTimeout(function() {
4148					var lastDelayElems = animate_elems(el.find('.owl-item.index-active'));
4149					var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
4150					if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
4151						if (lastDelayElems == undefined) lastDelayElems = 0;
4152						if (lastDelayThumb == undefined) lastDelayThumb = 0;
4153						var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
4154						$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
4155						requestTimeout(function() {
4156							$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
4157						}, maxDelay);
4158					}
4159				}, 500);
4160
4161			//}
4162		}
4163
4164		function navHover(el) {
4165			var $owlCont = el,
4166				$owlPrev = $owlCont.find('.owl-prev'),
4167				$owlNext = $owlCont.find('.owl-next'),
4168				$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
4169				$owlPagination = $owlCont.next(),
4170				owlPrevW = $owlPrev.outerWidth(),
4171				owlNextW = $owlNext.outerWidth(),
4172				owlDotsH = $owlDots.innerHeight(),
4173				owlTime = 400,
4174				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4175			if ( $('body').hasClass('rtl') ) {
4176				$owlPrev.css("margin-right", -owlPrevW);
4177				$owlNext.css("margin-left", -owlNextW);
4178			} else {
4179				$owlPrev.css("margin-left", -owlPrevW);
4180				$owlNext.css("margin-right", -owlNextW);
4181			}
4182			if (!owlNested) $owlDots.css("bottom", -owlDotsH);
4183			$owlCont.mouseenter(function() {
4184				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4185				$owlPrev.add($owlNext).css({
4186					marginLeft: 0,
4187					marginRight: 0
4188				});
4189				if (!owlNested) {
4190					$owlDots.css({
4191						opacity: 1,
4192						bottom: 0
4193					});
4194				}
4195			}).mouseleave(function() {
4196				owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
4197				if ( $('body').hasClass('rtl') ) {
4198					$owlPrev.css("margin-right", -owlPrevW);
4199					$owlNext.css("margin-left", -owlNextW);
4200				} else {
4201					$owlPrev.css("margin-left", -owlPrevW);
4202					$owlNext.css("margin-right", -owlNextW);
4203				}
4204				if (!owlNested) {
4205					$owlDots.css({
4206						opacity: 1,
4207						bottom: -owlDotsH
4208					});
4209				}
4210			});
4211		};
4212
4213		function animate_elems($this) {
4214			var lastDelay;
4215			$.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) {
4216				var element = $(val),
4217					delayAttr = element.attr('data-delay'),
4218					$first_item = element.closest('.owl-item[data-index="1"]');
4219
4220				if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) {
4221					return false;
4222				}
4223
4224				if (delayAttr == undefined) delayAttr = 0;
4225				requestTimeout(function() {
4226					element.addClass('start_animation');
4227				}, delayAttr);
4228				lastDelay = delayAttr;
4229			});
4230			return lastDelay;
4231		}
4232
4233		function animate_thumb(items, event) {
4234			var lastDelay,
4235				itemIndex,
4236				thiis = $(event.currentTarget),
4237				tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'),
4238				numActives = $('.owl-item.active', thiis).length,
4239				stagePadding = thiis.data('stagepadding');
4240
4241			stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true;
4242
4243			thiis.data('tempIndex', event.item.index);
4244				$.each(items, function(index, val) {
4245					var parent = $(val).closest('.owl-item');
4246					if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4247						return;
4248					}
4249					if (!$(val).hasClass('start_animation')) {
4250						if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) {
4251							var thumbInView = new Waypoint.Inview({
4252							  context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4253							  element: val,
4254							  enter: function(direction) {
4255								var element = $(this.element),
4256										delayAttr = parseInt(element.attr('data-delay')),
4257										itemIndex = element.closest('.owl-item').index() + 1,
4258										diffItem = Math.abs(itemIndex - tempIndex) - 1;
4259									if (itemIndex > tempIndex) {
4260										thiis.data('tempIndex', itemIndex);
4261									}
4262									if (isNaN(delayAttr)) delayAttr = 100;
4263									if (stagePadding) {
4264										var objTimeout = requestTimeout(function() {
4265											element.addClass('start_animation');
4266										}, index * delayAttr);
4267										lastDelay = index * delayAttr;
4268									} else {
4269										$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation');
4270										var objTimeout = requestTimeout(function() {
4271											element.addClass('start_animation');
4272										}, diffItem * delayAttr);
4273										lastDelay = diffItem * delayAttr;
4274									}
4275									parent.data('objTimeout', objTimeout);
4276									if (!UNCODE.isUnmodalOpen) {
4277										this.destroy();
4278									}
4279								}
4280							});
4281						}
4282					}
4283				});
4284				return lastDelay;
4285			}
4286
4287		function setItemsHeight(item) {
4288			$.each($('.owl-item', item), function(index, val) {
4289				var availableThumbHeight = $('.t-inside', $(val)).height(),
4290				innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
4291				difference = availableThumbHeight - innerThumbHeight;
4292				if ($('.tmb-content-under', val).length) {
4293					var visualPart = $('.t-entry-visual', val);
4294					if (visualPart.length) {
4295						difference -= $('.t-entry-visual', val).height();
4296					}
4297				}
4298				if (! $('.tmb-content-lateral', val).length)
4299					$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
4300			});
4301		}
4302
4303		function setItemsRelHeight(item) {
4304			$.each($('.owl-item', item), function(index, val) {
4305				var $rowContainer = $(item).parents('.row-parent').eq(0),
4306					paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')),
4307					$colContainer = $(item).parents('.uncell').eq(0),
4308					paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
4309					winHeight = UNCODE.wheight,
4310					multiplier_h = parseInt($(item).attr('data-vp-height')),
4311					data_viewport_h,
4312					consider_menu = $(item).data('vp-menu');
4313
4314				if ( consider_menu ) {
4315					winHeight = winHeight - UNCODE.menuHeight;
4316				}
4317
4318				data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol );
4319				$('.t-inside', val).css( 'height', data_viewport_h );
4320			});
4321		}
4322
4323		function pauseOnHover(slider) {
4324			$('.owl-dots, .owl-prev, .owl-next', slider).on({
4325				mouseenter: function () {
4326					$(slider).addClass('owl-mouseenter');
4327					$(slider).trigger('stop.owl.autoplay');
4328				},
4329				mouseleave: function () {
4330					$(slider).removeClass('owl-mouseenter');
4331					$(slider).trigger('play.owl.autoplay');
4332				}
4333			});
4334		}
4335	});
4336};
4337
4338UNCODE.owlPlayVideo = function(carousel) {
4339	var player, iframe;
4340	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
4341		var content = $(val).html();
4342		if (content == '') {
4343			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
4344			$(val).append(getCloned);
4345		}
4346		if ($(this).attr('data-provider') == 'vimeo') {
4347			iframe = $(this).find('iframe');
4348			player = new Vimeo.Player(iframe[0]);
4349			player.play();
4350		} else if ($(this).attr('data-provider') == 'youtube') {
4351			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
4352		} else {
4353			var player = $(this).find('video');
4354			if (player.length) {
4355				$(this).find('video')[0].volume = 0;
4356				$(this).find('video')[0].play();
4357				$(val).css('opacity', 1);
4358			}
4359		}
4360	});
4361};
4362
4363UNCODE.owlStopVideo = function(carousel) {
4364	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
4365		var player, iframe;
4366		if ($(this).attr('data-provider') == 'vimeo') {
4367			iframe = $(this).find('iframe');
4368			player = new Vimeo.Player(iframe[0]);
4369			player.pause();
4370		} else if ($(this).attr('data-provider') == 'youtube') {
4371			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
4372		} else {
4373			var player = $(this).find('video');
4374			if (player.length) {
4375				$(this).find('video')[0].volume = 0;
4376				$(this).find('video')[0].play();
4377			}
4378		}
4379	});
4380};
4381
4382UNCODE.animations = function() {
4383
4384	var runWaypoints_TO,
4385		runWaypoints_carousel_TO,
4386		runWaypoints_delay = 0,
4387	highlightComplexFunc = function($wrap, ev){
4388
4389		var $lines = $('.heading-line-wrap', $wrap),
4390			not_animate = false;
4391
4392		if ( $wrap.data('animate') === true ) {
4393			not_animate = true;
4394		}
4395
4396		var $rotatingTxt = $('.uncode-rotating-text-start', $wrap);
4397		if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) {
4398			return;
4399		}
4400
4401		$lines.each(function(_key, _value){
4402			var $line = $(_value),
4403				$inners = $('.split-word-inner', $line),
4404				$highlights = $('.heading-text-highlight-inner', $line);
4405
4406			var highlitInnerFunc = function(ev){
4407				var delay = 0;
4408				$highlights.each(function(h_key, high){
4409					var $highlight = $(high),
4410						$split = $highlight.closest('.split-word:not(.uncode-rotating-span)'),
4411						$nextSplit = $split.nextUntil(),
4412						$next = $('.heading-text-highlight-inner', $nextSplit),
4413						countCh = $split.text().length;
4414
4415					$highlight.css({
4416						'-webkit-transition-duration': (30 * countCh) + 'ms',
4417						'-moz-transition-duration': (30 * countCh) + 'ms',
4418						'-o-transition-duration': (30 * countCh) + 'ms',
4419						'transition-duration': (30 * countCh) + 'ms',
4420					});
4421
4422					delay += (30 * countCh);
4423
4424					$next.css({
4425						'-webkit-transition-delay': delay + 'ms',
4426						'-moz-transition-delay': delay + 'ms',
4427						'-o-transition-delay': delay + 'ms',
4428						'transition-delay': delay + 'ms',
4429					});
4430				});
4431				$highlights.removeAttr('data-animated');
4432				if ( _key+1 === $lines.length ) {
4433					$wrap.data('animate', true);
4434				}
4435			};
4436
4437			if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) {
4438				if ( not_animate ) {
4439					$highlights.each(function(h_key, high){
4440						var $highlight = $(high);
4441						$highlight.css({
4442							'-webkit-transition-duration': '0ms',
4443							'-moz-transition-duration': '0ms',
4444							'-o-transition-duration': '0ms',
4445							'transition-duration': '0ms',
4446						});
4447					});
4448					$highlights.removeAttr('data-animated');
4449				} else {
4450					if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) {
4451						highlitInnerFunc();
4452					} else {
4453						$inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc);
4454					}
4455				}
4456			}
4457		});
4458	};
4459
4460	$.each($('.header-content-inner'), function(index, val) {
4461		var element = $(val),
4462			transition = '';
4463		if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
4464		if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
4465		if (element.hasClass('left-t-right')) transition = 'left-t-right';
4466		if (element.hasClass('right-t-left')) transition = 'right-t-left';
4467		if (element.hasClass('zoom-in')) transition = 'zoom-in';
4468		if (element.hasClass('zoom-out')) transition = 'zoom-out';
4469		if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
4470		if (transition != '') {
4471			$(val).removeClass(transition);
4472			var container = element,
4473				containerDelay = container.attr('data-delay'),
4474				containerSpeed = container.attr('data-speed'),
4475				items = $('.header-title > *, .post-info', container);
4476			$.each(items, function(index, val) {
4477				var element = $(val),
4478					//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
4479					delayAttr = (containerDelay != undefined) ? containerDelay : 400;
4480				if (!element.hasClass('animate_when_almost_visible')) {
4481					delayAttr = Number(delayAttr) + (400 * index);
4482					if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
4483					element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
4484				}
4485			});
4486			container.css('opacity', 1);
4487		}
4488	});
4489
4490	function animate_css_grids_on_load() {
4491		$('.cssgrid-system').each(function() {
4492			var grid = $(this);
4493			var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false;
4494			UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false);
4495		});
4496	}
4497
4498	window.waypoint_animation = function(ev) {
4499		$.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) {
4500			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 ) ) {
4501				return true;
4502			}
4503			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4504				return;
4505			}
4506			var run = true,
4507				$carousel = $(val).closest('.owl-carousel');
4508			if ( $carousel.length ) {
4509				run = false;
4510			}
4511			if (run) {
4512				new Waypoint({
4513					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4514					element: val,
4515					handler: function() {
4516						var element = $(this.element),
4517							index = element.index(),
4518							delayAttr = element.attr('data-delay');
4519						if (delayAttr == undefined) delayAttr = 0;
4520						requestTimeout(function() {
4521							element.addClass('start_animation');
4522						}, delayAttr);
4523						if (!UNCODE.isUnmodalOpen) {
4524							this.destroy();
4525						}
4526					},
4527					offset: UNCODE.isFullPage ? '100%' : '90%'
4528				});
4529			}
4530		});
4531		$.each($('.animate_inner_when_almost_visible'), function(index, val) {
4532			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4533				return;
4534			}
4535			var run = true,
4536				$carousel = $(val).closest('.owl-carousel');
4537			if ( $carousel.length ) {
4538				run = false;
4539			}
4540			if (run) {
4541				new Waypoint({
4542					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4543					element: val,
4544					handler: function() {
4545						var $element = $(this.element),
4546							$childs = $('.animate_when_parent_almost_visible', $element);
4547						$childs.each(function(key,el){
4548							var $child = $(el),
4549								delaySpeed = $child.attr('data-speed'),
4550								delayAttr = $child.attr('data-delay'),
4551								intervalAttr = $child.attr('data-interval');
4552							if (delayAttr == undefined) {
4553								delayAttr = 50*key;
4554							}
4555							requestTimeout(function() {
4556								$child.addClass('start_animation');
4557								if ( $child.hasClass('anim-line-checker') ) {
4558									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4559										var $line = $child.closest('.heading-line-wrap');
4560									});
4561								}
4562								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
4563								highlightComplexFunc($wrapText, ev);
4564								if ( $child.hasClass('anim-tot-checker') ) {
4565									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4566										if ( $child.hasClass('anim-tot-checker') ) {
4567											$wrapText.addClass('already-animated');
4568											$element.trigger('already-animated');
4569										}
4570									});
4571								}
4572							}, delayAttr );
4573						});
4574						$element.addClass('start_animation');
4575						if (!UNCODE.isUnmodalOpen) {
4576							this.destroy();
4577						}
4578					},
4579					offset: UNCODE.isFullPage ? '100%' : '90%'
4580				});
4581			}
4582		});
4583	}
4584	window.waypoint_carousel_animation = function(ev) {
4585		$.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) {
4586			if ( $(val).hasClass('el-text-split') ) {
4587				return true;
4588			}
4589			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4590				return;
4591			}
4592			var run = true,
4593				$carousel = $(val).closest('.owl-carousel'),
4594				$first_item = $(val).closest('.owl-item[data-index="1"]'),
4595				$all_first = $('.owl-item[data-index="1"]', $carousel);
4596			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
4597				run = false;
4598			}
4599			if (run) {
4600				new Waypoint({
4601					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4602					element: val,
4603					handler: function() {
4604						var element = $(this.element),
4605							index = element.index(),
4606							delayAttr = element.attr('data-delay');
4607						if (delayAttr == undefined) delayAttr = 0;
4608						requestTimeout(function() {
4609							if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
4610								$all_first.attr('data-already-reached', 'true');
4611							}
4612							element.addClass('start_animation');
4613						}, delayAttr);
4614						if (!UNCODE.isUnmodalOpen) {
4615							this.destroy();
4616						}
4617					},
4618					offset: UNCODE.isFullPage ? '100%' : '90%'
4619				});
4620			}
4621		});
4622		$.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) {
4623			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4624				return;
4625			}
4626			var run = true,
4627				$carousel = $(val).closest('.owl-carousel'),
4628				$first_item = $(val).closest('.owl-item[data-index="1"]'),
4629				$all_first = $('.owl-item[data-index="1"]', $carousel);
4630			if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) {
4631				run = false;
4632			}
4633			if (run) {
4634				new Waypoint({
4635					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4636					element: val,
4637					handler: function() {
4638						var $element = $(this.element),
4639							$childs = $('.animate_when_parent_almost_visible', $element);
4640						$childs.each(function(key,el){
4641							var $child = $(el),
4642								delaySpeed = $child.attr('data-speed'),
4643								delayAttr = $child.attr('data-delay'),
4644								intervalAttr = $child.attr('data-interval');
4645							if (delayAttr == undefined) {
4646								delayAttr = 50*key;
4647							}
4648							requestTimeout(function() {
4649								if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) {
4650									$all_first.attr('data-already-reached', 'true');
4651								}
4652								$child.addClass('start_animation');
4653								if ( $child.hasClass('anim-line-checker') ) {
4654									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4655										var $line = $child.closest('.heading-line-wrap');
4656									});
4657								}
4658								var $wrapText = $child.closest('.animate_inner_when_almost_visible');
4659								highlightComplexFunc($wrapText, ev);
4660								if ( $child.hasClass('anim-tot-checker') ) {
4661									$child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) {
4662										if ( $child.hasClass('anim-tot-checker') ) {
4663											$wrapText.addClass('already-animated');
4664										}
4665									});
4666								}
4667							}, delayAttr );
4668						});
4669						$element.addClass('start_animation');
4670						if (!UNCODE.isUnmodalOpen) {
4671							this.destroy();
4672						}
4673					},
4674					offset: UNCODE.isFullPage ? '100%' : '90%'
4675				});
4676			}
4677		});
4678	}
4679
4680	var runWaypoints = function(ev){
4681		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
4682			runWaypoints_delay = 400;
4683		}
4684		clearRequestTimeout(runWaypoints_TO);
4685		runWaypoints_TO = requestTimeout(function() {
4686			window.waypoint_animation(ev);
4687		}, runWaypoints_delay);
4688
4689		clearRequestTimeout(runWaypoints_carousel_TO);
4690		runWaypoints_carousel_TO = requestTimeout(function() {
4691			window.waypoint_carousel_animation(ev);
4692		}, 400);
4693	};
4694	runWaypoints();
4695	animate_css_grids_on_load();
4696
4697	$( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) {
4698		runWaypoints(ev);
4699	});
4700	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
4701		window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints );
4702	}
4703};
4704
4705UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) {
4706	var $allItems = elements.length - startIndex,
4707		showed = 0,
4708		index = 0,
4709		use_index = false
4710		;
4711
4712	if (filtering) {
4713		if (sequential) {
4714			use_index = true;
4715		}
4716		sequential = false;
4717	}
4718
4719	$.each(elements, function(index, val) {
4720		var $this = $(val),
4721			elInner = $('> .t-inside', val);
4722
4723		if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4724			return;
4725		}
4726		if (val[0]) val = val[0];
4727
4728		if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
4729			new Waypoint({
4730				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4731				element: val,
4732				handler: function() {
4733					var element = $('> .t-inside', this.element),
4734						parent = $(this.element);
4735					var _index = use_index? index : 0;
4736
4737					var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index),
4738						delayAttr = parseInt(element.attr('data-delay'));
4739					if (isNaN(delayAttr)) delayAttr = 100;
4740					if (sequential || use_index) {
4741						delay -= showed;
4742					}
4743					var objTimeout = requestTimeout(function() {
4744						element.removeClass('zoom-reverse').addClass('start_animation');
4745						showed = index;
4746					}, delay * delayAttr);
4747					parent.data('objTimeout', objTimeout);
4748					if (!UNCODE.isUnmodalOpen) {
4749						this.destroy();
4750					}
4751				},
4752				offset: UNCODE.isFullPage ? '100%' : '90%'
4753			});
4754		}
4755
4756		index++;
4757	});
4758};
4759
4760UNCODE.tapHover = function() {
4761
4762	var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn
4763		elClass = "hover";
4764
4765	$(window).on('click', function() {
4766		$el.removeClass(elClass);
4767	});
4768
4769	$el.on("click", function(e) { // cambia click con touch start 'touchstart'
4770		e.stopPropagation();
4771		var link = $(this);
4772		if ( ! link.hasClass(elClass)) {
4773			e.preventDefault();
4774			link.addClass("hover");
4775			$el.not(this).removeClass(elClass);
4776			return false;
4777		}
4778	});
4779};
4780
4781UNCODE.onePage = function(isMobile) {
4782	var current = 0,
4783		last = 0,
4784		lastScrollTop = 0,
4785		forceScroll = false,
4786		lastScrolled = 0,
4787		isSectionscroller = ($('.main-onepage').length) ? true : false,
4788		isOnePage = false,
4789		getOffset = function () {
4790			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);
4791			return calculateOffset;
4792		}
4793
4794	// if ( UNCODE.isFullPage || UNCODE.isFullPageSnap )
4795	// 	return false;
4796
4797	function init_onepage() {
4798		if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) {
4799			$("<ul class='onepage-pagination'></ul>").prependTo("body");
4800		}
4801		last = $('.onepage-pagination li').last().find('a').data('index');
4802		$.each($('div[data-parent="true"]'), function(index, val) {
4803			$(this).attr('data-section', index);
4804			if (isMobile) return;
4805			if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
4806				return;
4807			}
4808			var sectionDown = new Waypoint({
4809				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4810				element: val,
4811				handler: function(direction) {
4812					if (direction == 'down') {
4813						changeMenuActive(this.element, index);
4814					}
4815				},
4816				offset: function() {
4817					return 5 + getOffset()
4818				}
4819			});
4820			var sectionUp = new Waypoint({
4821				context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
4822				element: val,
4823				handler: function(direction) {
4824					if (direction == 'up') {
4825						changeMenuActive(this.element, index);
4826					}
4827				},
4828				offset: function() {
4829					return -5 - getOffset()
4830				}
4831			});
4832
4833			if (isSectionscroller) {
4834				var label;
4835				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
4836				else label = '';
4837				var getName = $(this).attr('data-name');
4838				if (getName == undefined) getName = index;
4839				if (label != '') {
4840					isOnePage = true;
4841					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
4842					$('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>");
4843				}
4844			}
4845		});
4846
4847		if (isSectionscroller) {
4848			$.each($('ul.onepage-pagination li'), function(index, val) {
4849				var $this = $(val),
4850					$a = ('a', $this);
4851				$a.on('click', function(evt) {
4852					if ( $('.is-selected', $this).length ) {
4853						return false;
4854					}
4855					if ( $('body').hasClass('uncode-scroll-no-history') ) {
4856						evt.preventDefault();
4857					}
4858					Waypoint.refreshAll();
4859					var el = $('a', evt.currentTarget);
4860					current = lastScrolled = parseInt(el.attr('data-index'));
4861					lastScrolled += 1;
4862					scrollBody(current);
4863				});
4864			});
4865		}
4866
4867		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
4868		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) {
4869			goToSection = String(window.location.hash).replace(/^#/, "");
4870			goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section'));
4871		}
4872
4873		if (typeof goToSection === 'number' && !isNaN(goToSection)) {
4874			current = lastScrolled = goToSection;
4875			$(window).on('load', function(){
4876				if ( $('.owl-carousel').length ) {
4877					requestTimeout(function(){
4878						scrollBody(goToSection);
4879					}, 400);
4880				} else {
4881					scrollBody(goToSection);
4882				}
4883			});
4884		}
4885
4886	}
4887
4888	function changeMenuActive(section, index) {
4889		current = lastScrolled = parseInt($(section).attr('data-section'));
4890		if (isOnePage) {
4891			var newSection = $('.onepage-pagination li a[data-index="' + index + '"]');
4892			if (newSection.length) {
4893				$('ul.onepage-pagination li a').removeClass('is-selected');
4894				newSection.addClass('is-selected');
4895			}
4896			var getName = $('[data-section="' + index + '"]').attr('data-name');
4897			if (getName != undefined && getName !== '') {
4898				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
4899					var get_href = $(val).attr('href');
4900					if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
4901						$(val).closest('.menu-smart').find('.active').removeClass('active');
4902						$(val).parent().addClass('active');
4903					}
4904				});
4905			}
4906		}
4907	}
4908
4909	if (isOnePage) {
4910		$(window).on('scroll', function() {
4911			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
4912			if (bodyTop == 0) {
4913				$('ul.onepage-pagination li a').removeClass('is-selected');
4914				$('.onepage-pagination li a[data-index="0"]').addClass('is-selected');
4915				var getName = $('[data-section=0]').attr('data-name');
4916				if (getName != undefined && getName !== '') {
4917					$.each($('.menu-container .menu-item > a'), function(i, val) {
4918						var get_href = $(val).attr('href');
4919						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
4920							$(val).closest('ul').find('.active').removeClass('active');
4921							$(val).parent().addClass('active');
4922						}
4923					});
4924				}
4925			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
4926				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
4927				if (lastSection.length) {
4928					$('ul.onepage-pagination li a').removeClass('is-selected');
4929					lastSection.addClass('is-selected');
4930				}
4931			}
4932		});
4933	}
4934
4935	var scrollBody = function(index) {
4936		$('ul.onepage-pagination li a').removeClass('is-selected');
4937		$('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected');
4938
4939		var getSection = $('[data-section=' + index + ']'),
4940			scrollTo;
4941
4942		if (getSection == undefined) return;
4943
4944		var body = $("html, body"),
4945			bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
4946			delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0),
4947			getOffset = UNCODE.get_scroll_offset(index);
4948		if ( typeof getSection.offset() === 'undefined' )
4949			return;
4950		scrollTo = getSection.offset().top;
4951
4952		// if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) {
4953		if  ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) {
4954			var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 36;
4955			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) {
4956				scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink );
4957			}
4958
4959			if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) {
4960				if ( index === 0 ) {
4961					scrollTo = 0;
4962				} else {
4963					scrollTo -= $('.menu-sticky .menu-container').outerHeight();
4964				}
4965			} else {
4966				scrollTo -= getOffset;
4967			}
4968		}
4969
4970		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
4971		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
4972
4973		if (index != 0) {
4974			UNCODE.scrolling = true;
4975		}
4976
4977		if (scrollSpeed == 0) {
4978			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
4979			UNCODE.scrolling = false;
4980		} else {
4981			body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
4982				$(this).stop();
4983			}).animate({
4984				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
4985			}, scrollSpeed, 'easeInOutCubic', function() {
4986				$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
4987				UNCODE.scrolling = false;
4988				if  ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) )
4989				||
4990				$('.menu-hided').length ) {
4991					scrollTo = getSection.offset().top;
4992					getOffset = UNCODE.get_scroll_offset(index);
4993					scrollTo -= getOffset;
4994					body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){
4995						$(this).stop();
4996					}).animate({
4997						scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
4998						}, scrollSpeed, 'easeInOutCubic', function() {
4999							$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove");
5000							UNCODE.scrolling = false;
5001						}
5002					);
5003				}
5004			});
5005		}
5006
5007	};
5008
5009	init_onepage();
5010};
5011
5012UNCODE.stickyElements = function() {
5013	var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024;
5014	if (!isMobile_wide) {
5015
5016		var $pageHeader = $('#page-header'),
5017			$headerRow = $('.vc_row', $pageHeader),
5018			startSticky = false;
5019
5020		if ( $headerRow.hasClass('sticky-element') ) {
5021			$headerRow.removeClass('sticky-element');
5022			$pageHeader.addClass('sticky-element');
5023			startSticky = true;
5024		}
5025
5026		var calculateOffset = function(el) {
5027			var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0,
5028				sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0,
5029				shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ?  $('.navbar-brand').data('padding-shrink')*2 : 0;
5030
5031			sideOffset += UNCODE.bodyBorder;
5032
5033			if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
5034			if ($('.menu-sticky .menu-container:not(.menu-hide)').length) {
5035				if ($('.menu-shrink').length) {
5036					sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink;
5037				} else {
5038					sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
5039				}
5040			}
5041
5042			return sideOffset;
5043
5044		},
5045
5046		initStickyElement = function() {
5047			$.each($('.sticky-element'), function(index, element) {
5048				if ($(element).closest('.tab-pane').length) {
5049					var $paneParent = $(element).closest('.tab-pane');
5050					if ( !$paneParent.hasClass('active') ) {
5051						return true;
5052					}
5053				}
5054				$(element).stick_in_parent({
5055					sticky_class: 'is_stucked',
5056					offset_top: calculateOffset(element),
5057					bottoming: true,
5058					inner_scrolling: SiteParameters.sticky_elements === 'on'
5059				});
5060			});
5061		};
5062
5063		requestTimeout(function() {
5064			if ($('.sticky-element').length) {
5065
5066				if ($(window).width() > UNCODE.mediaQuery) {
5067					initStickyElement();
5068
5069					if ( startSticky === true ) {
5070						$('#page-header').trigger('sticky_kit:recalc');
5071					}
5072				}
5073
5074				$(window).on('resize lateral_resize', function(event) {
5075					$(".sticky-element").trigger("sticky_kit:detach");
5076					if ($(window).width() > UNCODE.mediaQuery) {
5077						initStickyElement();
5078					}
5079				});
5080			}
5081		}, 1000);
5082
5083		if ($('.sticky-element').length) {
5084			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
5085				requestTimeout(function() {
5086					$(document.body).trigger("sticky_kit:recalc");
5087				}, 100);
5088			});
5089		}
5090
5091		var $panels = $('.panel-collapse');
5092		if ( $panels.length ) {
5093			$panels.each(function(){
5094				var $panel = $(this);
5095				$panel.on('shown.bs.collapse hidden.bs.collapse', function(){
5096					$(document.body).trigger("sticky_kit:recalc");
5097				});
5098			});
5099		}
5100
5101		$('.nav-tabs a').on('shown.bs.tab', function(e){
5102			var $tabs = $(e.target).closest('.tab-container'),
5103				$panel = $('.tab-pane.active', $tabs);
5104
5105			$(".sticky-element").trigger("sticky_kit:detach");
5106			initStickyElement();
5107	});
5108	}
5109};
5110
5111UNCODE.twentytwenty = function() {
5112
5113  if (!$('.twentytwenty-container').length) return;
5114
5115// DOM.event.move
5116//
5117// 2.0.0
5118//
5119// Stephen Band
5120//
5121// Triggers 'movestart', 'move' and 'moveend' events after
5122// mousemoves following a mousedown cross a distance threshold,
5123// similar to the native 'dragstart', 'drag' and 'dragend' events.
5124// Move events are throttled to animation frames. Move event objects
5125// have the properties:
5126//
5127// pageX:
5128// pageY:     Page coordinates of pointer.
5129// startX:
5130// startY:    Page coordinates of pointer at movestart.
5131// distX:
5132// distY:     Distance the pointer has moved since movestart.
5133// deltaX:
5134// deltaY:    Distance the finger has moved since last event.
5135// velocityX:
5136// velocityY: Average velocity over last few events.
5137
5138
5139(function(fn) {
5140	if (typeof define === 'function' && define.amd) {
5141        define([], fn);
5142    } else if ((typeof module !== "undefined" && module !== null) && module.exports) {
5143        module.exports = fn;
5144	} else {
5145		fn();
5146	}
5147})(function(){
5148	var assign = Object.assign || window.jQuery && jQuery.extend;
5149
5150	// Number of pixels a pressed pointer travels before movestart
5151	// event is fired.
5152	var threshold = 8;
5153
5154	// Shim for requestAnimationFrame, falling back to timer. See:
5155	// see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
5156	var requestFrame = (function(){
5157		return (
5158			window.requestAnimationFrame ||
5159			window.webkitRequestAnimationFrame ||
5160			window.mozRequestAnimationFrame ||
5161			window.oRequestAnimationFrame ||
5162			window.msRequestAnimationFrame ||
5163			function(fn, element){
5164				return window.setTimeout(function(){
5165					fn();
5166				}, 25);
5167			}
5168		);
5169	})();
5170
5171	// Shim for customEvent
5172	// see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
5173	(function () {
5174		if ( typeof window.CustomEvent === "function" ) return false;
5175		function CustomEvent ( event, params ) {
5176			params = params || { bubbles: false, cancelable: false, detail: undefined };
5177			var evt = document.createEvent( 'CustomEvent' );
5178			evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
5179			return evt;
5180		}
5181
5182		CustomEvent.prototype = window.Event.prototype;
5183		window.CustomEvent = CustomEvent;
5184	})();
5185
5186	var ignoreTags = {
5187			textarea: true,
5188			input: true,
5189			select: true,
5190			button: true
5191		};
5192
5193	var mouseevents = {
5194		move:   'mousemove',
5195		cancel: 'mouseup dragstart',
5196		end:    'mouseup'
5197	};
5198
5199	var touchevents = {
5200		move:   'touchmove',
5201		cancel: 'touchend',
5202		end:    'touchend'
5203	};
5204
5205	var rspaces = /\s+/;
5206
5207
5208	// DOM Events
5209
5210	var eventOptions = { bubbles: true, cancelable: true };
5211
5212	var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {};
5213
5214	function createEvent(type) {
5215		return new CustomEvent(type, eventOptions);
5216	}
5217
5218	function getEvents(node) {
5219		return node[eventsSymbol] || (node[eventsSymbol] = {});
5220	}
5221
5222	function on(node, types, fn, data, selector) {
5223		types = types.split(rspaces);
5224
5225		var events = getEvents(node);
5226		var i = types.length;
5227		var handlers, type;
5228
5229		function handler(e) { fn(e, data); }
5230
5231		while (i--) {
5232			type = types[i];
5233			handlers = events[type] || (events[type] = []);
5234			handlers.push([fn, handler]);
5235			node.addEventListener(type, handler);
5236		}
5237	}
5238
5239	function off(node, types, fn, selector) {
5240		types = types.split(rspaces);
5241
5242		var events = getEvents(node);
5243		var i = types.length;
5244		var type, handlers, k;
5245
5246		if (!events) { return; }
5247
5248		while (i--) {
5249			type = types[i];
5250			handlers = events[type];
5251			if (!handlers) { continue; }
5252			k = handlers.length;
5253			while (k--) {
5254				if (handlers[k][0] === fn) {
5255					node.removeEventListener(type, handlers[k][1]);
5256					handlers.splice(k, 1);
5257				}
5258			}
5259		}
5260	}
5261
5262	function trigger(node, type, properties) {
5263		// Don't cache events. It prevents you from triggering an event of a
5264		// given type from inside the handler of another event of that type.
5265		var event = createEvent(type);
5266		if (properties) { assign(event, properties); }
5267		node.dispatchEvent(event);
5268	}
5269
5270
5271	// Constructors
5272
5273	function Timer(fn){
5274		var callback = fn,
5275		    active = false,
5276		    running = false;
5277
5278		function trigger(time) {
5279			if (active){
5280				callback();
5281				requestFrame(trigger);
5282				running = true;
5283				active = false;
5284			}
5285			else {
5286				running = false;
5287			}
5288		}
5289
5290		this.kick = function(fn) {
5291			active = true;
5292			if (!running) { trigger(); }
5293		};
5294
5295		this.end = function(fn) {
5296			var cb = callback;
5297
5298			if (!fn) { return; }
5299
5300			// If the timer is not running, simply call the end callback.
5301			if (!running) {
5302				fn();
5303			}
5304			// If the timer is running, and has been kicked lately, then
5305			// queue up the current callback and the end callback, otherwise
5306			// just the end callback.
5307			else {
5308				callback = active ?
5309					function(){ cb(); fn(); } :
5310					fn ;
5311
5312				active = true;
5313			}
5314		};
5315	}
5316
5317
5318	// Functions
5319
5320	function noop() {}
5321
5322	function preventDefault(e) {
5323		e.preventDefault();
5324	}
5325
5326	function isIgnoreTag(e) {
5327		return !!ignoreTags[e.target.tagName.toLowerCase()];
5328	}
5329
5330	function isPrimaryButton(e) {
5331		// Ignore mousedowns on any button other than the left (or primary)
5332		// mouse button, or when a modifier key is pressed.
5333		return (e.which === 1 && !e.ctrlKey && !e.altKey);
5334	}
5335
5336	function identifiedTouch(touchList, id) {
5337		var i, l;
5338
5339		if (touchList.identifiedTouch) {
5340			return touchList.identifiedTouch(id);
5341		}
5342
5343		// touchList.identifiedTouch() does not exist in
5344		// webkit yet… we must do the search ourselves...
5345
5346		i = -1;
5347		l = touchList.length;
5348
5349		while (++i < l) {
5350			if (touchList[i].identifier === id) {
5351				return touchList[i];
5352			}
5353		}
5354	}
5355
5356	function changedTouch(e, data) {
5357		var touch = identifiedTouch(e.changedTouches, data.identifier);
5358
5359		// This isn't the touch you're looking for.
5360		if (!touch) { return; }
5361
5362		// Chrome Android (at least) includes touches that have not
5363		// changed in e.changedTouches. That's a bit annoying. Check
5364		// that this touch has changed.
5365		if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; }
5366
5367		return touch;
5368	}
5369
5370
5371	// Handlers that decide when the first movestart is triggered
5372
5373	function mousedown(e){
5374		// Ignore non-primary buttons
5375		if (!isPrimaryButton(e)) { return; }
5376
5377		// Ignore form and interactive elements
5378		if (isIgnoreTag(e)) { return; }
5379
5380		on(document, mouseevents.move, mousemove, e);
5381		on(document, mouseevents.cancel, mouseend, e);
5382	}
5383
5384	function mousemove(e, data){
5385		checkThreshold(e, data, e, removeMouse);
5386	}
5387
5388	function mouseend(e, data) {
5389		removeMouse();
5390	}
5391
5392	function removeMouse() {
5393		off(document, mouseevents.move, mousemove);
5394		off(document, mouseevents.cancel, mouseend);
5395	}
5396
5397	function touchstart(e) {
5398		// Don't get in the way of interaction with form elements
5399		if (ignoreTags[e.target.tagName.toLowerCase()]) { return; }
5400
5401		var touch = e.changedTouches[0];
5402
5403		// iOS live updates the touch objects whereas Android gives us copies.
5404		// That means we can't trust the touchstart object to stay the same,
5405		// so we must copy the data. This object acts as a template for
5406		// movestart, move and moveend event objects.
5407		var data = {
5408			target:     touch.target,
5409			pageX:      touch.pageX,
5410			pageY:      touch.pageY,
5411			identifier: touch.identifier,
5412
5413			// The only way to make handlers individually unbindable is by
5414			// making them unique.
5415			touchmove:  function(e, data) { touchmove(e, data); },
5416			touchend:   function(e, data) { touchend(e, data); }
5417		};
5418
5419		on(document, touchevents.move, data.touchmove, data);
5420		on(document, touchevents.cancel, data.touchend, data);
5421	}
5422
5423	function touchmove(e, data) {
5424		var touch = changedTouch(e, data);
5425		if (!touch) { return; }
5426		checkThreshold(e, data, touch, removeTouch);
5427	}
5428
5429	function touchend(e, data) {
5430		var touch = identifiedTouch(e.changedTouches, data.identifier);
5431		if (!touch) { return; }
5432		removeTouch(data);
5433	}
5434
5435	function removeTouch(data) {
5436		off(document, touchevents.move, data.touchmove);
5437		off(document, touchevents.cancel, data.touchend);
5438	}
5439
5440	function checkThreshold(e, data, touch, fn) {
5441		var distX = touch.pageX - data.pageX;
5442		var distY = touch.pageY - data.pageY;
5443
5444		// Do nothing if the threshold has not been crossed.
5445		if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
5446
5447		triggerStart(e, data, touch, distX, distY, fn);
5448	}
5449
5450	function triggerStart(e, data, touch, distX, distY, fn) {
5451		var touches = e.targetTouches;
5452		var time = e.timeStamp - data.timeStamp;
5453
5454		// Create a movestart object with some special properties that
5455		// are passed only to the movestart handlers.
5456		var template = {
5457			altKey:     e.altKey,
5458			ctrlKey:    e.ctrlKey,
5459			shiftKey:   e.shiftKey,
5460			startX:     data.pageX,
5461			startY:     data.pageY,
5462			distX:      distX,
5463			distY:      distY,
5464			deltaX:     distX,
5465			deltaY:     distY,
5466			pageX:      touch.pageX,
5467			pageY:      touch.pageY,
5468			velocityX:  distX / time,
5469			velocityY:  distY / time,
5470			identifier: data.identifier,
5471			targetTouches: touches,
5472			finger: touches ? touches.length : 1,
5473			enableMove: function() {
5474				this.moveEnabled = true;
5475				this.enableMove = noop;
5476				e.preventDefault();
5477			}
5478		};
5479
5480		// Trigger the movestart event.
5481		trigger(data.target, 'movestart', template);
5482
5483		// Unbind handlers that tracked the touch or mouse up till now.
5484		fn(data);
5485	}
5486
5487
5488	// Handlers that control what happens following a movestart
5489
5490	function activeMousemove(e, data) {
5491		var timer  = data.timer;
5492
5493		data.touch = e;
5494		data.timeStamp = e.timeStamp;
5495		timer.kick();
5496	}
5497
5498	function activeMouseend(e, data) {
5499		var target = data.target;
5500		var event  = data.event;
5501		var timer  = data.timer;
5502
5503		removeActiveMouse();
5504
5505		endEvent(target, event, timer, function() {
5506			// Unbind the click suppressor, waiting until after mouseup
5507			// has been handled.
5508			setTimeout(function(){
5509				off(target, 'click', preventDefault);
5510			}, 0);
5511		});
5512	}
5513
5514	function removeActiveMouse() {
5515		off(document, mouseevents.move, activeMousemove);
5516		off(document, mouseevents.end, activeMouseend);
5517	}
5518
5519	function activeTouchmove(e, data) {
5520		var event = data.event;
5521		var timer = data.timer;
5522		var touch = changedTouch(e, event);
5523
5524		if (!touch) { return; }
5525
5526		// Stop the interface from gesturing
5527		e.preventDefault();
5528
5529		event.targetTouches = e.targetTouches;
5530		data.touch = touch;
5531		data.timeStamp = e.timeStamp;
5532
5533		timer.kick();
5534	}
5535
5536	function activeTouchend(e, data) {
5537		var target = data.target;
5538		var event  = data.event;
5539		var timer  = data.timer;
5540		var touch  = identifiedTouch(e.changedTouches, event.identifier);
5541
5542		// This isn't the touch you're looking for.
5543		if (!touch) { return; }
5544
5545		removeActiveTouch(data);
5546		endEvent(target, event, timer);
5547	}
5548
5549	function removeActiveTouch(data) {
5550		off(document, touchevents.move, data.activeTouchmove);
5551		off(document, touchevents.end, data.activeTouchend);
5552	}
5553
5554
5555	// Logic for triggering move and moveend events
5556
5557	function updateEvent(event, touch, timeStamp) {
5558		var time = timeStamp - event.timeStamp;
5559
5560		event.distX =  touch.pageX - event.startX;
5561		event.distY =  touch.pageY - event.startY;
5562		event.deltaX = touch.pageX - event.pageX;
5563		event.deltaY = touch.pageY - event.pageY;
5564
5565		// Average the velocity of the last few events using a decay
5566		// curve to even out spurious jumps in values.
5567		event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
5568		event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
5569		event.pageX =  touch.pageX;
5570		event.pageY =  touch.pageY;
5571	}
5572
5573	function endEvent(target, event, timer, fn) {
5574		timer.end(function(){
5575			trigger(target, 'moveend', event);
5576			return fn && fn();
5577		});
5578	}
5579
5580
5581	// Set up the DOM
5582
5583	function movestart(e) {
5584		if (e.defaultPrevented) { return; }
5585		if (!e.moveEnabled) { return; }
5586
5587		var event = {
5588			startX:        e.startX,
5589			startY:        e.startY,
5590			pageX:         e.pageX,
5591			pageY:         e.pageY,
5592			distX:         e.distX,
5593			distY:         e.distY,
5594			deltaX:        e.deltaX,
5595			deltaY:        e.deltaY,
5596			velocityX:     e.velocityX,
5597			velocityY:     e.velocityY,
5598			identifier:    e.identifier,
5599			targetTouches: e.targetTouches,
5600			finger:        e.finger
5601		};
5602
5603		var data = {
5604			target:    e.target,
5605			event:     event,
5606			timer:     new Timer(update),
5607			touch:     undefined,
5608			timeStamp: e.timeStamp
5609		};
5610
5611		function update(time) {
5612			updateEvent(event, data.touch, data.timeStamp);
5613			trigger(data.target, 'move', event);
5614		}
5615
5616		if (e.identifier === undefined) {
5617			// We're dealing with a mouse event.
5618			// Stop clicks from propagating during a move
5619			on(e.target, 'click', preventDefault);
5620			on(document, mouseevents.move, activeMousemove, data);
5621			on(document, mouseevents.end, activeMouseend, data);
5622		}
5623		else {
5624			// In order to unbind correct handlers they have to be unique
5625			data.activeTouchmove = function(e, data) { activeTouchmove(e, data); };
5626			data.activeTouchend = function(e, data) { activeTouchend(e, data); };
5627
5628			// We're dealing with a touch.
5629			on(document, touchevents.move, data.activeTouchmove, data);
5630			on(document, touchevents.end, data.activeTouchend, data);
5631		}
5632	}
5633
5634	on(document, 'mousedown', mousedown);
5635	on(document, 'touchstart', touchstart);
5636	on(document, 'movestart', movestart);
5637
5638
5639	// jQuery special events
5640	//
5641	// jQuery event objects are copies of DOM event objects. They need
5642	// a little help copying the move properties across.
5643
5644	if (!window.jQuery) { return; }
5645
5646	var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' ');
5647
5648	function enableMove1(e) { e.enableMove(); }
5649	function enableMove2(e) { e.enableMove(); }
5650	function enableMove3(e) { e.enableMove(); }
5651
5652	function add(handleObj) {
5653		var handler = handleObj.handler;
5654
5655		handleObj.handler = function(e) {
5656			// Copy move properties across from originalEvent
5657			var i = properties.length;
5658			var property;
5659
5660			while(i--) {
5661				property = properties[i];
5662				e[property] = e.originalEvent[property];
5663			}
5664
5665			handler.apply(this, arguments);
5666		};
5667	}
5668
5669	jQuery.event.special.movestart = {
5670		setup: function() {
5671			// Movestart must be enabled to allow other move events
5672			on(this, 'movestart', enableMove1);
5673
5674			// Do listen to DOM events
5675			return false;
5676		},
5677
5678		teardown: function() {
5679			off(this, 'movestart', enableMove1);
5680			return false;
5681		},
5682
5683		add: add
5684	};
5685
5686	jQuery.event.special.move = {
5687		setup: function() {
5688			on(this, 'movestart', enableMove2);
5689			return false;
5690		},
5691
5692		teardown: function() {
5693			off(this, 'movestart', enableMove2);
5694			return false;
5695		},
5696
5697		add: add
5698	};
5699
5700	jQuery.event.special.moveend = {
5701		setup: function() {
5702			on(this, 'movestart', enableMove3);
5703			return false;
5704		},
5705
5706		teardown: function() {
5707			off(this, 'movestart', enableMove3);
5708			return false;
5709		},
5710
5711		add: add
5712	};
5713});
5714
5715  $.fn.twentytwenty = function(options) {
5716    var options = $.extend({
5717      default_offset_pct: 0.5,
5718      orientation: 'horizontal',
5719      before_label: 'Before',
5720      after_label: 'After',
5721      no_overlay: false,
5722      move_slider_on_hover: false,
5723      move_with_handle_only: true,
5724      click_to_move: false
5725    }, options);
5726
5727    return this.each(function() {
5728
5729      var sliderPct = options.default_offset_pct;
5730      var container = $(this);
5731      var sliderOrientation = options.orientation;
5732      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
5733      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
5734
5735
5736      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
5737      if(!options.no_overlay) {
5738        container.append("<div class='twentytwenty-overlay'></div>");
5739        var overlay = container.find(".twentytwenty-overlay");
5740        overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>");
5741        overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>");
5742      }
5743      var beforeImg = container.find("img:first");
5744      var afterImg = container.find("img:last");
5745      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
5746      var slider = container.find(".twentytwenty-handle");
5747      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
5748      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
5749      container.addClass("twentytwenty-container");
5750      beforeImg.addClass("twentytwenty-before");
5751      afterImg.addClass("twentytwenty-after");
5752
5753      var calcOffset = function(dimensionPct) {
5754        var w = beforeImg.width();
5755        var h = beforeImg.height();
5756        return {
5757          w: w+"px",
5758          h: h+"px",
5759          cw: (dimensionPct*w)+"px",
5760          ch: (dimensionPct*h)+"px"
5761        };
5762      };
5763
5764      var adjustContainer = function(offset) {
5765      	if (sliderOrientation === 'vertical') {
5766          beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
5767          afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)");
5768      	}
5769      	else {
5770          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
5771          afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")");
5772    	}
5773        container.css("height", offset.h);
5774      };
5775
5776      var adjustSlider = function(pct) {
5777        var offset = calcOffset(pct);
5778        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
5779        adjustContainer(offset);
5780      };
5781
5782      // Return the number specified or the min/max number if it outside the range given.
5783      var minMaxNumber = function(num, min, max) {
5784        return Math.max(min, Math.min(max, num));
5785      };
5786
5787      // Calculate the slider percentage based on the position.
5788      var getSliderPercentage = function(positionX, positionY) {
5789        var sliderPercentage = (sliderOrientation === 'vertical') ?
5790          (positionY-offsetY)/imgHeight :
5791          (positionX-offsetX)/imgWidth;
5792
5793        return minMaxNumber(sliderPercentage, 0, 1);
5794      };
5795
5796
5797      $(window).on("resize.twentytwenty", function(e) {
5798        adjustSlider(sliderPct);
5799      });
5800
5801      var offsetX = 0;
5802      var offsetY = 0;
5803      var imgWidth = 0;
5804      var imgHeight = 0;
5805      var onMoveStart = function(e) {
5806        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
5807          e.preventDefault();
5808        }
5809        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
5810          e.preventDefault();
5811        }
5812        container.addClass("active");
5813        offsetX = container.offset().left;
5814        offsetY = container.offset().top;
5815        imgWidth = beforeImg.width();
5816        imgHeight = beforeImg.height();
5817      };
5818      var onMove = function(e) {
5819        if (container.hasClass("active")) {
5820          sliderPct = getSliderPercentage(e.pageX, e.pageY);
5821          adjustSlider(sliderPct);
5822        }
5823      };
5824      var onMoveEnd = function() {
5825          container.removeClass("active");
5826      };
5827
5828      var moveTarget = options.move_with_handle_only ? slider : container;
5829      moveTarget.on("movestart",onMoveStart);
5830      moveTarget.on("move",onMove);
5831      moveTarget.on("moveend",onMoveEnd);
5832
5833      if (options.move_slider_on_hover) {
5834        container.on("mouseenter", onMoveStart);
5835        container.on("mousemove", onMove);
5836        container.on("mouseleave", onMoveEnd);
5837      }
5838
5839      slider.on("touchmove", function(e) {
5840        e.preventDefault();
5841      });
5842
5843      container.find("img").on("mousedown", function(event) {
5844        event.preventDefault();
5845      });
5846
5847      if (options.click_to_move) {
5848        container.on('click', function(e) {
5849          offsetX = container.offset().left;
5850          offsetY = container.offset().top;
5851          imgWidth = beforeImg.width();
5852          imgHeight = beforeImg.height();
5853
5854          sliderPct = getSliderPercentage(e.pageX, e.pageY);
5855          adjustSlider(sliderPct);
5856        });
5857      }
5858
5859      $(window).trigger("resize.twentytwenty");
5860    });
5861  };
5862
5863
5864  $(window).on("load", function(e) {
5865  	$('.twentytwenty-container').each(function(){
5866  		var $container = $(this);
5867  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
5868  			$container.twentytwenty();
5869  		}
5870  		$('img', $container).on('async-done', function(){
5871	  		if ( ! $('.twentytwenty-wrapper', $container).length ) {
5872	  			$container.twentytwenty();
5873	  		}
5874	    });
5875  	});
5876  });
5877}
5878
5879UNCODE.justifiedGallery = function() {
5880
5881	var breakPointMe = function( val ) {
5882		val = parseInt( val );
5883		if ( isNaN(val) ) {
5884			return false;
5885		}
5886		if ( val >= 1500 ) {
5887			return 1;
5888		} else if ( val < 1500 && val >= 960 ) {
5889			return 2;
5890		} else if ( val < 960 && val >= 570 ) {
5891			return 3;
5892		} else if ( val < 570 ) {
5893			return 4;
5894		}
5895	}
5896
5897	var gutterByBreakpoint = function( bp, gutter ) {
5898		var ret;
5899		switch(gutter) {
5900		    case 'no-gutter':
5901		    	ret = 0;
5902		        break;
5903		    case 'px-gutter':
5904		    	ret = 1;
5905		        break;
5906		    case 'half-gutter':
5907		    	ret = 18;
5908		        break;
5909		    case 'double-gutter':
5910				switch(bp) {
5911				    case 3:
5912				    case 4:
5913				    	ret = 36;
5914				        break;
5915				    default:
5916				    	ret = 72;
5917				        break;
5918				}
5919		        break;
5920		    case 'triple-gutter':
5921				switch(bp) {
5922				    case 3:
5923				    case 4:
5924				    	ret = 36;
5925				        break;
5926				    default:
5927				    	ret = 108;
5928				        break;
5929				}
5930		        break;
5931		    case 'quad-gutter':
5932				switch(bp) {
5933				    case 2:
5934				    	ret = 108;
5935				        break;
5936				    case 3:
5937				    	ret = 72;
5938				        break;
5939				    case 4:
5940				    	ret = 36;
5941				        break;
5942				    default:
5943				    	ret = 144;
5944				        break;
5945				}
5946		        break;
5947		    default:
5948		    	ret = 36;//single-gutter
5949		}
5950		return ret;
5951	}
5952
5953	if ($('.justified-layout').length > 0) {
5954		var justifiedContainersArray = [],
5955			typeGridArray = [],
5956			layoutGridArray = [],
5957			transitionDuration = [],
5958			$filterItems = [],
5959			$filters = $('.justified-system .isotope-filters'),
5960			$itemSelector = '.tmb',
5961			$items,
5962			itemMargin,
5963			correctionFactor = 0,
5964			firstLoad = true,
5965			isOriginLeft = $('body').hasClass('rtl') ? false : true,
5966			prevW = breakPointMe(UNCODE.wwidth);
5967		$('[class*="justified-container"]').each(function() {
5968			var isoData = $(this).data();
5969			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
5970			if (isoData.type == 'metro') typeGridArray.push(true);
5971			else typeGridArray.push(false);
5972			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
5973			else layoutGridArray.push('justified');
5974			justifiedContainersArray.push($(this));
5975		});
5976		var init_justifiedGallery = function() {
5977			for (var i = 0, len = justifiedContainersArray.length; i < len; i++) {
5978				var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')),
5979					justifiedId = justifiedSystem.attr('id'),
5980					$layoutMode = layoutGridArray[i],
5981					gutter = $(justifiedContainersArray[i]).data('gutter'),
5982					rowHeight = $(justifiedContainersArray[i]).data('row-height'),
5983					maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'),
5984					lastRow = $(justifiedContainersArray[i]).data('last-row'),
5985					margins;
5986
5987				rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight);
5988				maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight);
5989				lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
5990
5991				margins = gutterByBreakpoint(prevW, gutter);
5992
5993				$(justifiedContainersArray[i]).justifiedGallery({
5994					rowHeight: rowHeight,
5995					maxRowHeight: maxRowHeight,
5996					margins: margins,
5997					cssAnimation: true,
5998					lastRow: lastRow,
5999					waitThumbnailsLoad: false
6000				}).one('jg.complete', function(){ onLayout($(this), 0); } );
6001
6002				if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) {
6003					$(justifiedContainersArray[i]).infinitescroll({
6004							navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container
6005							nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6006							itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve
6007							animate: false,
6008							behavior: 'local',
6009							debug: false,
6010							loading: {
6011								selector: '#' + justifiedId + '.justified-system .justified-footer-inner',
6012								speed: 0,
6013								finished: undefined,
6014								msg: $('#' + justifiedId + ' .loadmore-button'),
6015							},
6016							errorCallback: function() {
6017								var justified_system = $(this).closest('.justified-system');
6018								$('.loading-button', justified_system).hide();
6019								$('.loadmore-button', justified_system).attr('style', 'display:none !important');
6020							}
6021						},
6022						// append the new items to galleryJustified on the infinitescroll callback function.
6023						function(newElements, opts) {
6024							var $galleryJustified = $(this),
6025								justifiedId = $galleryJustified.closest('.justified-system').attr('id'),
6026								filters = new Array(),
6027								$loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'),
6028								$infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'),
6029								$numPages = $('a', $infinite_button).data('pages'),
6030								delay = 300;
6031							$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6032							$infinite_button.show();
6033							$loading_button.hide();
6034							if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6035							$('> li', $galleryJustified).remove();
6036							$.each($(newElements), function(index, val) {
6037								$(val).addClass('tmb-iso');
6038								if ($(val).is("li")) {
6039									filters.push($(val)[0]);
6040								}
6041							});
6042							newElements = newElements.filter(function(x) {
6043								return filters.indexOf(x) < 0
6044							});
6045							$.each($(filters), function(index, val) {
6046								if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val));
6047							});
6048							$galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length));
6049							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6050								var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId];
6051								if (typeof getLightbox === 'object') {
6052									getLightbox.refresh();
6053								} else {
6054									UNCODE.lightbox();
6055								}
6056							}
6057							if ( typeof twttr !== 'undefined' )
6058								twttr.widgets.load(justifiedContainersArray[i]);
6059
6060							requestTimeout(function() {
6061								$galleryJustified.trigger('more-items-loaded');
6062							}, 1000);
6063						});
6064					if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) {
6065						var $infinite_justified = $(justifiedContainersArray[i]),
6066							$infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a');
6067						$infinite_justified.infinitescroll('pause');
6068						$infinite_button.on('click', function(event) {
6069							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6070								$.each(UNCODE.lightboxArray, function(index, val) {
6071									UNCODE.lightboxArray[index].destroy();
6072								});
6073							}
6074							event.preventDefault();
6075							var $justified_system = $(event.target).closest('.justified-system'),
6076							$infinite_justified = $justified_system.find('.justified-container'),
6077							justifiedId = $justified_system.attr('id');
6078							$(event.currentTarget).html(SiteParameters.loading);
6079							$infinite_justified.infinitescroll('resume');
6080							$infinite_justified.infinitescroll('retrieve');
6081							$infinite_justified.infinitescroll('pause');
6082							$infinite_justified.trigger('more-items-loaded');
6083						});
6084					}
6085				}
6086			}
6087		},
6088		onLayout = function(justifiedObj, startIndex) {
6089			justifiedObj.css('opacity', 1);
6090			justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1);
6091			$('.tmb', justifiedObj).addClass('justified-object-loaded');
6092
6093			requestTimeout(function() {
6094				// window.dispatchEvent(UNCODE.boxEvent);
6095				UNCODE.adaptive();
6096				if (SiteParameters.dynamic_srcset_active === '1') {
6097					UNCODE.refresh_dynamic_srcset_size(justifiedObj);
6098				}
6099				if (typeof MediaElement === "function") {
6100					$(justifiedObj).find('audio,video').each(function() {
6101						$(this).mediaelementplayer({
6102								pauseOtherPlayers: false,
6103						});
6104					});
6105				}
6106				if ($(justifiedObj).find('.nested-carousel').length) {
6107					if (typeof UNCODE.carousel !== 'undefined') {
6108						UNCODE.carousel($(justifiedObj).find('.nested-carousel'));
6109					}
6110					requestTimeout(function() {
6111						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6112						justifiedObj.addClass('justified-gallery-finished')
6113						Waypoint.refreshAll();
6114					}, 200);
6115				} else {
6116					requestTimeout(function() {
6117						boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj);
6118						justifiedObj.addClass('justified-gallery-finished')
6119						Waypoint.refreshAll();
6120					}, 300);
6121				}
6122			}, 100);
6123
6124		},
6125		boxAnimation = function(items, startIndex, sequential, container) {
6126			var $allItems = items.length - startIndex,
6127				showed = 0,
6128				index = 0;
6129			if (container.closest('.owl-item').length == 1) return false;
6130			$.each(items, function(index, val) {
6131				var elInner = $('> .t-inside', val);
6132				if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) {
6133					return;
6134				}
6135				if (val[0]) val = val[0];
6136				if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
6137					new Waypoint({
6138						context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
6139						element: val,
6140						handler: function() {
6141							var element = $('> .t-inside', this.element),
6142								parent = $(this.element),
6143								currentIndex = parent.index();
6144							var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
6145								delayAttr = parseInt(element.attr('data-delay'));
6146							if (isNaN(delayAttr)) delayAttr = 100;
6147							delay -= showed;
6148							var objTimeout = requestTimeout(function() {
6149								element.removeClass('zoom-reverse').addClass('start_animation');
6150								showed = parent.index();
6151							}, delay * delayAttr);
6152							parent.data('objTimeout', objTimeout);
6153							if (!UNCODE.isUnmodalOpen) {
6154								this.destroy();
6155							}
6156						},
6157						offset: '100%'
6158					})
6159				} else {
6160					elInner.removeClass('animate_when_almost_visible');
6161					$(val).addClass('no-waypoint-animation');
6162					/*if (elInner.hasClass('force-anim')) {
6163						elInner.addClass('start_animation');
6164					} else {
6165						elInner.css('opacity', 1);
6166					}*/
6167				}
6168				index++;
6169			});
6170		};
6171		$filters.on('click', 'a[data-filter]', function(evt) {
6172			var $filter = $(this),
6173				filterContainer = $filter.closest('.isotope-filters'),
6174				filterValue = $filter.attr('data-filter'),
6175				container = $filter.closest('.justified-system').find($('.justified-layout')),
6176				lastRow = container.data('last-row'),
6177				transitionDuration = 0,
6178				delay = 300,
6179				filterItems = [];
6180
6181			lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow;
6182
6183			var filter_items = function(){
6184				if (filterValue !== undefined) {
6185					$.each($('> .tmb > .t-inside', container), function(index, val) {
6186						var parent = $(val).parent(),
6187							objTimeout = parent.data('objTimeout');
6188						if (objTimeout) {
6189							$(val).removeClass('zoom-reverse');
6190							clearRequestTimeout(objTimeout);
6191						}
6192						if (transitionDuration == 0) {
6193							if ($(val).hasClass('animate_when_almost_visible')) {
6194								$(val).addClass('zoom-reverse').removeClass('start_animation');
6195							} else {
6196								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6197							}
6198						}
6199					});
6200
6201					requestTimeout(function() {
6202						var $block,
6203							selector,
6204							lightboxElements,
6205							$boxes;
6206
6207						if ( filterValue !== '' && filterValue !== '*' ) {
6208							$('[data-lbox^=ilightbox]', container).addClass('lb-disabled');
6209							selector = '.' + filterValue;
6210							$.each($(selector, container), function(index, block) {
6211								lightboxElements = $('[data-lbox^=ilightbox]', block);
6212								if (lightboxElements.length) {
6213									lightboxElements.removeClass('lb-disabled');
6214									container.data('lbox', $(lightboxElements[0]).data('lbox'));
6215								}
6216								filterItems.push(block);
6217							});
6218							container.justifiedGallery({
6219								filter: selector,
6220								lastRow: 'nojustify'
6221							});
6222						} else {
6223							container.justifiedGallery({
6224								filter: false,
6225								lastRow: lastRow
6226							});
6227							$('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled');
6228							filterItems = $('> .tmb', container);
6229						}
6230						container.trigger('more-items-loaded');
6231
6232						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6233						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6234							var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
6235							if (typeof getLightbox === 'object') {
6236								getLightbox.refresh();
6237							} else {
6238								UNCODE.lightbox();
6239							}
6240						}
6241
6242						if (transitionDuration == 0) {
6243							requestTimeout(function() {
6244								boxAnimation(filterItems, 0, false, container);
6245							}, 100);
6246						}
6247						requestTimeout(function() {
6248							Waypoint.refreshAll();
6249							container.trigger('more-items-loaded');
6250						}, 2000);
6251
6252					}, delay);
6253				} else {
6254					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6255						$.each(UNCODE.lightboxArray, function(index, val) {
6256							UNCODE.lightboxArray[index].destroy();
6257						});
6258					}
6259					$.each($('> .tmb > .t-inside', container), function(index, val) {
6260						var parent = $(val).parent(),
6261							objTimeout = parent.data('objTimeout');
6262						if (objTimeout) {
6263							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6264							clearRequestTimeout(objTimeout);
6265						}
6266						if (transitionDuration == 0) {
6267							if ($(val).hasClass('animate_when_almost_visible')) {
6268								$(val).addClass('zoom-reverse').removeClass('start_animation');
6269							} else {
6270								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6271							}
6272						}
6273					});
6274					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6275						UNCODE.lightbox();
6276					}
6277					container.parent().addClass('justified-loading');
6278					container.trigger('more-items-loaded');
6279				}
6280			};
6281
6282			if (!$filter.hasClass('active')) {
6283				/** Scroll top with filtering */
6284				if (filterContainer.hasClass('filter-scroll')) {
6285                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6286                    calc_scroll -= UNCODE.get_scroll_offset();
6287
6288					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6289						delta = bodyTop - calc_scroll,
6290						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6291						filterTolerance = false,
6292						filter_timeout;
6293					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6294
6295					if ( !UNCODE.isFullPage ) {
6296						if (scrollSpeed == 0) {
6297							$('html, body').scrollTop(calc_scroll);
6298							UNCODE.scrolling = false;
6299							filter_items();
6300						} else {
6301
6302							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6303								filter_items();
6304								filterTolerance = true;
6305							}
6306
6307							$('html, body').animate({
6308								scrollTop: calc_scroll
6309							},{
6310								easing: 'easeInOutQuad',
6311								duration: scrollSpeed,
6312								complete: function(){
6313									UNCODE.scrolling = false;
6314									if ( !filterTolerance ) {
6315										filter_timeout = setTimeout(function(){
6316											clearTimeout(filter_timeout);
6317											filter_items();
6318										}, 200);
6319									}
6320								}
6321							});
6322						}
6323					}
6324				} else {
6325					filter_items();
6326				}
6327			}
6328			evt.preventDefault();
6329		});
6330
6331		$filters.each(function(i, buttonGroup) {
6332			var $buttonGroup = $(buttonGroup);
6333			$buttonGroup.on('click', 'a', function() {
6334				$buttonGroup.find('.active').removeClass('active');
6335				$(this).addClass('active');
6336			});
6337
6338			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6339				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6340				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6341			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6342				e.preventDefault();
6343				$cats_filters.slideToggle(400, 'easeInOutCirc');
6344			});
6345		});
6346		window.addEventListener('boxResized', function(e) {
6347			if ( prevW !== breakPointMe(UNCODE.wwidth) ) {
6348				prevW = breakPointMe(UNCODE.wwidth);
6349				$.each($('.justified-layout'), function(index, val) {
6350					var gutter = $(this).data('gutter'),
6351						margins = gutterByBreakpoint( prevW, gutter);
6352					$(this).justifiedGallery({
6353						margins: margins
6354					});
6355					$(this).find('.mejs-video,.mejs-audio').each(function() {
6356						$(this).trigger('resize');
6357					});
6358				});
6359			}
6360		}, false);
6361
6362		init_justifiedGallery();
6363	};
6364};
6365
6366UNCODE.cssGrid = function() {
6367	if ($('.cssgrid-layout').length > 0) {
6368		var cssGridContainersArray = [];
6369		var transitionDuration = [];
6370		var $filters = $('.cssgrid-system .cssgrid-filters');
6371
6372		$('[class*="cssgrid-container"]').each(function() {
6373			cssGridContainersArray.push($(this));
6374			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
6375		});
6376
6377		var init_cssGridAjax = function() {
6378			for (var i = 0, len = cssGridContainersArray.length; i < len; i++) {
6379				var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')),
6380					cssGridId = cssGridSystem.attr('id');
6381
6382				cssGridSystem.data('transitionDuration', transitionDuration[i]);
6383
6384				if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) {
6385					$(cssGridContainersArray[i]).infinitescroll({
6386						navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container
6387						nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
6388						itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat', // selector for all items you'll retrieve
6389						animate: false,
6390						behavior: 'local',
6391						debug: false,
6392						loading: {
6393							selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner',
6394							speed: 0,
6395							finished: undefined,
6396							msg: $('#' + cssGridId + ' .loadmore-button'),
6397						},
6398						errorCallback: function() {
6399							var cssgrid_system = $(this).closest('.cssgrid-system');
6400							$('.loading-button', cssgrid_system).hide();
6401							$('.loadmore-button', cssgrid_system).attr('style', 'display:none !important');
6402						}
6403					},
6404					// append the new items to cssGrid on the infinitescroll callback function.
6405					function(newElements, opts) {
6406						var $cssGrid = $(this),
6407							cssGridSystemCont = $cssGrid.closest('.cssgrid-system'),
6408							cssGridId = cssGridSystemCont.attr('id'),
6409							filters = new Array(),
6410							$loading_button = $cssGrid.closest('.cssgrid-system').find('.loading-button'),
6411							$infinite_button = $cssGrid.closest('.cssgrid-system').find('.loadmore-button'),
6412							$numPages = $('a', $infinite_button).data('pages'),
6413							delay = 300;
6414						$('a', $infinite_button).html($('a', $infinite_button).data('label'));
6415						$infinite_button.show();
6416						$loading_button.hide();
6417						if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
6418						$('> li', $cssGrid).remove();
6419						$.each($(newElements), function(index, val) {
6420							$(val).addClass('tmb-grid');
6421							if ($(val).is("li")) {
6422								filters.push($(val)[0]);
6423							}
6424						});
6425						newElements = newElements.filter(function(x) {
6426							return filters.indexOf(x) < 0
6427						});
6428						$.each($(filters), function(index, val) {
6429							if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val));
6430						});
6431
6432						var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6433						var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false;
6434						if (filterValue !== undefined && filterValue != '*') {
6435							$(newElements).hide();
6436							var els_to_show = $();
6437							$(newElements).each(function() {
6438								var el = $(this);
6439								if (el.hasClass(filterValue)) {
6440									els_to_show = els_to_show.add(el);
6441									el.show();
6442								}
6443							});
6444							UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true);
6445						} else {
6446							UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true);
6447						}
6448
6449						UNCODE.adaptive();
6450						if (SiteParameters.dynamic_srcset_active === '1') {
6451							UNCODE.refresh_dynamic_srcset_size($cssGrid);
6452						}
6453						if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6454							var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId];
6455							if (typeof getLightbox === 'object') {
6456								getLightbox.refresh();
6457							} else {
6458								UNCODE.lightbox();
6459							}
6460						}
6461						if ( typeof twttr !== 'undefined' ) {
6462							twttr.widgets.load(cssGridContainersArray[i]);
6463						}
6464
6465						UNCODE.carousel($(newElements));
6466						requestTimeout(function() {
6467							$cssGrid.trigger('more-items-loaded');
6468						}, 1000);
6469
6470					});
6471					if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) {
6472						var $cssgrid_el = $(cssGridContainersArray[i]),
6473							$infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a');
6474						$cssgrid_el.infinitescroll('pause');
6475						$infinite_button.on('click', function(event) {
6476							event.preventDefault();
6477							var $cssgrid_system = $(event.target).closest('.cssgrid-system'),
6478							$cssgrid_el = $cssgrid_system.find('.cssgrid-container'),
6479							cssGridId = $cssgrid_system.attr('id');
6480							$(event.currentTarget).html(SiteParameters.loading);
6481							$cssgrid_el.infinitescroll('resume');
6482							$cssgrid_el.infinitescroll('retrieve');
6483							$cssgrid_el.infinitescroll('pause');
6484						});
6485					}
6486				}
6487			}
6488		};
6489
6490		init_cssGridAjax();
6491
6492		if ($('.cssgrid-pagination').length > 0) {
6493			$('.cssgrid-system').on('click', '.pagination a', function(evt) {
6494				evt.preventDefault();
6495
6496                var container = $(this).closest('.cssgrid-system'),
6497				calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6498
6499                calc_scroll -= UNCODE.get_scroll_offset();
6500
6501				var menu_container = $('.menu-sticky');
6502				var menu = menu_container.find('.menu-container');
6503
6504				if (menu_container.length > 0 && menu.length > 0) {
6505					calc_scroll = calc_scroll - menu.outerHeight();
6506				}
6507
6508				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6509					delta = bodyTop - calc_scroll,
6510					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6511				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6512
6513				if ( !UNCODE.isFullPage ) {
6514					if (scrollSpeed == 0) {
6515						$('html, body').scrollTop(calc_scroll);
6516					} else {
6517						$('html, body').animate({
6518							scrollTop: calc_scroll
6519						},{
6520							easing: 'easeInOutQuad',
6521							duration: scrollSpeed,
6522							complete: function(){
6523								UNCODE.scrolling = false;
6524							}
6525						});
6526					}
6527				}
6528
6529				loadCssGrid($(this), true);
6530				evt.preventDefault();
6531			});
6532		}
6533
6534		$filters.on('click', 'a.grid-nav-link', function(evt) {
6535			if ($(this).hasClass('no-grid-filter')) {
6536				return;
6537			}
6538			var $filter = $(this),
6539				filterContainer = $filter.closest('.cssgrid-filters'),
6540				filterValue = $filter.attr('data-filter'),
6541				containerSystem = $filter.closest('.cssgrid-system'),
6542				container = containerSystem.find($('.cssgrid-layout')),
6543				transitionDuration = containerSystem.data('transitionDuration'),
6544				delay = 300,
6545				filterItems = [],
6546				all_thumbs = container.find('.tmb-grid');
6547
6548			var filter_items = function(){
6549				if (filterValue !== undefined) {
6550					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
6551						var parent = $(val).parent(),
6552							objTimeout = parent.data('objTimeout');
6553						if (objTimeout) {
6554							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6555							clearRequestTimeout(objTimeout);
6556						}
6557						if (transitionDuration == 0) {
6558							if ($(val).hasClass('animate_when_almost_visible')) {
6559								$(val).addClass('zoom-reverse').removeClass('start_animation');
6560							} else {
6561								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6562							}
6563						}
6564					});
6565					requestTimeout(function(){
6566						if ( filterValue == '*' ) {
6567							all_thumbs.show();
6568							all_thumbs.each(function(index, val) {
6569								$(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
6570								filterItems.push($(this));
6571							});
6572						} else {
6573							all_thumbs.each(function() {
6574								var _tmb = $(this);
6575								if (_tmb.hasClass(filterValue)) {
6576									_tmb.show();
6577									_tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled');
6578									filterItems.push(_tmb);
6579								} else {
6580									_tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled');
6581									_tmb.hide();
6582								}
6583							});
6584						}
6585
6586						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
6587
6588						var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false;
6589						UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true);
6590						var lightboxElements = $('[data-lbox^=ilightbox]', container);
6591						if (lightboxElements.length) {
6592							container.data('lbox', $(lightboxElements[0]).data('lbox'));
6593							if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6594								var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')];
6595								if (typeof getLightbox === 'object') {
6596									getLightbox.refresh();
6597								} else {
6598									UNCODE.lightbox();
6599								}
6600							}
6601						}
6602						container.trigger('more-items-loaded');
6603					}, delay);
6604				} else {
6605					$.each($('> .tmb-grid > .t-inside', container), function(index, val) {
6606						var parent = $(val).parent(),
6607							objTimeout = parent.data('objTimeout');
6608						if (objTimeout) {
6609							$(val).removeClass('zoom-reverse').removeClass('start_animation')
6610							clearRequestTimeout(objTimeout);
6611						}
6612						if (transitionDuration == 0) {
6613							if ($(val).hasClass('animate_when_almost_visible')) {
6614								$(val).addClass('zoom-reverse').removeClass('start_animation');
6615							} else {
6616								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
6617							}
6618						}
6619					});
6620					loadCssGrid($filter);
6621				}
6622			};
6623
6624			if (!$filter.hasClass('active')) {
6625				/** Scroll top with filtering */
6626				if (filterContainer.hasClass('filter-scroll')) {
6627                    var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top;
6628                    calc_scroll -= UNCODE.get_scroll_offset();
6629
6630					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6631						delta = bodyTop - calc_scroll,
6632						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed,
6633						filterTolerance = false,
6634						filter_timeout;
6635					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6636
6637					if ( !UNCODE.isFullPage ) {
6638						if (scrollSpeed == 0) {
6639							$('html, body').scrollTop(calc_scroll);
6640							UNCODE.scrolling = false;
6641							filter_items();
6642						} else {
6643
6644							if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) {
6645								filter_items();
6646								filterTolerance = true;
6647							}
6648
6649							$('html, body').animate({
6650								scrollTop: calc_scroll
6651							},{
6652								easing: 'easeInOutQuad',
6653								duration: scrollSpeed,
6654								complete: function(){
6655									UNCODE.scrolling = false;
6656									if ( !filterTolerance ) {
6657										filter_timeout = setTimeout(function(){
6658											clearTimeout(filter_timeout);
6659											filter_items();
6660										}, 200);
6661									}
6662								}
6663							});
6664						}
6665					}
6666				} else {
6667					filter_items();
6668				}
6669			}
6670			evt.preventDefault();
6671		});
6672
6673		$(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) {
6674			var params = UNCODE.getURLParams(window.location);
6675			var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
6676
6677			UNCODE.lastURL = window.location.href;
6678
6679			if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
6680				return;
6681			}
6682
6683			if (params.id === undefined) {
6684				$.each($('.cssgrid-system'), function(index, val) {
6685					loadCssGrid($(val));
6686				});
6687			} else {
6688				if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) {
6689					loadCssGrid($('#' + params.id));
6690				}
6691			}
6692		});
6693
6694		var loadCssGrid = function($href, $paginating) {
6695			var is_paginating = false;
6696
6697			if (undefined !== $paginating && $paginating) {
6698				var is_paginating = $paginating;
6699			}
6700
6701			var href = ($href.is("a") ? $href.attr('href') : location),
6702				cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href),
6703				cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')),
6704				cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')),
6705				cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')),
6706				cssgridContainer = cssgridSystem.find($('.cssgrid-layout')),
6707				cssgridId = cssgridSystem.attr('id');
6708			if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) {
6709				UNCODE.lastURL = href;
6710				history.pushState({
6711					myCSSgrid: true
6712				}, document.title, href);
6713			}
6714			cssgridWrapper.addClass('cssgrid-loading');
6715			if (is_paginating) {
6716				cssgridWrapper.addClass('grid-filtering');
6717			}
6718			$.ajax({
6719				url: href
6720			}).done(function(data) {
6721				var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(),
6722					$resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0],
6723					$resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0];
6724				requestTimeout(function() {
6725					cssgridContainer.html($resultItems);
6726					cssgridWrapper.removeClass('cssgrid-loading');
6727					cssgridWrapper.removeClass('grid-filtering');
6728					var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false;
6729					UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false);
6730					UNCODE.adaptive();
6731					if (SiteParameters.dynamic_srcset_active === '1') {
6732						UNCODE.refresh_dynamic_srcset_size(cssgridContainer);
6733					}
6734					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
6735						var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')];
6736						if (typeof getLightbox === 'object') {
6737							getLightbox.refresh();
6738						} else {
6739							UNCODE.lightbox();
6740						}
6741					}
6742					cssgridContainer.trigger('more-items-loaded');
6743				}, 300);
6744
6745				$('.pagination', cssgridFooter).remove();
6746				cssgridFooter.append($resultPagination);
6747
6748				if (cssgridResultCount.length > 0) {
6749					$('.woocommerce-result-count', cssgridResultCount).remove();
6750					cssgridResultCount.append($resultCount);
6751				}
6752			});
6753		};
6754
6755		$filters.each(function(i, buttonGroup) {
6756			var $buttonGroup = $(buttonGroup);
6757			$buttonGroup.on('click', 'a:not(.no-grid-filter)', function() {
6758				$buttonGroup.find('.active').removeClass('active');
6759				$(this).addClass('active');
6760
6761			});
6762
6763			var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup),
6764				$cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup),
6765				$cats_filters = $('.menu-smart--filter-cats', $buttonGroup);
6766			$buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) {
6767				e.preventDefault();
6768				$cats_filters.slideToggle(400, 'easeInOutCirc');
6769			});
6770
6771		});
6772	};
6773};
6774
6775UNCODE.preventDoubleTransition = function() {
6776	$('.sticky-element .animate_when_almost_visible').each(function(){
6777		var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){
6778			$el.addClass('do_not_reanimate');
6779		});
6780	});
6781};
6782
6783UNCODE.checkScrollForTabs = function(){
6784	var goToSection = window.location.hash.replace('#', ''),
6785		$index;
6786
6787	goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, "");
6788	goToSection = encodeURIComponent(goToSection);
6789	$index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion');
6790
6791	$index.attr('data-parent', 'parent-' + goToSection);
6792
6793	if (window.location.hash != undefined && window.location.hash != '') {
6794		requestTimeout(function() {
6795			scrollBody('parent-' + goToSection);
6796		}, 500);
6797	}
6798
6799	$('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) {
6800		var hash = (e.currentTarget).hash,
6801			index = (e.currentTarget).closest('.uncode-tabs');
6802		if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) {
6803			$('a[href="' + hash + '"][data-tab-history]').click();
6804			scrollBody(index);
6805		}
6806	});
6807
6808	var scrollBody = function(index) {
6809
6810		var getSection = $('a[href="' + index + '"][data-tab-history]'),
6811			scrollTo,
6812			safeGap = 27;
6813
6814		if ( ! getSection.length ) {
6815			getSection = $('div[data-parent="' + index + '"]');
6816
6817			if ( getSection.attr('data-target') == 'row' ) {
6818				getSection = getSection.closest('.vc_row');
6819				safeGap = 0;
6820			}
6821		}
6822
6823		if (typeof getSection === 'undefined' || ! getSection.length ) {
6824			return;
6825		}
6826
6827		var body = $("html, body"),
6828		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
6829		delta = bodyTop - (getSection.length ? getSection.offset().top : 0),
6830		getOffset = UNCODE.get_scroll_offset();
6831		if ( typeof getSection.offset() === 'undefined' )
6832			return;
6833		scrollTo = getSection.offset().top - safeGap;
6834		scrollTo -= getOffset;
6835
6836		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
6837		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
6838
6839		if (index != 0) {
6840			UNCODE.scrolling = true;
6841		}
6842
6843		if (scrollSpeed == 0) {
6844			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
6845			UNCODE.scrolling = false;
6846		} else {
6847			body.animate({
6848				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
6849			}, scrollSpeed, 'easeInOutQuad', function() {
6850				requestTimeout(function() {
6851					UNCODE.scrolling = false;
6852					if (getOffset != UNCODE.get_scroll_offset()) {
6853						scrollBody(index);
6854					}
6855				}, 100);
6856			});
6857		}
6858
6859	};
6860};
6861
6862UNCODE.printScreen = function() {
6863	var inlineMediaStyle = null,
6864		setResize;
6865
6866    function changeMediaStyle() {
6867		clearRequestTimeout(setResize);
6868		setResize = requestTimeout(function(){
6869	        var $head = document.getElementsByTagName('head')[0],
6870	        	$newStyle = document.createElement('style'),
6871	        	winW = window.innerWidth,
6872	        	printH = window.innerHeight;
6873
6874	        $newStyle.setAttribute('type', 'text/css');
6875	        $newStyle.setAttribute('media', 'print');
6876	        $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }'));
6877
6878	        if (inlineMediaStyle != null) {
6879	            $head.replaceChild($newStyle, inlineMediaStyle)
6880	        } else {
6881	            $head.appendChild($newStyle);
6882	        }
6883	        inlineMediaStyle = $newStyle;
6884	    }, 1000);
6885    }
6886
6887    changeMediaStyle();
6888    window.addEventListener('resize', changeMediaStyle);
6889};
6890
6891UNCODE.fullPage = function() {
6892	if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) {
6893		$('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting');
6894		return false;
6895	} else {
6896		requestTimeout(function() {
6897			window.scrollTo(0, 0);
6898		}, 10);
6899	}
6900
6901	var $masthead = $('#masthead'),
6902		$logo = $('#logo-container-mobile'),
6903		$logolink = $('[data-minheight]', $logo),
6904		logoMinScale = $logolink.data('minheight'),
6905		logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'),
6906		$container = $('.main-container .post-content'),
6907		$rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'),
6908		$header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'),
6909		headerName = $('.vc_row[data-name]', $header).attr('data-name'),
6910		headerLabel = $('.vc_row[data-label]', $header).attr('data-label'),
6911		headerWithOpacity = $('.header-scroll-opacity', $header).length,
6912		menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false,
6913		$footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'),
6914		scrollBar = true,
6915		effect,
6916		animationEndTimeOut,
6917		fp_anim_time = 900,
6918		fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)',
6919		is_scrolling = false,
6920		dataNames = [],
6921		is_first = true,
6922		no_history = $('body').hasClass('uncode-scroll-no-history'),
6923		theres_footer = true;
6924
6925	if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) {
6926		$('> div', $footer).each(function(index, el){
6927			if ( $(el).outerHeight() < 2 )
6928				theres_footer = false;
6929			else
6930				theres_footer = true;
6931		});
6932	}
6933
6934	if ( !$footer.length )
6935		theres_footer = false;
6936
6937	if ( !UNCODE.isFullPageSnap ) {
6938
6939		if ( $('body').hasClass('uncode-fullpage-zoom') )
6940			effect = 'scaleDown';
6941		else if ( $('body').hasClass('uncode-fullpage-parallax') )
6942			effect = 'moveparallax';
6943		else
6944			effect = 'movecurtain';
6945	}
6946
6947	if ( $('body').hasClass('uncode-fullpage-trid') )
6948		fp_anim_time = fp_anim_time*2;
6949
6950	if ( $header.length ) {
6951		if ( headerName !== '' )
6952			$header.attr('data-name', headerName);
6953		if ( headerLabel !== '' )
6954			$header.attr('data-label', headerLabel);
6955		$container.prepend($header);
6956	}
6957	if ( theres_footer ) {
6958		$container.append($footer);
6959		$footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer);
6960		$('aside.widget ul', $footer).addClass('no-list');
6961	}
6962
6963	var $all = $rows.add($header);
6964
6965	if ( theres_footer )
6966		$all = $all.add($footer);
6967
6968	$all.each(function(index, row) {
6969		if( index === 0 )
6970			$(row).addClass('uncode-scroll-active');
6971	});
6972
6973	if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') )
6974		$("<ul class='onepage-pagination'></ul>").prependTo("body");
6975
6976	$all.each(function(index, val) {
6977		var getName = $(val).data('name'),
6978			label;
6979
6980		if (typeof getName == 'undefined' || getName == 'undefined')
6981			getName = SiteParameters.slide_name + '-' + index;
6982
6983		//if ( dataNames.includes(getName) ) {
6984		if ( dataNames.indexOf(getName) > 0 ) {
6985			getName += '_' + index;
6986			$(val).data('name', getName);
6987		}
6988
6989		dataNames.push(getName);
6990
6991		$(val).attr('data-section', (index+1)).attr('data-anchor', getName);
6992
6993		if (typeof $(val).attr('data-label') !== 'undefined')
6994			label = $(val).attr('data-label');
6995		else label = '';
6996
6997		if ( $(val).is($footer) )
6998			return;
6999
7000		if (label != '' ) {
7001			label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
7002			$('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>");
7003		} else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) {
7004			$('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>");
7005		}
7006	});
7007
7008	var checkVisible = function( el, off ) {
7009		if (typeof jQuery === "function" && el instanceof jQuery) {
7010			el = el[0];
7011		}
7012
7013		off = typeof off=='undefined' ? 50 : off;
7014
7015		var rect = el.getBoundingClientRect();
7016
7017		return (
7018			(
7019				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7020				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
7021				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
7022			)
7023		);
7024	};
7025
7026	var animationEndAction = function( index, nextIndex ) {
7027		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
7028			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7029			player, iframe;
7030
7031		if ( !$nextSlide.is($footer) ) {
7032			$('.no-scrolloverflow').removeClass('no-scrolloverflow');
7033		}
7034
7035		if ( !UNCODE.isFullPageSnap ) {
7036			activateKBurns( nextIndex );
7037		}
7038
7039		$('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
7040			if ($(this).attr('data-provider') == 'vimeo') {
7041				iframe = $(this).find('iframe');
7042				player = new Vimeo.Player(iframe[0]);
7043				player.pause();
7044			} else if ($(this).attr('data-provider') == 'youtube') {
7045				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
7046			} else {
7047				if ($(this).is('video')) {
7048					$(this)[0].volume = 0;
7049					$(this)[0].pause();
7050				}
7051			}
7052		});
7053
7054		if ( ! UNCODE.isMobile && headerWithOpacity ) {
7055			if ( $nextSlide.is($header) )
7056				$header.removeClass('header-scrolled');
7057		}
7058
7059		var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide);
7060		$otherEl.each(function(){
7061			var $otherThis = $(this),
7062				$bgwrapperOther = $('.background-inner', $otherThis);
7063			if ( !checkVisible($otherThis) )
7064				$bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout');
7065
7066		});
7067
7068		if ( !checkVisible($currentSlide) ) {
7069			$currentSlide.removeClass('uncode-scroll-visible');
7070			var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance');
7071			if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
7072				currentScroll.scrollTo(0, 0, 0);
7073		}
7074
7075		clearRequestTimeout(animationEndTimeOut);
7076		animationEndTimeOut = requestTimeout(function(){
7077			Waypoint.refreshAll();
7078			$( document.body ).trigger('uncode_waypoints');
7079			var eventFP = new CustomEvent('fp-slide-changed');
7080			window.dispatchEvent(eventFP);
7081			is_scrolling = false;
7082
7083			if ( is_first ) {
7084				$('ul.onepage-pagination a').removeClass('is-selected');
7085				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
7086				is_first = false;
7087			}
7088
7089		}, 500);
7090	};
7091
7092	var postLeaveActions = function( nextIndex ){
7093		if ( menuHidden && ! UNCODE.isMobile )
7094			return false;
7095
7096		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7097			$cols = $('.uncol', $el),
7098			anchor = $el.data('anchor');
7099
7100		if ( ! UNCODE.isFullPageSnap ) {
7101			$.each($cols, function(index, val){
7102				if ( $(val).hasClass('style-light') ){
7103					$masthead.removeClass('style-dark-override').addClass('style-light-override');
7104					return false;
7105				} else if ( $(val).hasClass('style-dark') ) {
7106					$masthead.removeClass('style-light-override').addClass('style-dark-override');
7107					return false;
7108				}
7109			});
7110		}
7111
7112		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) {
7113			$('.menu-item' ).removeClass('active');
7114			$('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
7115		}
7116
7117		if ( !UNCODE.isFullPageSnap ) {
7118			activateBackWash( nextIndex );
7119		}
7120	};
7121
7122	var activateBackWash = function( nextIndex ){
7123		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7124			$bgwrapper;
7125
7126		if ( $el.length ) {
7127			if ( $el.hasClass('with-zoomout') ) {
7128				$bgwrapper = $('.background-inner:nth-child(1)', $el);
7129			} else if ( $('.with-zoomout', $el).length ) {
7130				$bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el);
7131			} else {
7132				return false;
7133			}
7134		} else {
7135			return false;
7136		}
7137
7138		$bgwrapper.addClass('uncode-zoomout');
7139
7140	};
7141
7142	var activateKBurns = function( nextIndex ){
7143		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7144			$bgwrapper;
7145
7146		if ( $el.length ) {
7147			if ( $el.hasClass('with-kburns') ) {
7148				$bgwrapper = $('.background-inner:nth-child(1)', $el);
7149			} else if ( $('.with-kburns', $el).length ) {
7150				$bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el);
7151			} else {
7152				return false;
7153			}
7154		} else {
7155			return false;
7156		}
7157
7158		$bgwrapper.addClass('uncode-kburns');
7159
7160	};
7161
7162	var activateParallax = function( nextIndex, direction ){
7163
7164		var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7165			$cell = $('.fp-tableCell', $el),
7166			animationEnd = 'webkitAnimationEnd animationend',
7167			cellAnim;
7168
7169		switch( direction ) {
7170			case 'up':
7171				cellAnim = 'moveFromTopInner';
7172				break;
7173			default:
7174				cellAnim = 'moveFromBottomInner';
7175		}
7176
7177		$cell.css({
7178			'animation-name': cellAnim,
7179			'animation-duration': fp_anim_time + 'ms',
7180			'animation-delay': '',
7181			'animation-timing-function': fp_easing,
7182			'animation-fill-mode': 'both',
7183		}).off(animationEnd)
7184		.on(animationEnd, function(event) {
7185			if ( event.originalEvent.animationName === cellAnim ) {
7186				$cell
7187					.css({
7188						'animation-name': '',
7189						'animation-duration': '',
7190						'animation-delay': '',
7191						'animation-timing-function': '',
7192						'animation-fill-mode': '',
7193					});
7194			}
7195		});
7196	};
7197
7198	var scrollHashes = function(){
7199		var hash = window.location.hash.replace('#', '').split('/'),
7200			hashInd;
7201		if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) {
7202			if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) {
7203				hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]');
7204				$.fn.fullpage.moveTo(hashInd+1);
7205			}
7206		} else if( hash[0] === '' ) {
7207			$.fn.fullpage.moveTo(1);
7208		}
7209	};
7210
7211	var hideMenu = function( index, nextIndex ){
7212		if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') )
7213			return false;
7214
7215		var hMenu = UNCODE.menuHeight,
7216			transTime = hMenu * 2;
7217
7218		if ( index === 1 && nextIndex > 1 ) {
7219			hMenu = hMenu * -1;
7220		} else if  ( index !== 1 && nextIndex === 1 ) {
7221			hMenu = 0;
7222		} else {
7223			return false;
7224		}
7225
7226		$masthead.css({
7227			'-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)',
7228			'transform': 'translate3d(0, ' + hMenu + 'px, 0)',
7229			'-webkit-transition': 'transform 0.5s ease-in-out',
7230			'transition': 'transform 0.5s ease-in-out'
7231		});
7232	};
7233
7234	var shrinkMenu = function( index, nextIndex ){
7235		if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') )
7236			return false;
7237
7238		if ( index === 1 && nextIndex > 1 ) {
7239			$logo.addClass('shrinked');
7240			$('div', $logo).each(function(index, val){
7241				$(val).css({
7242					'height': logoMinScale,
7243					'line-height': logoMinScale
7244				});
7245				if ($(val).hasClass('text-logo')) {
7246					$(val).css({
7247						'font-size': logoMinScale + 'px'
7248					});
7249				}
7250			});
7251			requestTimeout(function() {
7252				UNCODE.menuMobileHeight = $masthead.outerHeight();
7253			}, 300);
7254		} else if ( index !== 1 && nextIndex === 1 ) {
7255			$logo.removeClass('shrinked');
7256			$('div', $logo).each(function(index, val){
7257				$(val).css({
7258					'height': logoMaxScale,
7259					'line-height': logoMaxScale
7260				});
7261				if ($(val).hasClass('text-logo')) {
7262					$(val).css({
7263						'font-size': logoMaxScale + 'px'
7264					});
7265				}
7266			});
7267			requestTimeout(function() {
7268				UNCODE.menuMobileHeight = $masthead.outerHeight();
7269			}, 300);
7270		} else {
7271			return false;
7272		}
7273
7274	};
7275
7276	var anchorLink = function(){
7277
7278		$container.add('.menu-item').find('a[href*="#"]').click(function(e) {
7279			var $this = $(e.currentTarget),
7280				hash = e.currentTarget.href.split('#'),
7281				current = window.location.href.split('#'),
7282				ind,
7283				currentMenuOpened = UNCODE.menuOpened,
7284				go = false;
7285
7286			var hash_url = hash[0].replace(/\/?$/, '/'),
7287				current_url = current[0].replace(/\/?$/, '/');
7288
7289			if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) {
7290				hash = '#'+hash[1];
7291				e.preventDefault();
7292				go = true;
7293			}
7294
7295			if ( go ) {
7296
7297				if ( $(hash).length ) {
7298					ind = $(hash).closest('.fp-section').index();
7299				} else {
7300					hash = hash.slice(1);
7301					ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section');
7302				}
7303
7304				if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' )
7305					ind = $this.closest('.fp-section').index();
7306
7307				UNCODE.menuOpened = false;
7308
7309				$.fn.fullpage.moveTo(ind+1);
7310
7311				UNCODE.menuOpened = currentMenuOpened;
7312				if (UNCODE.menuOpened) {
7313					if (UNCODE.wwidth < UNCODE.mediaQuery) {
7314						window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
7315					} else {
7316						$('.mmb-container-overlay .overlay-close').trigger('click');
7317						$('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));;
7318					}
7319				}
7320
7321			}
7322
7323		});
7324
7325		$('.header-scrolldown').on('click', function(event) {
7326			event.preventDefault();
7327			var scrollDown = $(this),
7328				ind = scrollDown.closest('.fp-section').index();
7329
7330			$.fn.fullpage.moveTo(ind+2);
7331		});
7332
7333		var anchor = $('.fp-section.active').data('anchor');
7334
7335		if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) {
7336			$('.menu-item').removeClass('active');
7337			$('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active');
7338		}
7339
7340	};
7341
7342	var slideLeave = function( index, nextIndex, direction ) {
7343		var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container),
7344			$nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container),
7345			animationEnd = 'webkitAnimationEnd animationend',
7346			transitionEnd = 'webkitTransitionEnd transitionend',
7347			animOut = effect != 'scaleDown' ? effect + direction : effect,
7348			animIn,
7349			isFooter = false,
7350			isFooterNext = false,
7351			footerH = $footer.outerHeight(),
7352			timeout,
7353			player, iframe,
7354			footerCoeff;
7355		switch( direction ) {
7356			case 'up':
7357				animIn = 'moveFromTop';
7358				break;
7359			default:
7360				animIn = 'moveFromBottom';
7361		}
7362
7363		if ( $('body').hasClass('uncode-fullpage-trid') ) {
7364			animOut = animIn + 'trid';
7365			animIn = animOut + 'In';
7366		} else if ( UNCODE.isFullPageSnap ) {
7367			animIn = animOut = 'none';
7368		}
7369
7370		hideMenu(index, nextIndex);
7371		shrinkMenu(index, nextIndex);
7372
7373		$('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) {
7374			if ($(this).attr('data-provider') == 'vimeo') {
7375				iframe = $(this).find('iframe');
7376				player = new Vimeo.Player(iframe[0]);
7377				player.pause();
7378			} else if ($(this).attr('data-provider') == 'youtube') {
7379				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
7380			} else {
7381				if ($(this).is('video')) {
7382					$(this)[0].volume = 0;
7383					$(this)[0].pause();
7384				}
7385			}
7386		});
7387
7388		$('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) {
7389			if ($(this).attr('data-provider') == 'vimeo') {
7390				iframe = $(this).find('iframe');
7391				iframe.on('load', function(){
7392					player = new Vimeo.Player(iframe);
7393					player.setVolume(0);
7394					player.play();
7395				});
7396				player = new Vimeo.Player(iframe);
7397				player.setVolume(0);
7398				player.play();
7399			} else if ($(this).attr('data-provider') == 'youtube') {
7400				if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
7401			} else {
7402				if ($(this).is('video')) {
7403					$(this)[0].volume = 0;
7404					$(this)[0].play();
7405				}
7406			}
7407		});
7408
7409		if ( $currentSlide.is($footer) )
7410			isFooter = true;
7411
7412		if ( $nextSlide.is($footer) )
7413			isFooterNext = true;
7414
7415		if ( ! UNCODE.isMobile && headerWithOpacity ) {
7416			if ( $currentSlide.is($header) )
7417				$header.addClass('header-scrolled');
7418		}
7419
7420		footerCoeff = footerH;
7421
7422		if ( UNCODE.isFullPageSnap ) {
7423			postLeaveActions( nextIndex );
7424			activateBackWash( nextIndex );
7425			activateKBurns( nextIndex );
7426			requestTimeout(function(){
7427				animationEndAction( index, nextIndex );
7428			}, fp_anim_time+150);
7429		} else {
7430			if ( isFooterNext ) {
7431
7432				var $iscrollWrapper = $currentSlide.find('.fp-scrollable');
7433				$iscrollWrapper.addClass('no-scrolloverflow');
7434
7435				$nextSlide
7436				.add($currentSlide)
7437				.addClass('uncode-scroll-front')
7438				.addClass('uncode-scroll-active')
7439				.addClass('uncode-scroll-visible');
7440				$container.css({
7441					'-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
7442					'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)',
7443					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7444					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7445				}).off(transitionEnd)
7446				.one(transitionEnd, function(){
7447					animationEndAction( index, nextIndex );
7448				});
7449
7450			} else if ( isFooter ) {
7451
7452				$('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first
7453				.add($currentSlide)
7454				.addClass('uncode-scroll-front')
7455				.addClass('uncode-scroll-active')
7456				.addClass('uncode-scroll-visible');
7457				$container.css({
7458					'-webkit-transform': 'translate3d(0, 0, 0)',
7459					'transform': 'translate3d(0, 0, 0)',
7460					'-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7461					'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing,
7462				})
7463				.one(transitionEnd, function(){
7464					if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer
7465						clearRequestTimeout(timeout);
7466						timeout = requestTimeout(function(){
7467							$.fn.fullpage.moveTo(nextIndex);
7468							slideLeave( index-1, nextIndex, 'up' );
7469							$container.off(transitionEnd);
7470						}, 50);
7471					}
7472					animationEndAction( index, nextIndex );
7473				});
7474
7475			} else {
7476
7477				postLeaveActions( nextIndex );
7478
7479				if ( !$('body').hasClass('uncode-fullpage-trid') )
7480					activateParallax( nextIndex, direction );
7481
7482				var $outBg = $('.background-wrapper', $currentSlide);
7483
7484				$nextSlide
7485				.addClass('uncode-scroll-front')
7486				.addClass('uncode-scroll-active')
7487				.addClass('uncode-scroll-visible')
7488				.addClass('uncode-scroll-animating-in')
7489				.css({
7490					'z-index':4,
7491					'animation-name': animIn,
7492					'animation-duration': fp_anim_time + 'ms',
7493					'animation-delay': '',
7494					'animation-timing-function': fp_easing,
7495					'animation-fill-mode': 'both',
7496					'transition': 'initial',
7497				}).off(animationEnd)
7498				.on(animationEnd, function(event) {
7499					if ( event.originalEvent.animationName === animIn ) {
7500						$(this)
7501							.addClass('uncode-scroll-already')
7502							.removeClass('uncode-scroll-front')
7503							.removeClass('uncode-scroll-animating-in')
7504							.css({
7505								'animation-name': '',
7506								'animation-duration': '',
7507								'animation-delay': '',
7508								'animation-timing-function': '',
7509								'animation-fill-mode': '',
7510								'transition': 'initial',
7511							});
7512
7513						$currentSlide
7514							.removeClass('uncode-scroll-active')
7515							.add($outBg)
7516							.css({
7517								'animation-name': '',
7518								'animation-duration': '',
7519								'animation-delay': '',
7520								'animation-timing-function': '',
7521								'animation-fill-mode': '',
7522								'transition': 'initial',
7523							});
7524
7525						animationEndAction( index, nextIndex );
7526
7527					}
7528
7529					if ( nextIndex > 1 )
7530						$('body').addClass('window-scrolled');
7531					else
7532						$('body').removeClass('window-scrolled');
7533				});
7534
7535				$currentSlide
7536					.addClass('uncode-scroll-animating-out')
7537					.removeClass('uncode-scroll-front')
7538					.css({
7539						'z-index':'1',
7540						'animation-name': animOut,
7541						'animation-duration': fp_anim_time + 'ms',
7542						'animation-delay': '',
7543						'animation-timing-function': fp_easing,
7544						'animation-fill-mode': 'both',
7545						'transition': 'initial',
7546						'will-change': 'auto'
7547					}).off(animationEnd)
7548					.on(animationEnd, function(event) {
7549						if ( event.originalEvent.animationName === animOut ) {
7550							$currentSlide.removeClass('uncode-scroll-animating-out');
7551						}
7552					});
7553
7554				if ( $('body').hasClass('uncode-fp-opacity') ) {
7555					$currentSlide.find('> div').css({
7556						'animation-name': 'opacityout',
7557						'animation-duration': fp_anim_time + 'ms',
7558						'animation-delay': '',
7559						'animation-timing-function': fp_easing,
7560						'animation-fill-mode': 'both',
7561						'transition': 'initial',
7562					}).off(animationEnd)
7563					.on(animationEnd, function(event) {
7564						if ( event.originalEvent.animationName === 'opacityout' ) {
7565							$(event.currentTarget).css({
7566								'animation-name': '',
7567								'animation-duration': '',
7568								'animation-delay': '',
7569								'animation-timing-function': '',
7570								'animation-fill-mode': '',
7571								'transition': '',
7572							});
7573						}
7574					});
7575				}
7576			}
7577		}
7578
7579		$('.scroll-top').on('click', function(e){
7580			$.fn.fullpage.moveTo(1);
7581			return false;
7582		});
7583
7584	};
7585
7586	var init_fullPage = function(mode){
7587
7588		// if ( typeof mode !== 'undefined' && mode === 'mobile' ) {
7589		// 	scrollBar = false;
7590		// }
7591
7592		var checkFPeffects;
7593
7594		$container.fullpage({
7595			sectionSelector: '.uncode-scroll-lock',
7596			scrollOverflow: true,
7597			scrollOverflowOptions: {
7598				click: false,
7599				preventDefaultException: { tagName:/.*/ }
7600			},
7601			navigation: false,
7602			scrollBar: scrollBar,
7603			scrollingSpeed: fp_anim_time,
7604			verticalCentered: true,
7605			anchors: no_history ? false : dataNames,
7606			recordHistory: !no_history,
7607			afterRender: function(){
7608				$('body').removeClass('fp-waiting');
7609				$('.uncode-scroll-lock', $container).not(':visible').each(function(){
7610					var $invisible = $(this).addClass('hidden-scroll');//,
7611				});
7612				$('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){
7613					var $visible = $(this).addClass('uncode-scroll-visible'),
7614						visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)');
7615					$('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected');
7616				});
7617
7618				$('ul.onepage-pagination a').on('click', function(e){
7619					e.preventDefault();
7620					var $a = $(this),
7621						toIndex = $a.data('index');
7622
7623					$.fn.fullpage.moveTo(toIndex+1);
7624				});
7625
7626				requestTimeout(function(){
7627					scrollHashes();
7628				}, 1000);
7629
7630				$(window).on('hashchange', function(e){
7631					requestTimeout(function(){
7632						scrollHashes();
7633					}, 500);
7634				});
7635
7636				anchorLink();
7637
7638				if ( $('body').hasClass('uncode-fp-opacity') ) {
7639					$all.each(function(index, row) {
7640						var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''),
7641							classBg;
7642
7643						if ( typeof testmatch !== 'undefined' && testmatch !== null ) {
7644							classBg = testmatch[0];
7645							$(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg);
7646						}
7647					});
7648				}
7649
7650				if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) {
7651					$(window).on('menuOpen gdprOpen', function(){
7652						$.fn.fullpage.setAutoScrolling(false);
7653					}).on('menuClose gdprClose', function(){
7654						$.fn.fullpage.setAutoScrolling(true);
7655					});
7656				}
7657
7658				$(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){
7659					requestTimeout(function(){
7660						$.fn.fullpage.setAutoScrolling(false);
7661					}, 1000);
7662				}).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){
7663					$.fn.fullpage.setAutoScrolling(true);
7664				});
7665
7666				if ( !UNCODE.isFullPageSnap ) {
7667					clearRequestTimeout(checkFPeffects);
7668					checkFPeffects = requestTimeout(function(){
7669						activateBackWash( 1 );
7670						activateKBurns( 1 );
7671					}, 100);
7672				}
7673
7674			},
7675			onLeave: function( index, nextIndex, direction ){
7676
7677				if ( UNCODE.menuOpened || is_scrolling )
7678					return false;
7679
7680				is_scrolling = true;
7681
7682				var event = new CustomEvent('fp-slide-leave');
7683				window.dispatchEvent(event);
7684
7685				slideLeave( index, nextIndex, direction );
7686
7687				if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) {
7688					if ( direction === 'up' ) {
7689						$.fn.fullpage.moveTo(nextIndex-1);
7690					} else {
7691						$.fn.fullpage.moveTo(nextIndex+1);
7692					}
7693					return false;
7694				}
7695
7696				$('ul.onepage-pagination a').removeClass('is-selected');
7697				$('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected');
7698
7699			}
7700		});
7701	};
7702
7703	init_fullPage();
7704	$(window).on('load', function(){
7705		requestTimeout(function(){
7706			$.fn.fullpage.reBuild();
7707		}, 3000);
7708	});
7709
7710	var addScrollingClass,
7711		removeScrollingClass;
7712
7713	window.addEventListener("fp-slide-scroll", function(){
7714		addScrollingClass = requestTimeout( function(){
7715			$('body').addClass('fp-slide-scrolling');
7716		}, 10 );
7717
7718		clearRequestTimeout(removeScrollingClass);
7719		removeScrollingClass = requestTimeout( function(){
7720			$('body').removeClass('fp-slide-scrolling');
7721		}, 150 );
7722
7723		Waypoint.refreshAll();
7724	}, false);
7725
7726	var setFPheight = function(){
7727		var $body = document.body,
7728			$footer = document.getElementById('colophon'),
7729			$maincontainer = document.querySelector('.main-wrapper'),
7730			$boxcontainer = document.querySelector('.box-container'),
7731			$sections = document.querySelectorAll('.fp-section'),
7732			rect = $maincontainer.getBoundingClientRect(),
7733			rect2 = $boxcontainer.getBoundingClientRect(),
7734			$masthead = document.getElementById('masthead'),
7735			_hideMenu = false,
7736			menuHeight = UNCODE.menuHeight;
7737		$body.style.height = UNCODE.wheight + 'px';
7738
7739		if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) {
7740			_hideMenu = true;
7741		}
7742		if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) {
7743			menuHeight = 0
7744		}
7745
7746
7747		if ( theres_footer )
7748			$footer.style.top = (rect.height || rect2.height) + 'px';
7749
7750		for (var i = 0; i < $sections.length; i++) {
7751			$sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px';
7752		}
7753	};
7754
7755	setFPheight();
7756
7757	window.addEventListener('resize', setFPheight, false);
7758	window.addEventListener('orientationchange', setFPheight, false);
7759
7760};
7761
7762UNCODE.particles = function() {
7763	$(".vc-particles-background").each(function() {
7764		var $particle = $(this);
7765		var $parent = $particle.closest('[data-parent]');
7766
7767		$parent.prepend($particle);
7768		// $(window).trigger('resize');
7769	})
7770};
7771
7772
7773UNCODE.filters = function() {
7774	var $systems = $('.isotope-system, .cssgrid-system');
7775
7776	$systems.each(function(index, val){
7777		var $system = $(this),
7778			$widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system),
7779			$widgets = $('.widgetized-cb-wrapper', $system),
7780			$sorting_trgr = $('.uncode-woocommerce-sorting__link', $system),
7781			$sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system),
7782			$cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system),
7783			$cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system);
7784
7785		if ($system.hasClass('isotope-processed')) {
7786			return;
7787		}
7788
7789		$cats_trigger.on('click', function(e) {
7790			if ( ! $('html').hasClass('screen-sm') ) {
7791				// $widgets.add($sorting_dd).slideUp(400);
7792				e.preventDefault();
7793				$widgets.slideUp(400, 'easeInOutCirc');
7794			}
7795		});
7796
7797		$('.filters-toggle-trigger', $system).on('click', function(e) {
7798			e.preventDefault();
7799			var $filters = $('.isotope-filters .menu-horizontal', $system);
7800			$filters.slideToggle(400, 'easeInOutCirc');
7801			$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
7802		});
7803
7804		$widget_trgr.on('click', function(e) {
7805			e.preventDefault();
7806			$widgets.slideToggle(400, 'easeInOutCirc');
7807			if (!$('html').hasClass('screen-sm')) {
7808				$cats_filters.slideUp(400, 'easeInOutCirc');
7809			}
7810			window.dispatchEvent(new CustomEvent('boxResized'));
7811		});
7812
7813		$sorting_trgr.on('click', function(e) {
7814			e.preventDefault();
7815			if (!$('html').hasClass('screen-sm')) {
7816				$widgets.add($cats_filters).slideUp(400, 'easeInOutCirc');
7817			}
7818		});
7819
7820		$system.addClass('isotope-processed');
7821	});
7822
7823};
7824
7825UNCODE.widgets = function() {
7826	var widget_collapses = $('.widget-collapse');
7827
7828	widget_collapses.each(function(){
7829		var widget_collapse = $(this),
7830			widget_title = widget_collapse.find('.widget-title'),
7831			widget = widget_title.closest('.widget'),
7832			content = widget.children().not('.widget-title'),
7833			setCTA;
7834
7835		if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) {
7836			widget_title.toggleClass('open');
7837		}
7838
7839		widget_title.each(function() {
7840			var _this = $(this);
7841			var content = _this.closest('.widget').find('.widget-collapse-content');
7842
7843			$(window).on('load resize', function(){
7844				clearRequestTimeout(setCTA);
7845				setCTA = requestTimeout( function() {
7846					if ( content.is(':visible') ) {
7847						_this.addClass( 'open' );
7848					} else {
7849						_this.removeClass( 'open' );
7850					}
7851				}, 10 );
7852			})
7853
7854			_this.on( 'click', function(){
7855
7856				// Get content of :after element (+ icon) to check the visibility
7857				var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content');
7858
7859				if (icon_content === 'none' || !icon_content) {
7860					return false;
7861				}
7862
7863				_this.toggleClass('open');
7864				var isOpen = _this.hasClass('open'),
7865					hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27;
7866				content.animate({
7867					height: 'toggle',
7868					padding: 'toggle',
7869					opacity: 'toggle',
7870					top: isOpen ? 0 : hasBorder
7871				}, {
7872					duration: 400,
7873					easing: "easeInOutCirc",
7874				});
7875
7876				return false;
7877
7878			});
7879		});
7880	});
7881
7882	var $widgets_without_title = $('.collapse-init').removeClass('collapse-init');
7883};
7884
7885UNCODE.unmodal = function() {
7886	$(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() {
7887		$('.unmodal-overlay').fadeIn();
7888		$('.unmodal-overlay').addClass('loading');
7889		$('body').addClass('uncode-unmodal-overlay-visible');
7890		$(window).trigger('unmodal-open');
7891	});
7892
7893	$(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() {
7894		$('.unmodal-overlay').fadeOut();
7895		$('.unmodal').fadeOut();
7896		$('body').removeClass('uncode-unmodal-overlay-visible');
7897		$('body').removeClass('uncode-unmodal-open');
7898		$('html').removeClass('uncode-unmodal-body-disable-scroll');
7899		$(document).trigger('unmodal-close');
7900		UNCODE.isUnmodalOpen = false;
7901	});
7902
7903	$(document).on('uncode-unmodal-show-content', function() {
7904		$('.unmodal-overlay').removeClass('loading');
7905		$('.unmodal').show();
7906		$('.unmodal').addClass('show-unmodal-with-animation');
7907		$('.unmodal-content')[0].scrollTop = 0;
7908		$('body').addClass('uncode-unmodal-open');
7909		UNCODE.isUnmodalOpen = true;
7910
7911		if ($('body').hasClass('qw-body-scroll-disabled')) {
7912			$('html').addClass('uncode-unmodal-body-disable-scroll');
7913		}
7914
7915		if ($('.unmodal').hasClass('auto-height')) {
7916			set_modal_height();
7917		}
7918	});
7919
7920	var set_modal_height = function() {
7921		var modal = $('.unmodal');
7922		var window_height = $(window).outerHeight();
7923		var modal_height = modal.outerHeight();
7924
7925		modal.css('height', 'auto');
7926
7927		if (modal_height > window_height) {
7928			modal.outerHeight(window_height);
7929		}
7930	}
7931
7932	if ($('.unmodal').hasClass('auto-height')) {
7933		var setCTA;
7934
7935		$(window).on('resize', function() {
7936			clearRequestTimeout(setCTA);
7937			setCTA = requestTimeout(function() {
7938				set_modal_height();
7939			}, 100);
7940		});
7941	}
7942};
7943
7944UNCODE.bgChanger = function() {
7945	var $bg_changers = $('.vc_row[data-bg-changer]:visible'),
7946		$bg_first = $('.vc_row[data-bg-remove]'),
7947		bg_remove = $bg_first.attr('data-bg-remove'),
7948		$first = $bg_changers.first(),
7949		$last = $bg_changers.last(),
7950		$bg_wrapper = $('#changer-back-color'),
7951		$bg_changings = $('div[data-bg-changing]', $bg_wrapper),
7952		setCTA, localH = UNCODE.wheight,
7953		isScrolling;
7954
7955	$bg_first.removeClass(bg_remove);
7956
7957	var bgChange = function($col, bgColor, skin, tmbskin){
7958		$bg_wrapper.attr( 'class', bgColor );
7959		var menuskin;
7960		if ( typeof skin !== 'undefined' ) {
7961			menuskin = skin.replace('style', 'menu')
7962		}
7963
7964		if ( $col.length ) {
7965			$('.uncol[data-skin-change]').each(function(){
7966				var $isoFooter = $('.isotope-footer', this);
7967				$(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin);
7968				if ( menuskin !== '' ) {
7969					$(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin);
7970				}
7971			});
7972
7973			$('.tmb[data-skin-change]').each(function(){
7974				$(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin);
7975			});
7976		}
7977	};
7978
7979	var $masthead = $('#masthead'),
7980		transDesktop,
7981		transMobile,
7982		changeSkin,
7983
7984	checkTransparencyAndChange = function( skin ){
7985		transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery;
7986		transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery;
7987		changeSkin = $masthead.hasClass('menu-change-skin');
7988
7989		if ( ! transDesktop && ! transMobile ) {
7990			return false;
7991		}
7992
7993		if ( ! changeSkin ) {
7994			return false;
7995		}
7996
7997		if ( skin === 'style-light' ){
7998			$masthead.removeClass('style-dark-override').addClass('style-light-override');
7999			return false;
8000		} else if ( skin === 'style-dark' ) {
8001			$masthead.removeClass('style-light-override').addClass('style-dark-override');
8002			return false;
8003		}
8004	};
8005
8006	var bg_waypoints = function(){
8007		if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) {
8008
8009			$.each($bg_changers, function(index, row) {
8010
8011				var $row = $(row),
8012					$col = $('.uncol[data-skin-change]', $row).eq(0),
8013					skin,
8014					$tmbs,
8015					tmbskin,
8016					bgColor = $row.attr('data-bg-color');
8017
8018				if ( ! $row.is(':visible') ) {
8019					return false;
8020				}
8021
8022				if ( $col.length ) {
8023					skin = $col.attr('data-skin-change');
8024					$tmbs = $('.tmb[data-skin-change]', $row);
8025					tmbskin = skin.replace('style', 'tmb');
8026				}
8027
8028				if ( ! $row.hasClass('unscroll-horizontal') ) {
8029					$row.waypoint(function( dir ) {
8030						if ( dir === 'down' ) {
8031							bgChange($col, bgColor, skin, tmbskin);
8032							checkTransparencyAndChange(skin);
8033						} else {
8034							return;
8035						}
8036					}, {
8037						offset: '50%'
8038		  			});
8039
8040					$row.waypoint(function( dir ) {
8041						if ( dir === 'up' ) {
8042							bgChange($col, bgColor, skin, tmbskin);
8043							checkTransparencyAndChange(skin);
8044						} else {
8045							return;
8046						}
8047					}, {
8048						offset: function() {
8049							var clH = this.element.clientHeight,
8050								wH = window.innerHeight,
8051								ret = clH > 200 ? -100 : clH * -0.5;
8052							return ( wH / 2 ) - clH;
8053						}
8054					});
8055				}
8056
8057			});
8058
8059			$('body').addClass('bg-changer-init');
8060
8061		}
8062	};
8063
8064	var body = document.body,
8065	edges = false;
8066
8067	var throttle = function(fn, wait) {
8068		var time = Date.now();
8069		return function() {
8070			if ((time + wait - Date.now()) < 0) {
8071				fn();
8072				time = Date.now();
8073			}
8074		}
8075	}
8076
8077	var $wrapper = document.querySelector(".main-wrapper"),
8078		currentPixel = window.pageYOffset || window.document.documentElement.scrollTop;
8079
8080	var $title = document.querySelector('#rotating');
8081	if ( $title !== null ) {
8082		$title.style.whiteSpace = 'nowrap';
8083		$title.style.transition = 'transform 200ms linear';
8084	}
8085
8086	window.addEventListener( 'scroll', throttle( function() {
8087		window.clearRequestTimeout( isScrolling );
8088
8089		isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row
8090
8091			var scrolled = window.pageYOffset || window.document.documentElement.scrollTop,
8092				body = document.body,
8093				html = document.documentElement,
8094				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
8095				$row = false,
8096				firstOff,
8097				lastOff;
8098
8099			if ( scrolled < 100 && $first.length ) {
8100				firstOff = $first.offset().top;
8101				if ( firstOff < 100 ) {
8102					var $row = $first;
8103				}
8104			} else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) {
8105				lastOff = $last.offset().top + $last.outerHeight();
8106				if ( lastOff > ( docH - 100 ) ) {
8107					var $row = $last;
8108				}
8109			}
8110
8111			if ( $row.length ) {
8112				var $col = $('.uncol[data-skin-change]', $row).eq(0),
8113					skin,
8114					$tmbs,
8115					tmbskin,
8116					bgColor = $row.attr('data-bg-color');
8117
8118				if ( $col.length ) {
8119					skin = $col.attr('data-skin-change');
8120					$tmbs = $('.tmb[data-skin-change]', $row);
8121					tmbskin = skin.replace('style', 'tmb');
8122				}
8123
8124				bgChange($col, bgColor, skin, tmbskin);
8125				checkTransparencyAndChange(skin);
8126				edges = true;
8127			}
8128
8129		}, 150);
8130
8131		if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again
8132			bg_waypoints();
8133			Waypoint.refreshAll();
8134			edges = false;
8135		}
8136
8137	}, 100), false);
8138
8139	$(window).on('resize', function() {
8140		clearRequestTimeout(setCTA);
8141		setCTA = requestTimeout(function() {
8142			if ( localH != UNCODE.wheight ) {
8143				localH = UNCODE.wheight;
8144				bg_waypoints();
8145				Waypoint.refreshAll();
8146			}
8147		}, 100);
8148	});
8149
8150	bg_waypoints();
8151
8152};
8153
8154UNCODE.skewIt = function() {
8155
8156	if ( $('body').hasClass('compose-mode') ) {
8157		return;
8158	}
8159
8160	var justscrolled = false;
8161
8162	var loadSkewIt = function(){
8163
8164		var $pageHeader = $('#page-header'),
8165			$page_body = $('.page-body'),
8166			$header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader);
8167
8168		if ( $header_skew.length ) {
8169			$pageHeader.addClass('uncode-skew').css({
8170				position: 'relative',
8171				zIndex: 1
8172			});
8173			$header_skew.removeClass('uncode-skew');
8174			$page_body.css({
8175				position: 'relative',
8176				zIndex: 0
8177			});
8178		}
8179
8180		var $skew = $('.uncode-skew'),
8181			$horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'),
8182			horizontal = $horizontal.length,
8183			stopSkewing,
8184			lastOffset = 0,
8185			lastDate = Date.now();
8186
8187		if ( ! $skew.length ) {
8188			return;
8189		}
8190
8191		var dropSkew = function(){
8192			if ( UNCODE.wwidth < UNCODE.mediaQuery )
8193				return;
8194
8195			$skew.each(function(){
8196				var $this = $(this),
8197					$drop = $('.t-entry-drop:not(.drop-parent)', $this);
8198
8199				if ( $drop.length ) {
8200					$this.css({
8201						'transform': 'skew(0)'
8202					});
8203					var bound = $this[0].getBoundingClientRect();
8204					$drop.css({
8205						left: bound.x * -1,
8206						top: bound.y * -1,
8207					});
8208				}
8209			});
8210		};
8211		dropSkew();
8212
8213		$(window).on('resize', dropSkew);
8214
8215		window.addEventListener( 'scroll', function() {
8216
8217			if ( justscrolled !== true ) {
8218				justscrolled = true;
8219				return;
8220			}
8221
8222			window.clearRequestTimeout( stopSkewing );
8223
8224			var now = Date.now(),
8225				delayInMs = now - lastDate,
8226				offset = window.pageYOffset || window.document.documentElement.scrollTop,
8227				newOffset = offset - lastOffset,
8228				speed = Math.pow((newOffset / delayInMs), 3) * -1,
8229				body = document.body,
8230				html = document.documentElement,
8231				docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ),
8232				wait = 50,
8233				maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2;
8234
8235			if ((lastDate + wait - now) < 0) {
8236
8237				lastDate = now;
8238				lastOffset = offset;
8239
8240				if ( speed > 6 ) {
8241					speed = 6;
8242				} else if ( speed < -6 ) {
8243					speed = -6;
8244				}
8245
8246				if ( speed > 2 && offset < UNCODE.wheight ) {
8247					speed = 2;
8248				} else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) {
8249					speed = -2;
8250				}
8251
8252				var speedY = speed,
8253					speedX = speed * 1.25;
8254
8255				if ( horizontal ) {
8256					speedY = 0;
8257					if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) {
8258						speedX = 0;
8259						return;
8260					} else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
8261						speedX = 0;
8262						return;
8263					}
8264				} else {
8265					speedX = 0;
8266				}
8267
8268				if ( ! $skew.closest('.enter-st').length ) {
8269					speedX = 0;
8270				}
8271
8272				gsap.killTweensOf($skew);
8273				gsap.to( $skew, {
8274					duration: 0.2,
8275					skewY: (speedY * maxSpeed) + "deg",
8276					skewX: (speedX * maxSpeed) + "deg",
8277					ease: Power0.easeNone,
8278					transformOrigin: 'center',
8279				});
8280
8281			}
8282
8283			stopSkewing = requestTimeout(function() {
8284				gsap.killTweensOf($skew);
8285				gsap.to( $skew, {
8286					duration: 0.5,
8287					skewY: "0deg",
8288					skewX: "0deg",
8289					transformOrigin: 'center',
8290					ease: Expo.easeOut,
8291				});
8292
8293				$skew.each(function(){
8294					var $this = $(this),
8295						$drop = $('.t-entry-drop:not(.drop-parent)', $this);
8296
8297					if ( $drop.length ) {
8298						var bound = $this[0].getBoundingClientRect()
8299						$drop.css({
8300							left: bound.x * -1,
8301							top: bound.y * -1,
8302						});
8303					}
8304				});
8305
8306			}, 200);
8307
8308		}, false);
8309
8310	};
8311
8312	$(window).on('load', loadSkewIt);
8313
8314};
8315
8316UNCODE.rotateIt = function() {
8317
8318	if ( $('body').hasClass('compose-mode') ) {
8319		return;
8320	}
8321
8322	var loadRotateIt = function(){
8323
8324		var $toRotate = $('.uncode-rotate');
8325
8326		$toRotate.each(function(){
8327			var $rotate = $(this),
8328				deg = 0,
8329				dir = true,
8330				coeff = 1,
8331				lastOffset = 0,
8332				lastDate = Date.now();
8333
8334			var checkScroll = function($rotate){
8335				// if ( ! $rotate.length ) {
8336				// 	return;
8337				// }
8338
8339				var now = Date.now(),
8340					delayInMs = now - lastDate,
8341					offset = window.pageYOffset || window.document.documentElement.scrollTop,
8342					newOffset = offset - lastOffset,
8343					speed = (newOffset / delayInMs) * 5,
8344					body = document.body,
8345					html = document.documentElement,
8346					docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
8347
8348				lastDate = now;
8349				lastOffset = offset;
8350
8351				if ( Math.abs(deg) > 359 || isNaN(deg) ) {
8352					deg = 0;
8353				}
8354
8355				if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) {
8356					deg = parseFloat(deg) + parseFloat(speed);
8357				}
8358
8359				if ( $rotate.hasClass('uncode-rotate-hover') ) {
8360					$rotate.hover(function(){
8361						coeff = 1.75;
8362					}, function(){
8363						coeff = 1;
8364					});
8365				}
8366
8367				// if ( speed > 0 ) {
8368				// 	dir = true
8369				// } else if ( speed < 0 ) {
8370				// 	dir = false
8371				// }
8372
8373				if ( ! $rotate.hasClass('uncode-rotate-scroll') ) {
8374					deg = deg+coeff;
8375					// if ( dir ) {
8376					// 	deg = deg+coeff;
8377					// } else {
8378					// 	deg = deg-coeff;
8379					// }
8380				}
8381
8382				$rotate[0].style.transform = 'rotate(' + deg + 'deg)';
8383
8384				requestAnimationFrame(function() {
8385					checkScroll($rotate);
8386				});
8387
8388			};
8389
8390			checkScroll($rotate);
8391
8392		});
8393
8394	};
8395
8396	$(window).on('load', loadRotateIt);
8397
8398};
8399
8400var marqueeAttempts = 0,
8401	marqueeTO;
8402
8403UNCODE.textMarquee = function( $titles ) {
8404
8405	var initTextMarquee = function( $titles ){
8406
8407		if ( typeof $titles == 'undefined' ) {
8408			$titles = $('.un-text-marquee');
8409		}
8410
8411		if ( ! $titles.length ) {
8412			return;
8413		}
8414
8415		$titles.each(function(){
8416			var $title = $(this),
8417				$span = $('> span', $title),
8418				txt,
8419				first = true,
8420				newW = UNCODE.wwidth;
8421
8422			$('.marquee-clone-wrap', $title).remove();
8423
8424			txt = $title.text();
8425
8426			if ( ! $('.marquee-original-core', $span).length ) {
8427				$span = $('> span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original');
8428			}
8429
8430			var checkResize,
8431				spanW,
8432				$prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'),
8433				$appended = $('<span class="marquee-clone-wrap wrap-appended" />'),
8434				clearSpeed,
8435				speed = 10;
8436
8437			$span.prepend($prepended);
8438			$span.append($appended);
8439
8440			var continuousTextMarquee = function(){
8441				var bound = $title.css({
8442						'transform': 'none',
8443						'opacity': 0
8444					}).offset();
8445
8446				var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left,
8447					xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ),
8448					xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ),
8449					direction = $title.hasClass('un-marquee-opposite') ? 1 : -1;
8450
8451				var marqueeTL = new TimelineMax({paused:true, reversed:true});
8452
8453				var inViewElement = $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ? $title.closest('.vc_row')[0] : $title[0];
8454
8455				var inview = new Waypoint.Inview({
8456					element: inViewElement,
8457					enter: function(direction) {
8458						marqueeTL.play();
8459					},
8460					exited: function(direction) {
8461						marqueeTL.pause();
8462					}
8463				});
8464
8465				//gsap.killTweensOf($title);
8466				marqueeTL.fromTo( $title, {
8467					opacity: 1,
8468					x: xStrt * direction * -1
8469				},
8470				{
8471					duration: xSpeed / UNCODE.wwidth * speed,
8472					x: xEnd * direction,
8473					onComplete: function(){
8474						first = false;
8475						continuousTextMarquee();
8476					},
8477					ease: Linear.easeNone
8478				});
8479			};
8480
8481			var runTextMarquee = function(){
8482				var time = Date.now();
8483
8484				var textMarqueeScroll = function(){
8485					var $row = $title.closest('.vc_row'),
8486						$bound = $title.closest('.pin-spacer').length ? $row : $title,
8487						bound = $bound[0].getBoundingClientRect(),
8488						wait = 100,
8489						direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1;
8490
8491					if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 &&
8492						bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 &&
8493						marqueeAttempts < 2 ) {
8494
8495						clearRequestTimeout(marqueeTO);
8496
8497						marqueeTO = requestTimeout(function(){
8498							marqueeAttempts++;
8499							initTextMarquee();
8500						}, 100);
8501					}
8502
8503					//if ((time + wait - Date.now()) < 0) {
8504						//if ( bound.top > ( bound.height * -4 ) && ( bound.top - bound.height ) < UNCODE.wheight * 2 ) {
8505							// $title[0].style.transform = 'translateX(' + ( UNCODE.wheight * 0.5 - bound.top ) * 0.75 + 'px)';
8506							gsap.killTweensOf($title);
8507							gsap.to( $title, {
8508								duration: 0.24,
8509								x: ( UNCODE.wheight * 0.35 - bound.top ) * 0.5 * direction,
8510								//ease: Expo.easeOut,
8511							});
8512						//}
8513						//time = Date.now();
8514					//}
8515				};
8516
8517				textMarqueeScroll();
8518				$(window).on( 'load scroll', function() {
8519					textMarqueeScroll();
8520				});
8521
8522			};
8523
8524			var cloneSpan = function($_title, cntnt){
8525
8526				if ( $_title.hasClass('un-marquee-infinite') ) {
8527					$('> span.marquee-clone-wrap', $_title).text('');
8528				}
8529
8530				gsap.to( $_title, {
8531					duration: 0,
8532					x: 0
8533				});
8534				spanW = $span.outerWidth();
8535
8536				if ( !spanW ) {
8537					return;
8538				}
8539
8540				var part = Math.ceil( UNCODE.wwidth / spanW ) * 2;
8541
8542				if ( $_title.hasClass('un-marquee-infinite') ) {
8543
8544					for ( var i = 0; i < part; i++ ) {
8545						$prepended[0].textContent += cntnt + "\u00A0";
8546						$appended[0].textContent += cntnt + "\u00A0";
8547					}
8548				}
8549
8550				if ( $('body').hasClass('compose-mode') ) {
8551					return;
8552				}
8553
8554				if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) {
8555					continuousTextMarquee();
8556				}
8557
8558				if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) {
8559					runTextMarquee();
8560				}
8561
8562			};
8563
8564			var marqueResize = function(){
8565				clearRequestTimeout(checkResize);
8566				checkResize = requestTimeout(function(){
8567					if ( newW !== UNCODE.wwidth ) {
8568						gsap.killTweensOf($title);
8569						initTextMarquee();
8570						newW = UNCODE.wwidth;
8571					}
8572				}, 1000);
8573			};
8574
8575			$(window).off('resize', marqueResize)
8576			.on( 'resize', marqueResize);
8577
8578			cloneSpan($title, txt);
8579
8580			if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8581				window.parent.vc.events.on( 'shortcodeView:updated', function( e ){
8582					// imageHover();
8583					var $_titles = $('.un-text-marquee',e.view.$el);
8584					initTextMarquee($_titles);
8585				});
8586			}
8587		});
8588	};
8589
8590	$(document).ready(function(){
8591		initTextMarquee();
8592	});
8593
8594};
8595
8596UNCODE.parallax = function() {
8597	if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) {
8598		if ($('.parallax-el').length > 0) {
8599			var parallax_elements = new Rellax('.parallax-el');
8600			$( document.body ).trigger('uncode_parallax_done', parallax_elements);
8601			window.addEventListener('boxResized', function(e) {
8602				parallax_elements.refresh();
8603			}, false);
8604			$(window).on('uncode_wc_variation_gallery_loaded', function (event) {
8605				requestTimeout(function() {
8606					parallax_elements.refresh();
8607				}, 100);
8608			});
8609
8610		}
8611	}
8612};
8613
8614UNCODE.magicCursor = function(){
8615	var $customCursor = $('#uncode-custom-cursor'),
8616		$customPilot = $('#uncode-custom-cursor-pilot'),
8617		$postLists = $('.uncode-post-titles'),
8618		currentCursor = 'auto',
8619		setTime,
8620		isScrolling,
8621		mouseEvent;
8622
8623	function delayChangeCursor(cursorType, delayt_time){
8624		clearRequestTimeout(setTime);
8625		setTime = requestTimeout(function() {
8626			$customCursor.attr('data-cursor', cursorType);
8627			if ( $customPilot.length ) {
8628				$customPilot.attr('data-cursor', cursorType);
8629			}
8630			currentCursor = cursorType;
8631		}, delayt_time);
8632	}
8633
8634	function changeCursor($wrap){
8635		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
8636		var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]',
8637			$href = $wrap.find(href),
8638			cursorType,
8639			setTime, set_delay;
8640
8641		$href.hover(function(e) {
8642			var $this = $(this),
8643				data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'),
8644				is_frontend_editor = $this.closest('.vc_controls').length,
8645				hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length,
8646				$parent_cursor = $this.closest('[class*="custom-cursor"]');
8647			if ( is_frontend_editor ) {
8648				cursorType = 'auto';
8649			} else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) {
8650				cursorType = data_cursor;
8651			} else if ( $parent_cursor.length ) {
8652				if ( $parent_cursor.hasClass('custom-cursor-light') ) {
8653					cursorType = 'icon-light';
8654				} else if ( $parent_cursor.hasClass('custom-cursor-diff') ) {
8655					cursorType = 'icon-diff';
8656				} else if ( $parent_cursor.hasClass('custom-cursor-accent') ) {
8657					cursorType = 'icon-accent';
8658				} else {
8659					cursorType = 'icon-dark';
8660				}
8661			} else {
8662				cursorType = 'pointer';
8663			}
8664			delayChangeCursor(cursorType, 0);
8665		}, function(){
8666			delayChangeCursor('auto', 150);
8667		});
8668
8669		$(window).on('disable-hover', function(event) {
8670			document.addEventListener("mousemove", function(e) {
8671				mouseEvent = e;
8672			});
8673			delayChangeCursor('auto', 0);
8674		});
8675
8676		$(window).on('enable-hover', function(event) {
8677			if ( typeof mouseEvent !== 'undefined' ) {
8678				var x = mouseEvent.clientX,
8679					y = mouseEvent.clientY;
8680
8681				var elements = document.elementsFromPoint(x, y),
8682					$element = $(elements[0]);
8683
8684				$element.closest(href).trigger('mouseenter');
8685			}
8686		});
8687
8688	}
8689
8690	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
8691		changeCursor();
8692	});
8693
8694	$(document).ajaxComplete(function( event, xhr, settings ) {
8695		changeCursor();
8696	});
8697
8698	$('.isotope-container').on('isotope-layout-complete', function() {
8699		var $this = $(this);
8700		changeCursor($this);
8701	});
8702
8703};
8704
8705UNCODE.magneticCursor = function(){
8706	function magneticCursor($wrap){
8707		$wrap = typeof $wrap === 'undefined' ? $('body') : $wrap;
8708		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'));
8709
8710		$magnetics.on('mousemove', function(e){
8711			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this),
8712				bound = e.currentTarget.getBoundingClientRect(),
8713				coeff = 30,
8714				hor = (bound.width / 2) - (e.clientX - bound.left),
8715				ver = (bound.height / 2) - (e.clientY - bound.top),
8716				toX = hor / bound.width * coeff,
8717				toY = ver / bound.height * coeff,
8718				scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2),
8719				scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2),
8720				toScale = Math.max(scaleX, scaleY);
8721
8722			gsap.killTweensOf($el);
8723			gsap.to( $el, {
8724				duration: 0.75,
8725				x: toX,
8726				y: toY,
8727				scale: toScale,
8728				ease: Power1.easeOut,
8729				transformPerspective: 900,
8730				transformOrigin: 'center',
8731				force3D: true
8732			});
8733		}).on('mouseout', function(e){
8734			var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this);
8735			gsap.killTweensOf($el);
8736			gsap.to( $el, {
8737				duration: 0.6,
8738				y: 0,
8739				x: 0,
8740				scale: 1,
8741				ease: Power1.easeOut,
8742				transformPerspective: 900,
8743				transformOrigin: 'center',
8744				force3D: true
8745			});
8746		});
8747	};
8748
8749	$(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) {
8750		magneticCursor();
8751	});
8752
8753	$(document).ajaxComplete(function( event, xhr, settings ) {
8754		magneticCursor();
8755	});
8756
8757	$('.isotope-container').on('isotope-layout-complete', function() {
8758		var $this = $(this);
8759		magneticCursor($this);
8760	});
8761
8762};
8763
8764UNCODE.dropImage = function() {
8765
8766	/****************************
8767	 * Image hover *
8768	****************************/
8769	function imageHover(){
8770		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
8771			return;
8772		}
8773
8774		var $postLists = $('.uncode-post-titles');
8775		$postLists.each(function(){
8776			var $list = $(this),
8777				timing = parseFloat( $list.attr('data-timing') ),
8778				default_image = $list.hasClass('uncode-post-titles-default-image'),
8779				default_title = $list.hasClass('uncode-post-titles-default-title'),
8780				$tmbs = $('.tmb', $list),
8781				$drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs),
8782				clientX,
8783				clientY,
8784				$row_parent = $list.closest('.vc_row'),
8785				$drop_row_parents = $('.drop-parent.drop-parent-row', $list),
8786				$col_parent = $list.closest('.uncell'),
8787				$drop_col_parents = $('.drop-parent.drop-parent-column', $list),
8788				setCTA;
8789
8790			timing *= 0.001;
8791
8792			var drop_bgs = function(){
8793				$drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){
8794					var $drop = $(this),
8795						srcset = $drop.attr('data-bgset'),
8796						setArr = srcset.split(","),
8797						setArrOrder = [],
8798						biggest = 0,
8799						checkBg = false;
8800
8801					if ( SiteParameters.uncode_adaptive == true ) {
8802						if (  typeof setArr[0] !== 'undefined' && setArr[0] !== null ) {
8803							$drop.css({
8804								'background-image' : 'url(' + setArr[0] + ')'
8805							});
8806						}
8807					} else {
8808						for ( var i = 0; i < setArr.length; i++ ) {
8809							var setLoop = setArr[i].trim().split(" ");
8810							if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) {
8811								var parseSet = parseFloat(setLoop[1]);
8812								if ( biggest < parseSet ) {
8813									biggest = parseSet;
8814								}
8815								setArrOrder[parseSet] = setLoop[0];
8816								if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) {
8817									checkBg = true;
8818									$drop.css({
8819										'background-image' : 'url(' + setLoop[0] + ')'
8820									});
8821								}
8822							}
8823						}
8824
8825						if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) {
8826							$drop.css({
8827								'background-image' : 'url(' + setArrOrder[biggest] + ')'
8828							});
8829						}
8830					}
8831
8832				});
8833			};
8834
8835			drop_bgs();
8836
8837			var dropMovesSize = function(){
8838				if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
8839					return;
8840				}
8841				$drop_moves.each(function(){
8842					var $drop_move = $(this),
8843						dataW = $drop_move.attr('data-w'),
8844						$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el');
8845					if ( typeof dataW !== 'undefined' && dataW !== null ) {
8846						dataW = screenInfo.width / 12 * parseFloat( dataW );
8847					}
8848					$drop_moves.css({
8849						width: dataW
8850					});
8851
8852					if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
8853						$anim_parent.on('animationend', function(){
8854							var bound = $anim_parent[0].getBoundingClientRect();
8855							$drop_move.css({
8856								left: bound.x * -1,
8857								top: bound.y * -1,
8858							});
8859						});
8860					}
8861				});
8862
8863
8864			};
8865
8866			dropMovesSize();
8867
8868			$(window).on( 'resize', function(){
8869				clearRequestTimeout(setCTA);
8870				setCTA = requestTimeout( function() {
8871					drop_bgs();
8872					dropMovesSize();
8873				}, 100 );
8874			});
8875
8876			if ( $drop_row_parents.length ) {
8877				$row_parent.addClass( 'drop-added' );
8878			}
8879
8880			$drop_row_parents.each(function(index, val){
8881				var $drop = $(val);
8882				$row_parent.prepend($drop);
8883				manageVideos($drop, false);
8884				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
8885					UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
8886				}
8887				if ( default_image && index == 0 ) {
8888					manageVideos($drop, true);
8889					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
8890						image_ph = new Image();
8891					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
8892						image_ph.onload = function() {
8893							$drop.addClass('active');
8894							if ( default_title ) {
8895								$list.addClass('drop-hover');
8896								$tmbs.first().addClass('drop-active');
8897							}
8898						};
8899						image_ph.src = bg_img;
8900					}
8901				}
8902			});
8903
8904			if ( $drop_col_parents.length ) {
8905				$col_parent.addClass( 'drop-added' );
8906			}
8907
8908			$drop_col_parents.each(function(index, val){
8909				var $drop = $(this);
8910				$col_parent.prepend($drop);
8911				manageVideos($drop, false);
8912				if ( typeof UNCODE.initVideoComponent !== 'undefined' ) {
8913					UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video');
8914				}
8915				if ( default_image && index == 0 ) {
8916					manageVideos($drop, true);
8917					var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1],
8918						image_ph = new Image();
8919					if ( typeof bg_img !== 'undefined' && bg_img !== null ) {
8920						image_ph.onload = function() {
8921							$drop.addClass('active');
8922							if ( default_title ) {
8923								$list.addClass('drop-hover');
8924								$tmbs.first().addClass('drop-active');
8925							}
8926						};
8927						image_ph.src = bg_img;
8928					}
8929				}
8930			});
8931
8932			function manageVideos( $el, start ) {
8933				var videoElem = $('video', $el),
8934					$iframe = $('iframe', $el),
8935					iframeID = $iframe.attr('id');
8936				if ( videoElem.length ) {
8937					if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') {
8938						if ( start ) {
8939							videoElem[0].setCurrentTime(0);
8940							videoElem[0].play();
8941						} else {
8942							videoElem[0].pause();
8943							videoElem[0].setCurrentTime(0);
8944						}
8945					} else {
8946						if ( start ) {
8947							videoElem[0].currentTime = 0;
8948							videoElem[0].play();
8949						} else {
8950							videoElem[0].pause();
8951							videoElem[0].currentTime = 0;
8952						}
8953					}
8954				}
8955
8956				$el.data('active', start);
8957
8958				if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) {
8959					var iframeIDv = iframeID.replace('okplayer-', ''),
8960						optionsV = $(window).data('okoptions-' + iframeIDv),
8961						vimeo = $iframe[0],
8962						playerV = new Vimeo.Player(vimeo),
8963						timeV = 0;
8964
8965					if (optionsV.time != null) {
8966						var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/);
8967						for ( var i = 0; i < timeArr.length; i++ ) {
8968							if ( timeArr[i] === 'h' ) {
8969								timeV += parseFloat(timeArr[i-1]) * 3600;
8970							} else if ( timeArr[i] === 'm' ) {
8971								timeV += parseFloat(timeArr[i-1]) * 60;
8972							} else if ( timeArr[i] === 's' ) {
8973								timeV += parseFloat(timeArr[i-1]);
8974							}
8975						}
8976					}
8977					playerV.setCurrentTime(timeV);
8978					if ( start ) {
8979						playerV.setVolume(0);
8980						playerV.play();
8981					} else {
8982						playerV.pause();
8983					}
8984				} else if ( $el.attr('data-provider') === 'youtube' ) {
8985					if ( start ) {
8986						$el.trigger('uncode-resume');
8987					} else {
8988						$el.trigger('uncode-pause');
8989					}
8990				}
8991
8992			}
8993
8994			if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
8995
8996				document.addEventListener("mousemove", function(e) {
8997					$drop_moves.each(function(){
8998						var $drop_move = $(this),
8999							duration = 0.4;
9000
9001						if ( $('#uncode-custom-cursor:not(.in-content)').length ) {
9002							duration = 0.8;
9003						}
9004
9005						clientX = e.clientX;
9006						clientY = e.clientY;
9007
9008						gsap.to( $drop_move, {
9009							duration: duration,
9010							x: clientX,
9011							y: clientY,
9012							ease: Power1.easeOut,
9013						});
9014					});
9015				});
9016
9017			} else {
9018
9019				$(window).on("touchend scroll", function(e) {
9020					$list.removeClass('drop-hover');
9021					$drop_moves.removeClass('active');
9022					$tmbs.removeClass('drop-active');
9023				});
9024
9025				$drop_moves.each(function(){
9026					var $drop_move = $(this),
9027						$tmb = $drop_move.closest('.tmb'),
9028						$anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el');
9029
9030					if ( $anim_parent.hasClass('uncode-skew') ) {
9031						$anim_parent.css({
9032							'transform': 'skew(0)'
9033						});
9034					}
9035
9036					$tmb.on('touchend', function(e){
9037						e.stopPropagation();
9038
9039						$drop_moves.removeClass('active');
9040						$tmbs.removeClass('drop-active');
9041
9042						$list.addClass('drop-hover');
9043						$tmb.addClass('drop-active');
9044						$drop_move.addClass('active');
9045						manageVideos($drop_move, true);
9046						clientX = e.changedTouches[0].clientX;
9047						clientY = e.changedTouches[0].clientY;
9048
9049						if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
9050							var bound = $anim_parent[0].getBoundingClientRect();
9051							clientX = clientX - bound.x;
9052							clientY = clientY - bound.y;
9053						}
9054
9055						$drop_move.css({
9056							left: clientX,
9057							top: clientY
9058						});
9059					});
9060				});
9061
9062			}
9063
9064			$tmbs.each(function(e){
9065				var $tmb = $(this),
9066					// $trgr = $('a', $tmb),
9067					$trgr = $tmb,
9068					$drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb),
9069					$anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
9069(.t-inside), .parallax-el'),
9070					$video = $('video', $tmb),
9071					$iframe = $('iframe', $tmb),
9072					$entryTxt = $('.t-entry-text', $tmb),
9073					stopBounding;
9074
9075				$entryTxt.add($drop_move).css({
9076					'transition-duration': timing + 's'
9077				});
9078
9079				if ( $video.length ) {
9080					var vidH = $video[0].videoHeight,
9081						vidW = $video[0].videoWidth;
9082					$video.css({
9083						'height': vidH,
9084						'width': vidW
9085					});
9086				}
9087
9088				if ( $iframe.length ) {
9089					var vidH = $drop_move.attr('data-height'),
9090						vidW = $drop_move.attr('data-width');
9091					$iframe.css({
9092						'height': vidH,
9093						'width': vidW
9094					});
9095				}
9096
9097				$iframe.each(function(){
9098					var $video = $(this),
9099						vidH = $video[0].videoHeight,
9100						vidW = $video[0].videoWidth;
9101					$video.css({
9102						'height': vidH,
9103						'width': vidW
9104					});
9105				});
9106
9107				if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
9108					$trgr.on('mouseenter',function(e){
9109						$list.addClass('drop-hover');
9110						$tmbs.removeClass('drop-active');
9111						$tmb.addClass('drop-active');
9112						$drop_move.addClass('active');
9113						manageVideos($drop_move, true);
9114
9115						var clientX = e.clientX,
9116							clientY = e.clientY;
9117						$drop_move.css({
9118							'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)'
9119						});
9120
9121					})
9122					.on('mouseleave', function(e){
9123						$list.removeClass('drop-hover');
9124						$drop_move.css({
9125							'transition-duration': ( timing*1.25 ) + 's'
9126						});
9127						$drop_move.removeClass('active');
9128						$tmb.removeClass('drop-active');
9129						$drop_move.on('transitionend', function(e){
9130							$drop_move.off('transitionend');
9131							$drop_move.css({
9132								'transition-duration': timing + 's'
9133							});
9134							manageVideos($drop_move,false);
9135						});
9136					});
9137
9138					document.addEventListener('visibilitychange', function(){
9139						if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) {
9140							$drop_move.css({
9141								'transition-duration': '0s'
9142							});
9143							$drop_move.removeClass('active');
9144							manageVideos($drop_move, false);
9145						}
9146					});
9147
9148					document.addEventListener('scroll', function(){
9149						window.clearRequestTimeout( stopBounding );
9150
9151						if ( $drop_move.hasClass('active') ) {
9152							$list.removeClass('drop-hover');
9153							$tmbs.removeClass('drop-active');
9154							$drop_move.removeClass('active');
9155							$drop_move.on('transitionend', function(e){
9156								$drop_move.off('transitionend');
9157								$drop_move.css({
9158									'transition-duration': timing + 's'
9159								});
9160								manageVideos($drop_move,false);
9161							});
9162						}
9163
9164						stopBounding = requestTimeout(function() {
9165							if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) {
9166								var bound = $anim_parent[0].getBoundingClientRect();
9167								$drop_move.css({
9168									left: bound.x * -1,
9169									top: bound.y * -1,
9170								});
9171							}
9172						}, 200);
9173
9174					});
9175				}
9176
9177				var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'),
9178					$drop = $('[data-drop="' + datatarget + '"]', $row_parent);
9179
9180				$drop.css({
9181					'transition-duration': timing + 's'
9182				});
9183
9184				if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) {
9185					$trgr.on('mouseenter',function(e){
9186						$row_parent.add($col_parent).addClass('drop-list-loaded');
9187						$list.addClass('drop-hover');
9188
9189						if ( !$tmb.hasClass('drop-active') ) {
9190							$tmbs.removeClass('drop-active');
9191							$tmb.addClass('drop-active');
9192							if ( default_image && !$drop.hasClass('active') ) {
9193								var $prev = $('[data-drop].active', $row_parent);
9194								$prev.css({
9195									'transition-duration': (timing*1.5) + 's'
9196								});
9197								$prev.removeClass('active');
9198								$prev.on('transitionend', function(e){
9199									$prev.off('transitionend');
9200									manageVideos($prev,false);
9201								});
9202							}
9203							$drop.css({
9204								'transition-duration': timing + 's'
9205							});
9206							$drop.off('transitionend');
9207							$drop.addClass('active');
9208							manageVideos($drop, true);
9209						}
9210					})
9211					.on('mouseleave', function(e){
9212						if ( ( default_image && !default_title ) || !default_image ) {
9213							$list.removeClass('drop-hover');
9214							$tmb.removeClass('drop-active');
9215						}
9216						if ( ! default_image ) {
9217							$drop.css({
9218								'transition-duration': (timing*1.5) + 's'
9219							});
9220							$drop.removeClass('active');
9221
9222							$drop.on('transitionend', function(e){
9223								$drop.off('transitionend');
9224								manageVideos($drop,false);
9225							});
9226						}
9227					});
9228
9229					document.addEventListener('visibilitychange', function(){
9230						if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) {
9231							$drop.css({
9232								'transition-duration': '0s'
9233							});
9234							$drop.removeClass('active');
9235							manageVideos($drop, false);
9236						}
9237					});
9238				}
9239			});
9240
9241		});
9242	};
9243
9244	$(window).on('load', function(event) {
9245		imageHover();
9246	});
9247
9248	var drop_wp_animation = function() {
9249		var $postLists = $('.uncode-post-titles');
9250		$postLists.each(function(){
9251			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
9252				new Waypoint({
9253					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
9254					element: val,
9255					handler: function() {
9256						var element = $(this.element),
9257							parent = element.closest('.tmb'),
9258							currentIndex = parent.index(),
9259							delay = currentIndex,
9260							delayAttr = parseInt(element.attr('data-delay'));
9261						if (isNaN(delayAttr)) delayAttr = 100;
9262						var objTimeout = requestTimeout(function() {
9263							element.addClass('start_animation');
9264
9265							var nextTimeout = requestTimeout(function() {
9266								$('.drop-image-separator', parent).addClass('start_animation');
9267							}, 50);
9268
9269						}, delay * delayAttr);
9270						if (!UNCODE.isUnmodalOpen) {
9271							this.destroy();
9272						}
9273					},
9274					offset: UNCODE.isFullPage ? '100%' : '90%'
9275				})
9276			});
9277		});
9278	}
9279
9280	var runWaypoints_TO,
9281		runWaypoints_delay = 0;
9282
9283	var runWaypoints = function(){
9284		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
9285			runWaypoints_delay = 400;
9286		}
9287		clearRequestTimeout(runWaypoints_TO);
9288		runWaypoints_TO = requestTimeout(function() {
9289			drop_wp_animation();
9290		}, runWaypoints_delay);
9291	};
9292	runWaypoints();
9293	$( document.body ).on( 'uncode_waypoints', runWaypoints );
9294	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9295		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
9296			// imageHover();
9297			runWaypoints();
9298		});
9299	}
9300};
9301
9302UNCODE.postTable = function() {
9303
9304	var clickRow = function(){
9305		var $postLists = $('.uncode-post-table');
9306
9307		$postLists.each(function(){
9308			var $postList = $(this),
9309				$tmbClicks = $('.tmb.tmb-click-row', $postList);
9310
9311			$tmbClicks.each(function(){
9312				var $tmb = $(this),
9313					$click = $('.table-click-row', $tmb);
9314				$('*:not(.table-click-row)', $tmb).on('click', function(e){
9315					e.preventDefault();
9316					e.stopPropagation();
9317					$click[0].click();
9318					return false;
9319				});
9320			});
9321
9322		})
9323	};
9324
9325	clickRow();
9326
9327	var hoverRow = function(){
9328		var $postLists = $('.uncode-post-table.uncode-post-table-hover');
9329
9330		$postLists.on('mouseenter', function(){
9331			$(this).addClass('post-table-hover');
9332		});
9333		$postLists.on('mouseleave', function(){
9334			$(this).removeClass('post-table-hover');
9335		});
9336	}
9337
9338	hoverRow();
9339
9340	var drop_wp_animation = function() {
9341		var $postLists = $('.uncode-post-table');
9342		$postLists.each(function(){
9343			$.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) {
9344				new Waypoint({
9345					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
9346					element: val,
9347					handler: function() {
9348						var element = $(this.element),
9349							parent = element.closest('.tmb'),
9350							currentIndex = parent.index(),
9351							delay = currentIndex,
9352							delayAttr = parseInt(element.attr('data-delay'));
9353						if (isNaN(delayAttr)) delayAttr = 100;
9354						var objTimeout = requestTimeout(function() {
9355							element.addClass('start_animation');
9356						}, delay * delayAttr);
9357						if (!UNCODE.isUnmodalOpen) {
9358							this.destroy();
9359						}
9360					},
9361					offset: UNCODE.isFullPage ? '100%' : '90%'
9362				})
9363			});
9364		});
9365	}
9366
9367	var runWaypoints_TO,
9368		runWaypoints_delay = 0;
9369
9370	var runWaypoints = function(){
9371		if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) {
9372			runWaypoints_delay = 400;
9373		}
9374		clearRequestTimeout(runWaypoints_TO);
9375		runWaypoints_TO = requestTimeout(function() {
9376			drop_wp_animation();
9377		}, runWaypoints_delay);
9378	};
9379	runWaypoints();
9380	$( document.body ).on( 'uncode_waypoints', runWaypoints );
9381	if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9382		window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){
9383			runWaypoints();
9384			// clickRow();
9385		});
9386	}
9387};
9388
9389UNCODE.rotatingTxt = function($ctxt) {
9390
9391	if ( $('body').hasClass('compose-mode') ) {
9392		return;
9393	}
9394
9395	$ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt;
9396	var setCTA;
9397
9398	$('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){
9399		var $heading = $(this),
9400			// debug = 0,
9401			cycle = 0,
9402			$trgt,
9403			$toMove,
9404			$highl,
9405			$col = $heading.closest('.uncont'),
9406			txt,
9407			arrTxt,
9408			textFadeIn, textFadeOut,
9409			removeWraps;
9410
9411		var defineObjs = function() {
9412			$('.uncode-rotating-text-start[data-text]', $heading).each(function(){
9413				var $rtx = $(this),
9414					fx = $rtx.attr('data-fx'),
9415					wait = $rtx.attr('data-wait'),
9416					$prev = $(this).prev().addClass('prev-rotating-start'),
9417					splitToMove = [],
9418					splitArray = [],
9419					lineArray = [],
9420					lineIndex = 0,
9421					lineStart = true,
9422					lineEnd = false,
9423					startSplit = false,
9424					$line_wrap = $rtx.closest('.heading-line-wrap'),
9425					same_line = true,
9426					$splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'),
9427					indexRtx = $splits.index($rtx);
9428
9429				fx = typeof fx === 'undefined' ? '' : fx;
9430				wait = typeof wait === 'undefined' ? '' : wait;
9431
9432				$splits.each(function(key, val){
9433					var $split = $(this),
9434						$new_line_wrap = $split.closest('.heading-line-wrap');
9435
9436					if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) {
9437						splitArray.push( $split );
9438					}
9439
9440					if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
9441						startSplit = false;
9442					}
9443
9444					if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) {
9445						splitArray.push( $split );
9446
9447						if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) {
9448							same_line = true;
9449						} else {
9450							same_line = false;
9451						}
9452					}
9453
9454					if ( key == indexRtx ) {
9455						if ( /\S/.test($split.text()) ) {
9456							startSplit = true;
9457							$line_wrap = $split.closest('.heading-line-wrap');
9458							splitArray.push( $split );
9459						} else {
9460							indexRtx++;
9461						}
9462					}
9463
9464					$line_wrap = $new_line_wrap;
9465				});
9466
9467				$toMove = $($.map(splitToMove, function(el){return el.get();}));
9468				$trgt = $($.map(splitArray, function(el){return el.get();}));
9469
9470				if ( same_line ) {
9471					$trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />');
9472					$trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />');
9473				}
9474
9475				if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) {
9476					$prev.addClass('empty-span-hidden');
9477				}
9478
9479				$highl = $('.heading-text-highlight-inner', $trgt);
9480
9481				$rtx.attr('data-animated', 'true');
9482				if ( cycle == 0 ) {
9483					$( document.body ).trigger('defer-highlights');
9484					cycle++;
9485					defineObjs();
9486					return;
9487				}
9488				cycle++;
9489
9490				txt = $rtx.attr('data-text');
9491				arrTxt = txt.split("|");
9492
9493				textFadeOut($trgt);
9494
9495			});
9496		};
9497
9498		removeWraps = function(){
9499
9500			// if ( debug == 1 ) return;
9501			var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner');
9502			for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) {
9503
9504
9505				var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(),
9506					$splitFlow = $($wraps[wrap_k]).find('.split-word-flow');
9507
9508				$($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove();
9509
9510				$splitFlow.each(function(){
9511					$(this).append($temp_highl);
9512				});
9513
9514				var $line_wrap = $wraps[wrap_k];
9515				var $parent_wrap = $line_wrap.parentNode;
9516				if ( $parent_wrap !== null ) {
9517					while ( $line_wrap.firstChild ) {
9518						$parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap);
9519					}
9520					$parent_wrap.removeChild($line_wrap);
9521				}
9522			}
9523			// debug++;
9524			defineObjs();
9525		};
9526
9527		var loop = 0;
9528		textFadeIn = function($trgt){
9529			var word = arrTxt[loop].split(" "),
9530				worsSpan = '',
9531				$wrap = $trgt.closest('.uncode-rotating-wrap'),
9532				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
9533				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx');
9534
9535			for (var w = 0; w < word.length; w++) {
9536				var highl;
9537				if ( $highl.length ) {
9538					highl = $highl[0].outerHTML;
9539				} else {
9540					highl = '';
9541				}
9542
9543				if ( w > 0 ) {
9544					worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner">&nbsp;</span>' + highl + '</span></span>';
9545				}
9546				var charachters = word[w].split('');
9547				worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">';
9548				for (var c = 0; c < charachters.length; c++) {
9549					worsSpan += '<span class="split-char">' + charachters[c] + '</span>';
9550				}
9551				worsSpan += '</span>' + highl + '</span></span>';
9552			}
9553
9554			if ( $wrap.length && $wrap_inner.length ) {
9555				var words_w = $wrap_inner.outerWidth();
9556				$wrap.css({
9557					width: words_w
9558				});
9559
9560				$highl = $('.heading-text-highlight-inner', $wrap);
9561				$highl.prependTo($wrap);
9562
9563				$wrap_inner.css({
9564					opacity: 0
9565				});
9566
9567				$wrap_inner.html(worsSpan);
9568				$('.heading-text-highlight-inner', $wrap_inner).remove();
9569				words_w = $wrap_inner.innerWidth();
9570
9571				var duration = 0.45;
9572
9573				$heading.removeClass('auto-width');
9574				if ( words_w > $col.width() ) {
9575					$heading.addClass('auto-width');
9576					words_w = 'auto';
9577					duration = 0;
9578				}
9579
9580				$wrap.css({
9581					'width': words_w,
9582					'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)',
9583				});
9584
9585				var $word_inner = $('.split-word-inner', $wrap_inner),
9586					$extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner');
9587
9588				var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
9589
9590				if ( !$target_fx.length ) {
9591					return;
9592				}
9593
9594				gsap.killTweensOf($target_fx);
9595
9596				if ( fx !== 'zoom' ) {
9597					gsap.fromTo( $target_fx, {
9598						y: fx === 'opacity' ? '0%' : '-10%'
9599					},{
9600						delay: duration,
9601						duration: 0.25,
9602						y: '0%',
9603						ease: Circ.easeOut,
9604					});
9605
9606					if ( !$wrap_inner.length ) {
9607						return;
9608					}
9609
9610					gsap.fromTo( $wrap_inner, {
9611						opacity: 0,
9612					},{
9613						delay: duration,
9614						duration: 0.25,
9615						opacity: 1,
9616						ease: Circ.easeOut,
9617						onComplete: function(){
9618							$('> .heading-text-highlight-inner', $wrap).remove();
9619							$wrap_inner.html(worsSpan);
9620							removeWraps();
9621						}
9622					})
9623
9624				} else {
9625					gsap.fromTo( $target_fx, {
9626						transformOrigin: '50%',
9627						opacity: 0,
9628						scale: 0.875,
9629					},{
9630						opacity: 1,
9631						delay: duration,
9632						duration: 0.25,
9633						scale: 1,
9634						ease: Circ.easeOut,
9635						onComplete: function(){
9636							$('> .heading-text-highlight-inner', $wrap).remove();
9637							$wrap_inner.html(worsSpan);
9638							removeWraps();
9639						}
9640					});
9641				}
9642
9643			} else {
9644
9645				if ( !$wrap_inner.length ) {
9646					return;
9647				}
9648
9649				gsap.to( $wrap_inner, {
9650					duration: 0.4,
9651					opacity: 0,
9652					ease: Power1.easeOut,
9653					onComplete: function(){
9654						$wrap_inner.html(worsSpan);
9655						words_w = $wrap_inner.innerWidth();
9656
9657						gsap.to( $wrap_inner, {
9658							duration: 0.2,
9659							opacity: 1,
9660							ease: Power1.easeOut,
9661							onComplete: function(){
9662								$('> .heading-text-highlight-inner', $wrap).remove();
9663								$wrap_inner.html(worsSpan);
9664								removeWraps();
9665							}
9666						})
9667					}
9668				});
9669			}
9670
9671			if ( loop < arrTxt.length-1 ) {
9672				loop++;
9673			} else {
9674				loop = 0;
9675			}
9676
9677		};
9678
9679		textFadeOut = function($trgt){
9680			var $word_inner = $('.split-word-inner', $trgt),
9681				$wrap = $trgt.closest('.uncode-rotating-wrap'),
9682				$wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'),
9683				fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'),
9684				wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait');
9685
9686			wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000;
9687
9688			var gsap_param = {
9689					delay: wait,
9690					duration: 0.25,
9691					y: fx === '' ? '10%' : '0%',
9692					opacity: 0,
9693					ease: Circ.easeOut,
9694					onStart: function(){
9695						if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) {
9696							$highl = $('.heading-text-highlight-inner', $wrap);
9697							$highl.prependTo($wrap);
9698						}
9699					},
9700					onComplete: textFadeIn,
9701					onCompleteParams: [$trgt]
9702				};
9703
9704			var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner;
9705
9706			if ( fx === '' ) {
9707				gsap_param.y = '10%';
9708			} else if ( fx === 'zoom' ) {
9709				gsap_param.scale = '1.045';
9710			}
9711
9712			if ( !$target_fx.length ) {
9713				return;
9714			}
9715
9716			if ( $heading.data('waypoint') !== true ) {
9717				var textInView = new Waypoint.Inview({
9718					context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window,
9719					element: $heading[0],
9720					enter: function(direction) {
9721						$heading.data('waypoint',true);
9722						gsap.fromTo( $target_fx, {
9723							transformOrigin: '50%'
9724						}, gsap_param );
9725					}
9726				});
9727			} else {
9728				gsap.fromTo( $target_fx, {
9729					transformOrigin: '50%'
9730				}, gsap_param );
9731			}
9732		};
9733
9734		if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) {
9735			window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){
9736				var $el = model.view.$el,
9737					shortcode = model.attributes.shortcode;
9738
9739				UNCODE.rotatingTxt($el);
9740			});
9741		} else {
9742			if ( $heading.hasClass('animate_inner_when_almost_visible') ) {
9743				$heading.on('already-animated', function(){
9744					removeWraps();
9745					window.addEventListener('removeOldLines', function(){
9746						clearRequestTimeout(setCTA);
9747						setCTA = requestTimeout( removeWraps, 150 );
9748					});
9749				});
9750			} else {
9751				$(window).on('load', function(){
9752					removeWraps();
9753					window.addEventListener('removeOldLines', function(){
9754						clearRequestTimeout(setCTA);
9755						setCTA = requestTimeout( removeWraps, 150 );
9756					});
9757				});
9758			}
9759		}
9760	});
9761
9762};
9763
9764UNCODE.verticalText = function() {
9765	$(window).on('menuCanvasOpen', function(){
9766		$('.vertical-text--fixed').fadeOut(500);
9767		$('.horizontal-text--fixed').fadeOut(500);
9768	}).on('menuCanvasClose', function(){
9769		$('.vertical-text--fixed').fadeIn(500);
9770		$('.horizontal-text--fixed').fadeIn(500);
9771	});
9772
9773	var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom');
9774	var showOnTopVerticalTexts = $('.vertical-text--vis-show-top');
9775	var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom');
9776	var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top');
9777
9778	if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) {
9779		window.addEventListener('scroll', function(e) {
9780			var totalPageHeight = document.body.scrollHeight;
9781			var scrollPoint = window.scrollY + window.innerHeight;
9782
9783			if (window.scrollY > 0) {
9784				showOnTopVerticalTexts.fadeOut();
9785				showOnTopHorizontalTexts.fadeOut();
9786			} else {
9787				showOnTopVerticalTexts.fadeIn();
9788				showOnTopHorizontalTexts.fadeIn();
9789			}
9790
9791			if (scrollPoint >= totalPageHeight) {
9792				hideOnBottomVerticalTexts.fadeOut();
9793				hideOnBottomHorizontalTexts.fadeOut();
9794			} else {
9795				hideOnBottomVerticalTexts.fadeIn();
9796				hideOnBottomHorizontalTexts.fadeIn();
9797			}
9798		}, false);
9799	}
9800};
9801
9802UNCODE.stickyScroll = function( $el ) {
9803	if ( typeof $el === 'undefined' || $el === null ) {
9804		$el = $('body');
9805	}
9806	var checkVisible = function( el, dir ) {
9807		if (typeof jQuery === "function" && el instanceof jQuery) {
9808			el = el[0];
9809		}
9810
9811		var off = 50;
9812		dir = typeof dir=='undefined' ? 'right' : dir;
9813		var rect = el.getBoundingClientRect();
9814
9815		return (
9816			(
9817				( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
9818				( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) ||
9819				( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) )
9820			) &&
9821			(
9822				( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) ||
9823				( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) ||
9824				( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) ||
9825				( rect.right <= window.innerWidth && rect.left >= 0 )
9826			)
9827		);
9828	};
9829
9830	var setItemsRelHeight = function(reset) {
9831		var $_el = $el;
9832		if ( $el.is('.index-scroll') ) {
9833			var $_el = $el.closest('.uncont');
9834		}
9835		$('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){
9836			$.each($('.tmb', item), function(index, val) {
9837				if ( reset === true ) {
9838					$(val).css( 'visibility', 'hidden' );
9839				} else {
9840					$(val).css( 'visibility', 'visible' );
9841				}
9842			});
9843		});
9844		$('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){
9845			$.each($('.tmb', item), function(index, val) {
9846				if ( reset === true ) {
9847					$(val).css( 'visibility', 'hidden' );
9848					$('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' );
9849				} else {
9850					var $rowParent = $(item).closest('.row-parent'),
9851						rowRatio = $rowParent.attr('data-height-ratio'),
9852						$rowInner = $(item).closest('.row-child'),
9853						rowRatioInner = $rowInner.attr('data-height'),
9854						paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
9855						$colContainer = $(item).closest('.uncell'),
9856						$uncont = $(item).closest('.uncont'),
9857						paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')),
9858						safe_heigth = $(item).data('safe-height'),
9859						winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(),
9860						offSet = $(item).offset().top - $uncont.offset().top,
9861						multiplier_h,
9862						data_viewport_h,
9863						body_border = $('.body-borders .top-border').outerHeight() * 2,
9864						remove_menu = $(item).data('vp-menu');
9865
9866					if ( rowRatio === 'full' || rowRatio === '' ) {
9867						rowRatio = 1;
9868					} else {
9869						rowRatio = rowRatio / 100;
9870					}
9871
9872					if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) {
9873						rowRatio = rowRatio;
9874					} else {
9875						rowRatio = rowRatio * rowRatioInner / 100;
9876					}
9877
9878					winHeight = winHeight * rowRatio;
9879
9880					if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
9881						multiplier_h = parseInt($(item).attr('data-vp-height'));
9882					} else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) {
9883						multiplier_h = parseInt($(item).attr('data-vp-height-md'));
9884					} else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) {
9885						multiplier_h = parseInt($(item).attr('data-vp-height-sm'));
9886					}
9887
9888					if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) {
9889						data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet );
9890						if ( remove_menu === true ) {
9891							data_viewport_h = data_viewport_h - UNCODE.menuHeight;
9892						}
9893						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h );
9894					} else {
9895						$('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' );
9896					}
9897
9898				}
9899			});
9900		});
9901		$('.index-scroll', $_el).each(function(i, item){
9902			var $uncoltable = $(item).closest('.uncoltable'),
9903				$rowParent = $(item).closest('.row-parent'),
9904				paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')),
9905				body_border = $('.body-borders .top-border').outerHeight() * 2,
9906				$index_row = $('.index-row', item),
9907				safe_heigth = $index_row.data('safe-height'),
9908				winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight();
9909			if ( UNCODE.wwidth < UNCODE.mediaQuery ) {
9910				var data_viewport_h = winHeight - ( paddingRow + body_border );
9911				$uncoltable.css({
9912					'min-height': data_viewport_h
9913				});
9914			} else {
9915				$uncoltable.css({
9916					'min-height': 'auto'
9917				});
9918			}
9919		});
9920
9921	}
9922	setItemsRelHeight();
9923
9924	var $index_scrolls = $('.index-scroll', $el);
9925
9926	$index_scrolls.each(function(key, value){
9927		var $index = $(this),
9928			$parent_row = $index.closest('.vc_row[data-parent]'),
9929			$index_row = $('.index-row', $index),
9930			dir = $index_row.attr('data-direction');
9931		dir = typeof dir === 'undefined' ? 'right' : dir;
9932
9933		$parent_row.addClass('unscroll-horizontal').attr('data-direction', dir);
9934	});
9935
9936	var $horScrolls = $('.unscroll-horizontal', $el);
9937
9938	if ( $horScrolls.length ) {
9939
9940		$('body').addClass('scrolling-trigger');
9941
9942		$horScrolls.each(function(key, value){
9943			var $section = $(this),
9944				$index_scroll = $('.index-scroll', $section),
9945				$index_row = $('.index-row', $index_scroll),
9946				dir = $section.attr('data-direction'),
9947				wrap = $index_row.attr('data-wrap'),
9948				$pinWrap,
9949				$pinTrigger;
9950
9951			dir = typeof dir === 'undefined' ? 'right' : dir;
9952			$pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />');
9953			$pinWrap = $('<div class="pin-wrap" />');
9954			if ( SiteParameters.is_frontend_editor ) {
9955				var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, '');
9956				$('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0]));
9957			} else {
9958				if ( wrap === 'column' ) {
9959					$index_scroll.wrapInner( $pinWrap );
9960				} else {
9961					$('> .row', $section).wrap( $pinWrap );
9962				}
9963				$section.wrapInner( $pinTrigger );
9964			}
9965
9966		});
9967
9968		var $pinWraps = $('.pin-wrap', $el);
9969
9970		var horScrollSizes = function(){
9971
9972			$pinWraps.each(function(key, val){
9973				var $pinWrap = $(this).attr('id','pin_wrap_' + key),
9974					$pinTrigger = $pinWrap.closest('.pin-trigger'),
9975					dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'),
9976					$index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger),
9977					$boxContainer = $('.box-container'),
9978					box_m = $boxContainer.css('margin-left'),
9979					st_active = true;
9980
9981				var setHorW,
9982				horWidth = function(){
9983					$index_scroll.each(function(){
9984						var $this = $(this),
9985							$index_row = $('.index-row', $this),
9986							$rowContainer = $index_row.closest('.vc_row'),
9987							$rowInner = $index_row.closest('.wpb_row'),
9988							$rowParent = $index_row.closest('.row-parent'),
9989							$tmbs = $('.tmb', $index_row),
9990							padding_tmb = parseFloat( $tmbs.first().css('padding-right') ),
9991							$uncont = $index_row.closest('.uncont'),
9992							$parent_col = $index_row.closest('.wpb_column'),
9993							col_w = $uncont.width(),
9994							data_lg = parseFloat( $index_row.attr('data-lg') ),
9995							data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ),
9996							data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ),
9997							tmb_w;
9998
9999						col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w;
10000						tmb_w = ( col_w + padding_tmb ) / data_lg;
10001
10002						if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) {
10003							tmb_w = ( col_w + padding_tmb ) / data_sm;
10004						} else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) {
10005							tmb_w = ( col_w + padding_tmb ) / data_md;
10006						}
10007
10008						if ( !isNaN(tmb_w) ) {
10009							$tmbs.css({
10010								'width': tmb_w
10011							});
10012						}
10013
10014						$tmbs.css({
10015							'visibility': 'visible'
10016						});
10017
10018					});
10019				};
10020
10021				horWidth();
10022				clearRequestTimeout(setHorW);
10023				setHorW = requestTimeout( function(){
10024					setItemsRelHeight();
10025					horWidth();
10026				}, 100 );
10027
10028				if ( SiteParameters.is_frontend_editor ) {
10029					return;
10030				}
10031
10032				var $vmenu = $('body.vmenu .vmenu-container'),
10033					vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0,
10034					winWidth = window.innerWidth - vmenuW,
10035					$tmb = $('.tmb', $index_scroll).eq(0),
10036					paddingRight = parseFloat( $tmb.css('padding-right') ),
10037					stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ),
10038					remove_menu = $('.index-row', $index_scroll).data('vp-menu'),
10039					scroll_anim;
10040
10041				if ( $('body').hasClass('rtl') ) {
10042					if ( dir === 'left' ) {
10043						scroll_anim = gsap.fromTo( $pinWrap, {
10044							x: stickyScrollLength
10045						},{
10046							x: 0,
10047							ease: "none"
10048						});
10049					} else {
10050						scroll_anim = gsap.fromTo( $pinWrap, {
10051							x: 0
10052						},{
10053							x: stickyScrollLength,
10054							ease: "none"
10055						});
10056					}
10057				} else {
10058					if ( dir === 'left' ) {
10059						scroll_anim = gsap.fromTo( $pinWrap, {
10060							x: -stickyScrollLength
10061						},{
10062							x: 0,
10063							ease: "none"
10064						});
10065					} else {
10066						scroll_anim = gsap.fromTo( $pinWrap, {
10067							x: 0
10068						},{
10069							x: -stickyScrollLength,
10070							ease: "none"
10071						});
10072					}
10073				}
10074
10075				if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) {
10076					ScrollTrigger.getById("stickySectionScrolling" + key).kill(true);
10077				}
10078
10079				var animationIncrease;
10080
10081				var checkForAnimations = function(){
10082					animationIncrease = 0
10083					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
10084						var _this = this,
10085							isScrolling;
10086						if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) {
10087							var delayAttr = parseFloat( $(_this).attr('data-delay') );
10088							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
10089							requestTimeout(function() {
10090								$(_this).addClass('start_animation');
10091							}, delayAttr + animationIncrease);
10092							animationIncrease += 150;
10093						}
10094					});
10095				};
10096				checkForAnimations();
10097
10098				// var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0;
10099				var start = 0;
10100
10101				var horST = ScrollTrigger.create({
10102					id: "stickySectionScrolling" + key,
10103					scrub: true,
10104					trigger: $pinTrigger[0],
10105					pin: true,
10106					anticipatePin: 1,
10107					start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); },
10108					end: function() { return "+="+stickyScrollLength; },
10109					animation: scroll_anim,
10110					ease: Sine.easeOut,
10111					onUpdate: checkForAnimations,
10112					invalidateOnRefresh: true,
10113					onEnter: function(){
10114						$pinTrigger.addClass('enter-st');
10115					},
10116					onEnterBack: function(){
10117						$pinTrigger.addClass('enter-st');
10118					},
10119					onLeave: function(){
10120						$pinTrigger.removeClass('enter-st');
10121					},
10122					onLeaveBack: function(){
10123						$pinTrigger.removeClass('enter-st');
10124					}
10125				});
10126
10127				window.dispatchEvent(new CustomEvent('dynamic_srcset_load'));
10128				window.dispatchEvent(new CustomEvent('boxResized'));
10129
10130				var testSecondTrigger = function(){
10131					animationIncrease = 0
10132					$('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){
10133						var _this = this;
10134						if ( checkVisible(_this) ) {
10135							var delayAttr = parseFloat( $(_this).attr('data-delay') );
10136							if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0;
10137							requestTimeout(function() {
10138								$(_this).addClass('start_animation');
10139							}, delayAttr + animationIncrease);
10140							animationIncrease += 150;
10141						}
10142					});
10143
10144				};
10145
10146				var verST = ScrollTrigger.create({
10147					id: "verticalSectionScrolling" + key,
10148					trigger: $pinTrigger[0],
10149					start: "top center",
10150					end: function() { return "+="+UNCODE.wheight; },
10151					onUpdate: testSecondTrigger,
10152					invalidateOnRefresh: true
10153				});
10154
10155				var setCTA,
10156
10157				dis_enable_ST = function(){
10158					if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) {
10159						horST.kill();
10160						verST.kill();
10161						$pinTrigger.addClass('disabled');
10162						st_active = false;
10163					} else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) {
10164						horST.kill();
10165						verST.kill();
10166						$pinTrigger.addClass('disabled');
10167						st_active = false;
10168					}
10169				};
10170
10171				$(window).on('resize load', function() {
10172					clearRequestTimeout(setCTA);
10173					setCTA = requestTimeout(function() {
10174						dis_enable_ST();
10175						checkForAnimations();
10176					}, 500);
10177				});
10178
10179			});
10180		};
10181
10182		$(window).on( 'load', function(){
10183			horScrollSizes();
10184		});
10185		var setResize,
10186			setReLayout,
10187			doubleResize = true,
10188			oldW = UNCODE.wwidth;
10189		$(window).on( 'resize orientationchange', function(){
10190			if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) {
10191				return;
10192			} else {
10193				oldW = UNCODE.wwidth;
10194			}
10195			setItemsRelHeight(true);
10196			var $row_inners = document.querySelectorAll('.pin-spacer .row-inner');
10197			Array.prototype.forEach.call($row_inners, function(el) {
10198				el.style.height = '';
10199				el.style.marginBottom = '';
10200			});
10201			clearRequestTimeout(setResize);
10202			setResize = requestTimeout( function(){
10203				setItemsRelHeight();
10204				horScrollSizes();
10205				ScrollTrigger.refresh();
10206				if ( doubleResize === true ) {
10207					window.dispatchEvent(new Event('resize'));
10208					doubleResize = false;
10209				} else {
10210					doubleResize = true;
10211				}
10212				UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true);
10213			}, 100 );
10214		});
10215
10216		var show_pins = function(){
10217			$('.index-scroll').css({'opacity':'1'});
10218			setResize = requestTimeout( function(){
10219			}, 10 );
10220		};
10221		ScrollTrigger.addEventListener("refresh", show_pins);
10222		$(window).on( 'uncode.re-layout', function(){
10223			//$('.index-scroll').css({'opacity':'0'});
10224			$('.pin-spacer').each(function(){
10225				var space_h = $(this).outerHeight(),
10226					$row = $(this).closest('.row-container');
10227				$row.css({
10228					'height': space_h,
10229					'overflow': 'hidden'
10230				});
10231			});
10232			ScrollTrigger.refresh(true);
10233			clearRequestTimeout(setReLayout);
10234			setReLayout = requestTimeout( function(){
10235				$('.row-container').each(function(){
10236					$(this).css({
10237						'height': '',
10238						'overflow': ''
10239					});
10240				});
10241			}, 1000);
10242		});
10243	}
10244
10245};
10246
10247UNCODE.stickyTrigger = function( $el ) {
10248	if ( SiteParameters.is_frontend_editor ) {
10249		return false;
10250	}
10251
10252	var stickyTrigger = function(){
10253		var stickyTrick = $('.sticky-trigger').each(function(){
10254			var $sticky = $(this),
10255				$inside = $('> div', $sticky),
10256				insideH = $inside.outerHeight(),
10257				$row = $sticky.closest('.vc_row'),
10258				$uncont = $sticky.closest('.uncont'),
10259				rowBottom,
10260				uncontBottom ,
10261				diffBottom;
10262
10263			ScrollTrigger.create({
10264				trigger: $sticky,
10265				start: function(){ return "top center-=" + insideH/2; },
10266				endTrigger: $row,
10267				end:  function(){
10268					rowBottom = $row.offset().top + $row.outerHeight();
10269					uncontBottom = $uncont.offset().top + $uncont.outerHeight();
10270					diffBottom = rowBottom - uncontBottom;
10271					return "bottom center+=" + ( insideH/2 + diffBottom );
10272				},
10273				anticipatePin: true,
10274				pin: true,
10275				pinSpacing: false,
10276				scrub: true,
10277				invalidateOnRefresh: true,
10278			});
10279
10280		});
10281	},
10282	setResizeSticky;
10283
10284	$(window).on( 'load', function(){
10285		stickyTrigger();
10286	});
10287
10288	var oldW = UNCODE.wwidth;
10289	$(window).on( 'resize uncode.re-layout', function(e){
10290		clearRequestTimeout(setResizeSticky);
10291		if ( e.type === 'resize' && oldW === UNCODE.wwidth ) {
10292			return;
10293		} else {
10294			oldW = UNCODE.wwidth;
10295		}
10296		setResizeSticky = requestTimeout( function(){
10297			stickyTrigger();
10298			ScrollTrigger.refresh();
10299		}, 1000 );
10300	});
10301
10302};
10303
10304UNCODE.revslider = function() {
10305	var revSliderIn = function(){
10306		$('rs-module').each(function(){
10307			var $slider = $(this);
10308
10309			$slider.on('revolution.slide.onloaded', function(e, data){
10310				if ( $(e.currentTarget).closest(".header-revslider").length ) {
10311					var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"),
10312						scrolltop = $(document).scrollTop();
10313					if ( style != undefined ) {
10314						UNCODE.switchColorsMenu(scrolltop, style);
10315					}
10316				}
10317			});
10318
10319			$slider.on('revolution.slide.onchange', function(e, data){
10320				if ( $(e.currentTarget).closest(".header-revslider").length ) {
10321					var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"),
10322						scrolltop = $(document).scrollTop();
10323					if ( style != undefined ) {
10324						UNCODE.switchColorsMenu(scrolltop, style);
10325					}
10326				}
10327			});
10328
10329		});
10330	};
10331	revSliderIn();
10332	$(window).on("load", revSliderIn );
10333};
10334UNCODE.layerslider = function() {
10335	$(window).on("load", function() {
10336
10337		$('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) {
10338
10339			var slideData = slider.slides.current.data,
10340				scrolltop = $(document).scrollTop();
10341			if( slideData && slideData.skin ) {
10342
10343				UNCODE.switchColorsMenu(scrolltop, slideData.skin);
10344
10345			}
10346		});
10347
10348	});
10349};
10350
10351UNCODE.ajax_filters = function() {
10352
10353/*************************
10354 *
10355 * Filters Menu and Widgets Area
10356 *
10357 ************************/
10358
10359 	var clear_clicked = false;
10360
10361 	var init_ajax_grid = function(){
10362
10363		var $grids = $('.ajax-grid-system:not(.init-ajax-grid)');
10364		$grids.each(function(index, val){
10365			var $body = $('body'),
10366				$grid = $(val).addClass('init-ajax-grid'),
10367				starting_point = $grid.attr('data-toggle'),
10368				$trigger = $('.uncode-toggle-ajax-filters', $grid),
10369				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid),
10370				$isotope_wrapper = $('.isotope-wrapper', $grid),
10371				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper),
10372				$sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid),
10373				$footprint = $('.ajax-filter-footprint', $grid),
10374				sidebar_w,
10375				data_w = parseFloat( $sidebar.attr('data-max-width') ),
10376				$firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'),
10377				skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark',
10378				$positioned_top = $('.ajax-filter-position-horizontal', $grid),
10379				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
10380				$close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper),
10381				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0),
10382				sidew,
10383				$inside_row = $('> .row-parent', $vc_row),
10384				bg_row,
10385				$side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper),
10386				$side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper),
10387				$apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
10388				sidebar_overlay = false,
10389				sidebar_hover = false,
10390				switchMobile = false,
10391				scrollTop;
10392
10393			if ( $vc_row.attr('class') ) {
10394				bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/);
10395			}
10396
10397			if ( bg_row != null ) {
10398				$side_header.add($side_footer).addClass(bg_row[0]);
10399			}
10400
10401			$trigger.add($apply_filters).on('click', function(e){
10402				e.preventDefault();
10403				e.stopPropagation();
10404				$grid = $('.ajax-grid-system').eq(0);
10405				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
10406				overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length,
10407				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
10408				sidebar_w = $sidebar_wrapper.width();
10409				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
10410				if ($(this).hasClass('ajax-filter-sidebar__button--clear')) {
10411					$(this).trigger('uncode-ajax-clear-filters');
10412				}
10413				if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10414					$grid.toggleClass('ajax-hide-filters-blanks');
10415					$sidebar.slideToggle({
10416						duration: 400,
10417						easing: 'easeOutQuad',
10418					});
10419				} else {
10420					$grid.removeClass('ajax-hide-filters-blanks');
10421					$grid.toggleClass('ajax-hide-filters');
10422					if ( $grid.hasClass('ajax-hide-filters') ) {
10423						$body.addClass('ajax-hide-filters');
10424					} else {
10425						scrollTop = $('html, body').scrollTop();
10426						$body.removeClass('ajax-hide-filters');
10427					}
10428				}
10429				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
10430					$('html, body').scrollTop(scrollTop);
10431				}
10432				return false;
10433			});
10434
10435			$close_btn.on('click', function(e){
10436				e.preventDefault();
10437				$grid = $('.ajax-grid-system').eq(0);
10438				$grid.addClass('ajax-hide-filters');
10439				if ( $grid.hasClass('ajax-hide-filters') ) {
10440					$body.addClass('ajax-hide-filters');
10441				} else {
10442					scrollTop = $('html, body').scrollTop();
10443					$body.removeClass('ajax-hide-filters');
10444				}
10445				$('html, body').scrollTop(scrollTop);
10446			});
10447
10448			$sidebar_wrapper.on('mouseover',function(){
10449				sidebar_hover = true;
10450			}).on('mouseout', function(){
10451				sidebar_hover = false;
10452			});
10453
10454			$body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){
10455				if ( $(e.target).closest('.ajax-filter-sidebar').length ) {
10456					return;
10457				}
10458				if (undefined !== from && from === 'select_active_attributes') {
10459					return;
10460				}
10461				if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) {
10462					$grid.add($body).addClass('ajax-hide-filters');
10463				}
10464			});
10465
10466			$sorting_trgr.on('click', function(e) {
10467				e.preventDefault();
10468			});
10469
10470			var inside_width = function(){
10471				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
10472				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
10473				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
10474				$inside_row = $('> .row-parent', $vc_row);
10475				if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) {
10476					sidew = $sidebar.width();
10477					$inside_row.css({
10478						width: sidew
10479					});
10480				} else {
10481					$inside_row.css({
10482						width: ''
10483					});
10484				}
10485			};
10486			inside_width();
10487
10488			var ajax_sidebar_position = function(e, f_editor){
10489				$grid = $('.ajax-grid-system').eq(0);
10490				$sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0);
10491				$positioned_top = $('.ajax-filter-position-horizontal', $grid);
10492				$sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper);
10493				$vc_row = $('.vc_row', $sidebar_wrapper).eq(0);
10494				$inside_row = $('> .row-parent', $vc_row);
10495				scrollTop = $('html, body').scrollTop();
10496				if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) {
10497					$grid.add($body).addClass('ajax-hide-filters');
10498					$sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />');
10499					$body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
10500					sidebar_overlay = true;
10501					$body.addClass('ajax-filter-sidebar-overlay');
10502					$sidebar_wrapper.addClass(skin);
10503					var sideHeadH = $side_header.outerHeight(),
10504						sideFooterH = $side_footer.outerHeight();
10505					if ( data_w !== '' && data_w > 0 ) {
10506						if ( UNCODE.wwidth >= UNCODE.mediaQuery ) {
10507							$sidebar.css({
10508								'max-width': data_w
10509							});
10510						} else {
10511							$sidebar.css({
10512								'max-width':'none'
10513							});
10514						}
10515					}
10516					$vc_row.css({
10517						'padding-top':sideHeadH,
10518						'padding-bottom':sideFooterH
10519					});
10520					var sidew = $sidebar.width();
10521					$inside_row.css({
10522						width: sidew
10523					});
10524					switchMobile = true;
10525				} else {
10526					if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) {
10527						scrollTop = $('html, body').scrollTop();
10528						$grid.add($body).removeClass('ajax-hide-filters');
10529					}
10530					if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) {
10531						$grid.addClass('ajax-hide-filters-blanks');
10532						$sidebar.hide();
10533					}
10534					$('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas'));
10535					$('.ajax-sidebar-placeholder', $grid).remove();
10536					sidebar_overlay = false;
10537					$body.removeClass('ajax-filter-sidebar-overlay');
10538					$sidebar_wrapper.removeClass(skin);
10539					if ( data_w !== '' && data_w > 0 ) {
10540						$sidebar.css({
10541							'max-width':'none'
10542						});
10543					}
10544					$vc_row.css({
10545						'padding-top':0,
10546						'padding-bottom':0,
10547					});
10548
10549					$inside_row.css({
10550						width: ''
10551					});
10552
10553					if ( f_editor === true ) {
10554						UNCODE.ajax_filters();
10555					}
10556
10557					switchMobile = false;
10558				}
10559				if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) {
10560					$('html, body').scrollTop(scrollTop);
10561				}
10562			};
10563
10564			var sidebar_width = function(){
10565				if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) {
10566					sidebar_w = $footprint.width();
10567					$sidebar.css({ width: sidebar_w });
10568				} else {
10569					$sidebar.css({ width: '' });
10570				}
10571			};
10572			sidebar_width();
10573
10574			if ( SiteParameters.is_frontend_editor ) {
10575				ajax_sidebar_position();
10576			}
10577
10578			$(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){
10579				if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) {
10580					ajax_sidebar_position(e);
10581				}
10582				sidebar_width();
10583			});
10584
10585			$(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){
10586				ajax_sidebar_position(e, true);
10587			});
10588
10589			$isotope_wrapper.on('transitionend', function(e){
10590				if ( $(e.target).hasClass('isotope-wrapper') ) {
10591					window.dispatchEvent(new CustomEvent('boxResized'));
10592				}
10593				return false;
10594			});
10595
10596			if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) {
10597				var $grid = $('.ajax-grid-system').eq(0);
10598				$grid.addClass('ajax-hide-filters');
10599			}
10600
10601		});
10602	};
10603
10604	init_ajax_grid();
10605	$(document).on('uncode-ajax-filtered', init_ajax_grid);
10606
10607/*************************
10608 *
10609 * Hover hack
10610 *
10611 ************************/
10612 	var widget_hover_hack = function() {
10613 		$('.widget, .uncode_widget').each(function(){
10614			var $widget = $(this),
10615				class_w = $widget.attr('class'),
10616				$lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'),
10617				$footer = $widget.closest('#colophon');
10618
10619			if ( class_w.indexOf('widget_yith') > 0 ) {
10620				return true;
10621			}
10622
10623			$lis.each(function(){
10624 				var $li = $(this),
10625 					$a = $('a', $li),
10626 					$label = $a.closest('label');
10627
10628				if ( !$footer.length ) {
10629					$li.addClass('no-evts');
10630				}
10631
10632				if ( ! $('span', $a).length ) {
10633 					$li.addClass( 'li-hover' );
10634 				}
10635
10636 				$('li', $li).hover(function(e){
10637 					$(e.target).parents('li').each(function(){
10638 						$(this).addClass( 'parent-li-hover' );
10639 					});
10640					}, function (e) {
10641 					$(e.target).parents('li').each(function(key, val){
10642 						if ( key === 0) {
10643	 						$(val).removeClass( 'parent-li-hover' );
10644	 					}
10645 					});
10646 				});
10647
10648				$li.off('mouseup').on('mouseup', function (e) {
10649					if (e.which !== 3) {
10650						e.stopPropagation();
10651						var $a = $('a', this).first();
10652						$a[0].click();
10653					}
10654	 			});
10655 			});
10656 		});
10657 	}
10658	widget_hover_hack();
10659	$(document).on('uncode-ajax-filtered', widget_hover_hack);
10660
10661/*************************
10662 *
10663 * Init Filters
10664 *
10665 ************************/
10666
10667	function init_filters() {
10668		$(document).on('click', '.term-filter-link', function(e) {
10669			var _this = $(this);
10670			var widget = _this.closest('.uncode_widget');
10671			var container = get_filters_container();
10672
10673			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
10674				return true;
10675			}
10676
10677			e.preventDefault();
10678
10679			if (widget.hasClass('widget-ajax-filters--checkbox')) {
10680				_this.parent().find('input[type="checkbox"]').trigger('click');
10681			} else {
10682				if (_this.hasClass('term-filter-link--active')) {
10683					_this.removeClass('term-filter-link--active');
10684				} else {
10685					_this.addClass('term-filter-link--active');
10686
10687					if (widget.hasClass('widget-ajax-filters--single')) {
10688						widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active');
10689					}
10690				}
10691
10692				var url = _this.attr('href');
10693
10694				reload_items(container, url, true);
10695			}
10696		});
10697
10698		$(document).on('click', '.term-filter input[type="checkbox"]', function(e) {
10699			var _this = $(this);
10700			var widget = _this.closest('.uncode_widget');
10701			var link = _this.closest('.term-filter').find('.term-filter-link');
10702			var url = link.attr('href');
10703			var container = get_filters_container();
10704
10705			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
10706				window.location = url;
10707				return;
10708			}
10709
10710			if (widget.hasClass('widget-ajax-filters--single')) {
10711				widget.find('input[type="checkbox"]').each(function() {
10712					if (_this.attr('id') !== $(this).attr('id')) {
10713						$(this).prop('checked', false);
10714						$(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active');
10715					}
10716				});
10717			}
10718
10719			if (_this.prop('checked')) {
10720				link.addClass('term-filter-link--active');
10721			} else {
10722				link.removeClass('term-filter-link--active');
10723			}
10724
10725			reload_items(container, url, true);
10726		});
10727
10728		$(document).on('change', 'select.select--term-filters', function(e) {
10729			var _this = $(this);
10730			var selected = _this.find('option:selected');
10731			var option = $(selected);
10732			var url = option.attr('data-term-filter-url');
10733			var container = get_filters_container();
10734			var widget = _this.closest('.uncode_widget');
10735
10736			if (widget.hasClass('widget-ajax-filters--no-ajax')) {
10737				window.location = url;
10738			} else {
10739				reload_items(container, url, true);
10740			}
10741		});
10742
10743		$(document).on('click', '.filter-list__link', function(e) {
10744			if (SiteParameters.is_frontend_editor) {
10745				return false;
10746			}
10747
10748			e.preventDefault();
10749
10750			var _this = $(this);
10751			var container = get_filters_container();
10752			var url = _this.attr('href');
10753			reload_items(container, url, true);
10754		});
10755
10756		$('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) {
10757			var _this = $(this);
10758			var container = get_filters_container();
10759			var url = _this.attr('href');
10760			reload_items(container, url, true);
10761		});
10762
10763		$(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) {
10764
10765			var _this = $(this);
10766			var container = get_filters_container();
10767			var url = _this.attr('href');
10768
10769			if ( container.length ) {
10770				e.preventDefault();
10771				reload_items(container, url, true);
10772			}
10773		});
10774
10775		$(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) {
10776			var _this = $(this);
10777			var container = get_filters_container();
10778
10779			if (container.length > 0) {
10780				e.preventDefault();
10781
10782				var min_price = $('#min_price').val();
10783				var max_price = $('#max_price').val();
10784				var location = window.location;
10785				var url = location.href;
10786				var page_uri = location.origin + location.pathname;
10787				var is_filtered = page_uri !== url;
10788
10789				if (is_filtered) {
10790					url = remove_parameter_from_url(url, 'min_price');
10791					url = remove_parameter_from_url(url, 'max_price');
10792				}
10793
10794				var concat = page_uri === url ? '?' : '&';
10795				var params = {'min_price': min_price, 'max_price': max_price};
10796
10797				url = url + concat + $.param(params);
10798
10799				reload_items(container, url, true);
10800			}
10801		});
10802
10803		var search_timer;
10804
10805		$(document).on('keyup', '.term-filters-search-input', function(e) {
10806			var _this = $(this);
10807			var container = get_filters_container();
10808			var value = _this.val();
10809
10810			if (search_timer) {
10811				clearTimeout(search_timer);
10812			}
10813
10814			search_timer = setTimeout(function() {
10815				update_search_url(container, value);
10816			}, 500);
10817		});
10818	}
10819
10820	function update_search_url(container, search_value) {
10821		var location = window.location;
10822		var url = location.href;
10823		var page_uri = location.origin + location.pathname;
10824		var is_filtered = page_uri !== url;
10825		var key_search = SiteParameters.ajax_filter_key_search;
10826		var key_unfilter = SiteParameters.ajax_filter_key_unfilter;
10827
10828		if (is_filtered) {
10829			url = remove_parameter_from_url(url, key_search);
10830			url = remove_parameter_from_url(url, key_unfilter);
10831		}
10832
10833		if (search_value) {
10834			var concat = page_uri === url ? '?' : '&';
10835			var params = {};
10836
10837			params[key_search] = search_value;
10838			params[key_unfilter] = 1;
10839			url = url + concat + $.param(params);
10840		} else {
10841			url = remove_parameter_from_url(url, key_search);
10842		}
10843
10844		reload_items(container, url, true);
10845	}
10846
10847	function remove_parameter_from_url(url, parameter) {
10848		return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1');
10849	}
10850
10851	function get_filters_container() {
10852		var container = $('.ajax-grid-system');
10853
10854		if (container.length == 0) {
10855			container = $('.ajax-filters');
10856		}
10857
10858		return container;
10859	}
10860
10861	function update_widgets_state(widgets_states, container) {
10862		for (var i = widgets_states.length - 1; i >= 0; i--) {
10863			var state = widgets_states[i];
10864
10865			if (!state.collapse) {
10866				continue;
10867			}
10868
10869			var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"');
10870
10871			if (state.open) {
10872				new_widget.find('.widget-title').addClass('open');
10873				if (state.css) {
10874					new_widget.find('.widget-collapse-content').attr('style', state.css);
10875				}
10876			} else {
10877				new_widget.find('.widget-title').removeClass('open');
10878				if (state.css) {
10879					new_widget.find('.widget-collapse-content').attr('style', state.css);
10880				}
10881			}
10882		}
10883	}
10884
10885	// Reload items via AJAX
10886	function reload_items(container, url, push) {
10887		container.addClass('grid-filtering');
10888
10889		$.ajax({
10890			url     : url,
10891			success : function(response) {
10892				if (!response) {
10893					return;
10894				}
10895
10896				$(document).trigger('uncode-ajax-pre-filtered');
10897
10898				var container_id = container.attr('id');
10899				var pagination = $('.row-navigation');
10900
10901				if (container_id) {
10902					var container_to_append = $(response).find('#' + container_id);
10903					var pagination_to_append = $(response).find('.row-navigation');
10904					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
10905
10906					// Remember open/closed widgets
10907					var widgets = $('.uncode_widget');
10908					var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append;
10909					var widgets_states = [];
10910
10911					widgets.each(function() {
10912						var widget = $(this);
10913						var id = widget.attr('data-id');
10914						var state = {
10915							'id': id,
10916							'collapse': false,
10917							'open': false,
10918							'css': false,
10919						};
10920
10921						var collapse_wrapper = widget.find('.widget-collapse-content');
10922
10923						if (collapse_wrapper.length > 0) {
10924							state.collapse = true;
10925
10926							var collapse_wrapper_css = collapse_wrapper.attr('style');
10927							var title = widget.find('.widget-title');
10928
10929							state.css = collapse_wrapper_css;
10930
10931							if (title.hasClass('open')) {
10932								state.open = true;
10933							} else {
10934								state.open = false;
10935							}
10936						}
10937
10938						widgets_states.push(state);
10939					});
10940
10941					// Update widgets state
10942					if (offcanvas_sidebar_wrapper.length === 0) {
10943						update_widgets_state(widgets_states, container_to_append);
10944					}
10945
10946					// Update default sidebar state
10947					if (!container.hasClass('ajax-hide-filters')) {
10948						container_to_append.removeClass('ajax-hide-filters');
10949					}
10950
10951					// Update horizontal sidebar
10952					if (!container.hasClass('ajax-hide-filters-blanks')) {
10953						container_to_append.removeClass('ajax-hide-filters-blanks');
10954					}
10955					var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal');
10956					if (horizontal_sidebar_wrapper.length > 0) {
10957						var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar');
10958						var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style');
10959						var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0);
10960						var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style');
10961
10962						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style);
10963						container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style);
10964					}
10965
10966					// Append container
10967					container.replaceWith(container_to_append);
10968
10969					// Append pagination
10970					if (pagination.length > 0) {
10971						if (pagination_to_append.length > 0) {
10972							pagination.html(pagination_to_append.html());
10973						} else {
10974							pagination.html('');
10975						}
10976					} else {
10977						if (pagination_to_append.length > 0) {
10978							$('.post-wrapper').append(pagination_to_append);
10979						}
10980					}
10981
10982					// Update off canvas sidebar (mobile and overlay)
10983					var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
10984
10985					if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) {
10986						var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0);
10987						var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0);
10988						container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />');
10989						container_to_append.find('.ajax-filter-sidebar-wrapper').remove();
10990
10991						// Update widgets state
10992						update_widgets_state(widgets_states, sidebar_to_append);
10993
10994						// Update sidebar
10995						sidebar_container.html(sidebar_to_append.html());
10996					}
10997
10998					if (push) {
10999						UNCODE.lastURL = url;
11000						window.history.pushState(
11001							{ pageTitle: document.title },
11002							'',
11003							url
11004						);
11005					}
11006
11007					if (typeof UNCODE.isotopeLayout !== 'undefined') {
11008						UNCODE.isotopeLayout();
11009					}
11010					if (typeof UNCODE.justifiedGallery !== 'undefined') {
11011						UNCODE.justifiedGallery();
11012					}
11013					if (typeof UNCODE.cssGrid !== 'undefined') {
11014						UNCODE.cssGrid();
11015					}
11016					if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
11017						UNCODE.lightbox();
11018					}
11019					if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
11020						UNCODE.lightgallery();
11021					}
11022					if (typeof UNCODE.carousel !== 'undefined') {
11023						UNCODE.carousel($('body'));
11024					}
11025					UNCODE.animations();
11026					if (typeof UNCODE.filters !== 'undefined') {
11027						UNCODE.filters();
11028					}
11029					if (typeof UNCODE.widgets !== 'undefined') {
11030						UNCODE.widgets();
11031					}
11032
11033					if (SiteParameters.dynamic_srcset_active === '1') {
11034						UNCODE.refresh_dynamic_srcset_size();
11035					}
11036
11037					if (typeof UNCODE.menuSmartInit !== 'undefined') {
11038						UNCODE.menuSmartInit();
11039					}
11040
11041					if (typeof UNCODE.parallax !== 'undefined') {
11042						UNCODE.parallax();
11043					}
11044
11045					maybe_scroll_to_top();
11046
11047					$(document).trigger('uncode-ajax-filtered');
11048					$(document.body).trigger('init_price_filter');
11049				}
11050			},
11051			error: function() {
11052				container.removeClass('grid-filtering');
11053
11054				if (SiteParameters.enable_debug == true) {
11055					// This console log is disabled by default
11056					// So nothing is printed in a typical installation
11057					//
11058					// It can be enabled for debugging purposes setting
11059					// the 'uncode_enable_debug_on_js_scripts' filter to true
11060					console.log('There was an error retrieving the products');
11061				}
11062			}
11063		});
11064	}
11065
11066	// Scroll to top after filtering
11067	function maybe_scroll_to_top() {
11068		var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas');
11069
11070		if (offcanvas_sidebar_wrapper.length > 0) {
11071			return;
11072		}
11073
11074		var container = get_filters_container();
11075		var bound = container[0].getBoundingClientRect();
11076
11077		if (bound.y < 0) {
11078			$(window).scrollTop(container.offset().top);
11079		}
11080	}
11081
11082	// Back/forward browser buttons
11083	$(window).on("popstate.ajaxfilters", function(e) {
11084		var location = window.location;
11085		var url = location.href;
11086		var params = UNCODE.getURLParams(window.location);
11087		var old_params = UNCODE.getURLParams(UNCODE.lastURL, true);
11088
11089		UNCODE.lastURL = url;
11090
11091		if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) {
11092			return;
11093		}
11094
11095		var container = get_filters_container();
11096
11097		reload_items(container, url, false);
11098	});
11099
11100	// Destroy load more before to init a new one
11101	$(window).on('uncode-ajax-pre-filtered', function() {
11102		if ($.fn.infinitescroll) {
11103			$('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy');
11104		}
11105	});
11106
11107	init_filters();
11108};
11109
11110UNCODE.videoThumbs = function() {
11111	var checkResize,
11112		newW = UNCODE.wwidth;
11113	var checkForVideos = function(){
11114
11115		$(window).on('okevents.y.change', function(e, y){
11116			var $video = $(y.target.g),
11117				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11118				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11119				restart = !$video_wrap.hasClass('play-pause'),
11120				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') 
11120: $video.closest('.t-entry-visual'),
11121				setTime;
11122			if ( newW >= UNCODE.mediaQuery ) {
11123
11124				if( $video_wrap.length && $video_wrap.data('hovered') !== true ) {
11125					$video_wrap.data('hovered', true);
11126					$video_wrap.addClass('played-on');
11127					y.target.pauseVideo();
11128					$tmb.on('mouseenter', function(){
11129						if ( restart ) {
11130							y.target.seekTo(0);
11131						}
11132						y.target.playVideo();
11133					}).on('mouseleave', function(){
11134						clearTimeout(setTime);
11135						setTime = setTimeout(function(){
11136							y.target.pauseVideo();
11137						}, 300);
11138					});
11139				}
11140
11141			} else {
11142				if( $mobile_video_wrap.length ) {
11143					$video_wrap.addClass('played-on');
11144					y.target.playVideo();
11145				}
11146			}
11147
11148		});
11149
11150		$(window).on('okevents.v.loaded', function(e, playerV){
11151			var $video = $(playerV.element),
11152				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11153				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11154				restart = !$video_wrap.hasClass('play-pause'),
11155				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual'),
11156				setTime;
11157
11158			if ( newW >= UNCODE.mediaQuery ) {
11159				
11160				if( $video_wrap.length ) {
11161
11162					var playPromise = playerV.play();
11163					if (playPromise !== undefined) {
11164						playPromise.then(function( value ) {
11165							playerV.pause();
11166						});
11167					}
11168					$video_wrap.addClass('played-on');
11169					$tmb.on('mouseenter', function(){
11170						if ( restart ) {
11171							playerV.setCurrentTime(0)
11172						}
11173						playerV.play();
11174					}).on('mouseleave', function(){
11175						clearTimeout(setTime);
11176						setTime = setTimeout(function(){
11177							playerV.pause();
11178						}, 300);
11179					});
11180				}
11181
11182			} else {
11183
11184				if( $mobile_video_wrap.length ) {
11185					var playPromise = playerV.play();
11186					if (playPromise !== undefined) {
11187						playPromise.then(function( value ) {
11188							playerV.play();
11189						});
11190					}
11191					$video_wrap.addClass('played-on');
11192				}
11193			}
11194		});
11195
11196		$('.fluid-object.self-video.is-no-control video').each(function(key, video){
11197			var $video = $(video),
11198				$noscript = $('noscript', $video),
11199				$video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'),
11200				restart = !$video_wrap.hasClass('play-pause'),
11201				$mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'),
11202				$tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual'),
11203				setTime,
11204			manageVideo = function(){
11205				video.currentTime = 0;
11206				video.pause();
11207				if ( newW >= UNCODE.mediaQuery ) {
11208					if ( $video_wrap.length ) {
11209						$video_wrap.addClass('played-on');
11210						$tmb.on('mouseenter', function(){
11211							if ( restart ) {
11212								video.currentTime = 0;
11213							}
11214							video.play();
11215						}).on('mouseleave', function(){
11216							clearTimeout(setTime);
11217							setTime = setTimeout(function(){
11218								video.pause();
11219							}, 300);
11220						});
11221					} else {
11222						video.play();
11223					}
11224				} else {
11225					if ( $mobile_video_wrap.length ) {
11226						$mobile_video_wrap.addClass('played-on');
11227						video.play();
11228					}
11229				}
11230
11231			};
11232			if ( $noscript.length && newW >= UNCODE.mediaQuery ) {
11233				$noscript.each(function(key, val){
11234					$noscript.after(val.textContent || val.innerText);
11235					$noscript.remove();
11236				});
11237			}
11238
11239			if (typeof MediaElement === "function") {
11240				$video.has('source[src]').mediaelementplayer({
11241					pauseOtherPlayers: false,
11242				});
11243			}
11244			if (video.readyState > 0) {
11245				manageVideo();
11246			} else {
11247				$video.on("loadedmetadata", function(_event) {
11248					manageVideo();
11249				});
11250			};
11251		});
11252	
11253	};
11254	
11255	checkForVideos();
11256
11257	var checkVideoResize = function(){
11258		clearRequestTimeout(checkResize);
11259		checkResize = requestTimeout(function(){
11260			if ( newW !== UNCODE.wwidth ) {
11261				checkForVideos();
11262				newW = UNCODE.wwidth;
11263			}
11264		}, 1000);
11265	};
11266
11267	$(window).off('resize.videos', checkVideoResize)
11268	.on( 'resize.videos', checkVideoResize);
11269
11270};
11271UNCODE.lottie = function() {
11272    if ( SiteParameters.is_frontend_editor ) {
11273        var $lottie_wraps = $('div.uncode-lottie-wrap');
11274        $lottie_wraps.each(function(){
11275            var $lottie_wrap = $(this),
11276                $div_player = $('div.uncode-lottie-player', $lottie_wrap),
11277                $player_clone = $div_player.clone(),
11278                player_id = $div_player.attr('data-id'),
11279                $lottie_players = $('lottie-player', $lottie_wrap).remove();
11280            if ( $div_player.attr('data-init') !== true && $player_clone.length ) {
11281                if ( $('#'+player_id).length ) {
11282                    player_id += '_' + Math.floor(Math.random() * 10000000000000000);
11283                }
11284                $player_clone.attr('id', player_id);
11285                $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player");
11286                $div_player.after($player_clone);
11287                $div_player.attr('data-init',true);
11288            }
11289        });
11290    }
11291    var $players = $('.uncode-lottie-wrap lottie-player');
11292    $players.each(function(){
11293        var player = this,
11294            this_id = $(player).attr('id'),
11295            _player = document.getElementById(this_id),
11296            trigger = $(player).attr('data-trigger'),
11297            pFrames = $(player).attr('data-frames').split(','),
11298            srcPlayer = $(player).attr('src');
11299
11300        _player.load(srcPlayer);
11301
11302        _player.addEventListener("ready", function() {
11303
11304            var $_shadow = _player.shadowRoot;
11305            $($_shadow).find('.error').remove();
11306
11307            var tFrames = _player.getLottie().totalFrames / 100,
11308                pFrame_from = Math.round(tFrames * pFrames[0]),
11309                pFrame_to = Math.round( tFrames * pFrames[1] ) - 1,
11310                loop = $(player).attr('loop'),
11311                mode,
11312                actions;
11313
11314            if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) {
11315                if ( trigger === 'scroll' ) {
11316                    mode = 'scroll';
11317                    actions = [
11318                        {
11319                            visibility:[0, 1.0],
11320                            type: "seek",
11321                            frames: [pFrame_from, pFrame_to],
11322                        }
11323                    ];
11324                } else if ( trigger === 'viewport') {
11325                    mode = 'scroll';
11326                    actions = [
11327                        {
11328                            visibility: [0.20, 1.0],
11329                            frames: [pFrame_from, pFrame_to],
11330                            type: loop ? "loop" : "play"
11331                        }
11332                    ];
11333                } else if ( trigger === 'hover') {
11334                    $(player).on('mouseenter', function(){
11335                        _player.play();
11336                    }).on('mouseleave', function(){
11337                        _player.pause();
11338                    });
11339                    if ( pFrame_from > 0 && pFrame_from < 99 ) {
11340                        _player.seek(pFrame_from);
11341                        _player.addEventListener("frame", function(){
11342                            if ( _player.getLottie().currentFrame >= pFrame_to ) {
11343                                _player.seek(pFrame_from);
11344                            }
11345                        });
11346                    }
11347                }
11348                LottieInteractivity.create({
11349                    player: '#' + this_id,
11350                    mode: mode,
11351                    actions: actions
11352                });
11353            } else {
11354                if ( pFrame_from > 0 && pFrame_from < 99 ) {
11355                    _player.seek(pFrame_from);
11356                    _player.addEventListener("frame", function(){
11357                        if ( _player.getLottie().currentFrame >= pFrame_to ) {
11358                            _player.seek(pFrame_from);
11359                        }
11360                    });
11361                }
11362            }
11363        });
11364
11365        $(window).on('unlottie-destroy', function(){
11366            _player.destroy();
11367        });
11368    });
11369};
11370
11371	UNCODE.init = function() {
11372		var wfl_check = false, wfl_request, waypoint_request;
11373		UNCODE.preventDoubleTransition();
11374		UNCODE.betterResize();
11375		UNCODE.utils();
11376		if (typeof UNCODE.changeSkinOnScroll !== 'undefined') {
11377			UNCODE.changeSkinOnScroll();
11378		}
11379		if (typeof UNCODE.share !== 'undefined') {
11380			UNCODE.share();
11381		}
11382		if (typeof UNCODE.tooltip !== 'undefined') {
11383			UNCODE.tooltip();
11384		}
11385		if (typeof UNCODE.counters !== 'undefined') {
11386			UNCODE.counters();
11387		}
11388		if (typeof UNCODE.countdowns !== 'undefined') {
11389			UNCODE.countdowns();
11390		}
11391		if (typeof UNCODE.tabs !== 'undefined') {
11392			UNCODE.tabs();
11393		}
11394		if (typeof UNCODE.collapse !== 'undefined') {
11395			UNCODE.collapse();
11396		}
11397		if (typeof UNCODE.bigText !== 'undefined') {
11398			UNCODE.bigText();
11399		}
11400		UNCODE.menuSystem();
11401		if (typeof UNCODE.bgChanger !== 'undefined') {
11402			UNCODE.bgChanger();
11403		}
11404		if (typeof UNCODE.magicCursor !== 'undefined') {
11405			UNCODE.magicCursor();
11406		}
11407		if (typeof UNCODE.magneticCursor !== 'undefined') {
11408			UNCODE.magneticCursor();
11409		}
11410		if (typeof UNCODE.dropImage !== 'undefined') {
11411			UNCODE.dropImage();
11412		}
11413		if (typeof UNCODE.postTable !== 'undefined') {
11414			UNCODE.postTable();
11415		}
11416		if (typeof UNCODE.rotatingTxt !== 'undefined') {
11417			UNCODE.rotatingTxt();
11418		}
11419		if (typeof UNCODE.okvideo !== 'undefined') {
11420			UNCODE.okvideo();
11421		}
11422		if (typeof UNCODE.backgroundSelfVideos !== 'undefined') {
11423			UNCODE.backgroundSelfVideos();
11424		}
11425		UNCODE.tapHover();
11426		if (typeof UNCODE.isotopeLayout !== 'undefined') {
11427			UNCODE.isotopeLayout();
11428		}
11429		if (typeof UNCODE.justifiedGallery !== 'undefined') {
11430			UNCODE.justifiedGallery();
11431		}
11432		if (typeof UNCODE.cssGrid !== 'undefined') {
11433			UNCODE.cssGrid();
11434		}
11435		if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) {
11436			UNCODE.lightbox();
11437		}
11438		if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) {
11439			$(window).on('load',function(){
11440				UNCODE.lightgallery();
11441			});
11442		}
11443		if (typeof UNCODE.carousel !== 'undefined') {
11444			UNCODE.carousel($('body'));
11445		}
11446		if (typeof UNCODE.lettering !== 'undefined') {
11447			UNCODE.lettering();
11448		}
11449		UNCODE.animations();
11450		if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) {
11451			UNCODE.stickyElements();
11452		}
11453		if (typeof UNCODE.twentytwenty !== 'undefined') {
11454			UNCODE.twentytwenty();
11455		}
11456		UNCODE.disableHoverScroll();
11457		UNCODE.printScreen();
11458		if (typeof UNCODE.particles !== 'undefined') {
11459			UNCODE.particles();
11460		}
11461		if (typeof UNCODE.filters !== 'undefined') {
11462			UNCODE.filters();
11463		}
11464		if (typeof UNCODE.ajax_filters !== 'undefined') {
11465			UNCODE.ajax_filters();
11466		}
11467		if (typeof UNCODE.widgets !== 'undefined') {
11468			UNCODE.widgets();
11469		}
11470		if (typeof UNCODE.unmodal !== 'undefined') {
11471			UNCODE.unmodal();
11472		}
11473		if (typeof UNCODE.checkScrollForTabs !== 'undefined') {
11474			if ( !UNCODE.isFullPage ) {
11475				UNCODE.checkScrollForTabs();
11476			}
11477		}
11478		if (typeof UNCODE.onePage !== 'undefined') {
11479			UNCODE.onePage(UNCODE.isMobile);
11480		}
11481		if (typeof UNCODE.fullPage !== 'undefined') {
11482			$(document).ready(function(){
11483				UNCODE.fullPage();
11484			});
11485		}
11486		if (typeof UNCODE.skewIt !== 'undefined') {
11487			UNCODE.skewIt();
11488		}
11489		if (typeof UNCODE.rotateIt !== 'undefined') {
11490			UNCODE.rotateIt();
11491		}
11492		if (typeof UNCODE.textMarquee !== 'undefined') {
11493			UNCODE.textMarquee();
11494		}
11495		if (typeof UNCODE.stickyScroll !== 'undefined') {
11496			UNCODE.stickyScroll();
11497		}
11498		if (typeof UNCODE.stickyTrigger !== 'undefined') {
11499			UNCODE.stickyTrigger();
11500		}
11501		if (typeof UNCODE.verticalText !== 'undefined') {
11502			UNCODE.verticalText();
11503		}
11504		if (typeof UNCODE.videoThumbs !== 'undefined') {
11505			UNCODE.videoThumbs();
11506		}
11507		if (typeof UNCODE.revslider !== 'undefined') {
11508			UNCODE.revslider();
11509		}
11510		if (typeof UNCODE.layerslider !== 'undefined') {
11511			UNCODE.layerslider();
11512		}
11513		if (typeof UNCODE.lottie !== 'undefined') {
11514			UNCODE.lottie();
11515		}
11516		$(window).on('load',function(){
11517			clearRequestTimeout(waypoint_request);
11518			waypoint_request = requestTimeout( function(){
11519				Waypoint.refreshAll();
11520			}, 1000);
11521
11522			if (typeof UNCODE.parallax !== 'undefined') {
11523				UNCODE.parallax();
11524			}
11525		});
11526	}
11527
11528	if ( ! SiteParameters.is_frontend_editor ) {
11529		UNCODE.init();
11530	}
11531
11532
11533})(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.